vault backup: 2026-10-06 15:01:10

This commit is contained in:
ben committed 2026-10-06 15:01:11 -07:00
1 parent eefe4d67b0
commit 3385a3de64
11 files changed
+600 -351

No files matched your search

+7 -7
View File
@@ -1,4 +1,4 @@
"use strict";var t=require("obsidian");function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,n={},i={};var a,o,s={},l={};function u(){if(a)return l;a=1,Object.defineProperty(l,"__esModule",{value:!0}),l.PrioritizedList=void 0;var t=function(){function t(){this.items=[],this.items=[]}return t.prototype[Symbol.iterator]=function(){var t=0,e=this.items;return{next:function(){return{value:e[t++],done:t>e.length}}}},t.prototype.add=function(e,r){void 0===r&&(r=t.DEFAULTPRIORITY);var n=this.items.length;do{n--}while(n>=0&&r<this.items[n].priority);return this.items.splice(n+1,0,{item:e,priority:r}),e},t.prototype.remove=function(t){var e=this.items.length;do{e--}while(e>=0&&this.items[e].item!==t);e>=0&&this.items.splice(e,1)},t.DEFAULTPRIORITY=5,t}();return l.PrioritizedList=t,l}var h,d,p={};function T(){if(h)return p;return h=1,Object.defineProperty(p,"__esModule",{value:!0}),p.retryAfter=p.handleRetriesFor=void 0,p.handleRetriesFor=function(t){return new Promise(function e(r,n){try{r(t())}catch(t){t.retry&&t.retry instanceof Promise?t.retry.then(function(){return e(r,n)}).catch(function(t){return n(t)}):t.restart&&t.restart.isCallback?MathJax.Callback.After(function(){return e(r,n)},t.restart):n(t)}})},p.retryAfter=function(t){var e=new Error("MathJax retry");throw e.retry=t,e},p}function f(){return d||(d=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.mathjax=void 0;var e=(r||(r=1,Object.defineProperty(i,"__esModule",{value:!0}),i.VERSION=void 0,i.VERSION="3.2.2"),i),n=function(){if(o)return s;o=1;var t,e=s&&s.__extends||(t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),r=s&&s.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0}),s.HandlerList=void 0;var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.register=function(t){return this.add(t,t.priority)},n.prototype.unregister=function(t){this.remove(t)},n.prototype.handlesDocument=function(t){var e,n;try{for(var i=r(this),a=i.next();!a.done;a=i.next()){var o=a.value.item;if(o.handlesDocument(t))return o}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}throw new Error("Can't find handler for document")},n.prototype.document=function(t,e){return void 0===e&&(e=null),this.handlesDocument(t).create(t,e)},n}(u().PrioritizedList);return s.HandlerList=n,s}(),a=T();t.mathjax={version:e.VERSION,handlers:new n.HandlerList,document:function(e,r){return t.mathjax.handlers.document(e,r)},handleRetriesFor:a.handleRetriesFor,retryAfter:a.retryAfter,asyncLoad:null}}(n)),n}var Q,g=f(),y={},m={},v={};function b(){return Q||(Q=1,function(t){var e=v&&v.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=v&&v.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},n=v&&v.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,i=0,a=e.length;i<a;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(t,"__esModule",{value:!0}),t.lookup=t.separateOptions=t.selectOptionsFromKeys=t.selectOptions=t.userOptions=t.defaultOptions=t.insert=t.copy=t.keys=t.makeArray=t.expandable=t.Expandable=t.OPTIONS=t.REMOVE=t.APPEND=t.isObject=void 0;var i={}.constructor;function a(t){return"object"==typeof t&&null!==t&&(t.constructor===i||t.constructor===o)}t.isObject=a,t.APPEND="[+]",t.REMOVE="[-]",t.OPTIONS={invalidOption:"warn",optionError:function(e,r){if("fatal"===t.OPTIONS.invalidOption)throw new Error(e);console.warn("MathJax: "+e)}};var o=function(){};function s(t){return Object.assign(Object.create(o.prototype),t)}function l(t){return t?Object.keys(t).concat(Object.getOwnPropertySymbols(t)):[]}function c(t){var r,n,i={};try{for(var h=e(l(t)),d=h.next();!d.done;dLine truncated
"use strict";var t=require("obsidian");function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,n={},i={};var a,o,s={},l={};function u(){if(a)return l;a=1,Object.defineProperty(l,"__esModule",{value:!0}),l.PrioritizedList=void 0;var t=function(){function t(){this.items=[],this.items=[]}return t.prototype[Symbol.iterator]=function(){var t=0,e=this.items;return{next:function(){return{value:e[t++],done:t>e.length}}}},t.prototype.add=function(e,r){void 0===r&&(r=t.DEFAULTPRIORITY);var n=this.items.length;do{n--}while(n>=0&&r<this.items[n].priority);return this.items.splice(n+1,0,{item:e,priority:r}),e},t.prototype.remove=function(t){var e=this.items.length;do{e--}while(e>=0&&this.items[e].item!==t);e>=0&&this.items.splice(e,1)},t.DEFAULTPRIORITY=5,t}();return l.PrioritizedList=t,l}var h,d,p={};function T(){if(h)return p;return h=1,Object.defineProperty(p,"__esModule",{value:!0}),p.retryAfter=p.handleRetriesFor=void 0,p.handleRetriesFor=function(t){return new Promise(function e(r,n){try{r(t())}catch(t){t.retry&&t.retry instanceof Promise?t.retry.then(function(){return e(r,n)}).catch(function(t){return n(t)}):t.restart&&t.restart.isCallback?MathJax.Callback.After(function(){return e(r,n)},t.restart):n(t)}})},p.retryAfter=function(t){var e=new Error("MathJax retry");throw e.retry=t,e},p}function f(){return d||(d=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.mathjax=void 0;var e=(r||(r=1,Object.defineProperty(i,"__esModule",{value:!0}),i.VERSION=void 0,i.VERSION="3.2.2"),i),n=function(){if(o)return s;o=1;var t,e=s&&s.__extends||(t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),r=s&&s.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0}),s.HandlerList=void 0;var n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.register=function(t){return this.add(t,t.priority)},n.prototype.unregister=function(t){this.remove(t)},n.prototype.handlesDocument=function(t){var e,n;try{for(var i=r(this),a=i.next();!a.done;a=i.next()){var o=a.value.item;if(o.handlesDocument(t))return o}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}throw new Error("Can't find handler for document")},n.prototype.document=function(t,e){return void 0===e&&(e=null),this.handlesDocument(t).create(t,e)},n}(u().PrioritizedList);return s.HandlerList=n,s}(),a=T();t.mathjax={version:e.VERSION,handlers:new n.HandlerList,document:function(e,r){return t.mathjax.handlers.document(e,r)},handleRetriesFor:a.handleRetriesFor,retryAfter:a.retryAfter,asyncLoad:null}}(n)),n}var Q,g=f(),y={},m={},v={};function b(){return Q||(Q=1,function(t){var e=v&&v.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},r=v&&v.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},n=v&&v.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,i=0,a=e.length;i<a;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(t,"__esModule",{value:!0}),t.lookup=t.separateOptions=t.selectOptionsFromKeys=t.selectOptions=t.userOptions=t.defaultOptions=t.insert=t.copy=t.keys=t.makeArray=t.expandable=t.Expandable=t.OPTIONS=t.REMOVE=t.APPEND=t.isObject=void 0;var i={}.constructor;function a(t){return"object"==typeof t&&null!==t&&(t.constructor===i||t.constructor===o)}t.isObject=a,t.APPEND="[+]",t.REMOVE="[-]",t.OPTIONS={invalidOption:"warn",optionError:function(e,r){if("fatal"===t.OPTIONS.invalidOption)throw new Error(e);console.warn("MathJax: "+e)}};var o=function(){};function s(t){return Object.assign(Object.create(o.prototype),t)}function l(t){return t?Object.keys(t).concat(Object.getOwnPropertySymbols(t)):[]}function c(t){var r,n,i={};try{for(var h=e(l(t)),d=h.next();!d.done;dLine truncated
/*!
*************************************************************************
*
@@ -31,21 +31,21 @@
* https://github.com/mhchem/mhchemParser
*
*/
Object.defineProperty(rd,"__esModule",{value:!0}),rd.mhchemParser=void 0;var t=function(){function t(){}return t.toTex=function(t,e){return n.go(r.go(t,e),"tex"!==e)},t}();function e(t){var e,r,n={};for(e in t)for(r in t[e]){var i=r.split("|");t[e][r].stateArray=i;for(var a=0;a<i.length;a++)n[i[a]]=[]}for(e in t)for(r in t[e])for(i=t[e][r].stateArray||[],a=0;a<i.length;a++){var o=t[e][r];o.action_=[].concat(o.action_);for(var s=0;s<o.action_.length;s++)"string"==typeof o.action_[s]&&(o.action_[s]={type_:o.action_[s]});for(var l=e.split("|"),c=0;c<l.length;c++)if("*"===i[a]){var u=void 0;for(u in n)n[u].push({pattern:l[c],task:o})}else n[i[a]].push({pattern:l[c],task:o})}return n}rd.mhchemParser=t;var r={go:function(t,e){if(!t)return[];void 0===e&&(e="ce");var n,i="0",a={parenthesisLevel:0};t=(t=(t=t.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var o=10,s=[];;){n!==t?(o=10,n=t):o--;var l=r.stateMachines[e],c=l.transitions[i]||l.transitions["*"];t:for(var u=0;u<c.length;u++){var h=r.patterns.match_(c[u].pattern,t);if(h){for(var d=c[u].task,p=0;p<d.action_.length;p++){var T=void 0;if(l.actions[d.action_[p].type_])T=l.actions[d.action_[p].type_](a,h.match_,d.action_[p].option);else{if(!r.actions[d.action_[p].type_])throw["MhchemBugA","mhchem bug A. Please report. ("+d.action_[p].type_+")"];T=r.actions[d.action_[p].type_](a,h.match_,d.action_[p].option)}r.concatArray(s,T)}if(i=d.nextState||i,!(t.length>0))return s;if(d.revisit||(t=h.remainder),!d.toContinue)break t}}if(o<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(t,e){if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++)t.push(e[r]);else t.push(e)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(t){var e=t.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return e&&e[0]?{match_:e.slice(1),remainder:t.substr(e[0].length)}:null},"(-)(9)^(-9)":/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/,"state of aggregation $":function(t){var e=r.patterns.findObserveGroups(t,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(e&&e.remainder.match(/^($|[\s,;\)\]\}])/))return e;var n=t.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return n?{match_:n[0],remainder:t.substr(n[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". __* ":/^([.\u22C5\u00B7\u2022]|[*])\s*/,"...":/^\.\.\.(?=$|[^.])/,"^{(...)}":function(t){return r.patterns.findObserveGroups(t,"^{","","","}")},"^($...$)":function(t){return r.patterns.findObserveGroups(t,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(t){return r.patterns.findObserveGroups(t,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(t){return r.patterns.findObserveGroups(t,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(t){return r.patterns.findObserveGroups(t,"_{","","","}")},"_($...$)":function(t){return r.patterns.findObserveGroups(t,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(t){return r.patterns.findObserveGroups(t,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(t){return r.patterns.findObserveGroups(t,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}^":/^\{\}(?=\^)/,"{}":/^\{\}/,"{...}":function(t){return r.patterns.findObserveGroups(t,"","{","}","")},"{(...)}":function(t){return r.patterns.findObserveGroups(t,"{","","","}")},"$...$":function(t){return r.patterns.findObserveGroups(t,"","$","$","")},"${(...)}$__$(...)$":function(t){return r.patterns.findObserveGroups(t,"${","","","}$")||r.patLine truncated
Object.defineProperty(Xh,"__esModule",{value:!0}),Xh.mhchemParser=void 0;var t=function(){function t(){}return t.toTex=function(t,e){return n.go(r.go(t,e),"tex"!==e)},t}();function e(t){var e,r,n={};for(e in t)for(r in t[e]){var i=r.split("|");t[e][r].stateArray=i;for(var a=0;a<i.length;a++)n[i[a]]=[]}for(e in t)for(r in t[e])for(i=t[e][r].stateArray||[],a=0;a<i.length;a++){var o=t[e][r];o.action_=[].concat(o.action_);for(var s=0;s<o.action_.length;s++)"string"==typeof o.action_[s]&&(o.action_[s]={type_:o.action_[s]});for(var l=e.split("|"),c=0;c<l.length;c++)if("*"===i[a]){var u=void 0;for(u in n)n[u].push({pattern:l[c],task:o})}else n[i[a]].push({pattern:l[c],task:o})}return n}Xh.mhchemParser=t;var r={go:function(t,e){if(!t)return[];void 0===e&&(e="ce");var n,i="0",a={parenthesisLevel:0};t=(t=(t=t.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var o=10,s=[];;){n!==t?(o=10,n=t):o--;var l=r.stateMachines[e],c=l.transitions[i]||l.transitions["*"];t:for(var u=0;u<c.length;u++){var h=r.patterns.match_(c[u].pattern,t);if(h){for(var d=c[u].task,p=0;p<d.action_.length;p++){var T=void 0;if(l.actions[d.action_[p].type_])T=l.actions[d.action_[p].type_](a,h.match_,d.action_[p].option);else{if(!r.actions[d.action_[p].type_])throw["MhchemBugA","mhchem bug A. Please report. ("+d.action_[p].type_+")"];T=r.actions[d.action_[p].type_](a,h.match_,d.action_[p].option)}r.concatArray(s,T)}if(i=d.nextState||i,!(t.length>0))return s;if(d.revisit||(t=h.remainder),!d.toContinue)break t}}if(o<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(t,e){if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++)t.push(e[r]);else t.push(e)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(t){var e=t.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return e&&e[0]?{match_:e.slice(1),remainder:t.substr(e[0].length)}:null},"(-)(9)^(-9)":/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/,"state of aggregation $":function(t){var e=r.patterns.findObserveGroups(t,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(e&&e.remainder.match(/^($|[\s,;\)\]\}])/))return e;var n=t.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return n?{match_:n[0],remainder:t.substr(n[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". __* ":/^([.\u22C5\u00B7\u2022]|[*])\s*/,"...":/^\.\.\.(?=$|[^.])/,"^{(...)}":function(t){return r.patterns.findObserveGroups(t,"^{","","","}")},"^($...$)":function(t){return r.patterns.findObserveGroups(t,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(t){return r.patterns.findObserveGroups(t,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(t){return r.patterns.findObserveGroups(t,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(t){return r.patterns.findObserveGroups(t,"_{","","","}")},"_($...$)":function(t){return r.patterns.findObserveGroups(t,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(t){return r.patterns.findObserveGroups(t,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(t){return r.patterns.findObserveGroups(t,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}^":/^\{\}(?=\^)/,"{}":/^\{\}/,"{...}":function(t){return r.patterns.findObserveGroups(t,"","{","}","")},"{(...)}":function(t){return r.patterns.findObserveGroups(t,"{","","","}")},"$...$":function(t){return r.patterns.findObserveGroups(t,"","$","$","")},"${(...)}$__$(...)$":function(t){return r.patterns.findObserveGroups(t,"${","","","}$")||r.patLine truncated
/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */
function PT(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function VT(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,a,o,s=[],l=!0,c=!1;try{if(a=(r=r.call(t)).next,0===e);else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return PT(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?PT(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const DT=Object.entries,BT=Object.setPrototypeOf,$T=Object.isFrozen,FT=Object.getPrototypeOf,jT=Object.getOwnPropertyDescriptor;let zT=Object.freeze,GT=Object.seal,qT=Object.create,WT="undefined"!=typeof Reflect&&Reflect,UT=WT.apply,YT=WT.construct;zT||(zT=function(t){return t}),GT||(GT=function(t){return t}),UT||(UT=function(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return t.apply(e,n)}),YT||(YT=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return new t(...r)});const XT=yf(Array.prototype.forEach),ZT=yf(Array.prototype.lastIndexOf),KT=yf(Array.prototype.pop),JT=yf(Array.prototype.push),tf=yf(Array.prototype.splice),ef=Array.isArray,rf=yf(String.prototype.toLowerCase),nf=yf(String.prototype.toString),af=yf(String.prototype.match),of=yf(String.prototype.replace),sf=yf(String.prototype.indexOf),lf=yf(String.prototype.trim),cf=yf(Number.prototype.toString),uf=yf(Boolean.prototype.toString),hf="undefined"==typeof BigInt?null:yf(BigInt.prototype.toString),df="undefined"==typeof Symbol?null:yf(Symbol.prototype.toString),pf=yf(Object.prototype.hasOwnProperty),Tf=yf(Object.prototype.toString),ff=yf(RegExp.prototype.test),Qf=(gf=TypeError,function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return YT(gf,e)});var gf;function yf(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return UT(t,e,n)}}function mf(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rf;if(BT&&BT(t,null),!ef(e))return t;let n=e.length;for(;n--;){let i=e[n];if("string"==typeof i){const t=r(i);t!==i&&($T(e)||(e[n]=t),i=t)}t[i]=!0}return t}function vf(t){for(let e=0;e<t.length;e++){pf(t,e)||(t[e]=null)}return t}function bf(t){const e=qT(null);for(const n of DT(t)){var r=VT(n,2);const i=r[0],a=r[1];pf(t,i)&&(ef(a)?e[i]=vf(a):a&&"object"==typeof a&&a.constructor===Object?e[i]=bf(a):e[i]=a)}return e}function xf(t,e){for(;null!==t;){const r=jT(t,e);if(r){if(r.get)return yf(r.get);if("function"==typeof r.value)return yf(r.value)}t=FT(t)}return function(){return null}}const Lf=zT(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),wf=zT(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),_f=zT(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),kf=zT(["animate","color-profile","cursor","discard","font-face","font-face-format","fonLine truncated
function OT(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function NT(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,a,o,s=[],l=!0,c=!1;try{if(a=(r=r.call(t)).next,0===e);else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return OT(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?OT(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const IT=Object.entries,RT=Object.setPrototypeOf,PT=Object.isFrozen,VT=Object.getPrototypeOf,DT=Object.getOwnPropertyDescriptor;let BT=Object.freeze,$T=Object.seal,FT=Object.create,jT="undefined"!=typeof Reflect&&Reflect,zT=jT.apply,GT=jT.construct;BT||(BT=function(t){return t}),$T||($T=function(t){return t}),zT||(zT=function(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return t.apply(e,n)}),GT||(GT=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return new t(...r)});const qT=Tf(Array.prototype.forEach),WT=Tf(Array.prototype.lastIndexOf),UT=Tf(Array.prototype.pop),YT=Tf(Array.prototype.push),XT=Tf(Array.prototype.splice),ZT=Array.isArray,KT=Tf(String.prototype.toLowerCase),JT=Tf(String.prototype.toString),tf=Tf(String.prototype.match),ef=Tf(String.prototype.replace),rf=Tf(String.prototype.indexOf),nf=Tf(String.prototype.trim),af=Tf(Number.prototype.toString),of=Tf(Boolean.prototype.toString),sf="undefined"==typeof BigInt?null:Tf(BigInt.prototype.toString),lf="undefined"==typeof Symbol?null:Tf(Symbol.prototype.toString),cf=Tf(Object.prototype.hasOwnProperty),uf=Tf(Object.prototype.toString),hf=Tf(RegExp.prototype.test),df=(pf=TypeError,function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return GT(pf,e)});var pf;function Tf(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return zT(t,e,n)}}function ff(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:KT;if(RT&&RT(t,null),!ZT(e))return t;let n=e.length;for(;n--;){let i=e[n];if("string"==typeof i){const t=r(i);t!==i&&(PT(e)||(e[n]=t),i=t)}t[i]=!0}return t}function Qf(t){for(let e=0;e<t.length;e++){cf(t,e)||(t[e]=null)}return t}function gf(t){const e=FT(null);for(const n of IT(t)){var r=NT(n,2);const i=r[0],a=r[1];cf(t,i)&&(ZT(a)?e[i]=Qf(a):a&&"object"==typeof a&&a.constructor===Object?e[i]=gf(a):e[i]=a)}return e}function yf(t,e){for(;null!==t;){const r=DT(t,e);if(r){if(r.get)return Tf(r.get);if("function"==typeof r.value)return Tf(r.value)}t=VT(t)}return function(){return null}}const mf=BT(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),vf=BT(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bf=BT(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xf=BT(["animate","color-profile","cursor","discard","font-face","font-face-format","fonLine truncated
/*! Check if previously processed */
/*!
* Wait for document loaded before starting the execution
*/
const pF=t=>t.replace(/\s*!important\s*$/i,"").trim(),TF=(t,e)=>{let r=e;for(;r<t.length&&/\s/.test(t[r]);)r+=1;const n=r;for(;r<t.length&&/[a-z-]/i.test(t[r]);)r+=1;if(r===n)return!1;for(;r<t.length&&/\s/.test(t[r]);)r+=1;return":"===t[r]},fF=t=>{const e=[];let r=0;for(;r<t.length;){for(;r<t.length&&/[\s;,]/.test(t[r]);)r+=1;if(r>=t.length)break;const n=r;for(;r<t.length&&":"!==t[r]&&";"!==t[r]&&","!==t[r];)r+=1;if(r>=t.length||":"!==t[r])break;const i=t.substring(n,r).trim().toLowerCase();r+=1;const a=r;let o=0,s=null;for(;r<t.length;){const e=t[r];if(s)e===s&&"\\"!==t[r-1]&&(s=null),r+=1;else if('"'!==e&&"'"!==e)if("("!==e)if(")"!==e){if(0===o){if(";"===e||","===e)break;if(/\s/.test(e)&&TF(t,r))break}r+=1}else o=Math.max(0,o-1),r+=1;else o+=1,r+=1;else s=e,r+=1}const l=pF(t.substring(a,r));i&&l&&e.push({property:i,value:l}),r<t.length&&(";"===t[r]||","===t[r])&&(r+=1)}return e},QF=t=>{const e=pF(t);if(!e)return!1;if("undefined"!=typeof CSS&&"function"==typeof CSS.supports)return CSS.supports("color",e);if("undefined"!=typeof document){const t=document.createElement("div");return t.style.color="",t.style.color=e,""!==t.style.color}return!1},gF=(t,e)=>{const r=t.getAttribute("style");return r&&fF(r).find(t=>t.property===e)?.value||""},yF=(...t)=>{for(const e of t){const t=pF(e||"");if(QF(t))return t}},mF=(t,e)=>{const r=t.querySelector("text, foreignObject, div, span, p")||t,n=yF(r.getAttribute?.("fill"),gF(r,"fill"),r.style?.fill);if(n)return n;const i=yF(r.getAttribute?.("color"),gF(r,"color"),r.style?.color);if(i)return i;const a=yF(e);return a||void 0},vF=(t,e,r)=>{switch(e){case dp.FILL:case dp.STROKE:QF(r)&&(t[e]=r);break;case dp.STROKE_WIDTH:case dp.STROKE_DASHARRAY:t[e]=r}},bF=(t,e,r)=>{e===hp.COLOR&&QF(r)&&(t[hp.COLOR]=r)},xF=(t,e,r)=>{t&&fF(t).forEach(({property:t,value:n})=>{vF(e,t,n),bF(r,t,n)})},LF=(t,e)=>{t&&fF(t).forEach(({property:t,value:r})=>{"fill"===t&&QF(r)?e[hp.COLOR]=r:bF(e,t,r)})},wF=(t,e)=>{if(!t)return;[[dp.FILL,t.getAttribute("fill")],[dp.STROKE,t.getAttribute("stroke")],[dp.STROKE_WIDTH,t.getAttribute("stroke-width")],[dp.STROKE_DASHARRAY,t.getAttribute("stroke-dasharray")]].forEach(([t,r])=>{const n=pF(r||"");n&&vF(e,t,n)})},_F=(t,e)=>{if(!t)return;const r=t.getAttribute("fill")||t.getAttribute("color"),n=pF(r||"");QF(n)&&(e[hp.COLOR]=n)},kF=(t,e,r,n)=>{if(!(e instanceof Map))return;const i=e.get(t);i&&(i.styles?.forEach(t=>{fF(t).forEach(({property:t,value:e})=>{vF(r,t,e),bF(n,t,e)})}),i.textStyles?.forEach(t=>{fF(t).forEach(({property:t,value:e})=>{bF(n,t,e)})}))},EF=(t,e,r)=>{const n=e.querySelector(`[id*="${t.domId}"]`);if(!n)return;let i;"a"===n.parentElement?.tagName.toLowerCase()&&(i=n.parentElement.getAttribute("xlink:href"));const a=SF(i?n.parentElement:n,e),o=n.getBBox(),s={width:o.width,height:o.height},l={},c={};t.classes&&r instanceof Map&&(Array.isArray(t.classes)?t.classes:[t.classes]).forEach(t=>{kF(t,r,l,c)}),t.styles?.forEach(t=>{xF(t,l,c)});const u=n.querySelector(".label-container");xF(u?.getAttribute("style"),l,c),wF(u,l);return Array.from(n.querySelectorAll(".label, .nodeLabel, .label text, .label tspan, .label span, .label div")).forEach(t=>{LF(t.getAttribute("style"),c),_F(t,c)}),{id:t.id,labelType:t.labelType,text:Gp(t.text||""),type:t.type,link:i||void 0,...a,...s,containerStyle:l,labelStyle:c}},SF=(t,e)=>{if(!t)throw new Error("Element not found");let r=t.parentElement?.parentElement;const n=t.childNodes[0];let i={x:0,y:0};if(n){const{transformX:t,transformY:e}=qp(n),r=n.getBBox();i={x:Number(n.getAttribute("x"))||t+r.x||0,y:Number(n.getAttribute("y"))||e+r.y||0}}const{transformX:a,transformY:o}=qp(t),s={x:a+i.x,y:o+i.y};for(;r&&r.id!==e.id;){if("root"===r.classList.value&&r.hasAttribute("transform")){const{transformX:t,transformY:e}=qp(r);s.x+=t,s.y+=e}r=r.parentElement}return s},CF=(t,e)=>{const r=t.getVertices(),n=t.getEdges(),i=t.getSubGraphs(),a=t.getClasses(),o={},s=a instanceof Map?a:{};r instanceof Map?r.forEach((t,r)=>{o[r]=EF(t,e,s)}):"object"==typeof r&&null!==r&&Object.entries(r).forEach(([t,r])=>{o[t]=EF(r,e,s)});const l=new Map,c=(Array.isArray(n)?n:[]).map(t=>{if(!e.querySelector(`[id*="${t.id}"]`))return null;const r=`${t.start}-${t.end}`,n=l.get(r)||0;return l.set(r,n+1),((t,e,r)=>{const n=r.querySelector(`[id*="${t.id}"]`);if(!n)throw new Error("Edge element not found");const i=SF(n,r),a=Zp(n,i);return t.length=void 0,{...t,...a,text:Gp(t.text)}})(t,0,e)}).filter(t=>null!==t&&t.reflectionPoints.length>1),u=(Array.isArray(i)?i:[]).map(t=>((t,e,r)=>{const n=t.nodes.map(t=>t.startsWith("flowchart-")?t.split("-")[1]:t),i=e.querySelector(`[id='${t.id}']`);if(!i)throw new Error("SubGraph element not found");const a=SF(i,e),o=i.getBBox(),s={width:o.width,height:o.height},l={},c={},u=i.querySelector(":scope > rect, :scope > path, :scope > polygon, :scope > ellipse")||i.querySelector(".cluster > rect, .cluster > path, .cluster > polygon, .cluster > ellipse")||i.querySelector("rect, path, polygon, ellipse");xF(i.getAttribute("style"),l,c),xF(Line truncated
const cF=t=>t.replace(/\s*!important\s*$/i,"").trim(),uF=(t,e)=>{let r=e;for(;r<t.length&&/\s/.test(t[r]);)r+=1;const n=r;for(;r<t.length&&/[a-z-]/i.test(t[r]);)r+=1;if(r===n)return!1;for(;r<t.length&&/\s/.test(t[r]);)r+=1;return":"===t[r]},hF=t=>{const e=[];let r=0;for(;r<t.length;){for(;r<t.length&&/[\s;,]/.test(t[r]);)r+=1;if(r>=t.length)break;const n=r;for(;r<t.length&&":"!==t[r]&&";"!==t[r]&&","!==t[r];)r+=1;if(r>=t.length||":"!==t[r])break;const i=t.substring(n,r).trim().toLowerCase();r+=1;const a=r;let o=0,s=null;for(;r<t.length;){const e=t[r];if(s)e===s&&"\\"!==t[r-1]&&(s=null),r+=1;else if('"'!==e&&"'"!==e)if("("!==e)if(")"!==e){if(0===o){if(";"===e||","===e)break;if(/\s/.test(e)&&uF(t,r))break}r+=1}else o=Math.max(0,o-1),r+=1;else o+=1,r+=1;else s=e,r+=1}const l=cF(t.substring(a,r));i&&l&&e.push({property:i,value:l}),r<t.length&&(";"===t[r]||","===t[r])&&(r+=1)}return e},dF=t=>{const e=cF(t);if(!e)return!1;if("undefined"!=typeof CSS&&"function"==typeof CSS.supports)return CSS.supports("color",e);if("undefined"!=typeof document){const t=document.createElement("div");return t.style.color="",t.style.color=e,""!==t.style.color}return!1},pF=(t,e)=>{const r=t.getAttribute("style");return r&&hF(r).find(t=>t.property===e)?.value||""},TF=(...t)=>{for(const e of t){const t=cF(e||"");if(dF(t))return t}},fF=(t,e)=>{const r=t.querySelector("text, foreignObject, div, span, p")||t,n=TF(r.getAttribute?.("fill"),pF(r,"fill"),r.style?.fill);if(n)return n;const i=TF(r.getAttribute?.("color"),pF(r,"color"),r.style?.color);if(i)return i;const a=TF(e);return a||void 0},QF=(t,e,r)=>{switch(e){case lp.FILL:case lp.STROKE:dF(r)&&(t[e]=r);break;case lp.STROKE_WIDTH:case lp.STROKE_DASHARRAY:t[e]=r}},gF=(t,e,r)=>{e===sp.COLOR&&dF(r)&&(t[sp.COLOR]=r)},yF=(t,e,r)=>{t&&hF(t).forEach(({property:t,value:n})=>{QF(e,t,n),gF(r,t,n)})},mF=(t,e)=>{t&&hF(t).forEach(({property:t,value:r})=>{"fill"===t&&dF(r)?e[sp.COLOR]=r:gF(e,t,r)})},vF=(t,e)=>{if(!t)return;[[lp.FILL,t.getAttribute("fill")],[lp.STROKE,t.getAttribute("stroke")],[lp.STROKE_WIDTH,t.getAttribute("stroke-width")],[lp.STROKE_DASHARRAY,t.getAttribute("stroke-dasharray")]].forEach(([t,r])=>{const n=cF(r||"");n&&QF(e,t,n)})},bF=(t,e)=>{if(!t)return;const r=t.getAttribute("fill")||t.getAttribute("color"),n=cF(r||"");dF(n)&&(e[sp.COLOR]=n)},xF=(t,e,r,n)=>{if(!(e instanceof Map))return;const i=e.get(t);i&&(i.styles?.forEach(t=>{hF(t).forEach(({property:t,value:e})=>{QF(r,t,e),gF(n,t,e)})}),i.textStyles?.forEach(t=>{hF(t).forEach(({property:t,value:e})=>{gF(n,t,e)})}))},LF=(t,e,r)=>{const n=e.querySelector(`[id*="${t.domId}"]`);if(!n)return;let i;"a"===n.parentElement?.tagName.toLowerCase()&&(i=n.parentElement.getAttribute("xlink:href"));const a=wF(i?n.parentElement:n,e),o=n.getBBox(),s={width:o.width,height:o.height},l={},c={};t.classes&&r instanceof Map&&(Array.isArray(t.classes)?t.classes:[t.classes]).forEach(t=>{xF(t,r,l,c)}),t.styles?.forEach(t=>{yF(t,l,c)});const u=n.querySelector(".label-container");yF(u?.getAttribute("style"),l,c),vF(u,l);return Array.from(n.querySelectorAll(".label, .nodeLabel, .label text, .label tspan, .label span, .label div")).forEach(t=>{mF(t.getAttribute("style"),c),bF(t,c)}),{id:t.id,labelType:t.labelType,text:$p(t.text||""),type:t.type,link:i||void 0,...a,...s,containerStyle:l,labelStyle:c}},wF=(t,e)=>{if(!t)throw new Error("Element not found");let r=t.parentElement?.parentElement;const n=t.childNodes[0];let i={x:0,y:0};if(n){const{transformX:t,transformY:e}=Fp(n),r=n.getBBox();i={x:Number(n.getAttribute("x"))||t+r.x||0,y:Number(n.getAttribute("y"))||e+r.y||0}}const{transformX:a,transformY:o}=Fp(t),s={x:a+i.x,y:o+i.y};for(;r&&r.id!==e.id;){if("root"===r.classList.value&&r.hasAttribute("transform")){const{transformX:t,transformY:e}=Fp(r);s.x+=t,s.y+=e}r=r.parentElement}return s},_F=(t,e)=>{const r=t.getVertices(),n=t.getEdges(),i=t.getSubGraphs(),a=t.getClasses(),o={},s=a instanceof Map?a:{};r instanceof Map?r.forEach((t,r)=>{o[r]=LF(t,e,s)}):"object"==typeof r&&null!==r&&Object.entries(r).forEach(([t,r])=>{o[t]=LF(r,e,s)});const l=new Map,c=(Array.isArray(n)?n:[]).map(t=>{if(!e.querySelector(`[id*="${t.id}"]`))return null;const r=`${t.start}-${t.end}`,n=l.get(r)||0;return l.set(r,n+1),((t,e,r)=>{const n=r.querySelector(`[id*="${t.id}"]`);if(!n)throw new Error("Edge element not found");const i=wF(n,r),a=Wp(n,i);return t.length=void 0,{...t,...a,text:$p(t.text)}})(t,0,e)}).filter(t=>null!==t&&t.reflectionPoints.length>1),u=(Array.isArray(i)?i:[]).map(t=>((t,e,r)=>{const n=t.nodes.map(t=>t.startsWith("flowchart-")?t.split("-")[1]:t),i=e.querySelector(`[id='${t.id}']`);if(!i)throw new Error("SubGraph element not found");const a=wF(i,e),o=i.getBBox(),s={width:o.width,height:o.height},l={},c={},u=i.querySelector(":scope > rect, :scope > path, :scope > polygon, :scope > ellipse")||i.querySelector(".cluster > rect, .cluster > path, .cluster > polygon, .cluster > ellipse")||i.querySelector("rect, path, polygon, ellipse");yF(i.getAttribute("style"),l,c),yF(Line truncated
/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*/
var n0=function(t){if(!(this instanceof n0))return new n0(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};n0.prototype={fulfill:function(t){return i0(this,1,"fulfillValue",t)},reject:function(t){return i0(this,2,"rejectReason",t)},then:function(t,e){var r=this,n=new n0;return r.onFulfilled.push(s0(t,n,"fulfill")),r.onRejected.push(s0(e,n,"reject")),a0(r),n.proxy}};var i0=function(t,e,r,n){return 0===t.state&&(t.state=e,t[r]=n,a0(t)),t},a0=function(t){1===t.state?o0(t,"onFulfilled",t.fulfillValue):2===t.state&&o0(t,"onRejected",t.rejectReason)},o0=function(t,e,r){if(0!==t[e].length){var n=t[e];t[e]=[];var i=function(){for(var t=0;t<n.length;t++)n[t](r)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},s0=function(t,e,r){return function(n){if("function"!=typeof t)e[r].call(e,n);else{var i;try{i=t(n)}catch(t){return void e.reject(t)}l0(e,i)}}},l0=function(t,e){if(t!==e&&t.proxy!==e){var r;if("object"===w1(e)&&null!==e||"function"==typeof e)try{r=e.then}catch(e){return void t.reject(e)}if("function"!=typeof r)t.fulfill(e);else{var n=!1;try{r.call(e,function(r){n||(n=!0,r===e?t.reject(new TypeError("circular thenable chain")):l0(t,r))},function(e){n||(n=!0,t.reject(e))})}catch(e){n||t.reject(e)}}}else t.reject(new TypeError("cannot resolve promise with itself"))};n0.all=function(t){return new n0(function(e,r){for(var n=new Array(t.length),i=0,a=function(r,a){n[r]=a,++i===t.length&&e(n)},o=0;o<t.length;o++)(function(e){var n=t[e];null!=n&&null!=n.then?n.then(function(t){a(e,t)},function(t){r(t)}):a(e,n)})(o)})},n0.resolve=function(t){return new n0(function(e,r){e(t)})},n0.reject=function(t){return new n0(function(e,r){r(t)})};var c0="undefined"!=typeof Promise?Promise:n0,u0=function(t,e,r){var n=Q2(t),i=!n,a=this._private=H2({duration:1e3},e,r);if(a.target=t,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&l2(a.complete)&&a.completes.push(a.complete),i){var o=t.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||t.cy().style().getAnimationStartStyle(t,a.style)}if(n){var s=t.pan();a.startPan={x:s.x,y:s.y},a.startZoom=t.zoom()}this.length=1,this[0]=this},h0=u0.prototype;H2(h0,{instanceString:function(){return"animation"},hook:function(){var t=this._private;if(!t.hooked){var e=t.target._private.animation;(t.queue?e.queue:e.current).push(this),p2(t.target)&&t.target.cy().addToAnimationPool(t.target),t.hooked=!0}return this},play:function(){var t=this._private;return 1===t.progress&&(t.progress=0),t.playing=!0,t.started=!1,t.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var t=this._private;return t.applying=!0,t.started=!1,t.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var t=this._private;return t.playing=!1,t.started=!1,this},stop:function(){var t=this._private;return t.playing=!1,t.started=!1,t.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(t){var e=this._private;return void 0===t?e.progress*e.duration:this.progress(t/e.duration)},progress:function(t){var e=this._private,r=e.playing;return void 0===t?e.progress:(r&&this.pause(),e.progress=t,e.started=!1,r&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var t=this._private,e=t.playing;e&&this.pause(),t.progress=1-t.progress,t.started=!1;var r=function(e,r){var n=t[e];null!=n&&(t[e]=t[r],t[r]=n)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),t.style)for(var n=0;n<t.style.length;n++){var i=t.style[n],a=i.name,o=t.startStyle[a];t.startStyle[a]=i,t.style[n]=o}return e&&this.play(),this},promise:function(t){var e,r=this._private;if("frame"===t)e=r.frames;else e=r.completes;return new c0(function(t,r){e.push(function(){t()})})}}),h0.complete=h0.completed,h0.run=h0.play,h0.running=h0.playing;var d0,p0,T0,f0,Q0,g0,y0,m0,v0,b0,x0,L0,w0,_0,k0,E0,S0,C0,A0,M0,H0,O0,N0,I0,R0,P0,V0,D0,B0,$0,F0,j0,z0,G0,q0,W0,U0,Y0,X0,Z0,K0,J0,t5,e5,r5,n5,i5,a5,o5,s5,l5,c5,u5,h5,d5,p5,T5,f5,Q5,g5,y5,m5,v5,b5,x5,L5,w5,_5,k5,E5,S5,C5,A5,M5,H5,O5,N5,I5,R5,P5,V5,D5,B5,$5,F5,j5,z5={animated:function(){return function(){var t=this,e=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return!1;var r=e[0];return r?r._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var t=this,e=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return this;for(var r=0;r<e.length;r++){e[r]._private.animation.queue=[]}return this}},delay:function(){return function(t,e){return(this._private.cy||this).styleEnabled()?this.animate({delay:t,duration:t,complete:e}):this}},delayAnimation:funLine truncated
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function itt(t,e,r,n){var i=.1,a="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var o=0;o<4;++o)if("number"!=typeof arguments[o]||isNaN(arguments[o])||!isFinite(arguments[o]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var s=a?new Float32Array(11):new Array(11);function l(t,e){return 1-3*e+3*t}function c(t,e){return 3*e-6*t}function u(t){return 3*t}function h(t,e,r){return((l(e,r)*t+c(e,r))*t+u(e))*t}function d(t,e,r){return 3*l(e,r)*t*t+2*c(e,r)*t+u(e)}function p(e){for(var n=0,a=1;10!==a&&s[a]<=e;++a)n+=i;--a;var o=n+(e-s[a])/(s[a+1]-s[a])*i,l=d(o,t,r);return l>=.001?function(e,n){for(var i=0;i<4;++i){var a=d(n,t,r);if(0===a)return n;n-=(h(n,t,r)-e)/a}return n}(e,o):0===l?o:function(e,n,i){var a,o,s=0;do{(a=h(o=n+(i-n)/2,t,r)-e)>0?i=o:n=o}while(Math.abs(a)>1e-7&&++s<10);return o}(e,n,n+i)}var T=!1;function f(){T=!0,t===e&&r===n||function(){for(var e=0;e<11;++e)s[e]=h(e*i,t,r)}()}var Q=function(i){return T||f(),t===e&&r===n?i:0===i?0:1===i?1:h(p(i),e,n)};Q.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var g="generateBezier("+[t,e,r,n]+")";return Q.toString=function(){return g},Q}
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var att=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,r,n){var i={x:e.x+n.dx*r,v:e.v+n.dv*r,tension:e.tension,friction:e.friction};return{dx:i.v,dv:t(i)}}function r(r,n){var i={dx:r.v,dv:t(r)},a=e(r,.5*n,i),o=e(r,.5*n,a),s=e(r,n,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),c=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return r.x=r.x+l*n,r.v=r.v+c*n,r}return function t(e,n,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},c=[0],u=0,h=1e-4;for(e=parseFloat(e)||500,n=parseFloat(n)||20,i=i||null,l.tension=e,l.friction=n,o=(a=null!==i)?(u=t(e,n))/i*.016:.016;s=r(s||l,o),c.push(1+s.x),u+=16,Math.abs(s.x)>h&&Math.abs(s.v)>h;);return a?function(t){return c[t*(c.length-1)|0]}:u}}(),ott=function(t,e,r,n){var i=itt(t,e,r,n);return function(t,e,r){return t+(e-t)*i(r)}},stt={linear:function(t,e,r){return t+(e-t)*r},ease:ott(.25,.1,.25,1),"ease-in":ott(.42,0,1,1),"ease-out":ott(0,0,.58,1),"ease-in-out":ott(.42,0,.58,1),"ease-in-sine":ott(.47,0,.745,.715),"ease-out-sine":ott(.39,.575,.565,1),"ease-in-out-sine":ott(.445,.05,.55,.95),"ease-in-quad":ott(.55,.085,.68,.53),"ease-out-quad":ott(.25,.46,.45,.94),"ease-in-out-quad":ott(.455,.03,.515,.955),"ease-in-cubic":ott(.55,.055,.675,.19),"ease-out-cubic":ott(.215,.61,.355,1),"ease-in-out-cubic":ott(.645,.045,.355,1),"ease-in-quart":ott(.895,.03,.685,.22),"ease-out-quart":ott(.165,.84,.44,1),"ease-in-out-quart":ott(.77,0,.175,1),"ease-in-quint":ott(.755,.05,.855,.06),"ease-out-quint":ott(.23,1,.32,1),"ease-in-out-quint":ott(.86,0,.07,1),"ease-in-expo":ott(.95,.05,.795,.035),"ease-out-expo":ott(.19,1,.22,1),"ease-in-out-expo":ott(1,0,0,1),"ease-in-circ":ott(.6,.04,.98,.335),"ease-out-circ":ott(.075,.82,.165,1),"ease-in-out-circ":ott(.785,.135,.15,.86),spring:function(t,e,r){if(0===r)return stt.linear;var n=att(t,e,r);return function(t,e,r){return t+(e-t)*n(r)}},"cubic-bezier":ott};function ltt(t,e,r,n,i){if(1===n)return r;if(e===r)return r;var a=i(e,r,n);return null==t||((t.roundValue||t.color)&&(a=Math.round(a)),void 0!==t.min&&(a=Math.max(a,t.min)),void 0!==t.max&&(a=Math.min(a,t.max))),a}function ctt(t,e){return null!=t.pfValue||null!=t.value?null==t.pfValue||null!=e&&"%"===e.type.units?t.value:t.pfValue:t}function utt(t,e,r,n,i){var a=null!=i?i.type:null;r<0?r=0:r>1&&(r=1);var o=ctt(t,i),s=ctt(e,i);if(h2(o)&&h2(s))return ltt(a,o,s,r,n);if(c2(o)&&c2(s)){for(var l=[],c=0;c<s.length;c++){var u=o[c],h=s[c];if(null!=u&&null!=h){var d=ltt(a,u,h,r,n);l.push(d)}else l.push(h)}return l}}function htt(t,e,r,n){var i=!n,a=t._private,o=e._private,s=o.easing,l=o.startTime,c=(n?t:t.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=stt.linear;else{var u,h,d;if(s2(s))u=c.parse("transition-timing-function",s).value;else u=s;s2(u)?(h=u,d=[]):(h=u[1],d=u.slice(2).map(function(t){return+t})),d.length>0?("spring"===h&&d.push(o.duration),o.easingImpl=stt[h].apply(null,d)):o.easingImpl=stt[h]}var p,T=o.easingImpl;if(p=0===o.duration?1:(r-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var f=o.startPosition,Q=o.position;if(Q&&i&&!t.locked()){var g={};dtt(f.x,Q.x)&&(g.x=utt(f.x,Q.x,p,T)),dtt(f.y,Q.y)&&(g.y=utt(f.y,Q.y,p,T)),t.position(g)}var y=o.startPan,m=o.pan,v=a.pan,b=null!=m&&n;b&&(dtt(y.x,m.x)&&(v.x=utt(y.x,m.x,p,T)),dtt(y.y,m.y)&&(v.y=utt(y.y,m.y,p,T)),t.emit("pan"));var x=o.startZoom,L=o.zoom,w=null!=L&&n;w&&(dtt(x,L)&&(a.zoom=T4(a.minZoom,utt(x,L,p,T),a.maxZoom)),t.emit("zoom")),(b||w)&&t.emit("viewport");var _=o.style;if(_&&_.length>0&&i){for(var k=0;k<_.length;k++){var E=_[k],S=E.name,C=E,A=o.startStyle[S],M=utt(A,C,p,T,c.properties[A.name]);c.overrideBypass(t,S,M)}t.emit("style")}}return o.progress=p,p}function dtt(t,e){return null!=t&&null!=e&&(!(!h2(t)||!h2(e))||!(!t||!e))}function ptt(t,e,r,n){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function Ttt(t,e){var r=e._private.aniEles,n=[];function i(e,r){var i=e._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var c=function(t){for(var e=t.length-1;e>=0;e--){(0,t[e])()}t.splice(0,t.length)},u=a.length-1;u>=0;u--){var h=a[u],d=h._private;d.stopped?(a.splice(u,1),d.hooked=!1,d.playing=!1,d.started=!1,c(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||ptt(0,h,t),htt(e,h,t,r),d.applying&&(d.applying=!1),c(d.frames),null!=d.step&&d.step(t),h.completed()&&(a.splice(u,1),d.hooked=!1,d.playing=!1,d.started=!1,c(d.completes)),s=!0)}return r||0!==a.length||0!==o.length||n.push(e),s}for(var a=!1,o=0;o<r.length;o++){var s=i(r[o]);a=a||s}var l=i(e,!0);(a||l)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var ftt={animate:I7.animate(),animation:I7.animation(),animated:I7.animated(),clearQueue:I7.clearQueue(),delay:I7.delay(),delayAnimation:I7.delayAnimation(),stop:I7.stop(),addToAnimationPool:function(t){this.styleEnablLine truncated
var J6=function(t){if(!(this instanceof J6))return new J6(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};J6.prototype={fulfill:function(t){return t0(this,1,"fulfillValue",t)},reject:function(t){return t0(this,2,"rejectReason",t)},then:function(t,e){var r=this,n=new J6;return r.onFulfilled.push(n0(t,n,"fulfill")),r.onRejected.push(n0(e,n,"reject")),e0(r),n.proxy}};var t0=function(t,e,r,n){return 0===t.state&&(t.state=e,t[r]=n,e0(t)),t},e0=function(t){1===t.state?r0(t,"onFulfilled",t.fulfillValue):2===t.state&&r0(t,"onRejected",t.rejectReason)},r0=function(t,e,r){if(0!==t[e].length){var n=t[e];t[e]=[];var i=function(){for(var t=0;t<n.length;t++)n[t](r)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},n0=function(t,e,r){return function(n){if("function"!=typeof t)e[r].call(e,n);else{var i;try{i=t(n)}catch(t){return void e.reject(t)}i0(e,i)}}},i0=function(t,e){if(t!==e&&t.proxy!==e){var r;if("object"===v1(e)&&null!==e||"function"==typeof e)try{r=e.then}catch(e){return void t.reject(e)}if("function"!=typeof r)t.fulfill(e);else{var n=!1;try{r.call(e,function(r){n||(n=!0,r===e?t.reject(new TypeError("circular thenable chain")):i0(t,r))},function(e){n||(n=!0,t.reject(e))})}catch(e){n||t.reject(e)}}}else t.reject(new TypeError("cannot resolve promise with itself"))};J6.all=function(t){return new J6(function(e,r){for(var n=new Array(t.length),i=0,a=function(r,a){n[r]=a,++i===t.length&&e(n)},o=0;o<t.length;o++)(function(e){var n=t[e];null!=n&&null!=n.then?n.then(function(t){a(e,t)},function(t){r(t)}):a(e,n)})(o)})},J6.resolve=function(t){return new J6(function(e,r){e(t)})},J6.reject=function(t){return new J6(function(e,r){r(t)})};var a0="undefined"!=typeof Promise?Promise:J6,o0=function(t,e,r){var n=d2(t),i=!n,a=this._private=S2({duration:1e3},e,r);if(a.target=t,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&i2(a.complete)&&a.completes.push(a.complete),i){var o=t.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||t.cy().style().getAnimationStartStyle(t,a.style)}if(n){var s=t.pan();a.startPan={x:s.x,y:s.y},a.startZoom=t.zoom()}this.length=1,this[0]=this},s0=o0.prototype;S2(s0,{instanceString:function(){return"animation"},hook:function(){var t=this._private;if(!t.hooked){var e=t.target._private.animation;(t.queue?e.queue:e.current).push(this),c2(t.target)&&t.target.cy().addToAnimationPool(t.target),t.hooked=!0}return this},play:function(){var t=this._private;return 1===t.progress&&(t.progress=0),t.playing=!0,t.started=!1,t.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var t=this._private;return t.applying=!0,t.started=!1,t.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var t=this._private;return t.playing=!1,t.started=!1,this},stop:function(){var t=this._private;return t.playing=!1,t.started=!1,t.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(t){var e=this._private;return void 0===t?e.progress*e.duration:this.progress(t/e.duration)},progress:function(t){var e=this._private,r=e.playing;return void 0===t?e.progress:(r&&this.pause(),e.progress=t,e.started=!1,r&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var t=this._private,e=t.playing;e&&this.pause(),t.progress=1-t.progress,t.started=!1;var r=function(e,r){var n=t[e];null!=n&&(t[e]=t[r],t[r]=n)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),t.style)for(var n=0;n<t.style.length;n++){var i=t.style[n],a=i.name,o=t.startStyle[a];t.startStyle[a]=i,t.style[n]=o}return e&&this.play(),this},promise:function(t){var e,r=this._private;if("frame"===t)e=r.frames;else e=r.completes;return new a0(function(t,r){e.push(function(){t()})})}}),s0.complete=s0.completed,s0.run=s0.play,s0.running=s0.playing;var l0,c0,u0,h0,d0,p0,T0,f0,Q0,g0,y0,m0,v0,b0,x0,L0,w0,_0,k0,E0,S0,C0,A0,M0,H0,O0,N0,I0,R0,P0,V0,D0,B0,$0,F0,j0,z0,G0,q0,W0,U0,Y0,X0,Z0,K0,J0,t5,e5,r5,n5,i5,a5,o5,s5,l5,c5,u5,h5,d5,p5,T5,f5,Q5,g5,y5,m5,v5,b5,x5,L5,w5,_5,k5,E5,S5,C5,A5,M5,H5,O5,N5,I5,R5,P5,V5,D5,B5={animated:function(){return function(){var t=this,e=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return!1;var r=e[0];return r?r._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var t=this,e=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return this;for(var r=0;r<e.length;r++){e[r]._private.animation.queue=[]}return this}},delay:function(){return function(t,e){return(this._private.cy||this).styleEnabled()?this.animate({delay:t,duration:t,complete:e}):this}},delayAnimation:funLine truncated
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function ttt(t,e,r,n){var i=.1,a="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var o=0;o<4;++o)if("number"!=typeof arguments[o]||isNaN(arguments[o])||!isFinite(arguments[o]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var s=a?new Float32Array(11):new Array(11);function l(t,e){return 1-3*e+3*t}function c(t,e){return 3*e-6*t}function u(t){return 3*t}function h(t,e,r){return((l(e,r)*t+c(e,r))*t+u(e))*t}function d(t,e,r){return 3*l(e,r)*t*t+2*c(e,r)*t+u(e)}function p(e){for(var n=0,a=1;10!==a&&s[a]<=e;++a)n+=i;--a;var o=n+(e-s[a])/(s[a+1]-s[a])*i,l=d(o,t,r);return l>=.001?function(e,n){for(var i=0;i<4;++i){var a=d(n,t,r);if(0===a)return n;n-=(h(n,t,r)-e)/a}return n}(e,o):0===l?o:function(e,n,i){var a,o,s=0;do{(a=h(o=n+(i-n)/2,t,r)-e)>0?i=o:n=o}while(Math.abs(a)>1e-7&&++s<10);return o}(e,n,n+i)}var T=!1;function f(){T=!0,t===e&&r===n||function(){for(var e=0;e<11;++e)s[e]=h(e*i,t,r)}()}var Q=function(i){return T||f(),t===e&&r===n?i:0===i?0:1===i?1:h(p(i),e,n)};Q.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var g="generateBezier("+[t,e,r,n]+")";return Q.toString=function(){return g},Q}
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var ett=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,r,n){var i={x:e.x+n.dx*r,v:e.v+n.dv*r,tension:e.tension,friction:e.friction};return{dx:i.v,dv:t(i)}}function r(r,n){var i={dx:r.v,dv:t(r)},a=e(r,.5*n,i),o=e(r,.5*n,a),s=e(r,n,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),c=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return r.x=r.x+l*n,r.v=r.v+c*n,r}return function t(e,n,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},c=[0],u=0,h=1e-4;for(e=parseFloat(e)||500,n=parseFloat(n)||20,i=i||null,l.tension=e,l.friction=n,o=(a=null!==i)?(u=t(e,n))/i*.016:.016;s=r(s||l,o),c.push(1+s.x),u+=16,Math.abs(s.x)>h&&Math.abs(s.v)>h;);return a?function(t){return c[t*(c.length-1)|0]}:u}}(),rtt=function(t,e,r,n){var i=ttt(t,e,r,n);return function(t,e,r){return t+(e-t)*i(r)}},ntt={linear:function(t,e,r){return t+(e-t)*r},ease:rtt(.25,.1,.25,1),"ease-in":rtt(.42,0,1,1),"ease-out":rtt(0,0,.58,1),"ease-in-out":rtt(.42,0,.58,1),"ease-in-sine":rtt(.47,0,.745,.715),"ease-out-sine":rtt(.39,.575,.565,1),"ease-in-out-sine":rtt(.445,.05,.55,.95),"ease-in-quad":rtt(.55,.085,.68,.53),"ease-out-quad":rtt(.25,.46,.45,.94),"ease-in-out-quad":rtt(.455,.03,.515,.955),"ease-in-cubic":rtt(.55,.055,.675,.19),"ease-out-cubic":rtt(.215,.61,.355,1),"ease-in-out-cubic":rtt(.645,.045,.355,1),"ease-in-quart":rtt(.895,.03,.685,.22),"ease-out-quart":rtt(.165,.84,.44,1),"ease-in-out-quart":rtt(.77,0,.175,1),"ease-in-quint":rtt(.755,.05,.855,.06),"ease-out-quint":rtt(.23,1,.32,1),"ease-in-out-quint":rtt(.86,0,.07,1),"ease-in-expo":rtt(.95,.05,.795,.035),"ease-out-expo":rtt(.19,1,.22,1),"ease-in-out-expo":rtt(1,0,0,1),"ease-in-circ":rtt(.6,.04,.98,.335),"ease-out-circ":rtt(.075,.82,.165,1),"ease-in-out-circ":rtt(.785,.135,.15,.86),spring:function(t,e,r){if(0===r)return ntt.linear;var n=ett(t,e,r);return function(t,e,r){return t+(e-t)*n(r)}},"cubic-bezier":rtt};function itt(t,e,r,n,i){if(1===n)return r;if(e===r)return r;var a=i(e,r,n);return null==t||((t.roundValue||t.color)&&(a=Math.round(a)),void 0!==t.min&&(a=Math.max(a,t.min)),void 0!==t.max&&(a=Math.min(a,t.max))),a}function att(t,e){return null!=t.pfValue||null!=t.value?null==t.pfValue||null!=e&&"%"===e.type.units?t.value:t.pfValue:t}function ott(t,e,r,n,i){var a=null!=i?i.type:null;r<0?r=0:r>1&&(r=1);var o=att(t,i),s=att(e,i);if(s2(o)&&s2(s))return itt(a,o,s,r,n);if(a2(o)&&a2(s)){for(var l=[],c=0;c<s.length;c++){var u=o[c],h=s[c];if(null!=u&&null!=h){var d=itt(a,u,h,r,n);l.push(d)}else l.push(h)}return l}}function stt(t,e,r,n){var i=!n,a=t._private,o=e._private,s=o.easing,l=o.startTime,c=(n?t:t.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=ntt.linear;else{var u,h,d;if(n2(s))u=c.parse("transition-timing-function",s).value;else u=s;n2(u)?(h=u,d=[]):(h=u[1],d=u.slice(2).map(function(t){return+t})),d.length>0?("spring"===h&&d.push(o.duration),o.easingImpl=ntt[h].apply(null,d)):o.easingImpl=ntt[h]}var p,T=o.easingImpl;if(p=0===o.duration?1:(r-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var f=o.startPosition,Q=o.position;if(Q&&i&&!t.locked()){var g={};ltt(f.x,Q.x)&&(g.x=ott(f.x,Q.x,p,T)),ltt(f.y,Q.y)&&(g.y=ott(f.y,Q.y,p,T)),t.position(g)}var y=o.startPan,m=o.pan,v=a.pan,b=null!=m&&n;b&&(ltt(y.x,m.x)&&(v.x=ott(y.x,m.x,p,T)),ltt(y.y,m.y)&&(v.y=ott(y.y,m.y,p,T)),t.emit("pan"));var x=o.startZoom,L=o.zoom,w=null!=L&&n;w&&(ltt(x,L)&&(a.zoom=u4(a.minZoom,ott(x,L,p,T),a.maxZoom)),t.emit("zoom")),(b||w)&&t.emit("viewport");var _=o.style;if(_&&_.length>0&&i){for(var k=0;k<_.length;k++){var E=_[k],S=E.name,C=E,A=o.startStyle[S],M=ott(A,C,p,T,c.properties[A.name]);c.overrideBypass(t,S,M)}t.emit("style")}}return o.progress=p,p}function ltt(t,e){return null!=t&&null!=e&&(!(!s2(t)||!s2(e))||!(!t||!e))}function ctt(t,e,r,n){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function utt(t,e){var r=e._private.aniEles,n=[];function i(e,r){var i=e._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var c=function(t){for(var e=t.length-1;e>=0;e--){(0,t[e])()}t.splice(0,t.length)},u=a.length-1;u>=0;u--){var h=a[u],d=h._private;d.stopped?(a.splice(u,1),d.hooked=!1,d.playing=!1,d.started=!1,c(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||ctt(0,h,t),stt(e,h,t,r),d.applying&&(d.applying=!1),c(d.frames),null!=d.step&&d.step(t),h.completed()&&(a.splice(u,1),d.hooked=!1,d.playing=!1,d.started=!1,c(d.completes)),s=!0)}return r||0!==a.length||0!==o.length||n.push(e),s}for(var a=!1,o=0;o<r.length;o++){var s=i(r[o]);a=a||s}var l=i(e,!0);(a||l)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var htt={animate:M7.animate(),animation:M7.animation(),animated:M7.animated(),clearQueue:M7.clearQueue(),delay:M7.delay(),delayAnimation:M7.delayAnimation(),stop:M7.stop(),addToAnimationPool:function(t){this.styleEnablLine truncated
/* nosourcemap */
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "excalidraw-extras",
"name": "Excalidraw Extras",
"version": "0.1.0",
"version": "0.1.1",
"minAppVersion": "1.8.7",
"description": "Companion plugin for Excalidraw high-privilege and large components.",
"author": "Zsolt Viczian",
+7 -14
View File
@@ -9,7 +9,7 @@
& > .cm-scroller, & > .cm-announcment {
align-self: start;
width: 100%
width: 100%;
}
/* taken from Obsidian, doesn't apply automatically,
@@ -20,15 +20,14 @@
box-shadow: 0 0 0 var(--input-border-width-focus) var(--background-modifier-border-focus);
}
/* centering the popup */
& .cm-tooltip-cursor.cm-tooltip {
left: unset !important;
& .cm-tooltip-arrow {
left: 50% !important;
/*
Center the popup. CodeMirror writes the tooltip and arrow positions as
inline styles, so LatexTooltipPositioning.ts keeps those values aligned
without using priority overrides here.
*/
& .cm-tooltip-cursor.cm-tooltip .cm-tooltip-arrow {
transform: translateX(-50%);
}
}
[jax="CHTML"][display="true"] {
margin: 0;
@@ -42,9 +41,7 @@
@supports (anchor-name: --test) {
.excalidraw-LatexPrompt .cm-editor .cm-tooltip-cursor.cm-tooltip {
position: fixed !important;
position-anchor: --latex-editor;
top: unset !important;
max-width: calc(100vw - var(--size-4-4));
margin: var(--size-4-2) 0;
overflow-x: clip;
@@ -52,9 +49,5 @@
&.cm-tooltip-above {
bottom: anchor(top);
}
&.cm-tooltip-below {
top: anchor(bottom) !important;
}
}
}
+87 -26
View File
@@ -28,7 +28,7 @@ __export(main_exports, {
default: () => MermaidPlugin
});
module.exports = __toCommonJS(main_exports);
var import_obsidian7 = require("obsidian");
var import_obsidian8 = require("obsidian");
// src/elements/sampleDiagrams.ts
var sampleDiagrams = {
@@ -1768,8 +1768,7 @@ var MermaidElementService = class {
if (!category) {
return this.wrapForPastingIntoEditor(this.wrapWithMermaidBlock("flowchart TD\nStart --> End"));
}
const sampleKey = category.name;
const sample = sampleDiagrams[sampleKey];
const sample = sampleDiagrams[category.name];
if (sample) {
return this.wrapForPastingIntoEditor(this.wrapWithMermaidBlock(sample));
}
@@ -1952,7 +1951,12 @@ var EditMermaidElementModal = class extends import_obsidian2.Modal {
this._categoryService = _categoryService;
this._element = { ...element };
}
async onOpen() {
onOpen() {
void this.renderContent().catch((error) => {
new import_obsidian2.Notice(`Unable to open element editor: ${getErrorMessage(error)}`);
});
}
async renderContent() {
const { contentEl } = this;
contentEl.addClass("mermaid-tools-edit-element-modal");
contentEl.createEl("h2", { text: "Edit element" });
@@ -1975,9 +1979,9 @@ var EditMermaidElementModal = class extends import_obsidian2.Modal {
option.value = category.id;
}
elementCategoryEl.value = this._element.categoryId;
elementCategoryEl.onchange = async () => {
elementCategoryEl.onchange = () => {
this._element.categoryId = elementCategoryEl.value;
await this.renderPreview(mermaid, renderEl);
void this.renderPreview(mermaid, renderEl);
};
const elementDescriptionContainerEl = contentEl.createDiv();
elementDescriptionContainerEl.createEl("label", { text: "Description" });
@@ -1990,9 +1994,9 @@ var EditMermaidElementModal = class extends import_obsidian2.Modal {
elementContentContainerEl.createEl("label", { text: "Content" });
const elementContentEl = elementContentContainerEl.createEl("textarea", { text: this._element.content });
elementContentEl.addClass("mermaid-tools-element-content-input");
elementContentEl.onchange = async () => {
elementContentEl.onchange = () => {
this._element.content = elementContentEl.value;
await this.renderPreview(mermaid, renderEl);
void this.renderPreview(mermaid, renderEl);
};
const saveButtonEl = contentEl.createEl("button", { text: "Save" });
saveButtonEl.onclick = () => {
@@ -2151,11 +2155,30 @@ var MermaidToolsSettingsTab = class extends import_obsidian4.PluginSettingTab {
this._app = _app;
this._plugin = _plugin;
}
async display() {
await renderSettings(this.containerEl, this._plugin);
getSettingDefinitions() {
return [{
name: "Manage elements and categories",
desc: "Add, edit, duplicate, delete, and reorder Mermaid toolbar elements and diagram categories.",
aliases: ["wrapping", "description", "content", "sorting order", "custom categories"],
render: (setting) => {
setting.settingEl.empty();
setting.settingEl.addClass("mermaid-tools-settings-management");
const contentEl = setting.settingEl.createDiv();
this.renderContent(contentEl);
}
}];
}
display() {
this.renderContent(this.containerEl);
}
renderContent(containerEl) {
void renderSettings(containerEl, this._plugin).catch((error) => {
new import_obsidian4.Notice(`Unable to load Mermaid settings: ${getErrorMessage3(error)}`);
});
}
};
async function renderSettings(containerEl, plugin) {
containerEl.addClass("mermaid-tools-settings-content");
const mermaid = await (0, import_obsidian4.loadMermaid)();
const categoryService = CategoryService.getInstance();
categoryService.loadCategories(plugin.settings.customCategories, plugin.settings.defaultCategorySortOrders, plugin.settings.categoryModifications);
@@ -2442,7 +2465,7 @@ async function deleteElement(element, plugin, parentEl) {
await renderSettingsFromParent(parentEl, plugin);
}
async function renderSettingsFromParent(parentEl, plugin) {
const settingsContainer = parentEl.closest(".vertical-tab-content");
const settingsContainer = parentEl.closest(".mermaid-tools-settings-content");
if (settingsContainer instanceof HTMLElement) {
await renderSettings(settingsContainer, plugin);
}
@@ -2486,15 +2509,39 @@ var ConfirmActionModal = class extends import_obsidian4.Modal {
};
// src/ui/toolbarView/mermaidToolbarView.ts
var import_obsidian6 = require("obsidian");
var import_obsidian7 = require("obsidian");
// src/ui/toolbarView/viewHelpers.ts
var import_obsidian6 = require("obsidian");
// src/core/mermaidRenderer.ts
var import_obsidian5 = require("obsidian");
function getMermaidPreviewTheme(doc) {
return doc.body.classList.contains("theme-dark") ? "dark" : "default";
}
function renderMermaidPreview(mermaid, id, diagram, doc) {
var _a, _b, _c, _d;
const frontmatter = diagram.match(/^\s*---\r?\n([\s\S]*?\r?\n)?---[ \t]*(?:\r?\n|$)/);
let theme = getMermaidPreviewTheme(doc);
if (frontmatter) {
const metadata = (0, import_obsidian5.parseYaml)((_a = frontmatter[1]) != null ? _a : "");
theme = (_c = (_b = metadata == null ? void 0 : metadata.config) == null ? void 0 : _b.theme) != null ? _c : theme;
}
const directive = `%%{init: ${JSON.stringify({ theme })}}%%
`;
const offset = (_d = frontmatter == null ? void 0 : frontmatter[0].length) != null ? _d : 0;
const separator = offset > 0 && !diagram.slice(0, offset).endsWith("\n") ? "\n" : "";
const previewDiagram = diagram.slice(0, offset) + separator + directive + diagram.slice(offset);
return mermaid.render(id, previewDiagram);
}
// src/ui/toolbarView/viewHelpers.ts
var TOOLBAR_ELEMENT_CLASS_NAME = "mermaid-toolbar-element";
var TOOLBAR_ELEMENTS_CONTAINER_CLASS_NAME = "mermaid-toolbar-elements-container";
var TOOLBAR_ELEMENTS_CONTAINER_ID = "mermaid-toolbar-elements-container-id";
async function createMermaidToolbar(topRowButtons, items, selectedCategoryId, onCategoryChanged, onElementClick, categoryService) {
const container = document.createElement("div");
async function createMermaidToolbar(topRowButtons, items, selectedCategoryId, onCategoryChanged, onElementClick, categoryService, doc) {
const container = doc.body.createDiv();
container.detach();
const topRow = container.createDiv();
topRow.addClass("mermaid-toolbar-top-row");
const elementsContainer = container.createDiv();
@@ -2507,12 +2554,12 @@ async function createMermaidToolbar(topRowButtons, items, selectedCategoryId, on
}
function createTopRowBtns(parentEl, buttons) {
buttons.forEach((btn) => {
const b = new import_obsidian5.ButtonComponent(parentEl).setClass("clickable-icon").setIcon(btn.iconName).setTooltip(btn.tooltip).onClick(btn.callback);
new import_obsidian6.ButtonComponent(parentEl).setClass("clickable-icon").setIcon(btn.iconName).setTooltip(btn.tooltip).onClick(btn.callback);
});
}
function createDropdown(parentEl, elementsContainer, items, selectedCategoryId, onSelectionChanged, onElClick, categoryService) {
const categories = categoryService.getCategories();
const dropdown = new import_obsidian5.DropdownComponent(parentEl);
const dropdown = new import_obsidian6.DropdownComponent(parentEl);
categories.forEach((category) => {
dropdown.addOption(category.id, category.name);
});
@@ -2528,7 +2575,7 @@ async function handleCategoryChanged(elementsContainer, categoryId, items, onSel
async function recreateElementsSection(sectionContainer, categoryId, items, onElClick) {
sectionContainer.empty();
const elemService = new MermaidElementService();
const mermaid = await (0, import_obsidian5.loadMermaid)();
const mermaid = await (0, import_obsidian6.loadMermaid)();
const filteredSortedItems = items.filter((i) => i.categoryId === categoryId).sort((a, b) => a.sortingOrder - b.sortingOrder);
for (const [index, elem] of filteredSortedItems.entries()) {
const el = createToolbarElement(sectionContainer);
@@ -2536,7 +2583,7 @@ async function recreateElementsSection(sectionContainer, categoryId, items, onEl
const diagram = elemService.wrapAsCompleteDiagram(elem);
el.title = elem.description;
try {
const { svg } = await mermaid.render(createMermaidPreviewId2(), diagram);
const { svg } = await renderMermaidPreview(mermaid, createMermaidPreviewId2(), diagram, sectionContainer.ownerDocument);
setMermaidSvgContent(el, svg);
} catch (error) {
renderToolbarElementError(el, elem.description, error);
@@ -2575,9 +2622,10 @@ var MermaidToolbarButton = class {
};
// src/ui/toolbarView/mermaidToolbarView.ts
var _MermaidToolbarView = class extends import_obsidian6.ItemView {
var _MermaidToolbarView = class extends import_obsidian7.ItemView {
constructor(leaf, plugin) {
super(leaf);
this.toolbarRenderVersion = 0;
this.topRowButtons = [
new MermaidToolbarButton("insert Mermaid code block with sample diagram", "code-2", () => this.insertTextAtCursor(this._plugin._mermaidElementService.getSampleDiagram(this._plugin.settings.selectedCategoryId))),
new MermaidToolbarButton("open Mermaid.js documentation web page", "external-link", () => window.open("https://mermaid.js.org/intro/", "_blank", "noopener")),
@@ -2592,13 +2640,23 @@ var _MermaidToolbarView = class extends import_obsidian6.ItemView {
this.categoryService = CategoryService.getInstance();
this.categoryService.loadCategories(plugin.settings.customCategories, plugin.settings.defaultCategorySortOrders, plugin.settings.categoryModifications);
this.containerEl.children[1].addClass("mermaid-toolbar-container");
this.previewTheme = getMermaidPreviewTheme(this.containerEl.ownerDocument);
this.registerEvent(this.app.workspace.on("css-change", () => {
const theme = getMermaidPreviewTheme(this.containerEl.ownerDocument);
if (theme !== this.previewTheme) {
void this.recreateToolbar(this._plugin.settings.selectedCategoryId);
}
}));
}
async onOpen() {
await this.recreateToolbar(this._plugin.settings.selectedCategoryId);
}
async onClose() {
this.toolbarRenderVersion++;
}
async recreateToolbar(selectedCategoryId) {
const renderVersion = ++this.toolbarRenderVersion;
this.previewTheme = getMermaidPreviewTheme(this.containerEl.ownerDocument);
this.items = this._plugin.settings.elements;
this.categoryService.loadCategories(this._plugin.settings.customCategories, this._plugin.settings.defaultCategorySortOrders, this._plugin.settings.categoryModifications);
const container = this.containerEl.children[1];
@@ -2606,9 +2664,11 @@ var _MermaidToolbarView = class extends import_obsidian6.ItemView {
const toolbarElement = await createMermaidToolbar(this.topRowButtons, this.items, selectedCategoryId, (newCategoryId) => {
this._plugin.settings.selectedCategoryId = newCategoryId;
void this._plugin.saveSettings({ refreshToolbar: false });
}, (text) => this.insertTextAtCursor(text), this.categoryService);
}, (text) => this.insertTextAtCursor(text), this.categoryService, this.containerEl.ownerDocument);
if (renderVersion === this.toolbarRenderVersion) {
container.appendChild(toolbarElement);
}
}
insertTextAtCursor(text) {
this._plugin.insertTextAtCursor(text);
}
@@ -2628,7 +2688,7 @@ MermaidToolbarView.VIEW_DESCRIPTION = "Mermaid Toolbar";
// main.ts
var TRIDENT_ICON_NAME = "trident-custom";
var MermaidPlugin = class extends import_obsidian7.Plugin {
var MermaidPlugin = class extends import_obsidian8.Plugin {
constructor() {
super(...arguments);
this.activeEditor = null;
@@ -2657,9 +2717,6 @@ var MermaidPlugin = class extends import_obsidian7.Plugin {
});
this.addSettingTab(new MermaidToolsSettingsTab(this.app, this));
}
async onunload() {
this.app.workspace.detachLeavesOfType(MermaidToolbarView.VIEW_TYPE);
}
async loadSettings() {
var _a, _b, _c, _d, _e, _f;
const defaultSettings = MermaidPluginSettings.DefaultSettings();
@@ -2720,7 +2777,11 @@ var MermaidPlugin = class extends import_obsidian7.Plugin {
}
async activateView() {
var _a;
this.app.workspace.detachLeavesOfType(MermaidToolbarView.VIEW_TYPE);
const existingLeaf = this.app.workspace.getLeavesOfType(MermaidToolbarView.VIEW_TYPE)[0];
if (existingLeaf) {
await this.app.workspace.revealLeaf(existingLeaf);
return;
}
const leaf = (_a = this.app.workspace.getRightLeaf(false)) != null ? _a : this.app.workspace.getLeaf(true);
await leaf.setViewState({
type: MermaidToolbarView.VIEW_TYPE,
@@ -2735,7 +2796,7 @@ var MermaidPlugin = class extends import_obsidian7.Plugin {
this._textEditorService.insertTextAtCursor(editor, text);
this.activeEditor = editor != null ? editor : this.activeEditor;
} catch (error) {
new import_obsidian7.Notice(getErrorMessage5(error));
new import_obsidian8.Notice(getErrorMessage5(error));
}
}
};
+2 -2
View File
@@ -1,9 +1,9 @@
{
"id": "mermaid-tools",
"name": "Mermaid Tools",
"version": "1.4.1",
"version": "1.4.3",
"minAppVersion": "1.4.0",
"description": "Improved Mermaid.js experience for Obsidian: visual toolbar with common elements & more",
"description": "Improved Mermaid.js experience: visual toolbar with common elements & more.",
"author": "dartungar",
"authorUrl": "https://dartungar.com",
"fundingUrl": "https://www.paypal.com/paypalme/dartungar",
+4
View File
@@ -258,3 +258,7 @@
.mermaid-tools-modal-button-container button.mod-cta:hover {
background-color: var(--color-accent-hover);
}
.mermaid-tools-settings-management {
display: block;
}
+289 -297
View File
@@ -3,33 +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)
*/
"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
"use strict";var xI=Object.create;var Hc=Object.defineProperty;var EI=Object.getOwnPropertyDescriptor;var SI=Object.getOwnPropertyNames;var kI=Object.getPrototypeOf,CI=Object.prototype.hasOwnProperty;var x_=r=>{throw TypeError(r)};var AI=(r,e,t)=>e in r?Hc(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var TI=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var B=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},RI=(r,e)=>{for(var t in e)Hc(r,t,{get:e[t],enumerable:!0})},E_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of SI(e))!CI.call(r,i)&&i!==t&&Hc(r,i,{get:()=>e[i],enumerable:!(n=EI(e,i))||n.enumerable});return r};var Ke=(r,e,t)=>(t=r!=null?xI(kI(r)):{},E_(e||!r||!r.__esModule?Hc(t,"default",{value:r,enumerable:!0}):t,r)),PI=r=>E_(Hc({},"__esModule",{value:!0}),r);var Ve=(r,e,t)=>AI(r,typeof e!="symbol"?e+"":e,t),tg=(r,e,t)=>e.has(r)||x_("Cannot "+t);var I=(r,e,t)=>(tg(r,e,"read from private field"),t?t.call(r):e.get(r)),de=(r,e,t)=>e.has(r)?x_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),le=(r,e,t,n)=>(tg(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),_e=(r,e,t)=>(tg(r,e,"access private method"),t);var C_=B(ld=>{"use strict";m();ld.byteLength=II;ld.toByteArray=MI;ld.fromByteArray=LI;var Ti=[],Nn=[],$I=typeof Uint8Array!="undefined"?Uint8Array:Array,rg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Fa=0,S_=rg.length;Fa<S_;++Fa)Ti[Fa]=rg[Fa],Nn[rg.charCodeAt(Fa)]=Fa;var Fa,S_;Nn[45]=62;Nn[95]=63;function k_(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function II(r){var e=k_(r),t=e[0],n=e[1];return(t+n)*3/4-n}function FI(r,e,t){return(e+t)*3/4-t}function MI(r){var e,t=k_(r),n=t[0],i=t[1],s=new $I(FI(r,n,i)),a=0,o=i>0?n-4:n,l;for(l=0;l<o;l+=4)e=Nn[r.charCodeAt(l)]<<18|Nn[r.charCodeAt(l+1)]<<12|Nn[r.charCodeAt(l+2)]<<6|Nn[r.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return i===2&&(e=Nn[r.charCodeAt(l)]<<2|Nn[r.charCodeAt(l+1)]>>4,s[a++]=e&255),i===1&&(e=Nn[r.charCodeAt(l)]<<10|Nn[r.charCodeAt(l+1)]<<4|Nn[r.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function OI(r){return Ti[r>>18&63]+Ti[r>>12&63]+Ti[r>>6&63]+Ti[r&63]}function DI(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(OI(n));return i.join("")}function LI(r){for(var e,t=r.length,n=t%3,i=[],s=16383,a=0,o=t-n;a<o;a+=s)i.push(DI(r,a,a+s>o?o:a+s));return n===1?(e=r[t-1],i.push(Ti[e>>2]+Ti[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Ti[e>>10]+Ti[e>>4&63]+Ti[e<<2&63]+"=")),i.join("")}});var A_=B(ng=>{m();ng.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,l=(1<<o)-1,c=l>>1,u=-7,f=t?i-1:0,d=t?-1:1,h=r[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+r[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=n;u>0;a=a*256+r[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,n),s=s-c}return(h?-1:1)*a*Math.pow(2,s-n)};ng.write=function(r,e,t,n,i,s){var a,o,l,c=s*8-i-1,u=(1<<c)-1,f=u>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,p=n?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,i),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;r[t+h]=o&255,h+=p,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;r[t+h]=a&255,h+=p,a/=256,c-=8);r[t+h-p]|=g*128}});var dg=B(Jo=>{"use strict";m();var ig=C_(),Xo=A_(),T_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Jo.Buffer=F;Jo.SlowBuffer=jI;Jo.INSPECT_MAX_BYTES=50;var cd=2147483647;Jo.kMaxLength=cd;F.TYPED_ARRAY_SUPPORT=NI();!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 NI(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch(r){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 os(r){if(r>cd)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,F.prototype),e}function F(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return lg(r)}return I_(r,e,t)}F.poolSize=8192;function I_(r,e,t){if(typeoLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v8(r,e){if(r){if(typeof r=="string")return QC(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return QC(r,e)}}function QC(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function b8(r,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(r)))){var t=[],n=!0,i=!1,s=void 0;try{for(var a=r[Symbol.iterator](),o;!(n=(o=a.next()).done)&&(t.push(o.value),!(e&&t.length===e));n=!0);}catch(l){i=!0,s=l}finally{try{!n&&a.return!=null&&a.return()}finally{if(i)throw s}}return t}}function y8(r){if(Array.isArray(r))return r}var eA=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,tA=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,rA=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,nA=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,iA=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,sA=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,aA=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function Hu(r,e){return r.indexOf(e)>-1}function _8(r,e,t){var n=r/255,i=e/255,s=t/255,a=Math.max(n,i,s),o=Math.min(n,i,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 n:return(i-s)/l%6;case i:return(s-n)/l+2;default:return(n-i)/l+4}})();return[f*60,u*100,c*100]}function x8(r,e,t){var n=r/60,i=e/100,s=t/100,a=(1-Math.abs(2*s-1))*i,o=a*(1-Math.abs(n%2-1)),l=s-a/2,c=(function(){return n<1?[a,o,0]:n<2?[o,a,0]:n<3?[0,a,o]:n<4?[0,o,a]:n<5?[o,0,a]:[a,0,o]})(),u=Tr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var E8=(function(){function r(e){var t=Tr(e,4),n=t[0],i=t[1],s=t[2],a=t[3];m8(this,r),this.values=[Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return g8(r,[{key:"toRgbString",value:function(){var t=Tr(this.values,4),n=t[0],i=t[1],s=t[2],a=t[3];return a===1?"rgb(".concat(n,", ").concat(i,", ").concat(s,")"):"rgba(".concat(n,", ").concat(i,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var t=this.toHslaArray(),n=Tr(t,4),i=n[0],s=n[1],a=n[2],o=n[3];return o===1?"hsl(".concat(i,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(i,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var t=Tr(this.values,4),n=t[0],i=t[1],s=t[2],a=t[3];return n=Number(n).toString(16).padStart(2,"0"),i=Number(i).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(n).concat(i).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var t=Tr(this.values,4),n=t[0],i=t[1],s=t[2],a=t[3],o=_8(n,i,s),l=Tr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),r})();function Il(r){var e=Tr(r,4),t=e[0],n=e[1],i=e[2],s=e[3];return new E8([t,n,i,s])}function Zv(r){var e=Tr(r,3),t=e[0],n=e[1],i=e[2];return Il([t,n,i,1])}function bh(r){var e=Tr(r,4),t=e[0],n=e[1],i=e[2],s=e[3],a=x8(t,n,i),o=Tr(a,3),l=o[0],c=o[1],u=o[2];return Il([l,c,u,s])}function oA(r){var e=Tr(r,3),t=e[0],n=e[1],i=e[2];return bh([t,n,i,1])}function S8(r){var e=eA.exec(r)||tA.exec(r),t=Tr(e,5),n=t[1],i=t[2],s=t[3],a=t[4];return n=parseInt(n.length<2?n.repeat(2):n,16),i=parseInt(i.length<2?i.repeat(2):i,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,Il([n,i,s,a])}function k8(r){var e=rA.exec(r)||iA.exec(r)||nA.exec(r)||sA.exec(r),t=Tr(e,5),n=t[1],i=t[2],s=t[3],a=t[4];return n=Hu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=Hu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),s=Hu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(Hu(a,"%")?100:1),Il([n,i,s,a])}function C8(r){var e=aA.exec(r),t=Tr(e,6),n=t[1],i=t[2],s=t[3],a=t[4],o=t[5];return i=i||"deg",n=(0,p8.default)(parseFloat(n),i,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(Hu(o,"%")?100:1),bh([n,s,a,o])}function lA(r){return KC.default[r]?Zv(KC.default[r]):eA.test(r)||tA.test(r)?S8(r):rA.test(r)||iA.test(r)||nA.test(r)||sA.test(r)?k8(r):aA.test(r)?C8(r):null}var A8={fromString:lA,fromRgb:Zv,fromRgba:Il,fromHsl:oA,fromHsla:bh};ms.default=A8});var yA=B((Mq,bA)=>{m();bA.exports=function(r,e){var t=r,n=e,i=t.length,s=n.length,a=!1,o=i+1,l=[],c=[],u,f,d=function(){i>=s&&(u=t,f=i,t=n,n=u,i=s,s=f,a=!0,o=i+1)},h=function(g,w,b,y,k){return{startX:g,startY:w,endX:b,endY:y,r:k}},p=function(g,w,b){var y,k,C,S,A;for(w>b?y=l[g-1+o]:y=l[g+1+o],A=C=Math Line truncated
`});ye=!1,W=be.length}function Ze(kt,Kt){var Nr="="+H,Br=kt.indexOf(Nr,Kt),ke=c(kt.substring(kt.indexOf("=",Kt)+1,Br)).split(" ");return te=ke[0],H=ke[ke.length-1],Br+Nr.length-1}for(E&&(E=E.split(" "),te=E[0],H=E[1]),ae=0;ae<R;ae++)U==$?u(te,x,ae)?(--ae,St(),U=D):x.charAt(ae)==`
`?Bt(ye):Re+=x.charAt(ae):U==D?(ae+=te.length-1,Ne=r.tags[x.charAt(ae+1)],me=Ne?x.charAt(ae+1):"_v",me=="="?(ae=Ze(x,ae),U=$):(Ne&&ae++,U=O),ye=ae):u(H,x,ae)?(be.push({tag:me,n:c(Re),otag:te,ctag:H,i:me=="/"?ye-te.length:ae+H.length}),Re="",ae+=H.length-1,U=$,me=="{"&&(H=="}}"?ae++:l(be[be.length-1]))):Re+=x.charAt(ae);return Bt(ye,!0),be};function l(v){v.n.substr(v.n.length-1)==="}"&&(v.n=v.n.substring(0,v.n.length-1))}function c(v){return v.trim?v.trim():v.replace(/^\s*|\s*$/g,"")}function u(v,x,E){if(x.charAt(E)!=v.charAt(0))return!1;for(var R=1,$=v.length;R<$;R++)if(x.charAt(E+R)!=v.charAt(R))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(v,x,E,R){var $=[],D=null,O=null,U=null;for(O=E[E.length-1];v.length>0;){if(U=v.shift(),O&&O.tag=="<"&&!(U.tag in f))throw new Error("Illegal content in < super tag.");if(r.tags[U.tag]<=r.tags.$||h(U,R))E.push(U),U.nodes=d(v,U.tag,E,R);else if(U.tag=="/"){if(E.length===0)throw new Error("Closing tag without opener: /"+U.n);if(D=E.pop(),U.n!=D.n&&!p(U.n,D.n,R))throw new Error("Nesting error: "+D.n+" vs. "+U.n);return D.end=U.i,$}else U.tag==`
`&&(U.last=v.length==0||v[0].tag==`
`);$.push(U)}if(E.length>0)throw new Error("missing closing tag: "+E.pop().n);return $}function h(v,x){for(var E=0,R=x.length;E<R;E++)if(x[E].o==v.n)return v.tag="#",!0}function p(v,x,E){for(var R=0,$=E.length;R<$;R++)if(E[R].c==v&&E[R].o==x)return!0}function g(v){var x=[];for(var E in v)x.push('"'+y(E)+'": function(c,p,t,i) {'+v[E]+"}");return"{ "+x.join(",")+" }"}function w(v){var x=[];for(var E in v.partials)x.push('"'+y(E)+'":{name:"'+y(v.partials[E].name)+'", '+w(v.partials[E])+"}");return"partials: {"+x.join(",")+"}, subs: "+g(v.subs)}r.stringify=function(v,x,E){return"{code: function (c,p,i) { "+r.wrapMain(v.code)+" },"+w(v)+"}"};var b=0;r.generate=function(v,x,E){b=0;var R={code:"",subs:{},partials:{}};return r.walk(v,R),E.asString?this.stringify(R,x,E):this.makeTemplate(R,x,E)},r.wrapMain=function(v){return'var t=this;t.b(i=i||"");'+v+"return t.fl();"},r.template=r.Template,r.makeTemplate=function(v,x,E){var R=this.makePartials(v);return R.code=new Function("c","p","i",this.wrapMain(v.code)),new this.template(R,x,this,E)},r.makePartials=function(v){var x,E={subs:{},partials:v.partials,name:v.name};for(x in E.partials)E.partials[x]=this.makePartials(E.partials[x]);for(x in v.subs)E.subs[x]=new Function("c","p","t","i",v.subs[x]);return E};function y(v){return v.replace(s,"\\\\").replace(t,'\\"').replace(n,"\\n").replace(i,"\\r").replace(a,"\\u2028").replace(o,"\\u2029")}function k(v){return~v.indexOf(".")?"d":"f"}function C(v,x){var E="<"+(x.prefix||""),R=E+v.n+b++;return x.partials[R]={name:v.n,partials:{}},x.code+='t.b(t.rp("'+y(R)+'",c,p,"'+(v.indent||"")+'"));',R}r.codegen={"#":function(v,x){x.code+="if(t.s(t."+k(v.n)+'("'+y(v.n)+'",c,p,1),c,p,0,'+v.i+","+v.end+',"'+v.otag+" "+v.ctag+'")){t.rs(c,p,function(c,p,t){',r.walk(v.nodes,x),x.code+="});c.pop();}"},"^":function(v,x){x.code+="if(!t.s(t."+k(v.n)+'("'+y(v.n)+'",c,p,1),c,p,1,0,0,"")){',r.walk(v.nodes,x),x.code+="};"},">":C,"<":function(v,x){var E={partials:{},code:"",subs:{},inPartial:!0};r.walk(v.nodes,E);var R=x.partials[C(v,x)];R.subs=E.subs,R.partials=E.partials},$:function(v,x){var E={subs:{},code:"",partials:x.partials,prefix:v.n};r.walk(v.nodes,E),x.subs[v.n]=E.code,x.inPartial||(x.code+='t.sub("'+y(v.n)+'",c,p,i);')},"\n":function(v,x){x.code+=A('"\\n"'+(v.last?"":" + i"))},_v:function(v,x){x.code+="t.b(t.v(t."+k(v.n)+'("'+y(v.n)+'",c,p,0)));'},_t:function(v,x){x.code+=A('"'+y(v.text)+'"')},"{":S,"&":S};function S(v,x){x.code+="t.b(t.t(t."+k(v.n)+'("'+y(v.n)+'",c,p,0)));'}function A(v){return"t.b("+v+");"}r.walk=function(v,x){for(var E,R=0,$=v.length;R<$;R++)E=r.codegen[v[R].tag],E&&E(v[R],x);return x},r.parse=function(v,x,E){return E=E||{},d(v,"",[],E.sectionTags||[])},r.cache={},r.cacheKey=function(v,x){return[v,!!x.asString,!!x.disableLambda,x.delimiters,!!x.modelGet].join("||")},r.compile=function(v,x){x=x||{};var E=r.cacheKey(v,x),R=this.cache[E];if(R){var $=R.partials;for(var D in $)delete $[D].instance;return R}return R=this.generate(this.parse(this.scan(v,x.delimiters),v,x),v,x),this.cache[E]=R}})(typeof Tb!="undefined"?Tb:Hogan)});var RR=B(Rb=>{m();var sG={};(function(r){r.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=""},r.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=t(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 w=this.ep(d,p);return w?w.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 w=0;w<g.length;w++)d.push(g[w]),p(d,h,this),d.pop()},s:function(d,h,p,g,w,b,y){var k;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,w,b,y)),k=!!d,!g&&k&&h&&h.push(typeof d=="object"?d:h[h.length-1]),k)},d:function(d,h,p,g){var w,b=d.split("."),y=this.f(b[0],h,p,g),k=this.options.modelGet,C=null;if(d==="."&&f(h[h.length-2]))y=h[h.length-1];else for(var S=1;S<b.length;S++)w=e(b[S],y,k),w!==void 0?(C=y,y=w):y="";return g&&!y?!1:(!g&&typeof y=="function"&&(h.push(C),y=this.mv(y,h,p),h.pop()),y)},f:function(d,h,p,g){for(var w=!1,b=null,y=!1,k=this.options.modelGet,C=h.length-1;C>=0;C--)if(b=h[C],w=e(d,b,k),w!==void 0){y=!0;break}return y?(!g&&typeof w=="function"&&(w=this.mv(w,h,p)),w):g?!1:""},ls:function(d,h,p,g,w,b){var y=this.options.delimiters;return this.options.delimiters=b,this.b(this.ct(c(d.call(h,w,p)),h,g)),this.options.delimiters=y,!1},ct:functio Line truncated
If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
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:
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=r.code,this.data={message:e}}};ue.code="InternalError";var Ya=class r extends Ae{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=r.code,this.data={filepath:e}}};Ya.code="UnsafeFilepathError";var oi=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 t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let i=this.buffer.write(e,this._start,t,n);return this._start+=t,i}copy(e,t,n){let i=e.copy(this.buffer,this._start,t,n);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}};function ih(r,e){return-(r<e)||+(r>e)}function Uk(r,e){return ih(r.path,e.path)}function Hk(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}var Li=2**32;function uk(r,e,t,n){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=n.valueOf());let i=Math.floor(t/1e3),s=(t-i*1e3)*1e6;return[i,s]}function yl(r){let[e,t]=uk(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[n,i]=uk(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%Li,ctimeNanoseconds:t%Li,mtimeSeconds:n%Li,mtimeNanoseconds:i%Li,dev:r.dev%Li,ino:r.ino%Li,mode:Hk(r.mode%Li),uid:r.uid%Li,gid:r.gid%Li,size:r.size>-1?r.size%Li:0}}function vL(r){let e="";for(let t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}var $w=null;async function Bi(r){return $w===null&&($w=await yL()),$w?Gk(r):bL(r)}function bL(r){return new ev.default().update(r).digest("hex")}async function Gk(r){let e=await crypto.subtle.digest("SHA-1",r);return vL(e)}async function yL(){try{return await Gk(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(r){}return!1}function _L(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095}}function xL(r){let e=r.flags;return e.extended=!1,e.nameLength=Math.min(_.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Hw=class r{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||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 t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(_.isBuffer(e))return r.fromBuffer(e);if(e===null)return new r(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 t=new r,n=new oi(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new ue(`Invalid dircache magic file number: ${i}`);let s=await Bi(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=n.readUInt32BE();if(o!==2)throw new ue(`Unsupported dircache version: ${o}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&c<l;){let u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");let f=n.readUInt16BE();u.flags=_L(f);let d=e.indexOf(0,n.tell()+1)-n.tell();if(d<1)throw new ue(`Got a path length of: ${d}`);if(u.path=n.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new Ya(u.path);let h=8-(n.tell()-12)%8;for(h===0&&(h=8);h--;){let p=n.readUInt8();if(p!==0)throw new ue(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(n.eof())throw new ue("Unexpected end of file")}u.stages=[],t._addEntry(u),c++}return t}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(Uk)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(t=>t):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath Line truncated
`)}static async _entryToBuffer(e){let t=_.from(e.path),n=Math.ceil((62+t.length+1)/8)*8,i=_.alloc(n),s=new oi(i),a=yl(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(xL(e)),s.write(e.path,t.length,"utf8"),i}async toObject(){let e=_.alloc(12),t=new oi(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(2),t.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(r._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&n.push(r._entryToBuffer(l));n=await Promise.all(n);let i=_.concat(n),s=_.concat([e,i]),a=await Bi(s);return _.concat([s,_.from(a,"hex")])}};function Wd(r,e,t=!0,n=!0){let i=yl(r),s=yl(e);return t&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.ctimeSeconds!==s.ctimeSeconds||i.uid!==s.uid||i.gid!==s.gid||n&&i.ino!==s.ino||i.size!==s.size}var Iw;function EL(){return Iw===void 0&&(Iw=new Dk.default({maxPending:1/0})),Iw}function Jt(r,e){return EL().acquire(r,e)}var Fw=Symbol("IndexCache");function SL(){return{map:new Map,stats:new Map}}async function kL(r,e,t){let[n,i]=await Promise.all([r.lstat(e),r.read(e)]),s=await Hw.from(i);t.map.set(e,s),t.stats.set(e,n)}async function CL(r,e,t){let n=t.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await r.lstat(e);return i===null?!1:Wd(n,i)}var yt=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:i=!0},s){n[Fw]||(n[Fw]=SL());let a=`${t}/index`,o,l=[];return await Jt(a,async()=>{let c=n[Fw];await CL(e,a,c)&&await kL(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!i)throw new hu(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 qd(r){let e=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));return e>-1&&(r=r.slice(e+1)),r}function Za(r){let e=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));return e===-1?".":e===0?"/":r.slice(0,e)}function jk(r){let e=new Map,t=function(i){if(!e.has(i)){let s={type:"tree",fullpath:i,basename:qd(i),metadata:{},children:[]};e.set(i,s),s.parent=t(Za(i)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(i)},n=function(i,s){if(!e.has(i)){let a={type:"blob",fullpath:i,basename:qd(i),metadata:s,parent:t(Za(i)),children:[]};a.parent&&a.parent.children.push(a),e.set(i,a)}return e.get(i)};t(".");for(let i of r)n(i.path,i);return e}function AL(r){switch(r){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: ${r.toString(8)}`)}var Gw=class{constructor({fs:e,gitdir:t,cache:n}){this.treePromise=yt.acquire({fs:e,gitdir:t,cache:n},async function(s){return jk(s.entries)});let i=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let t=e._fullpath,i=(await this.treePromise).get(t);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let s=i.children.map(a=>a.fullpath);return s.sort(ih),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 n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:yl(n.metadata);e._type=n.type==="tree"?"tree":AL(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},sh=Symbol("GitWalkSymbol");function Ka(){let r=Object.create(null);return Object.defineProperty(r,sh,{value:function({fs:e,gitdir:t,cache:n}){return new Gw({fs:e,gitdir:t,cache:n})}}),Object.freeze(r),r}var Xe=class r extends Ae{constructor(e){super(`Could not find ${e}.`),this.code=this.name=r.code,this.data={what:e}}};Xe.code="NotFoundError";var br=class r extends Ae{constructor(e,t,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${t}.`),this.code=this.name=r.code,this.data={oid:e,actual:t,expected:n,filepath:i}}};br.code="ObjectTypeError";var Js=class r extends Ae{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=r.code,this.data={value:e}}};Js.code="InvalidOidError";var wn=class r extends Ae{constructor(e,t){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${t}".)`),this.code=this.name=r.code,this.data={ref:e,suggestion:t}}};w Line truncated
[remote "${e}"]
fetch = +refs/heads/*:refs/remotes/origin/*
`),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(`
`),this.code=this.name=r.code,this.data={remote:e}}};pu.code="NoRefspecError";var Yd=class r{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let t=null;this.parsedConfig=e.trim().split(`
`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let s=n.slice(1);return this.refs.set(t+"^{}",s),{line:n,ref:t,peeled:s}}else{let s=n.slice(0,i);return t=n.slice(i+1),this.refs.set(t,s),{line:n,ref:t,oid:s}}})}return this}static from(e){return new r(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(t=>t.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
`)+`
`}},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}
`}},Zd=class r{constructor({remotePath:e,localPath:t,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:t,force:n,matchPrefix:i})}static from(e){let[t,n,i,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=t==="+",l=i==="*";if(l!==(a==="*"))throw new ue("Invalid refspec");return new r({remotePath:n,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}},jw=class r{constructor(e=[]){this.rules=e}static from(e){let t=[];for(let n of e)t.push(Zd.from(n));return new r(t)}add(e){let t=Zd.from(e);this.rules.push(t)}translate(e){let t=[];for(let n of this.rules)for(let i of e){let s=n.translate(i);s&&t.push([i,s])}return t}translateOne(e){let t=null;for(let n of this.rules){let i=n.translate(e);i&&(t=i)}return t}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function TL(r,e){let t=r.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(t<n)||+(t>n);return i===0?r.endsWith("^{}")?1:-1:i}var RL=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function _l(r,e){if(typeof r!="string")throw new TypeError("Reference name must be a string");return!RL.test(r)&&(!!e||r.includes("/"))}function PL(r,e){let t="",n=0,i=-1,s=0,a="\0";for(let o=0;o<=r.length;++o){if(o<r.length)a=r[o];else{if(a==="/")break;a="/"}if(a==="/"){if(!(i===o-1||s===1))if(s===2){if(t.length<2||n!==2||t.at(-1)!=="."||t.at(-2)!=="."){if(t.length>2){let l=t.lastIndexOf("/");l===-1?(t="",n=0):(t=t.slice(0,l),n=t.length-1-t.lastIndexOf("/")),i=o,s=0;continue}else if(t.length!==0){t="",n=0,i=o,s=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+="/"+r.slice(i+1,o):t=r.slice(i+1,o),n=o-i-1;i=o,s=0}else a==="."&&s!==-1?++s:s=-1}return t}function $L(r){return r.length>=2&&/^[a-zA-Z]:/.test(r)?r.slice(0,2):null}function IL(r){if(!r.length)return".";r=r.replace(/\\/g,"/");let e=$L(r),t=r[0]==="/"||e!==null&&r[2]==="/",n=r.at(-1)==="/",i=e?r.slice(2):r,s=PL(i,!t);if(!s.length){let a=e?t?e+"/":e:t?"/":".";return n&&!t?a+"/":a}return n&&(s+="/"),e?t?`${e}/${s}`:`${e}${s}`:t?`/${s}`:s}function L(...r){if(r.length===0)return".";let e;for(let t=0;t<r.length;++t){let n=r[t].replace(/\\/g,"/");n.length!==0&&(/^[a-zA-Z]:\//.test(n)||e===void 0?e=n:e+="/"+n)}return e===void 0?".":IL(e)}var FL=r=>{if(typeof r=="number")return r;r=r.toLowerCase();let e=parseInt(r);return r.endsWith("k")&&(e*=1024),r.endsWith("m")&&(e*=1024*1024),r.endsWith("g")&&(e*=1024*1024*1024),e},uu=r=>{if(typeof r=="boolean")return r;if(r=r.trim().toLowerCase(),r==="true"||r==="yes"||r==="on")return!0;if(r==="false"||r==="no"||r==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${r}`)},fk={core:{filemode:uu,bare:uu,logallrefupdates:uu,symlinks:uu,ignorecase:uu,bigFileThreshold:FL}},ML=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,OL=/^[A-Za-z0-9-.]+$/,DL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,LL=/^[A-Za-z][A-Za-z-]*$/,NL=/^(.*?)( *[#;].*)$/,BL=r=>{let e=ML.exec(r);if(e!=null){let[t,n]=e.slice(1);return[t,n]}return null},UL=r=>{let e=DL.exec(r);if(e!=null){let[t,n="true"]=e.slice(1),i=HL(n),s=GL(i);return[t,s]}return null},HL=r=>{let e=NL.exec(r);if(e==null)return r;let[t,n]=e.slice(1);return dk(t)&&dk(n)?`${t}${n}`:t},dk=r=>(r.match(/(?:^|[^\\])"/g)||[]).length%2!==0,GL=r=>r.split("").reduce((e,t,n,i)=>{let s=t==='"'&&i[n-1]!=="\\",a=t==="\\"&&i[n+1]==='"';return s||a?e:e+t},""),hk=r=>r!=null?r.toLowerCase():null,zw=(r,e,t)=>[hk(r),e,hk(t)].filter(n=>n!=null).join("."),pk=r=>{let e=r.split("."),t=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:t,subsection:i,name:n,path:zw(t,i,n),sectionPath:zw(t,i,null),isSection:!!t}},jL=(r,e)=>r.reduce((t,n,i)=>e(n)?i:t,-1),Vw=class r{constructor(e){let t=null,n=null;this.parsedConfig=e?e.split(`
`).map(i=>{let s=null,a=null,o=i.trim(),l=BL(o),c=l!=null;if(c)[t,n]=l;else{let f=UL(o);f!=null&&([s,a]=f)}let u=zw(t,n,s);return{line:i,isSection:c,section:t,subsection:n,name:s,value:a,path:u}}):[]}static from(e){return new r(e)}async get(e,t=!1){let n=pk(e).path,i=this.parsedConfig.filter(s=>s.path===n).map(({section:s,name:a,value:o})=>{let l=fk[s]&&fk[s][a];return l?l(o):o});return t?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(t=>t.isSection&&t.section===e).map(t=>t.subsection)}async deleteSection(e,t){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===e&&n.subsection===t))}async append(e,t){return this.set(e,t,!0)}async set(e,t,n=!1){let{section:i,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=pk(e),u=jL(this.parsedConfig,f=>f.path===o);if(t==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:t,modified:!0});n?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:s,name:a,value:t,modified:!0,path:o};if(OL.test(i)&&LL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:i,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:t,subsection:n,name:i,value:s,modified:a=!1})=>a?i!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${i} = "${s}"`:` ${i} = ${s}`:n!=null?`[${t} "${n}"]`:`[${t}]`:e).join(`
`)}},vt=class{static async get({fs:e,gitdir:t}){let n=await e.read(`${t}/config`,{encoding:"utf8"});return Vw.from(n)}static async save({fs:e,gitdir:t,config:n}){await e.write(`${t}/config`,n.toString(),{encoding:"utf8"})}},fu=r=>[`${r}`,`refs/${r}`,`refs/tags/${r}`,`refs/heads/${r}`,`refs/remotes/${r}`,`refs/remotes/${r}/HEAD`],Ww=["config","description","index","shallow","commondir"];function Va(r){if(Ww.includes(r))throw new wn(r,`refs/heads/${r}`);if(!_l(r,!0))throw new wn(r,qa.default.clean(r))}var z=class r{static async updateRemoteRefs({fs:e,gitdir:t,remote:n,refs:i,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let b of i.values())if(!b.match(/[0-9a-f]{40}/))throw new Js(b);let u=await vt.get({fs:e,gitdir:t});if(!o){if(o=await u.getall(`remote.${n}.fetch`),o.length===0)throw new pu(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=jw.from(o),d=new Map,h=f.translate([...i.keys()]),p=[];for(let[b,y]of f.translate([...s.keys()])){let k=f.translateOne(s.get(b));k&&(Va(k),p.push([y,`ref: ${k}`]))}let g=a?[...i.keys()].filter(b=>b.startsWith("refs/tags")&&!b.endsWith("^{}")):[];for(let[,b]of h)Va(b);for(let[b]of p)Va(b);if(g.forEach(Va),c){let b=await r.listRefs({fs:e,gitdir:t,filepath:"refs/tags"});await r.deleteRefs({fs:e,gitdir:t,refs:b.map(y=>`refs/tags/${y}`)})}for(let b of g)if(!await r.exists({fs:e,gitdir:t,ref:b})){let y=i.get(b);d.set(b,y)}for(let[b,y]of h){let k=i.get(b);d.set(y,k)}for(let[b,y]of p)d.set(b,y);let w=[];if(l){for(let b of f.localNamespaces()){let y=(await r.listRefs({fs:e,gitdir:t,filepath:b})).map(k=>`${b}/${k}`);for(let k of y)d.has(k)||w.push(k)}w.length>0&&await r.deleteRefs({fs:e,gitdir:t,refs:w})}for(let[b,y]of d)await Jt(b,async()=>e.write(L(t,b),`${y.trim()}
`,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:t,ref:n,value:i}){if(Va(n),!i.match(/[0-9a-f]{40}/))throw new Js(i);await Jt(n,async()=>e.write(L(t,n),`${i.trim()}
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:t,ref:n,value:i}){Va(n),await Jt(n,async()=>e.write(L(t,n),`ref: ${i.trim()}
`,"utf8"))}static async deleteRef({fs:e,gitdir:t,ref:n}){return r.deleteRefs({fs:e,gitdir:t,refs:[n]})}static async deleteRefs({fs:e,gitdir:t,refs:n}){n.forEach(Va),await Promise.all(n.map(o=>e.rm(L(t,o))));let i=await Jt("packed-refs",async()=>e.read(`${t}/packed-refs`,{encoding:"utf8"})),s=Yd.from(i),a=s.refs.size;for(let o of n)s.refs.has(o)&&s.delete(o);s.refs.size<a&&(i=s.toString(),await Jt("packed-refs",async()=>e.write(`${t}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:t,ref:n,depth:i=void 0,visited:s=new Set}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),r.resolve({fs:e,gitdir:t,ref:n,depth:i,visited:s});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let a=await r.packedRefs({fs:e,gitdir:t}),o=fu(n).filter(l=>!Ww.includes(l));for(let l of o){let c=await Jt(l,async()=>await e.read(`${t}/${l}`,{encoding:"utf8"})||a.get(l));if(c){if(s.has(l))throw new ue(`Circular reference detected while resolving ref "${l}"`);return s.add(l),r.resolve({fs:e,gitdir:t,ref:c.trim(),depth:i,visited:s})}}throw new Xe(n)}static async isUnbornBranch({fs:e,gitdir:t,ref:n}){let i;try{i=await r.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2})}catch(s){return!1}return i.startsWith("refs/heads/")?n==="HEAD"||fu(n).includes(i):!1}static async exists({fs:e,gitdir:t,ref:n}){try{return await r.expand({fs:e,gitdir:t,ref:n}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:t,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await r.packedRefs({fs:e,gitdir:t}),s=fu(n).filter(a=>!Ww.includes(a));for(let a of s)if(await Jt(a,async()=>e.exists(`${t}/${a}`))||i.has(a))return a;throw new Xe(n)}static async expandAgainstMap({ref:e,map:t}){let n=fu(e);for(let i of n)if(await t.has(i))return i;throw new Xe(e)}static resolveAgainstMap({ref:e,fullref:t=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:t,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),r.resolveAgainstMap({ref:e,fullref:t,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:t,oid:e};let s=fu(e);for(let a of s){let o=i.get(a);if(o)return r.resolveAgainstMap({ref:o.trim(),fullref:a,depth:n,map:i})}throw new Xe(e)}static async packedRefs({fs:e,gitdir:t}){let n=await Jt("packed-refs",async()=>e.read(`${t}/packed-refs`,{encoding:"utf8"}));return Yd.from(n).refs}static async listRefs({fs:e,gitdir:t,filepath:n}){let i=r.packedRefs({fs:e,gitdir:t}),s=null;try{s=await e.readdirDeep(`${t}/${n}`),s=s.map(a=>a.replace(`${t}/${n}/`,""))}catch(a){s=[]}for(let a of(await i).keys())a.startsWith(n)&&(a=a.replace(n+"/",""),s.includes(a)||s.push(a));return s.sort(TL),s}static async listBranches({fs:e,gitdir:t,remote:n}){return n?r.listRefs({fs:e,gitdir:t,filepath:`refs/remotes/${n}`}):r.listRefs({fs:e,gitdir:t,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:t}){return(await r.listRefs({fs:e,gitdir:t,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function zL(r,e){return ih(mk(r),mk(e))}function mk(r){return r.mode==="040000"?r.path+"/":r.path}function zk(r){switch(r){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: ${r}`)}function VL(r){let e=[],t=0;for(;t<r.length;){let n=r.indexOf(32,t);if(n===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next space character.`);let i=r.indexOf(0,t);if(i===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next null character.`);let s=r.slice(t,n).toString("utf8");s==="40000"&&(s="040000");let a=zk(s),o=r.slice(n+1,i).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 Ya(o);let f=r.slice(i+1,i+21).toString("hex");t=i+21,e.push({mode:s,path:o,oid:f,type:a})}return e}function WL(r){if(typeof r=="number"&&(r=r.toString(8)),r.match(/^0?4.*/))return"040000";if(r.match(/^1006.*/))return"100644";if(r.match(/^1007.*/))return"100755";if(r.match(/^120.*/))return"120000";if(r.match(/^160.*/))return"160000";throw new ue(`Could not understand file mode: ${r}`)}function qL(r){return!r.oid&&r.sha&&(r.oid=r.sha),r.mode=WL(r.mode),r.type||(r.type=zk(r.mode)),r}var Vr=class r{constructor(e){if(_.isBuffer(e))this._entries=VL(e);else if(Array.isArray(e))this._entries=e.map(qL);else throw new ue("invalid type passed to GitTree constructor");this._entries.sort(Uk)}static from(e){return new r(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
`)}toObject(){let e=[...this._entries];return e.sort(zL),_.concat(e.map(t=>{let n=_.from(t.mode.replace(/^0/,"")),i=_.from(" "),s=_.from(t.path,"utf8"),a=_.from([0]),o=_.from(t.oid,"hex");return _.concat([n,i,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},ea=class{static wrap({type:e,object:t}){let n=`${e} ${t.length}\0`,i=n.length,s=i+t.length,a=new Uint8Array(s);for(let o=0;o<i;o++)a[o]=n.charCodeAt(o);return a.set(t,i),a}static unwrap(e){let t=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,t).toString("utf8"),s=e.slice(t+1,n).toString("utf8"),a=e.length-(n+1);if(parseInt(s)!==a)throw new ue(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:i,object:_.from(e.slice(n+1))}}};async function Vk({fs:r,gitdir:e,oid:t}){let n=`objects/${t.slice(0,2)}/${t.slice(2)}`,i=await r.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function YL(r,e){let t=new oi(r),n=gk(t);if(n!==e.byteLength)throw new ue(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=gk(t),s,a=vk(t,e);if(a.byteLength===i)s=a;else{let o=[a],l=a.byteLength;for(;!t.eof();){let c=vk(t,e);o.push(c),l+=c.byteLength}if(i!==l)throw new ue(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`);s=_.concat(o,i)}return s}function gk(r){let e=0,t=0,n=null;do n=r.readUInt8(),e|=(n&127)<<t,t+=7;while(n&128);return e}function wk(r,e,t){let n=0,i=0;for(;t--;)e&1&&(n|=r.readUInt8()<<i),e>>=1,i+=8;return n}function vk(r,e){let t=r.readUInt8(),n=128,i=15,s=112;if(t&n){let a=wk(r,t&i,4),o=wk(r,(t&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return r.slice(t)}function ZL(r){let e=[r];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function Wk(r){return r[Symbol.asyncIterator]?r[Symbol.asyncIterator]():r[Symbol.iterator]?r[Symbol.iterator]():r.next?r:ZL(r)}var Kd=class{constructor(e){if(typeof _=="undefined")throw new Error("Missing Buffer dependency");this.stream=Wk(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:t}=await this.stream.next();return e&&(this._ended=!0,!t)?_.alloc(0):(t&&(t=_.from(t)),t)}_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 t=[this.buffer];for(;this.cursor+e>KL(t);){let n=await this._next();if(this._ended)break;t.push(n)}this.buffer=_.concat(t)}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 KL(r){return r.reduce((e,t)=>e+t.length,0)}async function XL(r,e){let t=new Kd(r),n=await t.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new ue(`Invalid PACK header '${n}'`);let i=await t.read(4);if(i=i.readUInt32BE(0),i!==2)throw new ue(`Invalid packfile version: ${i}`);let s=await t.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!t.eof()&&s--;){let a=t.tell(),{type:o,length:l,ofs:c,reference:u}=await QL(t),f=new nh.default.Inflate;for(;!f.result;){let d=await t.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 t.undo(),await t.read(d.length-f.strm.avail_in);let h=t.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function QL(r){let e=await r.byte(),t=e>>4&7,n=e&15;if(e&128){let a=4;do e=await r.byte(),n|=(e&127)<<a,a+=7;while(e&128)}let i,s;if(t===6){let a=0;i=0;let o=[];do e=await r.byte(),i|=(e&127)<<a,a+=7,o.push(e);while(e&128);s=_.from(o)}return t===7&&(s=await r.read(20)),{type:t,l Line truncated
`,r}function Xd(r){let[,e,t,n,i]=r.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:t,timestamp:Number(n),timezoneOffset:cN(i)}}function cN(r){let[,e,t,n]=r.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(t)*60+Number(n)),uN(n)}function uN(r){return r===0?r:-r}var vn=class r{constructor(e){if(typeof e=="string")this._tag=e;else if(_.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=r.render(e);else throw new ue("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new r(e)}static render(e){return`object ${e.object}
type ${e.type}
tag ${e.tag}
tagger ${Qg(e.tagger)}
tagger ${qw(e.tagger)}
${e.message}
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
@@ -37,72 +37,72 @@ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
`)+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=Td(i.tagger)),i.committer&&(i.committer=Td(i.committer)),i}withoutSignature(){let e=Qn(this._tag);return e.indexOf(`
`),t=[];for(let i of e)i[0]===" "?t[t.length-1]+=`
`+i.slice(1):t.push(i);let n={};for(let i of t){let s=i.slice(0,i.indexOf(" ")),a=i.slice(i.indexOf(" ")+1);Array.isArray(n[s])?n[s].push(a):n[s]=a}return n.tagger&&(n.tagger=Xd(n.tagger)),n.committer&&(n.committer=Xd(n.committer)),n}withoutSignature(){let e=hs(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 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(`
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return hs(e)}payload(){return this.withoutSignature()+`
`}toObject(){return _.from(this._tag,"utf8")}static async sign(e,t,n){let i=e.payload(),{signature:s}=await t({payload:i,secretKey:n});s=hs(s);let a=i+s;return r.from(a)}};function Ow(r){return r.trim().split(`
`).map(e=>" "+e).join(`
`)+`
`}function $L(t){return t.split(`
`}function fN(r){return r.split(`
`).map(e=>e.replace(/^ /,"")).join(`
`)}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(`
`)}var Wr=class r{constructor(e){if(typeof e=="string")this._commit=e;else if(_.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=r.render(e);else throw new ue("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:t}){let n=r.justHeaders(e),i=r.justMessage(e),s=hs(n+`
gpgsig`+Ow(t)+`
`+i);return new r(s)}static from(e){return new r(e)}toObject(){return _.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return r.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return hs(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=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 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 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
`))}parseHeaders(){let e=r.justHeaders(this._commit).split(`
`),t=[];for(let i of e)i[0]===" "?t[t.length-1]+=`
`+i.slice(1):t.push(i);let n={parent:[]};for(let i of t){let s=i.slice(0,i.indexOf(" ")),a=i.slice(i.indexOf(" ")+1);Array.isArray(n[s])?n[s].push(a):n[s]=a}return n.author&&(n.author=Xd(n.author)),n.committer&&(n.committer=Xd(n.committer)),n}static renderHeaders(e){let t="";if(e.tree?t+=`tree ${e.tree}
`:t+=`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)t+=`parent ${s}
`}let n=e.author;t+=`author ${qw(n)}
`;let i=e.committer||e.author;return t+=`committer ${qw(i)}
`,e.gpgsig&&(t+="gpgsig"+Ow(e.gpgsig)),t}static render(e){return r.renderHeaders(e)+`
`+hs(e.message)}render(){return this._commit}withoutSignature(){let e=hs(this._commit);if(e.indexOf(`
gpgsig`)===-1)return e;let t=e.slice(0,e.indexOf(`
gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
`)+28);return hs(t+`
`+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return fN(e)}static async sign(e,t,n){let i=e.withoutSignature(),s=r.justMessage(e._commit),{signature:a}=await t({payload:i,secretKey:n});a=hs(a);let l=r.justHeaders(e._commit)+`
gpgsig`+Ow(a)+`
`+s;return r.from(l)}};async function Cl({fs:r,cache:e,gitdir:t,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Vr.from([]),oid:n};let{type:i,object:s}=await at({fs:r,cache:e,gitdir:t,oid:n});if(i==="tag")return n=vn.from(s).parse().object,Cl({fs:r,cache:e,gitdir:t,oid:n});if(i==="commit")return n=Wr.from(s).parse().tree,Cl({fs:r,cache:e,gitdir:t,oid:n});if(i!=="tree")throw new br(n,i,"tree");return{tree:Vr.from(s),oid:n}}var Yw=class{constructor({fs:e,gitdir:t,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=t,this.mapPromise=(async()=>{let a=new Map,o;try{o=await z.resolve({fs:e,gitdir:t,ref:n})}catch(c){if(c instanceof Xe&&await z.isUnbornBranch({fs:e,gitdir:t,ref:n}))o="4b825dc642cb6eb9a060e54bf8d69288fbee4904";else throw c}let l=await Cl({fs:e,cache:this.cache,gitdir:t,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 t=e._fullpath,{fs:n,cache:i,gitdir:s}=this,a=await this.mapPromise,o=a.get(t);if(!o)throw new Error(`No obj for ${t}`);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 at({fs:n,cache:i,gitdir:s,oid:l});if(c!==o.type)throw new br(l,c,o.type);let f=Vr.from(u);for(let d of f)a.set(L(t,d.path),d);return f.entries().map(d=>L(t,d.path))}async type(e){if(e._type===!1){let t=await this.mapPromise,{type:n}=t.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let t=await this.mapPromise,{mode:n}=t.get(e._fullpath);e._mode=Hk(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let t=await this.mapPromise,{fs:n,cache:i,gitdir:s}=this,o=t.get(e._fullpath).oid,{type:l,object:c}=await at({fs:n,cache:i,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 n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function jr({ref:r="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,sh,{value:function({fs:t,gitdir:n,cache:i}){return new Yw({fs:t,gitdir:n,ref:r,cache:i})}}),Object.freeze(e),e}var Zw=class{constructor({fs:e,dir:t,gitdir:n,cache:i,refresh:s=!0}){this.fs=e,this.cache=i,this.dir=t,this.gitdir=n,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 t=e._fullpath,{fs:n,dir:i}=this,s=await n.readdir(L(i,t));return s===null?null:s.map(a=>L(t,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:t,dir:n}=this,i=await t.lstat(`${n}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=i.isDirectory()?"tree":"blob";s==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(s="special"),e._type=s,i=yl(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:t,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await t.readlink(`${n}/${e._fullpath}`);else{let o=await(await this._getGitConfig(t,i)).get("core.autocrlf");s=await t.read(`${n}/${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 t=this,{fs:n,gitdir:i,cache:s}=this,a;await yt.acquire({fs:n,gitdir:i,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await t._getGitConfig(n,i)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Wd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await Bi(ea.wrap({type:"blob",object:h})),t.refresh&&l&&a===l.oid&&(!f||c.mode===l.mode)&&Wd(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,t){return this.config?this.config:(this.config=await vt.get({fs:e,gitdir:t}),this.config)}};function Fu({refresh:r=!0}={}){let e=Object.create(null);return Object.defineProperty(e,sh,{value:function({fs:t,dir:n,gitdir:i,cache:s}){return new Zw({fs:t,dir:n,gitdir:i,cache:s,refresh:r})}}),Object.freeze(e),e}function dN(r,e){let t=e-r;return Array.from({length:t},(n,i)=>r+i)}var Yk=typeof Array.prototype.flat=="undefined"?r=>r.reduce((e Line truncated
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=_.from(n)),n}catch(n){return null}}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch(i){await this.mkdir(Za(e)),await this._writeFile(e,t,n)}}async mkdir(e){await Zk(this._mkdir,e)}async rm(e){try{await this._unlink(e)}catch(t){if(t.code!=="ENOENT")throw t}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){try{let t=await this._readdir(e);return t.sort(ih),t}catch(t){return t.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async i=>{let s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(t){if(t.code==="ENOENT"||(t.code||"").includes("ENS"))return null;throw t}}async readlink(e,t={encoding:"buffer"}){try{let n=await this._readlink(e,t);return _.isBuffer(n)?n:_.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(e,t){return this._symlink(t.toString("utf8"),e)}};function P(r,e){if(e===void 0)throw new zr(r)}function gN(r){return r.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(r)}async function J({fsp:r,dotgit:e}){P("fsp",r),P("dotgit",e);let t=await r._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return t.isDirectory()?e:t.isFile()?r._readFile(e,"utf8").then(n=>n.trimRight().substr(8)).then(n=>gN(n)?n:L(Za(e),n)):e}async function Qd(r,e){return!r&&!e?!1:r&&!e||!r&&e?!0:!(await r.type()==="tree"&&await e.type()==="tree"||await r.type()===await e.type()&&await r.mode()===await e.mode()&&await r.oid()===await e.oid())}async function wN({fs:r,dir:e,gitdir:t=L(e,".git"),commit:n="HEAD",cache:i={}}){try{P("fs",r),P("dir",e),P("gitdir",t);let s=new Z(r),a=[jr({ref:n}),Fu(),Ka()],o=[],l=await J({fsp:s,dotgit:t});await yt.acquire({fs:s,gitdir:l,cache:i},async function(u){o=u.unmergedPaths});let c=await ps({fs:s,cache:i,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await Qd(d,h),g=o.includes(u),w=!await Qd(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(w)return!1;throw new Ru(u)}});await yt.acquire({fs:s,gitdir:l,cache:i},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 ra=class{static async isIgnored({fs:e,dir:t,gitdir:n=L(t,".git"),filepath:i}){if(qd(i)===".git")return!0;if(i===".")return!1;let s="",a=L(n,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:L(t,".gitignore"),filepath:i}],l=i.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:L(t,f,".gitignore"),filepath:d})}let c=!1;for(let[u,f]of o.entries()){let d;try{d=await e.read(f.gitignore,"utf8")}catch(g){if(g.code==="NOENT")continue}let h=(0,Nk.default)();u===0&&h.add(s),h.add(d);let p=Za(f.filepath);if(p!=="."&&h.ignores(p))return!0;c?c=!h.test(f.filepath).unignored:c=h.test(f.filepath).ignored}return c}};async function vN({fs:r,gitdir:e,object:t,format:n,oid:i}){if(n!=="deflated")throw new ue("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${i.slice(0,2)}/${i.slice(2)}`,a=`${e}/${s}`;await r.exists(a)||await r.write(a,t)}var Dw=null;async function Kk(r){return Dw===null&&(Dw=yN()),Dw?bN(r):nh.default.deflate(r)}async function bN(r){let e=new CompressionStream("deflate"),t=new Blob([r]).stream().pipeThrough(e);return new Uint8Array(await new Response(t).arrayBuffer())}function yN(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(r){return!1}}async function qr({fs:r,gitdir:e,type:t,object:n,format:i="content",oid:s=void 0,dryRun:a=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=ea.wrap({type:t,object:n})),s=await Bi(n),n=_.from(await Kk(n))),a||await vN({fs:r,gitdir:e,object:n,format:"deflated",oid:s}),s}function Xk(r){let e;for(;~(e=r.indexOf(92));)r[e]=47;return r}async function _N({fs:r,dir:e,gitdir:t=L(e,".git"),filepath:n,cache:i={},force:s=!1,parallel:a=!0}){try{P("fs",r),P("dir",e),P("gitdir",t),P("filepath",n);let o=new Z(r),l=await J({fsp:o,dotgit:t});await yt.acquire({fs:o,gitdir:l,cache:i},async c=>{let f=await(await vt.get({fs:o,gitdir:l})).get("core.autocrlf");return Qw({dir:e,gitdir:l,fs:o,filepath:n,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}function xN(r,e){if(r.has({filepath:e}))return!0;let t=`${e}/`;for(let n of r.entriesMap.keys())if(n.startsWith(t))return!0;return!1}async function Qw({dir:r,gitdir:e,fs:t,filepath:n,index:i,force:s,parallel:a,auto Line truncated
`,author:l,committer:c,signingKey:u})}async function kN({fs:r,onSign:e,dir:t,gitdir:n=L(t,".git"),ref:i="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{P("fs",r),P("gitdir",n),P("oid",s),P("note",a),u&&P("onSign",e);let d=new Z(r),h=await na({fs:d,gitdir:n,author:l});if(!h)throw new ur("author");let p=await eo({fs:d,gitdir:n,author:h,committer:c});if(!p)throw new ur("committer");let g=await J({fsp:d,dotgit:n});return await SN({fs:d,cache:f,onSign:e,gitdir:g,ref:i,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}async function nC({fs:r,gitdir:e,remote:t,url:n,force:i}){if(!_l(t,!0))throw new wn(t,qa.default.clean(t));let s=await vt.get({fs:r,gitdir:e});if(!i&&(await s.getSubsections("remote")).includes(t)&&n!==await s.get(`remote.${t}.url`))throw new li("remote",t);await s.set(`remote.${t}.url`,n),await s.set(`remote.${t}.fetch`,`+refs/heads/*:refs/remotes/${t}/*`),await vt.save({fs:r,gitdir:e,config:s})}async function CN({fs:r,dir:e,gitdir:t=L(e,".git"),remote:n,url:i,force:s=!1}){try{P("fs",r),P("gitdir",t),P("remote",n),P("url",i);let a=new Z(r),o=await J({fsp:a,dotgit:t});return await nC({fs:a,gitdir:o,remote:n,url:i,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function AN({fs:r,cache:e,onSign:t,gitdir:n,ref:i,tagger:s,message:a=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await z.exists({fs:r,gitdir:n,ref:i}))throw new li("tag",i);let f=await z.resolve({fs:r,gitdir:n,ref:l||"HEAD"}),{type:d}=await at({fs:r,cache:e,gitdir:n,oid:f}),h=vn.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await vn.sign(h,t,c));let p=await qr({fs:r,gitdir:n,type:"tag",object:h.toObject()});await z.writeRef({fs:r,gitdir:n,ref:i,value:p})}async function TN({fs:r,onSign:e,dir:t,gitdir:n=L(t,".git"),ref:i,tagger:s,message:a=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{P("fs",r),P("gitdir",n),P("ref",i),c&&P("onSign",e);let d=new Z(r),h=await J({fsp:d,dotgit:n}),p=await na({fs:d,gitdir:h,author:s});if(!p)throw new ur("tagger");return await AN({fs:d,cache:f,onSign:e,gitdir:h,ref:i,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function RN({fs:r,gitdir:e,ref:t,object:n,checkout:i=!1,force:s=!1}){if(!_l(t,!0))throw new wn(t,qa.default.clean(t));let a=`refs/heads/${t}`;if(!s&&await z.exists({fs:r,gitdir:e,ref:a}))throw new li("branch",t,!1);let o;try{o=await z.resolve({fs:r,gitdir:e,ref:n||"HEAD"})}catch(l){}o&&await z.writeRef({fs:r,gitdir:e,ref:a,value:o}),i&&await z.writeSymbolicRef({fs:r,gitdir:e,ref:"HEAD",value:a})}async function PN({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n,object:i,checkout:s=!1,force:a=!1}){try{P("fs",r),P("gitdir",t),P("ref",n);let o=new Z(r),l=await J({fsp:o,dotgit:t});return await RN({fs:o,gitdir:l,ref:n,object:i,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}async function Iu(r,e,t){let n=t.split("/");n.pop();let i=e;for(let s of n){if(s===""||s===".")continue;i=`${i}/${s}`;let a=await r.lstat(i);if(a&&a.isSymbolicLink())throw new Ya(t)}}var iC=(r,e)=>{if(r==="."||e==null||e.length===0||e===".")return!0;let t=e.endsWith("/")?e.slice(0,-1):e;return t==="."?!0:t.length>=r.length?t===r||t.startsWith(`${r}/`):r.startsWith(`${t}/`)};async function rv({fs:r,cache:e,onProgress:t,onPostCheckout:n,dir:i,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,restoreFromIndex:p=!1,nonBlocking:g=!1,batchSize:w=100}){let b;if(n)try{b=await z.resolve({fs:r,gitdir:s,ref:"HEAD"})}catch(k){b="0000000000000000000000000000000000000000"}let y;try{y=await z.resolve({fs:r,gitdir:s,ref:o})}catch(k){if(o==="HEAD")throw k;let C=`${a}/${o}`;if(y=await z.resolve({fs:r,gitdir:s,ref:C}),h){let S=await vt.get({fs:r,gitdir:s});await S.set(`branch.${o}.remote`,a),await S.set(`branch.${o}.merge`,`refs/heads/${o}`),await vt.save({fs:r,gitdir:s,config:S})}await z.writeRef({fs:r,gitdir:s,ref:`refs/heads/${o}`,value:y})}if(!c){let k;try{k=await $N({fs:r,cache:e,onProgress:t,dir:i,gitdir:s,ref:o,force:d,filepaths:l,restoreFromIndex:p})}catch(x){throw x instanceof Xe&&x.data.what===y?new yu(o,y):x}let C=k.filter(([x])=>x==="conflict").map(([x,E])=>E);if(C.length>0)throw new wu(C);let S=k.filter(([x])=>x==="error").map(([x,E])=>E);if(S.length>0)throw new ue(S.join(", "));if(f){n&&await n({previousHead:b,newHead:y,type:l!=null&&l.length>0?"file":"branch"});return}let A=0,v=k.length;if(await yt.acquire({fs:r,gitdir:s,cache:e},async function(x){await Promise.all(k.filter(([E])=>E==="delete"||E==="delete-index").map(async function([E,R]){let $=`${i}/${R}`;E==="delete"&&await r.rm($),x.delete({filepath:R}),t&&await t({phase:"Updating workdir",loaded:++A,total:v})}))}),await yt.acquire({fs:r,gitdir:s,cache:e},async function(x){for(let[E,R]of k)if(E==="rmdir"||E==="rmdir-index"){let $=`${i}/${R}`;try{E==="rmdir"&&await r.rmd 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 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(`
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${n}
`);return{cleanMerge:h,mergedText:d}}async function aC({fs:r,cache:e,dir:t,gitdir:n=L(t,".git"),index:i,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=jr({ref:s}),g=jr({ref:a}),w=jr({ref:o}),b=[],y=[],k=[],C=[],S=await ps({fs:r,cache:e,dir:t,gitdir:n,trees:[p,g,w],map:async function(A,[v,x,E]){let R=qd(A),$=await Qd(v,x),D=await Qd(E,x);switch(`${$}-${D}`){case"false-false":return{mode:await x.mode(),path:R,oid:await x.oid(),type:await x.type()};case"false-true":return!E&&await v.type()==="tree"?{mode:await v.mode(),path:R,oid:await v.oid(),type:await v.type()}:E?{mode:await E.mode(),path:R,oid:await E.oid(),type:await E.type()}:void 0;case"true-false":return!v&&await E.type()==="tree"?{mode:await E.mode(),path:R,oid:await E.oid(),type:await E.type()}:v?{mode:await v.mode(),path:R,oid:await v.oid(),type:await v.type()}:void 0;case"true-true":{if(v&&E&&await v.type()==="tree"&&await E.type()==="tree")return{mode:await v.mode(),path:R,oid:await v.oid(),type:"tree"};if(v&&E&&await v.type()==="blob"&&await E.type()==="blob")return ON({fs:r,gitdir:n,path:R,ours:v,base:x,theirs:E,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async O=>{if(O.cleanMerge)d||i.insert({filepath:A,oid:O.mergeResult.oid,stage:0});else if(b.push(A),y.push(A),!d){let U="";x&&await x.type()==="blob"&&(U=await x.oid());let me=await v.oid(),Ne=await E.oid();i.delete({filepath:A}),U&&i.insert({filepath:A,oid:U,stage:1}),i.insert({filepath:A,oid:me,stage:2}),i.insert({filepath:A,oid:Ne,stage:3})}return O.mergeResult});if(x&&!v&&E&&await x.type()==="blob"&&await E.type()==="blob"){if(b.push(A),k.push(A),!d){let O=await x.oid(),U=await E.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:O,stage:1}),i.insert({filepath:A,oid:U,stage:3})}return{mode:await E.mode(),oid:await E.oid(),type:"blob",path:R}}if(x&&v&&!E&&await x.type()==="blob"&&await v.type()==="blob"){if(b.push(A),C.push(A),!d){let O=await x.oid(),U=await v.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:O,stage:1}),i.insert({filepath:A,oid:U,stage:2})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:R}}if(x&&!v&&!E&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new El}}},reduce:b.length!==0&&(!t||d)?void 0:async(A,v)=>{let x=v.filter(Boolean);if(A&&!(A&&A.type==="tree"&&x.length===0&&A.path!==".")){if(x.length>0||A.path==="."&&x.length===0){let R=new Vr(x).toObject(),$=await qr({fs:r,gitdir:n,type:"tree",object:R,dryRun:f});A.oid=$}return A}}});return b.length!==0?(t&&!d&&await ps({fs:r,cache:e,dir:t,gitdir:n,trees:[jr({ref:S.oid})],map:async function(A,[v]){let x=`${t}/${A}`;if(await v.type()==="blob"){let E=await v.mode(),R=await v.content();await r.write(x,R,{mode:E})}return!0}}),new Xa(b,y,k,C)):S.oid}async function ON({fs:r,gitdir:e,path:t,ours:n,base:i,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=MN}){let f="blob",d="100755",h="",p="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),p=_.from(await i.content()).toString("utf8"));let g=d===await n.mode()?await s.mode():await n.mode();if(await n.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:t,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:t,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:t,oid:await n.oid(),type:f}};let w=_.from(await n.content()).toString("utf8"),b=_.from(await s.content()).toString("utf8"),{mergedText:y,cleanMerge:k}=await u({branches:[l,a,o],contents:[p,w,b],path:t}),C=await qr({fs:r,gitdir:e,type:"blob",object:_.from(y,"utf8"),dryRun:c});return{cleanMerge:k,mergeResult:{mode:g,path:t,oid:C,type:f}}}var DN={stage:Ka,workdir:Fu};async function LN(r,e,t,n,i=null){let s=L(t,n),a=await r.lstat(s);if(!a)throw new Xe(s);if(a.isDirectory())throw new ue(`${s}: file expected, but found directory`);let o=i?await Vk({fs:r,gitdir:e,oid:i}):void 0,l=o?i:void 0;return o||await Jt(s,async()=>{let c=a.isSymbolicLink()?await r.readlink(s).then(Xk):await r.read(s);if(c===null)throw new Xe(s);l=await qr({fs:r,gitdir:e,type:"blob",object:c})}),l}async function NN({fs:r,dir:e,gitdir:t,entries:n}){async function i(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(i));s.oid=await Ou({fs:r,gitdir:t,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await LN(r,t,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(n.map(i))}async function Sk({fs:r,dir:e,gitdir:t,treePair:n}){let i=n[1]==="stage",s=n.map(h=>typeof h=="string"?DN[h]():h),a=[],u=await ps({fs:r,cache:{},dir:e,gitdir:t,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await ra.isIgnored({fs:r,dir:e,gitdir:t,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&a.push([p,g]),{mode:await g.mode(),path:h,oid:await g.oid(),type:await g.type()}},reduce:async(h,p)=>(p=p.filter(Boolean),h?(h.children=p,h):p.length>0 Line truncated
`).map(a=>i.add(a))}),i}static async write({fs:e,gitdir:t,oids:n}){let i=L(t,"shallow");if(n.size>0){let s=[...n].join(`
`)+`
`;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]
`;await Jt(i,async function(){await e.write(i,s,{encoding:"utf8"})})}else await Jt(i,async function(){await e.rm(i)})}};async function WN({fs:r,gitdir:e,oid:t}){let n=`objects/${t.slice(0,2)}/${t.slice(2)}`;return r.exists(`${e}/${n}`)}async function qN({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i}){let s=await r.readdir(L(t,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${t}/objects/pack/${a}`,l=await tv({fs:r,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new ue(l.error);if(l.offsets.has(n))return!0}return!1}async function Fk({fs:r,cache:e,gitdir:t,oid:n,format:i="content"}){let s=o=>at({fs:r,cache:e,gitdir:t,oid:o}),a=await WN({fs:r,gitdir:t,oid:n});return a||(a=await qN({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:s})),a}function eh({config:r,onAuth:e}){return e&&(async(t,n)=>{let i=n.username||await r.get(`credential.${t}.username`);return e(t,i?{...n,username:i}:n)})}function YN(r){let i="5041434b"+"00000002"+"00000000";return r.slice(0,12).toString("hex")===i}function cC(r,e){let t=r.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return t.includes(i)})}var oh={name:"isomorphic-git",version:"1.42.4",agent:"git/isomorphic-git@1.42.4"},bl=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 t=this._waiting;this._waiting=null,t({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 ZN(r){let e=r.indexOf("\r"),t=r.indexOf(`
`);return e===-1&&t===-1?-1:e===-1?t+1:t===-1?e+1:t===e+1?t+1:Math.min(e,t)+1}function uC(r){let e=new bl,t="";return(async()=>(await Du(r,n=>{for(n=n.toString("utf8"),t+=n;;){let i=ZN(t);if(i===-1||i===t.length&&t[i-1]==="\r")break;e.write(t.slice(0,i)),t=t.slice(i)}}),t.length>0&&e.write(t),e.end()))(),e}var th=class{static demux(e){let t=wt.streamReader(e),n=new bl,i=new bl,s=new bl,a=async function(){let o=await t();if(o===null)return a();if(o===!0){n.end(),s.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),n.end(),s.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(o)}a()};return a(),{packetlines:n,packfile:i,progress:s}}};async function KN(r){let{packetlines:e,packfile:t,progress:n}=th.demux(r),i=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{Du(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Js(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Js(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&&(r.error?u(r.error):c({shallows:i,unshallows:s,acks:a,nak:o,packfile:t,progress:n}))}).finally(()=>{l||(r.error?u(r.error):c({shallows:i,unshallows:s,acks:a,nak:o,packfile:t,progress:n}))})})}function XN({capabilities:r=[],wants:e=[],haves:t=[],shallows:n=[],depth:i=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${r.join(" ")}`;for(let c of e)o.push(wt.encode(`want ${c}${l}
`)),l="";for(let c of n)o.push(wt.encode(`shallow ${c}
`));i!==null&&o.push(wt.encode(`deepen ${i}
`)),s!==null&&o.push(wt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
`));for(let c of a)o.push(wt.encode(`deepen-not ${c}
`));o.push(wt.flush());for(let c of t)o.push(wt.encode(`have ${c}
`));return o.push(wt.encode(`done
`)),o}async function nv({fs:r,cache:e,http:t,onProgress:n,onMessage:i,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:w=[],relative:b=!1,tags:y=!1,singleBranch:k=!1,headers:C={},prune:S=!1,pruneTags:A=!1}){let v=c||await sa({fs:r,gitdir:l,test:!0}),x=await vt.get({fs:r,gitdir:l}),E=f||v&&await x.get(`branch.${v}.remote`)||"origin",R=d||await x.get(`remote.${E}.url`);if(typeof R=="undefined")throw new zr("remote OR url");let $=u||v&&await x.get(`branch.${v}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let D=Tl.getRemoteHelperFor({url:R}),O=await D.discover({http:t,onAuth:eh({config:x,onAuth:s}),onAuthSuccess:a,onAuthFailure:eh({config:x,onAuth:o}),corsProxy:h,service:"git-upload-pack",url:R,headers:C,protocolVersion:1}),U=O.auth,me=O.refs;if(me.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!O.capabilities.has("shallow"))throw new Qs("shallow","depth");if(g!==null&&!O.capabilities.has("deepen-since"))throw new Qs("deepen-since","since");if(w.length>0&&!O.capabilities.has("deepen-not"))throw new Qs("deepen-not","exclude");if(b===!0&&!O.capabilities.has("deepen-relative"))throw new Qs("deepen-relative","relative");let{oid:Ne,fullref:Re}=z.resolveAgainstMap({ref:$,map:me});for(let ke of me.keys())ke===Re||ke==="HEAD"||ke.startsWith("refs/heads/")||y&&ke.startsWith("refs/tags/")||me.delete(ke);let be=cC([...O.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${oh.agent}`]);b&&be.push("deepen-relative");let ye=k?[Ne]:me.values(),ae=k?[v]:await z.listRefs({fs:r,gitdir:l,filepath:"refs"}),W=[];for(let ke of ae)try{ke=await z.expand({fs:r,gitdir:l,ref:ke});let It=await z.resolve({fs:r,gitdir:l,ref:ke});await Fk({fs:r,cache:e,gitdir:l,oid:It})&&W.push(It)}catch(It){}W=[...new Set(W)];let te=await ia.read({fs:r,gitdir:l}),H=O.capabilities.has("shallow")?[...te]:[],St=XN({capabilities:be,wants:ye,haves:W,shallows:H,depth:p,since:g,exclude:w}),st=_.from(await Jd(St)),Bt=await D.connect({http:t,onProgress:n,corsProxy:h,service:"git-upload-pack",url:R,auth:U,body:[st],headers:C}),Ze=await KN(Bt.body);Bt.headers&&(Ze.headers=Bt.headers);for(let ke of Ze.shallows)if(!te.has(ke))try{let{object:It}=await at({fs:r,cache:e,gitdir:l,oid:ke}),kr=new Wr(It),pn=await Promise.all(kr.headers().parent.map(Ra=>Fk({fs:r,cache:e,gitdir:l,oid:Ra})));pn.length===0||pn.every(Ra=>Ra)||te.add(ke)}catch(It){te.add(ke)}for(let ke of Ze.unshallows)te.delete(ke);if(await ia.write({fs:r,gitdir:l,oids:te}),k){let ke=new Map([[Re,Ne]]),It=new Map,kr=10,pn=Re;for(;kr--;){let Dc=O.symrefs.get(pn);if(Dc===void 0)break;It.set(pn,Dc),pn=Dc}let Oc=me.get(pn);Oc&&ke.set(pn,Oc);let{pruned:Ra}=await z.updateRemoteRefs({fs:r,gitdir:l,remote:E,refs:ke,symrefs:It,tags:y,prune:S});S&&(Ze.pruned=Ra)}else{let{pruned:ke}=await z.updateRemoteRefs({fs:r,gitdir:l,remote:E,refs:me,symrefs:O.symrefs,tags:y,prune:S,pruneTags:A});S&&(Ze.pruned=ke)}if(Ze.HEAD=O.symrefs.get("HEAD"),Ze.HEAD===void 0){let{oid:ke}=z.resolveAgainstMap({ref:"HEAD",map:me});for(let[It,kr]of me.entries())if(It!=="HEAD"&&kr===ke){Ze.HEAD=It;break}}let kt=Re.startsWith("refs/tags")?"tag":"branch";if(Ze.FETCH_HEAD={oid:Ne,description:`${kt} '${Wa(Re)}' of ${R}`},n||i){let ke=uC(Ze.progress);Du(ke,async It=>{if(i&&await i(It),n){let kr=It.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);kr&&await n({phase:kr[1].trim(),loaded:parseInt(kr[2],10),total:parseInt(kr[3],10)})}})}let Kt=_.from(await Jd(Ze.packfile));if(Bt.body.error)throw Bt.body.error;let Nr=Kt.slice(-20).toString("hex"),Br={defaultBranch:Ze.HEAD,fetchHead:Ze.FETCH_HEAD.oid,fetchHeadDescription:Ze.FETCH_HEAD.description};if(Ze.headers&&(Br.headers=Ze.headers),S&&(Br.pruned=Ze.pruned),Nr!==""&&!YN(Kt)){Br.packfile=`objects/pack/pack-${Nr}.pack`;let ke=L(l,Br.packfile);await r.write(ke,Kt);let It=pn=>at({fs:r,cache:e,gitdir:l,oid:pn}),kr=await mu.fromPack({pack:Kt,getExternalRefDelta:It,onProgress:n});await r.write(ke.replace(/\.pack$/,".idx"),await kr.toBuffer())}return Br}async function fC({fs:r,bare:e=!1,dir:t,gitdir:n=e?t:L(t,".git"),defaultBranch:i="master"}){if(await r.exists(n+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>n+"/"+a);for(let a of s)await r.mkdir(a);await r.write(n+"/config",`[core]
repositoryformatversion = 0
filemode = false
bare = ${e}
`+(e?"":` logallrefupdates = true
`)+` symlinks = false
ignorecase = true
`),await t.write(i+"/HEAD",`ref: refs/heads/${n}
`)}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 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)}},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(`
`),await r.write(n+"/HEAD",`ref: refs/heads/${i}
`)}async function QN({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:w,exclude:b,relative:y,singleBranch:k,noCheckout:C,noTags:S,headers:A,nonBlocking:v,batchSize:x=100}){try{if(await fC({fs:r,gitdir:u}),await nC({fs:r,gitdir:u,remote:p,url:f,force:!1}),d){let $=await vt.get({fs:r,gitdir:u});await $.set("http.corsProxy",d),await vt.save({fs:r,gitdir:u,config:$})}let{defaultBranch:E,fetchHead:R}=await nv({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:w,exclude:b,relative:y,singleBranch:k,headers:A,tags:!S});if(R===null)return;h=h||E,h=h.replace("refs/heads/",""),await rv({fs:r,cache:e,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:C,nonBlocking:v,batchSize:x})}catch(E){throw await r.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),E}}async function JN({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=L(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:w=[],relative:b=!1,singleBranch:y=!1,noCheckout:k=!1,noTags:C=!1,headers:S={},cache:A={},nonBlocking:v=!1,batchSize:x=100}){try{P("fs",r),P("http",e),P("gitdir",c),k||P("dir",l),P("url",u);let E=new Z(r),R=await J({fsp:E,dotgit:c});return await QN({fs:E,cache:A,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:R,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:w,relative:b,singleBranch:y,noCheckout:k,noTags:C,headers:S,nonBlocking:v,batchSize:x})}catch(E){throw E.caller="git.clone",E}}async function eB({fs:r,onSign:e,dir:t,gitdir:n=L(t,".git"),message:i,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{P("fs",r),l||P("message",i),o&&P("onSign",e);let w=new Z(r),b=await J({fsp:w,dotgit:n});return await Mu({fs:w,cache:g,onSign:e,gitdir:b,message:i,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,disallowEmpty:f,ref:d,parent:h,tree:p})}catch(w){throw w.caller="git.commit",w}}async function tB({fs:r,dir:e,gitdir:t=L(e,".git"),fullname:n=!1,test:i=!1}){try{P("fs",r),P("gitdir",t);let s=new Z(r),a=await J({fsp:s,dotgit:t});return await sa({fs:s,gitdir:a,fullname:n,test:i})}catch(s){throw s.caller="git.currentBranch",s}}async function rB({fs:r,gitdir:e,ref:t}){if(t=t.startsWith("refs/heads/")?t:`refs/heads/${t}`,!await z.exists({fs:r,gitdir:e,ref:t}))throw new Xe(t);let i=await z.expand({fs:r,gitdir:e,ref:t}),s=await sa({fs:r,gitdir:e,fullname:!0});if(i===s){let l=await z.resolve({fs:r,gitdir:e,ref:i});await z.writeRef({fs:r,gitdir:e,ref:"HEAD",value:l})}await z.deleteRef({fs:r,gitdir:e,ref:i});let a=Wa(t),o=await vt.get({fs:r,gitdir:e});await o.deleteSection("branch",a),await vt.save({fs:r,gitdir:e,config:o})}async function nB({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n}){try{P("fs",r),P("ref",n);let i=new Z(r),s=await J({fsp:i,dotgit:t});return await rB({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function iB({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n}){try{P("fs",r),P("ref",n);let i=new Z(r),s=await J({fsp:i,dotgit:t});await z.deleteRef({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function sB({fs:r,gitdir:e,remote:t}){let n=await vt.get({fs:r,gitdir:e});await n.deleteSection("remote",t),await vt.save({fs:r,gitdir:e,config:n})}async function aB({fs:r,dir:e,gitdir:t=L(e,".git"),remote:n}){try{P("fs",r),P("remote",n);let i=new Z(r),s=await J({fsp:i,dotgit:t});return await sB({fs:i,gitdir:s,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function oB({fs:r,gitdir:e,ref:t}){t=t.startsWith("refs/tags/")?t:`refs/tags/${t}`,await z.deleteRef({fs:r,gitdir:e,ref:t})}async function lB({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n}){try{P("fs",r),P("ref",n);let i=new Z(r),s=await J({fsp:i,dotgit:t});return await oB({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function cB({fs:r,gitdir:e,oid:t}){let n=t.slice(0,2);return(await r.readdir(`${e}/objects/${n}`)).map(s=>`${n}${s}`).filter(s=>s.startsWith(t))}async function uB({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i}){let s=[],a=await r.readdir(L(t,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${t}/objects/pack/${o}`,c=await tv({fs:r,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new ue(c.error);for(let u of c.offsets.keys())u.startsWith(n)&&s.push(u)}return s}async function fB({fs:r,cache:e,gitdir:t,oid:n}){let i=o=>at({fs:r,cache:e,gitdir:t,oid:o}),s=await cB({fs:r,gitdir:t,oid:n}),a=await uB({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new gu("oids",n,s):new Xe(`an object matching "${n}"`)}async fun Line truncated
`)),n.push(wt.encode(`agent=${oh.agent}
`)),(t||e||r)&&n.push(wt.delim()),t&&n.push(wt.encode("peel")),e&&n.push(wt.encode("symrefs")),r&&n.push(wt.encode(`ref-prefix ${r}`)),n.push(wt.flush()),n}async function UB({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{P("http",r),P("url",s);let d=await Al.discover({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return mC(d,c,u,f);let h=await BB({prefix:c,symrefs:u,peelTags:f}),p=await Al.connect({http:r,auth:d.auth,headers:a,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return NB(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function HB({fs:r,dir:e,gitdir:t=L(e,".git")}){try{P("fs",r),P("gitdir",t);let n=new Z(r),i=await J({fsp:n,dotgit:t});return z.listTags({fs:n,gitdir:i})}catch(n){throw n.caller="git.listTags",n}}function GB(r,e){return r.committer.timestamp-e.committer.timestamp}var jB="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function Ok({fs:r,cache:e,gitdir:t,oid:n,fileId:i}){if(i===jB)return;let s=n,a,o=await Cl({fs:r,cache:e,gitdir:t,oid:n}),l=o.tree;return i===o.oid?a=o.path:(a=await vC({fs:r,cache:e,gitdir:t,tree:l,fileId:i,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function vC({fs:r,cache:e,gitdir:t,tree:n,fileId:i,oid:s,filepaths:a=[],parentPath:o=""}){let l=n.entries().map(function(c){let u;return c.oid===i?(u=L(o,c.path),a.push(u)):c.type==="tree"&&(u=at({fs:r,cache:e,gitdir:t,oid:c.oid}).then(function({object:f}){return vC({fs:r,cache:e,gitdir:t,tree:Vr.from(f),fileId:i,oid:s,filepaths:a,parentPath:L(o,c.path)})})),u});return await Promise.all(l),a}async function zB({fs:r,cache:e,gitdir:t,filepath:n,ref:i,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 ia.read({fs:r,gitdir:t}),h=await z.resolve({fs:r,gitdir:t,ref:i}),p=[await Ni({fs:r,cache:e,gitdir:t,oid:h})],g,w,b,y;function k(C){y&&n&&f.push(C)}for(;p.length>0;){let C=p.pop();if(u!==void 0&&C.commit.committer.timestamp<=u)break;if(n){let S;try{S=await tC({fs:r,cache:e,gitdir:t,oid:C.commit.tree,filepath:n}),b&&(g!==S.oid||w!==S.mode)&&f.push(b),g=S.oid,w=S.mode,b=C,y=!0}catch(A){if(A instanceof Xe){let v=l&&g;if(v&&(v=await Ok({fs:r,cache:e,gitdir:t,oid:C.commit.tree,fileId:g}),v))if(Array.isArray(v)){if(b){let x=await Ok({fs:r,cache:e,gitdir:t,oid:b.commit.tree,fileId:g});if(Array.isArray(x))if(v=v.filter(E=>x.indexOf(E)===-1),v.length===1)v=v[0],n=v,b&&f.push(b);else{v=!1,b&&f.push(b);break}}}else n=v,b&&f.push(b);if(!v){if(y&&g&&(f.push(b),!o))break;if(!o&&!l)throw A}b=C,y=!1}else throw A}}else f.push(C);if(s!==void 0&&f.length===s){k(C);break}if(!d.has(C.oid))for(let S of C.commit.parent){let A=await Ni({fs:r,cache:e,gitdir:t,oid:S});p.map(v=>v.oid).includes(A.oid)||p.push(A)}p.length===0&&k(C),p.sort((S,A)=>GB(S.commit,A.commit))}if(c)for(let C of f)C.commit.changes=await VB({fs:r,cache:e,gitdir:t,commit:C,shallow:d.has(C.oid)});return f}async function VB({fs:r,cache:e,gitdir:t,commit:n,shallow:i}){let s=i||!n.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":n.commit.parent[0];return ps({fs:r,cache:e,gitdir:t,trees:[jr({ref:n.oid}),jr({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 WB({fs:r,dir:e,gitdir:t=L(e,".git"),filepath:n,ref:i="HEAD",depth:s,since:a,force:o,follow:l,includeChanges:c=!1,cache:u={}}){try{P("fs",r),P("gitdir",t),P("ref",i);let f=new Z(r),d=await J({fsp:f,dotgit:t});return await zB({fs:f,cache:u,gitdir:d,filepath:n,ref:i,depth:s,since:a,force:o,follow:l,includeChanges:c})}catch(f){throw f.caller="git.log",f}}async function qB({fs:r,onSign:e,dir:t,gitdir:n=L(t,".git"),ours:i,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:w,allowUnrelatedHistories:b=!1}){try{P("fs",r),p&&P("onSign",e);let y=new Z(r),k=await J({fsp:y,dotgit:n}),C=await na({fs:y,gitdir:k,author:d});if(!C&&(!o||!a))throw new ur("author");let S=await eo({fs:y,gitdir:k,author:C,committer:h});if(!S&&(!o||!a))throw new ur("committer");return await dC({fs:y,cache:g,dir:t,gitdir:k,ours:i,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:C,committer:S,signingKey:p,onSign:e,mergeDriver:w,allowUnrelatedHistories:b})}catch(y){throw y.caller="git.merge",y}}var YB={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function bC({fs:r,cache:e,dir:t,gitdir:n=L(t,".git"),oids:i}){let s=new ev.default,a=[];function o(u,f){let d=_.from Line truncated
`),i=await n();let s=t.toString("utf8").split(`
`);if(i=s.shift(),!i.startsWith("unpack "))throw new Ja('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.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 e3({capabilities:r=[],triplets:e=[]}){let t=[],n=`\0 ${r.join(" ")}`;for(let i of e)t.push(wt.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
`)),n="";return t.push(wt.flush()),t}async function t3({fs:r,cache:e,http:t,onProgress:n,onMessage:i,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:w,headers:b={},signal:y}){let k=u||await sa({fs:r,gitdir:c});if(typeof k=="undefined")throw new zr("ref");let C=await vt.get({fs:r,gitdir:c});d=d||await C.get(`branch.${k}.pushRemote`)||await C.get("remote.pushDefault")||await C.get(`branch.${k}.remote`)||"origin";let S=h||await C.get(`remote.${d}.pushurl`)||await C.get(`remote.${d}.url`);if(typeof S=="undefined")throw new zr("remote OR url");let A=f||await C.get(`branch.${k}.merge`);if(typeof S=="undefined")throw new zr("remoteRef");w===void 0&&(w=await C.get("http.corsProxy"));let v=await z.expand({fs:r,gitdir:c,ref:k}),x=g?"0000000000000000000000000000000000000000":await z.resolve({fs:r,gitdir:c,ref:v}),E=Tl.getRemoteHelperFor({url:S}),R=await E.discover({http:t,onAuth:eh({config:C,onAuth:s}),onAuthSuccess:a,onAuthFailure:eh({config:C,onAuth:o}),corsProxy:w,service:"git-receive-pack",url:S,headers:b,protocolVersion:1,signal:y}),$=R.auth,D;if(!A)D=v;else try{D=await z.expandAgainstMap({ref:A,map:R.refs})}catch(H){if(H instanceof Xe)D=A.startsWith("refs/")?A:`refs/heads/${A}`;else throw H}let O=R.refs.get(D)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:S,localRef:{ref:g?"(delete)":v,oid:x},remoteRef:{ref:D,oid:O}}))throw new kl;let U=!R.capabilities.has("no-thin"),me=new Set;if(!g){let H=[...R.refs.values()],St=new Set;if(O!=="0000000000000000000000000000000000000000"){let st=[];try{st=await iv({fs:r,cache:e,gitdir:c,oids:[x,O]})}catch(Bt){st=[]}for(let Bt of st)H.push(Bt);U&&(St=await Uw({fs:r,cache:e,gitdir:c,oids:st}))}if(!H.includes(x)){let st=await QB({fs:r,cache:e,gitdir:c,start:[x],finish:H});me=await Uw({fs:r,cache:e,gitdir:c,oids:st})}if(U){try{let st=await z.resolve({fs:r,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Bt}=await z.resolveAgainstMap({ref:st.replace(`refs/remotes/${d}/`,""),fullref:st,map:R.refs}),Ze=[Bt];for(let kt of await Uw({fs:r,cache:e,gitdir:c,oids:Ze}))St.add(kt)}catch(st){}for(let st of St)me.delete(st)}if(x===O&&(p=!0),!p){if(v.startsWith("refs/tags")&&O!=="0000000000000000000000000000000000000000")throw new Sl("tag-exists");if(x!=="0000000000000000000000000000000000000000"&&O!=="0000000000000000000000000000000000000000"&&!await gC({fs:r,cache:e,gitdir:c,oid:x,ancestor:O,depth:-1}))throw new Sl("not-fast-forward")}}let Ne=cC([...R.capabilities],["report-status","side-band-64k",`agent=${oh.agent}`]),Re=await e3({capabilities:Ne,triplets:[{oldoid:O,oid:x,fullRef:D}]}),be=g?[]:await bC({fs:r,cache:e,gitdir:c,oids:[...me]}),ye=await E.connect({http:t,onProgress:n,corsProxy:w,service:"git-receive-pack",url:S,auth:$,headers:b,body:[...Re,...be],signal:y}),{packfile:ae,progress:W}=await th.demux(ye.body);if(i){let H=uC(W);Du(H,async St=>{await i(St)})}let te=await JB(ae);if(ye.headers&&(te.headers=ye.headers),d&&te.ok&&te.refs[D].ok&&!v.startsWith("refs/tags")){let H=`refs/remotes/${d}/${D.replace("refs/heads/","")}`;g?await z.deleteRef({fs:r,gitdir:c,ref:H}):await z.writeRef({fs:r,gitdir:c,ref:H,value:x})}if(te.ok&&Object.values(te.refs).every(H=>H.ok))return te;{let H=Object.entries(te.refs).filter(([St,st])=>!st.ok).map(([St,st])=>`
- ${St}: ${st.error}`).join("");throw new Su(H,te)}}async function r3({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=L(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:w,headers:b={},cache:y={},signal:k}){try{P("fs",r),P("http",e),P("gitdir",c);let C=new Z(r),S=await J({fsp:C,dotgit:c});return await t3({fs:C,cache:y,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:S,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:w,headers:b,signal:k})}catch(C){throw C.caller="git.push",C}}async function yC({fs:r,cache:e,gitdir:t,oid:n}){let{type:i,object:s}=await at({fs:r,cache:e,gitdir:t,oid:n});if(i==="tag")return n=vn.from(s).parse().object,yC({fs:r,cache:e,gitdir:t,oid:n});if(i!=="blob")throw new br(n,i,"blob");return{oid:n,blob:new Uint8Array(s)}}async function _C({fs:r,cache:e,gitdir:t,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await ah({fs:r,cache:e,gitdir:t,oid:n,filepath:i})),await yC({fs:r,cache:e,gitdir:t,oid:n})}async function Pl({fs:r,dir:e,gitdir:t=L(e,".git"),oid:n,filepath:i,cache:s={}}){try{P("fs",r),P("gitdir",t),P("oid",n);let a=new Z(r),o=await J({fsp:a,dotgit:t});return await _C({fs:a,cache:s,gitdir:o,oid:n,filepath:i})}catch(a){throw a.caller="git.readBlob",a}}async function xC({fs:r,dir:e,gitdir:t=L(e,".git"),oid:n,cache:i={}}){try{P("fs",r),P("gitdir",t),P("oid",n);let s=new Z(r),a=await J({fsp:s,dotgit:t});return await Ni({fs:s,cache:i,gitdir:a,oid:n})}catch(s){throw s.caller="git.readCommit",s}}async function n3({fs:r,cache:e,gitdir:t,ref:n="refs/notes/commits",oid:i}){let s=await z.resolve({gitdir:t,fs:r,ref:n}),{blob:a}=await _C({fs:r,cache:e,gitdir:t,oid:s,filepath:i});return a}async function i3({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n="refs/notes/commits",oid:i,cache:s={}}){try{P("fs",r),P("gitdir",t),P("ref",n),P("oid",i);let a=new Z(r),o=await J({fsp:a,dotgit:t});return await n3({fs:a,cache:s,gitdir:o,ref:n,oid:i})}catch(a){throw a.caller="git.readNote",a}}async function s3({fs:r,dir:e,gitdir:t=L(e,".git"),oid:n,format:i="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{P("fs",r),P("gitdir",t),P("oid",n);let l=new Z(r),c=await J({fsp:l,dotgit:t});s!==void 0&&(n=await ah({fs:l,cache:o,gitdir:c,oid:n,filepath:s}));let f=await at({fs:l,cache:o,gitdir:c,oid:n,format:i==="parsed"?"content":i});if(f.oid=n,i==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Wr.from(f.object).parse();break;case"tree":f.object=Vr.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=vn.from(f.object).parse();break;default:throw new br(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 a3({fs:r,cache:e,gitdir:t,oid:n}){let{type:i,object:s}=await at({fs:r,cache:e,gitdir:t,oid:n,format:"content"});if(i!=="tag")throw new br(n,i,"tag");let a=vn.from(s);return{oid:n,tag:a.parse(),payload:a.payload()}}async function o3({fs:r,dir:e,gitdir:t=L(e,".git"),oid:n,cache:i={}}){try{P("fs",r),P("gitdir",t),P("oid",n);let s=new Z(r),a=await J({fsp:s,dotgit:t});return await a3({fs:s,cache:i,gitdir:a,oid:n})}catch(s){throw s.caller="git.readTag",s}}async function l3({fs:r,dir:e,gitdir:t=L(e,".git"),oid:n,filepath:i=void 0,cache:s={}}){try{P("fs",r),P("gitdir",t),P("oid",n);let a=new Z(r),o=await J({fsp:a,dotgit:t});return await Rl({fs:a,cache:s,gitdir:o,oid:n,filepath:i})}catch(a){throw a.caller="git.readTree",a}}async function c3({fs:r,dir:e,gitdir:t=L(e,".git"),filepath:n,cache:i={}}){try{P("fs",r),P("gitdir",t),P("filepath",n);let s=new Z(r),a=await J({fsp:s,dotgit:t});await yt.acquire({fs:s,gitdir:a,cache:i},async function(o){o.delete({filepath:n})})}catch(s){throw s.caller="git.remove",s}}async function u3({fs:r,cache:e,onSign:t,gitdir:n,ref:i="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await z.resolve({gitdir:n,fs:r,ref:i})}catch(p){if(!(p instanceof Xe))throw p}let f=(await Rl({fs:r,cache:e,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await Ou({fs:r,gitdir:n,tree:f});return await Mu({fs:r,cache:e,onSign:t,gitdir:n,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
`,author:a,committer:o,signingKey:l})}async function f3({fs:r,onSign:e,dir:t,gitdir:n=L(t,".git"),ref:i="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{P("fs",r),P("gitdir",n),P("oid",s);let u=new Z(r),f=await J({fsp:u,dotgit:n}),d=await na({fs:u,gitdir:f,author:a});if(!d)throw new ur("author");let h=await eo({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new ur("committer");return await u3({fs:u,cache:c,onSign:e,gitdir:f,ref:i,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function d3({fs:r,gitdir:e,oldref:t,ref:n,checkout:i=!1}){if(!_l(n,!0))throw new wn(n,qa.default.clean(n));if(!_l(t,!0))throw new wn(t,qa.default.clean(t));let s=`refs/heads/${t}`,a=`refs/heads/${n}`;if(await z.exists({fs:r,gitdir:e,ref:a}))throw new li("branch",n,!1);let l=await z.resolve({fs:r,gitdir:e,ref:s,depth:1});await z.writeRef({fs:r,gitdir:e,ref:a,value:l}),await z.deleteRef({fs:r,gitdir:e,ref:s});let u=await sa({fs:r,gitdir:e,fullname:!0})===s;(i||u)&&await z.writeSymbolicRef({fs:r,gitdir:e,ref:"HEAD",value:a})}async function h3({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n,oldref:i,checkout:s=!1}){try{P("fs",r),P("gitdir",t),P("ref",n),P("oldref",i);let a=new Z(r),o=await J({fsp:a,dotgit:t});return await d3({fs:a,gitdir:o,ref:n,oldref:i,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function EC({gitdir:r,type:e,object:t}){return Bi(ea.wrap({type:e,object:t}))}async function p3({fs:r,dir:e,gitdir:t=L(e,".git"),filepath:n,ref:i,cache:s={}}){try{P("fs",r),P("gitdir",t),P("filepath",n);let a=new Z(r),o=await J({fsp:a,dotgit:t}),l,c;try{l=await z.resolve({fs:a,gitdir:o,ref:i||"HEAD"})}catch(d){if(i)throw d}if(l)try{l=await ah({fs:a,cache:s,gitdir:o,oid:l,filepath:n})}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(L(e,n));f&&(c=await EC({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(L(e,n)))),await yt.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:n}),l&&d.insert({filepath:n,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function m3({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n,depth:i}){try{P("fs",r),P("gitdir",t),P("ref",n);let s=new Z(r),a=await J({fsp:s,dotgit:t});return await z.resolve({fs:s,gitdir:a,ref:n,depth:i})}catch(s){throw s.caller="git.resolveRef",s}}async function g3({fs:r,dir:e,gitdir:t=L(e,".git"),path:n,value:i,append:s=!1}){try{P("fs",r),P("gitdir",t),P("path",n);let a=new Z(r),o=await J({fsp:a,dotgit:t}),l=await vt.get({fs:a,gitdir:o});s?await l.append(n,i):await l.set(n,i),await vt.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function SC({fs:r,gitdir:e,commit:t}){let n=Wr.from(t).toObject();return await qr({fs:r,gitdir:e,type:"commit",object:n,format:"content"})}var rh=class r{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),t=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${t.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,t,n){let i=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=r.timezoneOffsetForRefLogEntry;return`${s} ${t} ${i} ${e.email} ${a} ${o} ${n}
`}static getStashReflogEntry(e,t=!1){return e.split(`
`).filter(s=>s).reverse().map((s,a)=>t?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},to=class r{constructor({fs:e,dir:t,gitdir:n=L(t,".git")}){Object.assign(this,{fs:e,dir:t,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return L(this.gitdir,r.refStash)}get refLogsStashPath(){return L(this.gitdir,r.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await na({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new ur("author");return this._author}async getStashSHA(e,t){return await this.fs.exists(this.refStashPath)?(t||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:t,parent:n}){return SC({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:t,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let t=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>t.length-1))throw new wn(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,t);return n?Ni({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return z.writeRef({fs:this.fs,gitdir:this.gitdir,ref:r.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:t}){let n=await this.getAuthor(),i=rh.createStashReflogEntry(n,e,t),s=this.refLogsStashPath;await Jt(s,async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let t=await this.fs.read(this.refLogsStashPath,"utf8");return rh.getStashReflogEntry(t,e)}};async function kC({fs:r,dir:e,gitdir:t,message:n=""}){let i=new to({fs:r,dir:e,gitdir:t});await i.getAuthor();let s=await sa({fs:r,gitdir:t,fullname:!1}),a=await z.resolve({fs:r,gitdir:t,ref:"HEAD"}),l=(await xC({fs:r,dir:e,gitdir:t,oid:a})).commit.message,c=[a],u=null,f=jr({ref:"HEAD"}),d=await Sk({fs:r,dir:e,gitdir:t,treePair:[jr({ref:"HEAD"}),"stage"]});if(d){let w=await i.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(w),u=d,f=Ka()}let h=await Sk({fs:r,dir:e,gitdir:t,treePair:[f,"workdir"]});if(h){let w=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(w),u=h}if(!u||!d&&!h)throw new Xe("changes, nothing to stash");let p=(n.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await i.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:i}}async function w3({fs:r,dir:e,gitdir:t,message:n=""}){let{stashCommit:i,stashMsg:s,branch:a,stashMgr:o}=await kC({fs:r,dir:e,gitdir:t,message:n});return await o.writeStashRef(i),await o.writeStashReflogEntry({stashCommit:i,message:s}),await sC({fs:r,dir:e,gitdir:t,ref:a,track:!1,force:!0}),i}async function v3({fs:r,dir:e,gitdir:t,message:n=""}){let{stashCommit:i}=await kC({fs:r,dir:e,gitdir:t,message:n});return i}async function CC({fs:r,dir:e,gitdir:t,refIdx:n=0}){let s=await new to({fs:r,dir:e,gitdir:t}).readStashCommit(n),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o<a.length-1;o++){let c=(await Ni({fs:r,cache:{},gitdir:t,oid:a[o+1]})).commit.message.startsWith("stash-Index");await oC({fs:r,dir:e,gitdir:t,stashCommit:a[o+1],parentCommit:a[o],wasStaged:c})}}async function AC({fs:r,dir:e,gitdir:t,refIdx:n=0}){let i=new to({fs:r,dir:e,gitdir:t});if(!(await i.readStashCommit(n)).commit)return;let a=i.refStashPath;await Jt(a,async()=>{await r.exists(a)&&await r.rm(a)});let o=await i.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(n,1);let l=i.refLogsStashPath;await Jt(l,async()=>{if(o.length){await r.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 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&&gt.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
`,"utf8");let c=o[o.length-1].split(" ")[1];await i.writeStashRef(c)}else await r.rm(l)})}async function b3({fs:r,dir:e,gitdir:t}){return new to({fs:r,dir:e,gitdir:t}).readStashReflogs({parsed:!0})}async function y3({fs:r,dir:e,gitdir:t}){let n=new to({fs:r,dir:e,gitdir:t}),i=[n.refStashPath,n.refLogsStashPath];await Jt(i,async()=>{await Promise.all(i.map(async s=>{if(await r.exists(s))return r.rm(s)}))})}async function _3({fs:r,dir:e,gitdir:t,refIdx:n=0}){await CC({fs:r,dir:e,gitdir:t,refIdx:n}),await AC({fs:r,dir:e,gitdir:t,refIdx:n})}async function x3({fs:r,dir:e,gitdir:t=L(e,".git"),op:n="push",message:i="",refIdx:s=0}){P("fs",r),P("dir",e),P("gitdir",t),P("op",n);let a={push:w3,apply:CC,drop:AC,list:b3,clear:y3,pop:_3,create:v3},o=["apply","drop","pop"];try{let l=new Z(r),c=await J({fsp:l,dotgit:t});["refs","logs","logs/refs"].map(d=>L(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[n];if(f){if(o.includes(n)&&s<0)throw new wn(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:i,refIdx:s})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function E3({fs:r,dir:e,gitdir:t=L(e,".git"),filepath:n,cache:i={},refresh:s=!0}){try{P("fs",r),P("gitdir",t),P("filepath",n);let a=new Z(r),o=await J({fsp:a,dotgit:t}),l=await S3({fs:a,cache:i,gitdir:o}),c=await TC({fs:a,cache:i,gitdir:o,tree:l,path:n}),u=await yt.acquire({fs:a,gitdir:o,cache:i},async function(w){for(let b of w)if(b.path===n)return b;return null});if(c===null&&u===null&&await ra.isIgnored({fs:a,gitdir:o,dir:e,filepath:n}))return"ignored";let f=await a.lstat(L(e,n)),d=c!==null,h=u!==null,p=f!==null,g=async()=>{if(h&&!Wd(u,f))return u.oid;{let b=await(await vt.get({fs:a,gitdir:o})).get("core.autocrlf"),y=await a.read(L(e,n),{autocrlf:b}),k=await EC({gitdir:o,type:"blob",object:y});return s&&h&&u.oid===k&&f.size!==-1&&yt.acquire({fs:a,gitdir:o,cache:i},async function(C){C.insert({filepath:n,stats:f,oid:k})}),k}};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 w=await g();return w===c?w===u.oid?"unmodified":"*unmodified":w===u.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function TC({fs:r,cache:e,gitdir:t,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let s=i.shift();for(let a of n)if(a.path===s){if(i.length===0)return a.oid;let{type:o,object:l}=await at({fs:r,cache:e,gitdir:t,oid:a.oid});if(o==="tree"){let c=Vr.from(l);return TC({fs:r,cache:e,gitdir:t,tree:c,path:i})}if(o==="blob")throw new br(a.oid,o,"blob",i.join("/"))}return null}async function S3({fs:r,cache:e,gitdir:t}){let n;try{n=await z.resolve({fs:r,gitdir:t,ref:"HEAD"})}catch(s){if(s instanceof Xe)return[]}let{tree:i}=await Rl({fs:r,cache:e,gitdir:t,oid:n});return i}async function k3({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:s,cache:a={},ignored:o=!1,refresh:l=!0}){try{P("fs",r),P("gitdir",t),P("ref",n);let c=new Z(r),u=await J({fsp:c,dotgit:t});return await ps({fs:c,cache:a,dir:e,gitdir:u,trees:[jr({ref:n}),Fu({refresh:l}),Ka()],map:async function(f,[d,h,p]){if(!d&&!p&&h&&!o&&await ra.isIgnored({fs:c,dir:e,filepath:f})||!i.some(x=>iC(f,x)))return null;if(s&&!s(f))return;let[g,w,b]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),y=[g,w,b].includes("blob");if((g==="tree"||g==="special")&&!y)return;if(g==="commit")return null;if((w==="tree"||w==="special")&&!y)return;if(b==="commit")return null;if((b==="tree"||b==="special")&&!y)return;let k=g==="blob"?await d.oid():void 0,C=b==="blob"?await p.oid():void 0,S;g!=="blob"&&w==="blob"&&b!=="blob"?S="42":w==="blob"&&(S=await h.oid());let A=[void 0,k,S,C],v=A.map(x=>A.indexOf(x));return v.shift(),[f,...v]}})}catch(c){throw c.caller="git.statusMatrix",c}}async function C3({fs:r,dir:e,gitdir:t=L(e,".git"),ref:n,object:i,force:s=!1}){try{P("fs",r),P("gitdir",t),P("ref",n);let a=new Z(r);if(n===void 0)throw new zr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let o=await J({fsp:a,dotgit:t}),l=await z.resolve({fs:a,gitdir:o,ref:i||"HEAD"});if(!s&&await z.exists({fs:a,gitdir:o,ref:n}))throw new li("tag",n);await z.writeRef({fs:a,gitdir:o,ref:n,value:l})}catch(a){throw a.caller="git.tag",a}}async function A3({fs:r,dir:e,gitdir:t=L(e,".git"),cache:n={},filepath:i,oid:s,mode:a,add:o,remove:l,force:c}){try{P("fs",r),P("gitdir",t),P("filepath",i);let u=new Z(r),f=await J({fsp:u,dotgit:t});if(l)return await yt.acquire({fs:u,gitdir:f,cache:n},async function(h){if(!c){let p=await u.lstat(L(e,i));if(p){if(p.isDirectory())throw new ta("directory");return}}h.has({filepath:i})&&h.delete({filepath:i})});let d;if(!s){if(d=await u.lstat(L(e,i)),!d)throw new Xe(`file at "${i}" on disk and "remove" not set`);if(d.isDirectory())throw new Line truncated
PROMPT="$1"
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
@@ -125,256 +125,256 @@ done
RESPONSE=$(cat "$TEMP_FILE.response")
echo "$RESPONSE"
`,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)}},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(`
`,$C=["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 Lu=class{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,l,n,i)}diffWithOptionsObj(e,t,n,i){var s;let a=y=>{if(y=this.postProcess(y,n),i){setTimeout(function(){i(y)},0);return}else return y},o=t.length,l=e.length,c=1,u=o+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,t,e));let g=-1/0,w=1/0,b=()=>{for(let y=Math.max(g,-c);y<=Math.min(w,c);y+=2){let k,C=h[y-1],S=h[y+1];C&&(h[y-1]=void 0);let A=!1;if(S){let x=S.oldPos-y;A=S&&0<=x&&x<o}let v=C&&C.oldPos+1<l;if(!A&&!v){h[y]=void 0;continue}if(!v||A&&C.oldPos<S.oldPos?k=this.addToPath(S,!0,!1,0,n):k=this.addToPath(C,!1,!0,1,n),p=this.extractCommon(k,t,e,y,n),k.oldPos+1>=l&&p+1>=o)return a(this.buildValues(k.lastComponent,t,e))||!0;h[y]=k,k.oldPos+1>=l&&(w=Math.min(w,y-1)),p+1>=o&&(g=Math.max(g,y+1))}c++};if(i)(function y(){setTimeout(function(){if(c>u||Date.now()>d)return i(void 0);b()||y()},0)})();else for(;c<=u&&Date.now()<=d;){let y=b();if(y)return y}}addToPath(e,t,n,i,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,i,s){let a=t.length,o=n.length,l=e.oldPos,c=l-i,u=0;for(;c+1<a&&l+1<o&&this.equals(n[l+1],t[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,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let i=[],s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();let a=i.length,o=0,l=0,c=0;for(;o<a;o++){let u=i[o];if(u.removed)u.value=this.join(n.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=t.slice(l,l+u.count);f=f.map(function(d,h){let p=n[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(t.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}};m();var ov=class extends Lu{constructor(){super(...arguments),this.tokenize=B3}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
`)&&(e=e.slice(0,-1)),t.endsWith(`
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},N3=new ov;function lv(r,e,t){return N3.diff(r,e,t)}function B3(r,e){e.stripTrailingCr&&(r=r.replace(/\r\n/g,`
`));let t=[],n=r.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){let s=n[i];i%2&&!e.newlineIsToken?t[t.length-1]+=s:t.push(s)}return t}m();function U3(r){for(let e=0;e<r.length;e++)if(r[e]<" "||r[e]>"~"||r[e]==='"'||r[e]==="\\")return!0;return!1}function ca(r){if(!U3(r))return r;let e='"',t=new TextEncoder().encode(r),n=0;for(;n<t.length;){let i=t[n];i===7?e+="\\a":i===8?e+="\\b":i===9?e+="\\t":i===10?e+="\\n":i===11?e+="\\v":i===12?e+="\\f":i===13?e+="\\r":i===34?e+='\\"':i===92?e+="\\\\":i>=32&&i<=126?e+=String.fromCharCode(i):e+="\\"+i.toString(8).padStart(3,"0"),n++}return e+='"',e}var cv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function uv(r,e,t,n,i,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;lv(t,n,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(lv(t,n,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(y){return y.map(function(k){return" "+k})}let d=[],h=0,p=0,g=[],w=1,b=1;for(let y=0;y<u.length;y++){let k=u[y],C=k.lines||H3(k.value);if(k.lines=C,k.added||k.removed){if(!h){let S=u[y-1];h=w,p=b,S&&(g=l>0?f(S.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let S of C)g.push((k.added?"+":"-")+S);k.added?b+=C.length:w+=C.length}else{if(h)if(C.length<=l*2&&y<u.length-2)for(let S of f(C))g.push(S);else{let S=Math.min(C.length,l);for(let v of f(C.slice(0,S)))g.push(v);let A={oldStart:h,oldLines:w-h+S,newStart:p,newLines:b-p+S,lines:g};d.push(A),h=0,p=0,g=[]}w+=C.length,b+=C.length}}for(let y of d)for(let k=0;k<y.lines.length;k++)y.lines[k].endsWith(`
`)?y.lines[k]=y.lines[k].slice(0,-1):(y.lines.splice(k+1,0,"\\ No newline at end of file"),k++);return{oldFileName:r,newFileName:e,oldHeader:i,newHeader:s,hunks:d}}}function hh(r,e){var t,n,i,s,a,o;if(e||(e=cv),Array.isArray(r)){if(r.length>1&&!e.includeFileHeaders&&!r.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 r.map(u=>hh(u,e)).join(`
`)}let l=[];if(r.isGit){if(e=cv,!r.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!r.newFileName)throw new Error("newFileName must be specified for Git patches");let u=r.oldFileName,f=r.newFileName;r.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):r.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+ca(u)+" "+ca(f)),r.isDelete&&l.push("deleted file mode "+((t=r.oldMode)!==null&&t!==void 0?t:"100644")),r.isCreate&&l.push("new file mode "+((n=r.newMode)!==null&&n!==void 0?n:"100644")),r.oldMode&&r.newMode&&!r.isDelete&&!r.isCreate&&(l.push("old mode "+r.oldMode),l.push("new mode "+r.newMode)),r.isRename&&(l.push("rename from "+ca(((i=r.oldFileName)!==null&&i!==void 0?i:"").replace(/^a\//,""))),l.push("rename to "+ca(((s=r.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),r.isCopy&&(l.push("copy from "+ca(((a=r.oldFileName)!==null&&a!==void 0?a:"").replace(/^a\//,""))),l.push("copy to "+ca(((o=r.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,""))))}else e.includeIndex&&r.oldFileName==r.newFileName&&r.oldFileName!==void 0&&l.push("Index: "+r.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=r.hunks.length>0;e.includeFileHeaders&&r.oldFileName!==void 0&&r.newFileName!==void 0&&(!r.isGit||c)&&(l.push("--- "+ca(r.oldFileName)+(r.oldHeader?" "+r.oldHeader:"")),l.push("+++ "+ca(r.newFileName)+(r.newHeader?" "+r.newHeader:"")));for(let u=0;u<r.hunks.length;u++){let f=r.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 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 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+`
`}function IC(r,e,t,n,i,s,a){if(typeof a=="function"&&(a={callback:a}),a!=null&&a.callback){let{callback:o}=a;uv(r,e,t,n,i,s,Object.assign(Object.assign({},a),{callback:l=>{o(l?hh(l,a.headerOptions):void 0)}}))}else{let o=uv(r,e,t,n,i,s,a);return o?hh(o,a==null?void 0:a.headerOptions):void 0}}function Nu(r,e,t,n,i,s){return IC(r,r,e,t,n,i,s)}function H3(r){let e=r.endsWith(`
`),t=r.split(`
`).map(n=>n+`
`);return e?t.pop():t.push(t.pop().slice(0,-1)),t}m();var G3=Ke(Pw(),1),OC=Ke(Lg(),1),DC=Ke(Ng(),1),j3=Ke(Bg(),1),z3=Ke(Hg(),1),V3=Ke(xw(),1);var Te=class r extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let t=new r(e.message);return t.code=e.code,t.data=e.data,t.caller=e.caller,t.stack=e.stack,t}get isIsomorphicGitError(){return!0}},ph=class r extends Te{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=r.code,this.data={filepaths:e}}};ph.code="UnmergedPathsError";var ci=class r extends Te{constructor(e){super(`An internal error caused this command to fail.
If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
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=r.code,this.data={message:e}}};ci.code="InternalError";var mh=class r extends Te{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=r.code,this.data={filepath:e}}};mh.code="UnsafeFilepathError";var Bu=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 t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let i=this.buffer.write(e,this._start,t,n);return this._start+=t,i}copy(e,t,n){let i=e.copy(this.buffer,this._start,t,n);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}};function W3(r,e){return-(r<e)||+(r>e)}function q3(r,e){return W3(r.path,e.path)}function Y3(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}var Ui=2**32;function FC(r,e,t,n){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=n.valueOf());let i=Math.floor(t/1e3),s=(t-i*1e3)*1e6;return[i,s]}function gh(r){let[e,t]=FC(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[n,i]=FC(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%Ui,ctimeNanoseconds:t%Ui,mtimeSeconds:n%Ui,mtimeNanoseconds:i%Ui,dev:r.dev%Ui,ino:r.ino%Ui,mode:Y3(r.mode%Ui),uid:r.uid%Ui,gid:r.gid%Ui,size:r.size>-1?r.size%Ui:0}}function Z3(r){let e="";for(let t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}var fv=null;async function MC(r){return fv===null&&(fv=await X3()),fv?LC(r):K3(r)}function K3(r){return new OC.default().update(r).digest("hex")}async function LC(r){let e=await crypto.subtle.digest("SHA-1",r);return Z3(e)}async function X3(){try{return await LC(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(r){}return!1}function Q3(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095}}function J3(r){let e=r.flags;return e.extended=!1,e.nameLength=Math.min(_.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var pv=class r{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||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 t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(_.isBuffer(e))return r.fromBuffer(e);if(e===null)return new r(null);throw new ci("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ci("Index file is empty (.git/index)");let t=new r,n=new Bu(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new ci(`Invalid dircache magic file number: ${i}`);let s=await MC(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new ci(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=n.readUInt32BE();if(o!==2)throw new ci(`Unsupported dircache version: ${o}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&c<l;){let u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");let f=n.readUInt16BE();u.flags=Q3(f);let d=e.indexOf(0,n.tell()+1)-n.tell();if(d<1)throw new ci(`Got a path length of: ${d}`);if(u.path=n.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new mh(u.path);let h=8-(n.tell()-12)%8;for(h===0&&(h=8);h--;){let p=n.readUInt8();if(p!==0)throw new ci(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(n.eof())throw new ci("Unexpected end of file")}u.stages=[],t._addEntry(u),c++}return t}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(q3)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(t=>t):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath Line truncated
`)}static async _entryToBuffer(e){let t=_.from(e.path),n=Math.ceil((62+t.length+1)/8)*8,i=_.alloc(n),s=new Bu(i),a=gh(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(J3(e)),s.write(e.path,t.length,"utf8"),i}async toObject(){let e=_.alloc(12),t=new Bu(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(2),t.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(r._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&n.push(r._entryToBuffer(l));n=await Promise.all(n);let i=_.concat(n),s=_.concat([e,i]),a=await MC(s);return _.concat([s,_.from(a,"hex")])}};function e8(r,e,t=!0,n=!0){let i=gh(r),s=gh(e);return t&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.ctimeSeconds!==s.ctimeSeconds||i.uid!==s.uid||i.gid!==s.gid||n&&i.ino!==s.ino||i.size!==s.size}var dv;function t8(){return dv===void 0&&(dv=new DC.default({maxPending:1/0})),dv}function r8(r,e){return t8().acquire(r,e)}var hv=Symbol("IndexCache");function n8(){return{map:new Map,stats:new Map}}async function i8(r,e,t){let[n,i]=await Promise.all([r.lstat(e),r.read(e)]),s=await pv.from(i);t.map.set(e,s),t.stats.set(e,n)}async function s8(r,e,t){let n=t.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await r.lstat(e);return i===null?!1:e8(n,i)}var wh=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:i=!0},s){n[hv]||(n[hv]=n8());let a=`${t}/index`,o,l=[];return await r8(a,async()=>{let c=n[hv];await s8(e,a,c)&&await i8(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!i)throw new ph(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}},mv=class r extends Te{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=r.code,this.data={value:e}}};mv.code="InvalidOidError";var gv=class r extends Te{constructor(e,t){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${t}".)`),this.code=this.name=r.code,this.data={ref:e,suggestion:t}}};gv.code="InvalidRefNameError";var wv=class r extends Te{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=r.code,this.data={remote:e}}};wv.code="NoRefspecError";var vv=class r extends Te{constructor(e){super(`Could not find ${e}.`),this.code=this.name=r.code,this.data={what:e}}};vv.code="NotFoundError";var bv=class r extends Te{constructor(e,t,n){super(`HTTP Error: ${e} ${t}`),this.code=this.name=r.code,this.data={statusCode:e,statusMessage:t,response:n}}};bv.code="HttpError";var yv=class r extends Te{constructor(e,t){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=r.code,this.data={preview:e,response:t}}};yv.code="SmartHttpError";var _v=class r extends Te{constructor(){super("The operation was canceled."),this.code=this.name=r.code,this.data={}}};_v.code="UserCanceledError";var xv=class r extends Te{constructor(){super("Empty response from git server."),this.code=this.name=r.code,this.data={}}};xv.code="EmptyServerResponseError";var Ev=class r extends Te{constructor(e,t){super(`Expected "${e}" but received "${t}".`),this.code=this.name=r.code,this.data={expected:e,actual:t}}};Ev.code="ParseError";var Sv=class r extends Te{constructor(e,t,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${t}"`),this.code=this.name=r.code,this.data={url:e,transport:t,suggestion:n}}};Sv.code="UnknownTransportError";var kv=class r extends Te{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=r.code,this.data={url:e}}};kv.code="UrlParseError";var Cv=class r extends Te{constructor(e,t,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${t}.`),this.code=this.name=r.code,this.data={oid:e,actual:t,expected:n,filepath:i}}};Cv.code="ObjectTypeError";var Av=class r extends Te{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=r.code,this.data={role:e}}};Av.code="MissingNameError";var Tv=class r extends Te{constructor(e,t,n=!0){super(`Failed to create ${e} at ${t} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=r.code,this.data={noun:e,where:t,canForce:n}}};Tv.code="AlreadyExistsError";var Rv=class r extends Te{constructor(e,t,n){super(`Found multiple ${e} matching "${t}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=r.code,this.data={nouns:e,short:t,matches:n}}};Rv.code="AmbiguousError";var Pv=class r extends Te{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=r.code,this.data={filepaths:e}}};Pv.code="CheckoutConflictError";var $v=class r extends Te{constructor(e,t){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${t} parents and require specifying which parent to use as the base.`),this.code=this.name=r.code,this.data={oid:e,parentCount:t}}};$v.code="CherryPickMergeCommitError";var Iv=class r extends Te{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=r.code,this.data={oid:e}}};Iv.code="CherryPickRootCommitError";var Fv=class r extends Te{constructor(e,t){super(`Failed to checkout "${e}" because commit ${t} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=r.code,this.data={ref:e,oid:t}}};Fv.code="CommitNotFetchedError";var Mv=class r extends Te{constructor(){super("Cannot create an empty commit when disallowEmpty is true."),this.code=this.name=r.code,this.data={}}};Mv.code="EmptyCommitError";var Ov=class r extends Te{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=r.code,this.data={}}};Ov.code="FastForwardError";var Dv=class r extends Te{constructor(e,t){super(`One or more branches were not updated: ${e}`),this.code=this.name=r.code,this.data={prettyDetails:e,result:t}}};Dv.code="GitPushError";var Lv=class r extends Te{constructor(e){let t="invalid filepath";e==="leading-slash"||e==="trailing-slash"?t='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(t='"filepath" should not be a directory.'),super(t),this.code=this.name=r.code,this.data={reason:e}}};Lv.code="InvalidFilepathError";var Nv=class r extends Te{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=r.code,this.data={depth:e}}};Nv.code="MaxDepthError";var Bv=class r extends Te{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=r.code,this.data={}}};Bv.code="MergeNotSupportedError";var Uv=class r extends Te{constructor(e,t,n,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=r.code,this.data={filepaths:e,bothModified:t,deleteByUs:n,deleteByTheirs:i}}};Uv.code="Merge Line truncated
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=_.from(n)),n}catch(n){return null}}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch(i){await this.mkdir(GC(e)),await this._writeFile(e,t,n)}}async mkdir(e){await jC(this._mkdir,e)}async rm(e){try{await this._unlink(e)}catch(t){if(t.code!=="ENOENT")throw t}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){try{let t=await this._readdir(e);return t.sort(a8),t}catch(t){return t.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async i=>{let s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(t){if(t.code==="ENOENT"||(t.code||"").includes("ENS"))return null;throw t}}async readlink(e,t={encoding:"buffer"}){try{let n=await this._readlink(e,t);return _.isBuffer(n)?n:_.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(e,t){return this._symlink(t.toString("utf8"),e)}};var ui=require("obsidian");m();function zC(r,e){let t=Object.assign({},r.lineAuthor,e.lineAuthor);return Object.assign({},r,e,{lineAuthor:t})}var $l=class extends Error{constructor(t){super("No network connection available");this.originalError=t}},zn=class extends Error{constructor(t,n){super("Git operation stopped because of merge conflicts");this.files=t;this.cause=n;this.name="GitConflictError"}};m();var VC=require("obsidian"),h8={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},ft=class extends VC.SuggestModal{constructor(e,t){if(super(e.app),this.config={...h8,...t},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button"});i.style.marginRight="32px",i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.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,t){this.config.obscure?t.hide():t.setText(e)}onChooseSuggestion(e,t){if(this.resolve){let n;this.config.allowEmpty&&e===" "?n="":e==="..."?n=void 0:n=e,this.resolve(n)}}};m();var uA=Ke(cA(),1),fA=require("child_process"),gs=require("obsidian");function Gu(r,e,t){return r===1?`${r} ${e}`:`${r} ${t!=null?t:e+"s"}`}var Kv=(r,e)=>r==="."||e==null||e.length===0||e==="."?!0:e.length>=r.length?e.startsWith(r):r.startsWith(e);function bn(r,e){let t;if(e){if(e.button===0||e.button===1){let n=gs.Keymap.isModEvent(e);t=r.workspace.getLeaf(n)}}else t=r.workspace.getLeaf(!1);return t}function yr(r){return r.getRoot().side==="left"?"right":"left"}function Hi(r,e,t,n,i){if(e.button==2){let s=r.vault.getAbstractFileByPath(t);if(s!=null){let a=new gs.Menu;r.workspace.trigger("file-menu",a,s,i,n),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new gs.Menu;r.workspace.trigger("obsidian-git:menu",a,t,i,n),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function ua(r){throw new Error(`Impossible branch: ${String(r)}`)}function Xv(r){return`rgb(${r.r},${r.g},${r.b})`}function dA(r){var s;let e=(s=uA.fromString(r))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[t,n,i]=e;return{r:t,g:n,b:i}}function hA(r){return r.diff(gs.moment.unix(0),"seconds")}function pA(r){if(r.length!==0)return r.slice().sort()[Math.floor(r.length/2)]}function ju(r,e){return new Proxy(r,{get(t,n){return n==="length"?Math.min(e,t.length):t[n]}})}function mA(r,e,t){return r.length<=e?new Array(e-r.length).fill(t).join("")+r:r.substring(r.length-e)}function gA(r,e){if(e<=0)return r;let t=new Array(e).fill(" ").join(""),n=r.substring(e,r.length);return t+n}function Qv(r,e,t){return r<=e&&e<=t}function fa(r){let[e,...t]=r.split("/");return[e!=null?e:"",t.length===0?void 0:t.join("/")]}function Vn(r){return r.endsWith("/")?r:r.split("/").last().replace(/\.md$/,"")}function T8(r){let e=r.lastIndexOf(".");return r.substring(e+1)}function no(r){if(r.endsWith(".md"))return!1;let e=T8(r);return $C.includes(e)}function Jv(r){return(r.startsWith("https://github.com/")||r.startsWith("https://gitlab.com/"))&&(r.endsWith(".git")||(r=r+".git")),r}function Fl(r,e){let t=e.vault.getAbstractFileByPath(r);i Line truncated
`),n.stagedOutsideVault>0&&(i+=`${i?`
`:""}${n.stagedOutsideVault} staged file${n.stagedOutsideVault===1?"":"s"} outside the vault`)):i="Too many files to list",e=e+`
Affected files:
`+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
`+i}return e}};m();var er=require("obsidian"),xh=class extends Error{constructor(t){super(`File not found: ${t}`);this.code="ENOENT";this.name="FileNotFoundError"}},Eh=class{constructor(e,t){this.plugin=t;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,t){var i;if(e===void 0)return;if(e=(0,er.normalizePath)(e),this.maybeLog("Read: "+e+JSON.stringify(t)),(typeof t=="string"?t:t==null?void 0:t.encoding)==="utf8"){let s=this.vault.getAbstractFileByPath(e);return s instanceof er.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)):(i=this.index)!=null?i:this.adapter.readBinary(e);let s=this.vault.getAbstractFileByPath(e);return s instanceof er.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(s)):this.adapter.readBinary(e)}}async writeFile(e,t){var n;if(this.maybeLog("Write: "+e),e=(0,er.normalizePath)(e),typeof t=="string"){let i=this.vault.getAbstractFileByPath(e);if(i instanceof er.TFile)return this.vault.modify(i,t);if(!this.isHiddenPath(e))await this.vault.create(e,t);else return this.adapter.write(e,t)}else{let i=R8(t);if(this.isIndexPath(e)){this.index=i;let s=Date.now();(n=this.indexctime)!=null||(this.indexctime=s),this.indexmtime=s}else{let s=this.vault.getAbstractFileByPath(e);if(s instanceof er.TFile)return this.vault.modifyBinary(s,i);if(!this.isHiddenPath(e))await this.vault.createBinary(e,i);else return this.adapter.writeBinary(e,i)}}}async readdir(e){e=(0,er.normalizePath)(e),this.maybeLog("ReadDir: "+e),e==="."&&(e="/");let t=await this.adapter.list(e),n=[...t.files,...t.folders],i;return e!=="/"?i=n.map(s=>(0,er.normalizePath)(s.substring(e.length))):i=n,i}async mkdir(e){if(e=(0,er.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,t){var n,i;if(e=(0,er.normalizePath)(e),this.maybeLog("Rmdir: "+e+JSON.stringify(t)),!this.isHiddenPath(e)){let s=this.vault.getAbstractFileByPath(e);if(s instanceof er.TFolder){await this.vault.delete(s,(t==null?void 0:t.recursive)===!0||((n=t==null?void 0:t.options)==null?void 0:n.recursive)===!0);return}}return this.adapter.rmdir(e,(t==null?void 0:t.recursive)===!0||((i=t==null?void 0:t.options)==null?void 0:i.recursive)===!0)}async stat(e){if(e=(0,er.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 n=await this.adapter.stat(e);if(n==null)throw new xh(e);return this.indexctime=n.ctime,this.indexmtime=n.mtime,{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let t=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),t instanceof er.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:t.stat.ctime,mtimeMs:t.stat.mtime,size:t.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let n=await this.adapter.stat(e);if(n)return{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:n.type==="folder"?"directory":n.type,isFile:()=>n.type==="file",isDirectory:()=>n.type==="folder",isSymbolicLink:()=>!1};throw new xh(e)}}async unlink(e){if(e=(0,er.normalizePath)(e),!this.isHiddenPath(e)){let t=this.vault.getAbstractFileByPath(e);if(t instanceof er.TFile)return this.vault.delete(t)}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(t=>t.startsWith(".")&&t!==".")}maybeLog(e){}};function R8(r){return r instanceof ArrayBuffer?r:r.buffer instanceof ArrayBuffer&&r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r.buffer,r.byteOffset,r.byteLength).slice().buf Line truncated
`);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(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
`),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(t){return this.getRepo().dir=t,Promise.resolve()}getGitDirPath(){return(0,ui.normalizePath)(this.getRelativeVaultPath(this.plugin.settings.gitDir||".git"))}async getConflictedFiles(){let t=wh.acquire({fs:new vh(this.fs),gitdir:this.getGitDirPath(),cache:{}},i=>i.unmergedPaths),n=await this.wrapFS(t);if(!Array.isArray(n)||!n.every(i=>typeof i=="string"))throw new TypeError("isomorphic-git returned invalid unmerged paths");return n}getMergeStatePath(t){return(0,ui.normalizePath)(`${this.getGitDirPath()}/${t}`)}async isMergeInProgress(){return this.app.vault.adapter.exists(this.getMergeStatePath(Rr.MERGE_HEAD))}async getMergeHeads(){let t=this.getMergeStatePath(Rr.MERGE_HEAD);return await this.app.vault.adapter.exists(t)?(await this.app.vault.adapter.read(t)).split(/\r?\n/).map(n=>n.trim()).filter(n=>n.length>0):[]}async writeMergeState({ours:t,theirs:n,message:i}){let s=this.app.vault.adapter;await s.write(this.getMergeStatePath(Rr.ORIGINAL_HEAD),`${t}
`),await s.write(this.getMergeStatePath(Rr.MERGE_MESSAGE),`${i}
`),await s.write(this.getMergeStatePath(Rr.MERGE_MODE),""),await s.write(this.getMergeStatePath(Rr.MERGE_HEAD),`${n}
`)}async clearMergeState(){let t=this.app.vault.adapter;for(let n of[Rr.MERGE_HEAD,Rr.MERGE_MESSAGE,Rr.MERGE_MODE]){let i=this.getMergeStatePath(n);await t.exists(i)&&await t.remove(i)}}async updateUpstreamBranch(t){let[n,i]=fa(t),s=await this.branchInfo();await this.wrapFS(ce.push({...this.getRepo(),remote:n,remoteRef:i})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${i}`)}updateGitPath(t){return Promise.resolve()}async getCommittedFilesCount(t){let{commit:n}=await this.wrapFS(ce.readCommit({...this.getRepo(),oid:t})),i=n.parent[0];return i?(await this.getFileChangesCount(i,t)).length:(await this.wrapFS(ce.listFiles({...this.getRepo(),ref:t}))).length}async getFileChangesCount(t,n){return this.walkDifference({walkers:[ce.TREE({ref:t}),ce.TREE({ref:n})]})}async walkDifference({walkers:t,dir:n}){return this.wrapFS(e0({...this.getRepo(),trees:t,map:async function(i,[s,a]){if(!Kv(i,n))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:i,type:c}}}))}async getStagedFiles(t="."){return(await this.walkDifference({walkers:[ce.TREE({ref:"HEAD"}),ce.STAGE()],dir:t})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path}))}async getUnstagedFiles(t="."){let n,i=window.setTimeout(()=>{n=new ui.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(e0({...s,trees:[ce.WORKDIR(),ce.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await ce.isIgnored({...s,filepath:o})||!Kv(o,t))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(i),n==null||n.hide(),a}catch(s){throw window.clearTimeout(i),n==null||n.hide(),s}}async getDiffString(t,n=!1,i){let s=this.getRelativeVaultPath(t),a=async(c,[u])=>{if(t==c){let f=await u.oid();return(await ce.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await Pl({...this.getRepo(),filepath:t,oid:i}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof ce.Errors.NotFoundError))throw p}),f=(await ce.readCommit({...this.getRepo(),oid:i})).commit.parent.first(),d;return f&&(d=await Pl({...this.getRepo(),filepath:t,oid:f}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof ce.Errors.NotFoundError))throw p})),Nu(s,d!=null?d:"",c!=null?c:"")}let o=(await e0({...this.getRepo(),trees:[ce.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(n){let c=await this.resolveRef("HEAD").then(f=>Pl({...this.getRepo(),filepath:t,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ce.Errors.NotFoundError))throw f});return Nu(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="",Nu(s,l,c)}}async show(t,n,i=!0){let s=this.getRelativeRepoPath(n,i),{blob:a}=await Pl({...this.getRepo(),oid:t,filepath:s});return new TextDecoder().decode(a)}async getLastCommitTime(){let t=this.getRepo(),n=await this.resolveRef("HEAD"),s=(await ce.readCommit({...t,oid:n})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(t){var s,a;let n=`${t[this.HEAD]}${t[this.WORKDIR]}${t[this.STAGE]}`,i=this.status_mapping[n];if(i===void 0)throw new Error(`Unsupported status matrix row: ${n}`);return{index:i[0]=="?"?"U":(s=i[0])!=null?s:" ",workingDir:i[1]=="?"?"U":(a=i[1])!=null?a:" ",path:t[this.FILE],vaultPath:this.getRelativeVaultPath(t[this.FILE])}}async checkAuthorInfo(){let t=await this.getConfig("user.name"),n=await this.getConfig("user.email");if(!t||!n)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(t,n=!0){if(!this.plugin.settings.disablePopups)return new ui.Notice(t,n?this.noticeLength:void 0)}};Rr.MERGE_HEAD="MERGE_HEAD",Rr.MERGE_MESSAGE="MERGE_MSG",Rr.MERGE_MODE="MERGE_MODE",Rr.ORIGINAL_HEAD="ORIG_HEAD";var ws=Rr;async function e0(r){let e=await ce.walk(r);if(!Array.isArray(e))throw new TypeError("isomorphic-git walk returned a non-array result");return e}function I8(r){let e=[new Uint8Array(r)].values();return{next:()=>Promise.resolve(e.next()),[Symbol.asyncIterator](){return this}}}async function F8(r){let e=new ReadableStream({async start(n){for await(let i of r)n.enqueue(i);n.close()}});return await new Response(e).arrayBuffer()}async function M8(r){let e=new Uint8Array(r);if(e.length<2||e[0]!==31||e[1]!==139)return r;try{let t=new Blob([r]).stream().pipeThrough(new DecompressionStr Line truncated
`){return r.split(t).reduce((n,i)=>{let s=e?i.trim():i;return s&&n.push(s),n},[])}function R0(r,e){return jh(r,!0).map(t=>e(t))}function sT(r){return(0,Uh.exists)(r,Uh.FOLDER)}function fi(r,e){return Array.isArray(r)?r.includes(e)||r.push(e):r.add(e),e}function FU(r,e){return Array.isArray(r)&&!r.includes(e)&&r.push(e),r}function P0(r,e){if(Array.isArray(r)){let t=r.indexOf(e);t>=0&&r.splice(t,1)}else r.delete(e);return e}var $0=Object.prototype.toString.call.bind(Object.prototype.toString);function xn(r){return Array.isArray(r)?r:[r]}function aT(r){return r.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function Zu(r){return xn(r).map(e=>e instanceof String?e:String(e))}function ot(r,e=0){if(r==null)return e;let t=parseInt(r,10);return Number.isNaN(t)?e:t}function Fh(r,e){let t=[];for(let n=0,i=r.length;n<i;n++)t.push(e,r[n]);return t}function Mh(r){return(Array.isArray(r)?_.concat(r):r).toString("utf-8")}function MU(r){return r?_.isBuffer(r)?r.length:_.byteLength(r):0}function OU(r,e){let t={};return e.forEach(n=>{r[n]!==void 0&&(t[n]=r[n])}),t}function NA(r=0){return new Promise(e=>setTimeout(e,r))}function BA(r){if(r!==!1)return r}function dt(r,e,t){return e(r)?r:arguments.length>2?t:void 0}var zh=r=>Array.isArray(r);function u0(r,e){let t=Gi(r)?"string":typeof r;return/number|string|boolean/.test(t)&&(!e||!e.includes(t))}var We=r=>typeof r=="string"||Gi(r),DU=r=>We(r)||_.isBuffer(r),Oh=r=>We(r)||Array.isArray(r)&&r.every(We);function I0(r){return!!r&&$0(r)==="[object Object]"}function LU(r){return typeof r=="function"}var oT=r=>r==null||"number|boolean|function".includes(typeof r)?!1:typeof r.length=="number",Vh=(r=>(r[r.SUCCESS=0]="SUCCESS",r[r.ERROR=1]="ERROR",r[r.NOT_FOUND=-2]="NOT_FOUND",r[r.UNCLEAN=128]="UNCLEAN",r))(Vh||{}),Dh=class r{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new r(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}};function NU(){throw new Error("LineParser:useMatches not implemented")}var ge=class{constructor(e,t){this.matches=[],this.useMatches=NU,this.parse=(n,i)=>(this.resetMatches(),this._regExp.every((s,a)=>this.addMatch(s,a,n(a)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let i=n&&e.exec(n);return i&&this.pushMatch(t,i),!!i}pushMatch(e,t){this.matches.push(...t.slice(1))}},ha=class extends ge{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}},BU={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1};function UU(...r){let e=process.cwd(),t=Object.assign({baseDir:e,...BU},...r.filter(n=>typeof n=="object"&&n));return t.baseDir=t.baseDir||e,t.trimmed=t.trimmed===!0,t}function lT(r,e=[]){return I0(r)?Object.keys(r).reduce((t,n)=>{let i=r[n];if(Gi(i))t.push(i);else if(u0(i,["boolean"]))t.push(n+"="+i);else if(Array.isArray(i))for(let s of i)u0(s,["string","number"])||t.push(n+"="+s);else t.push(n);return t},e):e}function Fe(r,e=0,t=!1){let n=[];for(let i=0,s=e<0?r.length:e;i<s;i++)"string|number".includes(typeof r[i])&&n.push(String(r[i]));return lT(F0(r),n),t||n.push(...HU(r)),n}function HU(r){let e=typeof Gl(r)=="function";return Zu(dt(Gl(r,e?1:0),zh,[]))}function F0(r){let e=LU(Gl(r));return dt(Gl(r,e?1:0),I0)}function ee(r,e=!0){let t=RU(Gl(r));return e||PU(t)?t:void 0}function UA(r,e){return r(e.stdOut,e.stdErr)}function En(r,e,t,n=!0){return xn(t).forEach(i=>{for(let s=jh(i,n),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,r))}}),r}var M0=({exitCode:r},e,t,n)=>{if(r===Vh.UNCLEAN&&VU(e))return t(_.from("false"));n(e)},cT=r=>r.trim()==="true";function GU(r){switch(r){case"bare":return zU();case"root":return jU()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:M0,parser:cT}}function jU(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:M0,parser(r){return/^\.(git)?$/.test(r.trim())}}}function zU(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:M0,parser:cT}}function VU(r){return/(Not a git repository|Kein Git-Repository)/i.test(String(r))}var f0=class{constructor(e){this.paths=[],this.files=[],this.folders=[],this.dryRun=e}},WU=/^[a-z]+\s*/i,qU=/^[a-z]+\s+[a-z]+\s*/i,YU=/\/$/;function ZU(r,e){let t=new f0(r),n=r?qU:WU;return jh(e).forEach(i=>{let s=i.replace(n,"");t.paths.push(s),(YU.test(s)?t.folders:t.files).push(s)}),t}var uT=[];function KU(r){return{commands:uT,format:"empty",parser:r}}function Ft(r){return{commands:uT,format:"empty",parser(){throw typeof r=="string"?new c0(r):r}}}function ht(r,e=!1){return{commands:r,format:"utf-8",parser(t){return e?String(t).trim():t}}}function fT(r){return{commands:r,format:"buffer",parser(e){return e}}}function XU(r){return r.format==="buffer"}function HA(r){return r.format==="empty"||!r.commands.length}var QU="Git clean interactive mode is not suppo Line truncated
`)){let l=$U(a,`
`);o=l[0],a=l[1]}yield{file:s,key:o,value:a}}}var pT=(r=>(r.system="system",r.global="global",r.local="local",r.worktree="worktree",r))(pT||{});function n0(r,e){return typeof r=="string"&&Object.hasOwn(pT,r)?r:e}function f4(r,e,t,n){let i=["config",`--${n}`];return t&&i.push("--add"),i.push(r,e),{commands:i,format:"utf-8",parser(s){return s}}}function d4(r,e){let t=["config","--null","--show-origin","--get-all",r];return e&&t.splice(1,0,`--${e}`),{commands:t,format:"utf-8",parser(n){return c4(n,r)}}}function h4(r){let e=["config","--list","--show-origin","--null"];return r&&e.push(`--${r}`),{commands:e,format:"utf-8",parser(t){return l4(t)}}}function p4(){return{addConfig(r,e,...t){return this._runTask(f4(r,e,t[0]===!0,n0(t[1],"local")),ee(arguments))},getConfig(r,e){return this._runTask(d4(r,n0(e,void 0)),ee(arguments))},listConfig(...r){return this._runTask(h4(n0(r[0],void 0)),ee(arguments))}}}var mT=(r=>(r.ADDED="A",r.COPIED="C",r.DELETED="D",r.MODIFIED="M",r.RENAMED="R",r.CHANGED="T",r.UNMERGED="U",r.UNKNOWN="X",r.BROKEN="B",r))(mT||{}),m4=new Set(Object.values(mT));function g4(r){return m4.has(r)}var GA,w4=["-h"],Ph=Symbol("grepQuery"),h0=class{constructor(){this[GA]=[]}*[(GA=Ph,Symbol.iterator)](){for(let e of this[Ph])yield e}and(...e){return e.length&&this[Ph].push("--and","(",...Fh(e,"-e"),")"),this}param(...e){return this[Ph].push(...Fh(e,"-e")),this}};function v4(...r){return new h0().param(...r)}function b4(r){let e=new Set,t={};return R0(r,n=>{let[i,s,a]=n.split(Ih);e.add(i),(t[i]=t[i]||[]).push({line:ot(s),path:i,preview:a})}),{paths:e,results:t}}function y4(){return{grep(r){let e=ee(arguments),t=Fe(arguments);for(let i of w4)if(t.includes(i))return this._runTask(Ft(`git.grep: use of "${i}" is not supported.`),e);typeof r=="string"&&(r=v4().param(r));let n=["grep","--null","-n","--full-name",...t,...r];return this._runTask({commands:n,format:"utf-8",parser(i){return b4(i)}},e)}}}var gT=(r=>(r.MIXED="mixed",r.SOFT="soft",r.HARD="hard",r.MERGE="merge",r.KEEP="keep",r))(gT||{}),_4=Zu(Object.values(gT));function x4(r,e){let t=["reset"];return wT(r)&&t.push(`--${r}`),t.push(...e),ht(t)}function E4(r){if(wT(r))return r;switch(typeof r){case"string":case"undefined":return"soft"}}function wT(r){return typeof r=="string"&&_4.includes(r)}Hh.default.formatters.L=r=>String(oT(r)?r.length:"-");Hh.default.formatters.B=r=>_.isBuffer(r)?r.toString("utf8"):$0(r);function S4(){return(0,Hh.default)("simple-git")}function jA(r,e,t){return!e||!String(e).replace(/\s*/,"")?t?(n,...i)=>{r(n,...i),t(n,...i)}:r:(n,...i)=>{r(`%s ${n}`,e,...i),t&&t(n,...i)}}function k4(r,e,{namespace:t}){if(typeof r=="string")return r;let n=e&&e.namespace||"";return n.startsWith(t)?n.substr(t.length+1):n||t}function jl(r,e,t,n=S4()){let i=r&&`[${r}]`||"",s=[],a=typeof e=="string"?n.extend(e):e,o=k4(dt(e,We),a,n);return c(t);function l(u,f){return fi(s,jl(r,o.replace(/^[^:]+/,u),f,n))}function c(u){let f=u&&`[${u}]`||"",d=a&&jA(a,f)||Gh,h=jA(n,`${i} ${f}`,d);return Object.assign(a?d:h,{label:r,sibling:l,info:h,step:c})}}var vT=class p0{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let t=p0.getName(e.commands[0]),n=jl(this.logLabel,t);return{task:e,logger:n,name:t}}push(e){let t=this.createProgress(e);return t.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info("Failed %o",e),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",e.message),this.complete(t);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new dr(void 0,"TasksPendingQueue: attempt called for an unknown task");return t.logger("Starting task"),t}static getName(e="empty"){return`task:${e}:${++p0.counter}`}};vT.counter=0;var C4=vT,m0=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new C4}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:i}=this._queue.attempt(e);return await(HA(e)?this.attemptEmptyTask(e,i):this.attemptRemoteTask(e,i))}catch(i){throw this.onFatalException(e,i)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof dr?Object.assign(t,{task:e}):new dr(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec("spawn.binary","",t Line truncated
`).map(w6).filter(Boolean);e||t.sort(function(i,s){let a=i.split("."),o=s.split(".");if(a.length===1||o.length===1)return g6($h(a[0]),$h(o[0]));for(let l=0,c=Math.max(a.length,o.length);l<c;l++){let u=NT($h(a[l]),$h(o[l]));if(u)return u}return 0});let n=e?t[0]:[...t].reverse().find(i=>i.indexOf(".")>=0);return new C0(t,n)};function g6(r,e){let t=Number.isNaN(r),n=Number.isNaN(e);return t!==n?t?1:-1:t?NT(r,e):0}function NT(r,e){return r===e?0:r>e?1:-1}function w6(r){return r.trim()}function $h(r){return typeof r=="string"&&parseInt(r.replace(/^\D+/g,""),10)||0}function v6(r=[]){let e=r.some(t=>/^--sort=/.test(t));return{format:"utf-8",commands:["tag","-l",...r],parser(t){return m6(t,e)}}}function b6(r){return{format:"utf-8",commands:["tag",r],parser(){return{name:r}}}}function y6(r,e){return{format:"utf-8",commands:["tag","-a","-m",e,r],parser(){return{name:r}}}}function he(r,e){this._plugins=e,this._executor=new g0(r.baseDir,new E0(r.maxConcurrentProcesses),e),this._trimmed=r.trimmed}(he.prototype=Object.create(Bh.prototype)).constructor=he;he.prototype.customBinary=function(r){return this._plugins.reconfigure("binary",r),this};he.prototype.env=function(r,e){return arguments.length===1&&typeof r=="object"?this._executor.env=r:(this._executor.env=this._executor.env||{})[r]=e,this};he.prototype.stashList=function(r){return this._runTask(f6(F0(arguments)||{},zh(r)&&r||[]),ee(arguments))};he.prototype.mv=function(r,e){return this._runTask(r6(r,e),ee(arguments))};he.prototype.checkoutLatestTag=function(r){var e=this;return this.pull(function(){e.tags(function(t,n){e.checkout(n.latest,r)})})};he.prototype.pull=function(r,e,t,n){return this._runTask(n6(dt(r,We),dt(e,We),Fe(arguments)),ee(arguments))};he.prototype.fetch=function(r,e){return this._runTask(JH(dt(r,We),dt(e,We),Fe(arguments)),ee(arguments))};he.prototype.tags=function(r,e){return this._runTask(v6(Fe(arguments)),ee(arguments))};he.prototype.rebase=function(){return this._runTask(ht(["rebase",...Fe(arguments)]),ee(arguments))};he.prototype.reset=function(r){return this._runTask(x4(E4(r),Fe(arguments)),ee(arguments))};he.prototype.revert=function(r){let e=ee(arguments);return typeof r!="string"?this._runTask(Ft("Commit must be a string"),e):this._runTask(ht(["revert",...Fe(arguments,0,!0),r]),e)};he.prototype.addTag=function(r){let e=typeof r=="string"?b6(r):Ft("Git.addTag requires a tag name");return this._runTask(e,ee(arguments))};he.prototype.addAnnotatedTag=function(r,e){return this._runTask(y6(r,e),ee(arguments))};he.prototype.deleteLocalBranch=function(r,e,t){return this._runTask(WH(r,typeof e=="boolean"?e:!1),ee(arguments))};he.prototype.deleteLocalBranches=function(r,e,t){return this._runTask(VH(r,typeof e=="boolean"?e:!1),ee(arguments))};he.prototype.branch=function(r,e){return this._runTask(jH(Fe(arguments)),ee(arguments))};he.prototype.branchLocal=function(r){return this._runTask(zH(),ee(arguments))};he.prototype.raw=function(r){let e=!Array.isArray(r),t=[].slice.call(e?arguments:r,0);for(let i=0;i<t.length&&e;i++)if(!u0(t[i])){t.splice(i,t.length-i);break}t.push(...Fe(arguments,0,!0));var n=ee(arguments);return t.length?this._runTask(ht(t,this._trimmed),n):this._runTask(Ft("Raw: must supply one or more command to execute"),n)};he.prototype.submoduleAdd=function(r,e,t){return this._runTask(d6(r,e),ee(arguments))};he.prototype.submoduleUpdate=function(r,e){return this._runTask(p6(Fe(arguments,!0)),ee(arguments))};he.prototype.submoduleInit=function(r,e){return this._runTask(h6(Fe(arguments,!0)),ee(arguments))};he.prototype.subModule=function(r,e){return this._runTask(Wh(Fe(arguments)),ee(arguments))};he.prototype.listRemote=function(){return this._runTask(l6(Fe(arguments)),ee(arguments))};he.prototype.addRemote=function(r,e,t){return this._runTask(a6(r,e,Fe(arguments)),ee(arguments))};he.prototype.removeRemote=function(r,e){return this._runTask(u6(r),ee(arguments))};he.prototype.getRemotes=function(r,e){return this._runTask(o6(r===!0),ee(arguments))};he.prototype.remote=function(r,e){return this._runTask(c6(Fe(arguments)),ee(arguments))};he.prototype.tag=function(r,e){let t=Fe(arguments);return t[0]!=="tag"&&t.unshift("tag"),this._runTask(ht(t),ee(arguments))};he.prototype.updateServerInfo=function(r){return this._runTask(ht(["update-server-info"]),ee(arguments))};he.prototype.pushTags=function(r,e){let t=xH({remote:dt(r,We)},Fe(arguments));return this._runTask(t,ee(arguments))};he.prototype.rm=function(r){return this._runTask(ht(["rm","-f",...xn(r)]),ee(arguments))};he.prototype.rmKeepLocal=function(r){return this._runTask(ht(["rm","--cached",...xn(r)]),ee(arguments))};he.prototype.catFile=function(r,e){return this._catFile("utf-8",arguments)};he.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)};he.prototype._catFile=function(r,e){var t=ee(e),n=["cat-file"],i=e[0];if(typeof i=="string")return this._runTask(Ft("Git.catFile: options must be supplied as an array of strings"),t);Array.isArray(i)&&n.push.apply(n,i);let s Line truncated
`).some(l=>l.contains(i))||await Pr.appendFile(t,i+`
`)}catch(t){console.error("Error while adding askpass script to exclude file:",t)}}unload(){var t;(t=this.watchAbortController)==null||t.abort()}async status(t){var u;let n=(u=t==null?void 0:t.path)!=null?u:this.getVaultPathspec(),[i,s,a]=await Promise.all([this.git.status(n!=null?["--",n]:[]),this.getVaultPathspec()==null?0:this.countPathsOutsideVault(["diff","--cached","--name-only","--diff-filter=ACDMRT"]),this.getVaultPathspec()==null?0:this.countPathsOutsideVault(["diff","--name-only","--diff-filter=U"])]),o=i.files.map(f=>{let d=this.formatPath(f);return{path:d.path,from:d.from,index:f.index==="?"?"U":f.index,workingDir:f.working_dir==="?"?"U":f.working_dir,vaultPath:this.getRelativeVaultPath(d.path)}}),l=i.conflicted.map(f=>this.formatPath({path:f}).path),c=new Set(l);return{all:o,changed:o.filter(f=>f.workingDir!==" "&&!c.has(f.path)),staged:o.filter(f=>f.index!==" "&&f.index!="U"),conflicted:l,stagedOutsideVault:s,conflictedOutsideVault:a}}async isMergeInProgress(){let t=await this.git.revparse(["--git-path","MERGE_HEAD"]),n=we.resolve(this.absoluteRepoPath,t.trim());try{return await Pr.access(n),!0}catch(i){if(i instanceof Error&&"code"in i&&i.code==="ENOENT")return!1;throw i}}async submoduleAwareHeadRevisonInContainingDirectory(t){let n=this.getRelativeRepoPath(t),s=["-C",we.dirname(n),"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(t=>{this.git.outputHandler((n,i,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.absoluteRepoPath;i.on("data",c=>{o+=c.toString("utf8")}),i.on("end",()=>{let u=o.split(`
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Xu.sep}).filter(f=>!!f).filter(f=>{if(this.getVaultPathspec()==null)return!0;let d=this.app.vault.adapter,h=we.relative(we.resolve(d.getBasePath()),we.resolve(f));return!(h===".."||h.startsWith(".."+we.sep)||we.isAbsolute(h))});u.reverse(),t(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(t){function n(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return t.from!=null?{from:n(t.from),path:n(t.path)}:{path:n(t.path)}}async blame(t,n,i){if(t=this.getRelativeRepoPath(t),!await this.isTracked(t))return"untracked";let s=await this.getSubmoduleOfFile(t),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:t;a.push("blame","--porcelain"),i&&a.push("-w");let l=`-C${uh}`;switch(n){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:ua(n)}a.push("--",o);let c=await this.git.raw(a);return j6(c)}async isTracked(t){let n=await this.getSubmoduleOfFile(t),i=n?["-C",n.submodule]:[],s=n?n.relativeFilepath:t;return i.push("ls-files","--",s),this.git.raw(i).then(a=>a.trim()!=="")}async commitAll({message:t,amend:n}){return this.withGitOperation(2,async()=>{if(this.plugin.settings.updateSubmodules){let a=await this.getSubmodulePaths();for(let o of a)await this.git.cwd({path:o,root:!1}).add("-A"),await this.git.cwd({path:o,root:!1}).commit(await this.formatCommitMessage(t))}let i=this.getVaultPathspec();await this.git.add(i==null?"-A":["-A","--",i]);let s=await this.git.commit(await this.formatCommitMessage(t),n?["--amend"]:[]);return this.app.workspace.trigger("obsidian-git:head-change"),this.getCommittedFilesCount(s.summary.changes)})}async commit({message:t,amend:n}){return this.withGitOperation(2,async()=>{try{let i=await this.git.commit(await this.formatCommitMessage(t),n?["--amend"]:[]);return this.app.workspace.trigger("obsidian-git:head-change"),this.getCommittedFilesCount(i.summary.changes)}catch(i){return this.throwConflictError(i)}})}async getCommittedFilesCount(t){return t!==0?t:(await this.git.diffSummary(["HEAD^1","HEAD"])).changed}async stage(t,n){t=this.getRelativeRepoPath(t,n),await this.git.add(["--",t])}async stageAll({dir:t}){let n=t!=null?t:this.getVaultPathspec();await this.git.add(n==null?"-A":["-A","--",n])}async unstageAll({dir:t}){let n=t!=null?t:this.getVaultPathspec();await this.git.reset(n!=null?["--",n]:[])}async unstage(t,n){t=this.getRelativeRepoPath(t,n),await this.git.reset(["--",t])}async discard(t){await this.isTracked(t)&&await this.git.checkout(["--progress","--",t])}async applyPatch(t){let n=we.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(n,t),await this.git.applyPatch(n,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(n)}async getUntrackedPaths(t){var a;let n=(a=t==null?void 0:t.path)!=null?a:this.getVaultPathspec(),i=[];return n!=null&&i.push("--",n),(await this.git.clean(Ku.RECURSIVE+Ku.DRY_RUN,i)).paths}async hashObject(t){t=this.getRelativeRepoPath(t);let n=await this.getSubmoduleOfFile(t),i=n?["-C",n.submodule]:[],s=n?n.relativeFilepath:t;return i.push("hash-object","--",s),this.git.raw(i)}async discardAll({dir:t}){var n;return this.discard((n=t!=null?t:this.getVaultPathspec())!=null?n:".")}async pull(){return this.withGitOperation(1,async()=>{try{if(this.plugin.settings.updateSubmodules){let s=["update","--remote","--merge","--recursive"],a=this.getVaultPathspec();a!=null&&s.push("--",a),await this.git.subModule(s)}let t=await this.branchInfo();if(!t.current)throw new Error("No current branch found. Cannot pull.");let n=await this.git.revparse([t.current]);if(!t.tracking)return this.plugin.log(this.plugin.settings.updateSubmodules?"No tracking branch found. Ignoring pull of main repo and updated submodules only.":"No tracking branch found. Ignoring pull."),{status:"skipped",reason:"no-upstream"};await this.git.fetch();let i=await this.git.revparse([t.tracking]);if(n!==i){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let c=[t.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&c.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(c);break;case"rebase":{this.plugin.settings.rebaseAutoStash==="enabled"?c.push("--autostash"):this.plugin.settings.rebaseAutoStash==="disabled"&&c.push("--no-autostash"),await this.git.rebase(c);break}}}catch(c){await this.throwConflictError(c)}else this.plugin.settings.syncMethod==="reset"&&(await this.git.raw(["update-ref",`refs/heads/${t.current}`,i]),await this.git.reset([]));let s=await this.git.revparse([t.current]);if(s===n)return{status:"up-to-date"};this.app.workspace.trigger("obsidian-git:head-change");let o=(await this.git.diff([`${n}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter Line truncated
`)){let[o,l]=a.split("\0");if(!(o!=null&&o.startsWith("refs/heads/")))continue;let c=o.slice(11);s.push(c),c===t&&(i=l||void 0)}return{current:t,tracking:i,branches:s}}async getRemoteUrl(t){try{return await this.git.remote(["get-url",t])||void 0}catch(n){if(String(n).contains(t))return;throw n}}async log(t,n=!0,i,s){let a;t&&(a=this.getRelativeRepoPath(t,n));let o={file:a,maxCount:i,"--diff-merges":"first-parent","--name-status":null};return s&&(o[s]=null),(await this.git.log(o)).all.map(c=>{var u,f,d,h;return{...c,author:{name:c.author_name,email:c.author_email},refs:c.refs.split(", ").filter(p=>p.length>0),diff:{...c.diff,files:(f=(u=c.diff)==null?void 0:u.files.map(p=>{let g="from"in p?p.from:void 0;return{...p,status:"status"in p?p.status:"M",path:p.file,hash:c.hash,vaultPath:this.getRelativeVaultPath(p.file),fromPath:g,fromVaultPath:g!=null?this.getRelativeVaultPath(g):void 0,binary:p.binary}}))!=null?f:[]},fileName:(h=(d=c.diff)==null?void 0:d.files.first())==null?void 0:h.file}})}async show(t,n,i=!0){let s=this.getRelativeRepoPath(n,i);return this.git.show(["--textconv",t+":"+s])}async getLocalBranchUpstream(t){try{let i=(await this.git.raw(["rev-parse","--abbrev-ref",`${t}@{upstream}`])).trim();return i.length>0?i:void 0}catch(n){return}}getAvailableLocalBranchName(t,n,i){let s=t;if(!i.includes(s))return s;let a=`${t}-${n}`,o=a,l=0;for(;i.includes(o);)l+=1,o=`${a}-${l}`;return o}async checkout(t,n){return this.withGitOperation(5,async()=>{if(n){let i=`${n}/${t}`,s=await this.branchInfo();if(s.branches.includes(t)&&await this.getLocalBranchUpstream(t)===i)await this.git.checkout(t);else{let l=this.getAvailableLocalBranchName(t,n,s.branches);await this.git.checkout(["-b",l,i])}}else await this.git.checkout(t);if(this.plugin.settings.submoduleRecurseCheckout){let i=await this.getSubmodulePaths();for(let s of i){let a=await this.git.cwd({path:s,root:!1}).branch();Object.keys(a.branches).includes(t)&&await this.git.cwd({path:s,root:!1}).checkout(t)}}})}async createBranch(t){await this.git.checkout(["-b",t])}async deleteBranch(t,n){await this.git.branch([n?"-D":"-d",t])}async branchIsMerged(t){return!(await this.git.branch(["--no-merged"])).all.contains(t)}async init(){await this.git.init(!1)}async clone(t,n,i){await this.git.clone(t,we.join(this.app.vault.adapter.getBasePath(),n),i?["--depth",`${i}`]:[]),await this.setGitInstance()}async setConfig(t,n){n==null?await this.getConfig(t,"local")!==void 0&&await this.git.raw(["config","--local","--unset-all",t]):await this.git.addConfig(t,n,!1,"local")}async getConfig(t,n="local"){var s;return(s=(await this.git.getConfig(t.toLowerCase(),n=="all"?void 0:n)).value)!=null?s:void 0}async fetch(t){return this.withGitOperation(4,async()=>{await this.git.fetch(t!=null?[t]:[])})}async setRemote(t,n){(await this.getRemotes()).includes(t)?await this.git.remote(["set-url",t,n]):await this.git.remote(["add",t,n])}async getRemoteBranches(t){let n=await this.git.branch(["-r","--list",`${t}*`]),i=[];for(let s in n.branches)i.push(n.branches[s].name);return i}async getRemotes(){let t=await this.git.remote([]);return t?t.trim().split(`
`):[]}async removeRemote(t){await this.git.removeRemote(t)}async updateUpstreamBranch(t){try{await this.git.branch(["--set-upstream-to",t])}catch(n){try{await this.git.branch(["--set-upstream",t])}catch(i){let[s,a]=fa(t),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(t){return this.setGitInstance()}updateBasePath(t){return this.setGitInstance(!0)}async getDiffString(t,n=!1,i){return n?await this.git.diff(["--cached","--",t]):i?await this.git.show([`${i}`,"--",t]):await this.git.diff(["--",t])}async diff(t,n,i){return await this.git.diff([`${n}..${i}`,"--",t])}async rawCommand(t){let n=t.split(" "),i=n[0];return i===void 0?"":await this.git.raw(i,...n.slice(1))}async getSubmoduleOfFile(t){if(!await this.app.vault.adapter.exists(we.dirname(t)))return;let n=await this.git.raw(["-C",we.dirname(t),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",we.dirname(t),"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(we.normalize(t)),o=we.relative(n,a);return{submodule:n,relativeFilepath:o}}async getLastCommitTime(){try{let t=await this.git.log({n:1});if(t!=null&&t.latest!=null)return new Date(t.latest.date)}catch(t){if(t instanceof dr){if(t.message.contains("does not have any commits yet"))return}else throw t}}async isGitInstalled(){let t=this.plugin.localStorage.getGitPath(),n=await zu(t||"git",["--version"],{});if(n.error)if(bs.Platform.isWin&&!t){this.plugin.log(`Git not found in PATH. Checking standard installation path(${fh}) of Git for Windows.`);let i=await zu(fh,["--version"]);if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(t){if(t instanceof dr){let n=String(t.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.contains("Unable to open connection")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new $l(n)}throw t}async isFileTrackedByLFS(t){try{return(await this.git.raw(["check-attr","filter",t])).includes("filter: lfs")}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(`Error checking LFS status: ${i}`)}}},VT={hash:"000000",isZeroCommit:!0,summary:""};function j6(r){let t=r.replaceAll(`\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;){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 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 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. 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
`),n={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let s=0;s<t.length;){let a=t[s];if(GT(a)){let o=a.split(" "),l=z6(o,i,n);for(s++;GT(t[s]);s++){let c=t[s].split(" ");V6(c,n,i)}W6(n.commits.get(l)),i+=1}else if(!(a===""&&s===t.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${a}`);s++}return n}function z6(r,e,t){let n=r[0],i=r[1],s=r[2];if(n===void 0||i===void 0||s===void 0)throw Error(`Invalid git-blame line info: ${r.join(" ")}`);if(t.hashPerLine.push(n),t.originalFileLineNrPerLine.push(parseInt(i)),t.finalFileLineNrPerLine.push(parseInt(s)),r.length>=4&&t.groupSizePerStartingLine.set(e,parseInt(r[3])),parseInt(s)!==e)throw Error(`git-blame output is out of order: ${e} vs ${s}`);return n}function V6(r,e,t){let n=r[0],i=r.slice(1).join(" "),s=e.hashPerLine[t];if(s===void 0)throw Error(`No commit hash found for git-blame line ${t}`);let a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(n){case"summary":a.summary=i;break;case"author":a.author.name=i;break;case"author-mail":a.author.email=jT(i);break;case"author-time":a.author.epochSeconds=parseInt(i);break;case"author-tz":a.author.tz=i;break;case"committer":a.committer.name=i;break;case"committer-mail":a.committer.email=jT(i);break;case"committer-time":a.committer.epochSeconds=parseInt(i);break;case"committer-tz":a.committer.tz=i;break;case"previous":a.previous.commitHash=i;break;case"filename":a.previous.filename=i;break;case void 0:break}e.commits.set(s,a)}function W6(r){if(r.summary===void 0)throw Error(`Summary not provided for commit: ${r.hash}`);N0(r.author)&&(r.author=void 0),N0(r.committer)&&(r.committer=void 0),N0(r.previous)&&(r.previous=void 0),r.isZeroCommit=!!r.hash.match(/^0*$/)}function N0(r){return!r||Object.keys(r).length===0}function GT(r){return r===void 0?!1:r.length>0&&r[0].trim()===r[0]}function jT(r){let e=r.startsWith("<")?r.substring(1):r;return e.endsWith(">")?e.substring(0,e.length-1):e}m();var y2=require("@codemirror/state");m();var B0=class{constructor(){this.eventsPerFilepath=new Map;this.init()}ifFilepathDefinedTransformSubscribers(e,t){if(e)return this.ensureInitialized(e),t(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(t=>t.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()}},Wn=new B0;m();var Xh=require("@codemirror/state");m();m();m();var q6="input is invalid type",WT="finalize already called",Y6=typeof ArrayBuffer!="undefined",U0=function(r){var e=typeof r;if(e==="string")return[r,!0];if(Array.isArray(r))return[r,!1];if(Y6&&r){if(r.constructor===ArrayBuffer)return[new Uint8Array(r),!1];if(ArrayBuffer.isView(r))return[r,!1]}throw new Error(q6)};var K="0123456789abcdef".split(""),Z6=[-2147483648,8388608,32768,128],di=[24,16,8,0],qh=[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],Yh=["hex","array","digest","arrayBuffer"],tr=[],qT=function(r,e){return function(t){return new rr(e,!0).update(t)[r]()}},ZT=function(r){var e=qT("hex",r);e.create=function(){return new rr(r)},e.update=function(i){return e.create().update(i)};for(var t=0;t<Yh.length;++t){var n=Yh[t];e[n]=qT(n,r)}return e},YT=function(r,e){return function(t,n){return new Zh(t,e,!0).update(n)[r]()}},KT=function(r){var e=YT("hex",r);e.create=function(i){return new Zh(i,r)},e.update=function(i,s){return e.create(i).update(s)};for(var t=0;t<Yh.length;++t){var n=Yh[t];e[n]=YT(n,r)}return e};function rr(r,e){e?(tr[0]=tr[16]=tr[1]=tr[2]=tr[3]=tr[4]=tr[5]=tr[6]=tr[7]=tr[8]=tr[9]=tr[10]=tr[11]=tr[12]=tr[13]=tr[14]=tr[15]=0,this.blocks=tr):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=314413 Line truncated
`)).onChange(l=>this.plugin.localStorage.setEnvVars(l.split(`
`))))}},{name:"Additional PATH environment variable paths",desc:"One path per line.",visible:n,render:a=>{a.addTextArea(o=>o.setValue(this.plugin.localStorage.getPATHPaths().join(`
`)).onChange(l=>this.plugin.localStorage.setPATHPaths(l.split(`
`))))}},{name:"Reload with new environment variables",desc:"Removing previous variables requires an Obsidian restart.",visible:n,render:a=>{a.addButton(o=>o.setButtonText("Reload").setCta().onClick(async()=>this.plugin.reloadGitManager()))}},{name:"Repository folder within the vault",desc:"Choose the folder containing the Git repository. Leave empty when the repository is at the root.",control:{type:"folder",key:"basePath",includeRoot:!1,validate:a=>{if(a!==""){if(a=="/")return"Leave empty when the repository is at the root.";if(!this.app.vault.getFolderByPath(a))return"Choose an existing folder in this vault."}}}},{name:"Custom Git directory path (instead of .git)",desc:"Resolved from the custom base path or vault root. Restart Obsidian to apply. Use backslashes on Windows.",control:{type:"text",key:"gitDir",placeholder:".git"}},{name:"Disable on this device",desc:"This setting is not synced.",render:a=>{a.addToggle(o=>o.setValue(this.plugin.localStorage.getPluginDisabled()).onChange(l=>{this.plugin.localStorage.setPluginDisabled(l),l?this.plugin.unloadPlugin():this.plugin.init({fromReload:!0}).catch(c=>this.plugin.displayError(c)),new He.Notice("Obsidian must be restarted for the change to take effect.")}))}},{type:"group",heading:"Debugging",items:[{name:"Copy debug information",desc:"May contain sensitive settings.",render:a=>{a.addButton(o=>o.setButtonText("Copy").onClick(async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.settings,pluginVersion:this.plugin.manifest.version},null,4)),new He.Notice("Debug information copied to clipboard. May contain sensitive information!")}))}},{name:"Debugging and logging",desc:He.Platform.isDesktopApp?`Open the developer console with ${He.Platform.isMacOS?"CMD (\u2318) + OPTION (\u2325) + I":"CTRL + SHIFT + I"}.`:"",visible:()=>He.Platform.isDesktopApp}]}]},{heading:"Support",type:"group",items:[{name:"Donate",desc:"Support continued development of the plugin.",render:a=>{a.addButton(o=>{var c;let l=(c=o.buttonEl.parentElement)==null?void 0:c.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});l==null||l.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"}}),o.buttonEl.remove()})}}]}]}configureLineAuthorShowStatus(t){this.settings.lineAuthor.show=t,this.plugin.saveSettings(),t?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(t,n){this.settings.lineAuthor[t]=n,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let t=this.settings.lineAuthor;t.authorDisplay!=="hide"&&(t.lastShownAuthorDisplay=t.authorDisplay),t.dateTimeFormatOptions!=="hide"&&(t.lastShownDateTimeFormatOptions=t.dateTimeFormatOptions)}renderLineAuthorSettings(t){t.empty(),this.lineAuthorColorSettings.clear();let n=new He.Setting(t).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.createEl("a",{href:d5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),n.descEl.createEl("br"),n.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),n.descEl.createEl("br"),n.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),n.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(s=>{this.configureLineAuthorShowStatus(s),this.refreshLineAuthorPage(t)})),this.settings.lineAuthor.show){let i=new He.Setting(t).setName("Follow movement and copies across files and commits").addDropdown(c=>{c.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),c.setValue(this.settings.lineAuthor.followMovement),c.onChange(u=>this.lineAuthorSettingHandler("followMovement",u))});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 ${uh} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"th 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=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.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),s.descEl.createSpan({text:"."});let a=new He.Setting(t).setName("Oldest age in coloring");this.setOldestAgeDescription(a.descEl,this.settings.lineAuthor.coloringMaxAge),a.addText(c=>{c.setPlaceholder("1y"),c.setValue(this.settings.lineAuthor.coloringMaxAge),c.onChange(async u=>{let d=Qu(u)!==void 0;this.setOldestAgeDescription(a.descEl,u),d&&(await this.lineAuthorSettingHandler("coloringMaxAge",u),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest",t),this.createColorSetting("oldest",t);let o=new He.Setting(t).setName("Text color").addText(c=>{c.setValue(this.settings.lineAuthor.textColorCss),c.onChange(async u=>{await this.lineAuthorSettingHandler("textColorCss",u)})});o.descEl.empty(),o.descEl.createSpan({text:"The CSS color of the gutter text."}),o.descEl.createEl("br"),o.descEl.createEl("br"),o.descEl.createSpan({text:"It is highly recommended to use "}),o.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),o.descEl.createSpan({text:" defined by themes (e.g. "}),o.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),o.descEl.createSpan({text:" or "}),o.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),o.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),o.descEl.createEl("br"),o.descEl.createEl("br"),o.descEl.createSpan({text:"See: "}),o.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 l=new He.Setting(t).setName("Ignore whitespace and newlines in changes").addToggle(c=>{c.setValue(this.settings.lineAuthor.ignoreWhitespace),c.onChange(u=>this.lineAuthorSettingHandler("ignoreWhitespace",u))});l.descEl.empty(),l.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."}),l.descEl.createEl("br"),l.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(t,n){let i=new He.Setting(n).setName("").addText(s=>{let a=K0(t,this.settings.lineAuthor),o=K0(t,Yr.lineAuthor);s.setPlaceholder(Xv(o)),s.setValue(Xv(a)),s.onChange(async l=>{let c=dA(l);if(c!==void 0){let u=t==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(u,c)}this.refreshColorSettingsDesc(t,c)})});this.lineAuthorColorSettings.set(t,i),this.refreshColorSettingsName(t),this.refreshColorSettingsDesc(t,K0(t,this.settings.lineAuthor))}refreshColorSettingsName(t){let n=this.lineAuthorColorSettings.get(t);if(n){let i=t==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";n.nameEl.setText(`Color for ${i} commits`)}}refreshColorSettingsDesc(t,n){let i=this.lineAuthorColorSettings.get(t);i&&this.colorSettingPreviewDesc(i.descEl,t,this.settings.lineAuthor,n!==void 0)}colorSettingPreviewDesc(t,n,i,s){t.empty(),t.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?ap(n,i):"rgba(127,127,127,0.3)",o=He.moment.unix(He.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";t.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(t,n){t.empty(),t.createEl("a",{text:"Format string",href:x2}),t.createSpan({text:" to display the authoring date."}),t.createEl("br");let i=(0,He.moment)().format(n);t.createSpan({text:`Currently: ${i}`})}setOldestAgeDescription(t,n){let i=Qu(n),s=i!==void 0?`${i.asDays()} days`:"invalid!";t.empty(),t.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
Smallest valid age is "1d". Currently: ${s}`})}refreshLineAuthorPage(t){window.clearTimeout(this.lineAuthorRefreshTimer),this.lineAuthorRefreshTimer=window.setTimeout(()=>{this.lineAuthorRefreshTimer=void 0,t.isConnected&&this.renderLineAuthorSettings(t)},80)}cancelLineAuthorRefresh(){window.clearTimeout(this.lineAuthorRefreshTimer),this.lineAuthorRefreshTimer=void 0,this.lineAuthorColorSettings.clear()}},X0=class extends He.SettingPage{constructor(t){super();this.tab=t;this.title="Line author information"}display(){this.tab.renderLineAuthorSettings(this.containerEl)}hide(){this.tab.cancelLineAuthorRefresh(),super.hide()}};function K0(r,e){return r==="oldest"?e.colorOld:e.colorNew}function Qu(r){let e=He.moment.duration("P"+r.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var $r=require("obsidian");var cp=class{constructor(e,t){this.statusBarEl=e;this.plugin=t;this.messages=[];this.currentMessage=null;this.lastMessageTimestamp=null;this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),t.registerEvent(t.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,t){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:t}),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.conflictEl.setAttribute("role","button"),this.conflictEl.onclick=()=>this.plugin.openMergeConflictHelp(),this.conflictEl.onkeydown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.plugin.openMergeConflictHelp())},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.state.mergeInProgress?((0,$r.setIcon)(this.conflictEl,"git-merge"),this.conflictEl.ariaLabel="Merge in progress. Select for help resolving and finishing the merge.",this.conflictEl.tabIndex=0,this.conflictEl.style.cursor="pointer",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.tabIndex=-1,this.conflictEl.style.cursor="",this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,$r.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,$r.setIcon)(this.iconEl,this.getProgressIcon()),this.displayProgressText(),this.statusBarEl.addClass(this.base+"progress"),this.addMergeHelpToTooltip();return}switch(this.plugin.state.operation){case 0:this.displayFromNow();break;case 2:this.statusBarEl.ariaLabel="Committing changes...",(0,$r.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,$r.setIcon)(this.iconEl,"upload"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"push");break;case 1:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pulling changes..."),(0,$r.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"pull");break;case 4:this.statusBarEl.ariaLabel=this.getProgressTooltip("Fetching from remote..."),(0,$r.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"fetch");break;case 5:this.statusBarEl.ariaLabel=this.getProgressTooltip("Checking out branch..."),(0,$r.setIcon)(this.iconEl,"git-branch"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"checkout");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,$r.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");break}this.addMergeHelpToTooltip()}addMergeHelpToTooltip(){if(!this.plugin.state.mergeInProgress)r Line truncated
${t}`:e}displayProgressText(){this.progress?this.textEl.setText(this.getCompactProgressText()):this.textEl.empty()}getProgressTooltip(e){if(!this.progress)return e;let t=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 n=this.progress.processed!==void 0&&this.progress.total!==void 0?` (${this.progress.processed}/${this.progress.total})`:"";return`${this.progress.action}: ${t}${Math.round(this.progress.progress)}%${n}`}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)==null?void 0:e.action){case"Fetching":case"Pulling":return"download";case"Pushing":return"upload";case"Checking out":return"git-branch";default:return"git-pull-request"}}displayFromNow(){var n;if(!this.plugin.gitReady){this.statusBarEl.ariaLabel="Git is not ready",(0,$r.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");return}let e=this.lastCommitTimestamp,t=this.plugin.state.offlineMode;if(e){let i=(0,$r.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${t?"Offline: ":""}Last Commit: ${i}`,((n=this.unPushedCommits)!=null?n:0)>0&&(this.statusBarEl.ariaLabel+=`
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=t?"Git is offline":"Git is ready";t?(0,$r.setIcon)(this.iconEl,"globe"):(0,$r.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.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var E2=require("obsidian"),ef=class{constructor(e){this.plugin=e}saveLastAuto(e,t){t==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):t==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):t==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,t,n;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((t=this.plugin.localStorage.getLastAutoPull())!=null?t:""),push:new Date((n=this.plugin.localStorage.getLastAutoPush())!=null?n:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let t=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(t)}if(this.plugin.settings.autoPullInterval>0){let t=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(t)}}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 t=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(t)}}}get isAutomaticsDisabled(){return!this.plugin.gitReady||this.plugin.localStorage.getPausedAutomatics()}startAutoCommitAndSync(e){if(this.isAutomaticsDisabled)return;let t=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,E2.debounce)(()=>this.doAutoCommitAndSync(),t,!0):(t>2147483647&&(t=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),t))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let t=await this.plugin.gitManager.getLastCommitTime();if(t){this.saveLastAuto(t,"backup");let n=this.diff(this.plugin.settings.autoSaveInterval,t);if(n>0)return this.startAutoCommitAndSync(n),!1}}let e=this.plugin.settings.autoCommitOnlyStaged?"staged":"all";return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.gitActions.commit({fromAuto:!0,mode:e}):await this.plugin.gitActions.commitAndSync({fromAutoBackup:!0,mode:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){if(this.isAutomaticsDisabled)return;let t=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;t>2147483647&&(t=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),t)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){if(this.isAutomaticsDisabled)return;let t=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;t>2147483647&&(t=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),t)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var t;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((t=this.plugin.autoCommitDebouncer)==null||t.cancel(),this.plugin.autoCommitDebouncer=void 0,e=!0),e}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPush=void 0,!0):!1}diff Line truncated
`)}static newName(){let e=R2[T2]||1;return R2[T2]=e+1,"\u037C"+e.toString(36)}static mount(e,t,n){let i=e[Q0],s=n&&n.nonce;i?s&&i.setNonce(s):i=new J0(e,s),i.mount(Array.isArray(t)?t:[t],e)}},P2=new Map,J0=class{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=P2.get(n);if(s)return e[Q0]=s;this.sheet=new i.CSSStyleSheet,P2.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Q0]=this}mount(e,t){let n=this.sheet,i=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),n)for(let c=0;c<o.rules.length;c++)n.insertRule(o.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=o.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
`;this.styleTag.textContent=a;let o=t.head||t;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 Y2=require("@codemirror/language"),m5=require("@lezer/highlight"),Mt=class r{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}offset(e,t=e){return new r(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}};function lo(r,e,t,n,i,s){if(r==n)return[];let a=ob(r,e,t,n,i,s),o=lb(r,e+a,t,n,i+a,s);e+=a,t-=o,i+=a,s-=o;let l=t-e,c=s-i;if(!l||!c)return[new Mt(e,t,i,s)];if(l>c){let f=r.slice(e,t).indexOf(n.slice(i,s));if(f>-1)return[new Mt(e,e+f,i,i),new Mt(e+f+c,t,s,s)]}else if(c>l){let f=n.slice(i,s).indexOf(r.slice(e,t));if(f>-1)return[new Mt(e,e,i,i+f),new Mt(t,t,i+f+l,s)]}if(l==1||c==1)return[new Mt(e,t,i,s)];let u=K2(r,e,t,n,i,s);if(u){let[f,d,h]=u;return lo(r,e,f,n,i,d).concat(lo(r,f+h,t,n,d+h,s))}return g5(r,e,t,n,i,s)}var rf=1e9,nf=0,ab=!1;function g5(r,e,t,n,i,s){let a=t-e,o=s-i;if(rf<1e9&&Math.min(a,o)>rf*16||nf>0&&Date.now()>nf)return Math.min(a,o)>rf*64?[new Mt(e,t,i,s)]:$2(r,e,t,n,i,s);let l=Math.ceil((a+o)/2);eb.reset(l),tb.reset(l);let c=(h,p)=>r.charCodeAt(e+h)==n.charCodeAt(i+p),u=(h,p)=>r.charCodeAt(t-h-1)==n.charCodeAt(s-p-1),f=(a-o)%2!=0?tb:null,d=f?null:eb;for(let h=0;h<l;h++){if(h>rf||nf>0&&!(h&63)&&Date.now()>nf)return $2(r,e,t,n,i,s);let p=eb.advance(h,a,o,l,f,!1,c)||tb.advance(h,a,o,l,d,!0,u);if(p)return w5(r,e,t,e+p[0],n,i,s,i+p[1])}return[new Mt(e,t,i,s)]}var gp=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let t=0;t<this.len;t++)this.vec[t]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,i,s,a,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=i+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<t&&f<n&&o(u,f);)u++,f++;if(this.vec[c]=u,u>t)this.end+=2;else if(f>n)this.start+=2;else if(s){let d=i+(t-n)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(a){let h=s.vec[d];if(h>=t-u)return[h,i+h-d]}else{let h=t-s.vec[d];if(u>=h)return[u,f]}}}return null}},eb=new gp,tb=new gp;function w5(r,e,t,n,i,s,a,o){let l=!1;return!Kl(r,n)&&++n==t&&(l=!0),!Kl(i,o)&&++o==a&&(l=!0),l?[new Mt(e,t,s,a)]:lo(r,e,n,i,s,o).concat(lo(r,n,t,i,o,a))}function Z2(r,e){let t=1,n=Math.min(r,e);for(;t<n;)t=t<<1;return t}function ob(r,e,t,n,i,s){if(e==t||e==s||r.charCodeAt(e)!=n.charCodeAt(i))return 0;let a=Z2(t-e,s-i);for(let o=e,l=i;;){let c=o+a,u=l+a;if(c>t||u>s||r.slice(o,c)!=n.slice(l,u)){if(a==1)return o-e-(Kl(r,o)?0:1);a=a>>1}else{if(c==t||u==s)return c-e;o=c,l=u}}}function lb(r,e,t,n,i,s){if(e==t||i==s||r.charCodeAt(t-1)!=n.charCodeAt(s-1))return 0;let a=Z2(t-e,s-i);for(let o=t,l=s;;){let c=o-a,u=l-a;if(c<e||u<i||r.slice(c,o)!=n.slice(u,l)){if(a==1)return t-o-(Kl(r,o)?0:1);a=a>>1}else{if(c==e||u==i)return t-c;o=c,l=u}}}function rb(r,e,t,n,i,s,a,o){let l=n.slice(i,s),c=null;for(;;){if(c||a<o)return c;for(let u=e+a;;){Kl(r,u)||u++;let f=u+a;if(Kl(r,f)||(f+=f==u+1?1:-1),f>=t)break;let d=r.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=ob(r,f,t,n,i+h+d.length,s),g=lb(r,e,u,n,i,i+h),w=d.length+p+g;(!c||c[2]<w)&&(c=[u-g,i+h-g,w])}u=f}if(o<0)return c;a=a>>1}}function K2(r,e,t,n,i,s){let a=t-e,o=s-i;if(a<o){let l=K2(n,i,s,r,e,t);return l&&[l[1],l[0],l[2]]}return a<4||o*2<a?null:rb(r,e,t,n,i,s,Math.floor(a/4),-1)}function $2(r,e,t,n,i,s){ab=!0;let a=t-e,o=s-i,l;if(a<o){let d=rb(n,i,s,r,e,t,Math.floor(a/6),50);l=d&&[d[1],d[0],d[2]]}else l=rb(r,e,t,n,i,s,Math.floor(o/6),50);if(!l)return[new Mt(e,t,i,s)];let[c,u,f]=l;return lo(r,e,c,n,i,u).concat(lo(r,c+f,t,n,u+f,s))}function X2(r,e){for(let t=1;t<r.length;t++){let n=r[t-1],i=r[t];n.toA>i.fromA-e&&n.toB>i.fromB-e&&(r[t-1]=new Mt(n.fromA,i.toA,n.fromB,i.toB),r.splice(t--,1))}}function v5(r,e,t){for(;;){X2(t,1);let n=!1;for(let i=0;i<t.length;i++){let s=t[i],a,o;(a=ob(r,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=t[i]=new Mt(s.fromA+a,s.toA,s.fromB+a,s.toB)),(o=lb(r,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=t[i]=new Mt(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-(i?t[i-1].toA:0),f=(i<t.length-1?t[i+1].fromA:r.length)-s.toA;if(!u||!f)continue;let d=l?r.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&r.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(t[i]=new Mt(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),n=!0):f<=d.length&&r.slice(s.toA,s.toA+f)==d.slice(0,f)&&(t[i]=new Mt(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),n=!0)}if(!n)break}return t}function b5(r,e,t){for(let n=0,i=0;i<r.length;i++){let s=r[i],a=s.toA-s.fromA,o=s.toB-s.fromB;if(a&&o||a>3||o>3){let l=i==r.length-1?e.length:r[i+1].fromA,c=s.fromA-n,u=l-s.toA,f=F2(e,s.fromA,c),d=I2(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[w,b,y]=a?[e,s.fromA,s.toA]:[t,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==w.slice(y-h,y)?(s=r[i]=new Mt(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=I2(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==w.slice(b,b+p)&&(s=r[i]=new Mt(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=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(`
`);for(let a of t){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=nr.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(i[d-1]);o+l>i.length&&i.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)}n.push(f)}return n}function db(r,e,t){let n=e.lineAt(r.fromA).number,i=r.fromA==r.toA?0:bp(e,r.endA)-n+1,s=t.lineAt(r.fromB).number,a=r.fromB==r.toB?0:bp(t,r.endB)-s+1,o={oldStart:n,oldLines:i,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var lR={scanLimit:1e3,timeout:200};function O5(r,e,t,n){let i=ub.Text.of(r.split(`
`)),s=ub.Text.of(e.split(`
`)),a=t&&n?_s.updateB(t,i,s,n,lR):_s.build(i,s,lR),o=[];for(let l=0;l<a.length;l++){let c=a[l],u=db(c,i,s);o.push(u)}return{hunks:fb(r,e,o),chunks:a}}function cR(r,e,t,n){return O5(r,e,t,n)}var xs=require("obsidian"),hi=class{static hasHunksData(e){let t=e.field(Xr,!1);return!!t&&!t.isDirty}static getHunks(e,t){let n=e.field(Xr);return n?t?n.stagedHunks:n.hunks:[]}static getHunkAtPos(e,t,n){if(!e.field(Xr))return;let s=e.doc.lineAt(t).number,a=this.getHunks(e,n);return nr.findHunk(s,a)[0]}static getCursorHunk(e,t){if(!e.field(Xr))return;let i=e.selection.main.head;return this.getHunkAtPos(e,i,t)}static getHunk(e,t,n){if(n!=null)return this.getHunkAtPos(e,n,t);if(e.selection.main.empty)return this.getCursorHunk(e,t);let i=e.selection.main.from,s=e.selection.main.to,a=e.doc.lineAt(i).number,o=bp(e.doc,s),l=this.getHunks(e,t),c=nr.createPartialHunk(l,a,o);if(!c)return;let u=e.field(Xr);if(t){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}},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,`
`)&&(c.removed.no_nl_at_eof=!0);return c}},Xr=Xl.StateField.define({create:r=>{},update:(r,e)=>{var i,s,a;let t=r?{...r}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},n=!1;for(let o of e.effects)if(o.is(Ql)&&(t.compareText=o.value.compareText,t.compareTextHead=o.value.compareTextHead,n=(r==null?void 0:r.compareText)!==o.value.compareText,n&&(t.chunks=void 0,t.changeDesc=void 0)),o.is(yp)){let l=(i=e.startState.field(af,!1))==null?void 0:i.revision;if(o.value.revision!==l)continue;uR(t,o.value.result,e.state),t.changeDesc=void 0}if(e.docChanged){let o=!t.changeDesc||t.changeDesc.newLength===e.changes.length;console.assert(o,"Git: Hunk changes belong to different document histories."),o||(t.chunks=void 0),t.changeDesc=D5(t.changeDesc,e.changes)}if(t.compareText!==void 0){if(n||e.docChanged){t.isDirty=!0;let o=L5(e,t.compareText,t.chunks,t.changeDesc,t.maxDiffTimeMs);o&&(uR(t,o,e.state),t.changeDesc=void 0)}}else{t.compareText=void 0,t.compareTextHead=void 0,t.chunks=void 0,t.hunks=[],t.stagedHunks=[],t.isDirty=!1;let o=e.state.field(xs.editorInfoField).file;(a=(s=At.plugin)==null?void 0:s.editorIntegration.signsFeature.changeStatusBar)==null||a.display(t.hunks,o)}return t}});function uR(r,e,t){var i,s;r.hunks=e.hunks,r.chunks=e.chunks,r.isDirty=!1,r.maxDiffTimeMs=Math.max(.95*r.maxDiffTimeMs,e.diffDuration);let n=t.field(xs.editorInfoField).file;(s=(i=At.plugin)==null?void 0:i.editorIntegration.signsFeature.changeStatusBar)==null||s.display(r.hunks,n)}var af=Xl.StateField.define({create:r=>{var e,t;return{debouncer:(0,xs.debounce)(n=>{let{state:i,compareText:s,previousChunks:a,changeDesc:o,revision:l}=n,c=i.field(xs.editorEditorField,!1);if(!c)return;let u=c.state.field(af,!1);if((u==null?void 0:u.revision)!==l)return;let f=fR(i,s,a,o);c.dispatch({effects:yp.of({result:f,revision:l})})},1e3,!0),revision:{},filePath:(t=(e=r.field(xs.editorInfoField,!1))==null?void 0:e.file)==null?void 0:t.path}},update:(r,e)=>{var n,i;let t=(i=(n=e.state.field(xs.editorInfoField,!1))==null?void 0:n.file)==null?void 0:i.path;return e.docChanged||t!==r.filePath?{...r,revision:{},filePath:t}:r}});function D5(r,e){return!r||r.newLength!==e.length?e:r.composeDesc(e)}function fR(r,e,t,n){let i=r.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=cR(e,i,t,n),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function L5(r,e,t,n,i){let s=r.state,a=Math.abs(r.changes.length-r.changes.newLength),o=s.field(af);if(a>1e3||i>16){o.debouncer({state:s,compareText:e,previousChunks:t,changeDesc:n,revision:o.revision});return}else return fR(s,e,t,n)}var Ql=Xl.StateEffect.define(),yp=Xl.StateEffect.define();function dR(r,e){return e.update({effects:Ql.of(r)})}m();m();m();var pt;(function(r){r.INSERT="insert",r.DELETE="delete",r.CONTEXT="context"})(pt||(pt={}));var hR={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},pR={LINES:"lines",WORDS:"words",NONE:"none"},mR={WORD:"word",CHAR:"char"},co;(function(r){r.AUTO="auto",r.DARK="dark",r.LIGHT="light"})(co||(co={}));m();var N5=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],B5=RegExp("["+N5.join("\\")+"]","g");function gR(r){return r.replace(B5,"\\$&")}function hb(r){return r&&r.replace(/\\/g,"/")}function wR(r){let e,t,n,i=0;for(e=0,n=r.length;e<n;e++)t=r.charCodeAt(e),i=(i<<5)-i+t,i|=0;return i}function _p(r){let e=r.length,t=-1/0;for(let n=0;n<e;n++)t=Math.max(t,r[n]);return t}function vR(r,e){let t=r.split(".");return t.length>1?t[t.length-1]:e}function bR(r,e){return e.reduce((t,n)=>t||r.startsWith(n),!1)}var yR=["a/","b/","i/","w/","c/","o/"];function pa(r,e,t){let n=t!==void 0?[...yR,t]:yR,i=e?new RegExp(`^${gR(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=i.exec(r)||[],a=n.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 U5(r,e){return pa(r,"---",e)}function H5(r,e){return pa(r,"+++",e)}function _R(r,e={}){let t=[],n=null,i=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})/,w=/^new file mode (\d{6})/,b=/^copy from "?(.+)"?/,y=/^copy to "?(.+)"?/,k=/^rename from "?(.+)"?/,C=/^rename to "?(.+)"?/,S=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,v=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,E=/^GIT binary patch/,R=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,$=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,D=/^new file mode (\d{6})/,O=/^deleted file mode (\d{6}),(\d{6})/,U=r.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
`).split(`
`);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===" "?"&nbsp;":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)===" "?"&nbsp;":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(`
`+r),i.b(' <span class="d2h-lines-added">'),i.b(i.v(i.f("addedLines",t,e,0))),i.b("</span>"),i.b(`
`+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:{}});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(`
`+r),i.b(' <a class="d2h-file-switch d2h-show">show</a>'),i.b(`
`+r),i.b(" </div>"),i.b(`
`+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:{}});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("&nbsp;"),i.b("</div>"),i.b(`
`+r),i.b(" </td>"),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:{}});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:{}});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(`
`+r),i.b(' <td class="'),i.b(i.v(i.f("type",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.s(i.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' <span class="d2h-code-line-prefix">'),a.b(a.t(a.f("prefix",n,s,0))),a.b("</span>"),a.b(`
`+r)}),t.pop()),i.s(i.f("prefix",t,e,1),t,e,1,0,0,"")||(i.b(' <span class="d2h-code-line-prefix">&nbsp;</span>'),i.b(`
`+r)),i.s(i.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' <span class="d2h-code-line-ctn">'),a.b(a.t(a.f("content",n,s,0))),a.b("</span>"),a.b(`
`+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:{}});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:{}});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:{}});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:{}});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:{}});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:{}});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:{}});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(`
`+r),i.b(' <div class="d2h-file-diff">'),i.b(`
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("diffs",t,e,0))),i.b(`
`+r),i.b(" </tbody>"),i.b(`
`+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:{}});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(`
`+r),i.b(' <div class="d2h-files-diff">'),i.b(`
`+r),i.b(' <div class="d2h-file-side-diff">'),i.b(`
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.d("diffs.left",t,e,0))),i.b(`
`+r),i.b(" </tbody>"),i.b(`
`+r),i.b(" </table>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(' <div class="d2h-file-side-diff">'),i.b(`
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.d("diffs.right",t,e,0))),i.b(`
`+r),i.b(" </tbody>"),i.b(`
`+r),i.b(" </table>"),i.b(`
`+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:{}});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(`
`);function me(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function Ne(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&c!==null&&(n.newName=c),n.newName&&(t.push(n),n=null)),l=null,c=null}function Re(){me(),Ne(),n={blocks:[],deletedLines:0,addedLines:0}}function be(W){me();let te;n!==null&&((te=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(W))?(n.isCombined=!1,s=parseInt(te[1],10),o=parseInt(te[2],10)):(te=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(W))?(n.isCombined=!0,s=parseInt(te[1],10),a=parseInt(te[2],10),o=parseInt(te[3],10)):(W.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,n.isCombined=!1)),i={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:W}}function ye(W){if(n===null||i===null||s===null||o===null)return;let te={content:W},H=n.isCombined?["+ "," +","++"]:["+"],St=n.isCombined?["- "," -","--"]:["-"];bR(W,H)?(n.addedLines++,te.type=pt.INSERT,te.oldNumber=void 0,te.newNumber=o++):bR(W,St)?(n.deletedLines++,te.type=pt.DELETE,te.oldNumber=s++,te.newNumber=void 0):(te.type=pt.CONTEXT,te.oldNumber=s++,te.newNumber=o++),i.lines.push(te)}function ae(W,te){let H=te;for(;H<U.length-3;){if(W.startsWith("diff"))return!1;if(U[H].startsWith(u)&&U[H+1].startsWith(f)&&U[H+2].startsWith(d))return!0;H++}return!1}return U.forEach((W,te)=>{if(!W||W.startsWith("*"))return;let H,St=U[te-1],st=U[te+1],Bt=U[te+2];if(W.startsWith("diff --git")||W.startsWith("diff --combined")){if(Re(),(H=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(W))&&(l=pa(H[1],void 0,e.dstPrefix),c=pa(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(W.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(Re(),(H=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(W))&&(l=pa(H[1],void 0,e.dstPrefix),c=pa(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&W.startsWith(u)&&st.startsWith(f)&&Bt.startsWith(d))&&Re(),n!=null&&n.isTooBig)return;if(n&&(typeof e.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&W.length>e.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let kt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(t.length):"Diff too big to be displayed";be(kt);return}if(W.startsWith(u)&&st.startsWith(f)||W.startsWith(f)&&St.startsWith(u)){if(n&&!n.oldName&&W.startsWith("--- ")&&(H=U5(W,e.srcPrefix))){n.oldName=H,n.language=vR(n.oldName,n.language);return}if(n&&!n.newName&&W.startsWith("+++ ")&&(H=H5(W,e.dstPrefix))){n.newName=H,n.language=vR(n.newName,n.language);return}}if(n&&(W.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){be(W);return}if(i&&(W.startsWith("+")||W.startsWith("-")||W.startsWith(" "))){ye(W);return}let Ze=!ae(W,te);if(n===null)throw new Error("Where is my file !!!");(H=h.exec(W))?n.oldMode=H[1]:(H=p.exec(W))?n.newMode=H[1]:(H=g.exec(W))?(n.deletedFileMode=H[1],n.isDeleted=!0):(H=w.exec(W))?(n.newFileMode=H[1],n.isNew=!0):(H=b.exec(W))?(Ze&&(n.oldName=H[1]),n.isCopy=!0):(H=y.exec(W))?(Ze&&(n.newName=H[1]),n.isCopy=!0):(H=k.exec(W))?(Ze&&(n.oldName=H[1]),n.isRename=!0):(H=C.exec(W))?(Ze&&(n.newName=H[1]),n.isRename=!0):(H=x.exec(W))?(n.isBinary=!0,n.oldName=pa(H[1],void 0,e.srcPrefix),n.newName=pa(H[2],void 0,e.dstPrefix),be("Binary file")):E.test(W)?(n.isBinary=!0,be(W)):(H=S.exec(W))?n.unchangedPercentage=parseInt(H[1],10):(H=A.exec(W))?n.changedPercentage=parseInt(H[1],10):(H=v.exec(W))?(n.checksumBefore=H[1],n.checksumAfter=H[2],H[3]&&(n.mode=H[3])):(H=R.exec(W))?(n.checksumBefore=[H[2],H[3]],n.checksumAfter=H[1]):(H=$.exec(W))?(n.oldMode=[H[2],H[3]],n.newMode=H[1]):(H=D.exec(W))?(n.newFileMode=H[1],n.isNew=!0):(H=O.exec(W))&&(n.deletedFileMode=H[1],n.isDeleted=!0)}),me(),Ne(),t}m();m();m();m();var ma=class{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,l,n,i)}diffWithOptionsObj(e,t,n,i){var s;let a=y=>{if(y=this.postProcess(y,n),i){setTimeout(function(){i(y)},0);return}else return y},o=t.length,l=e.length,c=1,u=o+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,t,e));let g=-1/0,w=1/0,b=()=>{for(let y=Math.max(g,-c);y<=Math.min(w,c);y+=2){let k,C=h[y-1],S=h[y+1];C&&(h[y-1]=void 0);let A=!1;if(S){let x=S.oldPos-y;A=S&&0<=x&&x<o}let v=C&&C.oldPos+1<l;if(!A&&!v){h[y]=void 0;continue}if(!v||A&&C.oldPos<S.oldPos?k=this.addToPath(S,!0,!1,0,n):k=this.addToPath(C,!1,!0,1,n),p=this.extractCommon(k,t,e,y,n),k.oldPos+1>=l&&p+1>=o)return a(this.buildValues(k.lastComponent,t,e))||!0;h[y]=k,k. Line truncated
`);return this.hoganUtils.render(CR,"wrapper",{colorScheme:ic(this.config.colorScheme),filesNumber:e.length,files:t})}};m();var Cb=Object.assign(Object.assign({},fo),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),lf="generic",AR="line-by-line",eG="icon",tG="tag",cf=class{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Cb),t)}render(e){let t=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
`);return this.hoganUtils.render(lf,"wrapper",{colorScheme:ic(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(AR,"file-diff"),i=this.hoganUtils.template(lf,"file-path"),s=this.hoganUtils.template(eG,"file"),a=this.hoganUtils.template(tG,ac(e));return n.render({file:e,fileHtmlId:sc(e),diffs:t,filePath:i.render({fileDiffName:ho(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(lf,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:hr})}generateFileHtml(e){let t=rc(tc(n=>Yn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i=this.hoganUtils.render(lf,"block-header",{CSSLineClass:hr,blockHeader:e.isTooBig?n.header:ga(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,t).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Yn(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:hr.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);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),i}).join(`
`)}applyLineGroupping(e){let t=[],n=[],i=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==pt.INSERT&&i.length||a.type===pt.CONTEXT&&n.length>0)&&(t.push([[],n,i]),n=[],i=[]),a.type===pt.CONTEXT?t.push([[a],[],[]]):a.type===pt.INSERT&&n.length===0?t.push([[],[],[a]]):a.type===pt.INSERT&&n.length>0?i.push(a):a.type===pt.DELETE&&n.push(a)}return(n.length||i.length)&&(t.push([[],n,i]),n=[],i=[]),t}applyRematchMatching(e,t,n){let i=e.length*t.length,s=_p(e.concat(t).map(o=>o.content.length));return i<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(e,t):[[e,t]]}processChangedLines(e,t,n,i){let s={right:"",left:""},a=Math.max(n.length,i.length);for(let o=0;o<a;o++){let l=n[o],c=i[o],u=l!==void 0&&c!==void 0?Cp(l.content,c.content,t,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:hr.DELETE_CHANGES}:Object.assign(Object.assign({},Yn(l.content,t)),{type:nc(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:hr.INSERT_CHANGES}:Object.assign(Object.assign({},Yn(c.content,t)),{type:nc(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,t,n){return{left:this.generateSingleLineHtml(e,t),right:this.generateSingleLineHtml(e,n)}}generateSingleLineHtml(e,t){if(t===void 0)return"";let n=this.hoganUtils.render(AR,"numbers",{oldNumber:t.oldNumber||"",newNumber:t.newNumber||""});return this.hoganUtils.render(lf,"line",{type:t.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:t.prefix===" "?"&nbsp;":t.prefix,content:t.content,lineNumber:n,line:t,file:e})}};m();var Ab=Object.assign(Object.assign({},fo),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),uf="generic",rG="side-by-side",nG="icon",iG="tag",ff=class{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Ab),t)}render(e){let t=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
`);return this.hoganUtils.render(uf,"wrapper",{colorScheme:ic(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(rG,"file-diff"),i=this.hoganUtils.template(uf,"file-path"),s=this.hoganUtils.template(nG,"file"),a=this.hoganUtils.template(iG,ac(e));return n.render({file:e,fileHtmlId:sc(e),diffs:t,filePath:i.render({fileDiffName:ho(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(uf,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:hr})}}generateFileHtml(e){let t=rc(tc(n=>Yn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,t).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Yn(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:hr.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:hr.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),i}).reduce((n,i)=>({left:n.left+i.left,right:n.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let t=[],n=[],i=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==pt.INSERT&&i.length||a.type===pt.CONTEXT&&n.length>0)&&(t.push([[],n,i]),n=[],i=[]),a.type===pt.CONTEXT?t.push([[a],[],[]]):a.type===pt.INSERT&&n.length===0?t.push([[],[],[a]]):a.type===pt.INSERT&&n.length>0?i.push(a):a.type===pt.DELETE&&n.push(a)}return(n.length||i.length)&&(t.push([[],n,i]),n=[],i=[]),t}applyRematchMatching(e,t,n){let i=e.length*t.length,s=_p(e.concat(t).map(o=>o.content.length));return i<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(e,t):[[e,t]]}makeHeaderHtml(e,t){return this.hoganUtils.render(uf,"block-header",{CSSLineClass:hr,blockHeader:t!=null&&t.isTooBig?e:ga(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,t,n){let i={right:"",left:""},s=Math.max(t.length,n.length);for(let a=0;a<s;a++){let o=t[a],l=n[a],c=o!==void 0&&l!==void 0?Cp(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:hr.DELETE_CHANGES}:Object.assign(Object.assign({},Yn(o.content,e)),{type:nc(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:hr.INSERT_CHANGES}:Object.assign(Object.assign({},Yn(l.content,e)),{type:nc(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);i.left+=d,i.right+=h}return i}generateLineHtml(e,t){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(t)}}generateSingleHtml(e){let t="d2h-code-side-linenumber",n="d2h-code-side-line";return this.hoganUtils.render(uf,"line",{type:(e==null?void 0:e.type)||`${hr.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?t:`${t} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?n:`${n} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?"&nbsp;":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};m();var $b=Ke(Pb());m();var Ot=Ke(Pb()),Rt={};Rt["file-summary-line"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<li class="d2h-file-list-line">'),n.b(`
`+t),n.b(' <span class="d2h-file-name-wrapper">'),n.b(`
`+t),n.b(n.rp("<fileIcon0",r,e," ")),n.b(' <a href="#'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-name">'),n.b(n.v(n.f("fileName",r,e,0))),n.b("</a>"),n.b(`
`+t),n.b(' <span class="d2h-file-stats">'),n.b(`
`+t),n.b(' <span class="d2h-lines-added">'),n.b(n.v(n.f("addedLines",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(' <span class="d2h-lines-deleted">'),n.b(n.v(n.f("deletedLines",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(" </span>"),n.b(`
`+t),n.b(" </span>"),n.b(`
`+t),n.b("</li>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});Rt["file-summary-wrapper"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="d2h-file-list-wrapper '),n.b(n.v(n.f("colorScheme",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-list-header">'),n.b(`
`+t),n.b(' <span class="d2h-file-list-title">Files changed ('),n.b(n.v(n.f("filesNumber",r,e,0))),n.b(")</span>"),n.b(`
`+t),n.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),n.b(`
`+t),n.b(' <a class="d2h-file-switch d2h-show">show</a>'),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <ol class="d2h-file-list">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("files",r,e,0))),n.b(`
`+t),n.b(" </ol>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Rt["generic-block-header"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("lineClass",r,e,0))),n.b(" "),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('"></td>'),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.s(n.f("blockHeader",r,e,1),r,e,0,156,173,"{{ }}")&&(n.rs(r,e,function(i,s,a){a.b(a.t(a.f("blockHeader",i,s,0)))}),r.pop()),n.s(n.f("blockHeader",r,e,1),r,e,1,0,0,"")||n.b("&nbsp;"),n.b("</div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Rt["generic-empty-diff"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" File without changes"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Rt["generic-file-path"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-file-name-wrapper">'),n.b(`
`+t),n.b(n.rp("<fileIcon0",r,e," ")),n.b(' <span class="d2h-file-name">'),n.b(n.v(n.f("fileDiffName",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(n.rp("<fileTag1",r,e," ")),n.b("</span>"),n.b(`
`+t),n.b('<label class="d2h-file-collapse">'),n.b(`
`+t),n.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),n.b(`
`+t),n.b(" Viewed"),n.b(`
`+t),n.b("</label>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});Rt["generic-line"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("lineClass",r,e,0))),n.b(" "),n.b(n.v(n.f("type",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("lineNumber",r,e,0))),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("type",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.b(`
`+t),n.s(n.f("prefix",r,e,1),r,e,0,162,238,"{{ }}")&&(n.rs(r,e,function(i,s,a){a.b(' <span class="d2h-code-line-prefix">'),a.b(a.t(a.f("prefix",i,s,0))),a.b("</span>"),a.b(`
`+t)}),r.pop()),n.s(n.f("prefix",r,e,1),r,e,1,0,0,"")||(n.b(' <span class="d2h-code-line-prefix">&nbsp;</span>'),n.b(`
`+t)),n.s(n.f("content",r,e,1),r,e,0,371,445,"{{ }}")&&(n.rs(r,e,function(i,s,a){a.b(' <span class="d2h-code-line-ctn">'),a.b(a.t(a.f("content",i,s,0))),a.b("</span>"),a.b(`
`+t)}),r.pop()),n.s(n.f("content",r,e,1),r,e,1,0,0,"")||(n.b(' <span class="d2h-code-line-ctn"><br></span>'),n.b(`
`+t)),n.b(" </div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Rt["generic-wrapper"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="d2h-wrapper '),n.b(n.v(n.f("colorScheme",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("content",r,e,0))),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Rt["icon-file-added"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),n.b(`
`+t),n.b(' width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Rt["icon-file-changed"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Rt["icon-file-deleted"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Rt["icon-file-renamed"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Rt["icon-file"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Rt["line-by-line-file-diff"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-header">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("filePath",r,e,0))),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-file-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("diffs",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Rt["line-by-line-numbers"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="line-num1">'),n.b(n.v(n.f("oldNumber",r,e,0))),n.b("</div>"),n.b(`
`+t),n.b('<div class="line-num2">'),n.b(n.v(n.f("newNumber",r,e,0))),n.b("</div>"),n.fl()},partials:{},subs:{}});Rt["side-by-side-file-diff"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-header">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("filePath",r,e,0))),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-files-diff">'),n.b(`
`+t),n.b(' <div class="d2h-file-side-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.d("diffs.left",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-file-side-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.d("diffs.right",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Rt["tag-file-added"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),n.fl()},partials:{},subs:{}});Rt["tag-file-changed"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),n.fl()},partials:{},subs:{}});Rt["tag-file-deleted"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),n.fl()},partials:{},subs:{}});Rt["tag-file-renamed"]=new Ot.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),n.fl()},partials:{},subs:{}});var df=class{constructor({compiledTemplates:e={},rawTemplates:t={}}){let n=Object.entries(t).reduce((i,[s,a])=>{let o=$b.compile(a,{asString:!1});return Object.assign(Object.assign({},i),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Rt),e),n)}static compile(e){return $b.compile(e,{asString:!1})}render(e,t,n,i,s){let a=this.templateKey(e,t);try{return this.preCompiledTemplates[a].render(n,i,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,t){return this.preCompiledTemplates[this.templateKey(e,t)]}templateKey(e,t){return`${e}-${t}`}};var aG=Object.assign(Object.assign(Object.assign({},Cb),Ab),{outputFormat:hR.LINE_BY_LINE,drawFileList:!0});function Rp(r,e={}){let t=Object.assign(Object.assign({},aG),e),n=typeof r=="string"?_R(r,t):r,i=new df(t),{colorScheme:s}=t,a={colorScheme:s},o=t.drawFileList?new Ap(i,a).render(n):"",l=t.outputFormat==="side-by-side"?new ff(i,t).render(n):new cf(i,t).render(n);return o+l}var OR=Ke(FR(),1);var po=require("obsidian"),Ib=hf.StateEffect.define();function wa(r,e){let t=r.state,n=t.field($p),i=t.field(Xr),s=t.doc.lineAt(e!=null?e:t.selection.main.head).number,a=nr.findHunk(s,i==null?void 0:i.hunks)[0];if(!a)return;let o=t.doc.line(Math.max(1,a.added.start)).from,l=n.has(o);return t.field(po.editorEditorField).dispatch({effects:Ib.of({pos:o,add:!l})})}var $p=hf.StateField.define({create:()=>new Set,update(r,e){let t=new Set;for(let n of e.effects)n.is(Ib)&&(n.value.add?r.add(n.value.pos):r.delete(n.value.pos));for(let n of r)t.add(e.changes.mapPos(n));return t}}),DR=hf.StateField.define({create:r=>MR(r),update(r,e){return e.docChanged||e.effects.some(t=>t.is(Ql)||t.is(Ib))?MR(e.state):r},provide:r=>Pp.showTooltip.computeN([r],e=>e.field(r))}),LR=Pp.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 MR(r){let e=r.field(Xr);return e?[...r.field($p)].map(n=>{let i=r.doc.lineAt(n),s=nr.findHunk(i.number,e.hunks)[0];if(s)return{pos:n,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>oG(s,r,n)}}).filter(n=>n!==void 0):[]}function oG(r,e,t){var g,w;let n=nr.createPatch("file",[r],"10064",!1).join(`
`)+`
`,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
`,i=Rp(n,{colorScheme:OR.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(i,"text/html").querySelector(".d2h-file-diff"),a=createDiv();a.addClass("tooltip-toolbar");let o=(b,y)=>{let k=createDiv();return(0,po.setIcon)(k,b),k.setAttr("aria-label",y),k.addClass("clickable-icon"),k},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(po.editorEditorField);l.onclick=()=>{wa(d,t)},c.onclick=()=>{let b=At.plugin;b&&(b.promiseQueue.addTask(()=>b.hunkActions.stageHunk(t)),wa(d,t))},u.onclick=()=>{let b=At.plugin;b&&(b.hunkActions.resetHunk(t),wa(d,t))};let h=(w=(g=At.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(po.MarkdownView))==null?void 0:w.scope,p=h==null?void 0:h.register(null,"Escape",(b,y)=>{wa(d,t)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:b=>{t=b.changes.mapPos(t)}}}function NR(r){let e=r.app;r.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let t=r.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(t)||await e.vault.adapter.write(t,"");let n=await e.vault.adapter.read(t),s=await new up(e,n).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(t,s),await r.refresh())}}),r.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let t=e.workspace.getLeavesOfType(fr.type),n;t.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:fr.type})):n=t.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),r.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let t=e.workspace.getLeavesOfType(jn.type),n;t.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:jn.type})):n=t.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),r.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:t=>{let n=e.workspace.getActiveFile();if(t)return n!==null;{let i=r.gitManager.getRelativeRepoPath(n.path,!0);return r.tools.openDiff({aFile:i,aRef:""}),!0}}}),r.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(t,{file:n})=>{if(n)return S2(t,n,r.gitManager)}}),r.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(t,{file:n})=>{if(n)return k2(n,r.gitManager)}}),r.addCommand({id:"pull",name:"Pull",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.pullChangesFromRemote())}),r.addCommand({id:"fetch",name:"Fetch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.fetch())}),r.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.switchRemoteBranch())}),r.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:t=>{let n=e.workspace.getActiveFile();return t?n!==null:(r.promiseQueue.addTask(()=>r.gitActions.addFileToGitignore(n.path,n instanceof pf.TFolder)),!0)}}),r.addCommand({id:"push",name:"Commit-and-sync",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commitAndSync({fromAutoBackup:!1}))}),r.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>r.promiseQueue.addTask(async()=>{await r.gitActions.commitAndSync({fromAutoBackup:!1}),window.close()})}),r.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),r.addCommand({id:"commit",name:"Commit all changes",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,mode:"all"}))}),r.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"all"}))}),r.addCommand({id:"commit-smart",name:"Commit",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!1,mode:"smart"}))}),r.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!1,mode:"staged"}))}),r.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged",amend:!0}))}),r.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"smart"}))}),r.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCusto 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(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
Please remove them or add to .gitignore.`),!0}return!1}openDiff({aFile:e,bFile:t,aRef:n,bRef:i,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Fp.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:t!=null?t:e,aRef:n,bRef:i};a=="split"?(l=bn(this.plugin.app,s))==null||l.setViewState({type:oa.type,active:!0,state:o}):a=="git_unified"&&((c=bn(this.plugin.app,s))==null||c.setViewState({type:la.type,active:!0,state:o}))}async openFileAtCommit(e,t){let n={file:e,ref:t};await this.plugin.app.workspace.getLeaf("tab").setViewState({type:aa.type,active:!0,state:n})}async runRawCommand(){if(!(this.plugin.gitManager instanceof Me))return;let t=await new ft(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();t!==void 0&&this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.runRawCommand(t))}};m();var Mp=require("obsidian");var mo=class extends Mp.ItemView{constructor(t,n){super(t);this.plugin=n;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 la.type}getDisplayText(){var t;if(((t=this.state)==null?void 0:t.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return la.name}getIcon(){return la.icon}async setState(t,n){this.state=t,Mp.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 t;if((t=this.state)!=null&&t.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let n=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!n){if(this.plugin.gitManager instanceof Me&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
`);else if(await this.app.vault.adapter.exists(i)){let s=await this.app.vault.adapter.read(i);n=[...`--- /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(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
`)}}if(n){let s=this.parser.parseFromString(Rp(n),"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 Es=require("obsidian");var lc=require("@codemirror/commands");var Dp=require("@codemirror/search"),oc=require("@codemirror/state"),pi=require("@codemirror/view");m();var Op=require("obsidian"),Fb=require("@codemirror/view");function lG(r){return r.selection.ranges.filter(e=>!e.empty).map(e=>r.sliceDoc(e.from,e.to)).join(r.lineBreak)}function cG(r){r.dispatch({...r.state.replaceSelection(""),userEvent:"delete.cut"})}function BR(r,e){r.dispatch({...r.state.replaceSelection(e),scrollIntoView:!0,userEvent:"input.paste"})}async function UR(r){if(!r&&navigator.clipboard.read){let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes("text/html")){let n=await(await t.getType("text/html")).text();return(0,Op.htmlToMarkdown)(n)}}return navigator.clipboard.readText()}var HR=Fb.EditorView.domEventHandlers({contextmenu(r,e){r.preventDefault();let t=lG(e.state),n=!e.state.readOnly&&e.state.facet(Fb.EditorView.editable),i=Op.Menu.forEvent(r);return i.addItem(s=>s.setTitle("Cut").setIcon("scissors").setDisabled(!n||t.length===0).onClick(async()=>{await navigator.clipboard.writeText(t),cG(e)})),i.addItem(s=>s.setTitle("Copy").setIcon("copy").setDisabled(t.length===0).onClick(()=>navigator.clipboard.writeText(t))),i.addItem(s=>s.setTitle("Paste").setIcon("clipboard-paste").setDisabled(!n).onClick(async()=>BR(e,await UR(!1)))),i.addItem(s=>s.setTitle("Paste as plain text").setIcon("clipboard-type").setDisabled(!n).onClick(async()=>BR(e,await UR(!0)))),i.addItem(s=>s.setTitle("Select all").setIcon("scan").onClick(()=>e.dispatch({selection:{anchor:0,head:e.state.doc.length}}))),i.showAtMouseEvent(r),!0}});var GR=pi.EditorView.theme({"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),uG=10;function fG(r,e){let t=Number.isInteger(r)&&r>0?r:Yr.diffTimeout;return e?t:t*uG}var go=class extends Es.ItemView{constructor(t,n){super(t);this.plugin=n;this.refreshing=!1;this.indexUnmerged=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{!this.mergeView||this.indexUnmerged?this.createMergeView().catch(console.error):this.updateRefEditors().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",i=>{this.isWorkingTreeBFile(i.path)&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",i=>{this.isWorkingTreeBFile(i.path)&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",i=>{this.isWorkingTreeBFile(i.path)&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(i,s)=>{(this.isWorkingTreeBFile(i.path)||this.isWorkingTreeBFile(s))&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,Es.debounce)(i=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),i).catch(a=>this.plugin.displayError(a)))},1e3,!1)}isWorkingTreeBFile(t){var n;return((n=this.state)==null?void 0:n.bFile)==null||this.state.bRef!=null||!this.plugin.gitManager?!1:t===this.plugin.gitManager.getRelativeVaultPath(this.state.bFile)}getViewType(){return oa.type}getDisplayText(){var t;if(((t=this.state)==null?void 0:t.bFile)!=null){let n=this.state.bFile.split("/").last();n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3));let i;return this.state.bRef==null?i=" (Working Tree)":this.state.bRef==""?i=" (Index)":i="("+this.state.bRef.substring(0,7)+")",`Diff: ${n} ${i}`}return oa.name}getIcon(){return oa.icon}async setState(t,n){this.state=t,Es.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(t,n),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(t,n){try{return await this.plugin.gitManager.show(t,n,!1)}catch(i){if(i instanceof dr){if(t===""&&i.message.includes("is in the index, but not at stage 0")){this.indexUnmerged=!0;try{return await this.plugin.gitManager.show(":2",n,!1)}catch(s){if(s instanceof dr&&s.message.includes("is in the index, but not at stage 2"))return"";throw s}}if(i.message.includes("does not exist")||i.message.includes("unknown revision or path")||i.message.includes("exists on disk, but not in")||i.message.includes("fatal: Line truncated
`)+`
`;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 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 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 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 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 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 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 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 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 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 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 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`,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`,Rn,$n):console.warn("https://svelte.dev/e/await_waterfall")}function KP(){O?console.warn(`%c[svelte] derived_inert
`;await this.plugin.gitManager.applyPatch(h),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let s=n.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,Es.setIcon)(s,"undo"),s.onmousedown=a=>{var d;let o=this.mergeView.a,l=this.mergeView.b,c=cb(l.state),u=(d=n.parentElement)==null?void 0:d.indexOf(n),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,g=f.fromB,w=f.toB,b=o.state.sliceDoc(h,Math.max(h,p-1));h!=p&&w<=l.state.doc.length&&(b+=o.state.lineBreak),l.dispatch({changes:{from:g,to:Math.min(l.state.doc.length,w),insert:b},userEvent:"revert"})}}}return n.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},n}async createMergeView(){var t,n,i;if((t=this.state)!=null&&t.aFile&&((n=this.state)!=null&&n.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0;try{(i=this.mergeView)==null||i.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable(),this.indexUnmerged=!1;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,pi.lineNumbers)(),(0,Dp.highlightSelectionMatches)(),(0,pi.drawSelection)(),pi.keymap.of([...lc.standardKeymap,lc.indentWithTab]),(0,lc.history)(),(0,Dp.search)(),pi.EditorView.lineWrapping,HR],c=pi.ViewPlugin.define(p=>({update:g=>{if(g.docChanged&&!g.transactions.some(w=>w.annotation(oc.Transaction.remote))){let w=p.state.doc.toString();this.fileSaveDebouncer(w)}}})),u={doc:a,extensions:[...l,oc.EditorState.readOnly.of(!0),GR]},f=[...l];this.bIsEditable?f.push(c):f.push(oc.EditorState.readOnly.of(!0),GR);let d={doc:o,extensions:f};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let h=this.plugin.gitManager instanceof Me&&!this.indexUnmerged&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new vp({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:fG(this.plugin.settings.diffTimeout,this.bIsEditable)},parent:s})}finally{this.refreshing=!1}}}};m();var P$=require("obsidian");m();m();m();var jR,zR,VR;typeof window!="undefined"&&((VR=(zR=(jR=window.__svelte)!=null?jR:window.__svelte={}).v)!=null?VR:zR.v=new Set).add("5");m();m();m();var Ss={};var et=Symbol("uninitialized"),Kn=Symbol("filename");var Lp="http://www.w3.org/1999/xhtml";m();m();m();m();var Np=!0;m();var M=!1;m();var ks=Array.isArray,WR=Array.prototype.indexOf,va=Array.prototype.includes,cc=Array.from,Mb=Object.keys,ir=Object.defineProperty,Qr=Object.getOwnPropertyDescriptor,Ob=Object.getOwnPropertyDescriptors,Db=Object.prototype,qR=Array.prototype,uc=Object.getPrototypeOf,Lb=Object.isExtensible;function Nb(r){return typeof r=="function"}var _r=()=>{};function Bp(r){for(var e=0;e<r.length;e++)r[e]()}function Up(){var r,e,t=new Promise((n,i)=>{r=n,e=i});return{promise:t,resolve:r,reject:e}}m();m();var Ir=Symbol("$state"),Hp=Symbol("component"),gf=Symbol("legacy props"),ZR=Symbol(""),Gp=Symbol("proxy path"),jp=Symbol("attributes"),wf=Symbol("class"),Bb=Symbol("style"),vf=Symbol("text"),wo=Symbol("form reset"),Ub=Symbol("hmr anchor"),Cs=new class extends Error{constructor(){super(...arguments);Ve(this,"name","StaleReactionError");Ve(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},YR,Hb=!!((YR=globalThis.document)!=null&&YR.contentType)&&globalThis.document.contentType.includes("xml");var fc=3,Xn=8;m();m();m();m();var As="font-weight: bold",Ts="font-weight: normal";function KR(r){M?console.warn(`%c[svelte] await_reactivity_loss
%cDetected reactivity loss when reading \`${r}\`. This happens when state is read in an async function after an earlier \`await\`
https://svelte.dev/e/await_reactivity_loss`,As,Ts):console.warn("https://svelte.dev/e/await_reactivity_loss")}function XR(r,e){M?console.warn(`%c[svelte] await_waterfall
%cAn async derived, \`${r}\` (${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`,As,Ts):console.warn("https://svelte.dev/e/await_waterfall")}function QR(){M?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`,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`,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`,Rn,$n):console.warn("https://svelte.dev/e/hydration_mismatch")}function QP(){O?console.warn(`%c[svelte] lifecycle_double_unmount
https://svelte.dev/e/derived_inert`,As,Ts):console.warn("https://svelte.dev/e/derived_inert")}function JR(r,e,t){M?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${r}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${t}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,As,Ts):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function vo(r){M?console.warn(`%c[svelte] hydration_mismatch
%c${r?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${r}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,As,Ts):console.warn("https://svelte.dev/e/hydration_mismatch")}function eP(){M?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
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`,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`,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`,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[Fi].split("/").pop()}`,s=s.p;return{message:t.message+`
${n}
`,stack:(l=t.stack)==null?void 0:l.split(`
https://svelte.dev/e/lifecycle_double_unmount`,As,Ts):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function zp(r){M?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${r}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,As,Ts):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function tP(){M?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",As,Ts):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function rP(r){M?console.warn(`%c[svelte] transition_slide_display
%cThe \`slide\` transition does not work correctly for elements with \`display: ${r}\`
https://svelte.dev/e/transition_slide_display`,As,Ts):console.warn("https://svelte.dev/e/transition_slide_display")}var re=!1;function jt(r){re=r}var pe;function Qe(r){if(r===null)throw vo(),Ss;return pe=r}function xr(){return Qe(pr(pe))}function G(r){if(re){if(pr(pe)!==null)throw vo(),Ss;pe=r}}function bo(r=1){if(re){for(var e=r,t=pe;e--;)t=pr(t);pe=t}}function qi(r=!0){for(var e=0,t=pe;;){if(t.nodeType===Xn){var n=t.data;if(n==="]"){if(e===0)return t;e-=1}else(n==="["||n==="[!"||n[0]==="["&&!isNaN(Number(n.slice(1))))&&(e+=1)}var i=pr(t);r&&t.remove(),t=i}}function yf(r){if(!r||r.nodeType!==Xn)throw vo(),Ss;return r.data}m();m();m();m();function Vp(r){return r===this.v}function Gb(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function Wp(r){return!Gb(r,this.v)}m();m();function nP(r){if(M){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: "${r}"
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function qp(r){if(M){let e=new Error(`lifecycle_outside_component
\`${r}(...)\` 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 sP(){if(M){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function jb(){if(M){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function aP(){if(M){let r=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/derived_references_self")}function zb(r,e,t){if(M){let n=new Error(`each_key_duplicate
${t?`Keyed each block has duplicate key \`${t}\` at indexes ${r} and ${e}`:`Keyed each block has duplicate key at indexes ${r} and ${e}`}
https://svelte.dev/e/each_key_duplicate`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function oP(r,e,t){if(M){let n=new Error(`each_key_volatile
Keyed each block has key that is not idempotent \u2014 the key for item at index ${r} was \`${e}\` but is now \`${t}\`. Keys must be the same each time for a given item
https://svelte.dev/e/each_key_volatile`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_volatile")}function lP(r){if(M){let e=new Error(`effect_in_teardown
\`${r}\` 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 cP(){if(M){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function uP(r){if(M){let e=new Error(`effect_orphan
\`${r}\` 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 fP(){if(M){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function dP(){if(M){let r=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/hydration_failed")}function hP(r){if(M){let e=new Error(`props_invalid_value
Cannot do \`bind:${r}={undefined}\` when \`${r}\` 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 pP(r){if(M){let e=new Error(`rune_outside_svelte
The \`${r}\` 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 mP(){if(M){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function gP(){if(M){let r=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function wP(){if(M){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function vP(){if(M){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();var zt=!1,Rs=!1,mi=!1;m();m();m();var _f=null;function Er(r,e){return r.label=e,Zp(r.v,e),r}function Zp(r,e){var t;return(t=r==null?void 0:r[Gp])==null||t.call(r,e),r}m();function gi(r){let e=new Error,t=hG();return t.length===0?null:(t.unshift(`
`),ir(e,"stack",{value:t.join(`
`)}),ir(e,"name",{value:r}),e)}function hG(){let r=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=r,!e)return[];let t=e.split(`
`),n=[];for(let i=0;i<t.length;i++){let s=t[i],a=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];a.includes("svelte/src/internal")||a.includes("node_modules/.vite")||n.push(s)}}return n}function yP(r,e){if(!M)throw new Error("invariant(...) was not guarded by if (DEV)");r||nP(e)}m();m();var Ee=null;function Ps(r){Ee=r}var Yi=null;function pc(r){Yi=r}var wi=null;function Kp(r){wi=r}function lt(r,e=!1,t){Ee={p:Ee,i:!1,c:null,e:null,s:r,x:null,r:X,l:Rs&&!e?{s:null,u:null,$:[]}:null},M&&(Ee.function=t,wi=t)}function ct(r){var i;var e=Ee,t=e.e;if(t!==null){e.e=null;for(var n of t)Vb(n)}return r!==void 0&&(e.x=r),e.i=!0,Ee=e.p,M&&(wi=(i=Ee==null?void 0:Ee.function)!=null?i:null),xf(r)}function xf(r={}){return ir(r,Hp,{value:!0}),r}function Zi(){return!Rs||Ee!==null&&Ee.l===null}m();m();var yo=[];function _P(){var r=yo;yo=[],Bp(r)}function Pt(r){if(yo.length===0&&!_o){var e=yo;queueMicrotask(()=>{e===yo&&_P()})}yo.push(r)}function xP(){for(;yo.length>0;)_P()}m();m();var pG=-7169;function qe(r,e){r.f=r.f&pG|e}function mc(r){(r.f&512)!==0||r.deps===null?qe(r,1024):qe(r,4096)}function Xp(r,e,t){(r.f&2048)!==0?e.add(r):(r.f&4096)!==0&&t.add(r),qe(r,1024)}m();m();m();m();function Wb(r){re&&or(r)!==null&&wc(r)}var EP=!1;function qb(){EP||(EP=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{var e;if(!r.defaultPrevented)for(let t of r.target.elements)(e=t[wo])==null||e.call(t)})},{capture:!0}))}function tn(r){var e=oe,t=X;Wt(null),qt(null);try{return r()}finally{Wt(e),qt(t)}}function Yb(r,e,t,n=t){r.addEventListener(e,()=>tn(t));let i=r[wo];i?r[wo]=()=>{i(),n(!0)}:r[wo]=()=>n(!0),qb()}m();function Qp(r,e,t,n){let i=Zi()?ya:Eo;var s=r.filter(h=>!h.settled),a=e.map(i);if(M&&a.forEach((h,p)=>{h.label=e[p].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(g,w)=>w)}),t.length===0&&s.length===0){n(a);return}var o=X,l=SP(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(h=>h.promise)):null;function u(h){if((o.f&16384)===0){l();try{n([...a,...h])}catch(p){rn(p,o)}vc()}}var f=Zb();if(t.length===0){c.then(()=>u([])).finally(f);return}function d(){Promise.all(t.map(h=>Xb(h))).then(u).catch(h=>rn(h,o)).finally(f)}c?c.then(()=>{l(),d(),vc()}):d()}function SP(){var r=X,e=oe,t=Ee,n=ie;if(M)var i=Yi;return function(a=!0){qt(r),Wt(e),Ps(t),a&&(r.f&16384)===0&&(n==null||n.activate(),n==null||n.apply()),M&&(Kb(null),pc(i))}}var mG=!1;function vc(r=!0){var e;mG=!1,qt(null),Wt(null),Ps(null),r&&((e=ie)==null||e.deactivate()),M&&(Kb(null),pc(null))}function Zb(){var r=X,e=r.b,t=ie,n=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,t),t.increment(n,r),()=>{e==null||e.update_pending_count(-1,t),t.decrement(n,r)}}var nn=null;function Kb(r){nn=r}var Sf=new Set;function ya(r){var e=2050;X!==null&&(X.f|=524288);let t={ctx:Ee,deps:null,effects:null,equals:Vp,f:e,fn:r,reactions:null,rv:0,v:et,wv:0,parent:X,ac:null};return M&&mi&&(t.created=gi("created at")),t}var bc=Symbol("obsolete");function Xb(r,e,t){let n=X;n===null&&sP();var i=void 0,s=Sr(et);M&&(s.label=e!=null?e:r.toString());var a=!oe,o=new Set;return AP(()=>{var h,p;var l=X;M&&(nn={effect:l,effect_deps:new Set,warned:!1});var c=Up();i=c.promise;try{Promise.resolve(r()).then(c.resolve,g=>{g!==Cs&&c.reject(g)}).finally(vc)}catch(g){c.reject(g),vc()}if(M){if(nn){if(l.deps!==null)for(let g=0;g<Mr;g+=1)nn.effect_deps.add(l.deps[g]);if(lr!==null)for(let g=0;g<lr.length;g+=1)nn.effect_deps.add(lr[g])}nn=null}var u=ie;if(a){if((l.f&32768)!==0)var f=Zb();if((h=n.b)!=null&&h.is_rendered())(p=u.async_deriveds.get(l))==null||p.reject(bc);else for(let g of o.values())g.reject(bc);o.add(c),u.async_deriveds.set(l,c)}let d=(g,w=void 0)=>{M&&(nn=null),f==null||f(),o.delete(c),w!==bc&&(u.activate(),w?(s.f|=8388608,bi(s,w)):((s.f&8388608)!==0&&(s.f^=8388608),M&&t!==void 0&&!s.equals(g)&&(Sf.add(s),setTimeout(()=>{Sf.has(s)&&(l.f&16384)===0&&(XR(s.label,t),Sf.delete(s))})),bi(s,g)),u.deactivate())};c.promise.then(d,g=>d(null,g||"unknown"))}),wr(()=>{for(let l of o)l.reject(bc)}),M&&(s.f|=4194304),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function Pe(r){let e=ya(r);return zt||tm(e),e}function Eo(r){let e=ya(r);return e.equals=Wp,e}function kP(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)xt(e[t])}}var Qb=[];function kf(r){var e,t=X,n=r.parent;if(!Sn&&n!==null&&r.v!==et&&(n.f&24576)!==0)return QR(),r.v;if(qt(n),M){let i=So;Jp(new Set);try{va.call(Qb,r)&&aP(),Qb.push(r),kP(r),e=em(r)}finally{qt(t),Jp(i),Qb.pop()}}else try{kP(r),e=em(r)}finally{qt(t)}return e}function Jb(r){var t,n,i;var e=kf(r);if(!r.equals(e)&&(r.wv=yc(),(!((t=ie)!=null&&t.is_fork)||r.deps===null)&&(ie!==null?(ie.capture(r,e,!0),(n=Fs)==null||n.capture(r,e,!0)):r.v=e,r.deps===null))){qe(r,1024);return}Sn||(Lt!==null?(ba()||(i=ie)!=null&&i.is_fork)&&Lt.set(r,e):mc(r))}function CP(r){var e;if(r.effects!==null)for(let t of r.effects)(t.tea Line truncated
${n}in ${((a=e.fn)==null?void 0:a.name)||"<unknown>"}`,s=e.ctx;s!==null;)i+=`
${n}in ${(o=s.function)==null?void 0:o[Kn].split("/").pop()}`,s=s.p;return{message:r.message+`
${i}
`,stack:(l=r.stack)==null?void 0:l.split(`
`).filter(c=>!c.includes("svelte/src/internal")).join(`
`)}}}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=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(`
`)}}}function VP(r){let e=hy.get(r);e&&(ir(r,"message",{value:e.message}),ir(r,"stack",{value:e.stack}))}function qP(r){X===null&&(oe===null&&uP(r),cP()),Sn&&lP(r)}function CG(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Qi(r,e){var a,o;var t=X;if(M)for(;t!==null&&(t.f&131072)!==0;)t=t.parent;t!==null&&(t.f&8192)!==0&&(r|=8192);var n={ctx:Ee,deps:null,nodes:null,f:r|2048|512,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};M&&(n.component_function=wi),(a=ie)==null||a.register_created_effect(n);var i=n;if((r&4)!==0)Ec!==null?Ec.push(n):kn.ensure().schedule(n);else if(e!==null){try{Ki(n)}catch(l){throw xt(n),l}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&524288)===0&&(i=i.first,(r&16)!==0&&(r&65536)!==0&&i!==null&&(i.f|=65536))}if(i!==null&&(i.parent=t,t!==null&&CG(i,t),oe!==null&&(oe.f&2)!==0&&(r&64)===0)){var s=oe;((o=s.effects)!=null?o:s.effects=[]).push(i)}return n}function ba(){return oe!==null&&!Or}function wr(r){let e=Qi(8,null);return qe(e,1024),e.teardown=r,e}function Yt(r){var i;qP("$effect"),M&&ir(r,"name",{value:"$effect"});var e=X.f,t=!oe&&(e&32)!==0&&Ee!==null&&!Ee.i;if(t){var n=Ee;((i=n.e)!=null?i:n.e=[]).push(r)}else return Vb(r)}function Vb(r){return Qi(1048580,r)}function gy(r){kn.ensure();let e=Qi(524352,r);return()=>{xt(e)}}function YP(r){kn.ensure();let e=Qi(524352,r);return(t={})=>new Promise(n=>{t.outro?Ji(e,()=>{xt(e),n(void 0)}):(xt(e),n(void 0))})}function cn(r){return Qi(4,r)}function AP(r){return Qi(4718592,r)}function vr(r,e=0){return Qi(8|e,r)}function $e(r,e=[],t=[],n=[]){Qp(n,e,t,i=>{Qi(8,()=>{r(...i.map(T))})})}function Tn(r,e=0){var t=Qi(16|e,r);return M&&(t.dev_stack=Yi),t}function Zt(r){return Qi(524320,r)}function wy(r){var e=r.teardown;if(e!==null){let t=Sn,n=oe;py(!0),Wt(null);try{e.call(null)}catch(i){rn(i,r.parent)}finally{py(t),Wt(n)}}}function Cf(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){let i=t.ac;i!==null&&tn(()=>{i.abort(Cs)});var n=t.next;(t.f&64)!==0?t.parent=null:xt(t,e),t=n}}function ZP(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&32)===0&&xt(e),e=t}}function xt(r,e=!0){var t=!1;(e||(r.f&262144)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(KP(r.nodes.start,r.nodes.end),t=!0),r.f|=33554432,Cf(r,e&&!t),ko(r,0);var n=r.nodes&&r.nodes.t;if(n!==null)for(let s of n)s.stop();wy(r),r.f^=33554432,r.f|=16384;var i=r.parent;i!==null&&i.first!==null&&ly(r),M&&(r.component_function=null),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=r.b=null}function KP(r,e){for(;r!==null;){var t=r===e?null:pr(r);r.remove(),r=t}}function ly(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function Ji(r,e,t=!0){var n=[];r.f|=256,XP(r,n,!0);var i=()=>{t&&xt(r),e&&e()},s=n.length;if(s>0){var a=()=>--s||i();for(var o of n)o.out(a)}else i()}function XP(r,e,t){if((r.f&8192)===0){r.f^=8192;var n=r.nodes&&r.nodes.t;if(n!==null)for(let o of n)(o.is_global||t)&&e.push(o);for(var i=r.first;i!==null;){var s=i.next;if((i.f&64)===0){var a=(i.f&65536)!==0||(i.f&32)!==0&&(r.f&16)!==0;XP(i,e,a?t:!1)}i=s}}}function Pc(r){r.f&=-257,QP(r,!0)}function QP(r,e){if((r.f&256)===0&&(r.f&8192)!==0){r.f^=8192,(r.f&1024)===0&&(qe(r,2048),kn.ensure().schedule(r));for(var t=r.first;t!==null;){var n=t.next,i=(t.f&65536)!==0||(t.f&32)!==0;QP(t,i?e:!1),t=n}var s=r.nodes&&r.nodes.t;if(s!==null)for(let a of s)(a.is_global||e)&&a.in()}}function $c(r,e){if(r.nodes)for(var t=r.nodes.start,n=r.nodes.end;t!==null;){var i=t===n?null:pr(t);e.append(t),t=i}}m();var JP=null;var cm=!1,Sn=!1;function py(r){Sn=r}var oe=null,Or=!1;function Wt(r){oe=r}var X=null;function qt(r){X=r}var on=null;function tm(r){oe!==null&&(!zt&&(oe.f&2097152)!==0||(oe.f&2)!==0)&&(on!=null?on:on=new Set).add(r)}var lr=null,Mr=0,Cn=null;function BP(r){Cn=r}var t$=1,Fo=0,Ea=Fo;function fy(r){Ea=r}function yc(){return++t$}function xa(r){var e=r.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var t=r.deps,n=t.length,i=0;i<n;i++){var s=t[i];if(xa(s)&&Jb(s),s.wv>r.wv)return!0}(e&512)!==0&&Lt===null&&qe(r,1024)}return!1}function r$(r,e,t=!0){var n=r.reactions;if(n!==null&&!(!zt&&on!==null&&on.has(r)))for(var i=0;i<n.length;i++){var s=n[i];(s.f&2)!==0?r$(s,e,!1):e===s&&(t?qe(s,2048):(s.f&1024)!==0&&qe(s,4096),$f(s))}}function em(r){var e=lr,t=Mr,n=Cn,i=oe,s=on,a=Ee,o=Or,l=Ea,c=r.f;lr=null,Mr=0,Cn=null,oe=(c&96)===0?r:null,on=null,Ps(r.ctx),Or=!1,Ea=++Fo,r.ac!==null&&(tn(()=>{r.ac.abort(Cs)}),r.ac=null);try{r.f|=2097152;var u=r.fn,f=u();r.f|=32768;var d=e$(r);if(Zi()&&Cn!==null&&!Or&&d!==null&&(r.f&6146)===0)for(var h=0;h<Cn.length;h++)r$(Cn[h],r);if(i!==null&&i!==r){if(Fo++,i.deps!==null)for(let p=0;p<t;p+=1)i.deps[p].rv=Fo;if(e!==null)for(let p of e)p.rv=Fo;Cn!==null&&(n===null?n=Cn:n.push(...Cn))}return(r.f&8388608)!==0&&(r.f^=8388608),f}catch(p){return e$(r),zP(p)}finally{r.f^=2097152,lr=e,Mr=t,Cn=n,oe=i,on=s,Ps(a),Or=o,Ea=l}}function e$(r){va Line truncated
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==Ss&&console.warn("Failed to hydrate: ",o),e.recover===!1&&dP(),am(),wc(t),jt(!1),ka(r,e)}finally{jt(n),Qe(i)}}var mm=new Map;function p$(r,{target:e,anchor:t,props:n={},events:i,context:s,intro:a=!0,transformError:o}){am();var l=void 0,c=YP(()=>{var u=t!=null?t:e.appendChild(Nt());Ry(u,{pending:()=>{}},h=>{lt({});var p=Ee;if(s&&(p.c=s),i&&(n.$$events=i),re&&xi(h,null),gm=a,l=r(h,n)||xf(),gm=!0,re&&(X.nodes.end=pe,pe===null||pe.nodeType!==Xn||pe.data!=="]"))throw vo(),Ss;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 w=l$(g);for(let k of[e,document]){var b=mm.get(k);b===void 0&&(b=new Map,mm.set(k,b));var y=b.get(g);y===void 0?(k.addEventListener(g,dm,{passive:w}),b.set(g,1)):b.set(g,y+1)}}}};return d(cc(yy)),fm.add(d),()=>{var w;for(var h of f)for(let b of[e,document]){var p=mm.get(b),g=p.get(h);--g==0?(b.removeEventListener(h,dm),p.delete(h),p.size===0&&mm.delete(b)):p.set(h,g)}fm.delete(d),u!==t&&((w=u.parentNode)==null||w.removeChild(u))}});return Py.set(l,c),l}var Py=new WeakMap;function Bs(r,e){let t=Py.get(r);return t?(Py.delete(r),t(e)):(M&&eP(),Promise.resolve())}m();m();m();var Ei,rs,In,Lo,Nf,Bf,wm,Us=class{constructor(e,t=!0){Ve(this,"anchor");de(this,Ei,new Map);de(this,rs,new Map);de(this,In,new Map);de(this,Lo,new Set);de(this,Nf,!0);de(this,Bf,e=>{if(I(this,Ei).has(e)){var t=I(this,Ei).get(e),n=I(this,rs).get(t);if(n)Pc(n),I(this,Lo).delete(t);else{var i=I(this,In).get(t);i&&(Pc(i.effect),I(this,rs).set(t,i.effect),I(this,In).delete(t),M&&(i.fragment.lastChild[Ub]=this.anchor),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(let[s,a]of I(this,Ei)){if(I(this,Ei).delete(s),s===e)break;let o=I(this,In).get(a);o&&(xt(o.effect),I(this,In).delete(a))}for(let[s,a]of I(this,rs)){if(s===t||I(this,Lo).has(s))continue;let o=()=>{if(Array.from(I(this,Ei).values()).includes(s)){var c=document.createDocumentFragment();$c(a,c),c.append(Nt()),I(this,In).set(s,{effect:a,fragment:c})}else xt(a);I(this,Lo).delete(s),I(this,rs).delete(s)};I(this,Nf)||!n?(I(this,Lo).add(s),Ji(a,o,!1)):o()}}});de(this,wm,e=>{I(this,Ei).delete(e);let t=Array.from(I(this,Ei).values());for(let[n,i]of I(this,In))t.includes(n)||(xt(i.effect),I(this,In).delete(n))});this.anchor=e,le(this,Nf,t)}ensure(e,t){var n=ie,i=om();if(t&&!I(this,rs).has(e)&&!I(this,In).has(e))if(i){var s=document.createDocumentFragment(),a=Nt();s.append(a),I(this,In).set(e,{effect:Zt(()=>t(a)),fragment:s})}else I(this,rs).set(e,Zt(()=>t(this.anchor)));if(I(this,Ei).set(n,e),i){for(let[o,l]of I(this,rs))o===e?n.unskip_effect(l):n.skip_effect(l);for(let[o,l]of I(this,In))o===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(I(this,Bf)),n.ondiscard(I(this,wm))}else re&&(this.anchor=pe),I(this,Bf).call(this,n)}};Ei=new WeakMap,rs=new WeakMap,In=new WeakMap,Lo=new WeakMap,Nf=new WeakMap,Bf=new WeakMap,wm=new WeakMap;if(M){let r=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void 0)return t;pP(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}function No(r){Ee===null&&qp("onMount"),Rs&&Ee.l!==null?BG(Ee).m.push(r):Yt(()=>{let e=tt(r);if(typeof e=="function")return e})}function BG(r){var t;var e=r.l;return(t=e.u)!=null?t:e.u={a:[],b:[],m:[]}}m();m();var w$=new Map;function v$(r,e){var t=w$.get(r);t||(t=new Set,w$.set(r,t)),t.add(e)}m();m();m();m();m();m();m();m();m();function ve(r,e,t=!1){var n;re&&(n=pe,xr());var i=new Us(r),s=t?65536:0;function a(o,l){if(re){var c=yf(n);if(o!==parseInt(c.substring(1))){var u=qi();Qe(u),i.anchor=u,jt(!1),i.ensure(o,l),jt(!0);return}}i.ensure(o,l)}Tn(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();m();m();function fn(r,e){return e}function qG(r,e,t){var f;for(var n=[],i=e.length,s,a=e.length,o=0;o<i;o++){let d=e[o];Ji(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=r.outrogroups;Iy(r,cc(s.done)),h.delete(s),h.size===0&&(r.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=n.length===0&&t!==null&&r.pending.size===0;if(l){var c=t,u=c.parentNode;wc(u),u.append(c),r.items.clear()}Iy(r,e,!l)}else s={pending:new Set(e),done:new Set},((f=r.outrogroups)!=null?f:r.outrogroups=new Set).add(s)}function Iy(r,e,t=!0){var n;if(r.pending.size>0){n=new Set;for(let a of r.pending.values())for(let o of a)n.add(r.items.get(o).e)}for(var i=0;i<e.length;i++){var s=e[i];if(n!=null&&n.has(s)){s.f|=33554432;let a=document.createDocumentFragment();$c(s,a)}else xt(e[i],t)}}var Ca;function dn(r,e,t,n,i,s=null){var a=r,o=new Map,l=(e&4)!==0;if(l){var c=r;a=re?Qe(or(c)):c.appendChild(Nt())}re&&xr();var u=null,f=Eo(()=>{var k=t();return ks(k)?k:k==null?[]:cc(k)});M&&Er(f,"{#each ...}");var d,h=new Map,p=!0;function g(k){(y.effect.f&16384)===0&&(y.pending.delete(k),y.fallback=u,YG(y,d,a,e,n),u!==null&&(d.length===0?(u.f&33554432)===0?Pc(u):(u.f^=33554432,Hf(u,nu Line truncated
\r\f\xA0\v\uFEFF`];function k$(r,e,t){var n=r==null?"":""+r;if(e&&(n=n?n+" "+e:e),t){for(var i of Object.keys(t))if(t[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,a=0;(a=n.indexOf(i,a))>=0;){var o=a+s;(a===0||S$.includes(n[a-1]))&&(o===n.length||S$.includes(n[o]))?n=(a===0?"":n.substring(0,a))+n.substring(o+1):a=o}}return n===""?null:n}m();function nt(r,e,t,n,i,s){var a=r[wf];if(re||a!==t||a===void 0){var o=k$(t,n,s);(!re||o!==r.getAttribute("class"))&&(o==null?r.removeAttribute("class"):e?r.className=o:r.setAttribute("class",o)),r[wf]=t}else if(s&&i!==s)for(var l in s){var c=!!s[l];(i==null||c!==!!i[l])&&r.classList.toggle(l,c)}return s}m();m();var dj=Symbol("is custom element"),hj=Symbol("is html"),pj=Hb?"link":"LINK";function fe(r,e,t,n){var i=mj(r);if(re&&(i[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName===pj)){n||wj(r,e,t!=null?t:"");return}i[e]!==(i[e]=t)&&(e==="loading"&&(r[ZR]=t),t==null?r.removeAttribute(e):typeof t!="string"&&gj(r).has(e)?r[e]=t:r.setAttribute(e,t))}function mj(r){var e,t;return(t=r[e=jp])!=null?t:r[e]={[dj]:r.nodeName.includes("-"),[hj]:r.namespaceURI===Lp}}var C$=new Map;function gj(r){var e=r.getAttribute("is")||r.nodeName,t=C$.get(e);if(t)return t;C$.set(e,t=new Set);for(var n,i=r,s=Element.prototype;s!==i;){n=Ob(i);for(var a in n)n[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&t.add(a);i=uc(i)}return t}function wj(r,e,t){var n;M&&(e==="srcset"&&vj(r,t)||My((n=r.getAttribute(e))!=null?n:"",t)||JR(e,r.outerHTML.replace(r.innerHTML,r.innerHTML&&"..."),String(t)))}function My(r,e){return r===e?!0:new URL(r,document.baseURI).href===new URL(e,document.baseURI).href}function A$(r){return r.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function vj(r,e){var t=A$(r.srcset),n=A$(e);return n.length===t.length&&n.every(([i,s],a)=>s===t[a][1]&&(My(t[a][0],i)||My(i,t[a][0])))}m();m();m();function Ly(r,e,t=e){var n=new WeakSet;Yb(r,"input",async i=>{M&&r.type==="checkbox"&&jb();var s=i?r.defaultValue:r.value;if(s=Oy(r)?Dy(s):s,t(s),ie!==null&&n.add(ie),await um(),s!==(s=e())){var a=r.selectionStart,o=r.selectionEnd,l=r.value.length;if(r.value=s!=null?s:"",o!==null){var c=r.value.length;a===o&&o===l&&c>l?(r.selectionStart=c,r.selectionEnd=c):(r.selectionStart=a,r.selectionEnd=Math.min(o,c))}}}),(re&&r.defaultValue!==r.value||tt(e)==null&&r.value)&&(t(Oy(r)?Dy(r.value):r.value),ie!==null&&n.add(ie)),vr(()=>{M&&r.type==="checkbox"&&jb();var i=e();if(r===document.activeElement){var s=zt?Fs:ie;if(n.has(s))return}Oy(r)&&i===Dy(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i!=null?i:"")})}function Oy(r){var e=r.type;return e==="number"||e==="range"}function Dy(r){return r===""?null:+r}m();m();m();m();m();function Ny(r,e){return r===e||(r==null?void 0:r[Ir])===e}function ze(r=xf(),e,t,n){var i=Ee.r,s=X;return cn(()=>{var a,o;return vr(()=>{a=o,o=(n==null?void 0:n())||[],tt(()=>{Ny(t(...o),r)||(e(r,...o),a&&Ny(t(...a),r)&&e(null,...a))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&Ny(t(...o),r)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),r}m();m();m();m();m();m();m();m();m();var ym=!1;function Uy(r){var e=ym;try{return ym=!1,[r(),ym]}finally{ym=e}}function Mn(r,e,t,n){var C,S;var i=!Rs||(t&2)!==0,s=(t&8)!==0,a=(t&16)!==0,o=n,l=!0,c=void 0,u=()=>a&&i?(c!=null||(c=ya(n)),T(c)):(l&&(l=!1,o=a?tt(n):n),o);let f;if(s){var d=Ir in r||gf in r;f=(S=(C=Qr(r,e))==null?void 0:C.set)!=null?S:d&&e in r?A=>r[e]=A:void 0}var h,p=!1;s?[h,p]=Uy(()=>r[e]):h=r[e],h===void 0&&n!==void 0&&(h=u(),f&&(i&&hP(e),f(h)));var g;if(i?g=()=>{var A=r[e];return A===void 0?u():(l=!0,A)}:g=()=>{var A=r[e];return A!==void 0&&(o=void 0),A===void 0?o:A},i&&(t&4)===0)return g;if(f){var w=r.$$legacy;return(function(A,v){return arguments.length>0?((!i||!v||w||p)&&f(v?g():A),A):g()})}var b=!1,y=((t&1)!==0?ya:Eo)(()=>(b=!1,g()));M&&(y.label=e),s&&T(y);var k=X;return(function(A,v){if(arguments.length>0){let x=v?T(y):i&&s?Je(A):A;return q(y,x),b=!0,o!==void 0&&(o=x),A}return Sn&&b||(k.f&16384)!==0?y.v:T(y)})}m();m();m();function R$(r){return new Hy(r)}var Hs,ri,Hy=class{constructor(e){de(this,Hs);de(this,ri);var s,a;var t=new Map,n=(o,l)=>{var c=Po(l,!1,!1);return t.set(o,c),c};let i=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return T((c=t.get(l))!=null?c:n(l,Reflect.get(o,l)))},has(o,l){var c;return l===gf?!0:(T((c=t.get(l))!=null?c:n(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return q((u=t.get(l))!=null?u:n(l,c),c),Reflect.set(o,l,c)}});le(this,ri,(e.hydrate?$y:ka)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!zt&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&To(),le(this,Hs,i.$$events);for(let o of Object.keys(I(this,ri)))o==="$set"||o==="$destroy"||o==="$on"||ir(this,o,{get(){return I(this,ri)[o]},set(l){I(this,ri)[o]=l},enumerable:!0});I(this,ri).$set=o=>{ Line truncated
`:""}${(x=e.log.author)==null?void 0:x.name}
${(0,zy.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
${e.log.message}`}]),ne("click",u,()=>q(i,!T(i))),Y(r,o),ct()}Et(["click"]);var Kj=se('<div class="tree-item nav-folder mod-root"></div>'),Xj=se('<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>'),Qj={hash:"svelte-12n6twc",code:""};function qy(r,e){lt(e,!0),Fn(r,Qj);let t=Mn(e,"plugin",15),n=Se(!1),i=Je([]),s=Se(void 0),a=Se(Je(t().settings.treeStructure)),o;Yt(()=>{o&&o.empty()}),No(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>{c().catch(console.error)}))}),Yt(()=>{i.forEach(C=>(0,Wy.setIcon)(C,C.getAttr("data-icon")))}),No(()=>{let C=new IntersectionObserver(A=>{var v;(v=A[0])!=null&&v.isIntersecting&&!T(n)&&u().catch(console.error)}),S=activeDocument.querySelector("#sentinel");return S&&C.observe(S),()=>{C.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}async function c(){var A,v;if(!t().gitReady){q(s,void 0);return}q(n,!0);let C=t().gitManager instanceof Me,S;((v=(A=T(s))==null?void 0:A.length)!=null?v:0)==0?S=C?50:10:S=T(s).length,q(s,await t().gitManager.log(void 0,!1,S),!0),q(n,!1)}async function u(){var v;if(!t().gitReady||T(s)===void 0)return;q(n,!0);let S=t().gitManager instanceof Me?50:10,A=await t().gitManager.log(void 0,!1,S,(v=T(s).last())==null?void 0:v.hash);T(s).push(...A.slice(1)),q(n,!1)}var f=Xj(),d=j(f),h=j(d),p=j(h);ze(p,C=>i[0]=C,()=>i==null?void 0:i[0]);var g=V(p,2);let w;ze(g,C=>i[1]=C,()=>i==null?void 0:i[1]),G(h),G(d);var b=V(d,2),y=j(b);{var k=C=>{var S=Kj();dn(S,21,()=>T(s),fn,(A,v)=>{Vy(A,{get view(){return e.view},get showTree(){return T(a)},get log(){return T(v)},get plugin(){return t()}})}),G(S),Y(C,S)};ve(y,C=>{T(s)&&C(k)})}bo(4),G(b),G(f),$e(()=>{fe(p,"data-icon",T(a)?"list":"folder"),w=nt(g,1,"clickable-icon nav-action-button",null,w,{loading:T(n)})}),ne("click",p,()=>{q(a,!T(a)),(0,Wy.setIcon)(i[0],T(a)?"list":"folder"),t(t().settings.treeStructure=T(a),!0),t().saveSettings()}),ne("click",g,l),Y(r,f),ct()}Et(["click"]);var zf=class extends P$.ItemView{constructor(e,t){super(e),this.plugin=t,this.hoverPopover=null}getViewType(){return jn.type}getDisplayText(){return jn.name}getIcon(){return jn.icon}async onClose(){return this._view&&await Bs(this._view),super.onClose()}async reload(){this._view&&await Bs(this._view),this._view=ka(qy,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};m();var $$=require("@codemirror/commands"),I$=require("@codemirror/search"),Yy=require("@codemirror/state"),is=require("@codemirror/view"),F$=require("obsidian");var Jj=is.EditorView.theme({"&":{height:"100%"},".cm-scroller":{overflow:"auto"},"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),Vf=class extends F$.ItemView{constructor(t,n){super(t);this.plugin=n;this.navigation=!0,this.contentEl.addClass("git-read-only-file-view","cm-s-obsidian","mod-cm6","markdown-source-view"),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.editor||this.renderFile().catch(i=>this.plugin.displayError(i))}))}getViewType(){return aa.type}getDisplayText(){var n;return this.state?`${(n=this.state.file.split("/").last())!=null?n:this.state.file} (${this.state.ref.substring(0,7)})`:aa.name}getIcon(){return aa.icon}async setState(t,n){this.state=t,await super.setState(t,n),this.leaf.view.titleEl.textContent=this.getDisplayText(),await this.renderFile()}getState(){var t;return(t=this.state)!=null?t:{}}async onOpen(){await this.renderFile(),await super.onOpen()}async onClose(){var t;(t=this.editor)==null||t.destroy(),this.editor=void 0,await super.onClose()}async renderFile(){var n;if(!this.state||!this.plugin.gitReady)return;let t=await this.plugin.gitManager.show(this.state.ref,this.state.file,!1);(n=this.editor)==null||n.destroy(),this.contentEl.empty(),this.editor=new is.EditorView({state:Yy.EditorState.create({doc:t,extensions:[(0,is.lineNumbers)(),(0,is.drawSelection)(),is.keymap.of($$.standardKeymap),(0,I$.search)(),is.EditorView.lineWrapping,Yy.EditorState.readOnly.of(!0),Jj]}),parent:this.contentEl})}};m();var M$=require("obsidian"),xm=class extends M$.Modal{constructor(t){super(t.app);this.plugin=t}onOpen(){var o,l;let{contentEl:t,titleEl:n}=this,i=(l=(o=this.plugin.cachedStatus)==null?void 0:o.conflicted)!=null?l:[];if(n.setText("Merge in progress"),t.addClass("obsidian-git-merge-help"),t.createEl("p",{text:"Git is combining the version in your vault with changes from another version. The merge must be committed before Obsidian Git can push or resume automatic commits."}),i.length>0){t.createEl("h3",{text:"Resolve the co Line truncated
.repository-missing.svelte-5wq9p > .git-commit-msg:where(.svelte-5wq9p),
.repository-missing.svelte-5wq9p > .nav-files-container:where(.svelte-5wq9p) {display:none;}.repository-notice.svelte-5wq9p {flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--size-4-3);padding:var(--size-4-6);text-align:center;}.repository-notice.svelte-5wq9p p:where(.svelte-5wq9p) {margin:0;color:var(--text-muted);}.repository-actions.svelte-5wq9p {display:flex;flex-wrap:wrap;justify-content:center;gap:var(--size-4-2);}.commit-action-group.svelte-5wq9p {display:inline-flex;flex:0 0 auto;gap:0;overflow:hidden;border:1px solid var(--background-modifier-border);border-radius:var(--radius-s);}.commit-action-group.svelte-5wq9p .nav-action-button:where(.svelte-5wq9p) {margin:0;border-radius:0;}.commit-action-group.svelte-5wq9p .nav-action-button:where(.svelte-5wq9p) + .nav-action-button:where(.svelte-5wq9p) {border-left:1px solid var(--background-modifier-border);}.commit-action-group.svelte-5wq9p #commit-menu:where(.svelte-5wq9p) {width:var(--size-4-5);padding-right:0;padding-left:0;}.merge-status.svelte-5wq9p {color:var(--text-warning);}.commit-msg-input.svelte-5wq9p {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-5wq9p {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}.conflicts.svelte-5wq9p {--nav-indentation-guide-color: var(--text-warning);--collapse-icon-color: var(--text-warning);--collapse-icon-color-collapsed: var(--text-warning);}.conflicts.svelte-5wq9p > .nav-folder-title:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .nav-folder-collapse-indicator:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .nav-folder-collapse-indicator:where(.svelte-5wq9p) svg:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .topLevel .nav-folder-collapse-indicator {color:var(--text-warning);}.conflicts.svelte-5wq9p .topLevel .nav-folder-collapse-indicator svg {color:var(--text-warning);}.conflicts.svelte-5wq9p .tree-item-children:where(.svelte-5wq9p) {border-inline-start-color:var(--text-warning);}main.svelte-5wq9p .git-tools:where(.svelte-5wq9p) .files-count:where(.svelte-5wq9p) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-5wq9p {align-items:center;}.git-commit-msg-clear-button.svelte-5wq9p {position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:-4px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out;}.git-commit-msg-clear-button.svelte-5wq9p:after {content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;mask-image:url("data:image/svg+xml,<svg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM3.8705 3.09766L6.00003 5.22718L8.12955 3.09766L8.9024 3.8705L6.77287 6.00003L8.9024 8.12955L8.12955 8.9024L6.00003 6.77287L3.8705 8.9024L3.09766 8.12955L5.22718 6.00003L3.09766 3.8705L3.8705 3.09766Z' fill='currentColor'/></svg>");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,<svg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM3.8705 3.09766L6.00003 5.22718L8.12955 3.09766L8.9024 3.8705L6.77287 6.00003L8.9024 8.12955L8.12955 8.9024L6.00003 6.77287L3.8705 8.9024L3.09766 8.12955L5.22718 6.00003L3.09766 3.8705L3.8705 3.09766Z' fill='currentColor'/></svg>");-webkit-mask-repeat:no-repeat;}`};function Xy(r,e){lt(e,!0),Fn(r,Tz);let t=Mn(e,"plugin",7),n=Mn(e,"view",7),i=Se(!1),s=Se(!1),a=Se(!1),o=Se(!1),l=Se(void 0),c=Se(Je([])),u=Pe(()=>t().settings.commitMessage),f=Je([]),d=Se(void 0),h=Se(void 0),p=Se(void 0),g=Se(void 0),w=Se(!0),b=Se(!0),y=Se(!0),k=Se(!0),C=Se(Je({})),S=Promise.resolve(),A=Pe(()=>{var N,Q;return[...(Q=(N=T(l))==null?void 0:N.conflicted)!=null?Q:[]].sort((xe,it)=>{let Ut=T(C)[xe]===0?0:1,Dn=T(C)[it]===0?0:1;return Ut!==Dn?Ut-Dn:xe.localeCompare(it)})}),v=Se(0),x=Se(Je({})),E=Se(Je({})),R=Se(Je({})),$=Se(Je({})),D=Pe(()=>{var N,Q,xe,it;return((Q=(N=T(l))==null?void 0:N.staged.length)!=null?Q:0)+((it=(xe=T(l))==null?void 0:xe.stagedOutsideVault)!=null?it:0)}),O=Pe(()=>{var N,Q;return(Q=(N=T(l))==null?void 0:N.changed.length)!=null?Q:0}),U=Pe(()=>{var N,Q,xe,it;return((Q=(N=T(l))==null?void 0:N.conflicted.length)!=null?Q:0)+((it=(xe=T(l))==null?void 0:xe.conflictedOutsideVault)!=null?it:0)>0}),me=Pe(()=>T(D)+T(O)>0),Ne=Pe(()=>!te("smart")),Re=Pe(()=>!H( Line truncated
`);i.removed.lines.length>0&&!i.removed.no_nl_at_eof&&(c+=`
`),n.replaceRange(c,n.offsetToPos(o),n.offsetToPos(l)),n.setSelection(n.offsetToPos(o))}}async stageHunk(e){if(!this.editor)return;let{editor:t}=this.editor,n=hi.getHunk(t.state,!1,e),i=!1;if(n||(n=hi.getHunk(t.state,!0,e),i=!0),!n)return;let s=t.state.field(L$.editorInfoField).file.path,a=nr.createPatch(s,[n],"100644",i).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=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.
\`\`\`diff
<<<<<<< HEAD
File changes in local repository
=======
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 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)}};
`;await this.plugin.gitActions.applyPatch(a)}goToHunk(e){if(!this.editor)return;let{editor:t,obEditor:n}=this.editor,i=hi.getHunks(t.state,!1),s=n.getCursor().line+1,a=nr.findNearestHunk(s,i,e,!0);if(a==null)return;let o=i[a];if(o){let l=o.added.start-1;n.setCursor(l,0),n.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();function N$(r){let e,t,n=()=>e?(t!=null||(t=e.catch(()=>{}).then(()=>(t=void 0,n()))),t):(e=r().finally(()=>{e=void 0}),e);return n}m();m();var Ho=require("obsidian");var Am=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let t=e==null?void 0:e.view;!(t instanceof Ho.MarkdownView)||t.file==null||(t==null?void 0:t.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(t.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),e2(()=>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;u2(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new op(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&&Ho.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Me?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(_2),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(),s2(),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 t;e&&((t=this.lineAuthorInfoProvider)==null||t.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,t)=>{var n;return e instanceof Ho.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var t;return e instanceof Ho.TFile&&((t=this.lineAuthorInfoProvider)==null?void 0:t.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",l2)}};m();var Fc=require("obsidian");m();m();var Go=require("@codemirror/state"),Rm=require("@codemirror/view");var Tm=class extends Rm.GutterMarker{constructor(t,n){super();this.type=t;this.staged=n}toDOM(t){let n=createDiv();return n.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&n.setText("~"),n}},Qy=Go.StateField.define({create:()=>Go.RangeSet.empty,update:(r,e)=>{let t=e.state.field(Xr,!1);if(!t)return Go.RangeS Line truncated
`,t),i=n===-1?r.length:n;if(e.push({from:t,to:i,text:r.slice(t,i)}),n===-1)break;t=n+1}return e}function Mm(r){let e=Iz(r),t=[];for(let n=0;n<e.length;n++){let i=e[n];if(!j$.test(i.text))continue;let s=-1,a=-1;for(let d=n+1;d<e.length;d++){let h=e[d];if(Pz.test(h.text)){a=d;break}s===-1&&Rz.test(h.text)&&(s=d)}if(a===-1)continue;let o=-1;for(let d=a+1;d<e.length;d++){let h=e[d];if($z.test(h.text)){o=d;break}if(j$.test(h.text))break}if(o===-1)continue;let l=e[a],c=e[o],u=s!==-1?e[s]:void 0,f=[{from:i.from,to:i.to}];u!==void 0&&f.push({from:u.from,to:u.to}),f.push({from:l.from,to:l.to},{from:c.from,to:c.to}),t.push({from:i.from,to:c.to<r.length?c.to+1:c.to,ours:r.slice(i.to+1,u!==void 0?u.from:l.from),theirs:r.slice(l.to+1,c.from),base:u!==void 0?r.slice(u.to+1,l.from):void 0,markers:f,oursRange:{from:i.to+1,to:u!==void 0?u.from:l.from},baseRange:u!==void 0?{from:u.to+1,to:l.from}:void 0,theirsRange:{from:l.to+1,to:c.from}}),n=o}return t}function Jy(r,e){switch(e){case"ours":return r.ours;case"theirs":return r.theirs;case"base":if(r.base===void 0)throw new Error("Cannot keep the base of a two-way conflict");return r.base;case"both":return r.ours+r.theirs}}function z$(r,e,t){r.dispatch({changes:{from:e.from,to:e.to,insert:Jy(e,t)}}),r.focus()}function V$(r,e){let t=Mm(r.state.doc.toString());r.dispatch({changes:t.map(n=>({from:n.from,to:n.to,insert:Jy(n,e)}))}),r.focus()}var Fz=["ours","base","theirs","both"];function W$(r){if(!r.field(jo.editorLivePreviewField,!1))return[];let e=r.doc.toString();return e.includes("<<<<<<<")?Mm(e):[]}var Mc=i_.StateField.define({create:W$,update:(r,e)=>e.docChanged||e.reconfigured?W$(e.state):r});function Y$(r,e,t){for(let n of Fz){let i=e[n];if(i===void 0)continue;new jo.ButtonComponent(r).setButtonText(i).onClick(a=>{a.preventDefault(),t(n)}).buttonEl.addClass("clickable-icon","nav-action-button",`git-conflict-choose-${n}`)}}var t_=class extends hn.WidgetType{constructor(t){super();this.block=t}eq(t){return t.block.from===this.block.from&&t.block.to===this.block.to&&t.block.ours===this.block.ours&&t.block.theirs===this.block.theirs&&t.block.base===this.block.base}toDOM(t){let n=createDiv({cls:"git-conflict-actions-group git-conflict-actions-widget"}),i={ours:"Keep ours",theirs:"Keep theirs",both:"Keep both"};return this.block.base!==void 0&&(i.base="Keep base"),Y$(n,i,s=>z$(t,this.block,s)),n}};function Z$(r,e){var i;let t=(i=e.state.field(Mc,!1))!=null?i:[];r.createSpan({cls:"git-conflict-panel-label",text:`${t.length} conflict${t.length===1?"":"s"} in file`});let n={ours:"Keep all ours",theirs:"Keep all theirs",both:"Keep both"};t.every(s=>s.base!==void 0)&&(n.base="Keep all base"),Y$(r.createDiv({cls:"git-conflict-actions-group"}),n,s=>V$(e,s))}var r_=class extends hn.WidgetType{constructor(t,n){super();this.count=t;this.hasBase=n}eq(t){return t.count===this.count&&t.hasBase===this.hasBase}toDOM(t){let n=createDiv({cls:"git-conflict-panel"});return Z$(n,t),n}};function e_(r,e,t,n){if(t.from>=t.to)return;let i=e.doc.lineAt(t.from).number,s=e.doc.lineAt(t.to-1).number;for(let a=i;a<=s;a++)r.push(hn.Decoration.line({class:n}).range(e.doc.line(a).from))}function q$(r){var n;let e=(n=r.field(Mc,!1))!=null?n:[],t=[];jo.Platform.isMobile&&e.length>0&&t.push(hn.Decoration.widget({widget:new r_(e.length,e.every(i=>i.base!==void 0)),block:!0,side:-1}).range(0));for(let i of e){let s=i.markers[0];for(let[a,o]of i.markers.entries()){let l=a===0?" git-conflict-marker-ours":a===i.markers.length-1?" git-conflict-marker-theirs":"";t.push(hn.Decoration.line({class:`git-conflict-marker-line${l}`}).range(o.from),hn.Decoration.mark({class:`git-conflict-marker${l}`}).range(o.from,o.to))}t.push(hn.Decoration.widget({widget:new t_(i),side:1}).range(s.to)),e_(t,r,i.oursRange,"git-conflict-ours-line"),i.baseRange!==void 0&&e_(t,r,i.baseRange,"git-conflict-base-line"),e_(t,r,i.theirsRange,"git-conflict-theirs-line")}return hn.Decoration.set(t,!0)}var Mz=i_.StateField.define({create:r=>q$(r),update:(r,e)=>e.docChanged||e.reconfigured?q$(e.state):r,provide:r=>hn.EditorView.decorations.from(r)}),n_=class{constructor(e){this.view=e;this.dom=createDiv({cls:"git-conflict-panel"});this.top=!0;this.render()}update(e){(e.docChanged||e.transactions.some(t=>t.reconfigured))&&this.render()}render(){var t;this.dom.empty(),((t=this.view.state.field(Mc,!1))!=null?t:[]).length!==0&&Z$(this.dom,this.view)}},Oz=r=>new n_(r),Dz=hn.showPanel.compute([Mc],r=>!jo.Platform.isMobile&&r.field(Mc).length>0?Oz:null),K$=[Mc,Mz,Dz];m();var X$=require("@codemirror/state"),Om=require("obsidian");var s_=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,t){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let n=this.view.state,i=JT(e,t,n);this.view.dispatch(i)}notifyGitCompare(e){if(this.view===void 0){console.warn("Git: View is not defined for editor cache key. Unforeseen situation. id: ");return}if(this.removeIfStale())return;let Line truncated
`+i)})}async createNewRepo(){let e=await Ai(this.plugin,async()=>(await this.plugin.gitManager.init(),await this.plugin.init({fromReload:!0}),{status:"initialized"}));return e.status==="success"&&this.reportInitRepositoryResult(e.value),e}reportInitRepositoryResult(e){if(e.status==="initialized"){this.plugin.displayMessage("Initialized new repo");return}}async deleteRepository(){let e=await Ai(this.plugin,async()=>{let t=this.plugin.settings.basePath?`${this.plugin.settings.basePath}/.git`:".git";return await this.plugin.app.vault.adapter.exists(t)?await new ft(this.plugin,{options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? This action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"?(await this.plugin.app.vault.adapter.rmdir(t,!0),{status:"deleted"}):{status:"cancelled"}:{status:"not-found"}});return e.status==="success"&&(this.reportDeleteRepositoryResult(e.value),e.value.status==="deleted"&&(this.plugin.unloadPlugin(),await this.plugin.init({fromReload:!0}))),e}reportDeleteRepositoryResult(e){switch(e.status){case"deleted":this.plugin.displayMessage("Successfully deleted repository. Reloading plugin...");return;case"not-found":this.plugin.displayMessage("No repository found");return;case"cancelled":return}}async cloneNewRepo(){let e=await Ai(this.plugin,()=>this.performCloneNewRepo());return e.status==="success"&&this.reportCloneRepositoryResult(e.value),e}async performCloneNewRepo(){let e=await new ft(this.plugin,{placeholder:"Enter remote URL"}).openAndGetResult();if(!e)return{status:"cancelled",reason:"no-url"};let t="Vault Root",n=await new ft(this.plugin,{options:this.plugin.gitManager instanceof ws?[t]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.plugin.gitManager instanceof ws}).openAndGetResult();if(n===void 0)return{status:"cancelled",reason:"no-directory"};if(n===t&&(n="."),n=(0,On.normalizePath)(n),n==="/"&&(n="."),n==="."){let l=await new ft(this.plugin,{options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.plugin.app.vault.configDir} directory at the root?`,onlySelection:!0}).openAndGetResult();if(l===void 0)return{status:"cancelled",reason:"safety-declined"};if(l==="YES"){let c="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(!(await new ft(this.plugin,{options:["Abort clone",c],placeholder:`To avoid conflicts, the local ${this.plugin.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===c))return{status:"cancelled",reason:"safety-declined"};await this.plugin.app.vault.adapter.rmdir(this.plugin.app.vault.configDir,!0)}}let i=await new ft(this.plugin,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult();if(i===void 0)return{status:"cancelled",reason:"no-depth"};let s;if(i!==""&&(s=parseInt(i),isNaN(s)))return{status:"invalid",reason:"depth"};new On.Notice(`Cloning new repo into "${n}"`);let a=this.plugin.settings.basePath,o=n!==".";o&&(this.plugin.settings.basePath=n);try{return await this.plugin.gitManager.clone(Jv(e),n,s),o&&await this.plugin.saveSettings(),{status:"cloned"}}catch(l){throw this.plugin.settings.basePath=a,await this.plugin.saveSettings(),l}}reportCloneRepositoryResult(e){switch(e.status){case"cloned":this.plugin.displayMessage("Cloned new repo."),this.plugin.displayMessage("Please restart Obsidian");return;case"cancelled":{switch(e.reason){case"safety-declined":case"no-depth":this.plugin.displayMessage("Aborted clone");return;case"no-url":case"no-directory":return}return}case"invalid":if(e.reason==="depth"){this.plugin.displayMessage("Invalid depth. Aborting clone.");return}}}runReadyGitAction(e){return Ai(this.plugin,async()=>await this.plugin.isAllInitialized()?e():{status:"skipped",reason:"not-ready"})}async listChangedFiles(){let e=await this.runReadyGitAction(async()=>{let t=await this.plugin.updateCachedStatus(),n=t.changed.length+t.staged.length;return n>500?{status:"blocked",reason:"too-many-changes",files:n}:(new Um(this.plugin,t.all).open(),{status:"displayed"})});return e.status==="success"&&this.reportListChangedFilesResult(e.value),e}reportListChangedFilesResult(e){switch(e.status){case"displayed":case"skipped":return;case"blocked":if(e.reason==="too-many-changes"){this.plugin.displayError("Too many changes to display");return}}}async pullChangesFromRemote(){let e=await this.pull();if(e.status!=="success")return;let t=e.value;t.status!=="skipped"&&(this.reportPullResult(t),this.plugin.app.workspace.trigger("obsidian-git:refresh"))}reportPullResult(e){switch(e.status){case"updated":{let t=e.files.length+e.outsideVault,n=e.outsideVault>0?` (${e.files.length} in the vault, ${e.outsideVault} outside)`:"";this.plugin.displayMessage(`Pulled ${t} ${t==1?"file":"files"} from remote${n}`),this.plugin.lastPulledFiles=e.files;return}case"up-to-date":this.plugin.displayMessage("Pull: Everything is up-to-date");return;case"skipped":switch(e.reason){case"not-re Line truncated
Use set upstream branch command to set it manually if desired.`),!1;new On.Notice("No upstream branch is set. Please select one.");let e=await this.performSetUpstreamBranch();return this.reportSetUpstreamResult(e),e.status==="updated"}async isPushRemoteSet(){if(this.plugin.settings.updateSubmodules||await this.canAutoSetupPushRemote())return!0;if(!(await this.plugin.gitManager.branchInfo()).tracking){new On.Notice("No upstream branch is set. Please select one.");let e=await this.performSetUpstreamBranch();return this.reportSetUpstreamResult(e),e.status==="updated"}return!0}async setUpstreamBranch(){let e=await this.runReadyGitAction(async()=>this.performSetUpstreamBranch());return e.status==="success"&&this.reportSetUpstreamResult(e.value),e}async performSetUpstreamBranch(){let e=await this.selectRemoteBranch();return e==null?{status:"cancelled"}:(await this.plugin.gitManager.updateUpstreamBranch(e),{status:"updated",branch:e})}reportSetUpstreamResult(e){switch(e.status){case"updated":this.plugin.displayMessage(`Set upstream branch to ${e.branch}`);return;case"cancelled":this.plugin.displayError("Aborted. No upstream-branch is set!",1e4);return;case"skipped":return}}async discardFile(e){let t=await this.runReadyGitAction(async()=>{let n=e.workingDir==="U",i=await new Qf({app:this.plugin.app,filesToDeleteCount:n?1:0,filesToDiscardCount:n?0:1,path:e.vaultPath}).openAndGetResult();if(i===!1)return{status:"cancelled"};if(i==="delete"){let s=this.plugin.app.vault.getAbstractFileByPath(e.vaultPath);s?await this.plugin.app.fileManager.trashFile(s):await this.plugin.app.vault.adapter.remove(e.vaultPath)}else await this.plugin.gitManager.discard(e.path);return this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"discarded",target:"file"}});return t.status==="success"&&this.reportDiscardResult(t.value,!1),t}async discardAll(e){let t=await this.runReadyGitAction(async()=>{let n=await this.plugin.gitManager.status({path:e}),i=0,s=0;for(let o of n.changed)o.workingDir=="U"?i++:s++;if(i+s==0)return{status:"skipped",reason:"no-changes"};let a=await new Qf({app:this.plugin.app,filesToDeleteCount:i,filesToDiscardCount:s,path:e!=null?e:""}).openAndGetResult();if(a===!1)return{status:"cancelled"};if(await this.plugin.gitManager.discardAll({dir:e,status:n}),a==="delete"){let o=await this.plugin.gitManager.getUntrackedPaths({path:e,status:n});for(let l of o){let c=this.plugin.gitManager.getRelativeVaultPath(l),u=this.plugin.app.vault.getAbstractFileByPath(c);u?await this.plugin.app.fileManager.trashFile(u):l.endsWith("/")?await this.plugin.app.vault.adapter.rmdir(c,!0):await this.plugin.app.vault.adapter.remove(c)}}return this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"discarded",target:a==="delete"?"all":"tracked"}});return t.status==="success"&&this.reportDiscardResult(t.value,e===void 0),t}reportDiscardResult(e,t){switch(e.status){case"discarded":if(!t||e.target==="file")return;this.plugin.displayMessage(e.target==="all"?"Discarded all files.":"Discarded all changes in tracked files.");return;case"cancelled":case"skipped":return}}async editRemotes(){let e=await this.runReadyGitAction(async()=>this.performEditRemotes());return e.status==="success"&&this.reportEditRemoteResult(e.value),e}async performEditRemotes(){let e=await this.plugin.gitManager.getRemotes(),t=await new ft(this.plugin,{options:e,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(!t)return{status:"cancelled"};let n=await this.plugin.gitManager.getRemoteUrl(t),i=await new ft(this.plugin,{initialValue:n,placeholder:"Enter remote URL"}).openAndGetResult();return i?(await this.plugin.gitManager.setRemote(t,Jv(i)),{status:"updated",remote:t}):{status:"cancelled"}}reportEditRemoteResult(e){switch(e.status){case"updated":case"cancelled":case"skipped":return}}async selectRemoteBranch(){let e=await this.plugin.gitManager.getRemotes(),t;if(e.length===0){let s=await this.performEditRemotes();s.status==="updated"&&(t=s.remote),t==null&&(e=await this.plugin.gitManager.getRemotes())}let n=new ft(this.plugin,{options:e,placeholder:"Select or create a new remote by typing its name and selecting it"}),i=t!=null?t:await n.openAndGetResult();if(i){this.plugin.displayMessage("Fetching remote branches"),await this.plugin.gitManager.fetch(i);let s=await this.plugin.gitManager.getRemoteBranches(i),o=await new ft(this.plugin,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return o==null?void 0:o.startsWith(i+"/")?o:`${i}/${o}`}}async removeRemote(){let e=await this.runReadyGitAction(async()=>{let t=await this.plugin.gitManager.getRemotes(),n=await new ft(this.plugin,{options:t,placeholder:"Select a remote"}).openAndGetResult();return n?(await this.plugin.gitManager.removeRemote(n),{status:"removed",remote:n}):{status:"cancelled"}});return e.status==="success"&&this.reportRemoveRemoteResult(e.value),e}reportRemoveRemoteResult(e Line truncated
/*! Bundled license information:
ieee754/index.js:
@@ -395,6 +395,8 @@ crc-32/crc32.js:
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
isomorphic-git/index.js:
isomorphic-git/managers/index.js:
isomorphic-git/models/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
@@ -412,16 +414,6 @@ isomorphic-git/index.js:
* 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/build/sha256.mjs:
(**
* [js-sha256]{@link https://github.com/emn178/js-sha256}
*
* @version 0.12.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2026
* @license MIT
*)
*/
/* nosourcemap */
+2 -1
View File
@@ -6,5 +6,6 @@
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.40.0"
"version": "2.41.1",
"minAppVersion": "1.13.0"
}
+198
View File
@@ -134,6 +134,16 @@
color: var(--text-accent);
}
.obsidian-git-merge-help ol {
padding-inline-start: var(--size-4-6);
}
.obsidian-git-merge-help-resolved {
padding: var(--size-4-3);
border-inline-start: 2px solid var(--color-green);
background-color: var(--background-secondary);
}
/* ====== diff2html ======
The following styles are adapted from the obsidian-version-history plugin by
@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss
@@ -170,6 +180,49 @@ which itself is adapted from the diff2html library with the following original l
--git-insert: #399839;
--git-change: #d0b44c;
--git-move: #3572b0;
--git-conflict-ours: var(--color-cyan);
--git-conflict-theirs: var(--color-blue);
--git-conflict-ours-bg: color-mix(
in oklch,
var(--git-conflict-ours) 10%,
transparent
);
--git-conflict-theirs-bg: color-mix(
in oklch,
var(--git-conflict-theirs) 10%,
transparent
);
--git-conflict-ours-header-bg: color-mix(
in oklch,
var(--git-conflict-ours) 25%,
transparent
);
--git-conflict-theirs-header-bg: color-mix(
in oklch,
var(--git-conflict-theirs) 25%,
transparent
);
--git-conflict-ours-button-bg: color-mix(
in oklab,
var(--git-conflict-ours) 25%,
var(--interactive-normal)
);
--git-conflict-theirs-button-bg: color-mix(
in oklab,
var(--git-conflict-theirs) 25%,
var(--interactive-normal)
);
--git-conflict-base-button-bg: color-mix(
in oklab,
var(--color-purple) 15%,
var(--interactive-normal)
);
--git-conflict-base-bg: color-mix(
in oklch,
var(--color-purple) 4%,
transparent
);
}
.git-diff {
@@ -703,3 +756,148 @@ div:hover > .git-gutter-marker.git-changedelete {
.git-changes-status-bar .git-change {
margin-right: 0.3em;
}
.cm-line.git-conflict-marker-line {
display: flex !important;
align-items: center;
background-color: var(--background-modifier-hover);
}
.cm-line.git-conflict-marker-line.HyperMD-quote {
/* The closing Git marker (`>>>>>>>`) is parsed by Live Preview as nested
* Markdown blockquotes. Obsidian marks these layout rules as important, so
* the conflict marker must use important as well to undo that styling. */
text-indent: 0 !important;
padding-inline-start: 0 !important;
border-inline-start: none !important;
}
.git-conflict-marker {
background-color: transparent;
}
.markdown-source-view.mod-cm6
.cm-line.git-conflict-marker-line.git-conflict-marker-ours {
background-color: var(--git-conflict-ours-header-bg);
}
.markdown-source-view.mod-cm6
.cm-line.git-conflict-marker-line.git-conflict-marker-theirs {
background-color: var(--git-conflict-theirs-header-bg);
}
.git-conflict-panel {
display: flex;
align-items: center;
gap: var(--size-2-2);
padding: var(--size-2-2) var(--size-4-2);
background-color: var(--background-secondary);
border-bottom: 1px solid var(--background-modifier-border);
}
.git-conflict-panel-label {
color: var(--text-muted);
font-size: var(--font-ui-smaller);
margin-inline-end: auto;
}
.is-mobile .git-conflict-panel {
flex-direction: column;
align-items: stretch;
}
.is-mobile .git-conflict-panel .git-conflict-actions-group {
flex-wrap: wrap;
}
.is-mobile .git-conflict-panel .nav-action-button {
flex: 1 1 auto;
}
.git-conflict-actions-group {
display: inline-flex;
gap: 0;
overflow: hidden;
border: 1px solid var(--background-modifier-border);
border-radius: var(--radius-s);
.nav-action-button {
margin: 0;
border-radius: 0;
font-weight: bold;
padding: var(--size-2-3);
}
.nav-action-button + .nav-action-button {
border-left: 1px solid var(--background-modifier-border);
}
}
.git-conflict-actions-group .git-conflict-choose-ours {
background-color: var(--git-conflict-ours-button-bg);
color: var(--text-normal);
}
.git-conflict-actions-group .git-conflict-choose-theirs {
background-color: var(--git-conflict-theirs-button-bg);
color: var(--text-normal);
}
.git-conflict-actions-group .git-conflict-choose-base {
background-color: var(--git-conflict-base-button-bg);
color: var(--text-normal);
}
.git-conflict-actions-group .git-conflict-choose-both {
background-color: var(--interactive-normal);
color: var(--text-normal);
}
.git-conflict-actions-widget {
flex: none;
margin-left: var(--size-2-2);
border-radius: 0;
}
.cm-line.git-conflict-ours-line {
background-color: var(--git-conflict-ours-bg);
}
.cm-line.git-conflict-theirs-line {
background-color: var(--git-conflict-theirs-bg);
}
.cm-line.git-conflict-base-line {
background-color: var(--git-conflict-base-bg);
}
.cm-line.git-conflict-marker-line::after {
content: "";
flex: 1;
margin-left: var(--size-2-2);
}
.cm-line.git-conflict-marker-line .git-conflict-actions-widget {
order: 2;
}
.is-mobile .cm-line.git-conflict-marker-line {
flex-wrap: wrap;
}
.is-mobile .cm-line.git-conflict-marker-line::after {
display: none;
}
.is-mobile .cm-line.git-conflict-marker-line .git-conflict-actions-widget {
flex: 0 0 100%;
margin: var(--size-2-1) 0 0;
}
.is-mobile .git-conflict-actions-widget {
flex-wrap: wrap;
}
.is-mobile .git-conflict-actions-widget .nav-action-button {
flex: 1 1 auto;
}
+2 -2
View File
@@ -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 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
"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(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
*/__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 */
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-livesync",
"name": "Self-hosted LiveSync",
"version": "1.0.32",
"version": "1.0.35",
"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",