From eb22819a9beaf58b9fa0fc2c5f6936ab7451f313 Mon Sep 17 00:00:00 2001 From: Gutca Date: Wed, 22 Jul 2026 20:27:57 +0200 Subject: [PATCH] Initial vault commit --- .obsidian/app.json | 1 + .obsidian/appearance.json | 1 + .obsidian/community-plugins.json | 3 + .obsidian/core-plugins.json | 33 + .obsidian/graph.json | 22 + .obsidian/plugins/obsidian-git/main.js | 415 +++++++++++ .obsidian/plugins/obsidian-git/manifest.json | 10 + .../plugins/obsidian-git/obsidian_askpass.sh | 23 + .obsidian/plugins/obsidian-git/styles.css | 705 ++++++++++++++++++ .obsidian/workspace.json | 213 ++++++ Advisor/2026-07-21-performance-summary.md | 240 ++++++ Running Log.md | 0 Runs/2026-06-07-1k.md | 23 + Runs/2026-06-07.md | 23 + Runs/2026-06-10.md | 36 + Runs/2026-06-13.md | 23 + Runs/2026-06-15.md | 23 + Runs/2026-06-19.md | 23 + Runs/2026-06-22.md | 23 + Runs/2026-06-29.md | 43 ++ Runs/2026-06-30.md | 59 ++ Runs/2026-07-01.md | 61 ++ Runs/2026-07-03.md | 64 ++ Runs/2026-07-05.md | 72 ++ Runs/2026-07-08.md | 69 ++ Runs/2026-07-10.md | 72 ++ Runs/2026-07-12.md | 76 ++ Runs/2026-07-13.md | 72 ++ Runs/2026-07-15.md | 75 ++ Runs/2026-07-18.md | 70 ++ Runs/2026-07-20.md | 77 ++ Sleep/2026-06-29.md | 17 + Sleep/2026-06-30.md | 17 + Sleep/2026-07-01.md | 17 + Sleep/2026-07-02.md | 17 + Sleep/2026-07-03.md | 15 + Sleep/2026-07-05.md | 17 + Sleep/2026-07-08.md | 15 + Sleep/2026-07-10.md | 15 + Sleep/2026-07-12.md | 15 + Sleep/2026-07-13.md | 19 + Sleep/2026-07-15.md | 46 ++ Sleep/2026-07-18.md | 43 ++ Sleep/2026-07-20.md | 45 ++ System/Assistant/context.md | 65 ++ System/Assistant/environment.md | 48 ++ System/Assistant/preferences.md | 43 ++ flag_fetch.md | 0 flag_rebuild.md | 0 index.md | 21 + koltsegvetes-julius-2026.md | 67 ++ sportnote-blueprint.md | 456 +++++++++++ 52 files changed, 3648 insertions(+) create mode 100644 .obsidian/app.json create mode 100644 .obsidian/appearance.json create mode 100644 .obsidian/community-plugins.json create mode 100644 .obsidian/core-plugins.json create mode 100644 .obsidian/graph.json create mode 100644 .obsidian/plugins/obsidian-git/main.js create mode 100644 .obsidian/plugins/obsidian-git/manifest.json create mode 100644 .obsidian/plugins/obsidian-git/obsidian_askpass.sh create mode 100644 .obsidian/plugins/obsidian-git/styles.css create mode 100644 .obsidian/workspace.json create mode 100644 Advisor/2026-07-21-performance-summary.md create mode 100644 Running Log.md create mode 100644 Runs/2026-06-07-1k.md create mode 100644 Runs/2026-06-07.md create mode 100644 Runs/2026-06-10.md create mode 100644 Runs/2026-06-13.md create mode 100644 Runs/2026-06-15.md create mode 100644 Runs/2026-06-19.md create mode 100644 Runs/2026-06-22.md create mode 100644 Runs/2026-06-29.md create mode 100644 Runs/2026-06-30.md create mode 100644 Runs/2026-07-01.md create mode 100644 Runs/2026-07-03.md create mode 100644 Runs/2026-07-05.md create mode 100644 Runs/2026-07-08.md create mode 100644 Runs/2026-07-10.md create mode 100644 Runs/2026-07-12.md create mode 100644 Runs/2026-07-13.md create mode 100644 Runs/2026-07-15.md create mode 100644 Runs/2026-07-18.md create mode 100644 Runs/2026-07-20.md create mode 100644 Sleep/2026-06-29.md create mode 100644 Sleep/2026-06-30.md create mode 100644 Sleep/2026-07-01.md create mode 100644 Sleep/2026-07-02.md create mode 100644 Sleep/2026-07-03.md create mode 100644 Sleep/2026-07-05.md create mode 100644 Sleep/2026-07-08.md create mode 100644 Sleep/2026-07-10.md create mode 100644 Sleep/2026-07-12.md create mode 100644 Sleep/2026-07-13.md create mode 100644 Sleep/2026-07-15.md create mode 100644 Sleep/2026-07-18.md create mode 100644 Sleep/2026-07-20.md create mode 100644 System/Assistant/context.md create mode 100644 System/Assistant/environment.md create mode 100644 System/Assistant/preferences.md create mode 100644 flag_fetch.md create mode 100644 flag_rebuild.md create mode 100644 index.md create mode 100644 koltsegvetes-julius-2026.md create mode 100644 sportnote-blueprint.md diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..d3f66fa --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,3 @@ +[ + "obsidian-git" +] \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..639b90d --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,33 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "footnotes": false, + "properties": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "bases": true, + "webviewer": false +} \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..affebb6 --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 0.9999999999999992, + "close": false +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/main.js b/.obsidian/plugins/obsidian-git/main.js new file mode 100644 index 0000000..3efd1dd --- /dev/null +++ b/.obsidian/plugins/obsidian-git/main.js @@ -0,0 +1,415 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source visit the plugins github repository (https://github.com/denolehov/obsidian-git) +*/ + +var TF=Object.create;var vc=Object.defineProperty;var PF=Object.getOwnPropertyDescriptor;var RF=Object.getOwnPropertyNames;var $F=Object.getPrototypeOf,FF=Object.prototype.hasOwnProperty;var yb=t=>{throw TypeError(t)};var IF=(t,e,r)=>e in t?vc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var MF=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(i){throw r=[i],i}};var U=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},DF=(t,e)=>{for(var r in e)vc(t,r,{get:e[r],enumerable:!0})},xb=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of RF(e))!FF.call(t,n)&&n!==r&&vc(t,n,{get:()=>e[n],enumerable:!(i=PF(e,n))||i.enumerable});return t};var Gt=(t,e,r)=>(r=t!=null?TF($F(t)):{},xb(e||!t||!t.__esModule?vc(r,"default",{value:t,enumerable:!0}):r,t)),OF=t=>xb(vc({},"__esModule",{value:!0}),t);var He=(t,e,r)=>IF(t,typeof e!="symbol"?e+"":e,r),Yp=(t,e,r)=>e.has(t)||yb("Cannot "+r);var F=(t,e,r)=>(Yp(t,e,"read from private field"),r?r.call(t):e.get(t)),ge=(t,e,r)=>e.has(t)?yb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),pe=(t,e,r,i)=>(Yp(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Ae=(t,e,r)=>(Yp(t,e,"access private method"),r);var kb=U(Cf=>{"use strict";m();Cf.byteLength=NF;Cf.toByteArray=HF;Cf.fromByteArray=jF;var on=[],pi=[],LF=typeof Uint8Array!="undefined"?Uint8Array:Array,Zp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ia=0,Eb=Zp.length;ia0)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 NF(t){var e=Sb(t),r=e[0],i=e[1];return(r+i)*3/4-i}function BF(t,e,r){return(e+r)*3/4-r}function HF(t){var e,r=Sb(t),i=r[0],n=r[1],s=new LF(BF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=pi[t.charCodeAt(l)]<<2|pi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=pi[t.charCodeAt(l)]<<10|pi[t.charCodeAt(l+1)]<<4|pi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function UF(t){return on[t>>18&63]+on[t>>12&63]+on[t>>6&63]+on[t&63]}function GF(t,e,r){for(var i,n=[],s=e;so?o:a+s));return i===1?(e=t[r-1],n.push(on[e>>2]+on[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(on[e>>10]+on[e>>4&63]+on[e<<2&63]+"=")),n.join("")}});var Ab=U(Kp=>{m();Kp.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<>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)};Kp.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<>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<0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var sm=U(So=>{"use strict";m();var Xp=kb(),xo=Ab(),Cb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;So.Buffer=O;So.SlowBuffer=ZF;So.INSPECT_MAX_BYTES=50;var Tf=2147483647;So.kMaxLength=Tf;O.TYPED_ARRAY_SUPPORT=VF();!O.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 VF(){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(O.prototype,"parent",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}});Object.defineProperty(O.prototype,"offset",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}});function Bn(t){if(t>Tf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,O.prototype),e}function O(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 tm(t)}return $b(t,e,r)}O.poolSize=8192;function $b(t,e,r){if(typeof t=="string")return WF(t,e);if(ArrayBuffer.isView(t))return qF(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(ln(t,ArrayBuffer)||t&&ln(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(ln(t,SharedArrayBuffer)||t&&ln(t.buffer,SharedArrayBuffer)))return Jp(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return O.from(i,e,r);let n=YF(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return O.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}O.from=function(t,e,r){return $b(t,e,r)};Object.setPrototypeOf(O.prototype,Uint8Array.prototype);Object.setPrototypeOf(O,Uint8Array);function Fb(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function zF(t,e,r){return Fb(t),t<=0?Bn(t):e!==void 0?typeof r=="string"?Bn(t).fill(e,r):Bn(t).fill(e):Bn(t)}O.alloc=function(t,e,r){return zF(t,e,r)};function tm(t){return Fb(t),Bn(t<0?0:rm(t)|0)}O.allocUnsafe=function(t){return tm(t)};O.allocUnsafeSlow=function(t){return tm(t)};function WF(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!O.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Ib(t,e)|0,i=Bn(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function Qp(t){let e=t.length<0?0:rm(t.length)|0,r=Bn(e);for(let i=0;i=Tf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Tf.toString(16)+" bytes");return t|0}function ZF(t){return+t!=t&&(t=0),O.alloc(+t)}O.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==O.prototype};O.compare=function(e,r){if(ln(e,Uint8Array)&&(e=O.from(e,e.offset,e.byteLength)),ln(r,Uint8Array)&&(r=O.from(r,r.offset,r.byteLength)),!O.isBuffer(e)||!O.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,a=Math.min(i,n);sn.length?(O.isBuffer(a)||(a=O.from(a)),a.copy(n,s)):Uint8Array.prototype.set.call(n,a,s);else if(O.isBuffer(a))a.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return n};function Ib(t,e){if(O.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||ln(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return em(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Gb(t).length;default:if(n)return i?-1:em(t).length;e=(""+e).toLowerCase(),n=!0}}O.byteLength=Ib;function KF(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return aI(this,e,r);case"utf8":case"utf-8":return Db(this,e,r);case"ascii":return nI(this,e,r);case"latin1":case"binary":return sI(this,e,r);case"base64":return rI(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oI(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}O.prototype._isBuffer=!0;function na(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}O.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};Cb&&(O.prototype[Cb]=O.prototype.inspect);O.prototype.compare=function(e,r,i,n,s){if(ln(e,Uint8Array)&&(e=O.from(e,e.offset,e.byteLength)),!O.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let a=s-n,o=i-r,l=Math.min(a,o),c=this.slice(n,s),u=e.slice(r,i);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,nm(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=O.from(e,i)),O.isBuffer(e))return e.length===0?-1:Tb(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Tb(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Tb(t,e,r,i,n){let s=1,a=t.length,o=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,o/=2,r/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(n){let u=-1;for(c=r;ca&&(r=a-o),c=r;c>=0;c--){let u=!0;for(let f=0;fn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let a;for(a=0;a>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return XF(this,e,r,i);case"utf8":case"utf-8":return QF(this,e,r,i);case"ascii":case"latin1":case"binary":return JF(this,e,r,i);case"base64":return eI(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tI(this,e,r,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}};O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rI(t,e,r){return e===0&&r===t.length?Xp.fromByteArray(t):Xp.fromByteArray(t.slice(e,r))}function Db(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+o<=r){let l,c,u,f;switch(o){case 1:s<128&&(a=s);break;case 2:l=t[n+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(a=f));break;case 3:l=t[n+1],c=t[n+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:l=t[n+1],c=t[n+2],u=t[n+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(a=f))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=o}return iI(i)}var Pb=4096;function iI(t){let e=t.length;if(e<=Pb)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii)&&(r=i);let n="";for(let s=e;si&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),rr)throw new RangeError("Trying to access beyond buffer length")}O.prototype.readUintLE=O.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||jt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a>>0,r=r>>>0,i||jt(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};O.prototype.readUint8=O.prototype.readUInt8=function(e,r){return e=e>>>0,r||jt(e,1,this.length),this[e]};O.prototype.readUint16LE=O.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||jt(e,2,this.length),this[e]|this[e+1]<<8};O.prototype.readUint16BE=O.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||jt(e,2,this.length),this[e]<<8|this[e+1]};O.prototype.readUint32LE=O.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};O.prototype.readUint32BE=O.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};O.prototype.readBigUInt64LE=vs(function(e){e=e>>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<>>0,r=r>>>0,i||jt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a=s&&(n-=Math.pow(2,8*r)),n};O.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||jt(e,r,this.length);let n=r,s=1,a=this[e+--n];for(;n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a};O.prototype.readInt8=function(e,r){return e=e>>>0,r||jt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};O.prototype.readInt16LE=function(e,r){e=e>>>0,r||jt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};O.prototype.readInt16BE=function(e,r){e=e>>>0,r||jt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};O.prototype.readInt32LE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};O.prototype.readInt32BE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};O.prototype.readBigInt64LE=vs(function(e){e=e>>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,r||jt(e,4,this.length),xo.read(this,e,!0,23,4)};O.prototype.readFloatBE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),xo.read(this,e,!1,23,4)};O.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||jt(e,8,this.length),xo.read(this,e,!0,52,8)};O.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||jt(e,8,this.length),xo.read(this,e,!1,52,8)};function $r(t,e,r,i,n,s){if(!O.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}O.prototype.writeUintLE=O.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;$r(this,e,r,i,o,0)}let s=1,a=0;for(this[r]=e&255;++a>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;$r(this,e,r,i,o,0)}let s=i-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+i};O.prototype.writeUint8=O.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,1,255,0),this[r]=e&255,r+1};O.prototype.writeUint16LE=O.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};O.prototype.writeUint16BE=O.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};O.prototype.writeUint32LE=O.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};O.prototype.writeUint32BE=O.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Ob(t,e,r,i,n){Ub(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function Lb(t,e,r,i,n){Ub(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}O.prototype.writeBigUInt64LE=vs(function(e,r=0){return Ob(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});O.prototype.writeBigUInt64BE=vs(function(e,r=0){return Lb(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});O.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);$r(this,e,r,i,l-1,-l)}let s=0,a=1,o=0;for(this[r]=e&255;++s>0)-o&255;return r+i};O.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);$r(this,e,r,i,l-1,-l)}let s=i-1,a=1,o=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&o===0&&this[r+s+1]!==0&&(o=1),this[r+s]=(e/a>>0)-o&255;return r+i};O.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};O.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};O.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};O.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};O.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};O.prototype.writeBigInt64LE=vs(function(e,r=0){return Ob(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});O.prototype.writeBigInt64BE=vs(function(e,r=0){return Lb(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Nb(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Bb(t,e,r,i,n){return e=+e,r=r>>>0,n||Nb(t,e,r,4,34028234663852886e22,-34028234663852886e22),xo.write(t,e,r,i,23,4),r+4}O.prototype.writeFloatLE=function(e,r,i){return Bb(this,e,r,!0,i)};O.prototype.writeFloatBE=function(e,r,i){return Bb(this,e,r,!1,i)};function Hb(t,e,r,i,n){return e=+e,r=r>>>0,n||Nb(t,e,r,8,17976931348623157e292,-17976931348623157e292),xo.write(t,e,r,i,52,8),r+8}O.prototype.writeDoubleLE=function(e,r,i){return Hb(this,e,r,!0,i)};O.prototype.writeDoubleBE=function(e,r,i){return Hb(this,e,r,!1,i)};O.prototype.copy=function(e,r,i,n){if(!O.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?n=Rb(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Rb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Rb(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function lI(t,e,r){Eo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&wc(e,t.length-(r+1))}function Ub(t,e,r,i,n,s){if(t>r||t3?e===0||e===BigInt(0)?o=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:o=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:o=`>= ${e}${a} and <= ${r}${a}`,new yo.ERR_OUT_OF_RANGE("value",o,t)}lI(i,n,s)}function Eo(t,e){if(typeof t!="number")throw new yo.ERR_INVALID_ARG_TYPE(e,"number",t)}function wc(t,e,r){throw Math.floor(t)!==t?(Eo(t,r),new yo.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new yo.ERR_BUFFER_OUT_OF_BOUNDS:new yo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var cI=/[^+/0-9A-Za-z-_]/g;function uI(t){if(t=t.split("=")[0],t=t.trim().replace(cI,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function em(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let a=0;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function fI(t){let e=[];for(let r=0;r>8,n=r%256,s.push(n),s.push(i);return s}function Gb(t){return Xp.toByteArray(uI(t))}function Pf(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function ln(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function nm(t){return t!==t}var hI=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function vs(t){return typeof BigInt=="undefined"?pI:t}function pI(){throw new Error("BigInt not supported")}});var jb,am,E,m=MF(()=>{jb=require("obsidian");jb.Platform.isMobileApp?am=sm().Buffer:am=global.Buffer;E=am});var zb=U((SG,Vb)=>{"use strict";m();var Yr=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process=="undefined"||typeof process.domain=="undefined")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||Yr.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Yr.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Yr.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Yr.DEFAULT_MAX_PENDING};Yr.DEFAULT_TIMEOUT=0;Yr.DEFAULT_MAX_OCCUPATION_TIME=0;Yr.DEFAULT_MAX_EXECUTION_TIME=0;Yr.DEFAULT_MAX_PENDING=1e3;Yr.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,a=null;typeof r!="function"&&(i=r,r=null,a=new this.Promise(function(b,S){n=b,s=S})),i=i||{};var o=!1,l=null,c=null,u=null,f=this,d=function(b,S,C){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(a?S?s(S):n(C):typeof r=="function"&&r(S,C),o=!0),b&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},h=function(b){if(o)return d(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[t]=process.domain);var S=i.maxExecutionTime||f.maxExecutionTime;if(S&&(u=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},S)),e.length===1){var C=!1;try{e(function(A,k){C||(C=!0,d(b,A,k))})}catch(A){C||(C=!0,d(b,A))}}else f._promiseTry(function(){return e()}).then(function(A){d(b,void 0,A)},function(A){d(b,A)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=i.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],h(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])h(!1);else if(f.queues[t].length>=p)d(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){h(!0)};i.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var w=i.timeout||f.timeout;w&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},w))}var y=i.maxOccupationTime||f.maxOccupationTime;if(y&&(c=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},y)),a)return a};Yr.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=function(o,l){return function(c){n.acquire(o,l,c,i)}},a=t.reduceRight(function(o,l){return s(l,o)},e);if(typeof r=="function")a(r);else return new this.Promise(function(o,l){a.length===1?a(function(c,u){c?l(c):o(u)}):o(a())})};Yr.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Yr.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};Vb.exports=Yr});var qb=U((AG,Wb)=>{"use strict";m();Wb.exports=zb()});var Yb=U((TG,om)=>{m();typeof Object.create=="function"?om.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:om.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var $f=U((lm,Kb)=>{m();var Rf=sm(),cn=Rf.Buffer;function Zb(t,e){for(var r in t)e[r]=t[r]}cn.from&&cn.alloc&&cn.allocUnsafe&&cn.allocUnsafeSlow?Kb.exports=Rf:(Zb(Rf,lm),lm.Buffer=sa);function sa(t,e,r){return cn(t,e,r)}sa.prototype=Object.create(cn.prototype);Zb(cn,sa);sa.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return cn(t,e,r)};sa.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=cn(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};sa.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return cn(t)};sa.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Rf.SlowBuffer(t)}});var Qb=U(($G,Xb)=>{m();var mI={}.toString;Xb.exports=Array.isArray||function(t){return mI.call(t)=="[object Array]"}});var ko=U((IG,Jb)=>{"use strict";m();Jb.exports=TypeError});var cm=U((DG,e_)=>{"use strict";m();e_.exports=Object});var r_=U((LG,t_)=>{"use strict";m();t_.exports=Error});var n_=U((BG,i_)=>{"use strict";m();i_.exports=EvalError});var a_=U((UG,s_)=>{"use strict";m();s_.exports=RangeError});var l_=U((jG,o_)=>{"use strict";m();o_.exports=ReferenceError});var um=U((zG,c_)=>{"use strict";m();c_.exports=SyntaxError});var f_=U((qG,u_)=>{"use strict";m();u_.exports=URIError});var h_=U((ZG,d_)=>{"use strict";m();d_.exports=Math.abs});var m_=U((XG,p_)=>{"use strict";m();p_.exports=Math.floor});var v_=U((JG,g_)=>{"use strict";m();g_.exports=Math.max});var b_=U((tj,w_)=>{"use strict";m();w_.exports=Math.min});var y_=U((ij,__)=>{"use strict";m();__.exports=Math.pow});var E_=U((sj,x_)=>{"use strict";m();x_.exports=Math.round});var k_=U((oj,S_)=>{"use strict";m();S_.exports=Number.isNaN||function(e){return e!==e}});var C_=U((cj,A_)=>{"use strict";m();var gI=k_();A_.exports=function(e){return gI(e)||e===0?e:e<0?-1:1}});var P_=U((fj,T_)=>{"use strict";m();T_.exports=Object.getOwnPropertyDescriptor});var Ao=U((hj,R_)=>{"use strict";m();var Ff=P_();if(Ff)try{Ff([],"length")}catch(t){Ff=null}R_.exports=Ff});var bc=U((mj,$_)=>{"use strict";m();var If=Object.defineProperty||!1;if(If)try{If({},"a",{value:1})}catch(t){If=!1}$_.exports=If});var fm=U((vj,F_)=>{"use strict";m();F_.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var D_=U((bj,M_)=>{"use strict";m();var I_=typeof Symbol!="undefined"&&Symbol,vI=fm();M_.exports=function(){return typeof I_!="function"||typeof Symbol!="function"||typeof I_("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:vI()}});var dm=U((yj,O_)=>{"use strict";m();O_.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var hm=U((Ej,L_)=>{"use strict";m();var wI=cm();L_.exports=wI.getPrototypeOf||null});var H_=U((kj,B_)=>{"use strict";m();var bI="Function.prototype.bind called on incompatible ",_I=Object.prototype.toString,yI=Math.max,xI="[object Function]",N_=function(e,r){for(var i=[],n=0;n{"use strict";m();var kI=H_();U_.exports=Function.prototype.bind||kI});var Mf=U((Pj,G_)=>{"use strict";m();G_.exports=Function.prototype.call});var Df=U(($j,j_)=>{"use strict";m();j_.exports=Function.prototype.apply});var z_=U((Ij,V_)=>{"use strict";m();V_.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var pm=U((Dj,W_)=>{"use strict";m();var AI=Co(),CI=Df(),TI=Mf(),PI=z_();W_.exports=PI||AI.call(TI,CI)});var Of=U((Lj,q_)=>{"use strict";m();var RI=Co(),$I=ko(),FI=Mf(),II=pm();q_.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new $I("a function is required");return II(RI,FI,e)}});var J_=U((Bj,Q_)=>{"use strict";m();var MI=Of(),Y_=Ao(),K_;try{K_=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var mm=!!K_&&Y_&&Y_(Object.prototype,"__proto__"),X_=Object,Z_=X_.getPrototypeOf;Q_.exports=mm&&typeof mm.get=="function"?MI([mm.get]):typeof Z_=="function"?function(e){return Z_(e==null?e:X_(e))}:!1});var gm=U((Uj,iy)=>{"use strict";m();var ey=dm(),ty=hm(),ry=J_();iy.exports=ey?function(e){return ey(e)}:ty?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return ty(e)}:ry?function(e){return ry(e)}:null});var sy=U((jj,ny)=>{"use strict";m();var DI=Function.prototype.call,OI=Object.prototype.hasOwnProperty,LI=Co();ny.exports=LI.call(DI,OI)});var bm=U((zj,fy)=>{"use strict";m();var Te,NI=cm(),BI=r_(),HI=n_(),UI=a_(),GI=l_(),$o=um(),Ro=ko(),jI=f_(),VI=h_(),zI=m_(),WI=v_(),qI=b_(),YI=y_(),ZI=E_(),KI=C_(),cy=Function,vm=function(t){try{return cy('"use strict"; return ('+t+").constructor;")()}catch(e){}},_c=Ao(),XI=bc(),wm=function(){throw new Ro},QI=_c?(function(){try{return arguments.callee,wm}catch(t){try{return _c(arguments,"callee").get}catch(e){return wm}}})():wm,To=D_()(),Vt=gm(),JI=hm(),eM=dm(),uy=Df(),yc=Mf(),Po={},tM=typeof Uint8Array=="undefined"||!Vt?Te:Vt(Uint8Array),aa={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Te:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Te:ArrayBuffer,"%ArrayIteratorPrototype%":To&&Vt?Vt([][Symbol.iterator]()):Te,"%AsyncFromSyncIteratorPrototype%":Te,"%AsyncFunction%":Po,"%AsyncGenerator%":Po,"%AsyncGeneratorFunction%":Po,"%AsyncIteratorPrototype%":Po,"%Atomics%":typeof Atomics=="undefined"?Te:Atomics,"%BigInt%":typeof BigInt=="undefined"?Te:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Te:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Te:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Te:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":BI,"%eval%":eval,"%EvalError%":HI,"%Float16Array%":typeof Float16Array=="undefined"?Te:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Te:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Te:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Te:FinalizationRegistry,"%Function%":cy,"%GeneratorFunction%":Po,"%Int8Array%":typeof Int8Array=="undefined"?Te:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Te:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Te:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":To&&Vt?Vt(Vt([][Symbol.iterator]())):Te,"%JSON%":typeof JSON=="object"?JSON:Te,"%Map%":typeof Map=="undefined"?Te:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!To||!Vt?Te:Vt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":NI,"%Object.getOwnPropertyDescriptor%":_c,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Te:Promise,"%Proxy%":typeof Proxy=="undefined"?Te:Proxy,"%RangeError%":UI,"%ReferenceError%":GI,"%Reflect%":typeof Reflect=="undefined"?Te:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Te:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!To||!Vt?Te:Vt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Te:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":To&&Vt?Vt(""[Symbol.iterator]()):Te,"%Symbol%":To?Symbol:Te,"%SyntaxError%":$o,"%ThrowTypeError%":QI,"%TypedArray%":tM,"%TypeError%":Ro,"%Uint8Array%":typeof Uint8Array=="undefined"?Te:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Te:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Te:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Te:Uint32Array,"%URIError%":jI,"%WeakMap%":typeof WeakMap=="undefined"?Te:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Te:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Te:WeakSet,"%Function.prototype.call%":yc,"%Function.prototype.apply%":uy,"%Object.defineProperty%":XI,"%Object.getPrototypeOf%":JI,"%Math.abs%":VI,"%Math.floor%":zI,"%Math.max%":WI,"%Math.min%":qI,"%Math.pow%":YI,"%Math.round%":ZI,"%Math.sign%":KI,"%Reflect.getPrototypeOf%":eM};if(Vt)try{null.error}catch(t){ay=Vt(Vt(t)),aa["%Error.prototype%"]=ay}var ay,rM=function t(e){var r;if(e==="%AsyncFunction%")r=vm("async function () {}");else if(e==="%GeneratorFunction%")r=vm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=vm("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Vt&&(r=Vt(n.prototype))}return aa[e]=r,r},oy={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},xc=Co(),Lf=sy(),iM=xc.call(yc,Array.prototype.concat),nM=xc.call(uy,Array.prototype.splice),ly=xc.call(yc,String.prototype.replace),Nf=xc.call(yc,String.prototype.slice),sM=xc.call(yc,RegExp.prototype.exec),aM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,oM=/\\(\\)?/g,lM=function(e){var r=Nf(e,0,1),i=Nf(e,-1);if(r==="%"&&i!=="%")throw new $o("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new $o("invalid intrinsic syntax, expected opening `%`");var n=[];return ly(e,aM,function(s,a,o,l){n[n.length]=o?ly(l,oM,"$1"):a||s}),n},cM=function(e,r){var i=e,n;if(Lf(oy,i)&&(n=oy[i],i="%"+n[0]+"%"),Lf(aa,i)){var s=aa[i];if(s===Po&&(s=rM(i)),typeof s=="undefined"&&!r)throw new Ro("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new $o("intrinsic "+e+" does not exist!")};fy.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Ro("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ro('"allowMissing" argument must be a boolean');if(sM(/^%?[^%]*%?$/,e)===null)throw new $o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=lM(e),n=i.length>0?i[0]:"",s=cM("%"+n+"%",r),a=s.name,o=s.value,l=!1,c=s.alias;c&&(n=c[0],nM(i,iM([0,1],c)));for(var u=1,f=!0;u=i.length){var g=_c(o,d);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[d]}else f=Lf(o,d),o=o[d];f&&!l&&(aa[a]=o)}}return o}});var _m=U((qj,py)=>{"use strict";m();var dy=bm(),hy=Of(),uM=hy([dy("%String.prototype.indexOf%")]);py.exports=function(e,r){var i=dy(e,!!r);return typeof i=="function"&&uM(e,".prototype.")>-1?hy([i]):i}});var wy=U((Zj,vy)=>{"use strict";m();var gy=Function.prototype.toString,Fo=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,xm,Bf;if(typeof Fo=="function"&&typeof Object.defineProperty=="function")try{xm=Object.defineProperty({},"length",{get:function(){throw Bf}}),Bf={},Fo(function(){throw 42},null,xm)}catch(t){t!==Bf&&(Fo=null)}else Fo=null;var fM=/^\s*class\b/,Em=function(e){try{var r=gy.call(e);return fM.test(r)}catch(i){return!1}},ym=function(e){try{return Em(e)?!1:(gy.call(e),!0)}catch(r){return!1}},Hf=Object.prototype.toString,dM="[object Object]",hM="[object Function]",pM="[object GeneratorFunction]",mM="[object HTMLAllCollection]",gM="[object HTML document.all class]",vM="[object HTMLCollection]",wM=typeof Symbol=="function"&&!!Symbol.toStringTag,bM=!(0 in[,]),Sm=function(){return!1};typeof document=="object"&&(my=document.all,Hf.call(my)===Hf.call(document.all)&&(Sm=function(e){if((bM||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var r=Hf.call(e);return(r===mM||r===gM||r===vM||r===dM)&&e("")==null}catch(i){}return!1}));var my;vy.exports=Fo?function(e){if(Sm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Fo(e,null,xm)}catch(r){if(r!==Bf)return!1}return!Em(e)&&ym(e)}:function(e){if(Sm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(wM)return ym(e);if(Em(e))return!1;var r=Hf.call(e);return r!==hM&&r!==pM&&!/^\[object HTML/.test(r)?!1:ym(e)}});var yy=U((Xj,_y)=>{"use strict";m();var _M=wy(),yM=Object.prototype.toString,by=Object.prototype.hasOwnProperty,xM=function(e,r,i){for(var n=0,s=e.length;n=3&&(n=i),kM(e)?xM(e,r,n):typeof e=="string"?EM(e,r,n):SM(e,r,n)}});var Ey=U((Jj,xy)=>{"use strict";m();xy.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var ky=U((tV,Sy)=>{"use strict";m();var km=Ey(),AM=typeof globalThis=="undefined"?global:globalThis;Sy.exports=function(){for(var e=[],r=0;r{"use strict";m();var Ay=bc(),CM=um(),Io=ko(),Cy=Ao();Ty.exports=function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Io("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Io("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Io("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Io("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Io("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Io("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!Cy&&Cy(e,r);if(Ay)Ay(e,r,{configurable:a===null&&l?l.configurable:!a,enumerable:n===null&&l?l.enumerable:!n,value:i,writable:s===null&&l?l.writable:!s});else if(o||!n&&!s&&!a)e[r]=i;else throw new CM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Fy=U((sV,$y)=>{"use strict";m();var Am=bc(),Ry=function(){return!!Am};Ry.hasArrayLengthDefineBug=function(){if(!Am)return null;try{return Am([],"length",{value:1}).length!==1}catch(e){return!0}};$y.exports=Ry});var Ly=U((oV,Oy)=>{"use strict";m();var TM=bm(),Iy=Py(),PM=Fy()(),My=Ao(),Dy=ko(),RM=TM("%Math.floor%");Oy.exports=function(e,r){if(typeof e!="function")throw new Dy("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||RM(r)!==r)throw new Dy("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&My){var a=My(e,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(s=!1)}return(n||s||!i)&&(PM?Iy(e,"length",r,!0,!0):Iy(e,"length",r)),e}});var By=U((cV,Ny)=>{"use strict";m();var $M=Co(),FM=Df(),IM=pm();Ny.exports=function(){return IM($M,FM,arguments)}});var Gy=U((fV,Uf)=>{"use strict";m();var MM=Ly(),Hy=bc(),DM=Of(),Uy=By();Uf.exports=function(e){var r=DM(arguments),i=1+e.length-(arguments.length-1);return MM(r,i>0?i:0,!0)};Hy?Hy(Uf.exports,"apply",{value:Uy}):Uf.exports.apply=Uy});var Vy=U((hV,jy)=>{"use strict";m();var OM=fm();jy.exports=function(){return OM()&&!!Symbol.toStringTag}});var Zy=U((mV,Yy)=>{"use strict";m();var Vf=yy(),LM=ky(),zy=Gy(),Tm=_m(),jf=Ao(),Gf=gm(),NM=Tm("Object.prototype.toString"),qy=Vy()(),Wy=typeof globalThis=="undefined"?global:globalThis,Cm=LM(),Pm=Tm("String.prototype.slice"),BM=Tm("Array.prototype.indexOf",!0)||function(e,r){for(var i=0;i-1}Yy.exports=function(e){if(!e||typeof e!="object")return!1;if(!qy){var r=Pm(NM(e),8,-1);return GM(r)?r:r!=="Object"?!1:UM(e)}return jf?HM(e):null}});var Xy=U((vV,Ky)=>{"use strict";m();var jM=Zy();Ky.exports=function(e){return!!jM(e)}});var Jy=U((bV,Qy)=>{"use strict";m();var VM=ko(),zM=_m(),WM=zM("TypedArray.prototype.buffer",!0),qM=Xy();Qy.exports=WM||function(e){if(!qM(e))throw new VM("Not a Typed Array");return e.buffer}});var rx=U((yV,tx)=>{"use strict";m();var Ni=$f().Buffer,YM=Qb(),ZM=Jy(),KM=ArrayBuffer.isView||function(e){try{return ZM(e),!0}catch(r){return!1}},XM=typeof Uint8Array!="undefined",ex=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",QM=ex&&(Ni.prototype instanceof Uint8Array||Ni.TYPED_ARRAY_SUPPORT);tx.exports=function(e,r){if(Ni.isBuffer(e))return e.constructor&&!("isBuffer"in e)?Ni.from(e):e;if(typeof e=="string")return Ni.from(e,r);if(ex&&KM(e)){if(e.byteLength===0)return Ni.alloc(0);if(QM){var i=Ni.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=Ni.from(n);if(s.length===e.byteLength)return s}if(XM&&e instanceof Uint8Array)return Ni.from(e);var a=YM(e);if(a)for(var o=0;o255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(a||Ni.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Ni.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var nx=U((EV,ix)=>{"use strict";m();var JM=$f().Buffer,eD=rx();function Wf(t,e){this._block=JM.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Wf.prototype.update=function(t,e){t=eD(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};Wf.prototype._update=function(){throw new Error("_update must be implemented by subclass")};ix.exports=Wf});var ox=U((kV,ax)=>{"use strict";m();var tD=Yb(),sx=nx(),rD=$f().Buffer,iD=[1518500249,1859775393,-1894007588,-899497514],nD=new Array(80);function Ec(){this.init(),this._w=nD,sx.call(this,64,56)}tD(Ec,sx);Ec.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function sD(t){return t<<1|t>>>31}function aD(t){return t<<5|t>>>27}function oD(t){return t<<30|t>>>2}function lD(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}Ec.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,a=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=sD(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=aD(r)+lD(c,i,n,s)+a+e[l]+iD[c]|0;a=s,s=n,n=oD(i),i=r,r=u}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};Ec.prototype._hash=function(){var t=rD.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};ax.exports=Ec});var cx=U(Rm=>{m();var lx;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof Rm=="object"?t(Rm):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(lx={}):t(lx={})})(function(t){t.version="1.2.2";function e(){for(var v=0,x=new Array(256),_=0;_!=256;++_)v=_,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,x[_]=v;return typeof Int32Array!="undefined"?new Int32Array(x):x}var r=e();function i(v){var x=0,_=0,P=0,T=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(P=0;P!=256;++P)T[P]=v[P];for(P=0;P!=256;++P)for(_=v[P],x=256+P;x<4096;x+=256)_=T[x]=_>>>8^v[_&255];var M=[];for(P=1;P!=16;++P)M[P-1]=typeof Int32Array!="undefined"?T.subarray(P*256,P*256+256):T.slice(P*256,P*256+256);return M}var n=i(r),s=n[0],a=n[1],o=n[2],l=n[3],c=n[4],u=n[5],f=n[6],d=n[7],h=n[8],p=n[9],g=n[10],w=n[11],y=n[12],b=n[13],S=n[14];function C(v,x){for(var _=x^-1,P=0,T=v.length;P>>8^r[(_^v.charCodeAt(P++))&255];return~_}function A(v,x){for(var _=x^-1,P=v.length-15,T=0;T>8&255]^y[v[T++]^_>>16&255]^w[v[T++]^_>>>24]^g[v[T++]]^p[v[T++]]^h[v[T++]]^d[v[T++]]^f[v[T++]]^u[v[T++]]^c[v[T++]]^l[v[T++]]^o[v[T++]]^a[v[T++]]^s[v[T++]]^r[v[T++]];for(P+=15;T>>8^r[(_^v[T++])&255];return~_}function k(v,x){for(var _=x^-1,P=0,T=v.length,M=0,$=0;P>>8^r[(_^M)&255]:M<2048?(_=_>>>8^r[(_^(192|M>>6&31))&255],_=_>>>8^r[(_^(128|M&63))&255]):M>=55296&&M<57344?(M=(M&1023)+64,$=v.charCodeAt(P++)&1023,_=_>>>8^r[(_^(240|M>>8&7))&255],_=_>>>8^r[(_^(128|M>>2&63))&255],_=_>>>8^r[(_^(128|$>>6&15|(M&3)<<4))&255],_=_>>>8^r[(_^(128|$&63))&255]):(_=_>>>8^r[(_^(224|M>>12&15))&255],_=_>>>8^r[(_^(128|M>>6&63))&255],_=_>>>8^r[(_^(128|M&63))&255]);return~_}t.table=r,t.bstr=C,t.buf=A,t.str=k})});var Hn=U(wr=>{"use strict";m();var cD=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function uD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}wr.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)uD(r,i)&&(t[i]=r[i])}}return t};wr.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var fD={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s{"use strict";m();var hD=Hn(),pD=4,ux=0,fx=1,mD=2;function Do(t){for(var e=t.length;--e>=0;)t[e]=0}var gD=0,vx=1,vD=2,wD=3,bD=258,Lm=29,Pc=256,kc=Pc+1+Lm,Mo=30,Nm=19,wx=2*kc+1,oa=15,$m=16,_D=7,Bm=256,bx=16,_x=17,yx=18,Dm=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],qf=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],yD=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],xx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],xD=512,Un=new Array((kc+2)*2);Do(Un);var Sc=new Array(Mo*2);Do(Sc);var Ac=new Array(xD);Do(Ac);var Cc=new Array(bD-wD+1);Do(Cc);var Hm=new Array(Lm);Do(Hm);var Yf=new Array(Mo);Do(Yf);function Fm(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}var Ex,Sx,kx;function Im(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Ax(t){return t<256?Ac[t]:Ac[256+(t>>>7)]}function Tc(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Fr(t,e,r){t.bi_valid>$m-r?(t.bi_buf|=e<>$m-t.bi_valid,t.bi_valid+=r-$m):(t.bi_buf|=e<>>=1,r<<=1;while(--e>0);return r>>>1}function ED(t){t.bi_valid===16?(Tc(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}function SD(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,p,g=0;for(d=0;d<=oa;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(d=l,g++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,h=0,u>=o&&(h=a[u-o]),p=r[u*2],t.opt_len+=p*(d+h),s&&(t.static_len+=p*(n[u*2+1]+h)));if(g!==0){do{for(d=l-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(d=l;d!==0;d--)for(u=t.bl_count[d];u!==0;)f=t.heap[--c],!(f>i)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),u--)}}function Tx(t,e,r){var i=new Array(oa+1),n=0,s,a;for(s=1;s<=oa;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=e;a++){var o=t[a*2+1];o!==0&&(t[a*2]=Cx(i[o]++,o))}}function kD(){var t,e,r,i,n,s=new Array(oa+1);for(r=0,i=0;i>=7;i8?Tc(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function AD(t,e,r,i){Rx(t),i&&(Tc(t,r),Tc(t,~r)),hD.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function dx(t,e,r,i){var n=e*2,s=r*2;return t[n]>1;a>=1;a--)Mm(t,r,a);c=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Mm(t,r,1),o=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=o,r[c*2]=r[a*2]+r[o*2],t.depth[c]=(t.depth[a]>=t.depth[o]?t.depth[a]:t.depth[o])+1,r[a*2+1]=r[o*2+1]=c,t.heap[1]=c++,Mm(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],SD(t,e),Tx(r,l,t.bl_count)}function px(t,e,r){var i,n=-1,s,a=e[1],o=0,l=7,c=4;for(a===0&&(l=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++o=3&&t.bl_tree[xx[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function TD(t,e,r,i){var n;for(Fr(t,e-257,5),Fr(t,r-1,5),Fr(t,i-4,4),n=0;n>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return ux;if(t.dyn_ltree[18]!==0||t.dyn_ltree[20]!==0||t.dyn_ltree[26]!==0)return fx;for(r=32;r0?(t.strm.data_type===mD&&(t.strm.data_type=PD(t)),Om(t,t.l_desc),Om(t,t.d_desc),a=CD(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?$x(t,e,r,i):t.strategy===pD||s===n?(Fr(t,(vx<<1)+(i?1:0),3),hx(t,Un,Sc)):(Fr(t,(vD<<1)+(i?1:0),3),TD(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),hx(t,t.dyn_ltree,t.dyn_dtree)),Px(t),i&&Rx(t)}function ID(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Cc[r]+Pc+1)*2]++,t.dyn_dtree[Ax(e)*2]++),t.last_lit===t.lit_bufsize-1}Oo._tr_init=RD;Oo._tr_stored_block=$x;Oo._tr_flush_block=FD;Oo._tr_tally=ID;Oo._tr_align=$D});var Um=U((IV,Ix)=>{"use strict";m();function MD(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+e[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}Ix.exports=MD});var Gm=U((DV,Mx)=>{"use strict";m();function DD(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var OD=DD();function LD(t,e,r,i){var n=OD,s=i+r;t^=-1;for(var a=i;a>>8^n[(t^e[a])&255];return t^-1}Mx.exports=LD});var Zf=U((LV,Dx)=>{"use strict";m();Dx.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Vx=U(hn=>{"use strict";m();var br=Hn(),mi=Fx(),Bx=Um(),ws=Gm(),ND=Zf(),fa=0,BD=1,HD=3,Es=4,Ox=5,dn=0,Lx=1,gi=-2,UD=-3,jm=-5,GD=-1,jD=1,Kf=2,VD=3,zD=4,WD=0,qD=2,td=8,YD=9,ZD=15,KD=8,XD=29,QD=256,zm=QD+1+XD,JD=30,eO=19,tO=2*zm+1,rO=15,$e=3,ys=258,Bi=ys+$e+1,iO=32,rd=42,Wm=69,Xf=73,Qf=91,Jf=103,la=113,$c=666,Ft=1,Fc=2,ca=3,Bo=4,nO=3;function xs(t,e){return t.msg=ND[e],e}function Nx(t){return(t<<1)-(t>4?9:0)}function _s(t){for(var e=t.length;--e>=0;)t[e]=0}function bs(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(br.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}function Kt(t,e){mi._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,bs(t.strm)}function Oe(t,e){t.pending_buf[t.pending++]=e}function Rc(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function sO(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,br.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=Bx(t.adler,e,n,r):t.state.wrap===2&&(t.adler=ws(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}function Hx(t,e){var r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-Bi?t.strstart-(t.w_size-Bi):0,c=t.window,u=t.w_mask,f=t.prev,d=t.strstart+ys,h=c[i+a-1],p=c[i+a];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(n=e,!(c[n+a]!==p||c[n+a-1]!==h||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&ia){if(t.match_start=e,a=s,s>=o)break;h=c[i+a-1],p=c[i+a]}}while((e=f[e&u])>l&&--r!==0);return a<=t.lookahead?a:t.lookahead}function ua(t){var e=t.w_size,r,i,n,s,a;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Bi)){br.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=sO(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=$e)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ua(t),t.lookahead===0&&e===fa)return Ft;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,Kt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Bi&&(Kt(t,!1),t.strm.avail_out===0))return Ft}return t.insert=0,e===Es?(Kt(t,!0),t.strm.avail_out===0?ca:Bo):(t.strstart>t.block_start&&(Kt(t,!1),t.strm.avail_out===0),Ft)}function Vm(t,e){for(var r,i;;){if(t.lookahead=$e&&(t.ins_h=(t.ins_h<=$e)if(i=mi._tr_tally(t,t.strstart-t.match_start,t.match_length-$e),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=$e){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=$e&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=$e-1)),t.prev_length>=$e&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-$e,i=mi._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-$e),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<=$e&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+ys;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=$e?(r=mi._tr_tally(t,1,t.match_length-$e),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=mi._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Kt(t,!1),t.strm.avail_out===0))return Ft}return t.insert=0,e===Es?(Kt(t,!0),t.strm.avail_out===0?ca:Bo):t.last_lit&&(Kt(t,!1),t.strm.avail_out===0)?Ft:Fc}function lO(t,e){for(var r;;){if(t.lookahead===0&&(ua(t),t.lookahead===0)){if(e===fa)return Ft;break}if(t.match_length=0,r=mi._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Kt(t,!1),t.strm.avail_out===0))return Ft}return t.insert=0,e===Es?(Kt(t,!0),t.strm.avail_out===0?ca:Bo):t.last_lit&&(Kt(t,!1),t.strm.avail_out===0)?Ft:Fc}function fn(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}var No;No=[new fn(0,0,0,0,aO),new fn(4,4,8,4,Vm),new fn(4,5,16,8,Vm),new fn(4,6,32,32,Vm),new fn(4,4,16,16,Lo),new fn(8,16,32,32,Lo),new fn(8,16,128,128,Lo),new fn(8,32,128,256,Lo),new fn(32,128,258,1024,Lo),new fn(32,258,258,4096,Lo)];function cO(t){t.window_size=2*t.w_size,_s(t.head),t.max_lazy_match=No[t.level].max_lazy,t.good_match=No[t.level].good_length,t.nice_match=No[t.level].nice_length,t.max_chain_length=No[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=$e-1,t.match_available=0,t.ins_h=0}function uO(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=td,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new br.Buf16(tO*2),this.dyn_dtree=new br.Buf16((2*JD+1)*2),this.bl_tree=new br.Buf16((2*eO+1)*2),_s(this.dyn_ltree),_s(this.dyn_dtree),_s(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new br.Buf16(rO+1),this.heap=new br.Buf16(2*zm+1),_s(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new br.Buf16(2*zm+1),_s(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ux(t){var e;return!t||!t.state?xs(t,gi):(t.total_in=t.total_out=0,t.data_type=qD,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?rd:la,t.adler=e.wrap===2?0:1,e.last_flush=fa,mi._tr_init(e),dn)}function Gx(t){var e=Ux(t);return e===dn&&cO(t.state),e}function fO(t,e){return!t||!t.state||t.state.wrap!==2?gi:(t.state.gzhead=e,dn)}function jx(t,e,r,i,n,s){if(!t)return gi;var a=1;if(e===GD&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>YD||r!==td||i<8||i>15||e<0||e>9||s<0||s>zD)return xs(t,gi);i===8&&(i=9);var o=new uO;return t.state=o,o.strm=t,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<Ox||e<0)return t?xs(t,gi):gi;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===$c&&e!==Es)return xs(t,t.avail_out===0?jm:gi);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===rd)if(i.wrap===2)t.adler=0,Oe(i,31),Oe(i,139),Oe(i,8),i.gzhead?(Oe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Oe(i,i.gzhead.time&255),Oe(i,i.gzhead.time>>8&255),Oe(i,i.gzhead.time>>16&255),Oe(i,i.gzhead.time>>24&255),Oe(i,i.level===9?2:i.strategy>=Kf||i.level<2?4:0),Oe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Oe(i,i.gzhead.extra.length&255),Oe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=ws(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Wm):(Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,i.level===9?2:i.strategy>=Kf||i.level<2?4:0),Oe(i,nO),i.status=la);else{var a=td+(i.w_bits-8<<4)<<8,o=-1;i.strategy>=Kf||i.level<2?o=0:i.level<6?o=1:i.level===6?o=2:o=3,a|=o<<6,i.strstart!==0&&(a|=iO),a+=31-a%31,i.status=la,Rc(i,a),i.strstart!==0&&(Rc(i,t.adler>>>16),Rc(i,t.adler&65535)),t.adler=1}if(i.status===Wm)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),bs(t),n=i.pending,i.pending===i.pending_buf_size));)Oe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=Xf)}else i.status=Xf;if(i.status===Xf)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),bs(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=Qf)}else i.status=Qf;if(i.status===Qf)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),bs(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=Jf)}else i.status=Jf;if(i.status===Jf&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&bs(t),i.pending+2<=i.pending_buf_size&&(Oe(i,t.adler&255),Oe(i,t.adler>>8&255),t.adler=0,i.status=la)):i.status=la),i.pending!==0){if(bs(t),t.avail_out===0)return i.last_flush=-1,dn}else if(t.avail_in===0&&Nx(e)<=Nx(r)&&e!==Es)return xs(t,jm);if(i.status===$c&&t.avail_in!==0)return xs(t,jm);if(t.avail_in!==0||i.lookahead!==0||e!==fa&&i.status!==$c){var l=i.strategy===Kf?lO(i,e):i.strategy===VD?oO(i,e):No[i.level].func(i,e);if((l===ca||l===Bo)&&(i.status=$c),l===Ft||l===ca)return t.avail_out===0&&(i.last_flush=-1),dn;if(l===Fc&&(e===BD?mi._tr_align(i):e!==Ox&&(mi._tr_stored_block(i,0,0,!1),e===HD&&(_s(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),bs(t),t.avail_out===0))return i.last_flush=-1,dn}return e!==Es?dn:i.wrap<=0?Lx:(i.wrap===2?(Oe(i,t.adler&255),Oe(i,t.adler>>8&255),Oe(i,t.adler>>16&255),Oe(i,t.adler>>24&255),Oe(i,t.total_in&255),Oe(i,t.total_in>>8&255),Oe(i,t.total_in>>16&255),Oe(i,t.total_in>>24&255)):(Rc(i,t.adler>>>16),Rc(i,t.adler&65535)),bs(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?dn:Lx)}function pO(t){var e;return!t||!t.state?gi:(e=t.state.status,e!==rd&&e!==Wm&&e!==Xf&&e!==Qf&&e!==Jf&&e!==la&&e!==$c?xs(t,gi):(t.state=null,e===la?xs(t,UD):dn))}function mO(t,e){var r=e.length,i,n,s,a,o,l,c,u;if(!t||!t.state||(i=t.state,a=i.wrap,a===2||a===1&&i.status!==rd||i.lookahead))return gi;for(a===1&&(t.adler=Bx(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(a===0&&(_s(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new br.Buf8(i.w_size),br.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=r,t.next_in=0,t.input=e,ua(i);i.lookahead>=$e;){n=i.strstart,s=i.lookahead-($e-1);do i.ins_h=(i.ins_h<{"use strict";m();var id=Hn(),zx=!0,Wx=!0;try{String.fromCharCode.apply(null,[0])}catch(t){zx=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Wx=!1}var Ic=new id.Buf8(256);for(Gn=0;Gn<256;Gn++)Ic[Gn]=Gn>=252?6:Gn>=248?5:Gn>=240?4:Gn>=224?3:Gn>=192?2:1;var Gn;Ic[254]=Ic[254]=1;Ho.string2buf=function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function qx(t,e){if(e<65534&&(t.subarray&&Wx||!t.subarray&&zx))return String.fromCharCode.apply(null,id.shrinkBuf(t,e));for(var r="",i=0;i4){o[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}n<65536?o[i++]=n:(n-=65536,o[i++]=55296|n>>10&1023,o[i++]=56320|n&1023)}return qx(o,i)};Ho.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Ic[t[r]]>e?r:e}});var Ym=U((jV,Yx)=>{"use strict";m();function gO(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Yx.exports=gO});var Qx=U(Oc=>{"use strict";m();var Mc=Vx(),Dc=Hn(),Km=qm(),Xm=Zf(),vO=Ym(),Xx=Object.prototype.toString,wO=0,Zm=4,Uo=0,Zx=1,Kx=2,bO=-1,_O=0,yO=8;function da(t){if(!(this instanceof da))return new da(t);this.options=Dc.assign({level:bO,method:yO,chunkSize:16384,windowBits:15,memLevel:8,strategy:_O,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new vO,this.strm.avail_out=0;var r=Mc.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Uo)throw new Error(Xm[r]);if(e.header&&Mc.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=Km.string2buf(e.dictionary):Xx.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Mc.deflateSetDictionary(this.strm,i),r!==Uo)throw new Error(Xm[r]);this._dict_set=!0}}da.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Zm:wO,typeof t=="string"?r.input=Km.string2buf(t):Xx.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Dc.Buf8(i),r.next_out=0,r.avail_out=i),n=Mc.deflate(r,s),n!==Zx&&n!==Uo)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Zm||s===Kx))&&(this.options.to==="string"?this.onData(Km.buf2binstring(Dc.shrinkBuf(r.output,r.next_out))):this.onData(Dc.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==Zx);return s===Zm?(n=Mc.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Uo):(s===Kx&&(this.onEnd(Uo),r.avail_out=0),!0)};da.prototype.onData=function(t){this.chunks.push(t)};da.prototype.onEnd=function(t){t===Uo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Dc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Qm(t,e){var r=new da(e);if(r.push(t,!0),r.err)throw r.msg||Xm[r.err];return r.result}function xO(t,e){return e=e||{},e.raw=!0,Qm(t,e)}function EO(t,e){return e=e||{},e.gzip=!0,Qm(t,e)}Oc.Deflate=da;Oc.deflate=Qm;Oc.deflateRaw=xO;Oc.gzip=EO});var e1=U((qV,Jx)=>{"use strict";m();var nd=30,SO=12;Jx.exports=function(e,r){var i,n,s,a,o,l,c,u,f,d,h,p,g,w,y,b,S,C,A,k,v,x,_,P,T;i=e.state,n=e.next_in,P=e.input,s=n+(e.avail_in-5),a=e.next_out,T=e.output,o=a-(r-e.avail_out),l=a+(e.avail_out-257),c=i.dmax,u=i.wsize,f=i.whave,d=i.wnext,h=i.window,p=i.hold,g=i.bits,w=i.lencode,y=i.distcode,b=(1<>>24,p>>>=A,g-=A,A=C>>>16&255,A===0)T[a++]=C&65535;else if(A&16){k=C&65535,A&=15,A&&(g>>=A,g-=A),g<15&&(p+=P[n++]<>>24,p>>>=A,g-=A,A=C>>>16&255,A&16){if(v=C&65535,A&=15,gc){e.msg="invalid distance too far back",i.mode=nd;break e}if(p>>>=A,g-=A,A=a-o,v>A){if(A=v-A,A>f&&i.sane){e.msg="invalid distance too far back",i.mode=nd;break e}if(x=0,_=h,d===0){if(x+=u-A,A2;)T[a++]=_[x++],T[a++]=_[x++],T[a++]=_[x++],k-=3;k&&(T[a++]=_[x++],k>1&&(T[a++]=_[x++]))}else{x=a-v;do T[a++]=T[x++],T[a++]=T[x++],T[a++]=T[x++],k-=3;while(k>2);k&&(T[a++]=T[x++],k>1&&(T[a++]=T[x++]))}}else if((A&64)===0){C=y[(C&65535)+(p&(1<>3,n-=k,g-=k<<3,p&=(1<{"use strict";m();var t1=Hn(),Go=15,r1=852,i1=592,n1=0,Jm=1,s1=2,kO=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],AO=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],CO=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],TO=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];a1.exports=function(e,r,i,n,s,a,o,l){var c=l.bits,u=0,f=0,d=0,h=0,p=0,g=0,w=0,y=0,b=0,S=0,C,A,k,v,x,_=null,P=0,T,M=new t1.Buf16(Go+1),$=new t1.Buf16(Go+1),D=null,Q=0,ye,de,J;for(u=0;u<=Go;u++)M[u]=0;for(f=0;f=1&&M[h]===0;h--);if(p>h&&(p=h),h===0)return s[a++]=1<<24|64<<16|0,s[a++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===n1||h!==1))return-1;for($[1]=0,u=1;ur1||e===s1&&b>i1)return 1;for(;;){ye=u-w,o[f]T?(de=D[Q+o[f]],J=_[P+o[f]]):(de=96,J=0),C=1<>w)+A]=ye<<24|de<<16|J|0;while(A!==0);for(C=1<>=1;if(C!==0?(S&=C-1,S+=C):S=0,f++,--M[u]===0){if(u===h)break;u=r[i+o[f]]}if(u>p&&(S&v)!==k){for(w===0&&(w=p),x+=d,g=u-w,y=1<r1||e===s1&&b>i1)return 1;k=S&v,s[k]=p<<24|g<<16|x-a|0}}return S!==0&&(s[x+S]=u-w<<24|64<<16|0),l.bits=p,0}});var G1=U(Hi=>{"use strict";m();var Zr=Hn(),sg=Um(),pn=Gm(),PO=e1(),Lc=o1(),RO=0,I1=1,M1=2,l1=4,$O=5,sd=6,ha=0,FO=1,IO=2,vi=-2,D1=-3,ag=-4,MO=-5,c1=8,O1=1,u1=2,f1=3,d1=4,h1=5,p1=6,m1=7,g1=8,v1=9,w1=10,ld=11,jn=12,eg=13,b1=14,tg=15,_1=16,y1=17,x1=18,E1=19,ad=20,od=21,S1=22,k1=23,A1=24,C1=25,T1=26,rg=27,P1=28,R1=29,nt=30,og=31,DO=32,OO=852,LO=592,NO=15,BO=NO;function $1(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function HO(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Zr.Buf16(320),this.work=new Zr.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function L1(t){var e;return!t||!t.state?vi:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=O1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Zr.Buf32(OO),e.distcode=e.distdyn=new Zr.Buf32(LO),e.sane=1,e.back=-1,ha)}function N1(t){var e;return!t||!t.state?vi:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,L1(t))}function B1(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?vi:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,N1(t))}function H1(t,e){var r,i;return t?(i=new HO,t.state=i,i.window=null,r=B1(t,e),r!==ha&&(t.state=null),r):vi}function UO(t){return H1(t,BO)}var F1=!0,ig,ng;function GO(t){if(F1){var e;for(ig=new Zr.Buf32(512),ng=new Zr.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Lc(I1,t.lens,0,288,ig,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Lc(M1,t.lens,0,32,ng,0,t.work,{bits:5}),F1=!1}t.lencode=ig,t.lenbits=9,t.distcode=ng,t.distbits=5}function U1(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<=s.wsize?(Zr.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),Zr.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(Zr.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=pn(r.check,_,2,0),c=0,u=0,r.mode=u1;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=nt;break}if((c&15)!==c1){t.msg="unknown compression method",r.mode=nt;break}if(c>>>=4,u-=4,v=(c&15)+8,r.wbits===0)r.wbits=v;else if(v>r.wbits){t.msg="invalid window size",r.mode=nt;break}r.dmax=1<>8&1),r.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,r.check=pn(r.check,_,2,0)),c=0,u=0,r.mode=f1;case f1:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>8&255,_[2]=c>>>16&255,_[3]=c>>>24&255,r.check=pn(r.check,_,4,0)),c=0,u=0,r.mode=d1;case d1:for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>8),r.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,r.check=pn(r.check,_,2,0)),c=0,u=0,r.mode=h1;case h1:if(r.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>>8&255,r.check=pn(r.check,_,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=p1;case p1:if(r.flags&1024&&(h=r.length,h>o&&(h=o),h&&(r.head&&(v=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Zr.arraySet(r.head.extra,i,s,h,v)),r.flags&512&&(r.check=pn(r.check,i,h,s)),o-=h,s+=h,r.length-=h),r.length))break e;r.length=0,r.mode=m1;case m1:if(r.flags&2048){if(o===0)break e;h=0;do v=i[s+h++],r.head&&v&&r.length<65536&&(r.head.name+=String.fromCharCode(v));while(v&&h>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=jn;break;case w1:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>=u&7,u-=u&7,r.mode=rg;break}for(;u<3;){if(o===0)break e;o--,c+=i[s++]<>>=1,u-=1,c&3){case 0:r.mode=b1;break;case 1:if(GO(r),r.mode=ad,e===sd){c>>>=2,u-=2;break e}break;case 2:r.mode=y1;break;case 3:t.msg="invalid block type",r.mode=nt}c>>>=2,u-=2;break;case b1:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=i[s++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=nt;break}if(r.length=c&65535,c=0,u=0,r.mode=tg,e===sd)break e;case tg:r.mode=_1;case _1:if(h=r.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;Zr.arraySet(n,i,s,h,a),o-=h,s+=h,l-=h,a+=h,r.length-=h;break}r.mode=jn;break;case y1:for(;u<14;){if(o===0)break e;o--,c+=i[s++]<>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=nt;break}r.have=0,r.mode=x1;case x1:for(;r.have>>=3,u-=3}for(;r.have<19;)r.lens[M[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},x=Lc(RO,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,x){t.msg="invalid code lengths set",r.mode=nt;break}r.have=0,r.mode=E1;case E1:for(;r.have>>24,b=w>>>16&255,S=w&65535,!(y<=u);){if(o===0)break e;o--,c+=i[s++]<>>=y,u-=y,r.lens[r.have++]=S;else{if(S===16){for(T=y+2;u>>=y,u-=y,r.have===0){t.msg="invalid bit length repeat",r.mode=nt;break}v=r.lens[r.have-1],h=3+(c&3),c>>>=2,u-=2}else if(S===17){for(T=y+3;u>>=y,u-=y,v=0,h=3+(c&7),c>>>=3,u-=3}else{for(T=y+7;u>>=y,u-=y,v=0,h=11+(c&127),c>>>=7,u-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=nt;break}for(;h--;)r.lens[r.have++]=v}}if(r.mode===nt)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=nt;break}if(r.lenbits=9,P={bits:r.lenbits},x=Lc(I1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,x){t.msg="invalid literal/lengths set",r.mode=nt;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},x=Lc(M1,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,x){t.msg="invalid distances set",r.mode=nt;break}if(r.mode=ad,e===sd)break e;case ad:r.mode=od;case od:if(o>=6&&l>=258){t.next_out=a,t.avail_out=l,t.next_in=s,t.avail_in=o,r.hold=c,r.bits=u,PO(t,d),a=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,c=r.hold,u=r.bits,r.mode===jn&&(r.back=-1);break}for(r.back=0;w=r.lencode[c&(1<>>24,b=w>>>16&255,S=w&65535,!(y<=u);){if(o===0)break e;o--,c+=i[s++]<>C)],y=w>>>24,b=w>>>16&255,S=w&65535,!(C+y<=u);){if(o===0)break e;o--,c+=i[s++]<>>=C,u-=C,r.back+=C}if(c>>>=y,u-=y,r.back+=y,r.length=S,b===0){r.mode=T1;break}if(b&32){r.back=-1,r.mode=jn;break}if(b&64){t.msg="invalid literal/length code",r.mode=nt;break}r.extra=b&15,r.mode=S1;case S1:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=k1;case k1:for(;w=r.distcode[c&(1<>>24,b=w>>>16&255,S=w&65535,!(y<=u);){if(o===0)break e;o--,c+=i[s++]<>C)],y=w>>>24,b=w>>>16&255,S=w&65535,!(C+y<=u);){if(o===0)break e;o--,c+=i[s++]<>>=C,u-=C,r.back+=C}if(c>>>=y,u-=y,r.back+=y,b&64){t.msg="invalid distance code",r.mode=nt;break}r.offset=S,r.extra=b&15,r.mode=A1;case A1:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=nt;break}r.mode=C1;case C1:if(l===0)break e;if(h=d-l,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=nt;break}h>r.wnext?(h-=r.wnext,p=r.wsize-h):p=r.wnext-h,h>r.length&&(h=r.length),g=r.window}else g=n,p=a-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do n[a++]=g[p++];while(--h);r.length===0&&(r.mode=od);break;case T1:if(l===0)break e;n[a++]=r.length,l--,r.mode=od;break;case rg:if(r.wrap){for(;u<32;){if(o===0)break e;o--,c|=i[s++]<{"use strict";m();j1.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var z1=U((tz,V1)=>{"use strict";m();function qO(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}V1.exports=qO});var q1=U(Bc=>{"use strict";m();var jo=G1(),Nc=Hn(),cd=qm(),bt=lg(),cg=Zf(),YO=Ym(),ZO=z1(),W1=Object.prototype.toString;function pa(t){if(!(this instanceof pa))return new pa(t);this.options=Nc.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new YO,this.strm.avail_out=0;var r=jo.inflateInit2(this.strm,e.windowBits);if(r!==bt.Z_OK)throw new Error(cg[r]);if(this.header=new ZO,jo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=cd.string2buf(e.dictionary):W1.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=jo.inflateSetDictionary(this.strm,e.dictionary),r!==bt.Z_OK)))throw new Error(cg[r])}pa.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,o,l,c,u=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?bt.Z_FINISH:bt.Z_NO_FLUSH,typeof t=="string"?r.input=cd.binstring2buf(t):W1.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Nc.Buf8(i),r.next_out=0,r.avail_out=i),s=jo.inflate(r,bt.Z_NO_FLUSH),s===bt.Z_NEED_DICT&&n&&(s=jo.inflateSetDictionary(this.strm,n)),s===bt.Z_BUF_ERROR&&u===!0&&(s=bt.Z_OK,u=!1),s!==bt.Z_STREAM_END&&s!==bt.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===bt.Z_STREAM_END||r.avail_in===0&&(a===bt.Z_FINISH||a===bt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=cd.utf8border(r.output,r.next_out),l=r.next_out-o,c=cd.buf2string(r.output,o),r.next_out=l,r.avail_out=i-l,l&&Nc.arraySet(r.output,r.output,o,l,0),this.onData(c)):this.onData(Nc.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==bt.Z_STREAM_END);return s===bt.Z_STREAM_END&&(a=bt.Z_FINISH),a===bt.Z_FINISH?(s=jo.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===bt.Z_OK):(a===bt.Z_SYNC_FLUSH&&(this.onEnd(bt.Z_OK),r.avail_out=0),!0)};pa.prototype.onData=function(t){this.chunks.push(t)};pa.prototype.onEnd=function(t){t===bt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Nc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ug(t,e){var r=new pa(e);if(r.push(t,!0),r.err)throw r.msg||cg[r.err];return r.result}function KO(t,e){return e=e||{},e.raw=!0,ug(t,e)}Bc.Inflate=pa;Bc.inflate=ug;Bc.inflateRaw=KO;Bc.ungzip=ug});var K1=U((sz,Z1)=>{"use strict";m();var XO=Hn().assign,QO=Qx(),JO=q1(),eL=lg(),Y1={};XO(Y1,QO,JO,eL);Z1.exports=Y1});var J1=U((oz,Q1)=>{"use strict";m();var X1=(t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...a)=>{e.errorFirst?a[0]?s(a):(a.shift(),n(a)):n(a)}):e.errorFirst?r.push((a,o)=>{a?s(a):n(o)}):r.push(n),t.apply(this,r)})};Q1.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=s=>{let a=o=>typeof o=="string"?s===o:o.test(s);return e.include?e.include.some(a):!e.exclude.some(a)},n;r==="function"?n=function(...s){return e.excludeMain?t(...s):X1(t,e).apply(this,s)}:n=Object.create(Object.getPrototypeOf(t));for(let s in t){let a=t[s];n[s]=typeof a=="function"&&i(s)?X1(a,e):a}return n}});var lE=U((cz,oE)=>{m();function eE(t){return Array.isArray(t)?t:[t]}var hg="",tE=" ",fg="\\",tL=/^\s+$/,rL=/(?:[^\\]|^)\\$/,iL=/^\\!/,nL=/^\\#/,sL=/\r?\n/g,aL=/^\.*\/|^\.+$/,dg="/",nE="node-ignore";typeof Symbol!="undefined"&&(nE=Symbol.for("node-ignore"));var rE=nE,oL=(t,e,r)=>Object.defineProperty(t,e,{value:r}),lL=/([0-z])-([0-z])/g,sE=()=>!1,cL=t=>t.replace(lL,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:hg),uL=t=>{let{length:e}=t;return t.slice(0,e-e%2)},fL=[[/^\uFEFF/,()=>hg],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?tE:hg)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+tE}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>fg],[/\\\\/g,()=>fg],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===fg?`\\[${r}${uL(i)}${n}`:n==="]"&&i.length%2===0?`[${cL(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],iE=Object.create(null),dL=(t,e)=>{let r=iE[t];return r||(r=fL.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),iE[t]=r),e?new RegExp(r,"i"):new RegExp(r)},gg=t=>typeof t=="string",hL=t=>t&&gg(t)&&!tL.test(t)&&!rL.test(t)&&t.indexOf("#")!==0,pL=t=>t.split(sL),pg=class{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}},mL=(t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(iL,"!").replace(nL,"#");let n=dL(t,e);return new pg(r,t,i,n)},gL=(t,e)=>{throw new e(t)},Vn=(t,e,r)=>gg(t)?t?Vn.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),aE=t=>aL.test(t);Vn.isNotRelative=aE;Vn.convert=t=>t;var mg=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){oL(this,rE,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[rE]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(hL(e)){let r=mL(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,eE(gg(e)?pL(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:a}=s;if(n===a&&i!==n||a&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!a,n=a)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&Vn.convert(e);return Vn(s,e,this._allowRelativePaths?sE:gL),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(dg)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(dg)+dg,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return eE(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},ud=t=>new mg(t),vL=t=>Vn(t&&Vn.convert(t),t,sE);ud.isPathValid=vL;ud.default=ud;oE.exports=ud;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Vn.convert=t;let e=/^[a-z]:\//i;Vn.isNotRelative=r=>e.test(r)||aE(r)}});var uE=U((fz,cE)=>{"use strict";m();function wL(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mn(t,e,r){return e=e instanceof RegExp?e:new RegExp(wL(e),"g"),t.replace(e,r)}var bL={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=mn(e,"./","/"),e=mn(e,"..","."),e=mn(e," ","-"),e=mn(e,/^[~^:?*\\\-]/g,""),e=mn(e,/[~^:?*\\]/g,"-"),e=mn(e,/[~^:?*\\\-]$/g,""),e=mn(e,"@{","-"),e=mn(e,/\.$/g,""),e=mn(e,/\/$/g,""),e=mn(e,/\.lock$/g,""),e}};cE.exports=bL});var dE=U((hz,fE)=>{m();fE.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=null,l=n+1,c=[],u=[],f=[],d="",h=-1,p=0,g=1,w,y,b=function(){n>=s&&(w=r,y=n,r=i,i=w,n=s,s=y,a=!0,l=n+1)},S=function(v,x,_){return{x:v,y:x,k:_}},C=function(v,x){return{elem:v,t:x}},A=function(v,x,_){var P,T,M;for(x>_?P=c[v-1+l]:P=c[v+1+l],M=Math.max(x,_),T=M-v;T=0;--M)for(;PT-P?(a?f[f.length]=new C(i[T],h):f[f.length]=new C(i[T],g),++_,++T):v[M].y-v[M].x=v+1;--D)_[D+l]=A(D,_[D-1+l]+1,_[D+1+l]);_[v+l]=A(v,_[v-1+l]+1,_[v+1+l])}while(_[v+l]!==s);for(o=v+2*P,T=c[v+l],M=[];T!==-1;)M[M.length]=new S(u[T].x,u[T].y,null),T=u[T].k;k(M)}}}});var mE=U((mz,pE)=>{m();var _L=dE();function yL(t,e){var r=new _L(t,e);r.compose();for(var i=r.getses(),n,s,a=t.length-1,o=e.length-1,l=i.length-1;l>=0;--l)i[l].t===r.SES_COMMON?(s?(s.chain={file1index:a,file2index:o,chain:null},s=s.chain):(n={file1index:a,file2index:o,chain:null},s=n),a--,o--):i[l].t===r.SES_DELETE?a--:i[l].t===r.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,n):c}function hE(t,e){for(var r=[],i=t.length,n=e.length,s=yL(t,e);s!==null;s=s.chain){var a=i-s.file1index-1,o=n-s.file2index-1;i=s.file1index,n=s.file2index,(a||o)&&r.push({file1:[i+1,a],file2:[n+1,o]})}return r.reverse(),r}function xL(t,e,r){var i,n=hE(e,t),s=hE(e,r),a=[];function o($,D){a.push([$.file1[0],D,$.file1[1],$.file2[0],$.file2[1]])}for(i=0;ic&&(l.push([1,c,$-c]),c=$)}for(var f=0;fg)break;g=Math.max(g,y+w[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var S=h[1],C=b[S],A=h[0],k=A+h[2],v=h[3],x=v+h[4];C[0]=Math.min(v,C[0]),C[1]=Math.max(x,C[1]),C[2]=Math.min(A,C[2]),C[3]=Math.max(k,C[3])}var _=b[0][0]+(p-b[0][2]),P=b[0][1]+(g-b[0][3]),T=b[2][0]+(p-b[2][2]),M=b[2][1]+(g-b[2][3]);l.push([-1,_,P-_,p,g-p,T,M-T])}c=g}return u(e.length),l}function EL(t,e,r){var i=[],n=[t,e,r],s=xL(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var p=0;p{"use strict";m();Object.defineProperty(Z,"__esModule",{value:!0});function Fs(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Uc=Fs(qb()),BE=Fs(ox()),SL=Fs(cx()),Ug=Fs(K1()),fd=Fs(J1()),kL=Fs(lE()),Gc=Fs(uE()),AL=Fs(mE()),Pe=class t 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 r=new t(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}},jc=class t extends Pe{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=t.code,this.data={filepaths:e}}};jc.code="UnmergedPathsError";var me=class t extends Pe{constructor(e){super(`An internal error caused this command to fail. + +If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment. + +Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};me.code="InternalError";var zo=class t extends Pe{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};zo.code="UnsafeFilepathError";var wi=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 Sd(t,e){return-(te)}function HE(t,e){return Sd(t.path,e.path)}function UE(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var gn=2**32;function gE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Wo(t){let[e,r]=gE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=gE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%gn,ctimeNanoseconds:r%gn,mtimeSeconds:i%gn,mtimeNanoseconds:n%gn,dev:t.dev%gn,ino:t.ino%gn,mode:UE(t.mode%gn),uid:t.uid%gn,gid:t.gid%gn,size:t.size>-1?t.size%gn:0}}function CL(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var vg=null;async function wn(t){return vg===null&&(vg=await PL()),vg?GE(t):TL(t)}function TL(t){return new BE().update(t).digest("hex")}async function GE(t){let e=await crypto.subtle.digest("SHA-1",t);return CL(e)}async function PL(){try{return await GE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function RL(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function $L(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(E.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Pg=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(E.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new me("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new me("Index file is empty (.git/index)");let r=new t,i=new wi(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new me(`Invalid dircache magic file number: ${n}`);let s=await wn(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new me(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new me(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&ce.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=Wo(r);let s=E.from(e),a={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:n,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(` +`)}static async _entryToBuffer(e){let r=E.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=E.alloc(i),s=new wi(n),a=Wo(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE($L(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=E.alloc(12),r=new wi(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=E.concat(i),s=E.concat([e,n]),a=await wn(s);return E.concat([s,E.from(a,"hex")])}};function pd(t,e,r=!0,i=!0){let n=Wo(t),s=Wo(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var wg=null,bg=Symbol("IndexCache");function FL(){return{map:new Map,stats:new Map}}async function IL(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await Pg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function ML(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:pd(i,n)}var dt=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[bg]||(i[bg]=FL());let a=`${r}/index`;wg===null&&(wg=new Uc({maxPending:1/0}));let o,l=[];return await wg.acquire(a,async()=>{let c=i[bg];await ML(e,a,c)&&await IL(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new jc(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 md(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function va(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function jE(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:md(n),metadata:{},children:[]};e.set(n,s),s.parent=r(va(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:md(n),metadata:s,parent:r(va(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 DL(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 me(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Rg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=dt.acquire({fs:e,gitdir:r,cache:i},async function(s){return jE(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(Sd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Wo(i.metadata);e._type=i.type==="tree"?"tree":DL(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}},kd=Symbol("GitWalkSymbol");function Ea(){let t=Object.create(null);return Object.defineProperty(t,kd,{value:function({fs:e,gitdir:r,cache:i}){return new Rg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var Ge=class t extends Pe{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Ge.code="NotFoundError";var _r=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}}};_r.code="ObjectTypeError";var As=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}}};As.code="InvalidOidError";var Vc=class t extends Pe{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following: +[remote "${e}"] + fetch = +refs/heads/*:refs/remotes/origin/* +`),this.code=this.name=t.code,this.data={remote:e}}};Vc.code="NoRefspecError";var gd=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(` +`)+` +`}},vd=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 me("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}},$g=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(vd.from(i));return new t(r)}add(e){let r=vd.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 OL(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(ri);return n===0?t.endsWith("^{}")?1:-1:n}function LL(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o2){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 NL(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=LL(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}function H(...t){if(t.length===0)return".";let e;for(let r=0;r0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":NL(e)}var BL=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},Hc=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}`)},vE={core:{filemode:Hc,bare:Hc,logallrefupdates:Hc,symlinks:Hc,ignorecase:Hc,bigFileThreshold:BL}},HL=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,UL=/^[A-Za-z0-9-.]+$/,GL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,jL=/^[A-Za-z][A-Za-z-]*$/,VL=/^(.*?)( *[#;].*)$/,zL=t=>{let e=HL.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},WL=t=>{let e=GL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=qL(i),s=YL(n);return[r,s]}return null},qL=t=>{let e=VL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return wE(r)&&wE(i)?`${r}${i}`:r},wE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,YL=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},""),bE=t=>t!=null?t.toLowerCase():null,Fg=(t,e,r)=>[bE(t),e,bE(r)].filter(i=>i!=null).join("."),_E=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:Fg(r,n,i),sectionPath:Fg(r,n,null),isSection:!!r}},ZL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Ig=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=zL(o),c=l!=null;if(c)[r,i]=l;else{let f=WL(o);f!=null&&([s,a]=f)}let u=Fg(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=_E(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=vE[s]&&vE[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}=_E(e),u=ZL(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(UL.test(n)&&jL.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(` +`)}},ht=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Ig.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},dd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],KL=["config","description","index","shallow","commondir"],_g;async function Ss(t,e){return _g===void 0&&(_g=new Uc),_g.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 w of n.values())if(!w.match(/[0-9a-f]{40}/))throw new As(w);let u=await ht.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Vc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=$g.from(o),d=new Map;if(c){let w=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:w.map(y=>`refs/tags/${y}`)})}if(a){for(let w of n.keys())if(w.startsWith("refs/tags")&&!w.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:w})){let y=n.get(w);d.set(w,y)}}let h=f.translate([...n.keys()]);for(let[w,y]of h){let b=n.get(w);d.set(y,b)}let p=f.translate([...s.keys()]);for(let[w,y]of p){let b=s.get(w),S=f.translateOne(b);S&&d.set(y,`ref: ${S}`)}let g=[];if(l){for(let w of f.localNamespaces()){let y=(await t.listRefs({fs:e,gitdir:r,filepath:w})).map(b=>`${w}/${b}`);for(let b of y)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[w,y]of d)await Ss(w,async()=>e.write(H(r,w),`${y.trim()} +`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new As(n);await Ss(i,async()=>e.write(H(r,i),`${n.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ss(i,async()=>e.write(H(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(H(r,o))));let n=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=gd.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.sizee.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await t.packedRefs({fs:e,gitdir:r}),a=dd(i).filter(o=>!KL.includes(o));for(let o of a){let l=await Ss(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||s.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:n})}throw new Ge(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=dd(i);for(let a of s)if(await Ss(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new Ge(i)}static async expandAgainstMap({ref:e,map:r}){let i=dd(e);for(let n of i)if(await r.has(n))return n;throw new Ge(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=dd(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 Ge(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return gd.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(OL),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 XL(t,e){return Sd(yE(t),yE(e))}function yE(t){return t.mode==="040000"?t.path+"/":t.path}function VE(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 me(`Unexpected GitTree entry mode: ${t}`)}function QL(t){let e=[],r=0;for(;r`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(XL),E.concat(e.map(r=>{let i=E.from(r.mode.replace(/^0/,"")),n=E.from(" "),s=E.from(r.path,"utf8"),a=E.from([0]),o=E.from(r.oid,"hex");return E.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Cs=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o>=1,n+=8;return i}function SE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=EE(t,r&n,4),o=EE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function rN(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function WE(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:rN(t)}var wd=class{constructor(e){if(typeof E=="undefined")throw new Error("Missing Buffer dependency");this.stream=WE(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)?E.alloc(0):(r&&(r=E.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>iN(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=E.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 iN(t){return t.reduce((e,r)=>e+r.length,0)}async function nN(t,e){let r=new wd(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new me(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new me(`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 sN(r),f=new Ug.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new me(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new me("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 sN(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)<n+1<<7|s,-1)}function cN(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<2048*1024*1024)throw new me("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+1020);let a=i.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=C);let A=Math.floor((u-C)*100/u);A!==f&&i&&await i({phase:"Receiving objects",loaded:u-C,total:u}),f=A,y=n[y],["commit","tree","blob","tag"].includes(y)?s[S]={type:y,offset:S}:y==="ofs-delta"?s[S]={type:y,offset:S}:y==="ref-delta"&&(s[S]={type:y,offset:S})});let d=Object.keys(s).map(Number);for(let[w,y]of d.entries()){let b=w+1===d.length?e.byteLength-20:d[w+1],S=s[y],C=SL.buf(e.slice(y,b))>>>0;S.end=b,S.crc=C}let h=new t({pack:Promise.resolve(e),packfileSha:a,crcs:l,hashes:o,offsets:c,getExternalRefDelta:r});f=null;let p=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let w in s){w=Number(w);let y=Math.floor(p*100/u);y!==f&&i&&await i({phase:"Resolving deltas",loaded:p,total:u}),p++,f=y;let b=s[w];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:S,object:C}=await h.readSlice({start:w});g[h.readDepth]+=1;let A=await wn(Cs.wrap({type:S,object:C}));b.oid=A,o.push(A),c.set(A,w),l[A]=b.crc}catch(S){continue}}return o.sort(),h}async toBuffer(){let e=[],r=(c,u)=>{e.push(E.from(c,u))};r("ff744f63","hex"),r("00000002","hex");let i=new wi(E.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=c&&u++;i.writeUInt32BE(u)}e.push(i.buffer);for(let c of this.hashes)r(c,"hex");let n=new wi(E.alloc(this.hashes.length*4));for(let c of this.hashes)n.writeUInt32BE(this.crcs[c]);e.push(n.buffer);let s=new wi(E.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),r(this.packfileSha,"hex");let a=E.concat(e),o=await wn(a),l=E.alloc(20);return l.write(o,"hex"),E.concat([a,l])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new me(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"},i=await this.pack;if(!i)throw new me("Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.");let n=i.slice(e),s=new wi(n),a=s.readUInt8(),o=a&112,l=r[o];if(l===void 0)throw new me("Unrecognized type: 0b"+o.toString(2));let c=a&15,u=c;a&128&&(u=cN(s,c));let d=null,h=null;if(l==="ofs_delta"){let g=lN(s),w=e-g;({object:d,type:l}=await this.readSlice({start:w}))}if(l==="ref_delta"){let g=s.slice(20).toString("hex");({object:d,type:l}=await this.read({oid:g}))}let p=n.slice(s.tell());if(h=E.from(await qE(p)),h.byteLength!==u)throw new me(`Packfile told us object would have length ${u} but it had length ${h.byteLength}`);return d&&(h=E.from(tN(h,d))),this.readDepth>3&&(this.offsetCache[e]={type:l,object:h}),{type:l,format:"content",object:h}}},hd=Symbol("PackfileCache");async function uN({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return zc.fromIdx({idx:s,getExternalRefDelta:r})}function Gg({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[hd]||(e[hd]=new Map);let a=e[hd].get(r);return a||(a=uN({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[hd].set(r,a)),a}async function fN({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let a=await t.readdir(H(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Gg({fs:t,cache:e,filename:l,getExternalRefDelta:s});if(c.error)throw new me(c.error);if(c.offsets.has(i)){let u=l.replace(/idx$/,"pack");c.pack||(c.pack=t.read(u));let f=await c.pack;if(!f)throw c.pack=null,new me(`Could not read packfile at ${u}. The file may be missing, corrupted, or too large to read into memory.`);if(!c._checksumVerified){let h=c.packfileSha,p=f.subarray(-20),g=Array.from(p).map(b=>b.toString(16).padStart(2,"0")).join("");if(g!==h)throw new me(`Packfile trailer mismatch: expected ${h}, got ${g}. The packfile may be corrupted.`);let w=f.subarray(0,-20),y=await wn(w);if(y!==h)throw new me(`Packfile payload corrupted: calculated ${y} but expected ${h}. The packfile may have been tampered with.`);c._checksumVerified=!0}let d=await c.read({oid:i,getExternalRefDelta:s});return d.format="content",d.source=`objects/pack/${o.replace(/idx$/,"pack")}`,d}}return null}async function et({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=u=>et({fs:t,cache:e,gitdir:r,oid:u}),a;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(a={format:"wrapped",object:E.from("tree 0\0")}),a||(a=await zE({fs:t,gitdir:r,oid:i})),!a){if(a=await fN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!a)throw new Ge(i);return a}if(n==="deflated"||(a.format==="deflated"&&(a.object=E.from(await qE(a.object)),a.format="wrapped"),n==="wrapped"))return a;let o=await wn(a.object);if(o!==i)throw new me(`SHA check failed! Expected ${i}, computed ${o}`);let{object:l,type:c}=Cs.unwrap(a.object);if(a.type=c,a.object=l,a.format="content",n==="content")return a;throw new me(`invalid requested format "${n}"`)}var Ui=class t extends Pe{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:i}}};Ui.code="AlreadyExistsError";var Wc=class t extends Pe{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:i}}};Wc.code="AmbiguousError";var qc=class t extends Pe{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};qc.code="CheckoutConflictError";var Yc=class t extends Pe{constructor(e,r){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${r} parents and require specifying which parent to use as the base.`),this.code=this.name=t.code,this.data={oid:e,parentCount:r}}};Yc.code="CherryPickMergeCommitError";var Zc=class t extends Pe{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=t.code,this.data={oid:e}}};Zc.code="CherryPickRootCommitError";var Kc=class t extends Pe{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=t.code,this.data={ref:e,oid:r}}};Kc.code="CommitNotFetchedError";var Xc=class t extends Pe{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};Xc.code="EmptyServerResponseError";var Qc=class t extends Pe{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Qc.code="FastForwardError";var Jc=class t extends Pe{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};Jc.code="GitPushError";var qo=class t extends Pe{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:i}}};qo.code="HttpError";var Ts=class t extends Pe{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=t.code,this.data={reason:e}}};Ts.code="InvalidFilepathError";var Gi=class t extends Pe{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:r}}};Gi.code="InvalidRefNameError";var eu=class t extends Pe{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};eu.code="MaxDepthError";var Yo=class t extends Pe{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Yo.code="MergeNotSupportedError";var wa=class t extends Pe{constructor(e,r,i,n){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=t.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};wa.code="MergeConflictError";var Xt=class t extends Pe{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=t.code,this.data={role:e}}};Xt.code="MissingNameError";var Ir=class t extends Pe{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Ir.code="MissingParameterError";var tu=class t extends Pe{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=t.code,this.data={errors:e},this.errors=e}};tu.code="MultipleGitError";var ba=class t extends Pe{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};ba.code="ParseError";var Zo=class t extends Pe{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Zo.code="PushRejectedError";var ks=class t extends Pe{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:r}}};ks.code="RemoteCapabilityError";var ru=class t extends Pe{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=t.code,this.data={preview:e,response:r}}};ru.code="SmartHttpError";var iu=class t extends Pe{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:i}}};iu.code="UnknownTransportError";var nu=class t extends Pe{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};nu.code="UrlParseError";var Ko=class t extends Pe{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Ko.code="UserCanceledError";var su=class t extends Pe{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=t.code,this.data={filepath:e}}};su.code="IndexResetError";var au=class t extends Pe{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=t.code,this.data={ref:e}}};au.code="NoCommitError";var YE=Object.freeze({__proto__:null,AlreadyExistsError:Ui,AmbiguousError:Wc,CheckoutConflictError:qc,CherryPickMergeCommitError:Yc,CherryPickRootCommitError:Zc,CommitNotFetchedError:Kc,EmptyServerResponseError:Xc,FastForwardError:Qc,GitPushError:Jc,HttpError:qo,InternalError:me,InvalidFilepathError:Ts,InvalidOidError:As,InvalidRefNameError:Gi,MaxDepthError:eu,MergeNotSupportedError:Yo,MergeConflictError:wa,MissingNameError:Xt,MissingParameterError:Ir,MultipleGitError:tu,NoRefspecError:Vc,NotFoundError:Ge,ObjectTypeError:_r,ParseError:ba,PushRejectedError:Zo,RemoteCapabilityError:ks,SmartHttpError:ru,UnknownTransportError:iu,UnsafeFilepathError:zo,UrlParseError:nu,UserCanceledError:Ko,UnmergedPathsError:jc,IndexResetError:su,NoCommitError:au});function Mg({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=dN(i),`${t} <${e}> ${r} ${i}`}function dN(t){let e=hN(pN(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}function hN(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function pN(t){return t===0?t:-t}function zn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function bd(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:mN(n)}}function mN(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),gN(i)}function gN(t){return t===0?t:-t}var Xr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(E.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new me("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object} +type ${e.type} +tag ${e.tag} +tagger ${Mg(e.tagger)} + +${e.message} +${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(` + +`))}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=bd(i.tagger)),i.committer&&(i.committer=bd(i.committer)),i}withoutSignature(){let e=zn(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 zn(e)}payload(){return this.withoutSignature()+` +`}toObject(){return E.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=zn(s);let a=n+s;return t.from(a)}};function xg(t){return t.trim().split(` +`).map(e=>" "+e).join(` +`)+` +`}function vN(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var Dr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(E.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new me("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=zn(i+` +gpgsig`+xg(r)+` +`+n);return new t(s)}static from(e){return new t(e)}toObject(){return E.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 zn(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=bd(i.author)),i.committer&&(i.committer=bd(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 me("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s} +`}let i=e.author;r+=`author ${Mg(i)} +`;let n=e.committer||e.author;return r+=`committer ${Mg(n)} +`,e.gpgsig&&(r+="gpgsig"+xg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+` +`+zn(e.message)}render(){return this._commit}withoutSignature(){let e=zn(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 zn(r+` +`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return vN(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=zn(a);let l=t.justHeaders(e._commit)+` +gpgsig`+xg(a)+` +`+s;return t.from(l)}};async function Xo({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Mr.from([]),oid:i};let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Xr.from(s).parse().object,Xo({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Dr.from(s).parse().tree,Xo({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new _r(i,n,"tree");return{tree:Mr.from(s),oid:i}}var Dg=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 Ge&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Xo({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 et({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new _r(l,c,o.type);let f=Mr.from(u);for(let d of f)a.set(H(r,d.path),d);return f.entries().map(d=>H(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=UE(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 et({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 Kr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,kd,{value:function({fs:r,gitdir:i,cache:n}){return new Dg({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var Og=class{constructor({fs:e,dir:r,gitdir:i,cache:n}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(H(n,r));return s===null?null:s.map(a=>H(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Wo(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await dt.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||pd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await wn(Cs.wrap({type:"blob",object:h})),l&&a===l.oid&&(!f||c.mode===l.mode)&&pd(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 ht.get({fs:e,gitdir:r}),this.config)}};function tl(){let t=Object.create(null);return Object.defineProperty(t,kd,{value:function({fs:e,dir:r,gitdir:i,cache:n}){return new Og({fs:e,dir:r,gitdir:i,cache:n})}}),Object.freeze(t),t}function wN(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var ZE=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Lg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:a=async(l,c)=>{let u=ZE(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=n.map(h=>h[kd]({fs:t,dir:r,gitdir:i,cache:e})),c=new Array(l.length).fill("."),u=wN(0,l.length),f=async h=>{u.forEach(w=>{let y=h[w];h[w]=y&&new l[w].ConstructEntry(y)});let g=(await Promise.all(u.map(w=>{let y=h[w];return y?l[w].readdir(y):[]}))).map(w=>(w===null?[]:w)[Symbol.iterator]());return{entries:h,children:bN(g)}},d=async h=>{let{entries:p,children:g}=await f(h),w=p.find(b=>b&&b._fullpath)._fullpath,y=await s(w,p);if(y!==null){let b=await o(d,g);return b=b.filter(S=>S!==void 0),a(y,b)}};return d(c)}async function Ng(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(i=>{let n=H(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?Ng(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function _N(t){return yN(t)&&kE(t.then)&&kE(t.catch)}function yN(t){return t&&typeof t=="object"}function kE(t){return typeof t=="function"}function AE(t){return _N((r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}})(t))}var CE=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function TE(t,e){if(AE(e))for(let r of CE)t[`_${r}`]=e[r].bind(e);else for(let r of CE)t[`_${r}`]=fd(e[r].bind(e));AE(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Ng.bind(null,t)):(e.cp&&(t._cp=fd(e.cp.bind(e))),e.rm?t._rm=fd(e.rm.bind(e)):e.rmdir.length>2?t._rm=fd(e.rmdir.bind(e)):t._rm=Ng.bind(null,t))}var te=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?TE(this,e.promises):TE(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(i){if(i.code==="ENOENT"||i.code==="ENOTDIR"||(i.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',i),i}}async read(e,r={}){try{let i=await this._readFile(e,r);if(r.autocrlf==="true")try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,` +`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=E.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(va(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=va(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(Sd),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 E.isBuffer(i)?i:E.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 Ir(t)}function xN(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=>xN(i)?i:H(va(e),i)):e}async function _d(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 KE({fs:t,dir:e,gitdir:r=H(e,".git"),commit:i="HEAD",cache:n={}}){try{R("fs",t),R("dir",e),R("gitdir",r);let s=new te(t),a=[Kr({ref:i}),tl(),Ea()],o=[],l=await ie({fsp:s,dotgit:r});await dt.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Ps({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await _d(d,h),g=o.includes(u),w=!await _d(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 su(u)}});await dt.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Rs=class{static async isIgnored({fs:e,dir:r,gitdir:i=H(r,".git"),filepath:n}){if(md(n)===".git")return!0;if(n===".")return!1;let s="",a=H(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:H(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u{let f=await(await ht.get({fs:o,gitdir:l})).get("core.autocrlf");return Bg({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 Bg({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:a,autocrlf:o}){i=Array.isArray(i)?i:[i];let l=i.map(async d=>{if(!s&&await Rs.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(H(t,d));if(!h)throw new Ge(d);if(h.isDirectory()){let p=await r.readdir(H(t,d));if(a){let g=p.map(w=>Bg({dir:t,gitdir:e,fs:r,filepath:[H(d,w)],index:n,force:s,parallel:a,autocrlf:o}));await Promise.all(g)}else for(let g of p)await Bg({dir:t,gitdir:e,fs:r,filepath:[H(d,g)],index:n,force:s,parallel:a,autocrlf:o})}else{let p=h.isSymbolicLink()?await r.readlink(H(t,d)).then(QE):await r.read(H(t,d),{autocrlf:o});if(p===null)throw new Ge(d);let g=await Or({fs:r,gitdir:e,type:"blob",object:p});n.insert({filepath:d,stats:h,oid:g})}}),c=await Promise.allSettled(l),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new tu(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function ou({fs:t,gitdir:e,path:r}){return(await ht.get({fs:t,gitdir:e})).get(r)}function eS(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}async function $s({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await ou({fs:t,gitdir:e,path:"user.name"}),email:await ou({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},a=eS({},s,i?i.author:void 0,r);if(a.name!==void 0)return a}async function _a({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),a={name:await ou({fs:t,gitdir:e,path:"user.name"}),email:await ou({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},o=eS({},a,n?n.committer:void 0,r,i);if(o.name!==void 0)return o}async function tS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Xr.from(s).parse().object,tS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new _r(i,n,"commit");return{commit:Dr.from(s),oid:i}}async function vn({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await tS({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}async function cu({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h}){let p=!1,g=!1;f||(g=!(await t.read(`${i}/HEAD`,{encoding:"utf8"})).startsWith("ref:"),f=await q.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let w,y;try{w=await q.resolve({fs:t,gitdir:i,ref:f}),y=await vn({fs:t,gitdir:i,oid:w,cache:{}})}catch(C){p=!0}if(l&&p)throw new au(f);let b=l?await $s({fs:t,gitdir:i,author:s,commit:y.commit}):await $s({fs:t,gitdir:i,author:s});if(!b)throw new Xt("author");let S=l?await _a({fs:t,gitdir:i,author:b,committer:a,commit:y.commit}):await _a({fs:t,gitdir:i,author:b,committer:a});if(!S)throw new Xt("committer");return dt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(C){let k=jE(C.entries).get(".");if(h||(h=await rS({fs:t,gitdir:i,inode:k,dryRun:c})),d?d=await Promise.all(d.map(_=>q.resolve({fs:t,gitdir:i,ref:_}))):l?d=y.commit.parent:d=w?[w]:[],!n)if(l)n=y.commit.message;else throw new Ir("message");let v=Dr.from({tree:h,parent:d,author:b,committer:S,message:n});o&&(v=await Dr.sign(v,r,o));let x=await Or({fs:t,gitdir:i,type:"commit",object:v.toObject(),dryRun:c});return!u&&!c&&await q.writeRef({fs:t,gitdir:i,ref:g?"HEAD":f,value:x}),x})}async function rS({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let l of n)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await rS({fs:t,gitdir:e,inode:l,dryRun:i}));let s=n.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),a=Mr.from(s);return await Or({fs:t,gitdir:e,type:"tree",object:a.toObject(),dryRun:i})}async function uu({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new Ts("leading-slash");if(n.endsWith("/"))throw new Ts("trailing-slash");let s=i,a=await Xo({fs:t,cache:e,gitdir:r,oid:i}),o=a.tree;if(n==="")i=a.oid;else{let l=n.split("/");i=await iS({fs:t,cache:e,gitdir:r,tree:o,pathArray:l,oid:s,filepath:n})}return i}async function iS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a}){let o=n.shift();for(let l of i)if(l.path===o){if(n.length===0)return l.oid;{let{type:c,object:u}=await et({fs:t,cache:e,gitdir:r,oid:l.oid});if(c!=="tree")throw new _r(s,c,"tree",a);return i=Mr.from(u),iS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a})}}throw new Ge(`file or directory found at "${s}:${a}"`)}async function rl({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await uu({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:a}=await Xo({fs:t,cache:e,gitdir:r,oid:i});return{oid:a,tree:s.entries()}}async function fu({fs:t,gitdir:e,tree:r}){let i=Mr.from(r).toObject();return await Or({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}async function AN({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:a,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await q.resolve({gitdir:i,fs:t,ref:n})}catch(y){if(!(y instanceof Ge))throw y}let h=(await rl({fs:t,cache:e,gitdir:i,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(y=>y.path!==s);else for(let y of h)if(y.path===s)throw new Ui("note",s);typeof a=="string"&&(a=E.from(a,"utf8"));let p=await Or({fs:t,gitdir:i,type:"blob",object:a,format:"content"});h.push({mode:"100644",path:s,oid:p,type:"blob"});let g=await fu({fs:t,gitdir:i,tree:h});return await cu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:c,signingKey:u})}async function nS({fs:t,onSign:e,dir:r,gitdir:i=H(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 $s({fs:d,gitdir:i,author:l});if(!h)throw new Xt("author");let p=await _a({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Xt("committer");let g=await ie({fsp:d,dotgit:i});return await AN({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 CN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function lu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!CN.test(t)&&(!!e||t.includes("/"))}async function sS({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!lu(r,!0))throw new Gi(r,Gc.clean(r));let s=await ht.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Ui("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await ht.save({fs:t,gitdir:e,config:s})}async function aS({fs:t,dir:e,gitdir:r=H(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 sS({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function TN({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 Ui("tag",n);let f=await q.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await et({fs:t,cache:e,gitdir:i,oid:f}),h=Xr.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await Xr.sign(h,r,c));let p=await Or({fs:t,gitdir:i,type:"tag",object:h.toObject()});await q.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function oS({fs:t,onSign:e,dir:r,gitdir:i=H(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 $s({fs:d,gitdir:h,author:s});if(!p)throw new Xt("tagger");return await TN({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 PN({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!lu(r,!0))throw new Gi(r,Gc.clean(r));let a=`refs/heads/${r}`;if(!s&&await q.exists({fs:t,gitdir:e,ref:a}))throw new Ui("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 lS({fs:t,dir:e,gitdir:r=H(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 PN({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}var cS=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function jg({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 w;if(i)try{w=await q.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(b){w="0000000000000000000000000000000000000000"}let y;try{y=await q.resolve({fs:t,gitdir:s,ref:o})}catch(b){if(o==="HEAD")throw b;let S=`${a}/${o}`;if(y=await q.resolve({fs:t,gitdir:s,ref:S}),h){let C=await ht.get({fs:t,gitdir:s});await C.set(`branch.${o}.remote`,a),await C.set(`branch.${o}.merge`,`refs/heads/${o}`),await ht.save({fs:t,gitdir:s,config:C})}await q.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:y})}if(!c){let b;try{b=await RN({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(v){throw v instanceof Ge&&v.data.what===y?new Kc(o,y):v}let S=b.filter(([v])=>v==="conflict").map(([v,x])=>x);if(S.length>0)throw new qc(S);let C=b.filter(([v])=>v==="error").map(([v,x])=>x);if(C.length>0)throw new me(C.join(", "));if(f){i&&await i({previousHead:w,newHead:y,type:l!=null&&l.length>0?"file":"branch"});return}let A=0,k=b.length;if(await dt.acquire({fs:t,gitdir:s,cache:e},async function(v){await Promise.all(b.filter(([x])=>x==="delete"||x==="delete-index").map(async function([x,_]){let P=`${n}/${_}`;x==="delete"&&await t.rm(P),v.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}))}),await dt.acquire({fs:t,gitdir:s,cache:e},async function(v){for(let[x,_]of b)if(x==="rmdir"||x==="rmdir-index"){let P=`${n}/${_}`;try{x==="rmdir"&&await t.rmdir(P),v.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}catch(T){if(T.code==="ENOTEMPTY")console.log(`Did not delete ${_} because directory is not empty`);else throw T}}}),await Promise.all(b.filter(([v])=>v==="mkdir"||v==="mkdir-index").map(async function([v,x]){let _=`${n}/${x}`;await t.mkdir(_),r&&await r({phase:"Updating workdir",loaded:++A,total:k})})),p){let v=b.filter(([_])=>_==="create"||_==="create-index"||_==="update"||_==="mkdir-index"),x=await PE("Update Working Dir",v.map(([_,P,T,M,$])=>()=>FN({fs:t,cache:e,gitdir:s,dir:n},[_,P,T,M,$])),r,g);await dt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(_){await PE("Update Index",x.map(([P,T,M])=>()=>$N({index:_,fullpath:P,oid:T,stats:M})),r,g)})}else await dt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await Promise.all(b.filter(([x])=>x==="create"||x==="create-index"||x==="update"||x==="mkdir-index").map(async function([x,_,P,T,M]){let $=`${n}/${_}`;try{if(x!=="create-index"&&x!=="mkdir-index"){let{object:Q}=await et({fs:t,cache:e,gitdir:s,oid:P});if(M&&await t.rm($),T===33188)await t.write($,Q);else if(T===33261)await t.write($,Q,{mode:511});else if(T===40960)await t.writelink($,Q);else throw new me(`Invalid mode 0o${T.toString(8)} detected in blob ${P}`)}let D=await t.lstat($);T===33261&&(D.mode=493),x==="mkdir-index"&&(D.mode=57344),v.insert({filepath:_,stats:D,oid:P}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}catch(D){console.log(D)}}))});i&&await i({previousHead:w,newHead:y,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let b=await q.expand({fs:t,gitdir:s,ref:o});b.startsWith("refs/heads")?await q.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:b}):await q.writeRef({fs:t,gitdir:s,ref:"HEAD",value:y})}}async function RN({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:a,filepaths:o}){let l=0;return Ps({fs:t,cache:e,dir:i,gitdir:n,trees:[Kr({ref:s}),tl(),Ea()],map:async function(c,[u,f,d]){if(c===".")return;if(o&&!o.some(p=>cS(c,p)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!d,!!u,!!f].map(Number).join("")){case"000":return;case"001":return a&&o&&o.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await f.oid()?a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?a?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir-index",c];case"blob":return await d.oid()!==await f.oid()?a?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!a)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(a)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=ZE(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function $N({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}async function FN({fs:t,cache:e,gitdir:r,dir:i},[n,s,a,o,l]){let c=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:f}=await et({fs:t,cache:e,gitdir:r,oid:a});if(l&&await t.rm(c),o===33188)await t.write(c,f);else if(o===33261)await t.write(c,f,{mode:511});else if(o===40960)await t.writelink(c,f);else throw new me(`Invalid mode 0o${o.toString(8)} detected in blob ${a}`)}let u=await t.lstat(c);return o===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,a,u]}async function PE(t,e,r,i){let n=[];try{for(let s=0;sl());(await Promise.allSettled(a)).forEach(l=>{l.status==="fulfilled"&&n.push(l.value)}),r&&await r({phase:"Updating workdir",loaded:s+a.length,total:e.length})}return n}catch(s){console.error(`Error during ${t}: ${s}`)}return n}async function Vg({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=H(i,".git"),remote:s="origin",ref:a,filepaths:o,noCheckout:l=!1,noUpdateHead:c=a===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:p=!1,batchSize:g=100}){try{R("fs",t),R("dir",i),R("gitdir",n);let w=a||"HEAD",y=new te(t),b=await ie({fsp:y,dotgit:n});return await jg({fs:y,cache:h,onProgress:e,onPostCheckout:r,dir:i,gitdir:b,remote:s,ref:w,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d,nonBlocking:p,batchSize:g})}catch(w){throw w.caller="git.checkout",w}}var Sg=/^.*(\r?\n|$)/gm;function IN({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],a=e[2],o=s.match(Sg),l=n.match(Sg),c=a.match(Sg),u=AL(o,l,c),f=7,d="",h=!0;for(let p of u)p.ok&&(d+=p.ok.join("")),p.conflict&&(h=!1,d+=`${"<".repeat(f)} ${r} +`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)} +`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${i} +`);return{cleanMerge:h,mergedText:d}}async function uS({fs:t,cache:e,dir:r,gitdir:i=H(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=Kr({ref:s}),g=Kr({ref:a}),w=Kr({ref:o}),y=[],b=[],S=[],C=[],A=await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,w],map:async function(k,[v,x,_]){let P=md(k),T=await _d(v,x),M=await _d(_,x);switch(`${T}-${M}`){case"false-false":return{mode:await x.mode(),path:P,oid:await x.oid(),type:await x.type()};case"false-true":return!_&&await v.type()==="tree"?{mode:await v.mode(),path:P,oid:await v.oid(),type:await v.type()}:_?{mode:await _.mode(),path:P,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return!v&&await _.type()==="tree"?{mode:await _.mode(),path:P,oid:await _.oid(),type:await _.type()}:v?{mode:await v.mode(),path:P,oid:await v.oid(),type:await v.type()}:void 0;case"true-true":{if(v&&_&&await v.type()==="tree"&&await _.type()==="tree")return{mode:await v.mode(),path:P,oid:await v.oid(),type:"tree"};if(v&&_&&await v.type()==="blob"&&await _.type()==="blob")return MN({fs:t,gitdir:i,path:P,ours:v,base:x,theirs:_,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async $=>{if($.cleanMerge)d||n.insert({filepath:k,oid:$.mergeResult.oid,stage:0});else if(y.push(k),b.push(k),!d){let D="";x&&await x.type()==="blob"&&(D=await x.oid());let Q=await v.oid(),ye=await _.oid();n.delete({filepath:k}),D&&n.insert({filepath:k,oid:D,stage:1}),n.insert({filepath:k,oid:Q,stage:2}),n.insert({filepath:k,oid:ye,stage:3})}return $.mergeResult});if(x&&!v&&_&&await x.type()==="blob"&&await _.type()==="blob"){if(y.push(k),S.push(k),!d){let $=await x.oid(),D=await _.oid();n.delete({filepath:k}),n.insert({filepath:k,oid:$,stage:1}),n.insert({filepath:k,oid:D,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:P}}if(x&&v&&!_&&await x.type()==="blob"&&await v.type()==="blob"){if(y.push(k),C.push(k),!d){let $=await x.oid(),D=await v.oid();n.delete({filepath:k}),n.insert({filepath:k,oid:$,stage:1}),n.insert({filepath:k,oid:D,stage:2})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:P}}if(x&&!v&&!_&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new Yo}}},reduce:y.length!==0&&(!r||d)?void 0:async(k,v)=>{let x=v.filter(Boolean);if(k&&!(k&&k.type==="tree"&&x.length===0&&k.path!==".")){if(x.length>0||k.path==="."&&x.length===0){let P=new Mr(x).toObject(),T=await Or({fs:t,gitdir:i,type:"tree",object:P,dryRun:f});k.oid=T}return k}}});return y.length!==0?(r&&!d&&await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[Kr({ref:A.oid})],map:async function(k,[v]){let x=`${r}/${k}`;if(await v.type()==="blob"){let _=await v.mode(),P=new TextDecoder().decode(await v.content());await t.write(x,P,{mode:_})}return!0}}),new wa(y,b,S,C)):A.oid}async function MN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=IN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=E.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 w=E.from(await i.content()).toString("utf8"),y=E.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:S}=await u({branches:[l,a,o],contents:[p,w,y],path:r}),C=await Or({fs:t,gitdir:e,type:"blob",object:E.from(b,"utf8"),dryRun:c});return{cleanMerge:S,mergeResult:{mode:g,path:r,oid:C,type:f}}}var DN={stage:Ea,workdir:tl},kg;async function Qo(t,e){return kg===void 0&&(kg=new Uc),kg.acquire(t,e)}async function ON(t,e,r,i,n=null){let s=H(r,i),a=await t.lstat(s);if(!a)throw new Ge(s);if(a.isDirectory())throw new me(`${s}: file expected, but found directory`);let o=n?await zE({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await Qo({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(QE):await t.read(s);if(c===null)throw new Ge(s);l=await Or({fs:t,gitdir:e,type:"blob",object:c})}),l}async function LN({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 fu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await ON(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 RE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?DN[h]():h),a=[],u=await Ps({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Rs.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&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?p:void 0),iterate:async(h,p)=>{let g=[];for(let w of p){let[y,b]=w;n?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(w):a.push([null,b])):y&&(b?g.push(w):a.push([y,null]))}return g.length?Promise.all(g.map(h)):[]}});if(a.length===0||u.length===0)return null;let d=(await LN({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return fu({fs:t,gitdir:r,tree:d})}async function fS({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let a=[],o=[],l=await Ps({fs:t,cache:{},dir:e,gitdir:r,trees:[Kr({ref:n}),Kr({ref:i})],map:async(c,[u,f])=>{if(c==="."||await Rs.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=f?await f.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!f&&u){let p=d==="tree"?"rmdir":"rm";return d==="tree"&&a.push(c),d==="blob"&&s&&o.push({filepath:c,oid:await u.oid()}),{method:p,filepath:c}}let h=await f.oid();if(!u||await u.oid()!==h)return d==="tree"?{method:"mkdir",filepath:c}:(s&&o.push({filepath:c,oid:h,stats:await t.lstat(H(e,c))}),{method:"write",filepath:c,oid:h})}});await Qo({fs:t,gitdir:r,dirRemoved:a,ops:l},async()=>{for(let c of l){let u=H(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!a.some(f=>u.startsWith(f))){let{object:f}=await et({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,f)}break}}}),await dt.acquire({fs:t,gitdir:r,cache:{}},async c=>{o.forEach(({filepath:u,stats:f,oid:d})=>{c.insert({filepath:u,stats:f,oid:d})})})}async function $E({fs:t,cache:e,dir:r,gitdir:i,oid:n,dryRun:s=!1,noUpdateBranch:a=!1,abortOnConflict:o=!0,committer:l,mergeDriver:c}){let{commit:u,oid:f}=await vn({fs:t,cache:e,gitdir:i,oid:n});if(u.parent.length>1)throw new Yc(f,u.parent.length);if(u.parent.length===0)throw new Zc(f);let d=await q.resolve({fs:t,gitdir:i,ref:"HEAD"}),{commit:h}=await vn({fs:t,cache:e,gitdir:i,oid:d}),p=u.parent[0],{commit:g}=await vn({fs:t,cache:e,gitdir:i,oid:p}),w=await dt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async b=>uS({fs:t,cache:e,dir:r,gitdir:i,index:b,ourOid:h.tree,baseOid:g.tree,theirOid:u.tree,ourName:"HEAD",baseName:`parent of ${f.slice(0,7)}`,theirName:f.slice(0,7),dryRun:s,abortOnConflict:o,mergeDriver:c}));if(w instanceof wa)throw w;let y=await cu({fs:t,cache:e,gitdir:i,message:u.message,tree:w,parent:[d],author:u.author,committer:l,dryRun:s,noUpdateBranch:a});return r&&!s&&!a&&await fS({fs:t,dir:r,gitdir:i,stashCommit:y,parentCommit:d,wasStaged:!0}),y}async function dS({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,cache:n={},committer:s,dryRun:a=!1,noUpdateBranch:o=!1,abortOnConflict:l=!0,mergeDriver:c}){try{R("fs",t),R("gitdir",r),R("oid",i);let u=new te(t),f=await ie({fsp:u,dotgit:r}),{commit:d}=await vn({fs:u,cache:n,gitdir:f,oid:i});if(d.parent&&d.parent.length>1)return await $E({fs:u,cache:n,dir:e,gitdir:f,oid:i,dryRun:a,noUpdateBranch:o,abortOnConflict:l,committer:void 0,mergeDriver:c});let h=await _a({fs:u,gitdir:f,committer:s});if(!h)throw new Xt("committer");return await $E({fs:u,cache:n,dir:e,gitdir:f,oid:i,dryRun:a,noUpdateBranch:o,abortOnConflict:l,committer:h,mergeDriver:c})}catch(u){throw u.caller="git.cherryPick",u}}var NN=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function ga(t){let e=NN.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function Is({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await q.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await q.resolve({fs:t,gitdir:e,ref:n})}catch(s){return}if(n.startsWith("refs/"))return r?n:ga(n)}function BN(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function hS({username:t="",password:e=""}){return`Basic ${E.from(`${t}:${e}`).toString("base64")}`}async function du(t,e){let r=WE(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}async function yd(t){let e=0,r=[];await du(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}function FE(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}function Hg(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var lt=class{static flush(){return E.from("0000","utf8")}static delim(){return E.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=E.from(e));let r=e.length+4,i=Hg(4,r);return E.concat([E.from(i,"utf8"),e])}static streamReader(e){let r=new wd(e);return async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s==null?!0:s}catch(n){return e.error=n,!0}}}};async function IE(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function ME(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=lt.streamReader(t),a=await s();for(;a===null;)a=await s();if(a===!0)throw new Xc;if(a.includes("version 2"))return IE(s);if(a.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new ba(`# service=${e}\\n`,a.toString("utf8"));let o=await s();for(;o===null;)o=await s();if(o===!0)return{capabilities:r,refs:i,symrefs:n};if(o=o.toString("utf8"),o.includes("version 2"))return IE(s);let[l,c]=Ag(o,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Ag(l," "," ");for(i.set(f,u);;){let d=await s();if(d===!0)break;if(d!==null){let[h,p]=Ag(d.toString("utf8")," "," ");i.set(p,h)}}}for(let u of r)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&n.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}function Ag(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new ba(`Two strings separated by '${r}'`,t.toString("utf8"));return i}var DE=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,OE=(t,e)=>{(e.username||e.password)&&(t.Authorization=hS(e)),e.headers&&Object.assign(t,e.headers)},Cg=async t=>{try{let e=E.from(await yd(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch(e){return{}}},Jo=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:a,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=FE(l),h=a?DE(a,f):f;(d.username||d.password)&&(c.Authorization=hS(d)),u===2&&(c["Git-Protocol"]="version=2");let p,g,w=!1;do if(p=await e.request({onProgress:r,method:"GET",url:`${h}/info/refs?service=${o}`,headers:c}),g=!1,p.statusCode===401||p.statusCode===203){let y=w?s:i;if(y){if(d=await y(f,{...d,headers:{...c}}),d&&d.cancel)throw new Ko;d&&(OE(c,d),w=!0,g=!0)}}else p.statusCode===200&&w&&n&&await n(f,d);while(g);if(p.statusCode!==200){let{response:y}=await Cg(p);throw new qo(p.statusCode,p.statusMessage,y)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let y=await ME(p.body,{service:o});return y.auth=d,y}else{let{preview:y,response:b,data:S}=await Cg(p);try{let C=await ME([S],{service:o});return C.auth=d,C}catch(C){throw new ru(y,b)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:a,body:o,headers:l}){let c=FE(s);c&&(s=c.url),i&&(s=DE(i,s)),l["content-type"]=`application/x-${n}-request`,l.accept=`application/x-${n}-result`,OE(l,a);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=Cg(u);throw new qo(u.statusCode,u.statusMessage,f)}return u}},el=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",Jo),r.set("https",Jo);let i=HN({url:e});if(!i)throw new nu(e);if(r.has(i.transport))return r.get(i.transport);throw new iu(e,i.transport,i.transport==="ssh"?BN(e):void 0)}};function HN({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}var ma=null,ya=class{static async read({fs:e,gitdir:r}){ma===null&&(ma=new Uc);let i=H(r,"shallow"),n=new Set;return await ma.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(` +`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){ma===null&&(ma=new Uc);let n=H(r,"shallow");if(i.size>0){let s=[...i].join(` +`)+` +`;await ma.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await ma.acquire(n,async function(){await e.rm(n)})}};async function UN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function GN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(H(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await Gg({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new me(l.error);if(l.offsets.has(i))return!0}return!1}async function LE({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>et({fs:t,cache:e,gitdir:r,oid:o}),a=await UN({fs:t,gitdir:r,oid:i});return a||(a=await GN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function jN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function pS(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 Ad={name:"isomorphic-git",version:"1.37.4",agent:"git/isomorphic-git@1.37.4"},Vo=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function VN(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 mS(t){let e=new Vo,r="";return(async()=>(await du(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=VN(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 xd=class{static demux(e){let r=lt.streamReader(e),i=new Vo,n=new Vo,s=new Vo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function zN(t){let{packetlines:e,packfile:r,progress:i}=xd.demux(t),n=[],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 As(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function WN({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(lt.encode(`want ${c}${l} +`)),l="";for(let c of i)o.push(lt.encode(`shallow ${c} +`));n!==null&&o.push(lt.encode(`deepen ${n} +`)),s!==null&&o.push(lt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)} +`));for(let c of a)o.push(lt.encode(`deepen-not ${c} +`));o.push(lt.flush());for(let c of r)o.push(lt.encode(`have ${c} +`));return o.push(lt.encode(`done +`)),o}async function zg({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:w=[],relative:y=!1,tags:b=!1,singleBranch:S=!1,headers:C={},prune:A=!1,pruneTags:k=!1}){let v=c||await Is({fs:t,gitdir:l,test:!0}),x=await ht.get({fs:t,gitdir:l}),_=f||v&&await x.get(`branch.${v}.remote`)||"origin",P=d||await x.get(`remote.${_}.url`);if(typeof P=="undefined")throw new Ir("remote OR url");let T=u||v&&await x.get(`branch.${v}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let M=el.getRemoteHelperFor({url:P}),$=await M.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:P,headers:C,protocolVersion:1}),D=$.auth,Q=$.refs;if(Q.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!$.capabilities.has("shallow"))throw new ks("shallow","depth");if(g!==null&&!$.capabilities.has("deepen-since"))throw new ks("deepen-since","since");if(w.length>0&&!$.capabilities.has("deepen-not"))throw new ks("deepen-not","exclude");if(y===!0&&!$.capabilities.has("deepen-relative"))throw new ks("deepen-relative","relative");let{oid:ye,fullref:de}=q.resolveAgainstMap({ref:T,map:Q});for(let B of Q.keys())B===de||B==="HEAD"||B.startsWith("refs/heads/")||b&&B.startsWith("refs/tags/")||Q.delete(B);let J=pS([...$.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ad.agent}`]);y&&J.push("deepen-relative");let X=S?[ye]:Q.values(),he=S?[v]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let B of he)try{B=await q.expand({fs:t,gitdir:l,ref:B});let N=await q.resolve({fs:t,gitdir:l,ref:B});await LE({fs:t,cache:e,gitdir:l,oid:N})&&z.push(N)}catch(N){}z=[...new Set(z)];let K=await ya.read({fs:t,gitdir:l}),G=$.capabilities.has("shallow")?[...K]:[],Me=WN({capabilities:J,wants:X,haves:z,shallows:G,depth:p,since:g,exclude:w}),Et=E.from(await yd(Me)),Ht=await M.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:P,auth:D,body:[Et],headers:C}),De=await zN(Ht.body);Ht.headers&&(De.headers=Ht.headers);for(let B of De.shallows)if(!K.has(B))try{let{object:N}=await et({fs:t,cache:e,gitdir:l,oid:B}),ue=new Dr(N),Re=await Promise.all(ue.headers().parent.map(Pr=>LE({fs:t,cache:e,gitdir:l,oid:Pr})));Re.length===0||Re.every(Pr=>Pr)||K.add(B)}catch(N){K.add(B)}for(let B of De.unshallows)K.delete(B);if(await ya.write({fs:t,gitdir:l,oids:K}),S){let B=new Map([[de,ye]]),N=new Map,ue=10,Re=de;for(;ue--;){let vo=$.symrefs.get(Re);if(vo===void 0)break;N.set(Re,vo),Re=vo}let Ut=Q.get(Re);Ut&&B.set(Re,Ut);let{pruned:Pr}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:B,symrefs:N,tags:b,prune:A});A&&(De.pruned=Pr)}else{let{pruned:B}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:Q,symrefs:$.symrefs,tags:b,prune:A,pruneTags:k});A&&(De.pruned=B)}if(De.HEAD=$.symrefs.get("HEAD"),De.HEAD===void 0){let{oid:B}=q.resolveAgainstMap({ref:"HEAD",map:Q});for(let[N,ue]of Q.entries())if(N!=="HEAD"&&ue===B){De.HEAD=N;break}}let Rt=de.startsWith("refs/tags")?"tag":"branch";if(De.FETCH_HEAD={oid:ye,description:`${Rt} '${ga(de)}' of ${P}`},i||n){let B=mS(De.progress);du(B,async N=>{if(n&&await n(N),i){let ue=N.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);ue&&await i({phase:ue[1].trim(),loaded:parseInt(ue[2],10),total:parseInt(ue[3],10)})}})}let $t=E.from(await yd(De.packfile));if(Ht.body.error)throw Ht.body.error;let Xe=$t.slice(-20).toString("hex"),re={defaultBranch:De.HEAD,fetchHead:De.FETCH_HEAD.oid,fetchHeadDescription:De.FETCH_HEAD.description};if(De.headers&&(re.headers=De.headers),A&&(re.pruned=De.pruned),Xe!==""&&!jN($t)){re.packfile=`objects/pack/pack-${Xe}.pack`;let B=H(l,re.packfile);await t.write(B,$t);let N=Re=>et({fs:t,cache:e,gitdir:l,oid:Re}),ue=await zc.fromPack({pack:$t,getExternalRefDelta:N,onProgress:i});await t.write(B.replace(/\.pack$/,".idx"),await ue.toBuffer())}return re}async function gS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:H(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core] + repositoryformatversion = 0 + filemode = false + bare = ${e} +`+(e?"":` logallrefupdates = true +`)+` symlinks = false + ignorecase = true +`),await t.write(i+"/HEAD",`ref: refs/heads/${n} +`)}async function qN({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:w,exclude:y,relative:b,singleBranch:S,noCheckout:C,noTags:A,headers:k,nonBlocking:v,batchSize:x=100}){try{if(await gS({fs:t,gitdir:u}),await sS({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let T=await ht.get({fs:t,gitdir:u});await T.set("http.corsProxy",d),await ht.save({fs:t,gitdir:u,config:T})}let{defaultBranch:_,fetchHead:P}=await zg({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:w,exclude:y,relative:b,singleBranch:S,headers:k,tags:!A});if(P===null)return;h=h||_,h=h.replace("refs/heads/",""),await jg({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:C,nonBlocking:v,batchSize:x})}catch(_){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function vS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=H(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:y=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:C=!1,headers:A={},cache:k={},nonBlocking:v=!1,batchSize:x=100}){try{R("fs",t),R("http",e),R("gitdir",c),S||R("dir",l),R("url",u);let _=new te(t),P=await ie({fsp:_,dotgit:c});return await qN({fs:_,cache:k,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:w,relative:y,singleBranch:b,noCheckout:S,noTags:C,headers:A,nonBlocking:v,batchSize:x})}catch(_){throw _.caller="git.clone",_}}async function wS({fs:t,onSign:e,dir:r,gitdir:i=H(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{R("fs",t),l||R("message",n),o&&R("onSign",e);let g=new te(t),w=await ie({fsp:g,dotgit:i});return await cu({fs:g,cache:p,onSign:e,gitdir:w,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function bS({fs:t,dir:e,gitdir:r=H(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 Is({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function YN({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 Ge(r);let n=await q.expand({fs:t,gitdir:e,ref:r}),s=await Is({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=ga(r),o=await ht.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await ht.save({fs:t,gitdir:e,config:o})}async function _S({fs:t,dir:e,gitdir:r=H(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 YN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function yS({fs:t,dir:e,gitdir:r=H(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 ZN({fs:t,gitdir:e,remote:r}){let i=await ht.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await ht.save({fs:t,gitdir:e,config:i})}async function xS({fs:t,dir:e,gitdir:r=H(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 ZN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function KN({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 ES({fs:t,dir:e,gitdir:r=H(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 KN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function XN({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 QN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(H(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Gg({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new me(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function JN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>et({fs:t,cache:e,gitdir:r,oid:o}),s=await XN({fs:t,gitdir:r,oid:i}),a=await QN({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 Wc("oids",i,s):new Ge(`an object matching "${i}"`)}async function SS({fs:t,dir:e,gitdir:r=H(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 JN({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.expandOid",s}}async function kS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i}){try{R("fs",t),R("gitdir",r),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await q.expand({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.expandRef",n}}async function Wg({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,a=i.map((o,l)=>({index:l,oid:o}));for(;a.length;){let o=new Set;for(let{oid:c,index:u}of a)n[c]||(n[c]=new Set),n[c].add(u),n[c].size===s&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of a)try{let{object:f}=await et({fs:t,cache:e,gitdir:r,oid:c}),d=Dr.from(f),{parent:h}=d.parseHeaders();for(let p of h)(!n[p]||!n[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}a=Array.from(l.values())}return[]}async function AS({fs:t,cache:e,dir:r,gitdir:i,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,onSign:g,mergeDriver:w,allowUnrelatedHistories:y=!1}){n===void 0&&(n=await Is({fs:t,gitdir:i,fullname:!0})),n=await q.expand({fs:t,gitdir:i,ref:n}),s=await q.expand({fs:t,gitdir:i,ref:s});let b=await q.resolve({fs:t,gitdir:i,ref:n}),S=await q.resolve({fs:t,gitdir:i,ref:s}),C=await Wg({fs:t,cache:e,gitdir:i,oids:[b,S]});if(C.length!==1)if(C.length===0&&y)C.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Yo;let A=C[0];if(A===S)return{oid:b,alreadyMerged:!0};if(a&&A===b)return!l&&!c&&await q.writeRef({fs:t,gitdir:i,ref:n,value:S}),{oid:S,fastForward:!0};{if(o)throw new Qc;let k=await dt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async x=>uS({fs:t,cache:e,dir:r,gitdir:i,index:x,ourOid:b,theirOid:S,baseOid:A,ourName:ga(n),baseName:"base",theirName:ga(s),dryRun:l,abortOnConflict:u,mergeDriver:w}));if(k instanceof wa)throw k;return f||(f=`Merge branch '${ga(s)}' into ${ga(n)}`),{oid:await cu({fs:t,cache:e,gitdir:i,message:f,ref:n,tree:k,parent:[b,S],author:d,committer:h,signingKey:p,onSign:g,dryRun:l,noUpdateBranch:c}),tree:k,mergeCommit:!0}}}async function CS({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:g,fastForward:w,fastForwardOnly:y,corsProxy:b,singleBranch:S,headers:C,author:A,committer:k,signingKey:v}){try{if(!u){let P=await Is({fs:t,gitdir:c});if(!P)throw new Ir("ref");u=P}let{fetchHead:x,fetchHeadDescription:_}=await zg({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:d,remoteRef:h,singleBranch:S,headers:C,prune:p,pruneTags:g});await AS({fs:t,cache:e,gitdir:c,ours:u,theirs:x,fastForward:w,fastForwardOnly:y,message:`Merge ${_}`,author:A,committer:k,signingKey:v,dryRun:!1,noUpdateBranch:!1}),await jg({fs:t,cache:e,onProgress:i,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(x){throw x.caller="git.pull",x}}async function TS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=H(o,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:p,headers:g={},cache:w={}}){try{R("fs",t),R("http",e),R("gitdir",l);let y={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},b=new te(t),S=await ie({fsp:b,dotgit:l});return await CS({fs:b,cache:w,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:S,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:g,author:y,committer:y})}catch(y){throw y.caller="git.fastForward",y}}async function PS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=H(o,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:w=[],relative:y=!1,tags:b=!1,singleBranch:S=!1,headers:C={},prune:A=!1,pruneTags:k=!1,cache:v={}}){try{R("fs",t),R("http",e),R("gitdir",l);let x=new te(t),_=await ie({fsp:x,dotgit:l});return await zg({fs:x,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,gitdir:_,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p,since:g,exclude:w,relative:y,tags:b,singleBranch:S,headers:C,prune:A,pruneTags:k})}catch(x){throw x.caller="git.fetch",x}}async function RS({fs:t,dir:e,gitdir:r=H(e,".git"),oids:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oids",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await Wg({fs:s,cache:n,gitdir:a,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}async function $S({fs:t,filepath:e}){if(await t.exists(H(e,".git")))return e;{let r=va(e);if(r===e)throw new Ge(`git root for ${e}`);return $S({fs:t,filepath:r})}}async function FS({fs:t,filepath:e}){try{return R("fs",t),R("filepath",e),await $S({fs:new te(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function IS({fs:t,dir:e,gitdir:r=H(e,".git"),path:i}){try{R("fs",t),R("gitdir",r),R("path",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await ou({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfig",n}}async function eB({fs:t,gitdir:e,path:r}){return(await ht.get({fs:t,gitdir:e})).getall(r)}async function MS({fs:t,dir:e,gitdir:r=H(e,".git"),path:i}){try{R("fs",t),R("gitdir",r),R("path",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await eB({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}async function DS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1}){try{R("http",t),R("url",s);let c=await el.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),p=h.pop(),g=u;for(let w of h)g[w]=g[w]||{},g=g[w];g[p]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),p=h.pop(),g=u;for(let w of h)g[w]=g[w]||{},g=g[w];g[p]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function OS(t,e,r,i){let n=[];for(let[s,a]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let l=s.replace("^{}",""),c=n[n.length-1],u=c.ref===l?c:n.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=a}continue}let o={ref:s,oid:a};r&&t.symrefs.has(s)&&(o.target=t.symrefs.get(s)),n.push(o)}return n}async function LS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2}){try{R("http",t),R("url",s);let u=await el.getRemoteHelperFor({url:s}).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(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let d of u.capabilities){let[h,p]=d.split("=");p?f[h]=p:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:OS(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function tB({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Cs.wrap({type:t,object:e})),i=await wn(e)),{oid:i,object:e}}async function NS({object:t}){try{R("object",t),typeof t=="string"?t=E.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await tB({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function rB({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=H(i,s);let a=await t.read(s),o=c=>et({fs:t,cache:e,gitdir:n,oid:c}),l=await zc.fromPack({pack:a,getExternalRefDelta:o,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(a){throw a.caller="git.indexPack",a}}async function BS({fs:t,onProgress:e,dir:r,gitdir:i=H(r,".git"),filepath:n,cache:s={}}){try{R("fs",t),R("dir",r),R("gitdir",r),R("filepath",n);let a=new te(t),o=await ie({fsp:a,dotgit:i});return await rB({fs:a,cache:s,onProgress:e,dir:r,gitdir:o,filepath:n})}catch(a){throw a.caller="git.indexPack",a}}async function HS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:H(r,".git"),defaultBranch:n="master"}){try{R("fs",t),R("gitdir",i),e||R("dir",r);let s=new te(t),a=await ie({fsp:s,dotgit:i});return await gS({fs:s,bare:e,dir:r,gitdir:a,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}async function US({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let a=await ya.read({fs:t,gitdir:r});if(!i)throw new Ir("oid");if(!n)throw new Ir("ancestor");if(i===n)return!1;let o=[i],l=new Set,c=0;for(;o.length;){if(c++===s)throw new eu(s);let u=o.shift(),{type:f,object:d}=await et({fs:t,cache:e,gitdir:r,oid:u});if(f!=="commit")throw new _r(u,f,"commit");let h=Dr.from(d).parse();for(let p of h.parent)if(p===n)return!0;if(!a.has(u))for(let p of h.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function GS({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:a={}}){try{R("fs",t),R("gitdir",r),R("oid",i),R("ancestor",n);let o=new te(t),l=await ie({fsp:o,dotgit:r});return await US({fs:o,cache:a,gitdir:l,oid:i,ancestor:n,depth:s})}catch(o){throw o.caller="git.isDescendent",o}}async function jS({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i}){try{R("fs",t),R("dir",e),R("gitdir",r),R("filepath",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return Rs.isIgnored({fs:n,dir:e,gitdir:s,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}async function VS({fs:t,dir:e,gitdir:r=H(e,".git"),remote:i}){try{R("fs",t),R("gitdir",r);let n=new te(t),s=await ie({fsp:n,dotgit:r});return q.listBranches({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.listBranches",n}}async function iB({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await q.resolve({gitdir:e,fs:t,ref:r}),s=[];return await zS({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return dt.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}async function zS({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:a}=await rl({fs:t,cache:e,gitdir:r,oid:i});for(let o of a)o.type==="tree"?await zS({fs:t,cache:e,gitdir:r,oid:o.oid,filenames:n,prefix:H(s,o.path)}):n.push(H(s,o.path))}async function WS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,cache:n={}}){try{R("fs",t),R("gitdir",r);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await iB({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listFiles",s}}async function nB({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await q.resolve({gitdir:r,fs:t,ref:i})}catch(o){if(o instanceof Ge)return[]}return(await rl({fs:t,cache:e,gitdir:r,oid:n})).tree.map(o=>({target:o.path,note:o.oid}))}async function qS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i="refs/notes/commits",cache: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 nB({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listNotes",s}}async function YS({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i}){try{R("fs",t),R("gitdir",r);let n=new te(t),s=await ie({fsp:n,dotgit:r});return q.listRefs({fs:n,gitdir:s,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}async function sB({fs:t,gitdir:e}){let r=await ht.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let a=await r.get(`remote.${s}.url`);return{remote:s,url:a}}))}async function ZS({fs:t,dir:e,gitdir:r=H(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new te(t),n=await ie({fsp:i,dotgit:r});return await sB({fs:i,gitdir:n})}catch(i){throw i.caller="git.listRemotes",i}}async function aB(t){let e=lt.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...a]=i.split(" "),o={ref:s,oid:n};for(let l of a){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}r.push(o)}return r}async function oB({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(lt.encode(`command=ls-refs +`)),i.push(lt.encode(`agent=${Ad.agent} +`)),(r||e||t)&&i.push(lt.delim()),r&&i.push(lt.encode("peel")),e&&i.push(lt.encode("symrefs")),t&&i.push(lt.encode(`ref-prefix ${t}`)),i.push(lt.flush()),i}async function KS({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 Jo.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return OS(d,c,u,f);let h=await oB({prefix:c,symrefs:u,peelTags:f}),p=await Jo.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return aB(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function XS({fs:t,dir:e,gitdir:r=H(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 lB(t,e){return t.committer.timestamp-e.committer.timestamp}var cB="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function NE({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===cB)return;let s=i,a,o=await Xo({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await QS({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 QS({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=H(o,c.path),a.push(u)):c.type==="tree"&&(u=et({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return QS({fs:t,cache:e,gitdir:r,tree:Mr.from(f),fileId:n,oid:s,filepaths:a,parentPath:H(o,c.path)})})),u});return await Promise.all(l),a}async function uB({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l}){let c=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),u=[],f=await ya.read({fs:t,gitdir:r}),d=await q.resolve({fs:t,gitdir:r,ref:n}),h=[await vn({fs:t,cache:e,gitdir:r,oid:d})],p,g,w;function y(b){w&&i&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(i){let S;try{S=await uu({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:i}),g&&p!==S&&u.push(g),p=S,g=b,w=!0}catch(C){if(C instanceof Ge){let A=l&&p;if(A&&(A=await NE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:p}),A))if(Array.isArray(A)){if(g){let k=await NE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:p});if(Array.isArray(k))if(A=A.filter(v=>k.indexOf(v)===-1),A.length===1)A=A[0],i=A,g&&u.push(g);else{A=!1,g&&u.push(g);break}}}else i=A,g&&u.push(g);if(!A){if(w&&p&&(u.push(g),!o))break;if(!o&&!l)throw C}g=b,w=!1}else throw C}}else u.push(b);if(s!==void 0&&u.length===s){y(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let C=await vn({fs:t,cache:e,gitdir:r,oid:S});h.map(A=>A.oid).includes(C.oid)||h.push(C)}h.length===0&&y(b),h.sort((S,C)=>lB(S.commit,C.commit))}return u}async function JS({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,cache:c={}}){try{R("fs",t),R("gitdir",r),R("ref",n);let u=new te(t),f=await ie({fsp:u,dotgit:r});return await uB({fs:u,cache:c,gitdir:f,filepath:i,ref:n,depth:s,since:a,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function ek({fs:t,onSign:e,dir:r,gitdir:i=H(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:w,allowUnrelatedHistories:y=!1}){try{R("fs",t),p&&R("onSign",e);let b=new te(t),S=await ie({fsp:b,dotgit:i}),C=await $s({fs:b,gitdir:S,author:d});if(!C&&(!o||!a))throw new Xt("author");let A=await _a({fs:b,gitdir:S,author:C,committer:h});if(!A&&(!o||!a))throw new Xt("committer");return await AS({fs:b,cache:g,dir:r,gitdir:S,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:C,committer:A,signingKey:p,onSign:e,mergeDriver:w,allowUnrelatedHistories:y})}catch(b){throw b.caller="git.merge",b}}var fB={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function tk({fs:t,cache:e,dir:r,gitdir:i=H(r,".git"),oids:n}){let s=new BE,a=[];function o(u,f){let d=E.from(u,f);a.push(d),s.update(d)}async function l({stype:u,object:f}){let d=fB[u],h=f.length,p=h>15?128:0,g=h&15;h=h>>>4;let w=(p|d|g).toString(16);for(o(w,"hex");p;)p=h>127?128:0,w=p|h&127,o(Hg(2,w),"hex"),h=h>>>7;o(E.from(await XE(f)))}o("PACK"),o("00000002","hex"),o(Hg(8,n.length),"hex");for(let u of n){let{type:f,object:d}=await et({fs:t,cache:e,gitdir:i,oid:u});await l({write:o,object:d,stype:f})}let c=s.digest();return a.push(c),a}async function dB({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await tk({fs:t,cache:e,gitdir:r,oids:i}),a=E.from(await yd(s)),l=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(H(r,`objects/pack/${l}`),a),{filename:l}):{filename:l,packfile:new Uint8Array(a)}}async function rk({fs:t,dir:e,gitdir:r=H(e,".git"),oids:i,write:n=!1,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oids",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await dB({fs:a,cache:s,gitdir:o,oids:i,write:n})}catch(a){throw a.caller="git.packObjects",a}}async function ik({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=H(o,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:g=!0,fastForwardOnly:w=!1,corsProxy:y,singleBranch:b,headers:S={},author:C,committer:A,signingKey:k,cache:v={}}){try{R("fs",t),R("gitdir",l);let x=new te(t),_=await ie({fsp:x,dotgit:l}),P=await $s({fs:x,gitdir:_,author:C});if(!P)throw new Xt("author");let T=await _a({fs:x,gitdir:_,author:P,committer:A});if(!T)throw new Xt("committer");return await CS({fs:x,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:_,ref:c,url:u,remote:f,remoteRef:d,fastForward:g,fastForwardOnly:w,corsProxy:y,singleBranch:b,headers:S,author:P,committer:T,signingKey:k,prune:h,pruneTags:p})}catch(x){throw x.caller="git.pull",x}}async function hB({fs:t,cache:e,dir:r,gitdir:i=H(r,".git"),start:n,finish:s}){let a=await ya.read({fs:t,gitdir:i}),o=new Set,l=new Set;for(let f of n)o.add(await q.resolve({fs:t,gitdir:i,ref:f}));for(let f of s)try{let d=await q.resolve({fs:t,gitdir:i,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await et({fs:t,cache:e,gitdir:i,oid:f});if(d==="tag"){let g=Xr.from(h).headers().object;return u(g)}if(d!=="commit")throw new _r(f,d,"commit");if(!a.has(f)){let g=Dr.from(h).headers().parent;for(f of g)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of o)await u(f);return c}async function Tg({fs:t,cache:e,dir:r,gitdir:i=H(r,".git"),oids:n}){let s=new Set;async function a(o){if(s.has(o))return;s.add(o);let{type:l,object:c}=await et({fs:t,cache:e,gitdir:i,oid:o});if(l==="tag"){let f=Xr.from(c).headers().object;await a(f)}else if(l==="commit"){let f=Dr.from(c).headers().tree;await a(f)}else if(l==="tree"){let u=Mr.from(c);for(let f of u)f.type==="blob"&&s.add(f.oid),f.type==="tree"&&await a(f.oid)}}for(let o of n)await a(o);return s}async function pB(t){let e={},r="",i=lt.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+` +`),n=await i();let s=r.toString("utf8").split(` +`);if(n=s.shift(),!n.startsWith("unpack "))throw new ba('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 mB({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(lt.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i} +`)),i="";return r.push(lt.flush()),r}async function gB({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:w,headers:y={}}){let b=u||await Is({fs:t,gitdir:c});if(typeof b=="undefined")throw new Ir("ref");let S=await ht.get({fs:t,gitdir:c});d=d||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let C=h||await S.get(`remote.${d}.pushurl`)||await S.get(`remote.${d}.url`);if(typeof C=="undefined")throw new Ir("remote OR url");let A=f||await S.get(`branch.${b}.merge`);if(typeof C=="undefined")throw new Ir("remoteRef");w===void 0&&(w=await S.get("http.corsProxy"));let k=await q.expand({fs:t,gitdir:c,ref:b}),v=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:k}),x=el.getRemoteHelperFor({url:C}),_=await x.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:w,service:"git-receive-pack",url:C,headers:y,protocolVersion:1}),P=_.auth,T;if(!A)T=k;else try{T=await q.expandAgainstMap({ref:A,map:_.refs})}catch(K){if(K instanceof Ge)T=A.startsWith("refs/")?A:`refs/heads/${A}`;else throw K}let M=_.refs.get(T)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:C,localRef:{ref:g?"(delete)":k,oid:v},remoteRef:{ref:T,oid:M}}))throw new Ko;let $=!_.capabilities.has("no-thin"),D=new Set;if(!g){let K=[..._.refs.values()],G=new Set;if(M!=="0000000000000000000000000000000000000000"){let Me=await Wg({fs:t,cache:e,gitdir:c,oids:[v,M]});for(let Et of Me)K.push(Et);$&&(G=await Tg({fs:t,cache:e,gitdir:c,oids:Me}))}if(!K.includes(v)){let Me=await hB({fs:t,cache:e,gitdir:c,start:[v],finish:K});D=await Tg({fs:t,cache:e,gitdir:c,oids:Me})}if($){try{let Me=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Et}=await q.resolveAgainstMap({ref:Me.replace(`refs/remotes/${d}/`,""),fullref:Me,map:_.refs}),Ht=[Et];for(let De of await Tg({fs:t,cache:e,gitdir:c,oids:Ht}))G.add(De)}catch(Me){}for(let Me of G)D.delete(Me)}if(v===M&&(p=!0),!p){if(k.startsWith("refs/tags")&&M!=="0000000000000000000000000000000000000000")throw new Zo("tag-exists");if(v!=="0000000000000000000000000000000000000000"&&M!=="0000000000000000000000000000000000000000"&&!await US({fs:t,cache:e,gitdir:c,oid:v,ancestor:M,depth:-1}))throw new Zo("not-fast-forward")}}let Q=pS([..._.capabilities],["report-status","side-band-64k",`agent=${Ad.agent}`]),ye=await mB({capabilities:Q,triplets:[{oldoid:M,oid:v,fullRef:T}]}),de=g?[]:await tk({fs:t,cache:e,gitdir:c,oids:[...D]}),J=await x.connect({http:r,onProgress:i,corsProxy:w,service:"git-receive-pack",url:C,auth:P,headers:y,body:[...ye,...de]}),{packfile:X,progress:he}=await xd.demux(J.body);if(n){let K=mS(he);du(K,async G=>{await n(G)})}let z=await pB(X);if(J.headers&&(z.headers=J.headers),d&&z.ok&&z.refs[T].ok&&!k.startsWith("refs/tags")){let K=`refs/remotes/${d}/${T.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:K}):await q.writeRef({fs:t,gitdir:c,ref:K,value:v})}if(z.ok&&Object.values(z.refs).every(K=>K.ok))return z;{let K=Object.entries(z.refs).filter(([G,Me])=>!Me.ok).map(([G,Me])=>` + - ${G}: ${Me.error}`).join("");throw new Jc(K,z)}}async function nk({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=H(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:w,headers:y={},cache:b={}}){try{R("fs",t),R("http",e),R("gitdir",c);let S=new te(t),C=await ie({fsp:S,dotgit:c});return await gB({fs:S,cache:b,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:C,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:w,headers:y})}catch(S){throw S.caller="git.push",S}}async function sk({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Xr.from(s).parse().object,sk({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new _r(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function ak({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await uu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await sk({fs:t,cache:e,gitdir:r,oid:i})}async function ok({fs:t,dir:e,gitdir:r=H(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 ak({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function qg({fs:t,dir:e,gitdir:r=H(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 vn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function vB({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 ak({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function lk({fs:t,dir:e,gitdir:r=H(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 vB({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function ck({fs:t,dir:e,gitdir:r=H(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 uu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await et({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=Dr.from(f.object).parse();break;case"tree":f.object=Mr.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=Xr.from(f.object).parse();break;default:throw new _r(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 wB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new _r(i,n,"tag");let a=Xr.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function uk({fs:t,dir:e,gitdir:r=H(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 wB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function fk({fs:t,dir:e,gitdir:r=H(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 rl({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function dk({fs:t,dir:e,gitdir:r=H(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 dt.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function bB({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 Ge))throw p}let f=(await rl({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await fu({fs:t,gitdir:i,tree:f});return await cu({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 hk({fs:t,onSign:e,dir:r,gitdir:i=H(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 $s({fs:u,gitdir:f,author:a});if(!d)throw new Xt("author");let h=await _a({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Xt("committer");return await bB({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 _B({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!lu(i,!0))throw new Gi(i,Gc.clean(i));if(!lu(r,!0))throw new Gi(r,Gc.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await q.exists({fs:t,gitdir:e,ref:a}))throw new Ui("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 Is({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function pk({fs:t,dir:e,gitdir:r=H(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 _B({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function mk({gitdir:t,type:e,object:r}){return wn(Cs.wrap({type:e,object:r}))}async function gk({fs:t,dir:e,gitdir:r=H(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 uu({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(H(e,i));f&&(c=await mk({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(H(e,i)))),await dt.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 vk({fs:t,dir:e,gitdir:r=H(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 wk({fs:t,dir:e,gitdir:r=H(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 ht.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await ht.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function bk({fs:t,gitdir:e,commit:r}){let i=Dr.from(r).toObject();return await Or({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var Ed=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)}},xa=class t{constructor({fs:e,dir:r,gitdir:i=H(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 H(this.gitdir,t.refStash)}get refLogsStashPath(){return H(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await $s({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Xt("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 bk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Gi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?vn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return 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=Ed.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await Qo({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Ed.getStashReflogEntry(r,e)}};async function _k({fs:t,dir:e,gitdir:r,message:i=""}){let n=new xa({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Is({fs:t,gitdir:r,fullname:!1}),a=await q.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await qg({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Kr({ref:"HEAD"}),d=await RE({fs:t,dir:e,gitdir:r,treePair:[Kr({ref:"HEAD"}),"stage"]});if(d){let w=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(w),u=d,f=Ea()}let h=await RE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let w=await n.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 Ge("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 yB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await _k({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await Vg({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function xB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await _k({fs:t,dir:e,gitdir:r,message:i});return n}async function yk({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new xa({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{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await Qo({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(` +`)+` +`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function EB({fs:t,dir:e,gitdir:r}){return new xa({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function SB({fs:t,dir:e,gitdir:r}){let i=new xa({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await Qo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function kB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await yk({fs:t,dir:e,gitdir:r,refIdx:i}),await xk({fs:t,dir:e,gitdir:r,refIdx:i})}async function Ek({fs:t,dir:e,gitdir:r=H(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:yB,apply:yk,drop:xk,list:EB,clear:SB,pop:kB,create:xB},o=["apply","drop","pop"];try{let l=new te(t),c=await ie({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>H(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new Gi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function Sk({fs:t,dir:e,gitdir:r=H(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});if(await Rs.isIgnored({fs:s,gitdir:a,dir:e,filepath:i}))return"ignored";let l=await AB({fs:s,cache:n,gitdir:a}),c=await kk({fs:s,cache:n,gitdir:a,tree:l,path:i}),u=await dt.acquire({fs:s,gitdir:a,cache:n},async function(w){for(let y of w)if(y.path===i)return y;return null}),f=await s.lstat(H(e,i)),d=c!==null,h=u!==null,p=f!==null,g=async()=>{if(h&&!pd(u,f))return u.oid;{let w=await s.read(H(e,i)),y=await mk({gitdir:a,type:"blob",object:w});return h&&u.oid===y&&f.size!==-1&&dt.acquire({fs:s,gitdir:a,cache:n},async function(b){b.insert({filepath:i,stats:f,oid:y})}),y}};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(s){throw s.caller="git.status",s}}async function kk({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 et({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Mr.from(l);return kk({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new _r(a.oid,o,"blob",n.join("/"))}return null}async function AB({fs:t,cache:e,gitdir:r}){let i;try{i=await q.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof Ge)return[]}let{tree:n}=await rl({fs:t,cache:e,gitdir:r,oid:i});return n}async function Ak({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});return await Ps({fs:l,cache:a,dir:e,gitdir:c,trees:[Kr({ref:i}),tl(),Ea()],map:async function(u,[f,d,h]){if(!f&&!h&&d&&!o&&await Rs.isIgnored({fs:l,dir:e,filepath:u})||!n.some(v=>cS(u,v)))return null;if(s&&!s(u))return;let[p,g,w]=await Promise.all([f&&f.type(),d&&d.type(),h&&h.type()]),y=[p,g,w].includes("blob");if((p==="tree"||p==="special")&&!y)return;if(p==="commit")return null;if((g==="tree"||g==="special")&&!y)return;if(w==="commit")return null;if((w==="tree"||w==="special")&&!y)return;let b=p==="blob"?await f.oid():void 0,S=w==="blob"?await h.oid():void 0,C;p!=="blob"&&g==="blob"&&w!=="blob"?C="42":g==="blob"&&(C=await d.oid());let A=[void 0,b,C,S],k=A.map(v=>A.indexOf(v));return k.shift(),[u,...k]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function Ck({fs:t,dir:e,gitdir:r=H(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 Ir("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 Ui("tag",i);await q.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function Tk({fs:t,dir:e,gitdir:r=H(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 dt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(H(e,n));if(p){if(p.isDirectory())throw new Ts("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(H(e,n)),!d)throw new Ge(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Ts("directory")}return await dt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o&&!h.has({filepath:n}))throw new Ge(`file at "${n}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:a,uid:0,gid:0,size:0};else{p=d;let g=p.isSymbolicLink()?await u.readlink(H(e,n)):await u.read(H(e,n));s=await Or({fs:u,gitdir:f,type:"blob",format:"content",object:g})}return h.insert({filepath:n,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}function Pk(){try{return Ad.version}catch(t){throw t.caller="git.version",t}}async function Rk({fs:t,dir:e,gitdir:r=H(e,".git"),trees:i,map:n,reduce:s,iterate:a,cache:o={}}){try{R("fs",t),R("gitdir",r),R("trees",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});return await Ps({fs:l,cache:o,dir:e,gitdir:c,trees:i,map:n,reduce:s,iterate:a})}catch(l){throw l.caller="git.walk",l}}async function $k({fs:t,dir:e,gitdir:r=H(e,".git"),blob:i}){try{R("fs",t),R("gitdir",r),R("blob",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await Or({fs:n,gitdir:s,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}async function Fk({fs:t,dir:e,gitdir:r=H(e,".git"),commit:i}){try{R("fs",t),R("gitdir",r),R("commit",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await bk({fs:n,gitdir:s,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}async function Ik({fs:t,dir:e,gitdir:r=H(e,".git"),type:i,object:n,format:s="parsed",oid:a,encoding:o=void 0}){try{let l=new te(t),c=await ie({fsp:l,dotgit:r});if(s==="parsed"){switch(i){case"commit":n=Dr.from(n).toObject();break;case"tree":n=Mr.from(n).toObject();break;case"blob":n=E.from(n,o);break;case"tag":n=Xr.from(n).toObject();break;default:throw new _r(a||"",i,"blob|commit|tag|tree")}s="content"}return a=await Or({fs:l,gitdir:c,type:i,object:n,oid:a,format:s}),a}catch(l){throw l.caller="git.writeObject",l}}async function Mk({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,value:n,force:s=!1,symbolic:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("value",n);let o=new te(t);if(!lu(i,!0))throw new Gi(i,Gc.clean(i));let l=await ie({fsp:o,dotgit:r});if(!s&&await q.exists({fs:o,gitdir:l,ref:i}))throw new Ui("ref",i);a?await q.writeSymbolicRef({fs:o,gitdir:l,ref:i,value:n}):(n=await q.resolve({fs:o,gitdir:l,ref:n}),await q.writeRef({fs:o,gitdir:l,ref:i,value:n}))}catch(o){throw o.caller="git.writeRef",o}}async function CB({fs:t,gitdir:e,tag:r}){let i=Xr.from(r).toObject();return await Or({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}async function Dk({fs:t,dir:e,gitdir:r=H(e,".git"),tag:i}){try{R("fs",t),R("gitdir",r),R("tag",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await CB({fs:n,gitdir:s,tag:i})}catch(n){throw n.caller="git.writeTag",n}}async function Ok({fs:t,dir:e,gitdir:r=H(e,".git"),tree:i}){try{R("fs",t),R("gitdir",r),R("tree",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await fu({fs:n,gitdir:s,tree:i})}catch(n){throw n.caller="git.writeTree",n}}var TB={Errors:YE,STAGE:Ea,TREE:Kr,WORKDIR:tl,add:JE,abortMerge:KE,addNote:nS,addRemote:aS,annotatedTag:oS,branch:lS,cherryPick:dS,checkout:Vg,clone:vS,commit:wS,getConfig:IS,getConfigAll:MS,setConfig:wk,currentBranch:bS,deleteBranch:_S,deleteRef:yS,deleteRemote:xS,deleteTag:ES,expandOid:SS,expandRef:kS,fastForward:TS,fetch:PS,findMergeBase:RS,findRoot:FS,getRemoteInfo:DS,getRemoteInfo2:LS,hashBlob:NS,indexPack:BS,init:HS,isDescendent:GS,isIgnored:jS,listBranches:VS,listFiles:WS,listNotes:qS,listRefs:YS,listRemotes:ZS,listServerRefs:KS,listTags:XS,log:JS,merge:ek,packObjects:rk,pull:ik,push:nk,readBlob:ok,readCommit:qg,readNote:lk,readObject:ck,readTag:uk,readTree:fk,remove:dk,removeNote:hk,renameBranch:pk,resetIndex:gk,updateIndex:Tk,resolveRef:vk,status:Sk,statusMatrix:Ak,tag:Ck,version:Pk,walk:Rk,writeBlob:$k,writeCommit:Fk,writeObject:Ik,writeRef:Mk,writeTag:Dk,writeTree:Ok,stash:Ek};Z.Errors=YE;Z.STAGE=Ea;Z.TREE=Kr;Z.WORKDIR=tl;Z.abortMerge=KE;Z.add=JE;Z.addNote=nS;Z.addRemote=aS;Z.annotatedTag=oS;Z.branch=lS;Z.checkout=Vg;Z.cherryPick=dS;Z.clone=vS;Z.commit=wS;Z.currentBranch=bS;Z.default=TB;Z.deleteBranch=_S;Z.deleteRef=yS;Z.deleteRemote=xS;Z.deleteTag=ES;Z.expandOid=SS;Z.expandRef=kS;Z.fastForward=TS;Z.fetch=PS;Z.findMergeBase=RS;Z.findRoot=FS;Z.getConfig=IS;Z.getConfigAll=MS;Z.getRemoteInfo=DS;Z.getRemoteInfo2=LS;Z.hashBlob=NS;Z.indexPack=BS;Z.init=HS;Z.isDescendent=GS;Z.isIgnored=jS;Z.listBranches=VS;Z.listFiles=WS;Z.listNotes=qS;Z.listRefs=YS;Z.listRemotes=ZS;Z.listServerRefs=KS;Z.listTags=XS;Z.log=JS;Z.merge=ek;Z.packObjects=rk;Z.pull=ik;Z.push=nk;Z.readBlob=ok;Z.readCommit=qg;Z.readNote=lk;Z.readObject=ck;Z.readTag=uk;Z.readTree=fk;Z.remove=dk;Z.removeNote=hk;Z.renameBranch=pk;Z.resetIndex=gk;Z.resolveRef=vk;Z.setConfig=wk;Z.stash=Ek;Z.status=Sk;Z.statusMatrix=Ak;Z.tag=Ck;Z.updateIndex=Tk;Z.version=Pk;Z.walk=Rk;Z.writeBlob=$k;Z.writeCommit=Fk;Z.writeObject=Ik;Z.writeRef=Mk;Z.writeTag=Dk;Z.writeTree=Ok});var Vk=U((zz,jk)=>{"use strict";m();jk.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Wk=U((qz,zk)=>{m();var tv={px:{px:1,cm:37.79527559055118,mm:3.7795275590551185,in:96,pt:1.3333333333333333,pc:16},cm:{px:.026458333333333334,cm:1,mm:.1,in:2.54,pt:.035277777777777776,pc:.42333333333333334},mm:{px:.26458333333333334,cm:10,mm:1,in:25.4,pt:.35277777777777775,pc:4.233333333333333},in:{px:.010416666666666666,cm:.39370078740157477,mm:.03937007874015748,in:1,pt:.013888888888888888,pc:.16666666666666666},pt:{px:.75,cm:28.346456692913385,mm:2.834645669291339,in:72,pt:1,pc:12},pc:{px:.0625,cm:2.3622047244094486,mm:.2362204724409449,in:6,pt:.08333333333333333,pc:1},deg:{deg:1,grad:.9,rad:180/Math.PI,turn:360},grad:{deg:1.1111111111111112,grad:1,rad:200/Math.PI,turn:400},rad:{deg:Math.PI/180,grad:Math.PI/200,rad:1,turn:Math.PI*2},turn:{deg:.002777777777777778,grad:.0025,rad:.5/Math.PI,turn:1},s:{s:1,ms:.001},ms:{s:1e3,ms:1},Hz:{Hz:1,kHz:1e3},kHz:{Hz:.001,kHz:1},dpi:{dpi:1,dpcm:.39370078740157477,dppx:.010416666666666666},dpcm:{dpi:2.54,dpcm:1,dppx:.026458333333333334},dppx:{dpi:96,dpcm:37.79527559055118,dppx:1}};zk.exports=function(t,e,r,i){if(!tv.hasOwnProperty(r))throw new Error("Cannot convert to "+r);if(!tv[r].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+r);var n=tv[r][e]*t;return i!==!1?(i=Math.pow(10,parseInt(i)||5),Math.round(n*i)/i):n}});var aA=U(Wn=>{"use strict";m();Object.defineProperty(Wn,"__esModule",{value:!0});Wn.fromRgba=sl;Wn.fromRgb=rv;Wn.fromHsla=Id;Wn.fromHsl=nA;Wn.fromString=sA;Wn.default=void 0;var qk=Kk(Vk()),MB=Kk(Wk());function Kk(t){return t&&t.__esModule?t:{default:t}}function DB(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yk(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r-1}function UB(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 GB(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=yr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var jB=(function(){function t(e){var r=yr(e,4),i=r[0],n=r[1],s=r[2],a=r[3];DB(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 OB(t,[{key:"toRgbString",value:function(){var r=yr(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=yr(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=yr(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=yr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=UB(i,n,s),l=yr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t})();function sl(t){var e=yr(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new jB([r,i,n,s])}function rv(t){var e=yr(t,3),r=e[0],i=e[1],n=e[2];return sl([r,i,n,1])}function Id(t){var e=yr(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=GB(r,i,n),o=yr(a,3),l=o[0],c=o[1],u=o[2];return sl([l,c,u,s])}function nA(t){var e=yr(t,3),r=e[0],i=e[1],n=e[2];return Id([r,i,n,1])}function VB(t){var e=Xk.exec(t)||Qk.exec(t),r=yr(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,sl([i,n,s,a])}function zB(t){var e=Jk.exec(t)||tA.exec(t)||eA.exec(t)||rA.exec(t),r=yr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=mu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=mu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=mu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(mu(a,"%")?100:1),sl([i,n,s,a])}function WB(t){var e=iA.exec(t),r=yr(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,MB.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(mu(o,"%")?100:1),Id([i,s,a,o])}function sA(t){return qk.default[t]?rv(qk.default[t]):Xk.test(t)||Qk.test(t)?VB(t):Jk.test(t)||tA.test(t)||eA.test(t)||rA.test(t)?zB(t):iA.test(t)?WB(t):null}var qB={fromString:sA,fromRgb:rv,fromRgba:sl,fromHsl:nA,fromHsla:Id};Wn.default=qB});var wA=U((n9,vA)=>{m();vA.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,w,y,b,S){return{startX:g,startY:w,endX:y,endY:b,r:S}},p=function(g,w,y){var b,S,C,A,k;for(w>y?b=l[g-1+o]:b=l[g+1+o],k=C=Math.max(w,y),A=S=C-g;S=g+1;--A)y[A+o]=p(A,y[A-1+o]+1,y[A+1+o]);y[g+o]=p(g,y[g-1+o]+1,y[g+1+o])}while(y[g+o]!==s);for(ed=g+2*b,S=l[g+o],k=n,v=s,x=[];S!==-1;){let _=c[S];(n!=_.endX||s!=_.endY)&&x.push({file1:[a?_.endY:_.endX,a?v-_.endY:k-_.endX],file2:[a?_.endX:_.endY,a?k-_.endX:v-_.endY]}),k=_.startX,v=_.startY,S=c[S].r}return(k!=0||v!=0)&&x.push({file1:[0,a?v:k],file2:[0,a?k:v]}),x.reverse(),x}}}});var yA=U((a9,_A)=>{m();var bA=wA();function KB(t,e,r){var i,n=new bA(e,t).compose(),s=new bA(e,r).compose(),a=[];function o($,D){a.push([$.file1[0],D,$.file1[1],$.file2[0],$.file2[1]])}for(i=0;ic&&(l.push([1,c,$-c]),c=$)}for(var f=0;fg)break;g=Math.max(g,y+w[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var S=h[1],C=b[S],A=h[0],k=A+h[2],v=h[3],x=v+h[4];C[0]=Math.min(v,C[0]),C[1]=Math.max(x,C[1]),C[2]=Math.min(A,C[2]),C[3]=Math.max(k,C[3])}var _=b[0][0]+(p-b[0][2]),P=b[0][1]+(g-b[0][3]),T=b[2][0]+(p-b[2][2]),M=b[2][1]+(g-b[2][3]);l.push([-1,_,P-_,p,g-p,T,M-T])}c=g}return u(e.length),l}function XB(t,e,r){var i=[],n=[t,e,r],s=KB(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var p=0;p{m();var ul=1e3,fl=ul*60,dl=fl*60,Aa=dl*24,e3=Aa*7,t3=Aa*365.25;EA.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return r3(t);if(r==="number"&&isFinite(t))return e.long?n3(t):i3(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function r3(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*t3;case"weeks":case"week":case"w":return r*e3;case"days":case"day":case"d":return r*Aa;case"hours":case"hour":case"hrs":case"hr":case"h":return r*dl;case"minutes":case"minute":case"mins":case"min":case"m":return r*fl;case"seconds":case"second":case"secs":case"sec":case"s":return r*ul;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function i3(t){var e=Math.abs(t);return e>=Aa?Math.round(t/Aa)+"d":e>=dl?Math.round(t/dl)+"h":e>=fl?Math.round(t/fl)+"m":e>=ul?Math.round(t/ul)+"s":t+"ms"}function n3(t){var e=Math.abs(t);return e>=Aa?Ld(t,e,Aa,"day"):e>=dl?Ld(t,e,dl,"hour"):e>=fl?Ld(t,e,fl,"minute"):e>=ul?Ld(t,e,ul,"second"):t+" ms"}function Ld(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var AA=U((w9,kA)=>{m();function s3(t){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=n,r.enabled=o,r.humanize=SA(),r.destroy=c,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let f=0;for(let d=0;d{if(k==="%%")return"%";C++;let x=r.formatters[v];if(typeof x=="function"){let _=w[C];k=x.call(y,_),w.splice(C,1),C--}return k}),r.formatArgs.call(y,w),(y.log||r.log).apply(y,w)}return g.namespace=u,g.useColors=r.useColors(),g.color=r.selectColor(u),g.extend=i,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,p=r.enabled(u)),p),set:w=>{d=w}}),typeof r.init=="function"&&r.init(g),g}function i(u,f){let d=r(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function n(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(u,f){let d=0,h=0,p=-1,g=0;for(;d"-"+f)].join(",");return r.enable(""),u}function o(u){for(let f of r.skips)if(s(u,f))return!1;for(let f of r.names)if(s(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}kA.exports=s3});var Bd=U((Lr,Nd)=>{m();Lr.formatArgs=o3;Lr.save=l3;Lr.load=c3;Lr.useColors=a3;Lr.storage=u3();Lr.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Lr.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function a3(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o3(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Nd.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}Lr.log=console.debug||console.log||(()=>{});function l3(t){try{t?Lr.storage.setItem("debug",t):Lr.storage.removeItem("debug")}catch(e){}}function c3(){let t;try{t=Lr.storage.getItem("debug")||Lr.storage.getItem("DEBUG")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function u3(){try{return localStorage}catch(t){}}Nd.exports=AA()(Lr);var{formatters:f3}=Nd.exports;f3.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var CA=U(Qr=>{"use strict";m();var d3=Qr&&Qr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qr,"__esModule",{value:!0});var h3=require("fs"),p3=d3(Bd()),hl=p3.default("@kwsites/file-exists");function m3(t,e,r){hl("checking %s",t);try{let i=h3.statSync(t);return i.isFile()&&e?(hl("[OK] path represents a file"),!0):i.isDirectory()&&r?(hl("[OK] path represents a directory"),!0):(hl("[FAIL] path represents something other than a file or directory"),!1)}catch(i){if(i.code==="ENOENT")return hl("[FAIL] path is not accessible: %o",i),!1;throw hl("[FATAL] %o",i),i}}function g3(t,e=Qr.READABLE){return m3(t,(e&Qr.FILE)>0,(e&Qr.FOLDER)>0)}Qr.exists=g3;Qr.FILE=1;Qr.FOLDER=2;Qr.READABLE=Qr.FILE+Qr.FOLDER});var TA=U(Hd=>{"use strict";m();function v3(t){for(var e in t)Hd.hasOwnProperty(e)||(Hd[e]=t[e])}Object.defineProperty(Hd,"__esModule",{value:!0});v3(CA())});var uv=U(Ca=>{"use strict";m();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.createDeferred=Ca.deferred=void 0;function cv(){let t,e,r="pending";return{promise:new Promise((n,s)=>{t=n,e=s}),done(n){r==="pending"&&(r="resolved",t(n))},fail(n){r==="pending"&&(r="rejected",e(n))},get fulfilled(){return r!=="pending"},get status(){return r}}}Ca.deferred=cv;Ca.createDeferred=cv;Ca.default=cv});var _2=U(()=>{m()});var y2=U(()=>{m()});var rw=U((RW,sh)=>{m();(function(){"use strict";var t="input is invalid type",e=typeof window=="object",r=e?window:{};r.JS_SHA256_NO_WINDOW&&(e=!1);var i=!e&&typeof self=="object",n=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";n?r=global:i&&(r=self);var s=!r.JS_SHA256_NO_COMMON_JS&&typeof sh=="object"&&sh.exports,a=typeof define=="function"&&define.amd,o=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",l="0123456789abcdef".split(""),c=[-2147483648,8388608,32768,128],u=[24,16,8,0],f=[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],d=["hex","array","digest","arrayBuffer"],h=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),o&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var p=function(k,v){return function(x){return new S(v,!0).update(x)[k]()}},g=function(k){var v=p("hex",k);n&&(v=w(v,k)),v.create=function(){return new S(k)},v.update=function(P){return v.create().update(P)};for(var x=0;x>>2]|=k[P]<>>2]|=_<>>2]|=(192|_>>>6)<>>2]|=(128|_&63)<=57344?($[T>>>2]|=(224|_>>>12)<>>2]|=(128|_>>>6&63)<>>2]|=(128|_&63)<>>2]|=(240|_>>>18)<>>2]|=(128|_>>>12&63)<>>2]|=(128|_>>>6&63)<>>2]|=(128|_&63)<=64?(this.block=$[16],this.start=T-64,this.hash(),this.hashed=!0):this.start=T}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},S.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,v=this.lastByteIndex;k[16]=this.block,k[v>>>2]|=c[v&3],this.block=k[16],v>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},S.prototype.hash=function(){var k=this.h0,v=this.h1,x=this.h2,_=this.h3,P=this.h4,T=this.h5,M=this.h6,$=this.h7,D=this.blocks,Q,ye,de,J,X,he,z,K,G,Me,Et;for(Q=16;Q<64;++Q)X=D[Q-15],ye=(X>>>7|X<<25)^(X>>>18|X<<14)^X>>>3,X=D[Q-2],de=(X>>>17|X<<15)^(X>>>19|X<<13)^X>>>10,D[Q]=D[Q-16]+ye+D[Q-7]+de<<0;for(Et=v&x,Q=0;Q<64;Q+=4)this.first?(this.is224?(K=300032,X=D[0]-1413257819,$=X-150054599<<0,_=X+24177077<<0):(K=704751109,X=D[0]-210244248,$=X-1521486534<<0,_=X+143694565<<0),this.first=!1):(ye=(k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10),de=(P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7),K=k&v,J=K^k&x^Et,z=P&T^~P&M,X=$+de+z+f[Q]+D[Q],he=ye+J,$=_+X<<0,_=X+he<<0),ye=(_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10),de=($>>>6|$<<26)^($>>>11|$<<21)^($>>>25|$<<7),G=_&k,J=G^_&v^K,z=$&P^~$&T,X=M+de+z+f[Q+1]+D[Q+1],he=ye+J,M=x+X<<0,x=X+he<<0,ye=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),de=(M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7),Me=x&_,J=Me^x&k^G,z=M&$^~M&P,X=T+de+z+f[Q+2]+D[Q+2],he=ye+J,T=v+X<<0,v=X+he<<0,ye=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),de=(T>>>6|T<<26)^(T>>>11|T<<21)^(T>>>25|T<<7),Et=v&x,J=Et^v&_^Me,z=T&M^~T&$,X=P+de+z+f[Q+3]+D[Q+3],he=ye+J,P=k+X<<0,k=X+he<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+k<<0,this.h1=this.h1+v<<0,this.h2=this.h2+x<<0,this.h3=this.h3+_<<0,this.h4=this.h4+P<<0,this.h5=this.h5+T<<0,this.h6=this.h6+M<<0,this.h7=this.h7+$<<0},S.prototype.hex=function(){this.finalize();var k=this.h0,v=this.h1,x=this.h2,_=this.h3,P=this.h4,T=this.h5,M=this.h6,$=this.h7,D=l[k>>>28&15]+l[k>>>24&15]+l[k>>>20&15]+l[k>>>16&15]+l[k>>>12&15]+l[k>>>8&15]+l[k>>>4&15]+l[k&15]+l[v>>>28&15]+l[v>>>24&15]+l[v>>>20&15]+l[v>>>16&15]+l[v>>>12&15]+l[v>>>8&15]+l[v>>>4&15]+l[v&15]+l[x>>>28&15]+l[x>>>24&15]+l[x>>>20&15]+l[x>>>16&15]+l[x>>>12&15]+l[x>>>8&15]+l[x>>>4&15]+l[x&15]+l[_>>>28&15]+l[_>>>24&15]+l[_>>>20&15]+l[_>>>16&15]+l[_>>>12&15]+l[_>>>8&15]+l[_>>>4&15]+l[_&15]+l[P>>>28&15]+l[P>>>24&15]+l[P>>>20&15]+l[P>>>16&15]+l[P>>>12&15]+l[P>>>8&15]+l[P>>>4&15]+l[P&15]+l[T>>>28&15]+l[T>>>24&15]+l[T>>>20&15]+l[T>>>16&15]+l[T>>>12&15]+l[T>>>8&15]+l[T>>>4&15]+l[T&15]+l[M>>>28&15]+l[M>>>24&15]+l[M>>>20&15]+l[M>>>16&15]+l[M>>>12&15]+l[M>>>8&15]+l[M>>>4&15]+l[M&15];return this.is224||(D+=l[$>>>28&15]+l[$>>>24&15]+l[$>>>20&15]+l[$>>>16&15]+l[$>>>12&15]+l[$>>>8&15]+l[$>>>4&15]+l[$&15]),D},S.prototype.toString=S.prototype.hex,S.prototype.digest=function(){this.finalize();var k=this.h0,v=this.h1,x=this.h2,_=this.h3,P=this.h4,T=this.h5,M=this.h6,$=this.h7,D=[k>>>24&255,k>>>16&255,k>>>8&255,k&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255,T>>>24&255,T>>>16&255,T>>>8&255,T&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255];return this.is224||D.push($>>>24&255,$>>>16&255,$>>>8&255,$&255),D},S.prototype.array=S.prototype.digest,S.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),v=new DataView(k);return v.setUint32(0,this.h0),v.setUint32(4,this.h1),v.setUint32(8,this.h2),v.setUint32(12,this.h3),v.setUint32(16,this.h4),v.setUint32(20,this.h5),v.setUint32(24,this.h6),this.is224||v.setUint32(28,this.h7),k};function C(k,v,x){var _,P=typeof k;if(P==="string"){var T=[],M=k.length,$=0,D;for(_=0;_>>6,T[$++]=128|D&63):D<55296||D>=57344?(T[$++]=224|D>>>12,T[$++]=128|D>>>6&63,T[$++]=128|D&63):(D=65536+((D&1023)<<10|k.charCodeAt(++_)&1023),T[$++]=240|D>>>18,T[$++]=128|D>>>12&63,T[$++]=128|D>>>6&63,T[$++]=128|D&63);k=T}else if(P==="object"){if(k===null)throw new Error(t);if(o&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!Array.isArray(k)&&(!o||!ArrayBuffer.isView(k)))throw new Error(t)}else throw new Error(t);k.length>64&&(k=new S(v,!0).update(k).array());var Q=[],ye=[];for(_=0;_<64;++_){var de=k[_]||0;Q[_]=92^de,ye[_]=54^de}S.call(this,v,x),this.update(ye),this.oKeyPad=Q,this.inner=!0,this.sharedMemory=x}C.prototype=new S,C.prototype.finalize=function(){if(S.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();S.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),S.prototype.finalize.call(this)}};var A=g();A.sha256=A,A.sha224=g(!0),A.sha256.hmac=b(),A.sha224.hmac=b(!0),s?sh.exports=A:(r.sha256=A.sha256,r.sha224=A.sha224,a&&define(function(){return A}))})()});var rR=U(jw=>{m();(function(t){var e=/\S/,r=/\"/g,i=/\n/g,n=/\r/g,s=/\\/g,a=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(x,_){var P=x.length,T=0,M=1,$=2,D=T,Q=null,ye=null,de="",J=[],X=!1,he=0,z=0,K="{{",G="}}";function Me(){de.length>0&&(J.push({tag:"_t",text:new String(de)}),de="")}function Et(){for(var Rt=!0,$t=z;$t"&&(re.indent=J[Xe].text.toString()),J.splice(Xe,1));else $t||J.push({tag:` +`});X=!1,z=J.length}function De(Rt,$t){var Xe="="+G,re=Rt.indexOf(Xe,$t),B=c(Rt.substring(Rt.indexOf("=",$t)+1,re)).split(" ");return K=B[0],G=B[B.length-1],re+Xe.length-1}for(_&&(_=_.split(" "),K=_[0],G=_[1]),he=0;he0;){if(D=v.shift(),$&&$.tag=="<"&&!(D.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[D.tag]<=t.tags.$||h(D,P))_.push(D),D.nodes=d(v,D.tag,_,P);else if(D.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+D.n);if(M=_.pop(),D.n!=M.n&&!p(D.n,M.n,P))throw new Error("Nesting error: "+M.n+" vs. "+D.n);return M.end=D.i,T}else D.tag==` +`&&(D.last=v.length==0||v[0].tag==` +`);T.push(D)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return T}function h(v,x){for(var _=0,P=x.length;_":C,"<":function(v,x){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(v.nodes,_);var P=x.partials[C(v,x)];P.subs=_.subs,P.partials=_.partials},$:function(v,x){var _={subs:{},code:"",partials:x.partials,prefix:v.n};t.walk(v.nodes,_),x.subs[v.n]=_.code,x.inPartial||(x.code+='t.sub("'+b(v.n)+'",c,p,i);')},"\n":function(v,x){x.code+=k('"\\n"'+(v.last?"":" + i"))},_v:function(v,x){x.code+="t.b(t.v(t."+S(v.n)+'("'+b(v.n)+'",c,p,0)));'},_t:function(v,x){x.code+=k('"'+b(v.text)+'"')},"{":A,"&":A};function A(v,x){x.code+="t.b(t.t(t."+S(v.n)+'("'+b(v.n)+'",c,p,0)));'}function k(v){return"t.b("+v+");"}t.walk=function(v,x){for(var _,P=0,T=v.length;P{m();var c4={};(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 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=0;C--)if(y=h[C],w=e(d,y,S),w!==void 0){b=!0;break}return b?(!g&&typeof w=="function"&&(w=this.mv(w,h,p)),w):g?!1:""},ls:function(d,h,p,g,w,y){var b=this.options.delimiters;return this.options.delimiters=y,this.b(this.ct(c(d.call(h,w,p)),h,g)),this.options.delimiters=b,!1},ct:function(d,h,p){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(d,this.options).render(h,p)},b:function(d){this.buf+=d},fl:function(){var d=this.buf;return this.buf="",d},ms:function(d,h,p,g,w,y,b){var S,C=h[h.length-1],A=d.call(C);return typeof A=="function"?g?!0:(S=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(A,C,h,p,S.substring(w,y),b)):A},mv:function(d,h,p){var g=h[h.length-1],w=d.call(g);return typeof w=="function"?this.ct(c(w.call(g)),g,p):w},sub:function(d,h,p,g){var w=this.subs[d];w&&(this.activeSub=d,w(h,p,this,g),this.activeSub=!1)}};function e(d,h,p){var g;return h&&typeof h=="object"&&(h[d]!==void 0?g=h[d]:p&&h.get&&typeof h.get=="function"&&(g=h.get(d))),g}function r(d,h,p,g,w,y){function b(){}b.prototype=d;function S(){}S.prototype=d.subs;var C,A=new b;A.subs=new S,A.subsText={},A.buf="",g=g||{},A.stackSubs=g,A.subsText=y;for(C in h)g[C]||(g[C]=h[C]);for(C in g)A.subs[C]=g[C];w=w||{},A.stackPartials=w;for(C in p)w[C]||(w[C]=p[C]);for(C in w)A.partials[C]=w[C];return A}var i=/&/g,n=//g,a=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(i,"&").replace(n,"<").replace(s,">").replace(a,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof Vw!="undefined"?Vw:c4)});var zw=U((hY,nR)=>{m();var Bh=rR();Bh.Template=iR().Template;Bh.template=Bh.Template;nR.exports=Bh});var oR=U(Ai=>{"use strict";m();Object.defineProperty(Ai,"__esModule",{value:!0});Ai.ColorSchemeType=Ai.DiffStyleType=Ai.LineMatchingType=Ai.OutputFormatType=Ai.LineType=void 0;var sR;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(sR||(Ai.LineType=sR={}));Ai.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"};Ai.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"};Ai.DiffStyleType={WORD:"word",CHAR:"char"};var aR;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(aR||(Ai.ColorSchemeType=aR={}))});var pG={};DF(pG,{default:()=>Vp});module.exports=OF(pG);m();var hF=Gt(Yg(),1),Se=require("obsidian"),pF=Gt(require("path"),1),zp=Gt(require("fs/promises"),1);m();var zt={};m();var Cd=class{constructor(e){this.plugin=e;this.tasks=[]}addTask(e,r){this.tasks.push({task:e,onFinished:r!=null?r:(()=>{})}),this.tasks.length===1&&this.handleTask()}handleTask(){if(this.tasks.length>0){let e=this.tasks[0];e.task().then(r=>{e.onFinished(r),this.tasks.shift(),this.handleTask()},r=>{this.plugin.displayError(r),e.onFinished(void 0),this.tasks.shift(),this.handleTask()})}}clear(){this.tasks=[]}};m();var j=require("obsidian");m();var Lk=require("obsidian"),Td="YYYY-MM-DD",Zg=`${Td} HH:mm`,Kg=`${Td} HH:mm:ss`,Pd=40,il="conflict-files-obsidian-git.md",pt={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitMessageScript:"",commitDateFormat:Kg,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,autoCommitOnlyStaged:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,showErrorNotices:!0,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",mergeStrategy:"none",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:Lk.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,diffStyle:"split",hunks:{showSigns:!1,hunkCommands:!1,statusBar:"disabled"},lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:Zg,dateTimeTimezone:"viewer-local",coloringMaxAge:"1y",colorNew:{r:255,g:150,b:150},colorOld:{r:120,g:160,b:255},textColorCss:"var(--text-muted)",ignoreWhitespace:!1}},Qt={type:"git-view",name:"Source Control",icon:"git-pull-request"},bi={type:"git-history-view",name:"History",icon:"history"},Ms={type:"split-diff-view",name:"Diff view",icon:"diff"},Ds={type:"diff-view",name:"Diff View",icon:"git-pull-request"},Rd="C:\\Program Files\\Git\\cmd\\git.exe",$d=".git_credentials_input",Sa="obsidian_askpass.sh",Nk=`#!/bin/sh + +PROMPT="$1" +TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT" + +cleanup() { + rm -f "$TEMP_FILE" "$TEMP_FILE.response" +} +trap cleanup EXIT + +echo "$PROMPT" > "$TEMP_FILE" + +while [ ! -e "$TEMP_FILE.response" ]; do + if [ ! -e "$TEMP_FILE" ]; then + echo "Trigger file got removed: Abort" >&2 + exit 1 + fi + sleep 0.1 +done + +RESPONSE=$(cat "$TEMP_FILE.response") + +echo "$RESPONSE" +`,Bk=["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 hu=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,w=1/0,y=()=>{for(let b=Math.max(g,-c);b<=Math.min(w,c);b+=2){let S,C=h[b-1],A=h[b+1];C&&(h[b-1]=void 0);let k=!1;if(A){let x=A.oldPos-b;k=A&&0<=x&&x=l&&p+1>=o)return a(this.buildValues(S.lastComponent,r,e))||!0;h[b]=S,S.oldPos+1>=l&&(w=Math.min(w,b-1)),p+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);y()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=y();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1d.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 Xg=class extends hu{constructor(){super(...arguments),this.tokenize=RB}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)}},PB=new Xg;function Qg(t,e,r){return PB.diff(t,e,r)}function RB(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"~"||t[e]==='"'||t[e]==="\\")return!0;return!1}function Os(t){if(!$B(t))return t;let e='"',r=new TextEncoder().encode(t),i=0;for(;i=32&&n<=126?e+=String.fromCharCode(n):e+="\\"+n.toString(8).padStart(3,"0"),i++}return e+='"',e}var Jg={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function ev(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;Qg(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(Qg(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(b){return b.map(function(S){return" "+S})}let d=[],h=0,p=0,g=[],w=1,y=1;for(let b=0;b0?f(A.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let A of C)g.push((S.added?"+":"-")+A);S.added?y+=C.length:w+=C.length}else{if(h)if(C.length<=l*2&&b1&&!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=>Fd(u,e)).join(` +`)}let l=[];if(t.isGit){if(e=Jg,!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 "+Os(u)+" "+Os(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 "+Os(((n=t.oldFileName)!==null&&n!==void 0?n:"").replace(/^a\//,""))),l.push("rename to "+Os(((s=t.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),t.isCopy&&(l.push("copy from "+Os(((a=t.oldFileName)!==null&&a!==void 0?a:"").replace(/^a\//,""))),l.push("copy to "+Os(((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("--- "+Os(t.oldFileName)+(t.oldHeader?" "+t.oldHeader:"")),l.push("+++ "+Os(t.newFileName)+(t.newHeader?" "+t.newHeader:"")));for(let u=0;u{o(l?Fd(l,a.headerOptions):void 0)}}))}else{let o=ev(t,e,r,i,n,s,a);return o?Fd(o,a==null?void 0:a.headerOptions):void 0}}function pu(t,e,r,i,n,s){return Hk(t,t,e,r,i,n,s)}function FB(t){let e=t.endsWith(` +`),r=t.split(` +`).map(i=>i+` +`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var se=Gt(Yg(),1),ka=require("obsidian");m();function Uk(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var nl=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var Gk=require("obsidian"),IB={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},tt=class extends Gk.SuggestModal{constructor(e,r){if(super(e.app),this.config={...IB,...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 oA=Gt(aA(),1),lA=require("child_process"),qn=require("obsidian");function Md(t){throw new Error(`Unexpected object: ${t}`)}function gu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var iv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function ji(t,e){let r;if(e){if(e.button===0||e.button===1){let i=qn.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function bn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new qn.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new qn.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function Ls(t){throw new Error("Impossible branch: "+t)}function nv(t){return`rgb(${t.r},${t.g},${t.b})`}function cA(t){var s;let e=(s=oA.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function uA(t){return t.diff(qn.moment.unix(0),"seconds")}function fA(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function vu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function dA(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function hA(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function sv(t,e,r){return t<=e&&e<=r}function Yn(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function _n(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function pA(t){return t===1?"1 minute":`${t} minutes`}function YB(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function al(t){if(t.endsWith(".md"))return!1;let e=YB(t);return Bk.includes(e)}function av(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function ol(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof qn.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function mA({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function ll(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 wu(t,e,r={}){return new Promise((i,n)=>{let s=(0,lA.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:a,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var gA=require("os"),Dd=require("obsidian"),cl=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let i=[];for(e=[...e];e.length>0;){let n=e.first(),s=n.path.substring(r);if(s.contains("/")){let a=s.substring(0,s.indexOf("/")),o=e.filter(c=>c.path.substring(r).startsWith(a+"/"));o.forEach(c=>e.remove(c));let l=n.path.substring(0,s.indexOf("/")+r);i.push({title:a,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(r>0?r+a.length:a.length)+1)})}else i.push({title:s,data:n,path:n.path,vaultPath:this.getRelativeVaultPath(n.path)}),e.remove(n)}return i}simplify(e){var r,i,n,s;for(let a of e){for(;;){let o=((r=a.children)==null?void 0:r.length)==1,l=((n=(i=a.children)==null?void 0:i.first())==null?void 0:n.data)==null;if(!(a.children!=null&&o&&l))break;let c=a.children.first();a.title+="/"+c.title,a.data=c.data,a.path=c.path,a.vaultPath=c.vaultPath,a.children=c.children}a.children!=null&&this.simplify(a.children),(s=a.children)==null||s.sort((o,l)=>{let c=(l.data==null?1:0)-(o.data==null?1:0);return c!=0?c:o.title.localeCompare(l.title)})}return e.sort((a,o)=>{let l=(o.data==null?1:0)-(a.data==null?1:0);return l!=0?l:a.title.localeCompare(o.title)})}getTreeStructure(e){let r=this._getTreeStructure(e);return this.simplify(r)}async formatCommitMessage(e){let r;if(e.includes("{{numFiles}}")){r=await this.status();let i=r.staged.length;e=e.replace("{{numFiles}}",String(i))}if(e.includes("{{hostname}}")){let i=this.plugin.localStorage.getHostname()||"";!i&&Dd.Platform.isDesktopApp&&(i=(0,gA.hostname)()),e=e.replace("{{hostname}}",i)}if(e.includes("{{files}}")){r=r!=null?r:await this.status();let i={},n="";if(r.staged.length<100){r.staged.forEach(a=>{a.index in i?i[a.index].push(a.path):i[a.index]=[a.path]});let s=[];for(let[a,o]of Object.entries(i))s.push(a+" "+o.join(" "));n=s.join(", ")}else n="Too many files to list";e=e.replace("{{files}}",n)}if(e=e.replace("{{date}}",(0,Dd.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let i=r!=null?r:await this.status(),n="";i.staged.length<100?n=i.staged.map(s=>s.path).join(` +`):n="Too many files to list",e=e+` + +Affected files: +`+n}return e}};m();var Ns=require("obsidian"),Od=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var i;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let n=this.vault.getAbstractFileByPath(e);return n instanceof Ns.TFile?(this.maybeLog("Reuse"),this.vault.read(n)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(i=this.index)!=null?i:this.adapter.readBinary(e);let n=this.vault.getAbstractFileByPath(e);return n instanceof Ns.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(n)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let i=this.vault.getAbstractFileByPath(e);return i instanceof Ns.TFile?this.vault.modify(i,r):this.adapter.write(e,r)}else{let i=ZB(r);if(e.endsWith(this.gitDir+"/index"))this.index=i,this.indexmtime=Date.now();else{let n=this.vault.getAbstractFileByPath(e);return n instanceof Ns.TFile?this.vault.modifyBinary(n,i):this.adapter.writeBinary(e,i)}}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Ns.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var i,n;return this.adapter.rmdir(e,(n=(i=r==null?void 0:r.options)==null?void 0:i.recursive)!=null?n:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw{code:"ENOENT"};return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Ns.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};function ZB(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().buffer}var xA=Gt(yA(),1),Vi=class extends cl{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new Od(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,i;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(i=this.plugin.localStorage.getPassword())!=null?i:void 0}},onAuthFailure:async()=>{new ka.Notice("Authentication failed. Please try with different credentials");let r=await new tt(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let i=await new tt(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(i)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(i),{username:r,password:i}}return{cancel:!0}},http:{async request({url:r,method:i,headers:n,body:s}){let a;s&&(a=await JB(s));let o=await(0,ka.requestUrl)({url:r,method:i,headers:n,body:a,throw:!1});return{url:r,method:i,headers:o.headers,body:QB(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let i=await r;return await this.fs.saveAndClear(),i}catch(i){throw await this.fs.saveAndClear(),i}}async status(r){let i,n=window.setTimeout(()=>{i=new ka.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let s={...this.getRepo()};(r==null?void 0:r.path)!=null&&(s.filepaths=[`${r.path}/`]);let a=(await this.wrapFS(se.default.statusMatrix(s))).map(f=>this.getFileStatusResult(f)),o=[],l=[],c=[];for(let f of a)f.workingDir!==" "&&o.push(f),f.index!==" "&&f.index!=="U"&&l.push(f),(f.index!=" "||f.workingDir!=" ")&&c.push(f);let u=[];return window.clearTimeout(n),i==null||i.hide(),{all:c,changed:o,staged:l,conflicted:u}}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async commitAll({message:r,status:i,unstagedFiles:n}){try{return await this.checkAuthorInfo(),await this.stageAll({status:i,unstagedFiles:n}),this.commit({message:r})}catch(s){throw this.plugin.displayError(s),s}}async commit({message:r}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let i=await this.formatCommitMessage(r),n=this.plugin.localStorage.getConflict(),s;if(n){let a=await this.branchInfo();s=[a.current,a.tracking]}await this.wrapFS(se.default.commit({...this.getRepo(),message:i,parent:s})),this.plugin.localStorage.setConflict(!1);return}catch(i){throw this.plugin.displayError(i),i}}async stage(r,i){let n=this.getRelativeRepoPath(r,i),s;i?s=r:s=this.getRelativeVaultPath(r);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(s)?await this.wrapFS(se.default.add({...this.getRepo(),filepath:n})):await this.wrapFS(se.default.remove({...this.getRepo(),filepath:n}))}catch(a){throw this.plugin.displayError(a),a}}async stageAll({dir:r,status:i,unstagedFiles:n}){try{if(i)await Promise.all(i.changed.map(s=>s.workingDir!=="D"?this.wrapFS(se.default.add({...this.getRepo(),filepath:s.path})):se.default.remove({...this.getRepo(),filepath:s.path})));else{let s=n!=null?n:await this.getUnstagedFiles(r!=null?r:".");await Promise.all(s.map(({path:a,type:o})=>o=="D"?se.default.remove({...this.getRepo(),filepath:a}):this.wrapFS(se.default.add({...this.getRepo(),filepath:a}))))}}catch(s){throw this.plugin.displayError(s),s}}async unstage(r,i){try{this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.wrapFS(se.default.resetIndex({...this.getRepo(),filepath:r}))}catch(n){throw this.plugin.displayError(n),n}}async unstageAll({dir:r,status:i}){try{let n;i?n=i.staged.map(s=>s.path):n=(await this.getStagedFiles(r!=null?r:".")).map(({path:a})=>a),await this.wrapFS(Promise.all(n.map(s=>se.default.resetIndex({...this.getRepo(),filepath:s}))))}catch(n){throw this.plugin.displayError(n),n}}async discard(r){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(se.default.checkout({...this.getRepo(),filepaths:[r],force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async discardAll({dir:r,status:i}){let n=[];i?r!=null?n=i.changed.filter(s=>s.workingDir!="U"&&s.path.startsWith(r)).map(s=>s.path):n=i.changed.filter(s=>s.workingDir!="U").map(s=>s.path):n=(await this.getUnstagedFiles(r)).filter(s=>s.type!="A").map(({path:s})=>s);try{await this.wrapFS(se.default.checkout({...this.getRepo(),filepaths:n,force:!0}))}catch(s){throw this.plugin.displayError(s),s}}async getUntrackedPaths(r){let i=[];if(r.status)for(let n of r.status.changed)n.index=="U"&&n.workingDir==="U"&&n.path.startsWith(r.path!=null?`${r.path}/`:"")&&i.push(n.path);else{let n=await this.status({path:r==null?void 0:r.path});for(let s of n.changed)s.index==="U"&&s.workingDir==="U"&&i.push(s.path)}return i}getProgressText(r,i){let n=`${r} progress:`;return i.phase&&(n=`${n} ${i.phase}:`),i.loaded&&(n=`${n} ${i.loaded}`,i.total&&(n=`${n} of ${i.total}`)),n}resolveRef(r){return this.wrapFS(se.default.resolveRef({...this.getRepo(),ref:r}))}async pull(){let r=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let i=await this.resolveRef("HEAD");await this.fetch();let n=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(se.default.merge({...this.getRepo(),ours:n.current,theirs:n.tracking,abortOnConflict:!1,mergeDriver:this.plugin.settings.mergeStrategy!=="none"?({contents:l})=>{var b,S,C;let c=l[0],u=l[1],f=l[2],d=/^.*(\r?\n|$)/gm,h=(b=u.match(d))!=null?b:[],p=(S=c.match(d))!=null?S:[],g=(C=f.match(d))!=null?C:[],w=(0,xA.default)(h,p,g),y="";for(let A of w)A.ok&&(y+=A.ok.join("")),A.conflict&&(y+=this.plugin.settings.mergeStrategy==="ours"?A.conflict.a.join(""):A.conflict.b.join(""));return{cleanMerge:!0,mergedText:y}}:void 0}))).alreadyMerged||await this.wrapFS(se.default.checkout({...this.getRepo(),ref:n.current,onProgress:l=>{r!==void 0&&r.setMessage(this.getProgressText("Checkout",l))},remote:n.remote})),r==null||r.hide();let a=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(i,a);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(l.path)}))}catch(i){throw r==null||r.hide(),i instanceof se.Errors.MergeConflictError&&await this.plugin.handleConflict(i.data.filepaths.map(n=>this.getRelativeVaultPath(n))),this.plugin.displayError(i),i}}async push(){if(!await this.canPush())return 0;let r=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let i=await this.branchInfo(),n=i.tracking,s=i.current,a=(await this.getFileChangesCount(s,n)).length;this.plugin.setPluginState({gitAction:5});let o=await this.getCurrentRemote();return await this.wrapFS(se.default.push({...this.getRepo(),remote:o,onProgress:l=>{r!==void 0&&r.setMessage(this.getProgressText("Pushing",l))}})),r==null||r.hide(),a}catch(i){throw r==null||r.hide(),this.plugin.displayError(i),i}}async getUnpushedCommits(){let r=await this.branchInfo(),i=r.tracking,n=r.current;if(i==null||n==null)return 0;let s=await this.resolveRef(n),a=await this.resolveRef(i);return(await this.getFileChangesCount(s,a)).length}async canPush(){let r=await this.branchInfo(),i=r.tracking,n=r.current,s=await this.resolveRef(n),a=await this.resolveRef(i);return s!=a}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var r,i;try{let n=await se.default.currentBranch(this.getRepo())||"",s=await se.default.listBranches(this.getRepo()),a=(r=await this.getConfig(`branch.${n}.remote`))!=null?r:"origin",o=(i=await this.getConfig(`branch.${n}.merge`))==null?void 0:i.split("refs/heads")[1],l=o?a+o:void 0;return{current:n,tracking:l,branches:s,remote:a}}catch(n){throw this.plugin.displayError(n),n}}async getCurrentRemote(){var n;let r=await se.default.currentBranch(this.getRepo())||"";return(n=await this.getConfig(`branch.${r}.remote`))!=null?n:"origin"}async checkout(r,i){try{return this.wrapFS(se.default.checkout({...this.getRepo(),ref:r,force:!!i,remote:i}))}catch(n){throw this.plugin.displayError(n),n}}async createBranch(r){try{await this.wrapFS(se.default.branch({...this.getRepo(),ref:r,checkout:!0}))}catch(i){throw this.plugin.displayError(i),i}}async deleteBranch(r){try{await this.wrapFS(se.default.deleteBranch({...this.getRepo(),ref:r}))}catch(i){throw this.plugin.displayError(i),i}}branchIsMerged(r){return Promise.resolve(!0)}async init(){try{await this.wrapFS(se.default.init(this.getRepo()))}catch(r){throw this.plugin.displayError(r),r}}async clone(r,i,n){let s=this.showNotice("Initializing clone");try{await this.wrapFS(se.default.clone({...this.getRepo(),dir:i,url:r,depth:n,onProgress:a=>{s!==void 0&&s.setMessage(this.getProgressText("Cloning",a))}})),s==null||s.hide()}catch(a){throw s==null||s.hide(),this.plugin.displayError(a),a}}async setConfig(r,i){try{return this.wrapFS(se.default.setConfig({...this.getRepo(),path:r,value:i}))}catch(n){throw this.plugin.displayError(n),n}}async getConfig(r){try{return this.wrapFS(se.default.getConfig({...this.getRepo(),path:r}))}catch(i){throw this.plugin.displayError(i),i}}async fetch(r){let i=this.showNotice("Initializing fetch");try{let n={...this.getRepo(),onProgress:s=>{i!==void 0&&i.setMessage(this.getProgressText("Fetching",s))},remote:r!=null?r:await this.getCurrentRemote()};await this.wrapFS(se.default.fetch(n)),i==null||i.hide()}catch(n){throw this.plugin.displayError(n),i==null||i.hide(),n}}async setRemote(r,i){try{await this.wrapFS(se.default.addRemote({...this.getRepo(),remote:r,url:i,force:!0}))}catch(n){throw this.plugin.displayError(n),n}}async getRemoteBranches(r){let i=[];return i.push(...await this.wrapFS(se.default.listBranches({...this.getRepo(),remote:r}))),i.remove("HEAD"),i=i.map(n=>`${r}/${n}`),i}async getRemotes(){return(await this.wrapFS(se.default.listRemotes({...this.getRepo()}))).map(r=>r.remote)}async removeRemote(r){await this.wrapFS(se.default.deleteRemote({...this.getRepo(),remote:r}))}async getRemoteUrl(r){var i;return(i=(await this.wrapFS(se.default.listRemotes({...this.getRepo()}))).filter(n=>n.remote==r)[0])==null?void 0:i.url}async log(r,i=!0,n,s){let a=await this.wrapFS(se.default.log({...this.getRepo(),depth:n,ref:s}));return Promise.all(a.map(async o=>{let l=o.commit.message.split(` + +`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(` + +`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(c=>({path:c.path,status:c.type,vaultPath:this.getRelativeVaultPath(c.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[i,n]=Yn(r),s=await this.branchInfo();await this.wrapFS(se.default.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[se.default.TREE({ref:r}),se.default.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return await this.wrapFS(se.default.walk({...this.getRepo(),trees:r,map:async function(s,[a,o]){if(!iv(s,i))return null;if(await(a==null?void 0:a.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(a==null?void 0:a.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(a),console.log(o)),u!=="equal")return{path:s,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[se.default.TREE({ref:"HEAD"}),se.default.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new ka.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(se.default.walk({...s,trees:[se.default.WORKDIR(),se.default.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await se.default.isIgnored({...s,filepath:o})||!iv(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 se.default.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await(0,se.readBlob)({...this.getRepo(),filepath:r,oid:n}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof se.default.Errors.NotFoundError))throw h}),u=await se.default.readCommit({...this.getRepo(),oid:n}),f=await(0,se.readBlob)({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof se.default.Errors.NotFoundError))throw h});return pu(s,f!=null?f:"",c!=null?c:"")}let o=(await se.default.walk({...this.getRepo(),trees:[se.default.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>(0,se.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof se.default.Errors.NotFoundError))throw f});return pu(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="",pu(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await se.default.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){let i=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:i[0]=="?"?"U":i[0],workingDir:i[1]=="?"?"U":i[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new ka.Notice(r,i?this.noticeLength:void 0)}};async function*QB(t){yield new Uint8Array(t)}async function JB(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}m();var w2=Gt(Bd(),1),ei=Gt(require("fs/promises"),1),Zn=require("obsidian"),We=Gt(require("path"),1),Tu=require("path");m();var Zd=Gt(TA(),1);m();var lv=new WeakMap;function pl(...t){let e=new String(t);return lv.set(e,t),e}function _i(t){return t instanceof String&&lv.has(t)}function ml(t){var e;return(e=lv.get(t))!=null?e:[]}var qd=Gt(Bd(),1),nT=require("child_process");var GT=Gt(uv(),1),JT=require("node:path");m();function*PA(t,e){let r=e==="global";for(let i of t)i.isGlobal===r&&(yield i)}var w3=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),b3=new Set(["--get","--get-all","--get-color","--get-colorbool","--get-regexp","--get-urlmatch","--list","-l"]),_3=new Set(["edit","remove-section","rename-section","set","unset"]),y3=new Set(["get","get-color","get-colorbool","list"]);function x3(t,e){var i;for(let{name:n}of PA(t,"task")){if(w3.has(n))return gl(!0,e);if(b3.has(n))return gl(!1,e)}let r=(i=e.at(0))==null?void 0:i.toLowerCase();return r===void 0?null:_3.has(r)?gl(!0,e.slice(1)):y3.has(r)?gl(!1,e.slice(1)):e.length===1?gl(!1,e):gl(!0,e)}function gl(t=!1,e=[]){var i;let r=(i=e.at(0))==null?void 0:i.toLowerCase();return r===void 0?null:{isWrite:t,isRead:!t,key:r,value:e.at(1)}}function E3(t,e){return e.isWrite&&e.value!==void 0?{key:e.key,value:e.value,scope:t}:{key:e.key,scope:t}}function S3(t){let e=(t==null?void 0:t.indexOf("="))||-1;return!t||e<0?null:{key:t.slice(0,e).trim().toLowerCase(),value:t.slice(e+1)}}function k3(t){for(let{name:e}of PA(t,"task"))switch(e){case"--global":return"global";case"--system":return"system";case"--worktree":return"worktree";case"--local":return"local";case"--file":case"-f":return"file"}return"local"}function A3({name:t}){if(t==="-c"||t==="--config")return"inline";if(t==="--config-env")return"env"}function*C3(t){for(let e of t){let r=A3(e),i=r&&S3(e.value);i&&(yield{...i,scope:r})}}function T3(t,e,r){let i={read:[],write:[...C3(e)]};return t==="config"&&P3(i,k3(e),x3(e,r)),i}function P3(t,e,r){if(r===null)return;let i=E3(e,r);r.isWrite?t.write.push(i):t.read.push(i)}var RA={short:new Map([["c",!0]])},R3={short:new Map([["C",!0],["P",!1],["h",!1],["p",!1],["v",!1],...RA.short.entries()]),long:new Set(["attr-source","config-env","exec-path","git-dir","list-cmds","namespace","super-prefix","work-tree"])},$3={clone:{short:new Map([["b",!0],["j",!0],["l",!1],["n",!1],["o",!0],["q",!1],["s",!1],["u",!0]]),long:new Set(["branch","config","jobs","origin","upload-pack","u","template"])},commit:{short:new Map([["C",!0],["F",!0],["c",!0],["m",!0],["t",!0]]),long:new Set(["file","message","reedit-message","reuse-message","template"])},config:{short:new Map([["e",!1],["f",!0],["l",!1]]),long:new Set(["blob","comment","default","file","type","value"])},fetch:{short:new Map,long:new Set(["upload-pack"])},init:{short:new Map,long:new Set(["template"])},pull:{short:new Map,long:new Set(["upload-pack"])},push:{short:new Map,long:new Set(["exec","receive-pack"])}},F3={short:new Map,long:new Set};function I3(t){var r;let e=(r=$3[t!=null?t:""])!=null?r:F3;return{short:new Map([...RA.short.entries(),...e.short.entries()]),long:e.long}}function $A(t,e=R3){if(t.startsWith("--")){let r=t.indexOf("=");if(r>2)return[{name:t.slice(0,r),value:t.slice(r+1),needsNext:!1}];let i=t.slice(2);return[{name:t,needsNext:e.long.has(i)}]}if(t.length===2){let r=t.charAt(1),i=e.short.get(r);return[{name:t,needsNext:i===!0}]}return M3(t,e.short)}function M3(t,e){let r=t.slice(1).split(""),i=[];for(let n=0;ne.has(l)))return i.push({name:`-${s}`,value:o,needsNext:!1}),i}i.push({name:`-${s}`,needsNext:a})}return i}function D3(t,e=[]){let r=0;for(;rfunction(){return t&&(e=(0,t[Fv(t)[0]])(t=0)),e},K3=(t,e)=>function(){return e||(0,t[Fv(t)[0]])((e={exports:{}}).exports,e),e.exports},St=(t,e)=>{for(var r in e)$v(t,r,{get:e[r],enumerable:!0})},X3=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fv(e))!Z3.call(t,n)&&n!==r&&$v(t,n,{get:()=>e[n],enumerable:!(i=Y3(e,n))||i.enumerable});return t},_t=t=>X3($v({},"__esModule",{value:!0}),t),Br,Hs=Y({"src/lib/errors/git-error.ts"(){"use strict";Br=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),Eu,_l=Y({"src/lib/errors/git-response-error.ts"(){"use strict";Hs(),Eu=class extends Br{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),hC,pC=Y({"src/lib/errors/task-configuration-error.ts"(){"use strict";Hs(),hC=class extends Br{constructor(t){super(void 0,t)}}}});function mC(t){return typeof t!="function"?$a:t}function gC(t){return typeof t=="function"&&t!==$a}function vC(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function wC(t,e=0){return bC(t)&&t.length>e?t[e]:void 0}function Ra(t,e=0){if(bC(t)&&t.length>e)return t[t.length-1-e]}function bC(t){return Jd(t)}function Su(t="",e=!0,r=` +`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Iv(t,e){return Su(t,!0).map(r=>e(r))}function Mv(t){return(0,Zd.exists)(t,Zd.FOLDER)}function Ei(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function _C(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Kd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function yn(t){return Array.isArray(t)?t:[t]}function yC(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function yl(t){return yn(t).map(e=>e instanceof String?e:String(e))}function Qe(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function yu(t,e){let r=[];for(let i=0,n=t.length;i{t[i]!==void 0&&(r[i]=t[i])}),r}function vv(t=0){return new Promise(e=>setTimeout(e,t))}function wv(t){if(t!==!1)return t}var wl,$a,ku,Xd=Y({"src/lib/utils/util.ts"(){"use strict";Dv(),wl="\0",$a=()=>{},ku=Object.prototype.toString.call.bind(Object.prototype.toString)}});function lr(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function bv(t,e){let r=_i(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function Qd(t){return!!t&&ku(t)==="[object Object]"}function EC(t){return typeof t=="function"}var Au,SC,mt,zd,Jd,Dv=Y({"src/lib/utils/argument-filters.ts"(){"use strict";Xd(),Au=t=>Array.isArray(t),SC=t=>typeof t=="number",mt=t=>typeof t=="string"||_i(t),zd=t=>mt(t)||Array.isArray(t)&&t.every(mt),Jd=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),_v,Q3=Y({"src/lib/utils/exit-codes.ts"(){"use strict";_v=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(_v||{})}}),Wd,J3=Y({"src/lib/utils/git-output-streams.ts"(){"use strict";Wd=class kC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new kC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function e8(){throw new Error("LineParser:useMatches not implemented")}var _e,Bs,t8=Y({"src/lib/utils/line-parser.ts"(){"use strict";_e=class{constructor(t,e){this.matches=[],this.useMatches=e8,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))}},Bs=class extends _e{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 AC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...CC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var CC,r8=Y({"src/lib/utils/simple-git-options.ts"(){"use strict";CC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Ov(t,e=[]){return Qd(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(_i(n))r.push(n);else if(bv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)bv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function xr(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n{for(let s=Su(n,i),a=0,o=s.length;a{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var s8=Y({"src/lib/utils/task-parser.ts"(){"use strict";Xd()}}),TC={};St(TC,{ExitCodes:()=>_v,GitOutputStreams:()=>Wd,LineParser:()=>_e,NOOP:()=>$a,NULL:()=>wl,RemoteLineParser:()=>Bs,append:()=>Ei,appendTaskOptions:()=>Ov,asArray:()=>yn,asCamelCase:()=>yC,asFunction:()=>mC,asNumber:()=>Qe,asStringArray:()=>yl,bufferToString:()=>xu,callTaskParser:()=>yv,createInstanceConfig:()=>AC,delay:()=>vv,filterArray:()=>Au,filterFunction:()=>EC,filterHasLength:()=>Jd,filterNumber:()=>SC,filterPlainObject:()=>Qd,filterPrimitives:()=>bv,filterString:()=>mt,filterStringOrStringArray:()=>zd,filterType:()=>lr,first:()=>wC,folderExists:()=>Mv,forEachLineWithContent:()=>Iv,getTrailingOptions:()=>xr,including:()=>_C,isUserFunction:()=>gC,last:()=>Ra,objectToString:()=>ku,orVoid:()=>wv,parseStringResponse:()=>Hr,pick:()=>xC,prefixedArray:()=>yu,remove:()=>Kd,splitOn:()=>vC,toLinesWithContent:()=>Su,trailingFunctionArgument:()=>st,trailingOptionsArgument:()=>Lv});var ve=Y({"src/lib/utils/index.ts"(){"use strict";Dv(),Q3(),J3(),t8(),r8(),n8(),s8(),Xd()}}),PC={};St(PC,{CheckRepoActions:()=>xv,checkIsBareRepoTask:()=>$C,checkIsRepoRootTask:()=>RC,checkIsRepoTask:()=>a8});function a8(t){switch(t){case"bare":return $C();case"root":return RC()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:eh,parser:Nv}}function RC(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:eh,parser(e){return/^\.(git)?$/.test(e.trim())}}}function $C(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:eh,parser:Nv}}function o8(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var xv,eh,Nv,FC=Y({"src/lib/tasks/check-is-repo.ts"(){"use strict";ve(),xv=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(xv||{}),eh=({exitCode:t},e,r,i)=>{if(t===128&&o8(e))return r(E.from("false"));i(e)},Nv=t=>t.trim()==="true"}});function l8(t,e){let r=new IC(t),i=t?DC:MC;return Su(e).forEach(n=>{let s=n.replace(i,"");r.paths.push(s),(OC.test(s)?r.folders:r.files).push(s)}),r}var IC,MC,DC,OC,c8=Y({"src/lib/responses/CleanSummary.ts"(){"use strict";ve(),IC=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},MC=/^[a-z]+\s*/i,DC=/^[a-z]+\s+[a-z]+\s*/i,OC=/\/$/}}),Ev={};St(Ev,{EMPTY_COMMANDS:()=>th,adhocExecTask:()=>LC,configurationErrorTask:()=>Nr,isBufferTask:()=>BC,isEmptyTask:()=>HC,straightThroughBufferTask:()=>NC,straightThroughStringTask:()=>Er});function LC(t){return{commands:th,format:"empty",parser:t}}function Nr(t){return{commands:th,format:"empty",parser(){throw typeof t=="string"?new hC(t):t}}}function Er(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function NC(t){return{commands:t,format:"buffer",parser(e){return e}}}function BC(t){return t.format==="buffer"}function HC(t){return t.format==="empty"||!t.commands.length}var th,yt=Y({"src/lib/tasks/task.ts"(){"use strict";pC(),th=[]}}),UC={};St(UC,{CONFIG_ERROR_INTERACTIVE_MODE:()=>Bv,CONFIG_ERROR_MODE_REQUIRED:()=>Hv,CONFIG_ERROR_UNKNOWN_OPTION:()=>Uv,CleanOptions:()=>Pa,cleanTask:()=>GC,cleanWithOptionsTask:()=>u8,isCleanOptionsArray:()=>f8});function u8(t,e){let{cleanMode:r,options:i,valid:n}=d8(t);return r?n.options?(i.push(...e),i.some(m8)?Nr(Bv):GC(r,i)):Nr(Uv+JSON.stringify(t)):Nr(Hv)}function GC(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(i){return l8(t==="n",i)}}}function f8(t){return Array.isArray(t)&&t.every(e=>Gv.has(e))}function d8(t){let e,r=[],i={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(n=>{h8(n)?(e=n,i.cleanMode=!0):i.options=i.options&&p8(r[r.length]=`-${n}`)}),{cleanMode:e,options:r,valid:i}}function h8(t){return t==="f"||t==="n"}function p8(t){return/^-[a-z]$/i.test(t)&&Gv.has(t.charAt(1))}function m8(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var Bv,Hv,Uv,Pa,Gv,jC=Y({"src/lib/tasks/clean.ts"(){"use strict";c8(),ve(),yt(),Bv="Git clean interactive mode is not supported",Hv='Git clean mode parameter ("n" or "f") is required',Uv="Git clean unknown option found in: ",Pa=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))(Pa||{}),Gv=new Set(["i",...yl(Object.values(Pa))])}});function g8(t){let e=new zC;for(let r of VC(t))e.addValue(r.file,String(r.key),r.value);return e}function v8(t,e){let r=null,i=[],n=new Map;for(let s of VC(t,e))s.key===e&&(i.push(r=s.value),n.has(s.file)||n.set(s.file,[]),n.get(s.file).push(r));return{key:e,paths:Array.from(n.keys()),scopes:n,value:r,values:i}}function w8(t){return t.replace(/^(file):/,"")}function*VC(t,e=null){let r=t.split("\0");for(let i=0,n=r.length-1;iObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Ra(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 fv(t,e){return typeof t=="string"&&Object.hasOwn(Sv,t)?t:e}function _8(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 x8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return g8(r)}}}function E8(){return{addConfig(t,e,...r){return this._runTask(_8(t,e,r[0]===!0,fv(r[1],"local")),st(arguments))},getConfig(t,e){return this._runTask(y8(t,fv(e,void 0)),st(arguments))},listConfig(...t){return this._runTask(x8(fv(t[0],void 0)),st(arguments))}}}var Sv,WC=Y({"src/lib/tasks/config.ts"(){"use strict";b8(),ve(),Sv=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Sv||{})}});function S8(t){return qC.has(t)}var dv,qC,YC=Y({"src/lib/tasks/diff-name-status.ts"(){"use strict";dv=(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))(dv||{}),qC=new Set(Object.values(dv))}});function k8(...t){return new KC().param(...t)}function A8(t){let e=new Set,r={};return Iv(t,i=>{let[n,s,a]=i.split(wl);e.add(n),(r[n]=r[n]||[]).push({line:Qe(s),path:n,preview:a})}),{paths:e,results:r}}function C8(){return{grep(t){let e=st(arguments),r=xr(arguments);for(let n of ZC)if(r.includes(n))return this._runTask(Nr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=k8().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return A8(n)}},e)}}}var ZC,_u,OA,KC,XC=Y({"src/lib/tasks/grep.ts"(){"use strict";ve(),yt(),ZC=["-h"],_u=Symbol("grepQuery"),KC=class{constructor(){this[OA]=[]}*[(OA=_u,Symbol.iterator)](){for(let t of this[_u])yield t}and(...t){return t.length&&this[_u].push("--and","(",...yu(t,"-e"),")"),this}param(...t){return this[_u].push(...yu(t,"-e")),this}}}}),QC={};St(QC,{ResetMode:()=>Gd,getResetMode:()=>P8,resetTask:()=>T8});function T8(t,e){let r=["reset"];return JC(t)&&r.push(`--${t}`),r.push(...e),Er(r)}function P8(t){if(JC(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function JC(t){return typeof t=="string"&&eT.includes(t)}var Gd,eT,tT=Y({"src/lib/tasks/reset.ts"(){"use strict";ve(),yt(),Gd=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Gd||{}),eT=yl(Object.values(Gd))}});function R8(){return(0,qd.default)("simple-git")}function LA(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 $8(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 jv(t,e,r,i=R8()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=$8(lr(e,mt),a,i);return c(r);function l(u,f){return Ei(s,jv(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&LA(a,f)||$a,h=LA(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var rT=Y({"src/lib/git-logger.ts"(){"use strict";ve(),qd.default.formatters.L=t=>String(Jd(t)?t.length:"-"),qd.default.formatters.B=t=>E.isBuffer(t)?t.toString("utf8"):ku(t)}}),iT,F8=Y({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Hs(),rT(),iT=(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=jv(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 Br(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.logger("Starting task"),i}static getName(r="empty"){return`task:${r}:${++t.counter}`}},t.counter=0,t)}});function Ta(t,e){return{method:wC(t.commands)||"",commands:e}}function I8(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(E.from(String(r.stack),"ascii"))}}function NA(t,e,r,i){return n=>{r("%s received %L bytes",e,n),i("%B",n),t.push(n)}}var kv,M8=Y({"src/lib/runners/git-executor-chain.ts"(){"use strict";Hs(),yt(),ve(),F8(),kv=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new iT}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:i}=this._queue.attempt(t);return await(HC(t)?this.attemptEmptyTask(t,i):this.attemptRemoteTask(t,i))}catch(i){throw this.onFatalException(t,i)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof Br?Object.assign(e,{task:t}):new Br(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",Ta(t,t.commands)),i=this._plugins.exec("spawn.args",[...t.commands],{...Ta(t,t.commands),env:{...this.env}}),n=await this.gitResponse(t,r,i,this.outputHandler,e.step("SPAWN")),s=await this.handleTaskData(t,i,n,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),BC(t)?yv(t.parser,s):yv(t.parser,s.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,i){let{exitCode:n,rejection:s,stdOut:a,stdErr:o}=r;return new Promise((l,c)=>{i("Preparing to handle process response exitCode=%d stdOut=",n);let{error:u}=this._plugins.exec("task.error",{error:s},{...Ta(t,e),...r});if(u&&t.onError)return i.info("exitCode=%s handling with custom error handler"),t.onError(r,u,f=>{i.info("custom error handler treated as success"),i("custom error returned a %s",ku(f)),l(new Wd(Array.isArray(f)?E.concat(f):f,E.concat(o)))},c);if(u)return i.info("handling as error: exitCode=%s stdErr=%s rejection=%o",n,o.length,s),c(u);i.info("retrieving task output complete"),l(new Wd(E.concat(a),E.concat(o)))})}async gitResponse(t,e,r,i,n){let s=n.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Ta(t,t.commands));return new Promise(o=>{let l=[],c=[];n.info("%s %o",e,r),n("%O",a);let u=this._beforeSpawn(t,r);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,{...Ta(t,r),kill(d){u=d||u}});let f=(0,nT.spawn)(e,r,a);f.stdout.on("data",NA(l,"stdOut",n,s.step("stdOut"))),f.stderr.on("data",NA(c,"stdErr",n,s.step("stdErr"))),f.on("error",I8(c,n)),i&&(n("Passing child process stdOut/stdErr to custom outputHandler"),i(e,f.stdout,f.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...Ta(t,r),spawned:f,close(d,h){o({stdOut:l,stdErr:c,exitCode:d,rejection:u||h})},kill(d){f.killed||(u=d,f.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...Ta(t,e),kill(i){r=i||r}}),r}}}}),sT={};St(sT,{GitExecutor:()=>aT});var aT,D8=Y({"src/lib/runners/git-executor.ts"(){"use strict";M8(),aT=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new kv(this,this._scheduler,this._plugins)}chain(){return new kv(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function O8(t,e,r=$a){let i=s=>{r(null,s)},n=s=>{(s==null?void 0:s.task)===t&&r(s instanceof Eu?L8(s):s,void 0)};e.then(i,n)}function L8(t){let e=i=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${i} should be GitResponseError.git.${i}, this will no longer be available in version 3`),e=$a};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(i,n){return n in t||(i[n]={enumerable:!1,configurable:!1,get(){return e(n),t.git[n]}}),i}}var N8=Y({"src/lib/task-callback.ts"(){"use strict";_l(),ve()}});function BA(t,e){return LC(r=>{if(!Mv(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var B8=Y({"src/lib/tasks/change-working-directory.ts"(){"use strict";ve(),yt()}});function hv(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=Kd(e,"-B")),Er(e)}function H8(){return{checkout(){return this._runTask(hv(xr(arguments,1)),st(arguments))},checkoutBranch(t,e){return this._runTask(hv(["-b",t,e,...xr(arguments)]),st(arguments))},checkoutLocalBranch(t){return this._runTask(hv(["-b",t,...xr(arguments)]),st(arguments))}}}var U8=Y({"src/lib/tasks/checkout.ts"(){"use strict";ve(),yt()}});function G8(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function j8(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Hr(G8(),[oT],t)}})}}}var oT,V8=Y({"src/lib/tasks/count-objects.ts"(){"use strict";ve(),oT=new _e(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let i=yC(e);Object.hasOwn(t,i)&&(t[i]=Qe(r))})}});function z8(t){return Hr({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},lT,t)}var lT,W8=Y({"src/lib/parsers/parse-commit.ts"(){"use strict";ve(),lT=[new _e(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,i])=>{t.branch=e,t.commit=i,t.root=!!r}),new _e(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),i=r.pop();!i||!i.includes("@")||(t.author={email:i.substr(0,i.length-1),name:r.join("<").trim()})}),new _e(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(i,10)||0}),new _e(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0;let n=parseInt(r,10)||0;i==="-"?t.summary.deletions=n:i==="+"&&(t.summary.insertions=n)})]}});function q8(t,e,r){return{commands:["-c","core.abbrev=40","commit",...yu(t,"-m"),...e,...r],format:"utf-8",parser:z8}}function Y8(){return{commit(e,...r){let i=st(arguments),n=t(e)||q8(yn(e),yn(lr(r[0],zd,[])),[...yl(lr(r[1],Au,[])),...xr(arguments,0,!0)]);return this._runTask(n,i)}};function t(e){return!zd(e)&&Nr("git.commit: requires the commit message to be supplied as a string/string[]")}}var Z8=Y({"src/lib/tasks/commit.ts"(){"use strict";W8(),ve(),yt()}});function K8(){return{firstCommit(){return this._runTask(Er(["rev-list","--max-parents=0","HEAD"],!0),st(arguments))}}}var X8=Y({"src/lib/tasks/first-commit.ts"(){"use strict";ve(),yt()}});function Q8(t,e){let r=["hash-object",t];return e&&r.push("-w"),Er(r,!0)}var J8=Y({"src/lib/tasks/hash-object.ts"(){"use strict";yt()}});function eH(t,e,r){let i=String(r).trim(),n;if(n=cT.exec(i))return new jd(t,e,!1,n[1]);if(n=uT.exec(i))return new jd(t,e,!0,n[1]);let s="",a=i.split(" ");for(;a.length;)if(a.shift()==="in"){s=a.join(" ");break}return new jd(t,e,/^re/i.test(i),s)}var jd,cT,uT,tH=Y({"src/lib/responses/InitSummary.ts"(){"use strict";jd=class{constructor(t,e,r,i){this.bare=t,this.path=e,this.existing=r,this.gitDir=i}},cT=/^Init.+ repository in (.+)$/,uT=/^Rein.+ in (.+)$/}});function rH(t){return t.includes(Vv)}function iH(t=!1,e,r){let i=["init",...r];return t&&!rH(i)&&i.splice(1,0,Vv),{commands:i,format:"utf-8",parser(n){return eH(i.includes("--bare"),e,n)}}}var Vv,nH=Y({"src/lib/tasks/init.ts"(){"use strict";tH(),Vv="--bare"}});function zv(t){for(let e=0;eHr(new fT,e,r,!1)}var pv,HA,UA,GA,hT,pT=Y({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Cu(),aH(),YC(),ve(),pv=[new _e(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,i=""])=>{t.files.push({file:e.trim(),changes:Qe(r),insertions:i.replace(/[^+]/g,"").length,deletions:i.replace(/[^-]/g,"").length,binary:!1})}),new _e(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,i])=>{t.files.push({file:e.trim(),before:Qe(r),after:Qe(i),binary:!0})}),new _e(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let i=/(\d+) i/.exec(r),n=/(\d+) d/.exec(r);t.changed=Qe(e),t.insertions=Qe(i==null?void 0:i[1]),t.deletions=Qe(n==null?void 0:n[1])})],HA=[new _e(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,i])=>{let n=Qe(e),s=Qe(r);t.changed++,t.insertions+=n,t.deletions+=s,t.files.push({file:i,changes:n+s,insertions:n,deletions:s,binary:!1})}),new _e(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],UA=[new _e(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],GA=[new _e(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,i,n,s])=>{t.changed++,t.files.push({file:s!=null?s:i,changes:0,insertions:0,deletions:0,binary:!1,status:wv(S8(e)&&e),from:wv(!!s&&i!==s&&i),similarity:Qe(r)})})],hT={"":pv,"--stat":pv,"--numstat":HA,"--name-status":GA,"--name-only":UA}}});function oH(t,e){return e.reduce((r,i,n)=>(r[i]=t[n]||"",r),Object.create({diff:null}))}function mT(t=Zv,e=gT,r=""){let i=dT(r);return function(n){let s=Su(n.trim(),!1,qv).map(function(a){let o=a.split(Yv),l=oH(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=i(o[1])),l});return{all:s,latest:s.length&&s[0]||null,total:s.length}}}var qv,Yv,Zv,gT,vT=Y({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";ve(),pT(),Cu(),qv="\xF2\xF2\xF2\xF2\xF2\xF2 ",Yv=" \xF2\xF2",Zv=" \xF2 ",gT=["hash","date","message","refs","author_name","author_email"]}}),wT={};St(wT,{diffSummaryTask:()=>lH,validateLogFormatConfig:()=>rh});function lH(t){let e=zv(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),rh(r)||{commands:r,format:"utf-8",parser:dT(e)}}function rh(t){let e=t.filter(sH);if(e.length>1)return Nr(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return Nr(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var Kv=Y({"src/lib/tasks/diff.ts"(){"use strict";Cu(),pT(),yt()}});function cH(t,e){let r=[],i=[];return Object.keys(t).forEach(n=>{r.push(n),i.push(String(t[n]))}),[r,i.join(e)]}function uH(t){return Object.keys(t).reduce((e,r)=>(r in Av||(e[r]=t[r]),e),{})}function bT(t={},e=[]){let r=lr(t.splitter,mt,Zv),i=Qd(t.format)?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[n,s]=cH(i,r),a=[],o=[`--pretty=format:${qv}${s}${Yv}`,...e],l=t.n||t["max-count"]||t.maxCount;if(l&&o.push(`--max-count=${l}`),t.from||t.to){let c=t.symmetric!==!1?"...":"..";a.push(`${t.from||""}${c}${t.to||""}`)}return mt(t.file)&&o.push("--follow",pl(t.file)),Ov(uH(t),o),{fields:n,splitter:r,commands:[...o,...a]}}function fH(t,e,r){let i=mT(t,e,zv(r));return{commands:["log",...r],format:"utf-8",parser:i}}function dH(){return{log(...r){let i=st(arguments),n=bT(Lv(arguments),yl(lr(arguments[0],Au,[]))),s=e(...r)||rh(n.commands)||t(n);return this._runTask(s,i)}};function t(r){return fH(r.splitter,r.fields,r.commands)}function e(r,i){return mt(r)&&mt(i)&&Nr("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Av,_T=Y({"src/lib/tasks/log.ts"(){"use strict";Cu(),vT(),ve(),yt(),Kv(),Av=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(Av||{})}}),Vd,yT,hH=Y({"src/lib/responses/MergeSummary.ts"(){"use strict";Vd=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},yT=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),Cv,xT,pH=Y({"src/lib/responses/PullSummary.ts"(){"use strict";Cv=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},xT=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function mv(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function jA(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Qe(e&&e[1]||"0"),delta:Qe(r&&r[1]||"0")}}var ET,mH=Y({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";ve(),ET=[new Bs(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=mv(t.remoteMessages);Object.assign(n,{[i]:Qe(r)})}),new Bs(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=mv(t.remoteMessages);Object.assign(n,{[i]:Qe(r)})}),new Bs(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,i])=>{let n=mv(t.remoteMessages);n.total=jA(e),n.reused=jA(r),n.packReused=Qe(i)})]}});function ST(t,e){return Hr({remoteMessages:new AT},kT,e)}var kT,AT,CT=Y({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";ve(),mH(),kT=[new Bs(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...ET,new Bs([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new Bs([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,i])=>{t.remoteMessages.vulnerabilities={count:Qe(e),summary:r,url:i}})],AT=class{constructor(){this.all=[]}}}});function gH(t,e){let r=Hr(new xT,TT,[t,e]);return r.message&&r}var VA,zA,WA,qA,TT,YA,Xv,PT=Y({"src/lib/parsers/parse-pull.ts"(){"use strict";pH(),ve(),CT(),VA=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,zA=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,WA=/^(create|delete) mode \d+ (.+)/,qA=[new _e(VA,(t,[e,r,i])=>{t.files.push(e),r&&(t.insertions[e]=r.length),i&&(t.deletions[e]=i.length)}),new _e(zA,(t,[e,,r,,i])=>r!==void 0||i!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+i||0,!0):!1),new _e(WA,(t,[e,r])=>{Ei(t.files,r),Ei(e==="create"?t.created:t.deleted,r)})],TT=[new _e(/^from\s(.+)$/i,(t,[e])=>{t.remote=e}),new _e(/^fatal:\s(.+)$/,(t,[e])=>{t.message=e}),new _e(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,i,n])=>{t.branch.local=i,t.hash.local=e,t.branch.remote=n,t.hash.remote=r})],YA=(t,e)=>Hr(new Cv,qA,[t,e]),Xv=(t,e)=>Object.assign(new Cv,YA(t,e),ST(t,e))}}),ZA,RT,KA,vH=Y({"src/lib/parsers/parse-merge.ts"(){"use strict";hH(),ve(),PT(),ZA=[new _e(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new _e(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new Vd(e,r))}),new _e(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,i])=>{t.conflicts.push(new Vd(e,r,{deleteRef:i}))}),new _e(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new Vd(e,null))}),new _e(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],RT=(t,e)=>Object.assign(KA(t,e),Xv(t,e)),KA=t=>Hr(new yT,ZA,t)}});function XA(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let i=RT(e,r);if(i.failed)throw new Eu(i);return i}}:Nr("Git.merge requires at least one option")}var wH=Y({"src/lib/tasks/merge.ts"(){"use strict";_l(),vH(),yt()}});function bH(t,e,r){let i=r.includes("deleted"),n=r.includes("tag")||/^refs\/tags/.test(t),s=!r.includes("new");return{deleted:i,tag:n,branch:!n,new:!s,alreadyUpdated:s,local:t,remote:e}}var QA,$T,JA,_H=Y({"src/lib/parsers/parse-push.ts"(){"use strict";ve(),CT(),QA=[new _e(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new _e(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new _e(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,i])=>{t.pushed.push(bH(e,r,i))}),new _e(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,i])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:i}}),new _e(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,i,n])=>{t.update={head:{local:e,remote:r},hash:{from:i,to:n}}})],$T=(t,e)=>{let r=JA(t,e),i=ST(t,e);return{...r,...i}},JA=(t,e)=>Hr({pushed:[]},QA,[t,e])}}),FT={};St(FT,{pushTagsTask:()=>yH,pushTask:()=>Qv});function yH(t={},e){return Ei(e,"--tags"),Qv(t,e)}function Qv(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),Kd(r,"-v"),Ei(r,"--verbose"),Ei(r,"--porcelain"),{commands:r,format:"utf-8",parser:$T}}var IT=Y({"src/lib/tasks/push.ts"(){"use strict";_H(),ve()}});function xH(){return{showBuffer(){let t=["show",...xr(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(NC(t),st(arguments))},show(){let t=["show",...xr(arguments,1)];return this._runTask(Er(t),st(arguments))}}}var EH=Y({"src/lib/tasks/show.ts"(){"use strict";ve(),yt()}}),eC,MT,SH=Y({"src/lib/responses/FileStatusSummary.ts"(){"use strict";eC=/^(.+)\0(.+)$/,MT=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let i=eC.exec(t)||[null,t,t];this.from=i[2]||"",this.path=i[1]||""}}}}});function tC(t){let[e,r]=t.split(wl);return{from:r||e,to:e}}function Jr(t,e,r){return[`${t}${e}`,r]}function gv(t,...e){return e.map(r=>Jr(t,r,(i,n)=>i.conflicted.push(n)))}function kH(t,e){let r=e.trim();switch(" "){case r.charAt(2):return i(r.charAt(0),r.charAt(1),r.slice(3));case r.charAt(1):return i(" ",r.charAt(0),r.slice(2));default:return}function i(n,s,a){let o=`${n}${s}`,l=DT.get(o);l&&l(t,a),o!=="##"&&o!=="!!"&&t.files.push(new MT(a,n,s))}}var rC,DT,OT,AH=Y({"src/lib/responses/StatusSummary.ts"(){"use strict";ve(),SH(),rC=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},DT=new Map([Jr(" ","A",(t,e)=>t.created.push(e)),Jr(" ","D",(t,e)=>t.deleted.push(e)),Jr(" ","M",(t,e)=>t.modified.push(e)),Jr("A"," ",(t,e)=>{t.created.push(e),t.staged.push(e)}),Jr("A","M",(t,e)=>{t.created.push(e),t.staged.push(e),t.modified.push(e)}),Jr("D"," ",(t,e)=>{t.deleted.push(e),t.staged.push(e)}),Jr("M"," ",(t,e)=>{t.modified.push(e),t.staged.push(e)}),Jr("M","M",(t,e)=>{t.modified.push(e),t.staged.push(e)}),Jr("R"," ",(t,e)=>{t.renamed.push(tC(e))}),Jr("R","M",(t,e)=>{let r=tC(e);t.renamed.push(r),t.modified.push(r.to)}),Jr("!","!",(t,e)=>{(t.ignored=t.ignored||[]).push(e)}),Jr("?","?",(t,e)=>t.not_added.push(e)),...gv("A","A","U"),...gv("D","D","U"),...gv("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,i=/behind (\d+)/,n=/^(.+?(?=(?:\.{3}|\s|$)))/,s=/\.{3}(\S*)/,a=/\son\s(\S+?)(?=\.{3}|$)/,o=r.exec(e);t.ahead=o&&+o[1]||0,o=i.exec(e),t.behind=o&&+o[1]||0,o=n.exec(e),t.current=lr(o==null?void 0:o[1],mt,null),o=s.exec(e),t.tracking=lr(o==null?void 0:o[1],mt,null),o=a.exec(e),o&&(t.current=lr(o==null?void 0:o[1],mt,t.current)),t.detached=/\(no branch\)/.test(e)}]]),OT=function(t){let e=t.split(wl),r=new rC;for(let i=0,n=e.length;i!LT.includes(r))],parser(r){return OT(r)}}}var LT,TH=Y({"src/lib/tasks/status.ts"(){"use strict";AH(),LT=["--null","-z"]}});function Yd(t=0,e=0,r=0,i="",n=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:i,installed:n},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function PH(){return Yd(0,0,0,"",!1)}function RH(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:$H,onError(t,e,r,i){if(t.exitCode===-2)return r(E.from(Jv));i(e)}})}}}function $H(t){return t===Jv?PH():Hr(Yd(0,0,0,t),NT,t)}var Jv,NT,FH=Y({"src/lib/tasks/version.ts"(){"use strict";ve(),Jv="installed=false",NT=[new _e(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,i,n=""])=>{Object.assign(t,Yd(Qe(e),Qe(r),Qe(i),n))}),new _e(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,i,n=""])=>{Object.assign(t,Yd(Qe(e),Qe(r),i,n))})]}});function iC(t,e,r,...i){return mt(r)?e(r,lr(i[0],mt),xr(arguments)):Nr(`git.${t}() requires a string 'repoPath'`)}function IH(){return{clone(t,...e){return this._runTask(iC("clone",Tv,lr(t,mt),...e),st(arguments))},mirror(t,...e){return this._runTask(iC("mirror",BT,lr(t,mt),...e),st(arguments))}}}var Tv,BT,MH=Y({"src/lib/tasks/clone.ts"(){"use strict";yt(),ve(),Tv=(t,e,r)=>{let i=["clone",...r];return mt(t)&&i.push(pl(t)),mt(e)&&i.push(pl(e)),Er(i)},BT=(t,e,r)=>(Ei(r,"--mirror"),Tv(t,e,r))}}),HT={};St(HT,{SimpleGitApi:()=>Pv});var Pv,DH=Y({"src/lib/simple-git-api.ts"(){"use strict";N8(),B8(),U8(),V8(),Z8(),WC(),X8(),XC(),J8(),nH(),_T(),wH(),IT(),EH(),TH(),yt(),FH(),ve(),MH(),Pv=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),i=r.push(t);return e&&O8(t,i,e),Object.create(this,{then:{value:i.then.bind(i)},catch:{value:i.catch.bind(i)},_executor:{value:r}})}add(t){return this._runTask(Er(["add",...yn(t)]),st(arguments))}cwd(t){let e=st(arguments);return typeof t=="string"?this._runTask(BA(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(BA(t.path,t.root&&this._executor||void 0),e):this._runTask(Nr("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Q8(t,e===!0),st(arguments))}init(t){return this._runTask(iH(t===!0,this._executor.cwd,xr(arguments)),st(arguments))}merge(){return this._runTask(XA(xr(arguments)),st(arguments))}mergeFromTo(t,e){return mt(t)&&mt(e)?this._runTask(XA([t,e,...xr(arguments)]),st(arguments,!1)):this._runTask(Nr("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=Qv({remote:lr(arguments[0],mt),branch:lr(arguments[1],mt)},xr(arguments));return this._runTask(t,st(arguments))}stash(){return this._runTask(Er(["stash",...xr(arguments)]),st(arguments))}status(){return this._runTask(CH(xr(arguments)),st(arguments))}},Object.assign(Pv.prototype,H8(),IH(),Y8(),E8(),j8(),K8(),C8(),dH(),xH(),RH())}}),UT={};St(UT,{Scheduler:()=>jT});var nC,jT,OH=Y({"src/lib/runners/scheduler.ts"(){"use strict";ve(),rT(),nC=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,GT.createDeferred)();return{promise:e,done:r,id:t}}})(),jT=class{constructor(t=2){this.concurrency=t,this.logger=jv("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=Ei(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),Kd(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=Ei(this.pending,nC());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),VT={};St(VT,{applyPatchTask:()=>LH});function LH(t,e){return Er(["apply",...e,...t])}var NH=Y({"src/lib/tasks/apply-patch.ts"(){"use strict";yt()}});function BH(t,e){return{branch:t,hash:e,success:!0}}function HH(t){return{branch:t,hash:null,success:!1}}var zT,UH=Y({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";zT=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function WT(t,e){return e===1&&Rv.test(t)}var sC,Rv,aC,ih,GH=Y({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";UH(),ve(),sC=/(\S+)\s+\(\S+\s([^)]+)\)/,Rv=/^error[^']+'([^']+)'/m,aC=[new _e(sC,(t,[e,r])=>{let i=BH(e,r);t.all.push(i),t.branches[e]=i}),new _e(Rv,(t,[e])=>{let r=HH(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],ih=(t,e)=>Hr(new zT,aC,[t,e])}}),qT,jH=Y({"src/lib/responses/BranchSummary.ts"(){"use strict";qT=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,i,n){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:i,label:n}}}}});function oC(t){return t?t.charAt(0):""}function YT(t,e=!1){return Hr(new qT,e?[KT]:ZT,t)}var ZT,KT,VH=Y({"src/lib/parsers/parse-branch.ts"(){"use strict";jH(),ve(),ZT=[new _e(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,i,n])=>{t.push(oC(e),!0,r,i,n)}),new _e(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,i,n])=>{t.push(oC(e),!1,r,i,n)})],KT=new _e(/^(\S+)$/s,(t,[e])=>{t.push("*",!1,e,"","")})}}),XT={};St(XT,{branchLocalTask:()=>WH,branchTask:()=>zH,containsDeleteBranchCommand:()=>QT,deleteBranchTask:()=>YH,deleteBranchesTask:()=>qH});function QT(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function zH(t){let e=QT(t),r=t.includes("--show-current"),i=["branch",...t];return i.length===1&&i.push("-a"),i.includes("-v")||i.splice(1,0,"-v"),{format:"utf-8",commands:i,parser(n,s){return e?ih(n,s).all[0]:YT(n,r)}}}function WH(){return{format:"utf-8",commands:["branch","-v"],parser(t){return YT(t)}}}function qH(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,i){return ih(r,i)},onError({exitCode:r,stdOut:i},n,s,a){if(!WT(String(n),r))return a(n);s(i)}}}function YH(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(i,n){return ih(i,n).branches[t]},onError({exitCode:i,stdErr:n,stdOut:s},a,o,l){if(!WT(String(a),i))return l(a);throw new Eu(r.parser(xu(s),xu(n)),String(a))}};return r}var ZH=Y({"src/lib/tasks/branch.ts"(){"use strict";_l(),GH(),VH(),ve()}});function KH(t){let e=t.trim().replace(/^["']|["']$/g,"");return e&&(0,JT.normalize)(e)}var e2,XH=Y({"src/lib/responses/CheckIgnore.ts"(){"use strict";e2=t=>t.split(/\n/g).map(KH).filter(Boolean)}}),t2={};St(t2,{checkIgnoreTask:()=>QH});function QH(t){return{commands:["check-ignore",...t],format:"utf-8",parser:e2}}var JH=Y({"src/lib/tasks/check-ignore.ts"(){"use strict";XH()}});function e6(t,e){return Hr({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},r2,[t,e])}var r2,t6=Y({"src/lib/parsers/parse-fetch.ts"(){"use strict";ve(),r2=[new _e(/From (.+)$/,(t,[e])=>{t.remote=e}),new _e(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new _e(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new _e(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new _e(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,i,n])=>{t.updated.push({name:i,tracking:n,to:r,from:e})})]}}),i2={};St(i2,{fetchTask:()=>i6});function r6(t){return/^--upload-pack(=|$)/.test(t)}function i6(t,e,r){let i=["fetch",...r];return t&&e&&i.push(t,e),i.find(r6)?Nr("git.fetch: potential exploit argument blocked."):{commands:i,format:"utf-8",parser:e6}}var n6=Y({"src/lib/tasks/fetch.ts"(){"use strict";t6(),yt()}});function s6(t){return Hr({moves:[]},n2,t)}var n2,a6=Y({"src/lib/parsers/parse-move.ts"(){"use strict";ve(),n2=[new _e(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),s2={};St(s2,{moveTask:()=>o6});function o6(t,e){return{commands:["mv","-v",...yn(t),e],format:"utf-8",parser:s6}}var l6=Y({"src/lib/tasks/move.ts"(){"use strict";a6(),ve()}}),a2={};St(a2,{pullTask:()=>c6});function c6(t,e,r){let i=["pull",...r];return t&&e&&i.splice(1,0,t,e),{commands:i,format:"utf-8",parser(n,s){return Xv(n,s)},onError(n,s,a,o){let l=gH(xu(n.stdOut),xu(n.stdErr));if(l)return o(new Eu(l));o(s)}}}var u6=Y({"src/lib/tasks/pull.ts"(){"use strict";_l(),PT(),ve()}});function f6(t){let e={};return o2(t,([r])=>e[r]={name:r}),Object.values(e)}function d6(t){let e={};return o2(t,([r,i,n])=>{Object.hasOwn(e,r)||(e[r]={name:r,refs:{fetch:"",push:""}}),n&&i&&(e[r].refs[n.replace(/[^a-z]/g,"")]=i)}),Object.values(e)}function o2(t,e){Iv(t,r=>e(r.split(/\s+/)))}var h6=Y({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";ve()}}),l2={};St(l2,{addRemoteTask:()=>p6,getRemotesTask:()=>m6,listRemotesTask:()=>g6,remoteTask:()=>v6,removeRemoteTask:()=>w6});function p6(t,e,r){return Er(["remote","add",...r,t,e])}function m6(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?d6:f6}}function g6(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),Er(e)}function v6(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),Er(e)}function w6(t){return Er(["remote","remove",t])}var b6=Y({"src/lib/tasks/remote.ts"(){"use strict";h6(),yt()}}),c2={};St(c2,{stashListTask:()=>_6});function _6(t={},e){let r=bT(t),i=["stash","list",...r.commands,...e],n=mT(r.splitter,r.fields,zv(i));return rh(i)||{commands:i,format:"utf-8",parser:n}}var y6=Y({"src/lib/tasks/stash-list.ts"(){"use strict";Cu(),vT(),Kv(),_T()}}),u2={};St(u2,{addSubModuleTask:()=>x6,initSubModuleTask:()=>E6,subModuleTask:()=>nh,updateSubModuleTask:()=>S6});function x6(t,e){return nh(["add",t,e])}function E6(t){return nh(["init",...t])}function nh(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),Er(e)}function S6(t){return nh(["update",...t])}var k6=Y({"src/lib/tasks/sub-module.ts"(){"use strict";yt()}});function A6(t,e){let r=Number.isNaN(t),i=Number.isNaN(e);return r!==i?r?1:-1:r?f2(t,e):0}function f2(t,e){return t===e?0:t>e?1:-1}function C6(t){return t.trim()}function Ud(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var lC,d2,T6=Y({"src/lib/responses/TagList.ts"(){"use strict";lC=class{constructor(t,e){this.all=t,this.latest=e}},d2=function(t,e=!1){let r=t.split(` +`).map(C6).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return A6(Ud(a[0]),Ud(o[0]));for(let l=0,c=Math.max(a.length,o.length);ln.indexOf(".")>=0);return new lC(r,i)}}}),h2={};St(h2,{addAnnotatedTagTask:()=>$6,addTagTask:()=>R6,tagListTask:()=>P6});function P6(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return d2(r,e)}}}function R6(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function $6(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var F6=Y({"src/lib/tasks/tag.ts"(){"use strict";T6()}}),I6=K3({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(D8(),_t(sT)),{SimpleGitApi:i}=(DH(),_t(HT)),{Scheduler:n}=(OH(),_t(UT)),{adhocExecTask:s,configurationErrorTask:a}=(yt(),_t(Ev)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(ve(),_t(TC)),{applyPatchTask:w}=(NH(),_t(VT)),{branchTask:y,branchLocalTask:b,deleteBranchesTask:S,deleteBranchTask:C}=(ZH(),_t(XT)),{checkIgnoreTask:A}=(JH(),_t(t2)),{checkIsRepoTask:k}=(FC(),_t(PC)),{cleanWithOptionsTask:v,isCleanOptionsArray:x}=(jC(),_t(UC)),{diffSummaryTask:_}=(Kv(),_t(wT)),{fetchTask:P}=(n6(),_t(i2)),{moveTask:T}=(l6(),_t(s2)),{pullTask:M}=(u6(),_t(a2)),{pushTagsTask:$}=(IT(),_t(FT)),{addRemoteTask:D,getRemotesTask:Q,listRemotesTask:ye,remoteTask:de,removeRemoteTask:J}=(b6(),_t(l2)),{getResetMode:X,resetTask:he}=(tT(),_t(QC)),{stashListTask:z}=(y6(),_t(c2)),{addSubModuleTask:K,initSubModuleTask:G,subModuleTask:Me,updateSubModuleTask:Et}=(k6(),_t(u2)),{addAnnotatedTagTask:Ht,addTagTask:De,tagListTask:Rt}=(F6(),_t(h2)),{straightThroughBufferTask:$t,straightThroughStringTask:Xe}=(yt(),_t(Ev));function re(B,N){this._plugins=N,this._executor=new r(B.baseDir,new n(B.maxConcurrentProcesses),N),this._trimmed=B.trimmed}(re.prototype=Object.create(i.prototype)).constructor=re,re.prototype.customBinary=function(B){return this._plugins.reconfigure("binary",B),this},re.prototype.env=function(B,N){return arguments.length===1&&typeof B=="object"?this._executor.env=B:(this._executor.env=this._executor.env||{})[B]=N,this},re.prototype.stashList=function(B){return this._runTask(z(g(arguments)||{},l(B)&&B||[]),p(arguments))},re.prototype.mv=function(B,N){return this._runTask(T(B,N),p(arguments))},re.prototype.checkoutLatestTag=function(B){var N=this;return this.pull(function(){N.tags(function(ue,Re){N.checkout(Re.latest,B)})})},re.prototype.pull=function(B,N,ue,Re){return this._runTask(M(d(B,u),d(N,u),h(arguments)),p(arguments))},re.prototype.fetch=function(B,N){return this._runTask(P(d(B,u),d(N,u),h(arguments)),p(arguments))},re.prototype.silent=function(B){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.")))},re.prototype.tags=function(B,N){return this._runTask(Rt(h(arguments)),p(arguments))},re.prototype.rebase=function(){return this._runTask(Xe(["rebase",...h(arguments)]),p(arguments))},re.prototype.reset=function(B){return this._runTask(he(X(B),h(arguments)),p(arguments))},re.prototype.revert=function(B){let N=p(arguments);return typeof B!="string"?this._runTask(a("Commit must be a string"),N):this._runTask(Xe(["revert",...h(arguments,0,!0),B]),N)},re.prototype.addTag=function(B){let N=typeof B=="string"?De(B):a("Git.addTag requires a tag name");return this._runTask(N,p(arguments))},re.prototype.addAnnotatedTag=function(B,N){return this._runTask(Ht(B,N),p(arguments))},re.prototype.deleteLocalBranch=function(B,N,ue){return this._runTask(C(B,typeof N=="boolean"?N:!1),p(arguments))},re.prototype.deleteLocalBranches=function(B,N,ue){return this._runTask(S(B,typeof N=="boolean"?N:!1),p(arguments))},re.prototype.branch=function(B,N){return this._runTask(y(h(arguments)),p(arguments))},re.prototype.branchLocal=function(B){return this._runTask(b(),p(arguments))},re.prototype.raw=function(B){let N=!Array.isArray(B),ue=[].slice.call(N?arguments:B,0);for(let Ut=0;Utconsole.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},re.prototype.checkIgnore=function(B,N){return this._runTask(A(o(d(B,f,[]))),p(arguments))},re.prototype.checkIsRepo=function(B,N){return this._runTask(k(d(B,u)),p(arguments))},e.exports=re}});Hs();var M6=class extends Br{constructor(t,e){super(void 0,e),this.config=t}};Hs();Hs();var bl=class extends Br{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};_l();pC();FC();jC();WC();YC();XC();tT();function D6(t){return t?[{type:"spawn.before",action(i,n){t.aborted&&n.kill(new bl(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(i,n){function s(){n.kill(new bl(void 0,"abort","Abort signal received"))}t.addEventListener("abort",s),n.spawned.on("close",()=>t.removeEventListener("abort",s))}}]:void 0}function O6(t={}){return{type:"spawn.args",action(e,{env:r}){for(let i of DA(e,r))if(t[i.category]!==!0)throw new bl(void 0,"unsafe",i.message);return e}}}ve();function L6(t){let e=yu(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}ve();var cC=(0,vl.deferred)().promise;function N6({onClose:t=!0,onExit:e=50}={}){function r(){let n=-1,s={close:(0,vl.deferred)(),closeTimeout:(0,vl.deferred)(),exit:(0,vl.deferred)(),exitTimeout:(0,vl.deferred)()},a=Promise.race([t===!1?cC:s.closeTimeout.promise,e===!1?cC:s.exitTimeout.promise]);return i(t,s.close,s.closeTimeout),i(e,s.exit,s.exitTimeout),{close(o){n=o,s.close.done()},exit(o){n=o,s.exit.done()},get exitCode(){return n},result:a}}function i(n,s,a){n!==!1&&(n===!0?s.promise:s.promise.then(()=>vv(n))).then(a.done)}return{type:"spawn.after",async action(n,{spawned:s,close:a}){var u,f;let o=r(),l=!0,c=()=>{l=!1};(u=s.stdout)==null||u.on("data",c),(f=s.stderr)==null||f.on("data",c),s.on("error",c),s.on("close",d=>o.close(d)),s.on("exit",d=>o.exit(d));try{await o.result,l&&await vv(50),a(o.exitCode)}catch(d){a(o.exitCode,d)}}}}ve();var B6="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",uC="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function H6(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}function fC(t,e){if(t.length<1||t.length>2)throw new bl(void 0,"binary",B6);if(t.some(H6))if(e)console.warn(uC);else throw new bl(void 0,"binary",uC);let[i,n]=t;return{binary:i,prefix:n}}function U6(t,e=["git"],r=!1){let i=fC(yn(e),r);t.on("binary",n=>{i=fC(yn(n),r)}),t.append("spawn.binary",()=>i.binary),t.append("spawn.args",n=>i.prefix?[i.prefix,...n]:n)}Hs();function G6(t){return!!(t.exitCode&&t.stdErr.length)}function j6(t){return E.concat([...t.stdOut,...t.stdErr])}function V6(t=!1,e=G6,r=j6){return(i,n)=>!t&&i||!e(n)?i:r(n)}function dC(t){return{type:"task.error",action(e,r){let i=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return E.isBuffer(i)?{error:new Br(void 0,i.toString("utf-8"))}:{error:i}}}}ve();var z6=class{constructor(){this.plugins=new Set,this.events=new p2.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=Ei(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return yn(t).forEach(r=>r&&this.plugins.add(Ei(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let i=e,n=Object.freeze(Object.create(r));for(let s of this.plugins)s.type===t&&(i=s.action(i,n));return i}};ve();function W6(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(s,a){return r.includes(a.method)?_C(s,e):s}},{type:"spawn.after",action(s,a){var o;a.commands.includes(e)&&((o=a.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:a.method,stage:q6(c[1]),progress:Qe(c[2]),processed:Qe(c[3]),total:Qe(c[4])})}))}}]}function q6(t){return String(t.toLowerCase().split(" ",1))||"unknown"}ve();function Y6(t){let e=xC(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function Z6({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(i,n){var c,u;let s;function a(){s&&clearTimeout(s),s=setTimeout(l,t)}function o(){var f,d;(f=n.spawned.stdout)==null||f.off("data",a),(d=n.spawned.stderr)==null||d.off("data",a),n.spawned.off("exit",o),n.spawned.off("close",o),s&&clearTimeout(s)}function l(){o(),n.kill(new bl(void 0,"timeout","block timeout reached"))}r&&((c=n.spawned.stdout)==null||c.on("data",a)),e&&((u=n.spawned.stderr)==null||u.on("data",a)),n.spawned.on("exit",o),n.spawned.on("close",o),a()}}}function K6(){return{type:"spawn.args",action(t){let e=[],r;function i(n){(r=r||[]).push(...n)}for(let n=0;n_i(a)&&ml(a)||a));break}e.push(s)}return r?[...e,"--",...r.map(String)]:e}}}ve();var X6=I6();function Q6(t,e){var n;let r=new z6,i=AC(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Mv(i.baseDir))throw new M6(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(L6(i.config)),r.add(O6(i.unsafe)),r.add(N6(i.completion)),i.abort&&r.add(D6(i.abort)),i.progress&&r.add(W6(i.progress)),i.timeout&&r.add(Z6(i.timeout)),i.spawnOptions&&r.add(Y6(i.spawnOptions)),r.add(K6()),r.add(dC(V6(!0))),i.errors&&r.add(dC(i.errors)),U6(r,i.binary,(n=i.unsafe)==null?void 0:n.allowUnsafeCustomBinary),new X6(i,r)}_l();var m2=Q6;var Ce=class extends cl{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var i;if(await this.isGitInstalled()){let n=this.app.vault.adapter,s=n.getBasePath(),a=s;this.plugin.settings.basePath&&(await n.exists((0,Zn.normalizePath)(this.plugin.settings.basePath))?a=We.join(s,this.plugin.settings.basePath):r||new Zn.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=a,this.git=m2({baseDir:a,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?Rd:void 0),config:["core.quotepath=off"],unsafe:{allowUnsafeCustomBinary:!0,allowUnsafeEditor:!0,allowUnsafeAskPass:!0,allowUnsafeConfigEnvCount:!0,allowUnsafeConfigPaths:!0,allowUnsafeCredentialHelper:!0,allowUnsafeGitProxy:!0,allowUnsafeGpgProgram:!0,allowUnsafeHooksPath:!0,allowUnsafeMergeDriver:!0,allowUnsafeSshCommand:!0,allowUnsafePager:!0}});let o=this.plugin.localStorage.getPATHPaths(),l=this.plugin.localStorage.getEnvVars(),c=this.plugin.settings.gitDir,u={...process.env};if(o.length>0){let y=o.join(":")+":"+u.PATH;u.PATH=y}c&&(u.GIT_DIR=c,u.GIT_WORK_TREE=a);for(let y of l){let[b,S]=y.split("=");u[b]=S}let f="simple-git",d=",",p=((i=localStorage.debug)!=null?i:"").split(d);if(!p.includes(f)&&!p.includes(`-${f}`)&&(p.push(f),w2.default.enable(p.join(d))),await this.git.env(u).checkIsRepo()){let y=await this.git.revparse("--show-cdup"),b=(0,Tu.resolve)(a+Tu.sep+y);this.absoluteRepoPath=b,await this.git.cwd(b)}let g=We.join(s,this.app.vault.configDir,"plugins","obsidian-git"),w=We.join(g,Sa);u.SSH_ASKPASS==null&&(u.SSH_ASKPASS=w),u.SSH_ASKPASS_REQUIRE="force",u.OBSIDIAN_GIT_CREDENTIALS_INPUT=We.join(g,$d),u.SSH_ASKPASS==w&&this.askpass().catch(y=>this.plugin.displayError(y)),u.OBSIDIAN_GIT="1",this.git=this.git.env(u)}}getRelativeVaultPath(r){let n=this.app.vault.adapter.getBasePath(),s=We.join(this.absoluteRepoPath,r),a=We.relative(n,s);return Zn.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(r,i=!0){if(i){let s=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,o=We.join(s,r),l=We.relative(a,o);return Zn.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}get absPluginConfigPath(){let i=this.app.vault.adapter.getBasePath();return We.join(i,this.app.vault.configDir,"plugins","obsidian-git")}get relPluginConfigPath(){return We.join(this.app.vault.configDir,"plugins","obsidian-git")}async askpass(){let r=this.app.vault.adapter,i=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await ei.writeFile(We.join(this.absPluginConfigPath,Sa),Nk),await ei.chmod(We.join(this.absPluginConfigPath,Sa),493),this.watchAbortController=new AbortController;let{signal:n}=this.watchAbortController;try{let s=ei.watch(this.absPluginConfigPath,{signal:n});for await(let a of s){if(a.filename!=$d)continue;let o=i+$d;if(await new Promise(d=>window.setTimeout(d,200)),!await r.exists(o))continue;let l=await r.read(o),c;l.length>60&&(c=new Zn.Notice(l,999999));let u=!0;l.contains("Username for")&&(u=!1);let f=await new tt(this.plugin,{allowEmpty:!0,obscure:u,placeholder:l.length>60?"Enter a response to the message.":l}).openAndGetResult();c==null||c.hide(),await r.exists(o)&&await r.write(`${o}.response`,f!=null?f:"")}}catch(s){this.plugin.displayError(s),await ei.rm(We.join(this.absPluginConfigPath,Sa),{force:!0}),await ei.rm(We.join(this.absPluginConfigPath,`${Sa}.response`),{force:!0}),await new Promise(a=>window.setTimeout(a,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{if(!await this.git.checkIsRepo())return;let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),i=We.join(this.app.vault.configDir,"plugins","obsidian-git",Sa),n=this.getRelativeRepoPath(i,!0);(await ei.readFile(r,"utf-8")).split(` +`).some(l=>l.contains(n))||await ei.appendFile(r,n+` +`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=await this.git.status(i!=null?["--",i]:[]);this.plugin.setPluginState({gitAction:0});let s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",We.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(` +`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Tu.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${Pd}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:Ls(i)}a.push("--",o);let c=await this.git.raw(a);return J6(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes}async commit({message:r,amend:i}){this.plugin.setPluginState({gitAction:4});let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),n}async stage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)&&await this.git.checkout(["--",r]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let i=We.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=[];i!=null&&n.push("--",i);let s=await this.git.clean(Pa.RECURSIVE+Pa.DRY_RUN,n);return this.plugin.setPluginState({gitAction:0}),s.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=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 r=await this.git.status(),i=r.tracking,n=r.current;if(!i&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let s=null;return i&&(s=(await this.git.diffSummary([n,i,"--"])).changed),await this.git.push(),s}catch(r){this.convertErrors(r)}}async getUnpushedCommits(){let r=await this.git.status(),i=r.tracking,n=r.current;if(i==null||n==null)return 0;let[s]=Yn(i);return(await this.getRemoteBranches(s)).includes(i)?(await this.git.diffSummary([n,i,"--"])).changed:(this.plugin.log(`Tracking branch ${i} does not exist on remote ${s}.`),0)}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let r=await this.git.status(),i=r.tracking,n=r.current;return i?(await this.git.diffSummary([n,i,"--"])).changed!==0:!1}async checkRequirements(){return await this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let r=await this.git.status(),i=await this.git.branch(["--no-color"]);return{current:r.current||void 0,tracking:r.tracking||void 0,branches:i.all}}async getRemoteUrl(r){try{return await this.git.remote(["get-url",r])||void 0}catch(i){if(String(i).contains(r))return;throw i}}async log(r,i=!0,n,s){let a;r&&(a=this.getRelativeRepoPath(r,i));let o={file:a,maxCount:n,"--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=>({...p,status:p.status,path:p.file,hash:c.hash,vaultPath:this.getRelativeVaultPath(p.file),fromPath:p.from,fromVaultPath:p.from!=null?this.getRelativeVaultPath(p.from):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(r,i,n=!0){let s=this.getRelativeRepoPath(i,n);return this.git.show([r+":"+s])}async getLocalBranchUpstream(r){try{let n=(await this.git.raw(["rev-parse","--abbrev-ref",`${r}@{upstream}`])).trim();return n.length>0?n:void 0}catch(i){return}}getAvailableLocalBranchName(r,i,n){let s=r;if(!n.includes(s))return s;let a=`${r}-${i}`,o=a,l=0;for(;n.includes(o);)l+=1,o=`${a}-${l}`;return o}async checkout(r,i){if(i){let n=`${i}/${r}`,s=await this.branchInfo();if(s.branches.includes(r)&&await this.getLocalBranchUpstream(r)===n)await this.git.checkout(r);else{let l=this.getAvailableLocalBranchName(r,i,s.branches);await this.git.checkout(["-b",l,n])}}else await this.git.checkout(r);if(this.plugin.settings.submoduleRecurseCheckout){let n=await this.getSubmodulePaths();for(let s of n){let a=await this.git.cwd({path:s,root:!1}).branch();Object.keys(a.branches).includes(r)&&await this.git.cwd({path:s,root:!1}).checkout(r)}}}async createBranch(r){await this.git.checkout(["-b",r])}async deleteBranch(r,i){await this.git.branch([i?"-D":"-d",r])}async branchIsMerged(r){return!(await this.git.branch(["--no-merged"])).all.contains(r)}async init(){await this.git.init(!1)}async clone(r,i,n){await this.git.clone(r,We.join(this.app.vault.adapter.getBasePath(),i),n?["--depth",`${n}`]:[]),await this.setGitInstance()}async setConfig(r,i){i==null?await this.git.raw(["config","--local","--unset",r]):await this.git.addConfig(r,i)}async getConfig(r,i="local"){var s;return(s=(await this.git.getConfig(r.toLowerCase(),i=="all"?void 0:i)).value)!=null?s:void 0}async fetch(r){await this.git.fetch(r!=null?[r]:[])}async setRemote(r,i){(await this.getRemotes()).includes(r)?await this.git.remote(["set-url",r,i]):await this.git.remote(["add",r,i])}async getRemoteBranches(r){let i=await this.git.branch(["-r","--list",`${r}*`]),n=[];for(let s in i.branches)n.push(i.branches[s].name);return n}async getRemotes(){let r=await this.git.remote([]);return r?r.trim().split(` +`):[]}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]=Yn(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" ");return await this.git.raw(i[0],...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(We.dirname(r)))return;let i=await this.git.raw(["-C",We.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",We.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(We.normalize(r)),o=We.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 Br){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await wu(r||"git",["--version"],{});if(i.error)if(Zn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Rd}) of Git for Windows.`);let n=await wu(Rd,["--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 Br){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 nl(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}}},b2={hash:"000000",isZeroCommit:!0,summary:""};function J6(t){let r=t.replace(`\r +`,` +`).split(` +`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return i}function t5(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r],a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=v2(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=v2(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 r5(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);ew(t.author)&&(t.author=void 0),ew(t.committer)&&(t.committer=void 0),ew(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function ew(t){return!t||Object.keys(t).length===0}function g2(t){return t.length>0&&t[0].trim()===t[0]}function v2(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}m();var q2=require("@codemirror/state");m();var tw=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},Kn=new tw;m();var ah=require("@codemirror/state"),x2=Gt(rw(),1);function E2(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var S2=ah.StateEffect.define();function k2(t,e,r){return r.update({effects:S2.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var xl=ah.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(S2))return r.value;return i5(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function oh(t){var s;let e=x2.sha256.create();if(!t)return e;let{la:r,key:i,lineOffsetsFromUnsavedChanges:n}=t;e.update(r==="untracked"?"t":"f"),e.update(i);for(let[a,o]of(s=n.entries())!=null?s:[])e.update([a,o]);return e}var Pu={get:void 0,save:void 0};function A2(t,e){Pu.get=t,Pu.save=e}function lh(t){var e,r;return(r=(e=Ru(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:Ru(pt.lineAuthor.coloringMaxAge).asDays()}function i5(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,i,n,s)=>{var p;let a=t.startState.doc,{newDoc:o}=t,l=a.lineAt(r).number,c=a.lineAt(i).number,u=o.lineAt(n).number,f=o.lineAt(s).number,d=c-l+1,h=f-u+1;for(let g=u;g<=f;g++){let w=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,y=f===g,b=h-d;y&&(w+=b),e.lineOffsetsFromUnsavedChanges.set(g,w)}}),e}m();function C2(){El=void 0,iw=[],ch=0,fh.clear(),dh.clear(),Sl.clear()}var El,uh=()=>El;function T2(t,e){var n;let r=e.length;if(r<((n=El==null?void 0:El.length)!=null?n:0))return;El={gutter:t,length:r,text:e};let i=zt.plugin.localStorage.getGutterSpacingFallbackLength();r!==i&&zt.plugin.localStorage.setGutterSpacingFallbackLength(r)}var iw=[],n5=15,ch=0;function P2(t){iw[ch]=t,ch=(ch+1)%n5}function R2(){return fA(iw)}var fh=new Map,dh=new Map,Sl=new Set;m();var V2=require("@codemirror/state"),z2=require("@codemirror/view");m();var ow=require("@codemirror/view"),B2=Gt(rw(),1),kl=require("obsidian");m();m();var hh={x:-10,y:-10};function $2(){hh.x===-10&&window.addEventListener("mousedown",t=>{hh.x=t.clientX,hh.y=t.clientY})}function F2(){for(let t of Sl)if(s5(t,hh))return t}function s5(t,e){let{x:r,y:i,width:n,height:s}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+n&&i<=e.y&&e.y<=i+s}var I2="data-commit";function M2(t,e,r){if(e.hasFocus())return;let i=F2();if(!i)return;let n=o5(i);n&&(!n.isZeroCommit&&!n.isWaitingGutter&&a5(n,t),nw("showCommitHash",t),nw("authorDisplay",t),nw("dateTimeFormatOptions",t))}function a5(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(i=>navigator.clipboard.writeText(t.hash)))}function nw(t,e){var l,c;let r,i,n=zt.plugin.settings.lineAuthor,s=n[t],a=typeof s=="boolean"?s:s!=="hide",o=pt.lineAuthor[t];if(t==="showCommitHash")r="Show commit hash",i=s;else if(t==="authorDisplay"){let u=(l=n.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(a?s:u),i=a?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=n.lastShownDateTimeFormatOptions)!=null?c:o;r="Show "+(a?s:u),r+=r.contains("date")?"":" date",i=a?"hide":u}else Ls(t);e.addItem(u=>u.setTitle(r).setSection("obs-git-line-author-configure").setChecked(a).onClick(f=>{var d,h;return(h=(d=zt.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,i)}))}function D2(t,e,r){r.setAttr(I2,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function o5(t){let e=t.getAttr(I2);return e?JSON.parse(e):void 0}m();function mh(t,e){return t==="oldest"?ph(0,!1,e).color:ph(void 0,!0,e).color}function ph(t,e,r){let i=lh(r),n=Date.now()/1e3,s=t!=null?t:0,o=(e?0:n-s)/60/60/24,l=Math.pow(Math.clamp(o/i,0,1),1/2.3),c=l5(),u=r.colorNew,f=r.colorOld,d=c?.4:1,h=sw(u.r,f.r,l)*d,p=sw(u.g,f.g,l)*d,g=sw(u.b,f.b,l)*d;return{color:`rgba(${h},${p},${g},${c?.75:.25})`,daysSinceCommit:o}}function sw(t,e,r){return t+(e-t)*r}function l5(){var t;return((t=window.app)==null?void 0:t.getTheme())==="obsidian"}function O2(t){activeDocument.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}m();function L2(t,e,r){let i;for(let n=e;n<=r;n++){let s=t.hashPerLine[n],a=t.commits.get(s);(!i||a.isZeroCommit||c5(a,i))&&(i=a)}return i}function c5(t,e){var n,s,a,o;let r=(s=(n=t.author)==null?void 0:n.epochSeconds)!=null?s:0,i=(o=(a=e.author)==null?void 0:a.epochSeconds)!=null?o:0;return r>i}var H2=require("node:util");var N2="-",u5="+",f5=3,d5="*",h5=/\S/g,p5="%",Al=class t extends ow.GutterMarker{constructor(r){super();this.text=r}eq(r){return r instanceof t&&this.text===r.text}toDOM(){return activeDocument.createTextNode(this.text)}destroy(r){}},aw=class extends ow.GutterMarker{constructor(r,i,n,s,a,o){super();this.lineAuthoring=r;this.startLine=i;this.endLine=n;this.key=s;this.settings=a;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(r){return this.key===(r==null?void 0:r.key)&&this.startLine===(r==null?void 0:r.startLine)&&this.endLine===(r==null?void 0:r.endLine)&&(this==null?void 0:this.options)===(r==null?void 0:r.options)}toDOM(){var r;return this.precomputedDomProvider=(r=this.precomputedDomProvider)!=null?r:this.computeDom(),this.precomputedDomProvider()}destroy(r){r&&(activeDocument.body.contains(r)||Sl.delete(r))}computeDom(){let r=L2(this.lineAuthoring,this.startLine,this.endLine),i=r.isZeroCommit?"":this.renderNonZeroCommit(r);return!r.isZeroCommit&&this.options!=="waiting-for-result"?T2(this,i):i=this.adaptTextForFakeCommit(r,i,this.options),this.createHtmlNode(r,i,this.options==="waiting-for-result")}createHtmlNode(r,i,n){var c,u,f,d,h,p;let s=window.createDiv();s.setText(i);let{color:a,daysSinceCommit:o}=ph((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds,r==null?void 0:r.isZeroCommit,this.settings);s.style.backgroundColor=a,s.setAttribute("data-author",(f=(u=r==null?void 0:r.author)==null?void 0:u.name)!=null?f:""),s.setAttribute("data-author-email",(h=(d=r==null?void 0:r.author)==null?void 0:d.email)!=null?h:""),(0,kl.setTooltip)(s,(p=r==null?void 0:r.summary)!=null?p:""),D2(r,n,s);function l(){let g=s.cloneNode(!0);return Sl.add(g),n||P2(o),g}return l}renderNonZeroCommit(r){let i=this.settings.showCommitHash?this.renderHash(r):"",n=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(r,this.settings.authorDisplay)}`,s=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(r,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[i,n,s].filter(o=>o.length>=1).join(" ")}renderHash(r){return r.hash.substring(0,6)}renderAuthorName(r,i){var o,l,c,u;let n=(l=(o=r==null?void 0:r.author)==null?void 0:o.name)!=null?l:"",s=n.split(" ").filter(f=>f.length>=1),a;switch(i){case"initials":a=s.map(f=>f[0].toUpperCase()).join("");break;case"first name":a=(c=s.first())!=null?c:N2;break;case"last name":a=(u=s.last())!=null?u:N2;break;case"full":a=n;break;default:return Ls(i)}return(0,H2.isDeepStrictEqual)(r==null?void 0:r.author,r==null?void 0:r.committer)||(a=a+d5),a}renderAuthoringDate(r,i,n,s){var c;if(((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds)===void 0)return"?";let o;switch(i){case"date":o=Td;break;case"datetime":o=Zg;break;case"custom":o=n;break;case"natural language":o=u=>{let f=u.diff((0,kl.moment)());return kl.moment.duration(f).humanize(!0)};break;default:return Ls(i)}let l=kl.moment.unix(r.author.epochSeconds);switch(s){case"viewer-local":break;case"author-local":l=l.utcOffset(r.author.tz),typeof o=="string"&&(o+=" Z");break;case"utc0000":l=l.utc(),typeof o=="string"&&(o+="[Z]");break;default:return Ls(s)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(r,i,n){var l,c,u;let s=(c=(l=uh())==null?void 0:l.text)!=null?c:i,a=n!=="waiting-for-result"&&r.isZeroCommit?u5:p5;i=s.replace(h5,a);let o=(u=zt.plugin.localStorage.getGutterSpacingFallbackLength())!=null?u:i.length;if(i=dA(i,o,a),n!=="waiting-for-result"&&r.isZeroCommit){let f=Math.min(o,f5);i=hA(i,o-f)}return i}};function Fa(t,e,r,i,n,s){let a=B2.sha256.create();a.update(JSON.stringify(n)),a.update(`s${e}-e${r}-k${i}-o${s}`);let o=a.hex(),l=fh.get(o);if(l)return l;let c=new aw(t,e,r,i,n,s);return fh.set(o,c),c}m();var U2=require("obsidian");function lw(){let t=zt.plugin.localStorage.getGutterSpacingFallbackLength();return new Al(Array(t).fill("-").join(""))}function cw(t){let{lineAuthoring:e,ageForInitialRender:r}=m5(t);return Fa(e,1,1,"initialGutter"+r,t,"waiting-for-result")}function m5(t){var s;let e=(s=R2())!=null?s:lh(t)*.25,r=(0,U2.moment)().add(-e,"days"),i={name:"",epochSeconds:uA(r),tz:"+0000"},n={hash:"waiting-for-result",author:i,committer:i,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",n]])},ageForInitialRender:e}}m();function G2(t,e){return Fa({hashPerLine:[void 0,"000000"],commits:new Map([["000000",b2]])},1,1,t,e)}var uw=new Al(""),W2=(0,z2.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(xl,!1);return g5(t,e)},lineMarkerChange(t){let e=oh(t.state.field(xl));return oh(t.startState.field(xl))!==e},renderEmptyElements:!0,initialSpacer:t=>(j2(t),lw()),updateSpacer:(t,e)=>{var r,i;return j2(e.view),(i=(r=uh())==null?void 0:r.gutter)!=null?i:lw()}});function g5(t,e){let r=oh(e),i=t.state.doc,n=new Map;for(let u=1;u<=i.lines;u++){let f=i.line(u).from,d=t.lineBlockAt(f).to;n.set(u,[f,d]),r.update([f,d,0])}let s=Pu.get();r.update("s"+Object.values(Pu).join(","));let a=r.hex(),o=dh.get(a);if(o)return o;let{result:l,allowCache:c}=v5(i,n,s,e);return c&&dh.set(a,l),l}function v5(t,e,r,i){let n=!0,s=t.lines,a=[];function o(f,d,h){return a.push(h.range(f,d))}let l=w5(s,i),c=t.length===0,u=t.iterLines(s,s+1).next().value==="";for(let f=1;f<=s;f++){let[d,h]=e.get(f),p=t.lineAt(h).number;if(c){o(d,h,uw);continue}if(f===s&&u){o(d,h,uw);continue}if(i===void 0){o(d,h,cw(r)),n=!1;continue}let{key:g,la:w}=i;if(w==="untracked"){o(d,h,G2(w,r));continue}let y=w.hashPerLine.length-1,b=l[f],S=l[p];if(S&&S>y&&o(d,h,uw),b!==void 0&&sv(1,b,y)&&S!==void 0&&sv(1,S,y)){o(d,h,Fa(w,b,S,g,r));continue}if(y<1){o(d,h,cw(r)),n=!1;continue}let C=Math.clamp(b!=null?b:f,1,y),A=Math.clamp(S!=null?S:p,1,y);o(d,h,Fa(w,C,A,g+"computing",r,"waiting-for-result"))}return{result:V2.RangeSet.of(a,!0),allowCache:n}}function w5(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),n=>n);let r=[void 0],i=0;for(let n=1;n<=t;n++){let s=e.lineOffsetsFromUnsavedChanges.get(n);i+=s!=null?s:0,r[n]=s===void 0?n-i:void 0}return r}function j2(t){t.dom.querySelectorAll(".cm-gutters").forEach(r=>{r!=null&&r.style&&(r.style.marginLeft||(r.style.marginLeft="unset"))})}var gh=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){return this.trackChangedHelper(e).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeLineAuthorInfo(e.path)}}destroy(){this.lineAuthorings.clear(),C2()}async computeLineAuthorInfo(e){let r=this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,i=await r.submoduleAwareHeadRevisonInContainingDirectory(e),n=await r.hashObject(e),s=E2(i,n,e);if(s!==void 0){if(!this.lineAuthorings.has(s)){let a=await r.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(s,a)}this.notifyComputationResultToSubscribers(e,s)}}notifyComputationResultToSubscribers(e,r){Kn.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyLineAuthoring(r,this.lineAuthorings.get(r))))}},Y2=q2.Prec.high([xl,W2]);var Z2="https://momentjs.com/docs/#/parsing/string-format/",b5="https://publish.obsidian.md/git-doc/Line+Authoring",vh=class extends j.PluginSettingTab{constructor(r,i){super(r,i);this.plugin=i;this.lineAuthorColorSettings=new Map;this.icon="git-pull-request"}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,i=this.plugin,n;i.settings.differentIntervalCommitAndPush?n="commit":n="commit-and-sync";let s=i.gitReady;r.empty(),s||(r.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let a;if(s){new j.Setting(r).setName("Automatic").setHeading(),new j.Setting(r).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(f=>f.setValue(i.settings.differentIntervalCommitAndPush).onChange(async d=>{i.settings.differentIntervalCommitAndPush=d,await i.saveSettings(),i.automaticsManager.reload("commit","push"),this.refreshDisplayWithDelay()})),new j.Setting(r).setName(`Auto ${n} interval (minutes)`).setDesc(`${i.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoSaveInterval"}),f.setPlaceholder(String(pt.autoSaveInterval)),f.onChange(async d=>{d!==""?i.settings.autoSaveInterval=Number(d):i.settings.autoSaveInterval=pt.autoSaveInterval,await i.saveSettings(),i.automaticsManager.reload("commit")})}),a=new j.Setting(r).setName(`Auto ${n} after stopping file edits`).setDesc(`Requires the ${n} interval not to be 0. + If turned on, do auto ${n} every ${pA(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 j.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 j.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(pt.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=pt.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new j.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(pt.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=pt.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new j.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 j.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 j.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(pt.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=pt.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new j.Setting(r).setName("Commit message").setHeading();let c=new j.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: "${pt.commitMessage}"`).onClick(()=>{f.setValue(pt.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),j.Platform.isDesktopApp&&new j.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=pt.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new j.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. "${Kg}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:Z2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for more formats."}),new j.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device. Defaults to the OS hostname if not set on desktop.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new j.Setting(r).setName("Preview commit message").addButton(f=>f.setButtonText("Preview").onClick(async()=>{let d=await i.gitManager.formatCommitMessage(i.settings.commitMessage);new j.Notice(`${d}`)})),new j.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(f=>f.setValue(i.settings.listChangedFilesInMessageBody).onChange(async d=>{i.settings.listChangedFilesInMessageBody=d,await i.saveSettings()})),new j.Setting(r).setName("Pull").setHeading(),i.gitManager instanceof Ce&&new j.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(f=>{let d={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};f.addOptions(d),f.setValue(i.settings.syncMethod),f.onChange(async h=>{i.settings.syncMethod=h,await i.saveSettings()})}),new j.Setting(r).setName("Merge strategy on conflicts").setDesc("Decide how to solve conflicts when pulling remote changes. This can be used to favor your local changes or the remote changes automatically.").addDropdown(f=>{let d={none:"None (git default)",ours:"Our changes",theirs:"Their changes"};f.addOptions(d),f.setValue(i.settings.mergeStrategy),f.onChange(async h=>{i.settings.mergeStrategy=h,await i.saveSettings()})}),new j.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(f=>f.setValue(i.settings.autoPullOnBoot).onChange(async d=>{i.settings.autoPullOnBoot=d,await i.saveSettings()})),new j.Setting(r).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),a=new j.Setting(r).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${i.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(f=>f.setValue(!i.settings.disablePush).onChange(async d=>{i.settings.disablePush=!d,this.refreshDisplayWithDelay(),await i.saveSettings()})),new j.Setting(r).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${i.settings.disablePush?"":"and push "}only.`).addToggle(f=>f.setValue(i.settings.pullBeforePush).onChange(async d=>{i.settings.pullBeforePush=d,this.refreshDisplayWithDelay(),await i.saveSettings()})),i.gitManager instanceof Ce&&(new j.Setting(r).setName("Hunk management").setDesc("Hunks are sections of grouped line changes right in your editor.").setHeading(),new j.Setting(r).setName("Signs").setDesc("This allows you to see your changes right in your editor via colored markers and stage/reset/preview individual hunks.").addToggle(f=>f.setValue(i.settings.hunks.showSigns).onChange(async d=>{i.settings.hunks.showSigns=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new j.Setting(r).setName("Hunk commands").setDesc("Adds commands to stage/reset individual Git diff hunks and navigate between them via 'Go to next/prev hunk' commands.").addToggle(f=>f.setValue(i.settings.hunks.hunkCommands).onChange(async d=>{i.settings.hunks.hunkCommands=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new j.Setting(r).setName("Status bar with summary of line changes").addDropdown(f=>f.addOptions({disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"}).setValue(i.settings.hunks.statusBar).onChange(async d=>{i.settings.hunks.statusBar=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new j.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new j.Setting(r).setName("History view").setHeading(),new j.Setting(r).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(c=>{let u={hide:"Hide",full:"Full",initials:"Initials"};c.addOptions(u),c.setValue(i.settings.authorInHistoryView),c.onChange(async f=>{i.settings.authorInHistoryView=f,await i.saveSettings(),await i.refresh()})}),new j.Setting(r).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(c=>c.setValue(i.settings.dateInHistoryView).onChange(async u=>{i.settings.dateInHistoryView=u,await i.saveSettings(),await i.refresh()})),new j.Setting(r).setName("Source control view").setHeading(),new j.Setting(r).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(c=>c.setValue(i.settings.refreshSourceControl).onChange(async u=>{i.settings.refreshSourceControl=u,await i.saveSettings()})),new j.Setting(r).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"refreshSourceControlTimer"}),c.setPlaceholder(String(pt.refreshSourceControlTimer)),c.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?i.settings.refreshSourceControlTimer=Math.max(Number(f),500):i.settings.refreshSourceControlTimer=pt.refreshSourceControlTimer,await i.saveSettings(),i.setRefreshDebouncer()})}),new j.Setting(r).setName("Miscellaneous").setHeading(),i.gitManager instanceof Ce&&new j.Setting(r).setName("Diff view style").setDesc('Set the style for the diff view. Note that the actual diff in "Split" mode is not generated by Git, but the editor itself instead so it may differ from the diff generated by Git. One advantage of this is that you can edit the text in that view.').addDropdown(c=>{let u={split:"Split",git_unified:"Unified"};c.addOptions(u),c.setValue(i.settings.diffStyle),c.onChange(async f=>{i.settings.diffStyle=f,await i.saveSettings()})}),new j.Setting(r).setName("Disable informative notifications").setDesc("Disable informative notifications for git operations to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(i.settings.disablePopups).onChange(async u=>{i.settings.disablePopups=u,this.refreshDisplayWithDelay(),await i.saveSettings()})),new j.Setting(r).setName("Disable error notifications").setDesc("Disable error notifications of any kind to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(!i.settings.showErrorNotices).onChange(async u=>{i.settings.showErrorNotices=!u,await i.saveSettings()})),i.settings.disablePopups||new j.Setting(r).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(i.settings.disablePopupsForNoChanges).onChange(async u=>{i.settings.disablePopupsForNoChanges=u,await i.saveSettings()})),new j.Setting(r).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showStatusBar).onChange(async u=>{i.settings.showStatusBar=u,await i.saveSettings()})),new j.Setting(r).setName("File menu integration").setDesc('Add "Stage", "Unstage" and "Add to .gitignore" actions to the file menu.').addToggle(c=>c.setValue(i.settings.showFileMenu).onChange(async u=>{i.settings.showFileMenu=u,await i.saveSettings()})),new j.Setting(r).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showBranchStatusBar).onChange(async u=>{i.settings.showBranchStatusBar=u,await i.saveSettings()})),new j.Setting(r).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(i.settings.changedFilesInStatusBar).onChange(async u=>{i.settings.changedFilesInStatusBar=u,await i.saveSettings()})),i.gitManager instanceof Vi?new j.Setting(r).setName("Authentication/commit author").setHeading():new j.Setting(r).setName("Commit author").setHeading(),i.gitManager instanceof Vi&&new j.Setting(r).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=i.localStorage.getUsername())!=null?u:""),c.onChange(f=>{i.localStorage.setUsername(f)})}),i.gitManager instanceof Vi&&new j.Setting(r).setName("Password/Personal access token").setDesc("Type in your password. You won't be able to see it again.").addText(c=>{c.inputEl.autocapitalize="off",c.inputEl.autocomplete="off",c.inputEl.spellcheck=!1,c.onChange(u=>{i.localStorage.setPassword(u)})}),i.gitReady&&new j.Setting(r).setName("Author name for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.name"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.name",f==""?void 0:f)})}),i.gitReady&&new j.Setting(r).setName("Author email for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.email"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.email",f==""?void 0:f)})}),new j.Setting(r).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be required for special setups.").setHeading(),i.gitManager instanceof Ce&&(new j.Setting(r).setName("Update submodules").setDesc('"Commit-and-sync" and "pull" takes care of submodules. Missing features: Conflicted files, count of pulled/pushed/committed files. Tracking branch needs to be set for each submodule.').addToggle(c=>c.setValue(i.settings.updateSubmodules).onChange(async u=>{i.settings.updateSubmodules=u,await i.saveSettings()})),i.settings.updateSubmodules&&new j.Setting(r).setName("Submodule recurse checkout/switch").setDesc("Whenever a checkout happens on the root repository, recurse the checkout on the submodules (if the branches exist).").addToggle(c=>c.setValue(i.settings.submoduleRecurseCheckout).onChange(async u=>{i.settings.submoduleRecurseCheckout=u,await i.saveSettings()}))),i.gitManager instanceof Ce&&new j.Setting(r).setName("Custom Git binary path").setDesc("Specify the path to the Git binary/executable. Git should already be in your PATH. Should only be necessary for a custom Git installation.").addText(c=>{var u;c.setValue((u=i.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{i.localStorage.setGitPath(f),i.gitManager.updateGitPath(f||"git").catch(d=>i.displayError(d))})}),i.gitManager instanceof Ce&&new j.Setting(r).setName("Additional environment variables").setDesc("Use each line for a new environment variable in the format KEY=VALUE .").addTextArea(c=>{c.setPlaceholder("GIT_DIR=/path/to/git/dir"),c.setValue(i.localStorage.getEnvVars().join(` +`)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(` +`))})}),i.gitManager instanceof Ce&&new j.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 Ce&&new j.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 j.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 j.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new j.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 j.Notice("Obsidian must be restarted for the changes to take affect.")})),new j.Setting(r).setName("Support").setHeading(),new j.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 j.Notice("Debug information copied to clipboard. May contain sensitive information!")},j.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"),j.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 j.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:b5,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 j.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 ${Pd} 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 j.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new j.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 j.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 j.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 j.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.descEl.empty(),n.descEl.createSpan({text:`The time-zone in which the authoring date should be shown. +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 j.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=Ru(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 j.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 j.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 j.Setting(this.containerEl).setName("").addText(n=>{let s=fw(r,this.settings.lineAuthor),a=fw(r,pt.lineAuthor);n.setPlaceholder(nv(a)),n.setValue(nv(s)),n.onChange(async o=>{let l=cA(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,fw(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?mh(i,n):"rgba(127,127,127,0.3)",o=j.moment.unix(j.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:Z2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,j.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Ru(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];pt[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 fw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Ru(t){let e=j.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var ti=require("obsidian");var wh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,ti.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,ti.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,ti.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,ti.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,ti.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,ti.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,ti.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,ti.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var i;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let n=(0,ti.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${n}`,((i=this.unPushedCommits)!=null?i:0)>0&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,ti.setIcon)(this.iconEl,"globe"):(0,ti.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var _h=require("obsidian"),bh=class extends _h.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,_h.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 K2=require("obsidian"),$u=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,K2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((r=this.plugin.autoCommitDebouncer)==null||r.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(e,r){let n=e-Math.round((new Date().getTime()-r.getTime())/1e3/60);return Math.max(0,n)}};m();var Wi=require("obsidian");m();var Fu=require("obsidian");async function X2(t,e,r){let i=await J2(e,r);if(i.result==="failure"){new Fu.Notice(i.reason);return}let{isGitHub:n,branch:s,repo:a,user:o,filePath:l}=i;if(n){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}-L${u}`)}else new Fu.Notice("It seems like you are not using GitHub")}async function Q2(t,e){let r=await J2(t,e);if(r.result==="failure"){new Fu.Notice(r.reason);return}let{isGitHub:i,branch:n,repo:s,user:a,filePath:o}=r;i?window.open(`https://github.com/${a}/${s}/commits/${n}/${o}`):new Fu.Notice("It seems like you are not using GitHub")}async function J2(t,e){let r=await e.branchInfo(),i=r.tracking,n=r.current,s,a=e.getRelativeRepoPath(t.path);if(e instanceof Ce){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){a=l.relativeFilepath;let c=await e.git.cwd({path:l.submodule,root:!1}).status();if(i=c.tracking||void 0,n=c.current||void 0,i){let u=i.substring(0,i.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)s=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(i==null)return{result:"failure",reason:"Remote branch is not configured"};if(n==null)return{result:"failure",reason:"Failed to get current branch name"};if(s==null){let l=i.substring(0,i.indexOf("/"));if(s=await e.getConfig(`remote.${l}.url`),s==null)return{result:"failure",reason:"Failed to get remote url"}}let o=s.match(/(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/);if(o==null)return{result:"failure",reason:"Could not parse remote url"};{let[l,c,u,f,d]=o;return{result:"success",isGitHub:!!l,repo:u||d,user:c||f,branch:n,filePath:a}}}m();var eP=require("obsidian"),yh=class extends eP.FuzzySuggestModal{constructor(e,r){super(e.app),this.plugin=e,this.changedFiles=r,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.workingDir=="U")return`Untracked | ${e.vaultPath}`;let r="",i="";return e.workingDir!=" "&&(r=`Working Dir: ${e.workingDir} `),e.index!=" "&&(i=`Index: ${e.index}`),`${r}${i} | ${e.vaultPath}`}onChooseItem(e,r){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vaultPath,"")==null?this.app.openWithDefaultApp(e.vaultPath):this.plugin.app.workspace.openLinkText(e.vaultPath,"/")}};m();var tP=require("obsidian"),xh=class extends tP.Modal{constructor(r,i){super(r);this.content=i;this.resolve=null}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onOpen(){let{contentEl:r,titleEl:i}=this;i.setText("Edit .gitignore");let n=r.createDiv(),s=n.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});n.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(s.value),this.close()})}onClose(){let{contentEl:r}=this;r.empty(),this.resolve&&this.resolve(void 0)}};m();var ju=require("@codemirror/state"),Uh=require("@codemirror/view");m();var Pl=require("@codemirror/state");m();var Wt=class t{static createHunk(e,r,i,n){return{removed:{start:e,count:r,lines:[]},added:{start:i,count:n,lines:[]},head:`@@ -${e}${r>0?`,${r}`:""} +${i}${n>0?`,${n}`:""} @@`,vend:i+Math.max(n-1,0),type:n===0?"delete":r===0?"add":"change"}}static createPartialHunk(e,r,i){let n=r,s=i-r+1,a=0;for(let o of e){let l=o.added.count-o.removed.count,c=0;if(o.added.start>=r&&o.vend<=i)c=l;else{let u=Math.max(0,i+1-(o.added.start+o.removed.count)),f=Math.max(0,r-(o.added.start+o.removed.count));o.added.start>=r&&o.added.start<=i?c=u:o.vend>=r&&o.vend<=i?(c=l-f,n=n-f):o.added.start<=r&&o.vend>=i?(c=u-f,n=n-f):a++,r>o.vend&&(n=n-l)}s=s-c}if(a!==e.length)return s===0&&(n=n-1),this.createHunk(n,s,r,i-r+1)}patchLines(e,r=!1){let i=[];for(let n of e.removed.lines)i.push("-"+n);for(let n of e.added.lines)i.push("+"+n);return r?i.map(n=>n.replace(/\r$/,"")):i}static parseDiffLine(e){let n=e.split("@@")[1].trim().split(" "),s=n[0].substring(1).split(","),a=n[1].substring(1).split(","),o=this.createHunk(parseInt(s[0]),parseInt(s[1]||"1"),parseInt(a[0]),parseInt(a[1]||"1"));return o.head=e,o}static changeEnd(e){return e.added.count===0?e.added.start:e.removed.count===0?e.added.start+e.added.count-1:e.added.start+Math.min(e.added.count,e.removed.count)-1}static calcSigns(e,r,i,n=1,s=1/0,a){if(a&&r.type!=="add")return console.error(`Invalid hunk with untracked=${a} hunk="${r.head}"`),[];n=Math.max(1,n);let{start:o,added:l,removed:c}={start:r.added.start,added:r.added.count,removed:r.removed.count},u=this.changeEnd(r),f=r.type==="delete"&&(o===0||e&&this.changeEnd(e)===o)&&(!i||i.added.start!==o+1);f&&n===1&&(n=0);let d=[];for(let h=Math.max(o,n);h<=Math.min(u,s);h++){let p=r.type==="change"&&(c>l&&h===u||e&&e.added.start===0);d.push({type:f?"topdelete":p?"changedelete":a?"untracked":r.type,count:h===o?r.type==="add"?l:c:void 0,lnum:h+(f?1:0)})}if(r.type==="change"&&l>c&&r.vend>=n&&u<=s)for(let h=Math.max(u,n);h<=Math.min(r.vend,s);h++)d.push({type:"add",count:h===r.vend?l-c:void 0,lnum:h});return d}static createPatch(e,r,i,n=!1){let s=[`diff --git a/${e} b/${e}`,`index 000000..000000 ${i}`,`--- a/${e}`,`+++ b/${e}`],a=0;r=structuredClone(r);for(let o of r){let l=o.removed.start,c=o.removed.count,u=o.added.count;o.type==="add"&&(l=l+1);let f=o.removed.lines,d=o.added.lines;n&&([c,u]=[u,c],[f,d]=[d,f]),s.push(`@@ -${l},${c} +${l+a},${u} @@`);for(let h of f)s.push("-"+h);(n?o.added:o.removed).no_nl_at_eof&&s.push("\\ No newline at end of file");for(let h of d)s.push("+"+h);(n?o.removed:o.added).no_nl_at_eof&&s.push("\\ No newline at end of file"),o.removed.start=l+a,a=a+(u-c)}return s}getSummary(e){let r={added:0,changed:0,removed:0};for(let i of e)if(i.type==="add")r.added+=i.added.count;else if(i.type==="delete")r.removed+=i.removed.count;else if(i.type==="change"){let n=i.added.count,s=i.removed.count,a=Math.min(n,s);r.changed+=a,r.added+=n-a,r.removed+=s-a}return r}static findHunk(e,r){if(!r)return[void 0,void 0];for(let i=0;i=e)return[n,i]}return[void 0,void 0]}static findNearestHunk(e,r,i,n){if(r.length!==0){if(i==="first")return 0;if(i==="last")return r.length-1;if(i==="next"){if(r[0].added.start>e)return 0;for(let s=r.length-1;s>=0;s--)if(r[s].added.start<=e){if(s+1e)return s+1;if(n)return 0}}else if(i==="prev"){if(Math.max(r[r.length-1].vend)0&&Math.max(r[s-1].vend,1)l.added.start?n++:o.added.starta.map(w=>g.replace(/&/,w))).reduce((g,w)=>g.concat(w)),p,l);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(n(h),p,u,d)}else p!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(u.length||d)&&l.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+u.join(" ")+"}")}for(let a in e)s(n(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=iP[rP]||1;return iP[rP]=e+1,"\u037C"+e.toString(36)}static mount(e,r,i){let n=e[dw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new hw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},nP=new Map,hw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=nP.get(i);if(s)return e[dw]=s;this.sheet=new n.CSSStyleSheet,nP.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[dw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;cc){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new kt(e,e+f,n,n),new kt(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 kt(e,e,n,n+f),new kt(r,r,n+f+l,s)]}if(l==1||c==1)return[new kt(e,r,n,s)];let u=SP(t,e,r,i,n,s);if(u){let[f,d,h]=u;return Ma(t,e,f,i,n,d).concat(Ma(t,f+h,r,i,d+h,s))}return y5(t,e,r,i,n,s)}var Iu=1e9,Mu=0,_w=!1;function y5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Iu<1e9&&Math.min(a,o)>Iu*16||Mu>0&&Date.now()>Mu)return Math.min(a,o)>Iu*64?[new kt(e,r,n,s)]:sP(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);pw.reset(l),mw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?mw:null,d=f?null:pw;for(let h=0;hIu||Mu>0&&!(h&63)&&Date.now()>Mu)return sP(t,e,r,i,n,s);let p=pw.advance(h,a,o,l,f,!1,c)||mw.advance(h,a,o,l,d,!0,u);if(p)return x5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new kt(e,r,n,s)]}var Th=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;rr)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},pw=new Th,mw=new Th;function x5(t,e,r,i,n,s,a,o){let l=!1;return!Tl(t,i)&&++i==r&&(l=!0),!Tl(n,o)&&++o==a&&(l=!0),l?[new kt(e,r,s,a)]:Ma(t,e,i,n,s,o).concat(Ma(t,i,r,n,o,a))}function EP(t,e){let r=1,i=Math.min(t,e);for(;rr||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Tl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function xw(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=EP(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function gw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=yw(t,f,r,i,n+h+d.length,s),g=xw(t,e,u,i,n,n+h),w=d.length+p+g;(!c||c[2]>1}}function SP(t,e,r,i,n,s){let a=r-e,o=s-n;if(an.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new kt(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function E5(t,e,r){for(;;){kP(r,1);let i=!1;for(let n=0;n3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=oP(e,s.fromA,c),d=aP(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[w,y,b]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==w.slice(b-h,b)?(s=t[n]=new kt(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=aP(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==w.slice(y,y+p)&&(s=t[n]=new kt(d-a,d,s.fromB+p,s.toB+p),d=s.toA,f=oP(e,s.fromA,s.fromA-i)),h=s.fromA-f,p=d-s.toA}if(h||p)s=t[n]=new kt(s.fromA-h,s.toA+p,s.fromB-h,s.toB+p);else if(a){if(!o){let g=cP(e,s.fromA,s.toA),w,y=g<0?-1:lP(e,s.toA,s.fromA);g>-1&&(w=g-s.fromA)<=u&&e.slice(s.fromA,g)==e.slice(s.toA,s.toA+w)?s=t[n]=s.offset(w):y>-1&&(w=s.toA-y)<=c&&e.slice(s.fromA-w,s.fromA)==e.slice(y,s.toA)&&(s=t[n]=s.offset(-w))}}else{let g=cP(r,s.fromB,s.toB),w,y=g<0?-1:lP(r,s.toB,s.fromB);g>-1&&(w=g-s.fromB)<=u&&r.slice(s.fromB,g)==r.slice(s.toB,s.toB+w)?s=t[n]=s.offset(w):y>-1&&(w=s.toB-y)<=c&&r.slice(s.fromB-w,s.fromB)==r.slice(y,s.toB)&&(s=t[n]=s.offset(-w))}}i=s.toA}return kP(t,3),t}var Ia;try{Ia=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(t){}function AP(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function CP(t,e){if(e==t.length)return 0;let r=t.charCodeAt(e);return r<192?AP(r)?1:0:Ia?!RP(r)||e==t.length-1?Ia.test(String.fromCharCode(r))?1:0:Ia.test(t.slice(e,e+2))?2:0:0}function TP(t,e){if(!e)return 0;let r=t.charCodeAt(e-1);return r<192?AP(r)?1:0:Ia?!$P(r)||e==1?Ia.test(String.fromCharCode(r))?1:0:Ia.test(t.slice(e-2,e))?2:0:0}var PP=8;function aP(t,e,r){if(e==t.length||!TP(t,e))return e;for(let i=e,n=e+r,s=0;sn)return i;i+=a}return e}function oP(t,e,r){if(!e||!CP(t,e))return e;for(let i=e,n=e-r,s=0;st>=55296&&t<=56319,$P=t=>t>=56320&&t<=57343;function Tl(t,e){return!e||e==t.length||!RP(t.charCodeAt(e-1))||!$P(t.charCodeAt(e))}function k5(t,e,r){var i;let n=r==null?void 0:r.override;return n?n(t,e):(Iu=((i=r==null?void 0:r.scanLimit)!==null&&i!==void 0?i:1e9)>>1,Mu=r!=null&&r.timeout?Date.now()+r.timeout:0,_w=!1,E5(t,e,Ma(t,0,t.length,e,0,e.length)))}function FP(){return!_w}function IP(t,e,r){return S5(k5(t,e,r),t,e)}var Si=Ie.Facet.define({combine:t=>t[0]}),vw=Ie.StateEffect.define(),A5=Ie.Facet.define(),xn=Ie.StateField.define({create(t){return null},update(t,e){for(let r of e.effects)r.is(vw)&&(t=r.value);for(let r of e.state.facet(A5))t=r(t,e);return t}});function Ew(t){let e=t.field(xn,!1);if(!e)return null;let r=t.facet(Si);return{chunks:e,side:r?r.side:null}}var Xn=class t{constructor(e,r,i,n,s,a=!0){this.changes=e,this.fromA=r,this.toA=i,this.fromB=n,this.toB=s,this.precise=a}offset(e,r){return e||r?new t(this.changes,this.fromA+e,this.toA+e,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,r,i){let n=IP(e.toString(),r.toString(),i);return MP(n,e,r,0,0,FP())}static updateA(e,r,i,n,s){return pP(hP(e,n,!0,i.length),e,r,i,s)}static updateB(e,r,i,n,s){return pP(hP(e,n,!1,r.length),e,r,i,s)}};function uP(t,e,r,i){let n=r.lineAt(t),s=i.lineAt(e);return n.to==t&&s.to==e&&tf+1&&w>d+1)break;h.push(p.offset(-c+i,-u+n)),[f,d]=fP(p.toA+i,p.toB+n,e,r),o++}a.push(new Xn(h,c,Math.max(c,f),u,Math.max(u,d),s))}return a}var Sh=1e3;function dP(t,e,r,i){let n=0,s=t.length;for(;;){if(n==s){let u=0,f=0;n&&({toA:u,toB:f}=t[n-1]);let d=e-(r?u:f);return[u+d,f+d]}let a=n+s>>1,o=t[a],[l,c]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>e)s=a;else if(c<=e)n=a+1;else return i?[o.fromA,o.fromB]:[o.toA,o.toB]}}function hP(t,e,r,i){let n=[];return e.iterChangedRanges((s,a,o,l)=>{let c=0,u=r?e.length:i,f=0,d=r?i:e.length;s>Sh&&([c,f]=dP(t,s-Sh,r,!0)),a=c?n[n.length-1]={fromA:p.fromA,fromB:p.fromB,toA:u,toB:d,diffA:p.diffA+g,diffB:p.diffB+w}:n.push({fromA:c,toA:u,fromB:f,toB:d,diffA:g,diffB:w})}),n}function pP(t,e,r,i,n){if(!t.length)return e;let s=[];for(let a=0,o=0,l=0,c=0;;a++){let u=a==t.length?null:t[a],f=u?u.fromA+o:r.length,d=u?u.fromB+l:i.length;for(;cf||w.toB+l>d))break;s.push(w.offset(o,l)),c++}if(!u)break;let h=u.toA+o+u.diffA,p=u.toB+l+u.diffB,g=IP(r.sliceString(f,h),i.sliceString(d,p),n);for(let w of MP(g,r,i,f,d,FP()))s.push(w);for(o+=u.diffA,l+=u.diffB;ch&&w.fromB+l>p)break;c++}}return s}var C5={scanLimit:500},DP=Le.ViewPlugin.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=vP(t))}update(t){(t.docChanged||t.viewportChanged||T5(t.startState,t.state)||P5(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=vP(t.view))}},{decorations:t=>t.deco}),kh=Ie.Prec.low((0,Le.gutter)({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(DP))===null||e===void 0?void 0:e.gutter)||Ie.RangeSet.empty}}));function T5(t,e){return t.field(xn,!1)!=e.field(xn,!1)}function P5(t,e){return t.facet(Si)!=e.facet(Si)}var mP=Le.Decoration.line({class:"cm-changedLine"}),R5=Le.Decoration.mark({class:"cm-changedText"}),$5=Le.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),F5=Le.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),gP=new class extends Le.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function I5(t,e,r,i,n,s){let a=r?t.fromA:t.fromB,o=r?t.toA:t.toB,l=0;if(a!=o){n.add(a,a,mP),n.add(a,o,r?F5:$5),s&&s.add(a,a,gP);for(let c=e.iterRange(a,o-1),u=a;!c.next().done;){if(c.lineBreak){u++,n.add(u,u,mP),s&&s.add(u,u,gP);continue}let f=u+c.value.length;if(i)for(;l=u)break;(a?f.toA:f.toB)>c&&(!s||!s(t.state,f,o,l))&&I5(f,t.state.doc,a,i,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}var Cl=class extends Le.WidgetType{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},Ph=Ie.StateEffect.define({map:(t,e)=>t.map(e)}),Du=Ie.StateField.define({create:()=>Le.Decoration.none,update:(t,e)=>{for(let r of e.effects)if(r.is(Ph))return r.value;return t.map(e.changes)},provide:t=>Le.EditorView.decorations.from(t)}),Ah=.01;function wP(t,e){if(t.size!=e.size)return!1;let r=t.iter(),i=e.iter();for(;r.value;){if(r.from!=i.from||Math.abs(r.value.spec.widget.height-i.value.spec.widget.height)>1)return!1;r.next(),i.next()}return!0}function M5(t,e,r){let i=new Ie.RangeSetBuilder,n=new Ie.RangeSetBuilder,s=t.state.field(Du).iter(),a=e.state.field(Du).iter(),o=0,l=0,c=0,u=0,f=t.viewport,d=e.viewport;for(let w=0;;w++){let y=wAh&&(u+=k,n.add(l,l,Le.Decoration.widget({widget:new Cl(k),block:!0,side:-1})))}if(b>o+1e3&&of.from&&ld.from){let C=Math.min(f.from-o,d.from-l);o+=C,l+=C,w--}else if(y)o=y.toA,l=y.toB;else break;for(;s.value&&s.fromAh&&n.add(e.state.doc.length,e.state.doc.length,Le.Decoration.widget({widget:new Cl(h),block:!0,side:1}));let p=i.finish(),g=n.finish();wP(p,t.state.field(Du))||t.dispatch({effects:Ph.of(p)}),wP(g,e.state.field(Du))||e.dispatch({effects:Ph.of(g)})}var ww=Ie.StateEffect.define({map:(t,e)=>e.mapPos(t)});var bw=class extends Le.WidgetType{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=e.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",i=>{let n=e.posAtDOM(i.target);e.dispatch({effects:ww.of(n)});let{side:s,sibling:a}=e.state.facet(Si);a&&a().dispatch({effects:ww.of(D5(n,e.state.field(xn),s=="a"))})}),r}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function D5(t,e,r){let i=0,n=0;for(let s=0;;s++){let a=s=t)return n+(t-i);[i,n]=r?[a.toA,a.toB]:[a.toB,a.toA]}}var O5=Ie.StateField.define({create(t){return Le.Decoration.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)r.is(ww)&&(t=t.update({filter:i=>i!=r.value}));if(t.size&&e.state.field(xn)!=e.startState.field(xn,!1)){let r=e.state.facet(Si).side=="a",i=[];for(let n of e.state.field(xn))t.between(r?n.fromA:n.fromB,r?n.toA:n.toB,s=>{i.push(s)});i.length&&(t=t.update({filter:n=>i.indexOf(n)<0}))}return t},provide:t=>Le.EditorView.decorations.from(t)});function bP({margin:t=3,minSize:e=4}){return O5.init(r=>L5(r,t,e))}function L5(t,e,r){let i=new Ie.RangeSetBuilder,n=t.facet(Si).side=="a",s=t.field(xn),a=1;for(let o=0;;o++){let l=o=r&&i.add(t.doc.line(c).from,t.doc.line(u).to,Le.Decoration.replace({widget:new bw(f),block:!0})),!l)break;a=t.doc.lineAt(Math.min(t.doc.length,n?l.toA:l.toB)).number}return i.finish()}var N5=Le.EditorView.styleModule.of(new Eh({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),B5=Le.EditorView.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),_P=new Ie.Compartment,Ch=new Ie.Compartment,Rh=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||C5;let r=[Ie.Prec.low(DP),B5,N5,Du,Le.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(Ph)))&&this.measure()})],i=[Si.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(kh);let n=Ie.EditorState.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Le.EditorView.editorAttributes.of({class:"cm-merge-a"}),Ch.of(i),r]}),s=[Si.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(kh);let a=Ie.EditorState.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Le.EditorView.editorAttributes.of({class:"cm-merge-b"}),Ch.of(s),r]});this.chunks=Xn.build(n.doc,a.doc,this.diffConf);let o=[xn.init(()=>this.chunks),_P.of(e.collapseUnchanged?bP(e.collapseUnchanged):[])];n=n.update({effects:Ie.StateEffect.appendConfig.of(o)}).state,a=a.update({effects:Ie.StateEffect.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:u),this.editorDOM.appendChild(l=="a-b"?u:c),this.a=new Le.EditorView({state:n,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new Le.EditorView({state:a,parent:u,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,r){if(e.some(i=>i.docChanged)){let i=e[e.length-1],n=e.reduce((a,o)=>a.compose(o.changes),Ie.ChangeSet.empty(e[0].startState.doc.length));this.chunks=r==this.a?Xn.updateA(this.chunks,i.newDoc,this.b.state.doc,n,this.diffConf):Xn.updateB(this.chunks,this.a.state.doc,i.newDoc,n,this.diffConf),r.update([...e,i.state.update({effects:vw.of(this.chunks)})]);let s=r==this.a?this.b:this.a;s.update([s.state.update({effects:vw.of(this.chunks)})]),this.scheduleMeasure()}else r.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let a=this.a.dom.parentNode,o=this.b.dom.parentNode;a.remove(),o.remove(),this.editorDOM.insertBefore(s?a:o,this.editorDOM.firstChild),this.editorDOM.appendChild(s?o:a),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,a=this.revertToA,o=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,a=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(s,a,o)}let r="highlightChanges"in e,i="gutter"in e,n="collapseUnchanged"in e;if(r||i||n){let s=[],a=[];if(r||i){let o=this.a.state.facet(Si),l=i?e.gutter!==!1:o.markGutter,c=r?e.highlightChanges!==!1:o.highlightChanges;s.push(Ch.reconfigure([Si.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?kh:[]])),a.push(Ch.reconfigure([Si.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?kh:[]]))}if(n){let o=_P.reconfigure(e.collapseUnchanged?bP(e.collapseUnchanged):[]);s.push(o),a.push(o)}this.a.dispatch({effects:s}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,r,i){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=i,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",n=>this.revertClicked(n)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){M5(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,r=e.firstChild,i=this.a.viewport,n=this.b.viewport;for(let s=0;si.to||a.fromB>n.to)break;if(a.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function yP(t){let e=t.nextSibling;return t.remove(),e}var Sw=require("@codemirror/state");function kw(t,e,r){let i=[],n=t.split(` +`),s=e.split(` +`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=Wt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;dn.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;ds.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Aw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:$h(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:$h(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 OP={scanLimit:1e3,timeout:200};function H5(t,e,r,i){let n=Sw.Text.of(t.split(` +`)),s=Sw.Text.of(e.split(` +`)),a=r&&i?Xn.updateB(r,n,s,i,OP):Xn.build(n,s,OP),o=[];for(let l=0;lh.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}},Ur=Pl.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let n of e.effects)n.is($l)&&(r.compareText=n.value.compareText,r.compareTextHead=n.value.compareTextHead,i=(t==null?void 0:t.compareText)!==n.value.compareText,i&&(r.chunks=void 0)),n.is(Ou)&&NP(r,n.value,e.state);if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let n=U5(e,r.compareText,r.chunks,r.maxDiffTimeMs);n&&NP(r,n,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function NP(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(Rl.editorInfoField).file;(s=(n=zt.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var Cw=Pl.StateField.define({create:()=>({debouncer:(0,Rl.debounce)(t=>{let{state:e,compareText:r,previousChunks:i,changeDesc:n}=t,s=BP(e,r,i,n);e.field(Rl.editorEditorField).dispatch({effects:Ou.of(s)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let i of e.effects)if(i.is(Ou))return t.changeDesc=void 0,t;return!t.changeDesc&&e.changes?t.changeDesc=e.changes:t.changeDesc=(r=t.changeDesc)==null?void 0:r.composeDesc(e.changes),t}});function BP(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=LP(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function U5(t,e,r,i){let n=t.state,s=Math.abs(t.changes.length-t.changes.newLength),a=n.field(Cw);if(s>1e3||i>16)a.debouncer({state:n,compareText:e,previousChunks:r,changeDesc:a.changeDesc});else return a.changeDesc=void 0,BP(n,e,r,t.changes)}var $l=Pl.StateEffect.define(),Ou=Pl.StateEffect.define();function HP(t,e){return e.update({effects:$l.of(t)})}m();m();m();var at;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(at||(at={}));var UP={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},GP={LINES:"lines",WORDS:"words",NONE:"none"},jP={WORD:"word",CHAR:"char"},Da;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Da||(Da={}));m();var G5=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],j5=RegExp("["+G5.join("\\")+"]","g");function VP(t){return t.replace(j5,"\\$&")}function Tw(t){return t&&t.replace(/\\/g,"/")}function zP(t){let e,r,i,n=0;for(e=0,i=t.length;e1?r[r.length-1]:e}function qP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var YP=["a/","b/","i/","w/","c/","o/"];function Us(t,e,r){let i=r!==void 0?[...YP,r]:YP,n=e?new RegExp(`^${VP(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 V5(t,e){return Us(t,"---",e)}function z5(t,e){return Us(t,"+++",e)}function ZP(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})/,w=/^new file mode (\d{6})/,y=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,C=/^rename to "?(.+)"?/,A=/^similarity index (\d+)%/,k=/^dissimilarity index (\d+)%/,v=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,P=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,T=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,M=/^new file mode (\d{6})/,$=/^deleted file mode (\d{6}),(\d{6})/,D=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function Q(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function ye(){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 de(){Q(),ye(),i={blocks:[],deletedLines:0,addedLines:0}}function J(z){Q();let K;i!==null&&((K=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(K[1],10),o=parseInt(K[2],10)):(K=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(K[1],10),a=parseInt(K[2],10),o=parseInt(K[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 X(z){if(i===null||n===null||s===null||o===null)return;let K={content:z},G=i.isCombined?["+ "," +","++"]:["+"],Me=i.isCombined?["- "," -","--"]:["-"];qP(z,G)?(i.addedLines++,K.type=at.INSERT,K.oldNumber=void 0,K.newNumber=o++):qP(z,Me)?(i.deletedLines++,K.type=at.DELETE,K.oldNumber=s++,K.newNumber=void 0):(K.type=at.CONTEXT,K.oldNumber=s++,K.newNumber=o++),n.lines.push(K)}function he(z,K){let G=K;for(;G{if(!z||z.startsWith("*"))return;let G,Me=D[K-1],Et=D[K+1],Ht=D[K+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(de(),(G=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=Us(G[1],void 0,e.dstPrefix),c=Us(G[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(de(),(G=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=Us(G[1],void 0,e.dstPrefix),c=Us(G[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)&&Et.startsWith(f)&&Ht.startsWith(d))&&de(),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 Rt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";J(Rt);return}if(z.startsWith(u)&&Et.startsWith(f)||z.startsWith(f)&&Me.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(G=V5(z,e.srcPrefix))){i.oldName=G,i.language=WP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(G=z5(z,e.dstPrefix))){i.newName=G,i.language=WP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){J(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){X(z);return}let De=!he(z,K);if(i===null)throw new Error("Where is my file !!!");(G=h.exec(z))?i.oldMode=G[1]:(G=p.exec(z))?i.newMode=G[1]:(G=g.exec(z))?(i.deletedFileMode=G[1],i.isDeleted=!0):(G=w.exec(z))?(i.newFileMode=G[1],i.isNew=!0):(G=y.exec(z))?(De&&(i.oldName=G[1]),i.isCopy=!0):(G=b.exec(z))?(De&&(i.newName=G[1]),i.isCopy=!0):(G=S.exec(z))?(De&&(i.oldName=G[1]),i.isRename=!0):(G=C.exec(z))?(De&&(i.newName=G[1]),i.isRename=!0):(G=x.exec(z))?(i.isBinary=!0,i.oldName=Us(G[1],void 0,e.srcPrefix),i.newName=Us(G[2],void 0,e.dstPrefix),J("Binary file")):_.test(z)?(i.isBinary=!0,J(z)):(G=A.exec(z))?i.unchangedPercentage=parseInt(G[1],10):(G=k.exec(z))?i.changedPercentage=parseInt(G[1],10):(G=v.exec(z))?(i.checksumBefore=G[1],i.checksumAfter=G[2],G[3]&&(i.mode=G[3])):(G=P.exec(z))?(i.checksumBefore=[G[2],G[3]],i.checksumAfter=G[1]):(G=T.exec(z))?(i.oldMode=[G[2],G[3]],i.newMode=G[1]):(G=M.exec(z))?(i.newFileMode=G[1],i.isNew=!0):(G=$.exec(z))&&(i.deletedFileMode=G[1],i.isDeleted=!0)}),Q(),ye(),r}m();m();m();m();var Gs=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,w=1/0,y=()=>{for(let b=Math.max(g,-c);b<=Math.min(w,c);b+=2){let S,C=h[b-1],A=h[b+1];C&&(h[b-1]=void 0);let k=!1;if(A){let x=A.oldPos-b;k=A&&0<=x&&x=l&&p+1>=o)return a(this.buildValues(S.lastComponent,r,e))||!0;h[b]=S,S.oldPos+1>=l&&(w=Math.min(w,b-1)),p+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);y()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=y();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1d.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 Pw=class extends Gs{},KP=new Pw;function Rw(t,e,r){return KP.diff(t,e,r)}m();m();function $w(t,e){let r;for(r=0;re.length&&(r=t.length-e.length);let i=e.length;t.length0&&e[a]!=e[s];)s=n[s];e[a]==e[s]&&s++}s=0;for(let a=r;a0&&t[a]!=e[s];)s=n[s];t[a]==e[s]&&s++}return s}function Mw(t,e){let r=[];for(let i of Array.from(e.segment(t))){let n=i.segment;r.length&&/\s/.test(r[r.length-1])&&/\s/.test(n)?r[r.length-1]+=n:r.push(n)}return r}function Dh(t,e){if(e)return Il(t,e)[1];let r;for(r=t.length-1;r>=0&&t[r].match(/\s/);r--);return t.substring(r+1)}function Oa(t,e){if(e)return Il(t,e)[0];let r=t.match(/^\s*/);return r?r[0]:""}function Il(t,e){if(!e)return[Oa(t),Dh(t)];if(e.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let r=Mw(t,e),i=r[0],n=r[r.length-1],s=/\s/.test(i)?i:"",a=/\s/.test(n)?n:"";return[s,a]}var Oh="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Y5=new RegExp(`[${Oh}]+|\\s+|[^${Oh}]`,"ug"),Dw=class extends Gs{equals(e,r,i){return i.ignoreCase&&(e=e.toLowerCase(),r=r.toLowerCase()),e.trim()===r.trim()}tokenize(e,r={}){let i;if(r.intlSegmenter){let a=r.intlSegmenter;if(a.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=Mw(e,a)}else i=e.match(Y5)||[];let n=[],s=null;return i.forEach(a=>{/\s/.test(a)?s==null?n.push(a):n.push(n.pop()+a):s!=null&&/\s/.test(s)?n[n.length-1]==s?n.push(n.pop()+a):n.push(s+a):n.push(a),s=a}),n}join(e){return e.map((r,i)=>i==0?r:r.replace(/^\s+/,"")).join("")}postProcess(e,r){if(!e||r.oneChangePerToken)return e;let i=null,n=null,s=null;return e.forEach(a=>{a.added?n=a:a.removed?s=a:((n||s)&&XP(i,s,n,a,r.intlSegmenter),i=a,n=null,s=null)}),(n||s)&&XP(i,s,n,null,r.intlSegmenter),e}},Z5=new Dw;function XP(t,e,r,i,n){if(e&&r){let[s,a]=Il(e.value,n),[o,l]=Il(r.value,n);if(t){let c=$w(s,o);t.value=Mh(t.value,o,c),e.value=Fl(e.value,c),r.value=Fl(r.value,c)}if(i){let c=Fw(a,l);i.value=Ih(i.value,l,c),e.value=Lu(e.value,c),r.value=Lu(r.value,c)}}else if(r){if(t){let s=Oa(r.value,n);r.value=r.value.substring(s.length)}if(i){let s=Oa(i.value,n);i.value=i.value.substring(s.length)}}else if(t&&i){let s=Oa(i.value,n),[a,o]=Il(e.value,n),l=$w(s,a);e.value=Fl(e.value,l);let c=Fw(Fl(s,l),o);e.value=Lu(e.value,c),i.value=Ih(i.value,s,c),t.value=Mh(t.value,s,s.slice(0,s.length-c.length))}else if(i){let s=Oa(i.value,n),a=Dh(e.value,n),o=Iw(a,s);e.value=Lu(e.value,o)}else if(t){let s=Dh(t.value,n),a=Oa(e.value,n),o=Iw(s,a);e.value=Fl(e.value,o)}}var Ow=class extends Gs{tokenize(e){let r=new RegExp(`(\\r?\\n)|[${Oh}]+|[^\\S\\n\\r]+|[^${Oh}]`,"ug");return e.match(r)||[]}},QP=new Ow;function Lw(t,e,r){return QP.diff(t,e,r)}m();function X5(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],i;for(i=0;i<=e.length;i++)r[i]=[i];let n;for(n=0;n<=t.length;n++)r[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?r[i][n]=r[i-1][n-1]:r[i][n]=Math.min(r[i-1][n-1]+1,Math.min(r[i][n-1]+1,r[i-1][n]+1));return r[e.length][t.length]}function Ml(t){return(e,r)=>{let i=t(e).trim(),n=t(r).trim();return X5(i,n)/(i.length+n.length)}}function Dl(t){function e(i,n,s=new Map){let a=1/0,o;for(let l=0;l0||o.indexB>0)&&(S=w.concat(S)),(i.length>d||n.length>h)&&(S=S.concat(b)),S}return r}var Jt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},La={matching:GP.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:jP.WORD,colorScheme:Da.LIGHT},En="/",JP=Ml(t=>t.value),Q5=Dl(JP);function Bw(t){return t.indexOf("dev/null")!==-1}function J5(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function e4(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function Ol(t){switch(t){case at.CONTEXT:return Jt.CONTEXT;case at.INSERT:return Jt.INSERTS;case at.DELETE:return Jt.DELETES}}function Ll(t){switch(t){case Da.DARK:return"d2h-dark-color-scheme";case Da.AUTO:return"d2h-auto-color-scheme";case Da.LIGHT:default:return"d2h-light-color-scheme"}}function t4(t){return t?2:1}function js(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function ki(t,e,r=!0){let i=t4(e);return{prefix:t.substring(0,i),content:r?js(t.substring(i)):t.substring(i)}}function Na(t){let e=Tw(t.oldName),r=Tw(t.newName);if(e!==r&&!Bw(e)&&!Bw(r)){let i=[],n=[],s=e.split(En),a=r.split(En),o=s.length,l=a.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&s[u]===a[f];)n.unshift(a[f]),u-=1,f-=1;let d=i.join(En),h=n.join(En),p=s.slice(c,u+1).join(En),g=a.slice(c,f+1).join(En);return d.length&&h.length?d+En+"{"+p+" \u2192 "+g+"}"+En+h:d.length?d+En+"{"+p+" \u2192 "+g+"}":h.length?"{"+p+" \u2192 "+g+"}"+En+h:e+" \u2192 "+r}else return Bw(r)?e:r}function Nl(t){return`d2h-${zP(Na(t)).toString().slice(-6)}`}function Bl(t){let e="file-changed";return t.isRename||t.isCopy?e="file-renamed":t.isNew?e="file-added":t.isDeleted?e="file-deleted":t.newName!==t.oldName&&(e="file-renamed"),e}function Lh(t,e,r,i={}){let{matching:n,maxLineLengthHighlight:s,matchWordsThreshold:a,diffStyle:o}=Object.assign(Object.assign({},La),i),l=ki(t,r,!1),c=ki(e,r,!1);if(l.content.length>s||c.content.length>s)return{oldLine:{prefix:l.prefix,content:js(l.content)},newLine:{prefix:c.prefix,content:js(c.content)}};let u=o==="char"?Rw(l.content,c.content):Lw(l.content,c.content),f=[];if(o==="word"&&n==="words"){let h=u.filter(w=>w.removed),p=u.filter(w=>w.added);Q5(p,h).forEach(w=>{w[0].length===1&&w[1].length===1&&JP(w[0][0],w[1][0]){let g=p.added?"ins":p.removed?"del":null,w=f.indexOf(p)>-1?' class="d2h-change"':"",y=js(p.value);return g!==null?`${h}<${g}${w}>${y}`:`${h}${y}`},"");return{oldLine:{prefix:l.prefix,content:J5(d)},newLine:{prefix:c.prefix,content:e4(d)}}}var eR="file-summary",r4="icon",i4={colorScheme:La.colorScheme},Nh=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},i4),r)}render(e){let r=e.map(i=>this.hoganUtils.render(eR,"line",{fileHtmlId:Nl(i),oldName:i.oldName,newName:i.newName,fileName:Na(i),deletedLines:"-"+i.deletedLines,addedLines:"+"+i.addedLines},{fileIcon:this.hoganUtils.template(r4,Bl(i))})).join(` +`);return this.hoganUtils.render(eR,"wrapper",{colorScheme:Ll(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var Uw=Object.assign(Object.assign({},La),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Nu="generic",tR="line-by-line",n4="icon",s4="tag",Bu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Uw),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(Nu,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(tR,"file-diff"),n=this.hoganUtils.template(Nu,"file-path"),s=this.hoganUtils.template(n4,"file"),a=this.hoganUtils.template(s4,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Na(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(Nu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Jt})}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(Nu,"block-header",{CSSLineClass:Jt,blockHeader:e.isTooBig?i.header:js(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:Jt.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;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===at.CONTEXT?r.push([[a],[],[]]):a.type===at.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===at.INSERT&&i.length>0?n.push(a):a.type===at.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=Fh(e.concat(r).map(o=>o.content.length));return n{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(` +`);return this.hoganUtils.render(Hu,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(a4,"file-diff"),n=this.hoganUtils.template(Hu,"file-path"),s=this.hoganUtils.template(o4,"file"),a=this.hoganUtils.template(l4,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Na(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Hu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Jt})}}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Jt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Jt.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;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===at.CONTEXT?r.push([[a],[],[]]):a.type===at.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===at.INSERT&&i.length>0?n.push(a):a.type===at.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=Fh(e.concat(r).map(o=>o.content.length));return n'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(i.rp("'),i.b(i.v(i.f("fileName",t,e,0))),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(i.v(i.f("addedLines",t,e,0))),i.b(""),i.b(` +`+r),i.b(' '),i.b(i.v(i.f("deletedLines",t,e,0))),i.b(""),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{"'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")"),i.b(` +`+r),i.b(' hide'),i.b(` +`+r),i.b(' show'),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
    '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-block-header"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b(" "),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-empty-diff"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" File without changes"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-file-path"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(''),i.b(` +`+r),i.b(i.rp("'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b(""),i.b(` +`+r),i.b(i.rp(""),i.b(` +`+r),i.b('"),i.fl()},partials:{""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(' '),i.b(` +`+r),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(' '),a.b(a.t(a.f("prefix",n,s,0))),a.b(""),a.b(` +`+r)}),t.pop()),i.s(i.f("prefix",t,e,1),t,e,1,0,0,"")||(i.b('  '),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(' '),a.b(a.t(a.f("content",n,s,0))),a.b(""),a.b(` +`+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b('
'),i.b(` +`+r)),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-wrapper"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});xt["icon-file-added"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file-changed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file-deleted"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file-renamed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["line-by-line-file-diff"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("diffs",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});xt["line-by-line-numbers"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("
"),i.b(` +`+r),i.b('
'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("
"),i.fl()},partials:{},subs:{}});xt["side-by-side-file-diff"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.d("diffs.left",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.d("diffs.right",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});xt["tag-file-added"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('ADDED'),i.fl()},partials:{},subs:{}});xt["tag-file-changed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('CHANGED'),i.fl()},partials:{},subs:{}});xt["tag-file-deleted"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('DELETED'),i.fl()},partials:{},subs:{}});xt["tag-file-renamed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('RENAMED'),i.fl()},partials:{},subs:{}});var Gu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=Ww.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},xt),e),i)}static compile(e){return Ww.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 u4=Object.assign(Object.assign(Object.assign({},Uw),Gw),{outputFormat:UP.LINE_BY_LINE,drawFileList:!0});function Hh(t,e={}){let r=Object.assign(Object.assign({},u4),e),i=typeof t=="string"?ZP(t,r):t,n=new Gu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Nh(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Uu(n,r).render(i):new Bu(n,r).render(i);return o+l}var cR=Gt(oR(),1);var Ba=require("obsidian"),qw=ju.StateEffect.define();function Vs(t,e){let r=t.state,i=r.field(Gh),n=r.field(Ur),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=Wt.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(Ba.editorEditorField).dispatch({effects:qw.of({pos:o,add:!l})})}var Gh=ju.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(qw)&&(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}}),uR=ju.StateField.define({create:t=>lR(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is($l)||r.is(qw))?lR(e.state):t},provide:t=>Uh.showTooltip.computeN([t],e=>e.field(t))}),fR=Uh.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 lR(t){let e=t.field(Ur);return e?[...t.field(Gh)].map(i=>{let n=t.doc.lineAt(i),s=Wt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>f4(s,t,i)}}).filter(i=>i!==void 0):[]}function f4(t,e,r){var g,w;let i=Wt.createPatch("file",[t],"10064",!1).join(` +`)+` +`,n=Hh(i,{colorScheme:cR.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=(y,b)=>{let S=createDiv();return(0,Ba.setIcon)(S,y),S.setAttr("aria-label",b),S.addClass("clickable-icon"),S},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(Ba.editorEditorField);l.onclick=()=>{Vs(d,r)},c.onclick=()=>{let y=zt.plugin;y&&(y.promiseQueue.addTask(()=>y.hunkActions.stageHunk(r)),Vs(d,r))},u.onclick=()=>{let y=zt.plugin;y&&(y.hunkActions.resetHunk(r),Vs(d,r))};let h=(w=(g=zt.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(Ba.MarkdownView))==null?void 0:w.scope,p=h==null?void 0:h.register(null,"Escape",(y,b)=>{Vs(d,r)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:y=>{r=y.changes.mapPos(r)}}}function dR(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 xh(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(Qt.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Qt.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(bi.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:bi.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);t.tools.openDiff({aFile:n,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return X2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return Q2(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.addFileToGitignore(i.path,i instanceof Wi.TFolder).catch(n=>t.displayError(n))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:i})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),Wi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:i})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.promiseQueue.addTask(()=>t.stageFile(i))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.promiseQueue.addTask(()=>t.unstageFile(i))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>t.editRemotes().catch(r=>t.displayError(r))}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>t.removeRemote().catch(r=>t.displayError(r))}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>t.setUpstreamBranch().catch(r=>t.displayError(r))}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new tt(t,{options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? plugin action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"&&(await e.vault.adapter.rmdir(`${t.settings.basePath}/.git`,!0),new Wi.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new Wi.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>t.createNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>t.cloneNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(await t.isAllInitialized())try{let r=await t.updateCachedStatus();if(r.changed.length+r.staged.length>500){t.displayError("Too many changes to display");return}new yh(t,r.all).open()}catch(r){t.displayError(r)}}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{let r=await t.discardAll();switch(r){case"discard":new Wi.Notice("Discarded all changes in tracked files.");break;case"delete":new Wi.Notice("Discarded all files.");break;case!1:break;default:Md(r)}}}),t.addCommand({id:"pause-automatic-routines",name:"Pause/Resume automatic routines",callback:()=>{let r=!t.localStorage.getPausedAutomatics();t.localStorage.setPausedAutomatics(r),r?(t.automaticsManager.unload(),new Wi.Notice("Paused automatic routines.")):(t.automaticsManager.reload("commit","push","pull"),new Wi.Notice("Resumed automatic routines."))}}),t.addCommand({id:"raw-command",name:"Raw command",checkCallback:r=>{let i=t.gitManager;if(r)return i instanceof Ce;t.tools.runRawCommand().catch(n=>t.displayError(n))}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var r;return(r=t.settingsTab)==null?void 0:r.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}}),t.addCommand({id:"reset-hunk",name:"Reset hunk",editorCheckCallback(r,i,n){if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.resetHunk()}}),t.addCommand({id:"stage-hunk",name:"Stage hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.promiseQueue.addTask(()=>t.hunkActions.stageHunk())}}),t.addCommand({id:"preview-hunk",name:"Preview hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;let s=t.hunkActions.editor.editor;Vs(s)}}),t.addCommand({id:"next-hunk",name:"Go to next hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("next")}}),t.addCommand({id:"prev-hunk",name:"Go to previous hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("prev")}})}m();var jh=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":",this.app=e.app}migrate(){let e=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let r of e){let i=localStorage.getItem(this.prefix+r);this.app.loadLocalStorage(this.prefix+r)==null&&i!=null&&i!=null&&(this.app.saveLocalStorage(this.prefix+r,i),localStorage.removeItem(this.prefix+r))}}getPassword(){return this.app.loadLocalStorage(this.prefix+"password")}setPassword(e){return this.app.saveLocalStorage(this.prefix+"password",e)}getUsername(){return this.app.loadLocalStorage(this.prefix+"username")}setUsername(e){return this.app.saveLocalStorage(this.prefix+"username",e)}getHostname(){return this.app.loadLocalStorage(this.prefix+"hostname")}setHostname(e){return this.app.saveLocalStorage(this.prefix+"hostname",e)}getConflict(){return this.app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(e){return this.app.saveLocalStorage(this.prefix+"conflict",`${e}`)}getLastAutoPull(){return this.app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPull",e)}getLastAutoBackup(){return this.app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(e){return this.app.saveLocalStorage(this.prefix+"lastAutoBackup",e)}getLastAutoPush(){return this.app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPush",e)}getGitPath(){return this.app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(e){return this.app.saveLocalStorage(this.prefix+"gitPath",e)}getPATHPaths(){var e,r;return(r=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?r:[]}setPATHPaths(e){return this.app.saveLocalStorage(this.prefix+"PATHPaths",e.join(":"))}getEnvVars(){var e;return JSON.parse((e=this.app.loadLocalStorage(this.prefix+"envVars"))!=null?e:"[]")}setEnvVars(e){return this.app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(e))}getPluginDisabled(){return this.app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(e){return this.app.saveLocalStorage(this.prefix+"pluginDisabled",`${e}`)}getPausedAutomatics(){return this.app.loadLocalStorage(this.prefix+"pausedAutomatics")=="true"}setPausedAutomatics(e){return this.app.saveLocalStorage(this.prefix+"pausedAutomatics",`${e}`)}getGutterSpacingFallbackLength(){var e;return(e=this.app.loadLocalStorage(this.prefix+"gutterSpacingFallbackLength"))!=null?e:5}setGutterSpacingFallbackLength(e){return this.app.saveLocalStorage(this.prefix+"gutterSpacingFallbackLength",e)}};m();var Hl=require("obsidian");var Vu=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let r=await this.plugin.gitManager.branchInfo(),i=r.tracking?Yn(r.tracking)[0]:null;if(!i)return!1;let n=await this.plugin.gitManager.getRemoteUrl(i);if(n!=null&&n.includes("github.com")){let s=[],a=this.plugin.gitManager;for(let o of e){let l=this.plugin.app.vault.getAbstractFileByPath(o.vaultPath),c=!1;if(l instanceof Hl.TFile)l.stat.size>=1e8&&(c=!0);else{let u=await this.plugin.app.vault.adapter.stat(o.vaultPath);u&&u.size>=1e8&&(c=!0)}if(c){let u=!1;a instanceof Ce&&(u=await a.isFileTrackedByLFS(o.path)),u||s.push(o)}}if(s.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big: +- ${s.map(o=>o.vaultPath).join(` +- `)} +Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(il,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&il.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(il,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Hl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=ji(this.plugin.app,s))==null||l.setViewState({type:Ms.type,active:!0,state:o}):a=="git_unified"&&((c=ji(this.plugin.app,s))==null||c.setViewState({type:Ds.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Ce))return;let i=await new tt(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new Hl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var Vh=require("obsidian");var Ha=class extends Vh.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Ds.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Ds.name}getIcon(){return Ds.icon}async setState(r,i){this.state=r,Vh.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 Ce&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(` +`);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null ++++ ${this.state.bFile} +@@ -0,0 +1,${s.split(` +`).length} @@`.split(` +`),...s.split(` +`).map(o=>`+${o}`)].join(` +`)}}if(i){let s=this.parser.parseFromString(Hh(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 Qn=require("obsidian");var Gl=require("@codemirror/commands");var zh=require("@codemirror/search"),Ul=require("@codemirror/state"),Ci=require("@codemirror/view");var Ua=class extends Qn.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,Qn.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Ms.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Ms.name}getIcon(){return Ms.icon}async setState(r,i){this.state=r,Qn.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 Br&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i},annotations:[Ul.Transaction.remote.of(!0)]});r.dispatch(n)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,i=this.mergeView.b;this.refreshing=!0;let n=await this.gitShow(this.state.aRef,this.state.aFile),s;if(this.state.bRef!=null&&(s=await this.gitShow(this.state.bRef,this.state.bFile)),n!=r.state.doc.toString()){let a=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n}});r.dispatch(a)}if(s!=null&&s!=i.state.doc.toString()){let a=i.state.update({changes:{from:0,to:i.state.doc.length,insert:s}});i.dispatch(a)}this.refreshing=!1}renderButtons(r){let i=r.createDiv(),n=i.createDiv();if(n.addClass("clickable-icon"),n.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,Qn.setIcon)(n,this.state.bRef==null?"plus":"minus"),n.onmousedown=async s=>{var p;let a=this.mergeView.b,o=this.mergeView.a,l=Ew(a.state),c=(p=i.parentElement)==null?void 0:p.indexOf(i),u=l.chunks[c],f=Aw(u,o.state.doc,a.state.doc),d=kw(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[f])[0],h=Wt.createPatch(this.state.bFile,[d],"100644",this.state.bRef!=null).join(` +`)+` +`;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,Qn.setIcon)(s,"undo"),s.onmousedown=a=>{var d;let o=this.mergeView.a,l=this.mergeView.b,c=Ew(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,w=f.toB,y=o.state.sliceDoc(h,Math.max(h,p-1));h!=p&&w<=l.state.doc.length&&(y+=o.state.lineBreak),l.dispatch({changes:{from:g,to:Math.min(l.state.doc.length,w),insert:y},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 g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,Ci.lineNumbers)(),(0,zh.highlightSelectionMatches)(),(0,Ci.drawSelection)(),Ci.keymap.of([...Gl.standardKeymap,Gl.indentWithTab]),(0,Gl.history)(),(0,zh.search)(),Ci.EditorView.lineWrapping],c=this,u=Ci.ViewPlugin.define(g=>({update(w){if(w.docChanged&&!w.transactions.some(y=>y.annotation(Ul.Transaction.remote))){let y=g.state.doc.toString();c.fileSaveDebouncer(y)}}})),f={doc:a,extensions:[...l,Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(u):d.push(Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let p=this.plugin.gitManager instanceof Ce&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Rh({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:p?()=>this.renderButtons(s):void 0,revertControls:p?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:s}),this.refreshing=!1}}};m();var rF=require("obsidian");m();m();m();var hR,pR,mR;typeof window!="undefined"&&((mR=(pR=(hR=window.__svelte)!=null?hR:window.__svelte={}).v)!=null?mR:pR.v=new Set).add("5");m();m();m();var Jn={};var qe=Symbol("uninitialized"),Ti=Symbol("filename");var Wh="http://www.w3.org/1999/xhtml";m();m();m();m();var qh=!0;m();var L=!1;m();var es=Array.isArray,gR=Array.prototype.indexOf,zs=Array.prototype.includes,jl=Array.from,Yw=Object.keys,cr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Zw=Object.getOwnPropertyDescriptors,Kw=Object.prototype,vR=Array.prototype,Vl=Object.getPrototypeOf,Xw=Object.isExtensible;function Qw(t){return typeof t=="function"}var ur=()=>{};function Yh(t){for(var e=0;e{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var er=Symbol("$state"),zu=Symbol("legacy props"),bR=Symbol(""),Kh=Symbol("proxy path"),Xh=Symbol("attributes"),Wu=Symbol("class"),Jw=Symbol("style"),qu=Symbol("text"),Ga=Symbol("form reset"),e0=Symbol("hmr anchor"),Ws=new class extends Error{constructor(){super(...arguments);He(this,"name","StaleReactionError");He(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},wR,t0=!!((wR=globalThis.document)!=null&&wR.contentType)&&globalThis.document.contentType.includes("xml");var zl=3,Pi=8;m();m();function _R(t){if(L){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 Qh(t){if(L){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 xR(){if(L){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 r0(){if(L){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 ER(){if(L){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 i0(t,e,r){if(L){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 SR(t,e,r){if(L){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 kR(t){if(L){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 AR(){if(L){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 CR(t){if(L){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 TR(){if(L){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 PR(){if(L){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 RR(t){if(L){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 $R(t){if(L){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 FR(){if(L){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 IR(){if(L){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 MR(){if(L){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 DR(){if(L){let t=new Error("svelte_boundary_reset_onerror\nA `` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Sn="font-weight: bold",kn="font-weight: normal";function OR(t){L?console.warn(`%c[svelte] await_reactivity_loss +%cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\` +https://svelte.dev/e/await_reactivity_loss`,Sn,kn):console.warn("https://svelte.dev/e/await_reactivity_loss")}function LR(t,e){L?console.warn(`%c[svelte] await_waterfall +%cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app +https://svelte.dev/e/await_waterfall`,Sn,kn):console.warn("https://svelte.dev/e/await_waterfall")}function NR(){L?console.warn(`%c[svelte] derived_inert +%cReading a derived belonging to a now-destroyed effect may result in stale values +https://svelte.dev/e/derived_inert`,Sn,kn):console.warn("https://svelte.dev/e/derived_inert")}function BR(t,e,r){L?console.warn(`%c[svelte] hydration_attribute_changed +%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value +https://svelte.dev/e/hydration_attribute_changed`,Sn,kn):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function ja(t){L?console.warn(`%c[svelte] hydration_mismatch +%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"} +https://svelte.dev/e/hydration_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/hydration_mismatch")}function HR(){L?console.warn(`%c[svelte] lifecycle_double_unmount +%cTried to unmount a component that was not mounted +https://svelte.dev/e/lifecycle_double_unmount`,Sn,kn):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Jh(t){L?console.warn(`%c[svelte] state_proxy_equality_mismatch +%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results +https://svelte.dev/e/state_proxy_equality_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function UR(){L?console.warn(`%c[svelte] state_proxy_unmount +%cTried to unmount a state proxy, rather than a component +https://svelte.dev/e/state_proxy_unmount`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_unmount")}function GR(){L?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Sn,kn):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function jR(t){L?console.warn(`%c[svelte] transition_slide_display +%cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\` +https://svelte.dev/e/transition_slide_display`,Sn,kn):console.warn("https://svelte.dev/e/transition_slide_display")}var ae=!1;function It(t){ae=t}var be;function je(t){if(t===null)throw ja(),Jn;return be=t}function fr(){return je(rr(be))}function V(t){if(ae){if(rr(be)!==null)throw ja(),Jn;be=t}}function Va(t=1){if(ae){for(var e=t,r=be;e--;)r=rr(r);be=r}}function An(t=!0){for(var e=0,r=be;;){if(r.nodeType===Pi){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=rr(r);t&&r.remove(),r=n}}function Zu(t){if(!t||t.nodeType!==Pi)throw ja(),Jn;return t.data}m();m();m();m();function ep(t){return t===this.v}function n0(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function tp(t){return!n0(t,this.v)}m();var Ct=!1,ts=!1,qi=!1;m();m();m();var Ku=null;function dr(t,e){return t.label=e,ip(t.v,e),t}function ip(t,e){var r;return(r=t==null?void 0:t[Kh])==null||r.call(t,e),t}m();function Yi(t){let e=new Error,r=h4();return r.length===0?null:(r.unshift(` +`),cr(e,"stack",{value:r.join(` +`)}),cr(e,"name",{value:t}),e)}function h4(){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{e===za&&WR()})}za.push(t)}function qR(){for(;za.length>0;)WR()}m();var a0=new WeakMap;function sp(t){var e=ee;if(e===null)return le.f|=8388608,t;if(L&&t instanceof Error&&!a0.has(t)&&a0.set(t,p4(t,e)),(e.f&32768)===0&&(e.f&4)===0)throw L&&!e.parent&&t instanceof Error&&YR(t),t;Xi(t,e)}function Xi(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 L&&t instanceof Error&&YR(t),t}}function p4(t,e){var a,o,l;let r=Gr(t,"message");if(!(r&&!r.configurable)){for(var i=Qu?" ":" ",n=` +${i}in ${((a=e.fn)==null?void 0:a.name)||""}`,s=e.ctx;s!==null;)n+=` +${i}in ${(o=s.function)==null?void 0:o[Ti].split("/").pop()}`,s=s.p;return{message:t.message+` +${n} +`,stack:(l=t.stack)==null?void 0:l.split(` +`).filter(c=>!c.includes("svelte/src/internal")).join(` +`)}}}function YR(t){let e=a0.get(t);e&&(cr(t,"message",{value:e.message}),cr(t,"stack",{value:e.stack}))}m();m();var m4=-7169;function Ve(t,e){t.f=t.f&m4|e}function Zl(t){(t.f&512)!==0||t.deps===null?Ve(t,1024):Ve(t,4096)}function ZR(t){if(t!==null)for(let e of t)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,ZR(e.deps))}function ap(t,e,r){(t.f&2048)!==0?e.add(t):(t.f&4096)!==0&&r.add(t),ZR(t.deps),Ve(t,1024)}m();m();m();var KR=!1,op=!1;function o0(t){var e=op;try{return op=!1,[t(),op]}finally{op=e}}m();m();m();m();m();function XR(t){let e=0,r=pr(0),i;return L&&dr(r,"createSubscriber version"),()=>{qs()&&(I(r),ar(()=>(e===0&&(i=Ye(()=>t(()=>Za(r)))),e+=1,()=>{Mt(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Za(r))})})))}}var v4=589824;function d0(t,e,r,i){new l0(t,e,r,i)}var ii,Ju,Fi,Ka,jr,Ii,kr,ni,ns,Xa,Ys,Xl,ef,tf,Pn,up,it,JR,e$,t$,c0,lp,cp,u0,f0,l0=class{constructor(e,r,i,n){ge(this,it);He(this,"parent");He(this,"is_pending",!1);He(this,"transform_error");ge(this,ii);ge(this,Ju,ae?be:null);ge(this,Fi);ge(this,Ka);ge(this,jr);ge(this,Ii,null);ge(this,kr,null);ge(this,ni,null);ge(this,ns,null);ge(this,Xa,0);ge(this,Ys,0);ge(this,Xl,!1);ge(this,ef,new Set);ge(this,tf,new Set);ge(this,Pn,null);ge(this,up,XR(()=>(pe(this,Pn,pr(F(this,Xa))),L&&dr(F(this,Pn),"$effect.pending()"),()=>{pe(this,Pn,null)})));var s,a;pe(this,ii,e),pe(this,Fi,r),pe(this,Ka,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),pe(this,jr,ai(()=>{if(ae){let o=F(this,Ju);fr();let l=o.data==="[!";if(o.data.startsWith("[?")){let u=JSON.parse(o.data.slice("[?".length));Ae(this,it,e$).call(this,u)}else l?Ae(this,it,t$).call(this):Ae(this,it,JR).call(this)}else Ae(this,it,c0).call(this)},v4)),ae&&pe(this,ii,be)}defer_effect(e){ap(e,F(this,ef),F(this,tf))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!F(this,Fi).pending}update_pending_count(e,r){Ae(this,it,u0).call(this,e,r),pe(this,Xa,F(this,Xa)+e),!(!F(this,Pn)||F(this,Xl))&&(pe(this,Xl,!0),Mt(()=>{pe(this,Xl,!1),F(this,Pn)&&Qi(F(this,Pn),F(this,Xa))}))}get_effect_pending(){return F(this,up).call(this),I(F(this,Pn))}error(e){var r;if(!F(this,Fi).onerror&&!F(this,Fi).failed)throw e;(r=ce)!=null&&r.is_fork?(F(this,Ii)&&ce.skip_effect(F(this,Ii)),F(this,kr)&&ce.skip_effect(F(this,kr)),F(this,ni)&&ce.skip_effect(F(this,ni)),ce.oncommit(()=>{Ae(this,it,f0).call(this,e)})):Ae(this,it,f0).call(this,e)}};ii=new WeakMap,Ju=new WeakMap,Fi=new WeakMap,Ka=new WeakMap,jr=new WeakMap,Ii=new WeakMap,kr=new WeakMap,ni=new WeakMap,ns=new WeakMap,Xa=new WeakMap,Ys=new WeakMap,Xl=new WeakMap,ef=new WeakMap,tf=new WeakMap,Pn=new WeakMap,up=new WeakMap,it=new WeakSet,JR=function(){try{pe(this,Ii,Ot(()=>F(this,Ka).call(this,F(this,ii))))}catch(e){this.error(e)}},e$=function(e){let r=F(this,Fi).failed;r&&pe(this,ni,Ot(()=>{r(F(this,ii),()=>e,()=>()=>{})}))},t$=function(){let e=F(this,Fi).pending;e&&(this.is_pending=!0,pe(this,kr,Ot(()=>e(F(this,ii)))),Mt(()=>{var r=pe(this,ns,document.createDocumentFragment()),i=Bt();r.append(i),pe(this,Ii,Ae(this,it,cp).call(this,()=>Ot(()=>F(this,Ka).call(this,i)))),F(this,Ys)===0&&(F(this,ii).before(r),pe(this,ns,null),Rn(F(this,kr),()=>{pe(this,kr,null)}),Ae(this,it,lp).call(this,ce))}))},c0=function(){try{if(this.is_pending=this.has_pending_snippet(),pe(this,Ys,0),pe(this,Xa,0),pe(this,Ii,Ot(()=>{F(this,Ka).call(this,F(this,ii))})),F(this,Ys)>0){var e=pe(this,ns,document.createDocumentFragment());Ql(F(this,Ii),e);let r=F(this,Fi).pending;pe(this,kr,Ot(()=>r(F(this,ii))))}else Ae(this,it,lp).call(this,ce)}catch(r){this.error(r)}},lp=function(e){this.is_pending=!1,e.transfer_effects(F(this,ef),F(this,tf))},cp=function(e){var r=ee,i=le,n=Ee;Nt(F(this,jr)),Lt(F(this,jr)),rs(F(this,jr).ctx);try{return si.ensure(),e()}catch(s){return sp(s),null}finally{Nt(r),Lt(i),rs(n)}},u0=function(e,r){var i;if(!this.has_pending_snippet()){this.parent&&Ae(i=this.parent,it,u0).call(i,e,r);return}pe(this,Ys,F(this,Ys)+e),F(this,Ys)===0&&(Ae(this,it,lp).call(this,r),F(this,kr)&&Rn(F(this,kr),()=>{pe(this,kr,null)}),F(this,ns)&&(F(this,ii).before(F(this,ns)),pe(this,ns,null)))},f0=function(e){F(this,Ii)&&(vt(F(this,Ii)),pe(this,Ii,null)),F(this,kr)&&(vt(F(this,kr)),pe(this,kr,null)),F(this,ni)&&(vt(F(this,ni)),pe(this,ni,null)),ae&&(je(F(this,Ju)),Va(),je(An()));var r=F(this,Fi).onerror;let i=F(this,Fi).failed;var n=!1,s=!1;let a=()=>{if(n){GR();return}n=!0,s&&DR(),F(this,ni)!==null&&Rn(F(this,ni),()=>{pe(this,ni,null)}),Ae(this,it,cp).call(this,()=>{Ae(this,it,c0).call(this)})},o=l=>{try{s=!0,r==null||r(l,a),s=!1}catch(c){Xi(c,F(this,jr)&&F(this,jr).parent)}i&&pe(this,ni,Ae(this,it,cp).call(this,()=>{try{return Ot(()=>{var c=ee;c.b=this,c.f|=128,i(F(this,ii),()=>l,()=>a)})}catch(c){return Xi(c,F(this,jr).parent),null}}))};Mt(()=>{var l;try{l=this.transform_error(e)}catch(c){Xi(c,F(this,jr)&&F(this,jr).parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(o,c=>Xi(c,F(this,jr)&&F(this,jr).parent)):o(l)})};function fp(t,e,r,i){let n=Tn()?Zs:Qa;var s=t.filter(h=>!h.settled),a=e.map(n);if(L&&a.forEach((h,p)=>{h.label=e[p].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(g,w)=>w)}),r.length===0&&s.length===0){i(a);return}var o=ee,l=r$(),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{i([...a,...h])}catch(p){Xi(p,o)}Jl()}}var f=h0();if(r.length===0){c.then(()=>u([])).finally(f);return}function d(){Promise.all(r.map(h=>m0(h))).then(u).catch(h=>Xi(h,o)).finally(f)}c?c.then(()=>{l(),d(),Jl()}):d()}function r$(){var t=ee,e=le,r=Ee,i=ce;if(L)var n=Cn;return function(a=!0){Nt(t),Lt(e),rs(r),a&&(t.f&16384)===0&&(i==null||i.activate(),i==null||i.apply()),L&&(p0(null),Yl(n))}}function Jl(t=!0){var e;Nt(null),Lt(null),rs(null),t&&((e=ce)==null||e.deactivate()),L&&(p0(null),Yl(null))}function h0(){var t=ee,e=t.b,r=ce,i=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,r),r.increment(i,t),()=>{e==null||e.update_pending_count(-1,r),r.decrement(i,t)}}var zr=null;function p0(t){zr=t}var rf=new Set;function Zs(t){var e=2050;ee!==null&&(ee.f|=524288);let r={ctx:Ee,deps:null,effects:null,equals:ep,f:e,fn:t,reactions:null,rv:0,v:qe,wv:0,parent:ee,ac:null};return L&&qi&&(r.created=Yi("created at")),r}var ec=Symbol("obsolete");function m0(t,e,r){let i=ee;i===null&&xR();var n=void 0,s=pr(qe);L&&(s.label=e!=null?e:t.toString());var a=!le,o=new Set;return s$(()=>{var h,p;var l=ee;L&&(zr={effect:l,effect_deps:new Set,warned:!1});var c=Zh();n=c.promise;try{Promise.resolve(t()).then(c.resolve,g=>{g!==Ws&&c.reject(g)}).finally(Jl)}catch(g){c.reject(g),Jl()}if(L){if(zr){if(l.deps!==null)for(let g=0;g{L&&(zr=null),f==null||f(),o.delete(c),w!==ec&&(u.activate(),w?(s.f|=8388608,Qi(s,w)):((s.f&8388608)!==0&&(s.f^=8388608),L&&r!==void 0&&!s.equals(g)&&(rf.add(s),setTimeout(()=>{rf.has(s)&&(l.f&16384)===0&&(LR(s.label,r),rf.delete(s))})),Qi(s,g)),u.deactivate())};c.promise.then(d,g=>d(null,g||"unknown"))}),nr(()=>{for(let l of o)l.reject(ec)}),L&&(s.f|=4194304),new Promise(l=>{function c(u){function f(){u===n?l(s):c(n)}u.then(f,f)}c(n)})}function ft(t){let e=Zs(t);return Ct||pp(e),e}function Qa(t){let e=Zs(t);return e.equals=tp,e}function i$(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;rthis.schedule(i)){var i=F(this,Fn).get(e);if(i){F(this,Fn).delete(e);for(var n of i.d)Ve(n,2048),r(n);for(n of i.m)Ve(n,4096),r(n)}F(this,cc).add(e)}capture(e,r,i=!1){e.v!==qe&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&8388608)===0&&(this.current.set(e,[r,i]),Tt==null||Tt.set(e,r)),this.is_fork||(e.v=r)}activate(){ce=this}deactivate(){ce=null,Tt=null}flush(){try{L&&_0.clear(),b0=!0,ce=this,Ae(this,Be,af).call(this)}finally{if(a$=0,y0=null,to=null,lf=null,b0=!1,ce=null,Tt=null,fs.clear(),L)for(let e of _0)e.updated=null}}discard(){var e;for(let r of F(this,ac))r(this);F(this,ac).clear();for(let r of this.async_deriveds.values())r.reject(ec);Ae(this,Be,of).call(this),(e=F(this,lc))==null||e.resolve()}register_created_effect(e){F(this,cf).push(e)}increment(e,r){var i;if(pe(this,oc,F(this,oc)+1),e){let n=(i=F(this,cs).get(r))!=null?i:0;F(this,cs).set(r,n+1)}}decrement(e,r){var i;if(pe(this,oc,F(this,oc)-1),e){let n=(i=F(this,cs).get(r))!=null?i:0;n===1?F(this,cs).delete(r):F(this,cs).set(r,n-1)}F(this,Ks)||(pe(this,Ks,!0),Mt(()=>{pe(this,Ks,!1),this.linked&&this.flush()}))}transfer_effects(e,r){for(let i of e)F(this,us).add(i);for(let i of r)F(this,Ji).add(i);e.clear(),r.clear()}oncommit(e){F(this,sc).add(e)}ondiscard(e){F(this,ac).add(e)}settled(){var e;return((e=F(this,lc))!=null?e:pe(this,lc,Zh())).promise}static ensure(){if(ce===null){let e=ce=new gp;!b0&&!Wa&&Mt(()=>{F(e,nc)||e.flush()})}return ce}apply(){if(!Ct||!this.is_fork&&F(this,os)===null&&F(this,ls)===null){Tt=null;return}Tt=new Map;for(let[r,[i]]of this.current)Tt.set(r,i);for(let r=mp;r!==null;r=F(r,ls))if(!(r===this||r.is_fork)){var e=!1;if(r.id1e3&&(Ae(this,Be,of).call(this),y4()),L)for(let d of this.current.keys())_0.add(d);for(let d of F(this,us))F(this,Ji).delete(d),Ve(d,2048),this.schedule(d);for(let d of F(this,Ji))Ve(d,4096),this.schedule(d);let e=F(this,Cr);pe(this,Cr,[]),this.apply();var r=to=[],i=[],n=lf=[];for(let d of e)try{Ae(this,Be,E0).call(this,d,r,i)}catch(h){throw h$(d),Ae(this,Be,x0).call(this)||this.discard(),h}if(ce=null,n.length>0){var s=gp.ensure();for(let d of n)s.schedule(d)}if(to=null,lf=null,Ae(this,Be,x0).call(this)){Ae(this,Be,ic).call(this,i),Ae(this,Be,ic).call(this,r);for(let[d,h]of F(this,Fn))d$(d,h);n.length>0&&Ae(l=ce,Be,af).call(l);return}let a=Ae(this,Be,l$).call(this);if(a){Ae(this,Be,ic).call(this,i),Ae(this,Be,ic).call(this,r),Ae(c=a,Be,c$).call(c,this);return}F(this,us).clear(),F(this,Ji).clear();for(let d of F(this,sc))d(this);F(this,sc).clear(),as=this,o$(i),o$(r),as=null,(u=F(this,lc))==null||u.resolve();var o=ce;if(F(this,oc)===0&&(F(this,Cr).length===0||o!==null)&&(Ae(this,Be,of).call(this),Ct&&(Ae(this,Be,u$).call(this),ce=o)),F(this,Cr).length>0)if(o!==null){let d=o;F(d,Cr).push(...F(this,Cr).filter(h=>!F(d,Cr).includes(h)))}else o=this;o!==null&&Ae(f=o,Be,af).call(f)},E0=function(e,r,i){e.f^=1024;for(var n=e.first;n!==null;){var s=n.f,a=(s&96)!==0,o=a&&(s&1024)!==0,l=o||(s&8192)!==0||F(this,Fn).has(n);if(!l&&n.fn!==null){a?n.f^=1024:(s&4)!==0?r.push(n):Ct&&(s&16777224)!==0?i.push(n):Xs(n)&&((s&16)!==0&&F(this,Ji).add(n),$n(n));var c=n.first;if(c!==null){n=c;continue}}for(;n!==null;){var u=n.next;if(u!==null){n=u;break}n=n.parent}}},l$=function(){for(var e=F(this,os);e!==null;){if(!e.is_fork){for(let[r,[,i]]of this.current)if(e.current.has(r)&&!i)return e}e=F(e,os)}return null},c$=function(e){var i;for(let[n,s]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,s);for(let[n,s]of e.async_deriveds){let a=this.async_deriveds.get(n);a&&s.promise.then(a.resolve).catch(a.reject)}e.async_deriveds.clear(),this.transfer_effects(F(e,us),F(e,Ji));let r=n=>{var s=n.reactions;if(s!==null)for(let l of s){var a=l.f;if((a&2)!==0)r(l);else{var o=l;a&4194320&&!this.async_deriveds.has(o)&&(F(this,Ji).delete(o),Ve(o,2048),this.schedule(o))}}};for(let n of this.current.keys())r(n);this.oncommit(()=>e.discard()),Ae(i=e,Be,of).call(i),ce=this,Ae(this,Be,af).call(this)},ic=function(e){for(var r=0;r!d.current.get(h)[1]);if(!(!F(d,nc)||n.length===0)){var s=n.filter(h=>!this.current.has(h));if(s.length===0)e&&d.discard();else if(r.length>0){if(L&&!F(d,Ks)&&zR(F(d,Cr).length===0,"Batch has scheduled roots"),e)for(let h of F(this,cc))d.unskip_effect(h,p=>{var g;(p.f&4194320)!==0?d.schedule(p):Ae(g=d,Be,ic).call(g,[p])});d.activate();var a=new Set,o=new Map;for(var l of r)f$(l,s,a,o);o=new Map;var c=[...d.current].filter(([h,p])=>{let g=this.current.get(h);return g?g[0]!==p[0]||g[1]!==p[1]:!0}).map(([h])=>h);if(c.length>0)for(let h of F(this,cf))(h.f&155648)===0&&S0(h,c,o)&&((h.f&4194320)!==0?(Ve(h,2048),d.schedule(h)):F(d,us).add(h));if(F(d,Cr).length>0&&!F(d,Ks)){d.apply();for(var u of F(d,Cr))Ae(f=d,Be,E0).call(f,u,[],[]);pe(d,Cr,[])}d.deactivate()}}}},of=function(){if(this.linked){var e=F(this,os),r=F(this,ls);e===null?mp=r:pe(e,ls,r),r===null?rc=e:pe(r,os,e),this.linked=!1}};var si=gp;function io(t){var e=Wa;Wa=!0;try{var r;for(t&&(ce!==null&&!ce.is_fork&&ce.flush(),r=t());;){if(qR(),ce===null)return r;ce.flush()}}finally{Wa=e}}function y4(){var r;if(L){var t=new Map;for(let i of ce.current.keys())for(let[n,s]of(r=i.updated)!=null?r:[]){var e=t.get(n);e||(e={error:s.error,count:0},t.set(n,e)),e.count+=s.count}for(let i of t.values())i.error&&console.error(i.error)}try{TR()}catch(i){L&&cr(i,"stack",{value:""}),Xi(i,y0)}}var Wr=null;function o$(t){var e=t.length;if(e!==0){for(var r=0;r0)){fs.clear();for(let n of Wr){if((n.f&24576)!==0)continue;let s=[n],a=n.parent;for(;a!==null;)Wr.has(a)&&(Wr.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){let l=s[o];(l.f&24576)===0&&$n(l)}}Wr.clear()}}Wr=null}}function f$(t,e,r,i){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(let n of t.reactions){let s=n.f;(s&2)!==0?f$(n,e,r,i):(s&4194320)!==0&&(s&2048)===0&&S0(n,e,i)&&(Ve(n,2048),ff(n))}}function S0(t,e,r){let i=r.get(t);if(i!==void 0)return i;if(t.deps!==null)for(let n of t.deps){if(zs.call(e,n))return!0;if((n.f&2)!==0&&S0(n,e,r))return r.set(n,!0),!0}return r.set(t,!1),!1}function ff(t){ce.schedule(t)}function d$(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):(t.f&4096)!==0&&e.m.push(t),Ve(t,1024);for(var r=t.first;r!==null;)d$(r,e),r=r.next}}function h$(t){Ve(t,1024);for(var e=t.first;e!==null;)h$(e),e=e.next}var Ja=new Set,fs=new Map;function dp(t){Ja=t}var A0=!1;function m$(){A0=!0}function pr(t,e){var r={f:0,v:t,reactions:null,equals:ep,rv:0,wv:0};return L&&qi&&(r.created=e!=null?e:Yi("created at"),r.updated=null,r.set_during_effect=!1,r.trace=null),r}function Ne(t,e){let r=pr(t,e);return pp(r),r}function qa(t,e=!1,r=!0){var n,s;let i=pr(t);return e||(i.equals=tp),ts&&r&&Ee!==null&&Ee.l!==null&&((s=(n=Ee.l).s)!=null?s:n.s=[]).push(i),i}function oe(t,e,r=!1){le!==null&&(!Tr||(le.f&131072)!==0)&&Tn()&&(le.f&4325394)!==0&&(li===null||!li.has(t))&&MR();let i=r?Je(e):e;return L&&ip(i,t.label),Qi(t,i,lf)}function Qi(t,e,r=null){var n,s,a;if(!t.equals(e)){fs.set(t,oi?e:t.v);var i=si.ensure();if(i.capture(t,e),L){if(qi||ee!==null){(n=t.updated)!=null||(t.updated=new Map);let o=((a=(s=t.updated.get(""))==null?void 0:s.count)!=null?a:0)+1;if(t.updated.set("",{error:null,count:o}),qi||o>5){let l=Yi("updated at");if(l!==null){let c=t.updated.get(l.stack);c||(c={error:l,count:0},t.updated.set(l.stack,c)),c.count++}}}ee!==null&&(t.set_during_effect=!0)}if((t.f&2)!==0){let o=t;(t.f&2048)!==0&&nf(o),Tt===null&&Zl(o)}t.wv=tc(),g$(t,2048,r),Tn()&&ee!==null&&(ee.f&1024)!==0&&(ee.f&96)===0&&(ci===null?v$([t]):ci.push(t)),!i.is_fork&&Ja.size>0&&!A0&&vp()}return e}function vp(){A0=!1;for(let t of Ja){(t.f&1024)!==0&&Ve(t,4096);let e;try{e=Xs(t)}catch(r){e=!0}e&&$n(t)}Ja.clear()}function Za(t){oe(t,t.v+1)}function g$(t,e,r){var d;var i=t.reactions;if(i!==null)for(var n=Tn(),s=i.length,a=0;a{if(Qs===a)return f();var d=le,h=Qs;Lt(null),C0(a);var p=f();return Lt(d),C0(h),p};i&&(r.set("length",Ne(t.length,s)),L&&(t=k4(t)));var l="";let c=!1;function u(f){if(!c){c=!0,l=f,dr(n,`${l} version`);for(let[d,h]of r)dr(h,no(l,d));c=!1}}return new Proxy(t,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&FR();var p=r.get(d);return p===void 0?o(()=>{var g=Ne(h.value,s);return r.set(d,g),L&&typeof d=="string"&&dr(g,no(l,d)),g}):oe(p,h.value,!0),!0},deleteProperty(f,d){var h=r.get(d);if(h===void 0){if(d in f){let p=o(()=>Ne(qe,s));r.set(d,p),Za(n),L&&dr(p,no(l,d))}}else oe(h,qe),Za(n);return!0},get(f,d,h){var y;if(d===er)return t;if(L&&d===Kh)return u;var p=r.get(d),g=d in f;if(p===void 0&&(!g||(y=Gr(f,d))!=null&&y.writable)&&(p=o(()=>{var b=Je(g?f[d]:qe),S=Ne(b,s);return L&&dr(S,no(l,d)),S}),r.set(d,p)),p!==void 0){var w=I(p);return w===qe?void 0:w}return Reflect.get(f,d,h)},getOwnPropertyDescriptor(f,d){var h=Reflect.getOwnPropertyDescriptor(f,d);if(h&&"value"in h){var p=r.get(d);p&&(h.value=I(p))}else if(h===void 0){var g=r.get(d),w=g==null?void 0:g.v;if(g!==void 0&&w!==qe)return{enumerable:!0,configurable:!0,value:w,writable:!0}}return h},has(f,d){var w;if(d===er)return!0;var h=r.get(d),p=h!==void 0&&h.v!==qe||Reflect.has(f,d);if(h!==void 0||ee!==null&&(!p||(w=Gr(f,d))!=null&&w.writable)){h===void 0&&(h=o(()=>{var y=p?Je(f[d]):qe,b=Ne(y,s);return L&&dr(b,no(l,d)),b}),r.set(d,h));var g=I(h);if(g===qe)return!1}return p},set(f,d,h,p){var v;var g=r.get(d),w=d in f;if(i&&d==="length")for(var y=h;yNe(qe,s)),r.set(y+"",b),L&&dr(b,no(l,y)))}if(g===void 0)(!w||(v=Gr(f,d))!=null&&v.writable)&&(g=o(()=>Ne(void 0,s)),L&&dr(g,no(l,d)),oe(g,Je(h)),r.set(d,g));else{w=g.v!==qe;var S=o(()=>Je(h));oe(g,S)}var C=Reflect.getOwnPropertyDescriptor(f,d);if(C!=null&&C.set&&C.set.call(p,h),!w){if(i&&typeof d=="string"){var A=r.get("length"),k=Number(d);Number.isInteger(k)&&k>=A.v&&oe(A,k+1)}Za(n)}return!0},ownKeys(f){I(n);var d=Reflect.ownKeys(f).filter(g=>{var w=r.get(g);return w===void 0||w.v!==qe});for(var[h,p]of r)p.v!==qe&&!(h in f)&&d.push(h);return d},setPrototypeOf(){IR()}})}function no(t,e){var r;return typeof e=="symbol"?`${t}[Symbol(${(r=e.description)!=null?r:""})]`:E4.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function wp(t){try{if(t!==null&&typeof t=="object"&&er in t)return t[er]}catch(e){}return t}var S4=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function k4(t){return new Proxy(t,{get(e,r,i){var n=Reflect.get(e,r,i);return S4.has(r)?function(...s){m$();var a=n.apply(this,s);return vp(),a}:n}})}function w$(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:i,includes:n}=t;t.indexOf=function(s,a){let o=r.call(this,s,a);if(o===-1){for(let l=a!=null?a:0;l{t.indexOf=r,t.lastIndexOf=i,t.includes=n}}var T0,b$,Qu,_$,y$;function bp(){if(T0===void 0){T0=window,b$=document,Qu=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;_$=Gr(e,"firstChild").get,y$=Gr(e,"nextSibling").get,Xw(t)&&(t[Wu]=void 0,t[Xh]=null,t[Jw]=void 0,t.__e=void 0),Xw(r)&&(r[qu]=void 0),L&&(t.__svelte_meta=null,w$())}}function Bt(t=""){return document.createTextNode(t)}function or(t){return _$.call(t)}function rr(t){return y$.call(t)}function W(t,e){if(!ae)return or(t);var r=or(be);if(r===null)r=be.appendChild(Bt());else if(e&&r.nodeType!==zl){var i=Bt();return r==null||r.before(i),je(i),i}return e&&yp(r),je(r),r}function Mi(t,e=!1){var n,s;if(!ae){var r=or(t);return r instanceof Comment&&r.data===""?rr(r):r}if(e){if(((n=be)==null?void 0:n.nodeType)!==zl){var i=Bt();return(s=be)==null||s.before(i),je(i),i}yp(be)}return be}function ne(t,e=1,r=!1){let i=ae?be:t;for(var n;e--;)n=i,i=rr(i);if(!ae)return i;if(r){if((i==null?void 0:i.nodeType)!==zl){var s=Bt();return i===null?n==null||n.after(s):i.before(s),je(s),s}yp(i)}return je(i),i}function fc(t){t.textContent=""}function _p(){if(!Ct||Wr!==null)return!1;var t=ee.f;return(t&32768)!==0}function In(t,e,r){return e==null||e===Wh?r?document.createElement(t,{is:r}):document.createElement(t):r?document.createElementNS(e,t,{is:r}):document.createElementNS(e,t)}function yp(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===zl;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}m();m();function P0(t){ae&&or(t)!==null&&fc(t)}var x$=!1;function R0(){x$||(x$=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r[Ga])==null||e.call(r)})},{capture:!0}))}function en(t){var e=le,r=ee;Lt(null),Nt(null);try{return t()}finally{Lt(e),Nt(r)}}function $0(t,e,r,i=r){t.addEventListener(e,()=>en(r));let n=t[Ga];n?t[Ga]=()=>{n(),i(!0)}:t[Ga]=()=>i(!0),R0()}function S$(t){ee===null&&(le===null&&CR(t),AR()),oi&&kR(t)}function C4(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Mn(t,e){var a,o;var r=ee;if(L)for(;r!==null&&(r.f&131072)!==0;)r=r.parent;r!==null&&(r.f&8192)!==0&&(t|=8192);var i={ctx:Ee,deps:null,nodes:null,f:t|2048|512,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};L&&(i.component_function=Zi),(a=ce)==null||a.register_created_effect(i);var n=i;if((t&4)!==0)to!==null?to.push(i):si.ensure().schedule(i);else if(e!==null){try{$n(i)}catch(l){throw vt(i),l}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&524288)===0&&(n=n.first,(t&16)!==0&&(t&65536)!==0&&n!==null&&(n.f|=65536))}if(n!==null&&(n.parent=r,r!==null&&C4(n,r),le!==null&&(le.f&2)!==0&&(t&64)===0)){var s=le;((o=s.effects)!=null?o:s.effects=[]).push(n)}return i}function qs(){return le!==null&&!Tr}function nr(t){let e=Mn(8,null);return Ve(e,1024),e.teardown=t,e}function mr(t){var n;S$("$effect"),L&&cr(t,"name",{value:"$effect"});var e=ee.f,r=!le&&(e&32)!==0&&Ee!==null&&!Ee.i;if(r){var i=Ee;((n=i.e)!=null?n:i.e=[]).push(t)}else return s0(t)}function s0(t){return Mn(1048580,t)}function I0(t){si.ensure();let e=Mn(524352,t);return()=>{vt(e)}}function k$(t){si.ensure();let e=Mn(524352,t);return(r={})=>new Promise(i=>{r.outro?Rn(e,()=>{vt(e),i(void 0)}):(vt(e),i(void 0))})}function qr(t){return Mn(4,t)}function s$(t){return Mn(4718592,t)}function ar(t,e=0){return Mn(8|e,t)}function Ue(t,e=[],r=[],i=[]){fp(i,e,r,n=>{Mn(8,()=>{t(...n.map(I))})})}function ai(t,e=0){var r=Mn(16|e,t);return L&&(r.dev_stack=Cn),r}function Ot(t){return Mn(524320,t)}function M0(t){var e=t.teardown;if(e!==null){let r=oi,i=le;F0(!0),Lt(null);try{e.call(null)}finally{F0(r),Lt(i)}}}function sf(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){let n=r.ac;n!==null&&en(()=>{n.abort(Ws)});var i=r.next;(r.f&64)!==0?r.parent=null:vt(r,e),r=i}}function A$(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&32)===0&&vt(e),e=r}}function vt(t,e=!0){var r=!1;(e||(t.f&262144)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(C$(t.nodes.start,t.nodes.end),r=!0),t.f|=33554432,sf(t,e&&!r),eo(t,0);var i=t.nodes&&t.nodes.t;if(i!==null)for(let s of i)s.stop();M0(t),t.f^=33554432,t.f|=16384;var n=t.parent;n!==null&&n.first!==null&&k0(t),L&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function C$(t,e){for(;t!==null;){var r=t===e?null:rr(t);t.remove(),t=r}}function k0(t){var e=t.parent,r=t.prev,i=t.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),e!==null&&(e.first===t&&(e.first=i),e.last===t&&(e.last=r))}function Rn(t,e,r=!0){var i=[];T$(t,i,!0);var n=()=>{r&&vt(t),e&&e()},s=i.length;if(s>0){var a=()=>--s||n();for(var o of i)o.out(a)}else n()}function T$(t,e,r){if((t.f&8192)===0){t.f^=8192;var i=t.nodes&&t.nodes.t;if(i!==null)for(let o of i)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var s=n.next;if((n.f&64)===0){var a=(n.f&65536)!==0||(n.f&32)!==0&&(t.f&16)!==0;T$(n,e,a?r:!1)}n=s}}}function dc(t){P$(t,!0)}function P$(t,e){if((t.f&8192)!==0){t.f^=8192,(t.f&1024)===0&&(Ve(t,2048),si.ensure().schedule(t));for(var r=t.first;r!==null;){var i=r.next,n=(r.f&65536)!==0||(r.f&32)!==0;P$(r,n?e:!1),r=i}var s=t.nodes&&t.nodes.t;if(s!==null)for(let a of s)(a.is_global||e)&&a.in()}}function Ql(t,e){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end;r!==null;){var n=r===i?null:rr(r);e.append(r),r=n}}m();var R$=null;var xp=!1,oi=!1;function F0(t){oi=t}var le=null,Tr=!1;function Lt(t){le=t}var ee=null;function Nt(t){ee=t}var li=null;function pp(t){le!==null&&(!Ct||(le.f&2)!==0)&&(li!=null?li:li=new Set).add(t)}var Zt=null,Ar=0,ci=null;function v$(t){ci=t}var $$=1,so=0,Qs=so;function C0(t){Qs=t}function tc(){return++$$}function Xs(t){var e=t.f;if((e&2048)!==0)return!0;if(e&2&&(t.f&=-65537),(e&4096)!==0){for(var r=t.deps,i=r.length,n=0;nt.wv)return!0}(e&512)!==0&&Tt===null&&Ve(t,1024)}return!1}function F$(t,e,r=!0){var i=t.reactions;if(i!==null&&!(!Ct&&li!==null&&li.has(t)))for(var n=0;n{t.ac.abort(Ws)}),t.ac=null);try{t.f|=2097152;var u=t.fn,f=u();t.f|=32768;var d=t.deps,h=(g=ce)==null?void 0:g.is_fork;if(Zt!==null){var p;if(h||eo(t,Ar),d!==null&&Ar>0)for(d.length=Ar+Zt.length,p=0;p{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),io()}function I(t){var h,p,g;var e=t.f,r=(e&2)!==0;if((h=R$)==null||h.add(t),le!==null&&!Tr){var i=ee!==null&&(ee.f&16384)!==0;if(!i&&(li===null||!li.has(t))){var n=le.deps;if((le.f&2097152)!==0)t.rvr==null?void 0:r.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Mt(()=>{e.addEventListener(t,n,i)}):e.addEventListener(t,n,i),n}function ui(t,e,r,i,n){var s={capture:i,passive:n},a=O$(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&nr(()=>{e.removeEventListener(t,a,s)})}function we(t,e,r){var i;((i=e[ao])!=null?i:e[ao]={})[t]=r}function Pt(t){for(var e=0;e{throw y});throw d}}finally{t[ao]=e,delete t.currentTarget,Lt(u),Nt(f)}}}m();m();var L$,O0=((L$=globalThis==null?void 0:globalThis.window)==null?void 0:L$.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function N$(t){var e;return(e=O0==null?void 0:O0.createHTML(t))!=null?e:t}function L0(t){var e=In("template");return e.innerHTML=N$(t.replaceAll("","")),e.content}function tn(t,e){var r=ee;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function xe(t,e){var r=(e&1)!==0,i=(e&2)!==0,n,s=!t.startsWith("");return()=>{if(ae)return tn(be,null),be;n===void 0&&(n=L0(s?t:""+t),r||(n=or(n)));var a=i||Qu?document.importNode(n,!0):n.cloneNode(!0);if(r){var o=or(a),l=a.lastChild;tn(o,l)}else tn(a,a);return a}}function oo(){if(ae)return tn(be,null),be;var t=document.createDocumentFragment(),e=document.createComment(""),r=Bt();return t.append(e,r),tn(e,r),t}function fe(t,e){if(ae){var r=ee;((r.f&32768)===0||r.nodes.end===null)&&(r.nodes.end=be),fr();return}t!==null&&t.before(e)}m();var M4=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var Jee=[...M4,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var D4=["touchstart","touchmove"];function B$(t){return D4.includes(t)}var O4=["$state","$state.raw","$derived","$derived.by"],ete=[...O4,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var Cp=!0;function ze(t,e){var i,n;var r=e==null?"":typeof e=="object"?`${e}`:e;r!==((n=t[i=qu])!=null?n:t[i]=t.nodeValue)&&(t[qu]=r,t.nodeValue=`${r}`)}function Js(t,e){return H$(t,e)}function H0(t,e){var a;bp(),e.intro=(a=e.intro)!=null?a:!1;let r=e.target,i=ae,n=be;try{for(var s=or(r);s&&(s.nodeType!==Pi||s.data!=="[");)s=rr(s);if(!s)throw Jn;It(!0),je(s);let o=H$(t,{...e,anchor:s});return It(!1),o}catch(o){if(o instanceof Error&&o.message.split(` +`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==Jn&&console.warn("Failed to hydrate: ",o),e.recover===!1&&PR(),bp(),fc(r),It(!1),Js(t,e)}finally{It(i),je(n)}}var Ap=new Map;function H$(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){bp();var l=void 0,c=k$(()=>{var u=r!=null?r:e.appendChild(Bt());d0(u,{pending:()=>{}},h=>{ct({});var p=Ee;if(s&&(p.c=s),n&&(i.$$events=n),ae&&tn(h,null),Cp=a,l=t(h,i)||{},Cp=!0,ae&&(ee.nodes.end=be,be===null||be.nodeType!==Pi||be.data!=="]"))throw ja(),Jn;ut()},o);var f=new Set,d=h=>{for(var p=0;p{var w;for(var h of f)for(let y of[e,document]){var p=Ap.get(y),g=p.get(h);--g==0?(y.removeEventListener(h,kp),p.delete(h),p.size===0&&Ap.delete(y)):p.set(h,g)}Sp.delete(d),u!==r&&((w=u.parentNode)==null||w.removeChild(u))}});return B0.set(l,c),l}var B0=new WeakMap;function ds(t,e){let r=B0.get(t);return r?(B0.delete(t),r(e)):(L&&(er in t?UR():HR()),Promise.resolve())}m();m();m();var rn,Dn,fi,lo,df,hf,Tp,hs=class{constructor(e,r=!0){He(this,"anchor");ge(this,rn,new Map);ge(this,Dn,new Map);ge(this,fi,new Map);ge(this,lo,new Set);ge(this,df,!0);ge(this,hf,e=>{if(F(this,rn).has(e)){var r=F(this,rn).get(e),i=F(this,Dn).get(r);if(i)dc(i),F(this,lo).delete(r);else{var n=F(this,fi).get(r);n&&(dc(n.effect),F(this,Dn).set(r,n.effect),F(this,fi).delete(r),L&&(n.fragment.lastChild[e0]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of F(this,rn)){if(F(this,rn).delete(s),s===e)break;let o=F(this,fi).get(a);o&&(vt(o.effect),F(this,fi).delete(a))}for(let[s,a]of F(this,Dn)){if(s===r||F(this,lo).has(s))continue;let o=()=>{if(Array.from(F(this,rn).values()).includes(s)){var c=document.createDocumentFragment();Ql(a,c),c.append(Bt()),F(this,fi).set(s,{effect:a,fragment:c})}else vt(a);F(this,lo).delete(s),F(this,Dn).delete(s)};F(this,df)||!i?(F(this,lo).add(s),Rn(a,o,!1)):o()}}});ge(this,Tp,e=>{F(this,rn).delete(e);let r=Array.from(F(this,rn).values());for(let[i,n]of F(this,fi))r.includes(i)||(vt(n.effect),F(this,fi).delete(i))});this.anchor=e,pe(this,df,r)}ensure(e,r){var i=ce,n=_p();if(r&&!F(this,Dn).has(e)&&!F(this,fi).has(e))if(n){var s=document.createDocumentFragment(),a=Bt();s.append(a),F(this,fi).set(e,{effect:Ot(()=>r(a)),fragment:s})}else F(this,Dn).set(e,Ot(()=>r(this.anchor)));if(F(this,rn).set(i,e),n){for(let[o,l]of F(this,Dn))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of F(this,fi))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(F(this,hf)),i.ondiscard(F(this,Tp))}else ae&&(this.anchor=be),F(this,hf).call(this,i)}};rn=new WeakMap,Dn=new WeakMap,fi=new WeakMap,lo=new WeakMap,df=new WeakMap,hf=new WeakMap,Tp=new WeakMap;if(L){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;$R(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function co(t){Ee===null&&Qh("onMount"),ts&&Ee.l!==null?B4(Ee).m.push(t):mr(()=>{let e=Ye(t);if(typeof e=="function")return e})}function B4(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var j$=new Map;function V$(t,e){var r=j$.get(t);r||(r=new Set,j$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function Fe(t,e,r=!1){var i;ae&&(i=be,fr());var n=new hs(t),s=r?65536:0;function a(o,l){if(ae){var c=Zu(i);if(o!==parseInt(c.substring(1))){var u=An();je(u),n.anchor=u,It(!1),n.ensure(o,l),It(!0);return}}n.ensure(o,l)}ai(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();m();m();function di(t,e){return e}function q4(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;U0(t,jl(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;fc(u),u.append(c),t.items.clear()}U0(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function U0(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{var S=r();return es(S)?S:S==null?[]:jl(S)});L&&dr(f,"{#each ...}");var d,h=new Map,p=!0;function g(S){(b.effect.f&16384)===0&&(b.pending.delete(S),b.fallback=u,Y4(b,d,a,e,i),u!==null&&(d.length===0?(u.f&33554432)===0?dc(u):(u.f^=33554432,mf(u,null,a)):Rn(u,()=>{u=null})))}function w(S){b.pending.delete(S)}var y=ai(()=>{d=I(f);var S=d.length;let C=!1;if(ae){var A=Zu(a)==="[!";A!==(S===0)&&(a=An(),je(a),It(!1),C=!0)}for(var k=new Set,v=ce,x=_p(),_=0;_s(a)):(u=Ot(()=>s(hc!=null?hc:hc=Bt())),u.f|=33554432)),S>k.size&&(L?K4(d,i):i0("","","")),ae&&S>0&&je(An()),!p)if(h.set(v,k),x){for(let[D,Q]of o)k.has(D)||v.skip_effect(Q.e);v.oncommit(g),v.ondiscard(w)}else g(v);C&&It(!0),I(f)}),b={effect:y,flags:e,items:o,pending:h,outrogroups:null,fallback:u};p=!1,ae&&(a=be)}function pf(t){for(;t!==null&&(t.f&32)===0;)t=t.next;return t}function Y4(t,e,r,i,n){var P,T,M,$,D,Q,ye,de,J;var s=(i&8)!==0,a=e.length,o=t.items,l=pf(t.effect.first),c,u=null,f,d=[],h=[],p,g,w,y;if(s)for(y=0;y0){var _=(i&4)!==0&&a===0?r:null;if(s){for(y=0;y{var X,he;if(f!==void 0)for(w of f)(he=(X=w.nodes)==null?void 0:X.a)==null||he.apply()})}function Z4(t,e,r,i,n,s,a,o){var l=(a&1)!==0?(a&16)===0?qa(r,!1,!1):pr(r):null,c=(a&2)!==0?pr(n):null;return L&&l&&(l.trace=()=>{var u;o()[(u=c==null?void 0:c.v)!=null?u:n]}),{v:l,i:c,e:Ot(()=>(s(e,l!=null?l:r,c!=null?c:n,o),()=>{t.delete(i)}))}}function mf(t,e,r){if(t.nodes)for(var i=t.nodes.start,n=t.nodes.end,s=e&&(e.f&33554432)===0?e.nodes.start:r;i!==null;){var a=rr(i);if(s.before(i),i===n)return;i=a}}function ea(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}function K4(t,e){let r=new Map,i=t.length;for(let n=0;nperformance.now():()=>Date.now(),nn={tick:t=>(qh?requestAnimationFrame:ur)(t),now:()=>X4(),tasks:new Set};function W$(){let t=nn.now();nn.tasks.forEach(e=>{e.c(t)||(nn.tasks.delete(e),e.f())}),nn.tasks.size!==0&&nn.tick(W$)}function q$(t){let e;return nn.tasks.size===0&&nn.tick(W$),{promise:new Promise(r=>{nn.tasks.add(e={c:t,f:r})}),abort(){nn.tasks.delete(e)}}}function Pp(t,e){en(()=>{t.dispatchEvent(new CustomEvent(e))})}function tU(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;let e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function Y$(t){let e={},r=t.split(";");for(let i of r){let[n,s]=i.split(":");if(!n||s===void 0)break;let a=tU(n.trim());e[a]=s.trim()}return e}var rU=t=>t;function sn(t,e,r,i){var S,C;var n=(t&1)!==0,s=(t&2)!==0,a=n&&s,o=(t&4)!==0,l=a?"both":n?"in":"out",c,u=e.inert,f=e.style.overflow,d,h;function p(){return en(()=>{var A;return c!=null?c:c=r()(e,(A=i==null?void 0:i())!=null?A:{},{direction:l})})}var g={is_global:o,in(){var A;if(e.inert=u,!n){h==null||h.abort(),(A=h==null?void 0:h.reset)==null||A.call(h);return}s||d==null||d.abort(),d=G0(e,p(),h,1,()=>{Pp(e,"introstart")},()=>{Pp(e,"introend"),d==null||d.abort(),d=c=void 0,e.style.overflow=f})},out(A){if(!s){A==null||A(),c=void 0;return}e.inert=!0,h=G0(e,p(),d,0,()=>{Pp(e,"outrostart")},()=>{Pp(e,"outroend"),A==null||A()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},w=ee;if(((C=(S=w.nodes).t)!=null?C:S.t=[]).push(g),n&&Cp){var y=o;if(!y){for(var b=w.parent;b&&(b.f&65536)!==0;)for(;(b=b.parent)&&(b.f&16)===0;);y=!b||(b.f&32768)!==0}y&&qr(()=>{Ye(()=>g.in())})}}function G0(t,e,r,i,n,s){var a=i===1;if(Qw(e)){var o,l=!1;return Mt(()=>{if(!l){var y=e({direction:a?"in":"out"});o=G0(t,y,r,i,n,s)}}),{abort:()=>{l=!0,o==null||o.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration)&&!(e!=null&&e.delay))return n(),s(),{abort:ur,deactivate:ur,reset:ur,t:()=>i};let{delay:c=0,css:u,tick:f,easing:d=rU}=e;var h=[];if(a&&r===void 0&&(f&&f(0,1),u)){var p=Y$(u(0,1));h.push(p,p)}var g=()=>1-i,w=t.animate(h,{duration:c,fill:"forwards"});return w.onfinish=()=>{var P;w.cancel(),n();var y=(P=r==null?void 0:r.t())!=null?P:1-i;r==null||r.abort();var b=i-y,S=e.duration*Math.abs(b),C=[];if(S>0){var A=!1;if(u)for(var k=Math.ceil(S/16.666666666666668),v=0;v<=k;v+=1){var x=y+b*d(v/k),_=Y$(u(x,1-x));C.push(_),A||(A=_.overflow==="hidden")}A&&(t.style.overflow="hidden"),g=()=>{var T=w.currentTime;return y+b*d(T/S)},f&&q$(()=>{if(w.playState!=="running")return!1;var T=g();return f(T,1-T),!0})}w=t.animate(C,{duration:S,fill:"forwards"}),w.onfinish=()=>{g=()=>i,f==null||f(i,1-i),s()}},{abort:()=>{w&&(w.cancel(),w.effect=null,w.onfinish=ur)},deactivate:()=>{s=ur},reset:()=>{i===0&&(f==null||f(1,0))},t:()=>g()}}m();m();function an(t,e){qr(()=>{var n;var r=t.getRootNode(),i=r.host?r:(n=r.head)!=null?n:r.ownerDocument.head;if(!i.querySelector("#"+e.hash)){let s=In("style");s.id=e.hash,s.textContent=e.code,i.appendChild(s),L&&V$(e.hash,s)}})}m();m();m();m();m();m();var K$=[...` +\r\f\xA0\v\uFEFF`];function X$(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||K$.includes(i[a-1]))&&(o===i.length||K$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function wt(t,e,r,i,n,s){var a=t[Wu];if(ae||a!==r||a===void 0){var o=X$(r,i,s);(!ae||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t[Wu]=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 uU=Symbol("is custom element"),fU=Symbol("is html"),dU=t0?"link":"LINK";function ke(t,e,r,i){var n=hU(t);if(ae&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===dU)){i||mU(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[bR]=r),r==null?t.removeAttribute(e):typeof r!="string"&&pU(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function hU(t){var e,r;return(r=t[e=Xh])!=null?r:t[e]={[uU]:t.nodeName.includes("-"),[fU]:t.namespaceURI===Wh}}var Q$=new Map;function pU(t){var e=t.getAttribute("is")||t.nodeName,r=Q$.get(e);if(r)return r;Q$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=Zw(n);for(var a in i)i[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.push(a);n=Vl(n)}return r}function mU(t,e,r){var i;L&&(e==="srcset"&&gU(t,r)||j0((i=t.getAttribute(e))!=null?i:"",r)||BR(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function j0(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function J$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function gU(t,e){var r=J$(t.srcset),i=J$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&(j0(r[a][0],n)||j0(n,r[a][0])))}m();m();m();function W0(t,e,r=e){var i=new WeakSet;$0(t,"input",async n=>{L&&t.type==="checkbox"&&r0();var s=n?t.defaultValue:t.value;if(s=V0(t)?z0(s):s,r(s),ce!==null&&i.add(ce),await Ep(),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))}}}),(ae&&t.defaultValue!==t.value||Ye(e)==null&&t.value)&&(r(V0(t)?z0(t.value):t.value),ce!==null&&i.add(ce)),ar(()=>{L&&t.type==="checkbox"&&r0();var n=e();if(t===document.activeElement){var s=Ct?as:ce;if(i.has(s))return}V0(t)&&n===z0(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function V0(t){var e=t.type;return e==="number"||e==="range"}function z0(t){return t===""?null:+t}m();m();m();m();m();function q0(t,e){return t===e||(t==null?void 0:t[er])===e}function ot(t={},e,r,i){var n=Ee.r,s=ee;return qr(()=>{var a,o;return ar(()=>{a=o,o=(i==null?void 0:i())||[],Ye(()=>{q0(r(...o),t)||(e(t,...o),a&&q0(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&&q0(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Di(t,e,r,i){var C,A;var n=!ts||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=void 0,u=()=>a&&n?(c!=null||(c=Zs(i)),I(c)):(l&&(l=!1,o=a?Ye(i):i),o);let f;if(s){var d=er in t||zu in t;f=(A=(C=Gr(t,e))==null?void 0:C.set)!=null?A:d&&e in t?k=>t[e]=k:void 0}var h,p=!1;s?[h,p]=o0(()=>t[e]):h=t[e],h===void 0&&i!==void 0&&(h=u(),f&&(n&&RR(e),f(h)));var g;if(n?g=()=>{var k=t[e];return k===void 0?u():(l=!0,k)}:g=()=>{var k=t[e];return k!==void 0&&(o=void 0),k===void 0?o:k},n&&(r&4)===0)return g;if(f){var w=t.$$legacy;return(function(k,v){return arguments.length>0?((!n||!v||w||p)&&f(v?g():k),k):g()})}var y=!1,b=((r&1)!==0?Zs:Qa)(()=>(y=!1,g()));L&&(b.label=e),s&&I(b);var S=ee;return(function(k,v){if(arguments.length>0){let x=v?I(b):n&&s?Je(k):k;return oe(b,x),y=!0,o!==void 0&&(o=x),k}return oi&&y||(S.f&16384)!==0?b.v:I(b)})}m();m();m();function tF(t){return new Z0(t)}var ps,Oi,Z0=class{constructor(e){ge(this,ps);ge(this,Oi);var s,a;var r=new Map,i=(o,l)=>{var c=qa(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return I((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===zu?!0:(I((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return oe((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});pe(this,Oi,(e.hydrate?H0:Js)(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})),!Ct&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&io(),pe(this,ps,n.$$events);for(let o of Object.keys(F(this,Oi)))o==="$set"||o==="$destroy"||o==="$on"||cr(this,o,{get(){return F(this,Oi)[o]},set(l){F(this,Oi)[o]=l},enumerable:!0});F(this,Oi).$set=o=>{Object.assign(n,o)},F(this,Oi).$destroy=()=>{ds(F(this,Oi))}}$set(e){F(this,Oi).$set(e)}$on(e,r){F(this,ps)[e]=F(this,ps)[e]||[];let i=(...n)=>r.call(this,...n);return F(this,ps)[e].push(i),()=>{F(this,ps)[e]=F(this,ps)[e].filter(n=>n!==i)}}$destroy(){F(this,Oi).$destroy()}};ps=new WeakMap,Oi=new WeakMap;var PU;typeof HTMLElement=="function"&&(PU=class extends HTMLElement{constructor(e,r,i){super();He(this,"$$ctor");He(this,"$$s");He(this,"$$c");He(this,"$$cn",!1);He(this,"$$d",{});He(this,"$$r",!1);He(this,"$$p_d",{});He(this,"$$l",{});He(this,"$$l_u",new Map);He(this,"$$me");He(this,"$$shadowRoot",null);this.$$ctor=e,this.$$s=r,i&&(this.$$shadowRoot=this.attachShadow(i))}addEventListener(e,r,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){let n=this.$$c.$on(e,r);this.$$l_u.set(r,n)}super.addEventListener(e,r,i)}removeEventListener(e,r,i){if(super.removeEventListener(e,r,i),this.$$c){let n=this.$$l_u.get(r);n&&(n(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return s=>{let a=In("slot");n!=="default"&&(a.name=n),fe(s,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let r={},i=RU(this);for(let n of this.$$s)n in i&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),r.default=!0):r[n]=e(n));for(let n of this.attributes){let s=this.$$g_p(n.name);s in this.$$d||(this.$$d[s]=K0(s,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=tF({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=I0(()=>{ar(()=>{var n;this.$$r=!0;for(let s of Yw(this.$$c)){if(!((n=this.$$p_d[s])!=null&&n.reflect))continue;this.$$d[s]=this.$$c[s];let a=K0(s,this.$$d[s],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,a)}this.$$r=!1})});for(let n in this.$$l)for(let s of this.$$l[n]){let a=this.$$c.$on(n,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,r,i){var n;this.$$r||(e=this.$$g_p(e),this.$$d[e]=K0(e,i,this.$$p_d,"toProp"),(n=this.$$c)==null||n.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Yw(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function K0(t,e,r,i){var s;let n=(s=r[t])==null?void 0:s.type;if(e=n==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!r[t])return e;if(i==="toAttribute")switch(n){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(n){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function RU(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}m();m();function uo(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(u){try{c(i.next(u))}catch(f){a(f)}}function l(u){try{c(i.throw(u))}catch(f){a(f)}}function c(u){u.done?s(u.value):n(u.value).then(o,l)}c((i=i.apply(t,e||[])).next())})}var eb=require("obsidian");m();var Q0=require("obsidian");m();function $U(t){let e=t-1;return e*e*e+1}var X0=!1;function Nn(t,{delay:e=0,duration:r=400,easing:i=$U,axis:n="y"}={}){let s=getComputedStyle(t);L&&!X0&&/(contents|inline|table)/.test(s.display)&&(X0=!0,Promise.resolve().then(()=>X0=!1),jR(s.display));let a=+s.opacity,o=n==="y"?"height":"width",l=parseFloat(s[o]),c=n==="y"?["top","bottom"]:["left","right"],u=c.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),f=parseFloat(s[`padding${u[0]}`]),d=parseFloat(s[`padding${u[1]}`]),h=parseFloat(s[`margin${u[0]}`]),p=parseFloat(s[`margin${u[1]}`]),g=parseFloat(s[`border${u[0]}Width`]),w=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:r,easing:i,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*a};${o}: ${y*l}px;padding-${c[0]}: ${y*f}px;padding-${c[1]}: ${y*d}px;margin-${c[0]}: ${y*h}px;margin-${c[1]}: ${y*p}px;border-${c[0]}-width: ${y*g}px;border-${c[1]}-width: ${y*w}px;min-${o}: 0`}}m();var $p=require("obsidian");var FU=xe('
'),IU=xe('
'),MU={hash:"svelte-1c0jiav",code:"main.svelte-1c0jiav .nav-file-title:where(.svelte-1c0jiav) {align-items:center;}"};function gf(t,e){ct(e,!0),an(t,MU);let r=Je([]),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");mr(()=>{for(let b of r)b&&(0,$p.setIcon)(b,b.getAttr("data-icon"))});function n(b){b.stopPropagation(),al(e.diff.path)?s(b):a(b)}function s(b){var S;b.stopPropagation();let C=e.view.app.vault.getAbstractFileByPath(e.diff.vaultPath);C instanceof $p.TFile&&((S=ji(e.view.app,b))===null||S===void 0||S.openFile(C).catch(A=>e.view.plugin.displayError(A)))}function a(b){var S;e.view.plugin.tools.openDiff({event:b,aFile:(S=e.diff.fromPath)!==null&&S!==void 0?S:e.diff.path,aRef:`${e.diff.hash}^`,bFile:e.diff.path,bRef:e.diff.hash})}var o=IU(),l=W(o),c=W(l),u=W(c,!0);V(c);var f=ne(c,2),d=W(f),h=W(d);{var p=b=>{var S=FU();ot(S,C=>r[0]=C,()=>r==null?void 0:r[0]),ui("auxclick",S,s),we("click",S,s),fe(b,S)},g=ft(()=>ol(e.diff.vaultPath,e.view.app));Fe(h,b=>{I(g)&&b(p)})}V(d);var w=ne(d,2),y=W(w,!0);V(w),V(f),V(l),V(o),Ue(b=>{ke(l,"data-path",e.diff.vaultPath),ke(l,"data-tooltip-position",I(i)),ke(l,"aria-label",e.diff.vaultPath),ze(u,b),ke(w,"data-type",e.diff.status),ze(y,e.diff.status)},[()=>_n(e.diff.vaultPath)]),we("click",o,n),ui("auxclick",o,b=>{b.stopPropagation(),b.button==2?bn(e.view.app,b,e.diff.vaultPath,e.view.leaf,"git-history"):n(b)}),fe(t,o),ut()}Pt(["click"]);m();var DU=xe("
"),OU=xe(''),LU=xe('
'),NU=xe("
"),BU={hash:"svelte-d9h7mp",code:"main.svelte-d9h7mp .nav-folder-title-content:where(.svelte-d9h7mp) {display:flex;align-items:center;}"};function vf(t,e){ct(e,!0),an(t,BU);let r=Di(e,"topLevel",3,!1),i=Di(e,"closed",15),n=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function s(l,c){l.stopPropagation(),i(i()[c.path]=!i()[c.path],!0)}var a=NU();let o;hi(a,21,()=>e.hierarchy.children,di,(l,c)=>{var u=oo(),f=Mi(u);{var d=p=>{var g=DU(),w=W(g);gf(w,{get diff(){return I(c).data},get view(){return e.view}}),V(g),fe(p,g)},h=p=>{var g=LU();let w;var y=W(g),b=ne(W(y),2);let S;var C=ne(b,2),A=W(C,!0);V(C),V(y);var k=ne(y,2);{var v=x=>{var _=OU(),P=W(_);vf(P,{get hierarchy(){return I(c)},get plugin(){return e.plugin},get view(){return e.view},get closed(){return i()},set closed(T){i(T)}}),V(_),sn(3,_,()=>Nn,()=>({duration:150})),fe(x,_)};Fe(k,x=>{i()[I(c).path]||x(v)})}V(g),Ue(()=>{w=wt(g,1,"tree-item nav-folder",null,w,{"is-collapsed":i()[I(c).path]}),ke(y,"data-tooltip-position",I(n)),ke(y,"aria-label",I(c).vaultPath),S=wt(b,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,S,{"is-collapsed":i()[I(c).path]}),ze(A,I(c).title)}),we("click",y,x=>s(x,I(c))),fe(p,g)};Fe(f,p=>{I(c).data?p(d):p(h,-1)})}fe(l,u)}),V(a),Ue(()=>o=wt(a,1,"svelte-d9h7mp",null,o,{topLevel:r()})),fe(t,a),ut()}Pt(["click"]);var HU=xe('
'),UU=xe('
'),GU=xe('
'),jU=xe(''),VU=xe('
'),zU={hash:"svelte-1edsiy5",code:""};function J0(t,e){ct(e,!0),an(t,zU);let r=ft(()=>({title:"",path:"",vaultPath:"",children:e.plugin.gitManager.getTreeStructure(e.log.diff.files)})),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left"),n=Ne(!0),s=Ne(Je({}));function a(x){let _=x.author.name;if(e.plugin.settings.authorInHistoryView=="full")return _;if(e.plugin.settings.authorInHistoryView=="initials")return _.split(" ").filter(T=>T.length>0).map(T=>T[0].toUpperCase()).join("")}var o=VU(),l=W(o);let c;var u=W(l),f=W(u);let d;var h=ne(f,2),p=W(h);{var g=x=>{var _=HU(),P=W(_,!0);V(_),Ue(T=>ze(P,T),[()=>e.log.refs.join(", ")]),fe(x,_)};Fe(p,x=>{e.log.refs.length>0&&x(g)})}var w=ne(p,2);{var y=x=>{var _=UU(),P=W(_,!0);V(_),Ue(T=>ze(P,T),[()=>a(e.log)]),fe(x,_)};Fe(w,x=>{var _;e.plugin.settings.authorInHistoryView!="hide"&&((_=e.log.author)!=null&&_.name)&&x(y)})}var b=ne(w,2);{var S=x=>{var _=GU(),P=W(_,!0);V(_),Ue(T=>ze(P,T),[()=>(0,Q0.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),fe(x,_)};Fe(b,x=>{e.plugin.settings.dateInHistoryView&&x(S)})}var C=ne(b,2),A=W(C,!0);V(C),V(h),V(u);var k=ne(u,2);{var v=x=>{var _=jU(),P=W(_);{var T=$=>{vf($,{get hierarchy(){return I(r)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return I(s)},set closed(D){oe(s,D,!0)}})},M=$=>{var D=oo(),Q=Mi(D);hi(Q,17,()=>e.log.diff.files,di,(ye,de)=>{gf(ye,{get view(){return e.view},get diff(){return I(de)}})}),fe($,D)};Fe(P,$=>{e.showTree?$(T):$(M,-1)})}V(_),sn(3,_,()=>Nn,()=>({duration:150})),fe(x,_)};Fe(k,x=>{I(n)||x(v)})}V(l),V(o),Ue(x=>{c=wt(l,1,"tree-item nav-folder",null,c,{"is-collapsed":I(n)}),ke(u,"aria-label",x),ke(u,"data-tooltip-position",I(i)),d=wt(f,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,d,{"is-collapsed":I(n)}),ze(A,e.log.message)},[()=>{var x;return`${e.log.refs.length>0?e.log.refs.join(", ")+` +`:""}${(x=e.log.author)==null?void 0:x.name} +${(0,Q0.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)} +${e.log.message}`}]),we("click",u,()=>oe(n,!I(n))),fe(t,o),ut()}Pt(["click"]);var WU=xe(''),qU=xe('
'),YU={hash:"svelte-12n6twc",code:""};function tb(t,e){ct(e,!0),an(t,YU);let r=Di(e,"plugin",15),i=Ne(!1),n=Je([]),s=Ne(void 0),a=Ne(Je(r().settings.treeStructure)),o;mr(()=>{o&&o.empty()}),co(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>{c().catch(console.error)}))}),mr(()=>{n.forEach(C=>(0,eb.setIcon)(C,C.getAttr("data-icon")))}),co(()=>{let C=new IntersectionObserver(k=>{k[0].isIntersecting&&!I(i)&&u().catch(console.error)}),A=activeDocument.querySelector("#sentinel");return A&&C.observe(A),()=>{C.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}function c(){return uo(this,void 0,void 0,function*(){var C;if(!r().gitReady){oe(s,void 0);return}oe(i,!0);let A=r().gitManager instanceof Ce,k;((C=I(s)===null||I(s)===void 0?void 0:I(s).length)!==null&&C!==void 0?C:0)==0?k=A?50:10:k=I(s).length,oe(s,yield r().gitManager.log(void 0,!1,k),!0),oe(i,!1)})}function u(){return uo(this,void 0,void 0,function*(){var C;if(!r().gitReady||I(s)===void 0)return;oe(i,!0);let k=r().gitManager instanceof Ce?50:10,v=yield r().gitManager.log(void 0,!1,k,(C=I(s).last())===null||C===void 0?void 0:C.hash);I(s).push(...v.slice(1)),oe(i,!1)})}var f=qU(),d=W(f),h=W(d),p=W(h);ot(p,C=>n[0]=C,()=>n==null?void 0:n[0]);var g=ne(p,2);let w;ot(g,C=>n[1]=C,()=>n==null?void 0:n[1]),V(h),V(d);var y=ne(d,2),b=W(y);{var S=C=>{var A=WU();hi(A,21,()=>I(s),di,(k,v)=>{J0(k,{get view(){return e.view},get showTree(){return I(a)},get log(){return I(v)},get plugin(){return r()}})}),V(A),fe(C,A)};Fe(b,C=>{I(s)&&C(S)})}Va(4),V(y),V(f),Ue(()=>{ke(p,"data-icon",I(a)?"list":"folder"),w=wt(g,1,"clickable-icon nav-action-button",null,w,{loading:I(i)})}),we("click",p,()=>{oe(a,!I(a)),(0,eb.setIcon)(n[0],I(a)?"list":"folder"),r(r().settings.treeStructure=I(a),!0),r().saveSettings()}),we("click",g,l),fe(t,f),ut()}Pt(["click"]);var wf=class extends rF.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return bi.type}getDisplayText(){return bi.name}getIcon(){return bi.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=Js(tb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var iF=require("obsidian"),Fp=class extends iF.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 aF=require("obsidian");m();var po=require("obsidian");m();var bf=require("obsidian");m();var nF=require("obsidian");var pc=class extends nF.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 ${gu(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 ${gu(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 ${gu(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 ${gu(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()}};var ZU=xe('
'),KU=xe('
');function _f(t,e){ct(e,!0);let r=Je([]),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");mr(()=>{for(let v of r)v&&(0,bf.setIcon)(v,v.getAttr("data-icon"))});function n(v){v.stopPropagation(),al(e.change.path)?a(v):l(v)}function s(v){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&ll(e.view.app,v,e.view,e.change.vaultPath)}function a(v){var x;v.stopPropagation();let _=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);_ instanceof bf.TFile&&((x=ji(e.view.app,v))===null||x===void 0||x.openFile(_).catch(P=>e.view.plugin.displayError(P)))}function o(v){v.stopPropagation(),e.manager.stage(e.change.path,!1).catch(x=>e.view.plugin.displayError(x)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function l(v){v.stopPropagation(),e.view.plugin.tools.openDiff({aFile:e.change.path,aRef:"",event:v})}function c(v){v.stopPropagation();let x=e.change.workingDir=="U";new pc({app:e.view.app,filesToDeleteCount:x?1:0,filesToDiscardCount:x?0:1,path:e.change.vaultPath}).openAndGetResult().then(_=>uo(this,void 0,void 0,function*(){if(_=="delete"){let P=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);P instanceof bf.TFile?yield e.view.app.fileManager.trashFile(P):yield e.view.app.vault.adapter.remove(e.change.vaultPath)}else _=="discard"&&(yield e.manager.discard(e.change.path).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")}));e.view.app.workspace.trigger("obsidian-git:refresh")}),_=>e.view.plugin.displayError(_))}var u=KU(),f=W(u),d=W(f),h=W(d,!0);V(d);var p=ne(d,2),g=W(p),w=W(g);{var y=v=>{var x=ZU();ot(x,_=>r[0]=_,()=>r==null?void 0:r[0]),ui("auxclick",x,a),we("click",x,a),fe(v,x)},b=ft(()=>ol(e.change.vaultPath,e.view.app));Fe(w,v=>{I(b)&&v(y)})}var S=ne(w,2);ot(S,v=>r[1]=v,()=>r==null?void 0:r[1]);var C=ne(S,2);ot(C,v=>r[2]=v,()=>r==null?void 0:r[2]),V(g);var A=ne(g,2),k=W(A,!0);V(A),V(p),V(f),V(u),Ue(v=>{ke(f,"data-path",e.change.vaultPath),ke(f,"data-tooltip-position",I(i)),ke(f,"aria-label",e.change.vaultPath),ze(h,v),ke(A,"data-type",e.change.workingDir),ze(k,e.change.workingDir)},[()=>_n(e.change.vaultPath)]),we("mouseover",u,s),we("click",u,n),ui("auxclick",u,v=>{v.stopPropagation(),v.button==2?bn(e.view.app,v,e.change.vaultPath,e.view.leaf,"git-source-control"):n(v)}),we("click",S,c),we("click",C,o),fe(t,u),ut()}Pt(["mouseover","click"]);m();var sF=require("obsidian");var XU=xe('
');function yf(t,e){ct(e,!0);let r=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function i(d){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&ll(e.view.app,d,e.view,e.change.vaultPath)}function n(d){var h;d.stopPropagation();let p=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);p instanceof sF.TFile&&((h=ji(e.view.app,d))===null||h===void 0||h.openFile(p).catch(g=>e.view.plugin.displayError(g)))}var s=XU(),a=W(s),o=W(a),l=W(o,!0);V(o);var c=ne(o,2),u=W(c),f=W(u,!0);V(u),V(c),V(a),V(s),Ue(d=>{ke(a,"data-path",e.change.vaultPath),ke(a,"data-tooltip-position",I(r)),ke(a,"aria-label",e.change.vaultPath),ze(l,d),ke(u,"data-type",e.change.workingDir),ze(f,e.change.workingDir)},[()=>_n(e.change.vaultPath)]),we("mouseover",s,i),we("click",s,n),ui("auxclick",s,d=>{d.stopPropagation(),d.button==2?bn(e.view.app,d,e.change.vaultPath,e.view.leaf,"git-source-control"):n(d)}),fe(t,s),ut()}Pt(["mouseover","click"]);m();var Ip=require("obsidian");var QU=xe('
'),JU=xe('
');function xf(t,e){ct(e,!0);let r=Je([]),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");mr(()=>{for(let A of r)A&&(0,Ip.setIcon)(A,A.getAttr("data-icon"))});function n(A){A.stopPropagation(),al(e.change.path)?a(A):o(A)}function s(A){e.view.app.vault.getFileByPath(e.change.vaultPath)&&ll(e.view.app,A,e.view,e.change.vaultPath)}function a(A){var k;A.stopPropagation();let v=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);v instanceof Ip.TFile&&((k=ji(e.view.app,A))===null||k===void 0||k.openFile(v).catch(x=>e.view.plugin.displayError(x)))}function o(A){var k;A.stopPropagation(),e.view.plugin.tools.openDiff({aFile:(k=e.change.from)!==null&&k!==void 0?k:e.change.path,bFile:e.change.path,aRef:"HEAD",bRef:"",event:A})}function l(A){A.stopPropagation(),e.manager.unstage(e.change.path,!1).catch(k=>e.view.plugin.displayError(k)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}var c=JU(),u=W(c),f=W(u),d=W(f,!0);V(f);var h=ne(f,2),p=W(h),g=W(p);{var w=A=>{var k=QU();ot(k,v=>r[0]=v,()=>r==null?void 0:r[0]),we("click",k,a),fe(A,k)},y=ft(()=>ol(e.change.vaultPath,e.view.app));Fe(g,A=>{I(y)&&A(w)})}var b=ne(g,2);ot(b,A=>r[1]=A,()=>r==null?void 0:r[1]),V(p);var S=ne(p,2),C=W(S,!0);V(S),V(h),V(u),V(c),Ue(A=>{ke(u,"data-path",e.change.vaultPath),ke(u,"data-tooltip-position",I(i)),ke(u,"aria-label",e.change.vaultPath),ze(d,A),ke(S,"data-type",e.change.index),ze(C,e.change.index)},[()=>_n(e.change.vaultPath)]),we("mouseover",c,s),we("click",c,n),ui("auxclick",c,A=>{A.stopPropagation(),A.button==2?bn(e.view.app,A,e.change.vaultPath,e.view.leaf,"git-source-control"):n(A)}),we("click",b,l),fe(t,c),ut()}Pt(["mouseover","click"]);m();m();var eG=xe(''),tG=xe("
");function fo(t,e){ct(e,!0);var r=tG(),i=W(r);{var n=s=>{var a=eG(),o=W(a),l=W(o),c=W(l,!0);V(l),V(o),V(a),Ue(()=>{ke(o,"aria-label","And "+(e.files.length-500)+" more files"),ze(c,"And "+(e.files.length-500)+" more files")}),fe(s,a)};Fe(i,s=>{e.files.length>500&&s(n)})}V(r),fe(t,r),ut()}var iG=xe("
"),nG=xe('
'),sG=xe('
',1),aG=xe(''),oG=xe('
'),lG=xe("
");function ho(t,e){ct(e,!0);let r=Di(e,"topLevel",3,!1),i=Di(e,"closed",15);co(()=>{var h,p;for(let g of e.hierarchy.children)((p=(h=g.children)===null||h===void 0?void 0:h.length)!==null&&p!==void 0?p:0)>100&&i(i()[g.title]=!0,!0)});let n=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function s(h,p){h.stopPropagation(),e.plugin.gitManager.stageAll({dir:p}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function a(h,p){h.stopPropagation(),e.plugin.gitManager.unstageAll({dir:p}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function o(h,p){h.stopPropagation(),e.plugin.discardAll(p.vaultPath)}function l(h,p){h.stopPropagation(),i(i()[p.path]=!i()[p.path],!0)}var c=lG();let u;var f=W(c);hi(f,17,()=>vu(e.hierarchy.children,500),di,(h,p)=>{var g=oo(),w=Mi(g);{var y=S=>{var C=iG(),A=W(C);{var k=_=>{xf(_,{get change(){return I(p).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},v=_=>{_f(_,{get change(){return I(p).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},x=_=>{yf(_,{get change(){return I(p).data},get view(){return e.view}})};Fe(A,_=>{e.fileType==0?_(k):e.fileType==1?_(v,1):e.fileType==2&&_(x,2)})}V(C),fe(S,C)},b=S=>{var C=oG();let A;var k=W(C),v=ne(W(k),2);let x;var _=ne(v,2),P=W(_,!0);V(_);var T=ne(_,2),M=W(T),$=W(M);{var D=J=>{var X=nG();we("click",X,he=>a(he,I(p).path)),fe(J,X)},Q=J=>{var X=sG(),he=Mi(X),z=ne(he,2);we("click",he,K=>o(K,I(p))),we("click",z,K=>s(K,I(p).path)),fe(J,X)};Fe($,J=>{e.fileType==0?J(D):J(Q,-1)})}Va(2),V(M),V(T),V(k);var ye=ne(k,2);{var de=J=>{var X=aG(),he=W(X);ho(he,{get hierarchy(){return I(p)},get plugin(){return e.plugin},get view(){return e.view},get fileType(){return e.fileType},get closed(){return i()},set closed(z){i(z)}}),V(X),sn(3,X,()=>Nn,()=>({duration:150})),fe(J,X)};Fe(ye,J=>{i()[I(p).path]||J(de)})}V(C),Ue(()=>{A=wt(C,1,"tree-item nav-folder",null,A,{"is-collapsed":i()[I(p).path]}),ke(k,"data-tooltip-position",I(n)),ke(k,"aria-label",I(p).vaultPath),x=wt(v,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,x,{"is-collapsed":i()[I(p).path]}),ze(P,I(p).title)}),ui("auxclick",C,J=>bn(e.view.app,J,I(p).vaultPath,e.view.leaf,"git-source-control")),we("click",k,J=>l(J,I(p))),fe(S,C)};Fe(w,S=>{I(p).data?S(y):S(b,-1)})}fe(h,g)});var d=ne(f,2);fo(d,{get files(){return e.hierarchy.children}}),V(c),Ue(()=>u=wt(c,1,"",null,u,{topLevel:r()})),fe(t,c),ut()}Pt(["click"]);var cG=xe('
'),rb=xe(" ",1),ib=xe(''),uG=xe('
'),fG=xe(''),dG=xe('
'),hG={hash:"svelte-5wq9p",code:`.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;}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,");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,");-webkit-mask-repeat:no-repeat;}`};function nb(t,e){ct(e,!0),an(t,hG);let r=Di(e,"plugin",7),i=Di(e,"view",7),n=Ne(!1),s=Ne(void 0),a=Ne(Je([])),o=ft(()=>r().settings.commitMessage),l=Je([]),c=Ne(void 0),u=Ne(void 0),f=Ne(void 0),d=Ne(!0),h=Ne(!0),p=Ne(!0),g=Ne(0),w=Ne(Je({})),y=Ne(Je({})),b=Ne(Je({})),S=ft(()=>r().settings.treeStructure);co(()=>{i().registerEvent(i().app.workspace.on("obsidian-git:loading-status",()=>oe(n,!0))),i().registerEvent(i().app.workspace.on("obsidian-git:status-changed",()=>{k().catch(console.error)})),i().plugin.cachedStatus==null?i().plugin.refresh().catch(console.error):k().catch(console.error),i().scope=new po.Scope(r().app.scope),i().scope.register(["Ctrl"],"Enter",N=>A())}),mr(()=>{l.forEach(N=>(0,po.setIcon)(N,N.getAttr("data-icon")))}),mr(()=>{l.forEach(N=>{var ue,Re;!N||N.id!="push"||(po.Platform.isMobile?(N.removeClass("button-border"),I(g)>0&&N.addClass("button-border")):((ue=N.firstElementChild)===null||ue===void 0||ue.removeAttribute("color"),I(g)>0&&((Re=N.firstElementChild)===null||Re===void 0||Re.setAttr("color","var(--text-accent)"))))})});function C(){if(oe(n,!0),I(s)){let N=I(s).staged.length>0;r().promiseQueue.addTask(()=>r().commit({fromAuto:!1,commitMessage:I(o),onlyStaged:N}).then(()=>oe(o,r().settings.commitMessage)).finally(v))}}function A(){if(oe(n,!0),I(s)){let N=I(s).staged.length>0;r().promiseQueue.addTask(()=>r().commitAndSync({fromAutoBackup:!1,commitMessage:I(o),onlyStaged:N}).then(()=>{oe(o,r().settings.commitMessage)}).finally(v))}}function k(){return uo(this,void 0,void 0,function*(){if(!r().gitReady){oe(s,void 0);return}if(oe(g,yield r().gitManager.getUnpushedCommits(),!0),oe(s,r().cachedStatus,!0),oe(n,!1),r().lastPulledFiles&&r().lastPulledFiles!=I(a)&&(oe(a,r().lastPulledFiles,!0),oe(f,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(I(a))},!0)),I(s)){let N=(ue,Re)=>ue.vaultPath.split("/").last().localeCompare(_n(Re.vaultPath));I(s).changed.sort(N),I(s).staged.sort(N),oe(c,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(I(s).changed)},!0),oe(u,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(I(s).staged)},!0)}else oe(c,void 0),oe(u,void 0)})}function v(){i().app.workspace.trigger("obsidian-git:refresh")}function x(N){N.stopPropagation(),oe(n,!0),r().promiseQueue.addTask(()=>r().gitManager.stageAll({status:I(s)}).finally(v))}function _(N){N.stopPropagation(),oe(n,!0),r().promiseQueue.addTask(()=>r().gitManager.unstageAll({status:I(s)}).finally(v))}function P(){oe(n,!0),r().promiseQueue.addTask(()=>r().push().finally(v))}function T(){oe(n,!0),r().promiseQueue.addTask(()=>r().pullChangesFromRemote().finally(v))}function M(N){N.stopPropagation(),r().discardAll()}let $=ft(()=>(I(o).match(/\n/g)||[]).length+1||1);var D=dG(),Q=W(D),ye=W(Q),de=W(ye);ot(de,N=>l[0]=N,()=>l==null?void 0:l[0]);var J=ne(de,2);ot(J,N=>l[1]=N,()=>l==null?void 0:l[1]);var X=ne(J,2);ot(X,N=>l[2]=N,()=>l==null?void 0:l[2]);var he=ne(X,2);ot(he,N=>l[3]=N,()=>l==null?void 0:l[3]);var z=ne(he,2);ot(z,N=>l[4]=N,()=>l==null?void 0:l[4]);var K=ne(z,2);ot(K,N=>l[5]=N,()=>l==null?void 0:l[5]);var G=ne(K,2);ot(G,N=>l[6]=N,()=>l==null?void 0:l[6]);var Me=ne(G,2);let Et;ot(Me,N=>l[7]=N,()=>l==null?void 0:l[7]),V(ye),V(Q);var Ht=ne(Q,2),De=W(Ht);P0(De);var Rt=ne(De,2);{var $t=N=>{var ue=cG();ke(ue,"aria-label","Clear"),we("click",ue,()=>oe(o,"")),fe(N,ue)};Fe(Rt,N=>{I(o)&&N($t)})}V(Ht);var Xe=ne(Ht,2),re=W(Xe);{var B=N=>{var ue=fG(),Re=W(ue);let Ut;var Pr=W(Re),vo=W(Pr);let cb;var ub=ne(vo,4),Wp=W(ub),fb=W(Wp);ot(fb,gr=>l[8]=gr,()=>l==null?void 0:l[8]),V(Wp);var db=ne(Wp,2),mF=W(db,!0);V(db),V(ub),V(Pr);var gF=ne(Pr,2);{var vF=gr=>{var Rr=ib(),wo=W(Rr);{var ms=vr=>{ho(vr,{get hierarchy(){return I(u)},get plugin(){return r()},get view(){return i()},get fileType(){return 0},topLevel:!0,get closed(){return I(w)},set closed(Li){oe(w,Li,!0)}})},bo=vr=>{var Li=rb(),ta=Mi(Li);hi(ta,17,()=>vu(I(s).staged,500),di,(gs,gc)=>{xf(gs,{get change(){return I(gc)},get view(){return i()},get manager(){return r().gitManager}})});var ra=ne(ta,2);fo(ra,{get files(){return I(s).staged}}),fe(vr,Li)};Fe(wo,vr=>{I(S)?vr(ms):vr(bo,-1)})}V(Rr),sn(3,Rr,()=>Nn,()=>({duration:150})),fe(gr,Rr)};Fe(gF,gr=>{I(h)&&gr(vF)})}V(Re);var Sf=ne(Re,2);let hb;var kf=W(Sf),pb=W(kf);let mb;var gb=ne(pb,4),qp=W(gb),vb=W(qp),wb=ne(vb,2);ot(wb,gr=>l[9]=gr,()=>l==null?void 0:l[9]),V(qp);var bb=ne(qp,2),wF=W(bb,!0);V(bb),V(gb),V(kf);var bF=ne(kf,2);{var _F=gr=>{var Rr=ib(),wo=W(Rr);{var ms=vr=>{ho(vr,{get hierarchy(){return I(c)},get plugin(){return r()},get view(){return i()},get fileType(){return 1},topLevel:!0,get closed(){return I(y)},set closed(Li){oe(y,Li,!0)}})},bo=vr=>{var Li=rb(),ta=Mi(Li);hi(ta,17,()=>vu(I(s).changed,500),di,(gs,gc)=>{_f(gs,{get change(){return I(gc)},get view(){return i()},get manager(){return r().gitManager}})});var ra=ne(ta,2);fo(ra,{get files(){return I(s).changed}}),fe(vr,Li)};Fe(wo,vr=>{I(S)?vr(ms):vr(bo,-1)})}V(Rr),sn(3,Rr,()=>Nn,()=>({duration:150})),fe(gr,Rr)};Fe(bF,gr=>{I(d)&&gr(_F)})}V(Sf);var yF=ne(Sf,2);{var xF=gr=>{var Rr=uG();let wo;var ms=W(Rr),bo=ne(W(ms),4),vr=W(bo,!0);V(bo),V(ms);var Li=ne(ms,2);{var ta=ra=>{var gs=ib(),gc=W(gs);{var EF=_o=>{ho(_o,{get hierarchy(){return I(f)},get plugin(){return r()},get view(){return i()},get fileType(){return 2},topLevel:!0,get closed(){return I(b)},set closed(Af){oe(b,Af,!0)}})},SF=_o=>{var Af=rb(),_b=Mi(Af);hi(_b,17,()=>I(a),di,(AF,CF)=>{yf(AF,{get change(){return I(CF)},get view(){return i()}})});var kF=ne(_b,2);fo(kF,{get files(){return I(a)}}),fe(_o,Af)};Fe(gc,_o=>{I(S)?_o(EF):_o(SF,-1)})}V(gs),sn(3,gs,()=>Nn,()=>({duration:150})),fe(ra,gs)};Fe(Li,ra=>{I(p)&&ra(ta)})}V(Rr),Ue(()=>{wo=wt(Rr,1,"pulled nav-folder",null,wo,{"is-collapsed":!I(p)}),ze(vr,I(a).length)}),we("click",ms,()=>oe(p,!I(p))),fe(gr,Rr)};Fe(yF,gr=>{I(a).length>0&&I(f)&&gr(xF)})}V(ue),Ue(()=>{Ut=wt(Re,1,"staged tree-item nav-folder",null,Ut,{"is-collapsed":!I(h)}),cb=wt(vo,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,cb,{"is-collapsed":!I(h)}),ze(mF,I(s).staged.length),hb=wt(Sf,1,"changes tree-item nav-folder",null,hb,{"is-collapsed":!I(d)}),mb=wt(pb,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,mb,{"is-collapsed":!I(d)}),ze(wF,I(s).changed.length)}),we("click",Pr,()=>oe(h,!I(h))),we("click",fb,_),we("click",kf,()=>oe(d,!I(d))),we("click",vb,M),we("click",wb,x),fe(N,ue)};Fe(re,N=>{I(s)&&I(u)&&I(c)&&N(B)})}V(Xe),V(D),Ue(()=>{ke(D,"data-type",Qt.type),ke(G,"data-icon",I(S)?"list":"folder"),Et=wt(Me,1,"clickable-icon nav-action-button",null,Et,{loading:I(n)}),ke(De,"rows",I($))}),we("click",de,A),we("click",J,C),we("click",X,x),we("click",he,_),we("click",z,P),we("click",K,T),we("click",G,()=>{oe(S,!I(S)),(0,po.setIcon)(l[6],I(S)?"list":"folder"),r().settings.treeStructure=I(S),r().saveSettings()}),we("click",Me,v),W0(De,()=>I(o),N=>oe(o,N)),fe(t,D),ut()}Pt(["click"]);var Ef=class extends aF.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Qt.type}getDisplayText(){return Qt.name}getIcon(){return Qt.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=Js(nb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var Mp=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(i=>{this.plugin.switchBranch().catch(n=>r.displayError(n))})}async display(){if(this.plugin.gitReady){let e=await this.plugin.gitManager.branchInfo();e.current!=null?this.statusBarEl.setText(e.current):this.statusBarEl.empty()}else this.statusBarEl.empty()}remove(){this.statusBarEl.remove()}};m();var oF=require("obsidian");var Dp=class{constructor(e){this.plugin=e}get editor(){var i;let e=(i=this.plugin.app.workspace.activeEditor)==null?void 0:i.editor,r=e==null?void 0:e.cm;if(!(!e||!zi.hasHunksData(r.state)))return{editor:r,obEditor:e}}get gitManager(){return this.plugin.gitManager}resetHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=zi.getHunk(r.state,!1,e);if(n){let s,a;n.type==="delete"?(s=n.added.start+1,a=n.added.start+1):(s=n.added.start-0,a=n.added.start-1+n.added.count);let o=r.state.doc.line(s).from,l=n.type==="delete"?r.state.doc.line(a).from:r.state.doc.line(a).to+1,c=n.removed.lines.join(` +`);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=zi.getHunk(r.state,!1,e),n=!1;if(i||(i=zi.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(oF.editorInfoField).file.path,a=Wt.createPatch(s,[i],"100644",n).join(` +`)+` +`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=zi.getHunks(r.state,!1),s=i.getCursor().line+1,a=Wt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var mo=require("obsidian");var Op=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof mo.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),A2(()=>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;O2(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new gh(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&mo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Ce?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(Y2),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(),$2(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;(r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error)})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof mo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof mo.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",M2)}};m();var mc=require("obsidian");m();m();var go=require("@codemirror/state"),Np=require("@codemirror/view");var Lp=class extends Np.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}},sb=go.StateField.define({create:()=>go.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Ur,!1);if(!r)return go.RangeSet.empty;let i=e.effects.some(s=>s.is(Ou)),n=e.effects.some(s=>s.is($l));if(i||n||(e.docChanged||t.size==0)&&r.isDirty==!1){let s=new Set,a=lF(e,r.hunks,!1,s),o=lF(e,r.stagedHunks,!0,s);return t=go.RangeSet.of([...a,...o],!0),t}else e.docChanged&&(t=t.map(e.changes));return t}});function lF(t,e,r,i){let n=[];for(let a=0;a0?e[a-1]:void 0,l=a{var e;return(e=t.state.field(sb,!1))!=null?e:go.RangeSet.empty},initialSpacer:t=>new Lp("delete",!1),domEventHandlers:{click:(t,e,r)=>{var n;return((n=zi.getHunkAtPos(t.state,e.from,!1))!=null?n:zi.getHunkAtPos(t.state,e.from,!0))&&(Vs(t,e.from),r.preventDefault()),!1}}});var Bp=class{constructor(e){this.plugin=e}async trackChanged(e){return this.trackChangedHelper(e).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeSigns(e.path)}}destroy(){}async computeSigns(e){let i=await this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager.show("",e).catch(()=>{});this.notifySignComputationResultToSubscribers(e,{compareText:i,compareTextHead:void 0})}notifySignComputationResultToSubscribers(e,r){Kn.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyGitCompare(r)))}},uF=[uR,fR,cF,sb,Gh],fF=[Ur,Cw];m();var ab=require("obsidian"),Hp=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;e.addClass("git-changes-status-bar"),r.settings.hunks.statusBar==="colored"&&e.addClass("git-changes-status-bar-colored"),e.setAttr("aria-label","Git diff of the current editor"),this.statusBarEl.setAttribute("data-tooltip-position","top"),r.app.workspace.on("active-leaf-change",i=>{(!i||i.getRoot()==r.app.workspace.rootSplit&&!(i.view instanceof ab.MarkdownView))&&this.statusBarEl.empty()})}display(e,r){var o;let i=this.plugin.app.workspace.getActiveViewOfType(ab.MarkdownView);if(!i||((o=i.file)==null?void 0:o.path)!==(r==null?void 0:r.path))return;let n=0,s=0,a=0;for(let l of e)n+=Math.max(0,l.added.count-l.removed.count),s+=Math.min(l.added.count,l.removed.count),a+=Math.max(0,l.removed.count-l.added.count);this.statusBarEl.empty(),n>0&&this.statusBarEl.createSpan({text:`+${n} `,cls:"git-add"}),s>0&&this.statusBarEl.createSpan({text:`~${s} `,cls:"git-change"}),a>0&&this.statusBarEl.createSpan({text:`-${a}`,cls:"git-delete"})}remove(){this.statusBarEl.remove()}};var Up=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.signsProvider){console.warn("Git: undefined signsProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof mc.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.signsProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions)}conditionallyActivateBySettings(){(this.plg.settings.hunks.showSigns||this.plg.settings.hunks.statusBar!="disabled"||this.plg.settings.hunks.hunkCommands)&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;if(this.signsProvider=new Bp(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),this.plg.settings.hunks.statusBar!="disabled"){let e=this.plg.addStatusBarItem();this.changeStatusBar=new Hp(e,this.plg)}}catch(e){console.warn("Git: Error while loading signs feature.",e),this.deactivateFeature()}}deactivateFeature(){var e,r;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.signsProvider)==null||e.destroy(),this.signsProvider=void 0,(r=this.changeStatusBar)==null||r.remove(),this.changeStatusBar=void 0}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&mc.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Ce?this.plg.gitManager:void 0}}refresh(){this.plg.settings.hunks.showSigns&&this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(fF),this.plg.settings.hunks.showSigns&&this.codeMirrorExtensions.push(...uF),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.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileRenameEvent=this.createFileRenameEvent(),this.pluginRefreshedEvent=this.createPluginRefreshedEvent(),this.intervalRefreshEvent=this.createIntervalRefreshEvent(),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileRenameEvent),this.plg.registerEvent(this.pluginRefreshedEvent),this.plg.registerInterval(this.intervalRefreshEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent),this.plg.app.workspace.offref(this.pluginRefreshedEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent),window.clearInterval(this.intervalRefreshEvent)}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 Kn.ifFilepathDefinedTransformSubscribers(r,n=>n.forEach(s=>{s.changeToNewFilepath(e.path)})),e instanceof mc.TFile&&((i=this.signsProvider)==null?void 0:i.trackChanged(e))})}createPluginRefreshedEvent(){return this.plg.app.workspace.on("obsidian-git:refresh",()=>{this.refresh()})}createIntervalRefreshEvent(){return window.setInterval(()=>{var e,r;(e=this.plg.app.workspace.activeEditor)!=null&&e.file&&((r=this.signsProvider)==null||r.trackChanged(this.plg.app.workspace.activeEditor.file).catch(console.error))},10*1e3)}};m();var dF=require("@codemirror/state"),Gp=require("obsidian");var ob=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let i=this.view.state,n=k2(e,r,i);this.view.dispatch(n)}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 r=this.view.state,i=r.field(Ur);if(!i||i.compareText!=e.compareText||i.compareTextHead!=e.compareTextHead){let n=HP(e,r);this.view.dispatch(n)}}updateToNewState(e){return this.state=e,!this.lastSeenPath&&this.filepath&&this.subscribeMe(),this}removeIfStale(){var e;return((e=this.view)==null?void 0:e.state.field(lb,!1))!=this||this.view.destroyed?(this.unsubscribeMe(this.lastSeenPath),!0):!1}changeToNewFilepath(e){this.unsubscribeMe(this.lastSeenPath),this.subscribeMe(e)}subscribeMe(e){e!=null||(e=this.filepath),e!==void 0&&(Kn.ifFilepathDefinedTransformSubscribers(e,r=>r.add(this)),this.lastSeenPath=e)}unsubscribeMe(e){Kn.ifFilepathDefinedTransformSubscribers(e,r=>r.delete(this))}get filepath(){var e,r;return(r=(e=this.state.field(Gp.editorInfoField))==null?void 0:e.file)==null?void 0:r.path}get view(){return this.state.field(Gp.editorEditorField)}},lb=dF.StateField.define({create:t=>new ob(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});var jp=class{constructor(e){this.plg=e;this.lineAuthoringFeature=new Op(this.plg);this.signsFeature=new Up(this.plg)}onUnloadPlugin(){this.lineAuthoringFeature.deactivateFeature(),this.signsFeature.deactivateFeature()}onLoadPlugin(){this.plg.registerEditorExtension(lb),this.lineAuthoringFeature.onLoadPlugin(),this.signsFeature.onLoadPlugin()}onReady(){this.lineAuthoringFeature.conditionallyActivateBySettings(),this.signsFeature.conditionallyActivateBySettings()}activateLineAuthoring(){this.lineAuthoringFeature.activateFeature()}deactiveLineAuthoring(){this.lineAuthoringFeature.deactivateFeature()}refreshSignsSettings(){let e=this.plg.settings.hunks;e.showSigns||e.statusBar!="disabled"||e.hunkCommands?(this.signsFeature.deactivateFeature(),this.signsFeature.activateFeature()):this.signsFeature.deactivateFeature()}};var Vp=class extends Se.Plugin{constructor(){super(...arguments);this.automaticsManager=new $u(this);this.tools=new Vu(this);this.localStorage=new jh(this);this.state={gitAction:0,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new Cd(this);this.intervalsToClear=[];this.editorIntegration=new jp(this);this.hunkActions=new Dp(this)}setPluginState(r){var i;this.state=Object.assign(this.state,r),(i=this.statusBar)==null||i.display()}async updateCachedStatus(){var r,i;return this.app.workspace.trigger("obsidian-git:loading-status"),this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((r=this.branchBar)==null?void 0:r.display())):(this.localStorage.setConflict(!1),await((i=this.branchBar)==null?void 0:i.display())),this.app.workspace.trigger("obsidian-git:status-changed",this.cachedStatus),this.cachedStatus}async refresh(){if(!this.gitReady)return;let r=this.app.workspace.getLeavesOfType(Qt.type),i=this.app.workspace.getLeavesOfType(bi.type);(this.settings.changedFilesInStatusBar||r.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)})||i.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)}))&&await this.updateCachedStatus().catch(n=>this.displayError(n)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),zt.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new vh(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(r=>this.displayError(r))))}onExternalSettingsChange(){this.reloadSettings().catch(r=>this.displayError(r))}async reloadSettings(){let r=JSON.stringify(this.settings);await this.loadSettings();let i=JSON.stringify(this.settings);r!==i&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(Qt.type).forEach(n=>{var s;if(!((s=n.isDeferred)!=null&&s))return n.view.reload()}),this.app.workspace.getLeavesOfType(bi.type).forEach(n=>{var s;if(!((s=n.isDeferred)!=null&&s))return n.view.reload()}))}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(r=>this.displayError(r))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"obsidian-git:menu")})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{this.onActiveLeafChange(r)})),this.registerEvent(this.app.vault.on("modify",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerView(Qt.type,r=>new Ef(r,this)),this.registerView(bi.type,r=>new wf(r,this)),this.registerView(Ds.type,r=>new Ha(r,this)),this.registerView(Ms.type,r=>new Ua(r,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var n;let r=this.app.workspace.getLeavesOfType(Qt.type),i;r.length===0?(i=(n=this.app.workspace.getRightLeaf(!1))!=null?n:this.app.workspace.getLeaf(),await i.setViewState({type:Qt.type})):i=r.first(),await this.app.workspace.revealLeaf(i)}),this.registerHoverLinkSource(Qt.type,{display:"Git View",defaultMod:!0}),this.editorIntegration.onLoadPlugin(),this.setRefreshDebouncer(),dR(this)}setRefreshDebouncer(){var r;(r=this.debRefresh)==null||r.cancel(),this.debRefresh=(0,Se.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(r,i){let n=this.gitManager.getRelativeRepoPath(r,!0),s=mA({isFolder:i,gitRelativePath:n});await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+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 Se.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 Se.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 Se.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 Se.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof Se.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(pF.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=Uk(pt,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return Se.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new wh(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 Ce(this),await this.gitManager.setGitInstance()):this.gitManager=new Vi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new Se.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),Se.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new Mp(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 Se.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+n)}}catch(n){this.displayError(n),console.error(n)}}async createNewRepo(){try{await this.gitManager.init(),new Se.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new tt(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new tt(this,{options:this.gitManager instanceof Vi?[n]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof Vi}).openAndGetResult();if(s==null)return;if(s===n&&(s="."),s=(0,Se.normalizePath)(s),s==="/"&&(s="."),s==="."){let f=await new tt(this,{options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.app.vault.configDir} directory at the root?`,onlySelection:!0}).openAndGetResult();if(f===void 0){new Se.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new tt(this,{options:["Abort clone",d],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===d)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new Se.Notice("Aborted clone");return}}}let a=await new tt(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(a===void 0){new Se.Notice("Aborted clone");return}if(a!==""&&(o=parseInt(a),isNaN(o))){new Se.Notice("Invalid depth. Aborting clone.");return}new Se.Notice(`Cloning new repo into "${s}"`);let l=this.settings.basePath,c=s&&s!==".";c&&(this.settings.basePath=s);try{await this.gitManager.clone(av(i),s,o),new Se.Notice("Cloned new repo."),new Se.Notice("Please restart Obsidian"),c&&await this.saveSettings()}catch(u){this.displayError(u),this.settings.basePath=l,await this.saveSettings()}}}async isAllInitialized(){return this.gitReady||await this.init({fromReload:!0}),this.gitReady}async pullChangesFromRemote(){if(!await this.isAllInitialized())return;let r=await this.pull();if(r!==!1){if(r||this.displayMessage("Pull: Everything is up-to-date"),this.gitManager instanceof Ce){let i=await this.updateCachedStatus();i.conflicted.length>0&&(this.displayError(`You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync({fromAutoBackup:r,requestCustomMessage:i=!1,commitMessage:n,onlyStaged:s=!1}){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:r,requestCustomMessage:i,commitMessage:n,onlyStaged:s}))||(this.settings.syncMethod!="reset"&&this.settings.pullBeforePush&&await this.pull(),this.settings.disablePush||(await this.remotesAreSet()&&await this.gitManager.canPush()?await this.push():this.displayMessage("No commits to push")),this.setPluginState({gitAction:0}))}async commit({fromAuto:r,requestCustomMessage:i=!1,onlyStaged:n=!1,commitMessage:s,amend:a=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,c=[],u=[];if(this.gitManager instanceof Ce){if(await this.mayDeleteConflictFile(),l=await this.updateCachedStatus(),l.conflicted.length==0&&(o=!1),r&&l.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${l.conflicted.length} ${l.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(l.conflicted),!1;c=l.staged,u=l.changed}else{if(r&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;{o&&await this.mayDeleteConflictFile();let f=this.gitManager;n?c=await f.getStagedFiles():u=(await f.getUnstagedFiles()).map(({path:h,type:p})=>({vaultPath:this.gitManager.getRelativeVaultPath(h),path:h,type:p}))}}if(await this.tools.hasTooBigFiles(n?c:[...c,...u]))return this.setPluginState({gitAction:0}),!1;if(u.length+c.length!==0||o){let f=s!=null?s:s=r?this.settings.autoCommitMessage:this.settings.commitMessage;if(r&&this.settings.customMessageOnAutoBackup||i){!this.settings.disablePopups&&r&&new Se.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let p=await new bh(this).openAndGetResult();if(p!=null&&p!=""&&p!="...")f=p;else return this.setPluginState({gitAction:0}),!1}else if(this.gitManager instanceof Ce&&this.settings.commitMessageScript){let p=this.settings.commitMessageScript,g=this.localStorage.getHostname()||"",w=p.replace("{{hostname}}",g);w=w.replace("{{date}}",(0,Se.moment)().format(this.settings.commitDateFormat));let y="sh";if(Se.Platform.isWin){y=process.env.PROGRAMFILES+"\\Git\\bin\\sh.exe";let S=!1;try{await zp.access(y,zp.constants.X_OK),S=!0}catch(C){S=!1}if(!S)return this.displayError(`Cannot find sh.exe at ${y}. Please make sure Git is properly installed.`),!1}let b=await wu(y,["-c",w],{cwd:this.gitManager.absoluteRepoPath});b.code!=0?this.displayError(b.stderr):b.stdout.trim().length==0?this.displayMessage("Stdout from commit message script is empty. Using default message."):f=b.stdout}if(!f||f.trim()==="")return new Se.Notice("Commit aborted: No commit message provided"),this.setPluginState({gitAction:0}),!1;let d;n?d=await this.gitManager.commit({message:f,amend:a}):d=await this.gitManager.commitAll({message:f,status:l,unstagedFiles:u,amend:a}),this.gitManager instanceof Ce&&await this.updateCachedStatus();let h=!1;d===void 0&&(h=!0,d=u.length+c.length||0),this.displayMessage(`Committed${h?" approx.":""} ${d} ${d==1?"file":"files"}`)}else this.displayMessage("No changes to commit");return this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(o){return this.displayError(o),!1}}async push(){if(!await this.isAllInitialized()||!await this.remotesAreSet())return!1;let r=this.localStorage.getConflict();try{this.gitManager instanceof Ce&&await this.mayDeleteConflictFile();let i;if(this.gitManager instanceof Ce&&(i=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted),!1;if(this.gitManager instanceof Vi&&r)return this.displayError("Cannot push. You have conflicts"),!1;this.log("Pushing....");let n=await this.gitManager.push();return n!==void 0&&(n===null?this.displayMessage("Pushed to remote"):n>0?this.displayMessage(`Pushed ${n} ${n==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(i){return i instanceof nl?this.handleNoNetworkError(i):this.displayError(i),!1}}async pull(){if(!await this.remotesAreSet())return!1;try{this.log("Pulling....");let r=await this.gitManager.pull()||[];return this.setPluginState({offlineMode:!1}),r.length>0&&(this.displayMessage(`Pulled ${r.length} ${r.length==1?"file":"files"} from remote`),this.lastPulledFiles=r),r.length}catch(r){return this.displayError(r),!1}}async fetch(){if(await this.remotesAreSet())try{await this.gitManager.fetch(),this.displayMessage("Fetched from remote"),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh")}catch(r){this.displayError(r)}}async mayDeleteConflictFile(){let r=this.app.vault.getAbstractFileByPath(il);r&&(this.app.workspace.iterateAllLeaves(i=>{var n;i.view instanceof Se.MarkdownView&&((n=i.view.file)==null?void 0:n.path)==r.path&&i.detach()}),await this.app.vault.delete(r))}async stageFile(r){return await this.isAllInitialized()?(await this.gitManager.stage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async unstageFile(r){return await this.isAllInitialized()?(await this.gitManager.unstage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async switchBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo(),i=await new Fp(this,r.branches).openAndGetReslt();if(i!=null)return await this.gitManager.checkout(i),this.displayMessage(`Switched to ${i}`),this.app.workspace.trigger("obsidian-git:refresh"),await((n=this.branchBar)==null?void 0:n.display()),i}async switchRemoteBranch(){var s;if(!await this.isAllInitialized())return;let r=await this.selectRemoteBranch()||"",[i,n]=Yn(r);if(n!=null&&i!=null)return await this.gitManager.checkout(n,i),this.displayMessage(`Switched to ${r}`),await((s=this.branchBar)==null?void 0:s.display()),r}async createBranch(){var i;if(!await this.isAllInitialized())return;let r=await new tt(this,{placeholder:"Create new branch"}).openAndGetResult();if(r!=null)return await this.gitManager.createBranch(r),this.displayMessage(`Created new branch ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}async deleteBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo();r.current&&r.branches.remove(r.current);let i=await new tt(this,{options:r.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(i!=null){let s=!1;if(!await this.gitManager.branchIsMerged(i)){let o=await new tt(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;s=o==="YES"}return await this.gitManager.deleteBranch(i,s),this.displayMessage(`Deleted branch ${i}`),await((n=this.branchBar)==null?void 0:n.display()),i}}async remotesAreSet(){return this.settings.updateSubmodules||this.gitManager instanceof Ce&&await this.gitManager.getConfig("push.autoSetupRemote","all")=="true"||(await this.gitManager.branchInfo()).tracking?!0:(new Se.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let r=await this.selectRemoteBranch();return r==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setPluginState({gitAction:0}),!1):(await this.gitManager.updateUpstreamBranch(r),this.displayMessage(`Set upstream branch to ${r}`),this.setPluginState({gitAction:0}),!0)}async discardAll(r){if(!await this.isAllInitialized())return!1;let i=await this.gitManager.status({path:r}),n=0,s=0;for(let o of i.changed)o.workingDir=="U"?n++:s++;if(n+s==0)return!1;let a=await new pc({app:this.app,filesToDeleteCount:n,filesToDiscardCount:s,path:r!=null?r:""}).openAndGetResult();switch(a){case!1:return a;case"discard":await this.gitManager.discardAll({dir:r,status:this.cachedStatus});break;case"delete":{await this.gitManager.discardAll({dir:r,status:this.cachedStatus});let o=await this.gitManager.getUntrackedPaths({path:r,status:this.cachedStatus});for(let l of o){let c=this.gitManager.getRelativeVaultPath(l),u=this.app.vault.getAbstractFileByPath(c);u?await this.app.fileManager.trashFile(u):l.endsWith("/")?await this.app.vault.adapter.rmdir(c,!0):await this.app.vault.adapter.remove(c)}break}default:Md(a)}return this.app.workspace.trigger("obsidian-git:refresh"),a}async handleConflict(r){this.localStorage.setConflict(!0);let i;r!==void 0&&(i=["# Conflicts","Please resolve them and commit them using the commands `Git: Commit all changes` followed by `Git: Push`","(This file will automatically be deleted before commit)","[[#Additional Instructions]] available below file list","",...r.map(n=>{let s=this.app.vault.getAbstractFileByPath(n);return s instanceof Se.TFile?`- [[${this.app.metadataCache.fileToLinktext(s,"/")}]]`:`- Not a file: ${n}`}),` +# 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 tt(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 tt(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,av(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 tt(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 tt(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 tt(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 Ha||i instanceof Ua))return;let n=this.app.workspace.getLeavesOfType(Qt.type).first(),s=this.app.workspace.getLeavesOfType(bi.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof Ha||(r==null?void 0:r.view)instanceof Ua){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new Se.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof hF.Errors.UserCanceledError){new Se.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new Se.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}}; +/*! Bundled license information: + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + +buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) + +safe-buffer/index.js: + (*! safe-buffer. MIT License. Feross Aboukhadijeh *) + +crc-32/crc32.js: + (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) + +isomorphic-git/index.cjs: + (*! + * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements. + * SPDX-License-Identifier: LGPL-3.0-or-later + * Copyright (c) James Prevett and other ZenFS contributors. + *) + +js-sha256/src/sha256.js: + (** + * [js-sha256]{@link https://github.com/emn178/js-sha256} + * + * @version 0.11.1 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2025 + * @license MIT + *) +*/ + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json new file mode 100644 index 0000000..2e8f9b0 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -0,0 +1,10 @@ +{ + "author": "Vinzent", + "authorUrl": "https://github.com/Vinzent03", + "id": "obsidian-git", + "name": "Git", + "description": "Integrate Git version control with automatic backup and other advanced features.", + "isDesktopOnly": false, + "fundingUrl": "https://ko-fi.com/vinzent", + "version": "2.38.6" +} diff --git a/.obsidian/plugins/obsidian-git/obsidian_askpass.sh b/.obsidian/plugins/obsidian-git/obsidian_askpass.sh new file mode 100644 index 0000000..2e5eb5d --- /dev/null +++ b/.obsidian/plugins/obsidian-git/obsidian_askpass.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +PROMPT="$1" +TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT" + +cleanup() { + rm -f "$TEMP_FILE" "$TEMP_FILE.response" +} +trap cleanup EXIT + +echo "$PROMPT" > "$TEMP_FILE" + +while [ ! -e "$TEMP_FILE.response" ]; do + if [ ! -e "$TEMP_FILE" ]; then + echo "Trigger file got removed: Abort" >&2 + exit 1 + fi + sleep 0.1 +done + +RESPONSE=$(cat "$TEMP_FILE.response") + +echo "$RESPONSE" diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css new file mode 100644 index 0000000..7dee885 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -0,0 +1,705 @@ +@keyframes loading { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +.workspace-leaf-content[data-type="git-view"] .button-border { + border: 2px solid var(--interactive-accent); + border-radius: var(--radius-s); +} + +.workspace-leaf-content[data-type="git-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.workspace-leaf-content[data-type="git-history-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.loading { + overflow: hidden; +} + +.loading > svg { + animation: 2s linear infinite loading; + transform-origin: 50% 50%; + display: inline-block; +} + +.obsidian-git-center { + margin: auto; + text-align: center; + width: 50%; +} + +.obsidian-git-textarea { + display: block; + margin-left: auto; + margin-right: auto; +} + +.obsidian-git-disabled { + opacity: 0.5; +} + +.obsidian-git-center-button { + display: block; + margin: 20px auto; +} + +.tooltip.mod-left { + overflow-wrap: break-word; +} + +.tooltip.mod-right { + overflow-wrap: break-word; +} + +/* Limits the scrollbar to the view body */ +.git-view { + display: flex; + flex-direction: column; + position: relative; + height: 100%; +} + +/* Re-enable wrapping of nav buttns to prevent overflow on smaller screens #*/ +.workspace-drawer .git-view .nav-buttons-container { + flex-wrap: wrap; +} + +.git-tools { + display: flex; + margin-left: auto; +} +.git-tools .type { + padding-left: var(--size-2-1); + display: flex; + align-items: center; + justify-content: center; + width: 11px; +} + +.git-tools .type[data-type="M"] { + color: orange; +} +.git-tools .type[data-type="D"] { + color: red; +} +.git-tools .buttons { + display: flex; +} +.git-tools .buttons > * { + padding: 0; + height: auto; +} + +.workspace-leaf-content[data-type="git-view"] .tree-item-self, +.workspace-leaf-content[data-type="git-history-view"] .tree-item-self { + align-items: center; +} + +.workspace-leaf-content[data-type="git-view"] + .tree-item-self:hover + .clickable-icon, +.workspace-leaf-content[data-type="git-history-view"] + .tree-item-self:hover + .clickable-icon { + color: var(--icon-color-hover); +} + +/* Highlight an item as active if it's diff is currently opened */ +.is-active .git-tools .buttons > * { + color: var(--nav-item-color-active); +} + +.git-author { + color: var(--text-accent); +} + +.git-date { + color: var(--text-accent); +} + +.git-ref { + color: var(--text-accent); +} + +/* ====== 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 +which itself is adapted from the diff2html library with the following original license: + + https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md + + Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +.theme-dark, +.theme-light { + --git-delete-bg: #ff475040; + --git-delete-hl: #96050a75; + --git-insert-bg: #68d36840; + --git-insert-hl: #23c02350; + --git-change-bg: #ffd55840; + --git-selected: #3572b0; + + --git-delete: #cc3333; + --git-insert: #399839; + --git-change: #d0b44c; + --git-move: #3572b0; +} + +.git-diff { + .d2h-d-none { + display: none; + } + .d2h-wrapper { + text-align: left; + border-radius: 0.25em; + overflow: auto; + } + .d2h-file-header.d2h-file-header { + background-color: var(--background-secondary); + border-bottom: 1px solid var(--background-modifier-border); + font-family: + Source Sans Pro, + Helvetica Neue, + Helvetica, + Arial, + sans-serif; + height: 35px; + padding: 5px 10px; + } + .d2h-file-header, + .d2h-file-stats { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + } + .d2h-file-header { + display: none; + } + .d2h-file-stats { + font-size: 14px; + margin-left: auto; + } + .d2h-lines-added { + border: 1px solid var(--color-green); + border-radius: 5px 0 0 5px; + color: var(--color-green); + padding: 2px; + text-align: right; + vertical-align: middle; + } + .d2h-lines-deleted { + border: 1px solid var(--color-red); + border-radius: 0 5px 5px 0; + color: var(--color-red); + margin-left: 1px; + padding: 2px; + text-align: left; + vertical-align: middle; + } + .d2h-file-name-wrapper { + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 15px; + width: 100%; + } + .d2h-file-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--text-normal); + font-size: var(--h5-size); + } + .d2h-file-wrapper { + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + margin-bottom: 1em; + max-height: 100%; + } + .d2h-file-collapse { + -webkit-box-pack: end; + -ms-flex-pack: end; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + cursor: pointer; + display: none; + font-size: 12px; + justify-content: flex-end; + padding: 4px 8px; + } + .d2h-file-collapse.d2h-selected { + background-color: var(--git-selected); + } + .d2h-file-collapse-input { + margin: 0 4px 0 0; + } + .d2h-diff-table { + border-collapse: collapse; + font-family: var(--font-monospace); + font-size: var(--code-size); + width: 100%; + } + .d2h-files-diff { + width: 100%; + } + .d2h-file-diff { + /* + overflow-y: scroll; + */ + border-radius: 5px; + font-size: var(--font-text-size); + line-height: var(--line-height-normal); + } + .d2h-file-side-diff { + display: inline-block; + margin-bottom: -8px; + margin-right: -4px; + overflow-x: scroll; + overflow-y: hidden; + width: 50%; + } + .d2h-code-line { + padding-left: 6em; + padding-right: 1.5em; + } + .d2h-code-line, + .d2h-code-side-line { + display: inline-block; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + white-space: nowrap; + width: 100%; + } + .d2h-code-side-line { + /* needed to be changed */ + padding-left: 0.5em; + padding-right: 0.5em; + } + .d2h-code-line-ctn { + word-wrap: normal; + background: none; + display: inline-block; + padding: 0; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + vertical-align: middle; + width: 100%; + /* only works for line-by-line */ + white-space: pre-wrap; + } + .d2h-code-line del, + .d2h-code-side-line del { + background-color: var(--git-delete-hl); + color: var(--text-normal); + } + .d2h-code-line del, + .d2h-code-line ins, + .d2h-code-side-line del, + .d2h-code-side-line ins { + border-radius: 0.2em; + display: inline-block; + margin-top: -1px; + text-decoration: none; + vertical-align: middle; + } + .d2h-code-line ins, + .d2h-code-side-line ins { + background-color: var(--git-insert-hl); + text-align: left; + } + .d2h-code-line-prefix { + word-wrap: normal; + background: none; + display: inline; + padding: 0; + white-space: pre; + } + .line-num1 { + float: left; + } + .line-num1, + .line-num2 { + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + /* + padding: 0 0.5em; + */ + text-overflow: ellipsis; + width: 2.5em; + padding-left: 0; + } + .line-num2 { + float: right; + } + .d2h-code-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + display: inline-block; + position: absolute; + text-align: right; + width: 5.5em; + } + .d2h-code-linenumber:after { + content: "\200b"; + } + .d2h-code-side-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + overflow: hidden; + padding: 0 0.5em; + text-align: right; + text-overflow: ellipsis; + width: 4em; + /* needed to be changed */ + display: table-cell; + position: relative; + } + .d2h-code-side-linenumber:after { + content: "\200b"; + } + .d2h-code-side-emptyplaceholder, + .d2h-emptyplaceholder { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + } + .d2h-code-line-prefix, + .d2h-code-linenumber, + .d2h-code-side-linenumber, + .d2h-emptyplaceholder { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + .d2h-code-linenumber, + .d2h-code-side-linenumber { + direction: rtl; + } + .d2h-del { + background-color: var(--git-delete-bg); + border-color: var(--git-delete-hl); + } + .d2h-ins { + background-color: var(--git-insert-bg); + border-color: var(--git-insert-hl); + } + .d2h-info { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + color: var(--text-faint); + } + .d2h-del, + .d2h-ins, + .d2h-file-diff .d2h-change { + color: var(--text-normal); + } + .d2h-file-diff .d2h-del.d2h-change { + background-color: var(--git-change-bg); + } + .d2h-file-diff .d2h-ins.d2h-change { + background-color: var(--git-insert-bg); + } + .d2h-file-list-wrapper { + a { + text-decoration: none; + cursor: default; + -webkit-user-drag: none; + } + + svg { + display: none; + } + } + .d2h-file-list-header { + text-align: left; + } + .d2h-file-list-title { + display: none; + } + .d2h-file-list-line { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + text-align: left; + } + .d2h-file-list { + } + .d2h-file-list > li { + border-bottom: 1px solid var(--background-modifier-border); + margin: 0; + padding: 5px 10px; + } + .d2h-file-list > li:last-child { + border-bottom: none; + } + .d2h-file-switch { + cursor: pointer; + display: none; + font-size: 10px; + } + .d2h-icon { + fill: currentColor; + margin-right: 10px; + vertical-align: middle; + } + .d2h-deleted { + color: var(--git-delete); + } + .d2h-added { + color: var(--git-insert); + } + .d2h-changed { + color: var(--git-change); + } + .d2h-moved { + color: var(--git-move); + } + .d2h-tag { + background-color: var(--background-secondary); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 10px; + margin-left: 5px; + padding: 0 2px; + } + .d2h-deleted-tag { + border: 1px solid var(--git-delete); + } + .d2h-added-tag { + border: 1px solid var(--git-insert); + } + .d2h-changed-tag { + border: 1px solid var(--git-change); + } + .d2h-moved-tag { + border: 1px solid var(--git-move); + } + + /* needed for line-by-line*/ + + .d2h-diff-tbody { + position: relative; + } + + /* My additions */ + .cm-merge-revert { + width: 4em; + } + /* Ensure that merge revert markers are positioned correctly */ + .cm-merge-revert > * { + position: absolute; + background-color: var(--background-secondary); + display: flex; + } +} + +/* ====================== Line Authoring Information ====================== */ + +.cm-gutterElement.obs-git-blame-gutter { + /* Add background color to spacing inbetween and around the gutter for better aesthetics */ + border-width: 0px 2px 0.2px; + border-style: solid; + border-color: var(--background-secondary); + background-color: var(--background-secondary); +} + +.cm-gutterElement.obs-git-blame-gutter > div, +.line-author-settings-preview { + /* delegate text color to settings */ + color: var(--obs-git-gutter-text); + font-family: monospace; + height: 100%; /* ensure, that age-based background color occupies entire parent */ + text-align: right; + padding: 0px 6px; + white-space: pre; /* Keep spaces and do not collapse them. */ +} + +@media (max-width: 800px) { + /* hide git blame gutter not to superpose text */ + .cm-gutterElement.obs-git-blame-gutter { + display: none; + } +} + +.git-unified-diff-view, +.git-split-diff-view .cm-deletedLine .cm-changedText { + background-color: #ee443330; +} + +.git-unified-diff-view, +.git-split-diff-view .cm-insertedLine .cm-changedText { + background-color: #22bb2230; +} + +.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +/* Override styling of Codemirror merge view "collapsed lines" indicator */ +.git-split-diff-view .ͼ2 .cm-collapsedLines { + background: var(--interactive-normal); + border-radius: var(--radius-m); + color: var(--text-accent); + font-size: var(--font-small); + padding: var(--size-4-1) var(--size-4-1); +} +.git-split-diff-view .ͼ2 .cm-collapsedLines:hover { + background: var(--interactive-hover); + color: var(--text-accent-hover); +} + +.git-signs-gutter { + .cm-gutterElement { + display: grid; + + /* Needed to align the sign properly for different line heigts. Such as + * when having a heading or list item. + */ + padding-top: 0 !important; + } +} + +.git-gutter-marker:hover { + border-radius: 2px; +} + +.git-gutter-marker.git-add { + background-color: var(--color-green); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-change { + background-color: var(--color-yellow); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-changedelete { + color: var(--color-yellow); + font-weight: var(--font-bold); + font-size: 1rem; + justify-self: center; + height: inherit; +} + +.git-gutter-marker.git-delete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: end; +} + +.git-gutter-marker.git-topdelete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: start; +} + +div:hover > .git-gutter-marker.git-change { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-add { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-delete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-topdelete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-changedelete { + font-weight: var(--font-bold); +} + +.git-gutter-marker.staged { + opacity: 0.5; +} + +/* Prevent shifting of the editor when git signs gutter is the only gutter present */ +.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) { + margin-inline-end: 0; + .git-signs-gutter { + margin-inline-start: -1rem; + } +} + +.git-changes-status-bar-colored { + .git-add { + color: var(--color-green); + } + .git-change { + color: var(--color-yellow); + } + .git-delete { + color: var(--color-red); + } +} + +.git-changes-status-bar .git-add { + margin-right: 0.3em; +} + +.git-changes-status-bar .git-change { + margin-right: 0.3em; +} diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json new file mode 100644 index 0000000..1c65912 --- /dev/null +++ b/.obsidian/workspace.json @@ -0,0 +1,213 @@ +{ + "main": { + "id": "036dfde8704dd0ac", + "type": "split", + "children": [ + { + "id": "e0af171081a7af59", + "type": "tabs", + "children": [ + { + "id": "17cb9add59916996", + "type": "leaf", + "state": { + "type": "empty", + "state": {}, + "icon": "lucide-file", + "title": "New tab" + } + } + ] + } + ], + "direction": "vertical" + }, + "left": { + "id": "dad1395f7ed4460a", + "type": "split", + "children": [ + { + "id": "830c1b9f0bd9642f", + "type": "tabs", + "children": [ + { + "id": "25bb4c4c84eb0a9e", + "type": "leaf", + "state": { + "type": "file-explorer", + "state": { + "sortOrder": "alphabetical", + "autoReveal": false + }, + "icon": "lucide-folder-closed", + "title": "Files" + } + }, + { + "id": "dab155f931e456d9", + "type": "leaf", + "state": { + "type": "search", + "state": { + "query": "", + "matchingCase": false, + "explainSearch": false, + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical" + }, + "icon": "lucide-search", + "title": "Search" + } + }, + { + "id": "e745d06eb593c048", + "type": "leaf", + "state": { + "type": "bookmarks", + "state": {}, + "icon": "lucide-bookmark", + "title": "Bookmarks" + } + } + ] + } + ], + "direction": "horizontal", + "width": 300 + }, + "right": { + "id": "e86341c0d9a93f7c", + "type": "split", + "children": [ + { + "id": "32615812d6574c04", + "type": "tabs", + "children": [ + { + "id": "4671978dc90d27a9", + "type": "leaf", + "state": { + "type": "backlink", + "state": { + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-coming-in", + "title": "Backlinks" + } + }, + { + "id": "f11f4fca158f93fa", + "type": "leaf", + "state": { + "type": "outgoing-link", + "state": { + "linksCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-going-out", + "title": "Outgoing links" + } + }, + { + "id": "1438f618aa56a680", + "type": "leaf", + "state": { + "type": "tag", + "state": { + "sortOrder": "frequency", + "useHierarchy": true, + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-tags", + "title": "Tags" + } + }, + { + "id": "c43e2326ec3f4983", + "type": "leaf", + "state": { + "type": "all-properties", + "state": { + "sortOrder": "frequency", + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-archive", + "title": "All properties" + } + }, + { + "id": "62f5b64614c9f0e0", + "type": "leaf", + "state": { + "type": "outline", + "state": { + "followCursor": false, + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-list", + "title": "Outline" + } + } + ] + } + ], + "direction": "horizontal", + "width": 300, + "collapsed": true + }, + "left-ribbon": { + "hiddenItems": { + "switcher:Open quick switcher": false, + "graph:Open graph view": false, + "canvas:Create new canvas": false, + "daily-notes:Open today's daily note": false, + "templates:Insert template": false, + "command-palette:Open command palette": false, + "bases:Create new base": false, + "obsidian-livesync:P2P Status": false, + "obsidian-livesync:Replicate": false, + "obsidian-livesync:Show Log": false, + "obsidian-livesync:Show Customization sync": false + } + }, + "active": "17cb9add59916996", + "lastOpenFiles": [ + "sportnote-blueprint.md", + "flag_rebuild.md", + "flag_fetch.md", + "index.md", + "Runs/2026-06-07.md", + "koltsegvetes-julius-2026.md", + "Advisor/2026-07-21-performance-summary.md", + "Runs/2026-06-22.md", + "Runs/2026-06-15.md", + "Runs/2026-06-07-1k.md", + "Runs/2026-06-19.md", + "Runs/2026-06-13.md", + "Running Log.md", + "Advisor", + "System/Assistant/preferences.md", + "System/Assistant/environment.md", + "System/Assistant/context.md", + "Runs/2026-07-20.md", + "Runs/2026-07-15.md", + "Sleep/2026-07-03.md", + "Runs/2026-06-10.md", + "Sleep/2026-07-01.md", + "Sleep/2026-06-30.md", + "Sleep/2026-06-29.md", + "Runs/2026-07-01.md", + "Runs/2026-06-30.md", + "Runs/2026-06-29.md" + ] +} \ No newline at end of file diff --git a/Advisor/2026-07-21-performance-summary.md b/Advisor/2026-07-21-performance-summary.md new file mode 100644 index 0000000..4819b66 --- /dev/null +++ b/Advisor/2026-07-21-performance-summary.md @@ -0,0 +1,240 @@ +--- +date: 2026-07-20 +type: summary +tags: [advisor, consultation, performance-review] +--- + +# Running & Recovery Summary — June–July 2026 + +*For sport & health advisor consultation (last meeting: May 21, 2026)* + +--- + +## Quick overview + +**19 runs in ~6 weeks** (Jun 7 – Jul 20). Runner profile: 23yo male, 172cm, ~83.5-84.5kg, flat feet. Shoes: Kiprun Jogflow 190.1. Huawei Watch Fit 4 Pro for tracking. + +The first half (Jun 7–22) was sporadic, varied-distance runs. A ~1 week break followed, then a consistent morning-run streak started Jun 29 and has continued through today (13 runs in 3 weeks). + +--- + +## Performance trajectory + +### Early phase (Jun 7–22) — partial data only + +| Date | Distance | Time | Pace | Notes | +|------|----------|------|------|-------| +| Jun 7 | 4.90 km | 34:20 | 7'00" | Longest early run | +| Jun 7 | 1.00 km | 6:29 | 6'29" | Second run same day | +| Jun 10 | 4.01 km | 27:53 | 6'57" | VO₂Max 37 | +| Jun 13 | 3.00 km | 19:26 | 6'29" | | +| Jun 15 | 2.00 km | 12:05 | 6'03" | | +| Jun 19 | 2.00 km | 12:45 | 6'23" | | +| Jun 22 | 4.00 km | 28:40 | 7'10" | | + +### Consistent streak (Jun 29 – Jul 20) — full data + +| Date | Distance | Time | Pace | Avg HR | Max HR | Cadence | VO₂Max | Notes | +|------|----------|------|------|--------|--------|---------|--------|-------| +| Jun 29 | 2.03 km | 11:55 | 5'52" | — | — | 165 | — | First morning run ever | +| Jun 30 | 2.51 km | 16:24 | 6'32" | 153 | 170 | 165 | **39** | | +| Jul 1 | 3.04 km | 19:11 | 6'19" | 155 | 174 | 167 | **39** | | +| Jul 3 | 3.63 km | 23:49 | 6'34" | 152 | 166 | 168 | **40** ↑ | | +| Jul 5 | **5.30 km** | 34:29 | 6'30" | 155 | 169 | 167 | **40** | Distance PB | +| Jul 8 | 1.56 km | 8:24 | 5'23" | 159 | 173 | 167 | **40** | Rage-run (hungover) | +| Jul 10 | 2.50 km | 14:52 | 5'57" | 151 | 164 | 170 | **41** ↑ | | +| Jul 12 | 1.98 km | 13:13 | 6'41" | 144 | 155 | 165 | **41** | Beach recovery run | +| Jul 13 | 2.50 km | 14:40 | **5'52"** | 154 | 178 | 172 | **41** | 3'53" fastest pace PB | +| Jul 15 | 5.02 km | 35:55 | 7'09" | 155 | 178 | 156 | **41** | Stress + poor sleep | +| Jul 18 | 2.01 km | 12:20 | 6'08" | 147 | 158 | 172 | **42** ↑ | | +| Jul 20 | 3.01 km | **17:55** | **5'57"** | 158 | 170 | 171 | **42** | **3K PB** (had ~40s red light) | + +--- + +## Key metrics progression + +### VO₂Max (ml/kg/min) + +``` +37 (Jun 10) → 39 (Jun 30) → 40 (Jul 3) → 41 (Jul 10) → 42 (Jul 18) +``` + +**+5 points in ~5 weeks.** Watch rates it "Fair" throughout but the trajectory is clearly upward. + +### Pace at comparable distances + +- **~2 km:** 6'03" (Jun 15) → 6'23" (Jun 19) → 5'52" (Jun 29) → 6'41" (Jul 12, hungover) → 6'08" (Jul 18) — **trending faster when rested** +- **~3 km:** 6'29" (Jun 13) → 6'19" (Jul 1) → **5'57" (Jul 20, 3K PB)** — **−32s/km improvement** +- **~4 km:** 7'10" (Jun 22) → 6'57" (Jun 10) — limited data but trending faster +- **~5 km:** 7'00" (Jun 7) → 6'30" (Jul 5) → 7'09" (Jul 15, poor sleep) — **−30s/km when recovered** + +### Fastest instantaneous pace (full-data runs only) + +``` +5'45" (Jun 30) → 5'13" (Jul 1) → 6'08" (Jul 3) → 5'23" (Jul 5) +→ 3'58" (Jul 8, rage-run) → 4'46" (Jul 10) → 5'45" (Jul 12) +→ 3'53" (Jul 13, PB) → 6'01" (Jul 15) → 5'03" (Jul 18) → 3'58" (Jul 20) +``` + +**All-time best: 3'53"/km (Jul 13).** Hit 3'58" twice in controlled runs, not just rage-runs. + +### Max HR evolution (full-data runs only) + +``` +176 (Jun 10) → 170 (Jun 30) → 174 (Jul 1) → 166 (Jul 3) → 169 (Jul 5) +→ 173 (Jul 8) → 164 (Jul 10) → 155 (Jul 12) → 178 (Jul 13) → 178 (Jul 15) +→ 158 (Jul 18) → 170 (Jul 20) +``` + +Trend: harder to reach 178 now — requires real effort. Improving cardiovascular fitness. + +### Cadence (full-data runs only) + +``` +165 (Jun 29-30) → 167 (Jul 1) → 168 (Jul 3) → 167 (Jul 5/8) +→ 170 (Jul 10) → 165 (Jul 12) → 172 (Jul 13) → 156 (Jul 15, fatigue) +→ 172 (Jul 18) → 171 (Jul 20) +``` + +Generally 165-172 range. The 156 on Jul 15 was a fatigue outlier. When well-rested, cadence naturally settles at 170-172. + +--- + +## Recovery patterns + +### Sleep quality & HRV + +| Date (night) | Sleep | HRV | Rest HR | Score | Deep % | Context | +|-------------|-------|-----|---------|-------|--------|---------| +| Jun 29 | 6h31 | 130 | 47 | — | 22% | Pre-run excitement | +| Jun 30 | 7h48 | 112 | 54 | 85 | 23% | | +| Jul 1 | 7h24 | 77 | 58 | 88 | 38% | Had fröccs (wine spritzer) | +| Jul 3 | 7h28 | 113 | 50 | 86 | 31% | 2 drinks, missed dinner | +| Jul 5 | 8h11 | 135 | 49 | 89 | 29% | Best recovery night | +| Jul 8 | 6h42 | 71 | 58 | 82 | 25% | Heavy drinking | +| Jul 10 | 7h42 | 94 | 55 | 87 | 31% | 2 drinks | +| Jul 12 | 7h41 | 78 | 59 | 87 | 30% | Beach day, late home | +| Jul 13 | 6h47 | 121 | 51 | 86 | 25% | +1h snooze, racing thoughts | +| Jul 15 | 5h52 | 93 | 54 | 72 | 23% | Mental stress (no alcohol) | +| Jul 18 | 8h33 | 116 | 52 | 87 | 31% | Clean recovery | +| Jul 20 | 8h24 | 107 | 52 | 90 | **37%** | Weed (deep sleep boost) | + +### HRV patterns + +- **Sober baseline:** 110-135ms (Jun 29, Jul 3, Jul 5, Jul 13, Jul 18, Jul 20) +- **2 drinks:** ~94ms (Jul 10) +- **Heavy drinking:** 71ms (Jul 8) +- **Mental stress (no alcohol):** 93ms — same territory as 2 drinks +- **Late night / beach fatigue:** 77-78ms + +### Run performance vs HRV + +HRV below ~90ms consistently predicts poor run quality: +- Jul 1 (HRV 77): manageable but thigh pain +- Jul 8 (HRV 71): rage-ran, crashed at 1.5km +- Jul 12 (HRV 78): slowest pace, tired +- Jul 15 (HRV 93): 39s/km slower than same-HR 5K + +Above 100ms HRV = good-to-great runs almost every time. + +--- + +## Physical issues & patterns + +### Foot numbness (bilateral, transverse arch) + +- Triggered at ~3-4km mark (Jul 5 at Margaret Island, Jul 5 at XII. District) +- Resolves 2-5 min after stopping +- Suspected cause: lace tension over midfoot +- No numbness reported on recent 5K (Jul 15) or any run since Jul 5 + +### Right leg chain reaction + +- Left leg issues early on → corrected form → right leg became weak link +- Right inner thigh (adductor): Jul 1, resolved by Jul 3 +- Right knee / distal quad: Jul 3, Jul 12 (same spot both times) +- Pattern: cumulative load issue, not acute injury +- Currently no active complaints + +### Side stitches + +- Jul 8 (rage-run, crashed at 1.5km) +- Jul 13 (during threshold burst, managed it) + +### Dry cough (Jul 18) + +- Exercise-induced throat irritation from mouth-breathing without water +- Resolved immediately after drinking — not respiratory + +### Ankle + +- Slight right ankle pain before runs occasionally (flat feet + weight) +- Usually self-resolves during warm-up +- Ankle circles identified as most important warm-up exercise + +--- + +## Lifestyle factors + +### Nutrition + +- Pre-run: 2 muesli bars (typical quick breakfast) OR Greek yogurt (200g) +- DIY sports drink: 30g table sugar + 1g salt + zero-sugar syrup in 5dl water (~6% carb) +- Takes creatine, magnesium bisglycinate (nightly) +- Sometimes runs with no food — energy deficit noticeable at end of longer runs + +### Substances + +- **Alcohol:** clear dose-dependent HRV suppression. 2 drinks → ~94ms. Heavy drinking → 71ms. Recovery takes 2-3 days. +- **Weed (one instance, Jul 19):** boosted deep sleep to 37% (record), suppressed REM to 11%. Next-day run was a 3K PB. Not a sustainable strategy but data is interesting. +- **Smoker:** relevant for cardiovascular and recovery context. + +### Sleep habits + +- Typical bedtime: 23:30-01:30 +- Racing thoughts / mental clutter = delayed sleep onset + HRV suppression +- Mid-night awakening roughly 2x/night (consistent pattern) +- Post-wake naps suggest recovery debt on short-sleep nights + +--- + +## Summary for the advisor + +**What's working:** +- VO₂Max climbing steadily: 37 → 42 in ~5 weeks (+13.5%) +- 3K pace improved from 6'29" (Jun 13) to 5'57" (Jul 20, PB) — **−32s/km** +- 5K pace improved from 7'00" (Jun 7) to 6'30" (Jul 5) — **−30s/km** +- HRV reliably tracks recovery quality and predicts run performance +- Cadence naturally settling at 170-172 when well-rested +- Consistency: 19 runs in ~6 weeks, morning-run habit established (first ever: Jun 29) +- Went from sporadic varied runs (Jun 7-22) to disciplined 3x/week pattern (Jul) + +**What needs attention:** +- Foot numbness at 3-4km (bilateral, transverse arch) — likely mechanical (lace tension) +- Right knee/thigh recurring issue (distal quad/suprapatellar) — cumulative load, not acute +- Sleep consistency: great nights (8h+, HRV >110) mixed with bad ones (5-6h, HRV <90) +- Alcohol's outsized impact on HRV and next-day performance +- Flat feet + current weight (83-84kg at 172cm) → mechanical load on lower limbs +- REM sleep often on the low end (9-19%), especially after substances + +## Connected + +- [[Runs/2026-06-07]] +- [[Runs/2026-06-07-1k]] +- [[Runs/2026-06-10]] +- [[Runs/2026-06-13]] +- [[Runs/2026-06-15]] +- [[Runs/2026-06-19]] +- [[Runs/2026-06-22]] +- [[Runs/2026-06-29]] +- [[Runs/2026-06-30]] +- [[Runs/2026-07-01]] +- [[Runs/2026-07-03]] +- [[Runs/2026-07-05]] +- [[Runs/2026-07-08]] +- [[Runs/2026-07-10]] +- [[Runs/2026-07-12]] +- [[Runs/2026-07-13]] +- [[Runs/2026-07-15]] +- [[Runs/2026-07-18]] +- [[Runs/2026-07-20]] \ No newline at end of file diff --git a/Running Log.md b/Running Log.md new file mode 100644 index 0000000..e69de29 diff --git a/Runs/2026-06-07-1k.md b/Runs/2026-06-07-1k.md new file mode 100644 index 0000000..84aa5f4 --- /dev/null +++ b/Runs/2026-06-07-1k.md @@ -0,0 +1,23 @@ +--- +date: 2026-06-07 +type: run +tags: [run, early-run, partial-data, short-run] +--- + +# Run — 2026-06-07 (second run) + +**1.00 km in 6:29 — Short second run same day. Pace 6'29"/km.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 1.00 km | +| Duration | 6:29 | +| Avg pace | 6'29" | + +> Partial data — only distance and time recorded. No HR, cadence, or VO₂Max available. + +## Connected + +- [[Runs/2026-06-07]] \ No newline at end of file diff --git a/Runs/2026-06-07.md b/Runs/2026-06-07.md new file mode 100644 index 0000000..6d4dd53 --- /dev/null +++ b/Runs/2026-06-07.md @@ -0,0 +1,23 @@ +--- +date: 2026-06-07 +type: run +tags: [run, early-run, partial-data] +--- + +# Run — 2026-06-07 + +**4.90 km in 34:20 — Longest run of the early period. Pace 7'00"/km.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 4.90 km | +| Duration | 34:20 | +| Avg pace | 7'00" | + +> Partial data — only distance and time recorded. No HR, cadence, or VO₂Max available. + +## Connected + +- [[Runs/2026-06-07-1k]] \ No newline at end of file diff --git a/Runs/2026-06-10.md b/Runs/2026-06-10.md new file mode 100644 index 0000000..d868688 --- /dev/null +++ b/Runs/2026-06-10.md @@ -0,0 +1,36 @@ +--- +date: 2026-06-10 +type: run +tags: [run, reference, early-run] +--- + +# Run — 2026-06-10 + +**Easy run training. 4.01 km at 6'57", VO₂Max still 37.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 4.01 km | +| Duration | 27:53 | +| Avg pace | 6'57" | +| Best pace | 6'40" | +| Avg HR | ~160 bpm | +| Max HR | 176 bpm | +| Cadence | 169 spm | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 23 bpm (173→126) | +| VO₂Max | 37 ml/kg/min (Poor) | +| Steps | 4,724 | +| Elevation | 18.1 m | + +## Comparison anchor + +This run is a **baseline** — shows where things were ~3 weeks before the consistent streak started. VO₂Max went from 37→40 by Jul 3, pace improved from 6'57"→6'34" over a similar distance with lower HR (152 vs ~160). + +## Connected + +- [[Runs/2026-07-03]] \ No newline at end of file diff --git a/Runs/2026-06-13.md b/Runs/2026-06-13.md new file mode 100644 index 0000000..b66a2eb --- /dev/null +++ b/Runs/2026-06-13.md @@ -0,0 +1,23 @@ +--- +date: 2026-06-13 +type: run +tags: [run, early-run, partial-data] +--- + +# Run — 2026-06-13 + +**3.00 km in 19:26 — Pace 6'29"/km.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 3.00 km | +| Duration | 19:26 | +| Avg pace | 6'29" | + +> Partial data — only distance and time recorded. No HR, cadence, or VO₂Max available. + +## Connected + +- [[Runs/2026-06-10]] \ No newline at end of file diff --git a/Runs/2026-06-15.md b/Runs/2026-06-15.md new file mode 100644 index 0000000..2becbb2 --- /dev/null +++ b/Runs/2026-06-15.md @@ -0,0 +1,23 @@ +--- +date: 2026-06-15 +type: run +tags: [run, early-run, partial-data] +--- + +# Run — 2026-06-15 + +**2.00 km in 12:05 — Pace 6'03"/km.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 2.00 km | +| Duration | 12:05 | +| Avg pace | 6'03" | + +> Partial data — only distance and time recorded. No HR, cadence, or VO₂Max available. + +## Connected + +- [[Runs/2026-06-13]] \ No newline at end of file diff --git a/Runs/2026-06-19.md b/Runs/2026-06-19.md new file mode 100644 index 0000000..7fea59c --- /dev/null +++ b/Runs/2026-06-19.md @@ -0,0 +1,23 @@ +--- +date: 2026-06-19 +type: run +tags: [run, early-run, partial-data] +--- + +# Run — 2026-06-19 + +**2.00 km in 12:45 — Pace 6'23"/km.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 2.00 km | +| Duration | 12:45 | +| Avg pace | 6'23" | + +> Partial data — only distance and time recorded. No HR, cadence, or VO₂Max available. + +## Connected + +- [[Runs/2026-06-15]] \ No newline at end of file diff --git a/Runs/2026-06-22.md b/Runs/2026-06-22.md new file mode 100644 index 0000000..f20a33e --- /dev/null +++ b/Runs/2026-06-22.md @@ -0,0 +1,23 @@ +--- +date: 2026-06-22 +type: run +tags: [run, early-run, partial-data] +--- + +# Run — 2026-06-22 + +**4.00 km in 28:40 — Pace 7'10"/km.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 4.00 km | +| Duration | 28:40 | +| Avg pace | 7'10" | + +> Partial data — only distance and time recorded. No HR, cadence, or VO₂Max available. + +## Connected + +- [[Runs/2026-06-19]] \ No newline at end of file diff --git a/Runs/2026-06-29.md b/Runs/2026-06-29.md new file mode 100644 index 0000000..c0c7776 --- /dev/null +++ b/Runs/2026-06-29.md @@ -0,0 +1,43 @@ +--- +date: 2026-06-29 +type: run +tags: [run, morning, comeback] +--- + +# Run — 2026-06-29 + +**First morning run ever.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 2.03 km | +| Duration | 11:55 | +| Avg pace | 5'52" | +| Avg HR | — | +| Max HR | — | +| Cadence | 165 spm | +| Steps | — | + +## Sleep — Night before + +6h 31min | REM: 5% | Deep: 22% | HRV: 130 | Resting HR: 47 | Woke: 0x +> Couldn't sleep before midnight. Mind racing with excitement about the run. + +## How it felt + +> "Felt great. Feet were fine. Continued at one of my highest performance levels." + +**Verdict:** Fitness held through 2-week break. Successful comeback. + +## Post-run notes + +- Ate bakery breakfast + coffee → felt fight-or-flight symptoms around 09:00 +- Recognized as anxiety about procrastinated Angular 11→21 migration task +- Calmed down with binaural beats, worked 3 hours on it + +## Connected + +- [[Sleep/2026-06-29]] +- [[sportnote-blueprint]] \ No newline at end of file diff --git a/Runs/2026-06-30.md b/Runs/2026-06-30.md new file mode 100644 index 0000000..a7e5cff --- /dev/null +++ b/Runs/2026-06-30.md @@ -0,0 +1,59 @@ +--- +date: 2026-06-30 +type: run +tags: [run, morning, day-2] +--- + +# Run — 2026-06-30 + +**Day 2. Slower, further. Good pace control.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 2.51 km | +| Duration | 16:24 | +| Avg pace | 6'32" | +| Fastest pace | 5'45" | +| Avg HR | 153 bpm | +| Max HR | 170 bpm | +| Cadence | 165 spm | + +| HR Zone | Time | +|---------|------| +| Anaerobic | 7 min | +| Aerobic | 6 min | +| Fat-burning | 1 min | +| Warm-up | <1 min | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 23 bpm (165→118) | +| VO2Max | 39 ml/kg/min (Fair) | +| Steps | 2,711 | + +| KM | Pace | +|----|------| +| 1 | 6'28" | +| 2 | 6'41" | +| Last 0.5km | ~6'22" | + +## Sleep — Night before + +**7h 48min** · 23:22→07:12 · REM: 14% · Deep: 23% · HRV: 112 · Resting HR: 54 · Woke: 1x · Score: 85/100 🔥 + +> Went to bed almost an hour earlier. Huge improvement — REM tripled from 21 min to 65 min. + +## How it felt + +> Waking up was harder than yesterday. Intentionally went slower and further — wanted ~3km but didn't plan the distance, ended at 2.5km. +> +> Legs okay. Slight ankle pain (flat feet + overweight: 172cm, 83.5-84.5kg). Yesterday had zero problems. Shoes (Kiprun Jogflow 190.1) are great for short distances but start causing issues around 4km (numbness, foot pain). + +**Verdict:** Consistent back-to-back. Sleep recovery made the run sustainable. Cadence (165) slightly below ideal 170-180 — worth monitoring. Shoe issues noted for longer runs. + +## Connected + +- [[Sleep/2026-06-30]] +- [[sportnote-blueprint]] \ No newline at end of file diff --git a/Runs/2026-07-01.md b/Runs/2026-07-01.md new file mode 100644 index 0000000..f236ff7 --- /dev/null +++ b/Runs/2026-07-01.md @@ -0,0 +1,61 @@ +--- +date: 2026-07-01 +type: run +tags: [run, morning, day-3, streak] +--- + +# Run — 2026-07-01 + +**Day 3. Further, faster than yesterday. Won the wake-up fight.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 3.04 km | +| Duration | 19:11 | +| Avg pace | 6'19" | +| Fastest pace | 5'13" | +| Avg HR | 155 bpm | +| Max HR | 174 bpm | +| Cadence | 167 spm | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 23 bpm | +| VO2Max | 39 ml/kg/min (Fair) | +| Steps | 3,215 | + +## Sleep — Night before + +**7h 24min** · 23:47→07:12 · REM: 17% · Deep: 38% · HRV: 77 · Resting HR: 58 · Score: 88/100 + +> Had Fröccs with friends. HRV dipped below range but sleep quality held up. + +## How it felt + +> Waking up was a real tug of war — wanted to sleep more. But got out, dressed, did ankle circles (noticed these are the most important warm-up), and left. +> +> Run felt okay and good. Left ankle was a minor struggle but negligible. Sweated like crazy after. Right inner/upper thigh has some pain when sitting and elevating the leg — doesn't affect walking or running. +> +> Did stretching the watch recommended post-run. + +## Comparison — 3-day streak + +| Metric | Jun 29 | Jun 30 | Jul 1 | Trend | +|--------|--------|--------|-------|-------| +| Distance | 2.03 km | 2.51 km | **3.04 km** | ↑ +50% in 3 days | +| Duration | 11:55 | 16:24 | **19:11** | ↑ | +| Avg pace | 5'52" | 6'32" | **6'19"** | ← faster than D2 | +| Fastest pace | — | 5'45" | **5'13"** | ↑ faster kick | +| Avg HR | — | 153 bpm | **155 bpm** | ≈ same effort | +| Max HR | — | 170 bpm | **174 bpm** | ↑ slight | +| Cadence | 165 spm | 165 spm | **167 spm** | ↑ steady | +| VO2Max | — | 39 | **39** | — stable | + +**Verdict:** Clear building pattern across all 3 days — more distance, similar effort, faster top speed. The best pace (5'13") shows there's more in the tank when pushing. Right thigh adductor needs watching. Streak alive. 🏃 + +## Connected + +- [[Sleep/2026-07-01]] +- [[Runs/2026-06-30]] \ No newline at end of file diff --git a/Runs/2026-07-03.md b/Runs/2026-07-03.md new file mode 100644 index 0000000..dfbf751 --- /dev/null +++ b/Runs/2026-07-03.md @@ -0,0 +1,64 @@ +--- +date: 2026-07-03 +type: run +tags: [run, morning, day-1] +--- + +# Run — 2026-07-03 + +**Fresh start after a rest day. New distance PB — 3.63 km. Pushed through an energy wall.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | **3.63 km** 🚀 | +| Duration | **23:49** | +| Avg pace | 6'34" | +| Fastest pace | 6'08" | +| Avg HR | 152 bpm | +| Max HR | 166 bpm | +| Cadence | 168 spm | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 24 bpm (161→113) | +| VO₂Max | **40 ml/kg/min** (↑ from 39) | +| Steps | 4,024 | +| Elevation | 9.4 m | + +## Sleep — Night before + +**7h 28min** · 23:49→07:17 · REM: 14% · Deep: 31% · HRV: 113 · Resting HR: 50 · Woke: 0x · Score: 86/100 🔥 + +> Surprisingly solid sleep despite drinking and missing dinner. Zero wake-ups, deep sleep on the high end. + +## How it felt + +> Rest day yesterday was a good call. Only had 2 drinks, got home early, but forgot about dinner — felt the energy deficit toward the end of the run, had to push through that wall and get home. +> +> Right ankle hurt a bit before the run, decided to go if it subsides — it did. Right thigh (above the knee) had some pain during the run, but the inner thigh strain from two days ago is completely gone. +> +> **Form chain reaction theory:** When I started running 2 months ago my form was bad — back/achilles hurting and numb after runs. Corrected my form, but shifting balance sends pressure to other places. It's been a chain reaction: left leg pain → correct form → right leg not strong enough → rest and keep going → right leg got strong enough → now right knee/thigh is the weak link. At least that's how I imagine it. +> +> Compared to a month ago (early June), the improvement is clear — VO₂Max was 37 back then, now it's 40. + +## Comparison + +| Metric | Jun 10 | Jun 29 | Jun 30 | Jul 1 | **Jul 3** | Trend | +|--------|--------|--------|--------|-------|-------|-------| +| Distance | 4.01 km | 2.03 km | 2.51 km | 3.04 km | **3.63 km** | 🚀 longest yet | +| Duration | 27:53 | 11:55 | 16:24 | 19:11 | **23:49** | ↑ | +| Avg pace | 6'57" | 5'52" | 6'32" | 6'19" | **6'34"** | ← faster than Jun 10 baseline | +| Best pace | 6'40" | — | 5'45" | 5'13" | **6'08"** | ↑ faster top speed | +| Avg HR | ~160 | — | 153 | 155 | **152** | ↓ much lower than Jun 10 | +| Max HR | 176 | — | 170 | 174 | **166** | ↓ calmer effort | +| Cadence | 169 | 165 | 165 | 167 | **168** | ≈ steady | +| VO₂Max | **37** | — | 39 | 39 | **40** | **↑ +3 in ~3 weeks** | + +**Verdict:** Smart rest day + solid sleep made this a good outing despite the energy deficit from drinking + missed dinner. Pushing through the wall when your tank is low is a real mental win. New distance PB (3.63 km), VO₂Max finally ticked up to 40 (was 37 in early June — 3 points in ~3 weeks is meaningful improvement), and HR stayed well-controlled throughout (avg 152, max 166 — both lower than Jul 1's shorter run). The right ankle self-resolved, but the right thigh pain (above knee) is worth watching. Compared to early June, this is a completely different runner — more distance, better aerobic base, higher VO₂Max. 🏃 + +## Connected + +- [[Sleep/2026-07-03]] +- [[Runs/2026-07-01]] \ No newline at end of file diff --git a/Runs/2026-07-05.md b/Runs/2026-07-05.md new file mode 100644 index 0000000..4947397 --- /dev/null +++ b/Runs/2026-07-05.md @@ -0,0 +1,72 @@ +--- +date: 2026-07-05 +type: run +tags: [run, morning, day-1] +--- + +# Run — 2026-07-05 + +**New distance PB — 5.30 km! Nearly 2 km further than previous best. XII. District route.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | **5.30 km** 🚀 | +| Duration | **34:29** | +| Avg pace | 6'30" | +| Fastest pace | 5'23" | +| Avg HR | 155 bpm | +| Max HR | 169 bpm | +| Cadence | 167 spm | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 25 bpm (165→115) | +| VO₂Max | 40 ml/kg/min | +| Steps | 5,772 | +| Elevation | 5.3 m | +| Speed | 9.22 km/h | +| Stride | 92 cm | +| Ground contact | 302 ms (Good) | +| Balance | L 50.0% / R 50.0% | +| Vertical oscillation | 10.1 cm | +| Recovery time | 15h | + +## Sleep — Night before + +**8h 11min** · 00:44→08:55 · REM: 9% · Deep: 29% · HRV: 135 · Resting HR: 49 · Woke: 0x · Score: 89/100 + +> Late bedtime (00:44) but 8+ hours slept. HRV excellent at 135ms. REM low at 9%. Zero wake-ups. + +## How it felt + +> Woke up and prepared a sports drink: 30g table sugar + 1g table salt + a bit of zero-sugar syrup in 5dl water. Energy was fine the whole run — felt good. +> +> Weather was 22°C, not sweating much because of the controlled 6'30" pace. Was starting to feel proud… then around the 3.5-4km mark, **both feet went suddenly numb**. Pressure on the sole around the transverse arch / mid-metatarsal area. Pushed through the last km, upped the pace a bit at the end to finish faster (hence the HR bump — wasn't planned). +> +> Sat down after finishing — numbness went away in 2-5 minutes. Felt completely normal after, and really calm. Still feel calm now. +> +> This exact numbness happened once before (Margaret Island), around the 3-3.5km mark — same spot, same distance threshold. +> +> Walked home. Step count now at 11k. Ate cottage cheese + jam mixed in, took creatine. + +## Comparison + +| Metric | Jun 29 | Jun 30 | Jul 1 | Jul 3 | **Jul 5** | Trend | +|--------|--------|--------|-------|-------|-------|-------| +| Distance | 2.03 km | 2.51 km | 3.04 km | 3.63 km | **5.30 km** | 🚀 **new PB +1.67 km** | +| Duration | 11:55 | 16:24 | 19:11 | 23:49 | **34:29** | ↑ longest yet | +| Avg pace | 5'52" | 6'32" | 6'19" | 6'34" | 6'30" | ≈ consistent | +| Best pace | — | 5'45" | 5'13" | 6'08" | **5'23"** | ↑ fast kick | +| Avg HR | — | 153 | 155 | 152 | **155** | ≈ steady effort | +| Max HR | — | 170 | 174 | 166 | **169** | ≈ controlled | +| Cadence | 165 spm | 165 spm | 167 spm | 168 spm | **167 spm** | ≈ steady | +| VO₂Max | — | 39 | 39 | 40 | **40** | ↑ from 39→40 | + +**Verdict:** Massive distance jump — 5.30 km is a 46% (!) increase over the previous PB (3.63 km). That's a huge leap in one run. The fact that heart rate stayed under control (avg 155, max 169 — comparable to much shorter runs) and pace didn't nosedive (6'30" vs 6'34" on Jul 3) suggests the aerobic base is genuinely improving. Perfect 50/50 ground contact balance is excellent. VO₂Max held at 40. Recovery time of 15h is reasonable for a distance this long. Need to keep an eye on recovery after this effort — it's the longest run yet. 🏃 + +## Connected + +- [[Sleep/2026-07-05]] +- [[Runs/2026-07-03]] \ No newline at end of file diff --git a/Runs/2026-07-08.md b/Runs/2026-07-08.md new file mode 100644 index 0000000..f198ff0 --- /dev/null +++ b/Runs/2026-07-08.md @@ -0,0 +1,69 @@ +--- +date: 2026-07-08 +type: run +tags: [run, afternoon, rage-run] +--- + +# Run — 2026-07-08 + +**1.56 km in 8:24 — Rage running after a heavy drinking night. Explosive start, crashed fast. Side stitch ended it at 1.5km.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 1.56 km | +| Duration | **08:24** | +| Avg pace | 5'23" | +| Fastest pace | **3'58"** 🔥 | +| Avg HR | 159 bpm | +| Max HR | **173 bpm** | +| Cadence | 167 spm | +| Max cadence | 191 spm | +| Steps | 1,403 | + +| Metric | Value | +|--------|-------| +| VO₂Max | 40 ml/kg/min | +| Recovery time | 5h | +| Elevation gain | 3.0 m | +| Ground contact | 277 ms | +| Vertical oscillation | 8.8 cm | + +**HR zone distribution:** Aerobic 6 min · Fat-burning 1 min · High intensity (Z5) 1 min + +## Sleep — Night before + +**6h 42min** · 01:24→08:20 · REM: 25% · Deep: 25% · HRV: 71ms · Resting HR: 58 · Score: 82/100 + +> Deeply disrupted by alcohol. Short sleep, fragmented deep, HRV tanked to 71ms (below personal range). + +## How it felt + +> Yesterday went out drinking — fairly drunk, smoked a lot. Woke up today not really hungover but absolutely exhausted and grumpy. Nothing lifted my mood. Decided to push myself and run really fast. +> +> Barely ate all day — just 200g of Greek yogurt. Basically nothing in the tank. +> +> Started immediately at max — hit ~4'00/km with cadence around 185 at peak speed. First kilometre in **4:30**. HR shot from 109 (idle walking) to 173 in that time. Slowed down after but was completely out of breath. Around the 1.5km mark my side started hurting — stopped there. +> +> This was rage running, and it didn't go well. Completely fucked, but I think I needed it. + +## Comparison + +| Metric | Jul 5 (PB) | Jul 8 | Delta | +|--------|-----------|-------|-------| +| Distance | **5.30 km** 🚀 | 1.56 km | ↓ 3.74 km | +| Duration | 34:29 | **08:24** | ↓ short | +| Avg pace | 6'30" | **5'23"** | ⚡ **1'07" faster** | +| Best pace | 5'23" | **3'58"** | ⚡ **1'25" faster** | +| Avg HR | 155 bpm | **159 bpm** | ↑ +4 bpm | +| Max HR | 169 bpm | **173 bpm** | ↑ +4 bpm | +| Cadence | 167 spm | 167 spm | ≈ same | +| VO₂Max | 40 | 40 | ≈ same | + +**Verdict:** Classic rage-run. Fastest pace ever (3'58"!) but lasted only 1.56 km. HR spiked to 173 in under 4 minutes — the combination of alcohol hangover, depleted glycogen, poor sleep (HRV 71, 6h42), and an all-out start meant the tank was empty before 2km. Side stitch is a telltale sign of breathing panic under max effort. On the bright side: the top-end speed is clearly there when you push. The challenge is channelling that energy into a controlled effort rather than burning out. Recovery time of 5h is optimistic — with alcohol in the system expect longer. + +## Connected + +- [[Sleep/2026-07-08]] +- [[Runs/2026-07-05]] diff --git a/Runs/2026-07-10.md b/Runs/2026-07-10.md new file mode 100644 index 0000000..53ddf07 --- /dev/null +++ b/Runs/2026-07-10.md @@ -0,0 +1,72 @@ +--- +date: 2026-07-10 +type: run +tags: [run, morning, recovery] +--- + +# Run — 2026-07-10 + +**2.50 km in 14:52 — Back on track after the rage-run. Solid controlled effort, VO₂Max bumped to 41.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 2.50 km | +| Duration | **14:52** | +| Avg pace | 5'57" | +| Fastest pace | **4'46"** | +| Best 1km pace | 5'41" | +| Avg HR | 151 bpm | +| Max HR | 164 bpm | +| Cadence | 170 spm | +| Steps | 2,530 | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 25 bpm (164→114) | +| VO₂Max | **41 ml/kg/min** 🆕 | +| Training load | 26 (Low) | +| Ground contact | 294 ms | +| Balance | L 50% / R 50% | +| Vertical oscillation | 8.9 cm | +| Elevation gain | 4.1 m | + +**HR zone distribution:** Anaerobic 6 min · Aerobic 6 min · Fat-burning 1 min + +## Sleep — Night before + +**7h 42min** · 01:01→08:50 · REM: 14% · Deep: 31% · HRV: 94ms · Resting HR: 55 · Score: 87/100 + +> Solid recovery night. HRV bounced back to 94ms (from 71ms two nights prior). Deep sleep 31% is great. + +## How it felt + +> Had 2 drinks yesterday (didn't get drunk this time), but waking up was still a struggle — really really sleepy. Had vivid dreams: +> +> **Void dream:** Standing on a floating mattress in a pool, drunk, barely balancing — knowing beneath me is not water but the void itself. If I fall I die. +> +> **Running race dream:** In a running race with water-filled holes we had to jump over. A girl almost drowned in one — I pulled her out. After the first lap I sat down next to friends, then realised I was sitting in spider webs with spiders glowing bright blue. Freaked out and woke up. +> +> Despite the dreams, sleep felt great overall. The run was okay — feet and legs a bit sore, but nothing really bad. + +## Comparison + +| Metric | Jul 5 (PB) | Jul 8 (Rage) | **Jul 10** | Trend | +|--------|-----------|-------------|-----------|-------| +| Distance | **5.30 km** 🚀 | 1.56 km | 2.50 km | ↑ from rage-run | +| Duration | 34:29 | 08:24 | **14:52** | ↑ longer than Jul 8 | +| Avg pace | 6'30" | 5'23" | **5'57"** | ↔ moderate | +| Best pace | 5'23" | 3'58" | **4'46"** | ↔ mid-range | +| Avg HR | 155 bpm | 159 bpm | **151 bpm** | ↓ calmer effort | +| Max HR | 169 bpm | 173 bpm | **164 bpm** | ↓ better control | +| Cadence | 167 spm | 167 spm | **170 spm** | ↑ slight gain | +| VO₂Max | 40 | 40 | **41** 🆕 | **↑ bumped up!** | + +**Verdict:** Exactly the run you needed after Wednesday's meltdown. Good distance (2.5km is higher than your June average), pace was controlled (5'57"), HR stayed well-managed (151 avg / 164 max — both lower than the rage-run despite running 60% further). HR recovery at 25 bpm (164→114) is solid. But the highlight is **VO₂Max ticking up to 41** — first increase since Jun 30→Jul 3. Your body is clearly recovering and building. This is the kind of run that builds fitness, not breaks it. 🏃 + +## Connected + +- [[Sleep/2026-07-10]] +- [[Runs/2026-07-08]] +- [[Runs/2026-07-05]] diff --git a/Runs/2026-07-12.md b/Runs/2026-07-12.md new file mode 100644 index 0000000..f157662 --- /dev/null +++ b/Runs/2026-07-12.md @@ -0,0 +1,76 @@ +--- +date: 2026-07-12 +type: run +tags: [run, afternoon, running-with-friend, conversational-pace] +--- + +# Run — 2026-07-12 + +**~1.98 km in 13:13 — Beach recovery run with a friend. Tired legs, empty tank, but got it done.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | ~1.98 km | +| Duration | **13:13** | +| Avg pace | 6'41" | +| Fastest pace | **5'45"** | +| Avg HR | 144 bpm | +| Max HR | 155 bpm | +| Cadence | 165 spm | +| Steps | 2,193 | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 44 bpm (146→102) | +| VO₂Max | **41 ml/kg/min** | +| GCT | 296 ms (Good) | +| Balance | L 49.9% / R 50.1% | +| Vertical oscillation | 9.4 cm (Avg) / 9.8 cm (Max) | +| Elevation | +8.2m / −7.9m | +| Speed | 8.99 km/h | +| Recovery time | 5h | +| Training load | 1.0 (Low) | +| Route | Vánmező | + +**HR zone distribution:** Aerobic ~10 min · Fat-burning / Warm-up ~3 min + +## Sleep — Night before + +**7h 41min** · 02:25→10:21 · REM: 14% · Deep: 30% · HRV: 78ms · Resting HR: 59 · Score: 87/100 + +> Beach day + late night (home at 2am). Decent sleep despite the late bedtime, but HRV at the bottom of range (78ms) and resting HR elevated to 59. Not a disaster, but not ideal prep for a run. + +## How it felt + +> Yesterday was beach day with friends — whole day in the lake, tons of steps, got home at 2am. Woke up and didn't really feel like running today, but went out with a friend anyway. +> +> Talking and running is still really hard for me — without it I manage fine, but holding a conversation while running takes a lot more effort. Felt tired and under-energised the whole time. My "breakfast" was two Műzli szelet (muesli bars) — basically nothing in the tank. +> +> On my right leg, above my knee and at the end of my thigh on the top, I felt some pain. + +## Comparison + +| Metric | Jul 8 (Rage) | Jul 10 (Recovery) | **Jul 12 (Beach hang)** | +|--------|-------------|------------------|------------------------| +| Distance | 1.56 km | 2.50 km | **1.98 km** | +| Duration | 08:24 | 14:52 | **13:13** | +| Avg pace | 5'23" | 5'57" | **6'41"** | +| Fastest pace | **3'58"** 🔥 | 4'46" | 5'45" | +| Avg HR | 159 bpm | 151 bpm | **144 bpm** ⬇ | +| Max HR | **173 bpm** | 164 bpm | **155 bpm** ⬇ | +| Cadence | 167 spm | 170 spm | **165 spm** | +| VO₂Max | 40 | **41** 🆕 | **41** ✅ held | + +**Verdict:** This was a social outing, not a performance run — and that's fine. The slowest pace in weeks (6'41") reflects the combination of poor nutrition (two muesli bars), late night (2am bedtime), and the physical toll of a full beach day. But the heart rate tells an interesting story: **avg 144 / max 155 is the lowest of the three comparable runs** — your body knew this was a low-effort day and didn't push. That's actually good pacing intuition: when you're tired, you naturally ran at a conversation-possible effort instead of trying to force speed. The fact that you went out and ran at all after a beach day + late night is the win here. + +**On the leg pain:** "above my knee, end of my thigh on top" = distal quadriceps / suprapatellar tendon area. You reported the **exact same spot on Jul 3** ("right thigh above the knee had some pain"). This reinforces your chain-reaction theory — as the left side adapted, the right quad/knee became the next weak link. Worth tracking, but this is a cumulative-load issue (beach walking + running on tired legs) rather than an acute injury. If it persists beyond 2-3 runs, consider some quad-strengthening work. + +**The "talking while running is hard" note** is actually useful data: it means your conversational pace threshold is somewhere around 6'40"/km at ~144 bpm. That's your Zone 2 ceiling — which is higher than it was 6 weeks ago. This will improve as aerobic base builds. + +## Connected + +- [[Sleep/2026-07-12]] +- [[Runs/2026-07-10]] +- [[Runs/2026-07-08]] \ No newline at end of file diff --git a/Runs/2026-07-13.md b/Runs/2026-07-13.md new file mode 100644 index 0000000..c96c015 --- /dev/null +++ b/Runs/2026-07-13.md @@ -0,0 +1,72 @@ +--- +date: 2026-07-13 +type: run +tags: [run, morning, threshold-burst, pace-PR] +--- + +# Run — 2026-07-13 + +**2.50 km in 14:40 — Solid run with a killer burst. Fastest pace ever at 3'53" 🔥** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 2.50 km | +| Duration | **14:40** | +| Avg pace | **5'52"** | +| Fastest pace | **3'53"** 🔥 NEW PB | +| Avg HR | 154 bpm | +| Max HR | 178 bpm | +| Cadence | 172 spm | +| Max Cadence | **196 spm** | +| Steps | 2,528 | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 23 bpm (122→99) | +| VO₂Max | 41 ml/kg/min ✅ held | +| Training load | 31 (Low) | +| Recovery time | 10h | +| Ground contact | 287 ms (Good) | +| Balance | L 50% / R 50% (perfect symmetry) | +| Vertical oscillation | 8 cm (Avg) | +| Elevation | +3.1m / −4.7m | +| Speed | 10.23 km/h | + +**HR zone distribution:** Very High (Z5) 3 min · Anaerobic (Z4) 2 min · Aerobic (Z3) ~9 min · Fat-burn + Warm-up <1 min + +## Sleep — Night before + +**6h 47min** (watch) / ~7h 47min (actual) · 01:13→08:00 (→~09:00 snooze) · REM: 16% · Deep: 25% · HRV: **121ms** · Resting HR: 51 · Score: 86/100 + +> Came to bed with racing thoughts, got up at 01:13 to journal + make a task list. Despite the late bedtime, sleep quality was excellent — HRV at 121ms is nearly top of range. Snoozed from 8→9 with dreaming (not deepest sleep but real rest). + +## How it felt + +> Good energy today. After the first kilometer I went full throttle for a short burst — about 1:30–2 minutes. Pace hit **3'53"** with cadence around 190, peaking at **195** for a few steps. HR climbed from ~155 to **178** during the push. +> +> After the burst I slowed down, HR settled to ~165 avg. Got a mild side stitch on breathing — slowed even more and pushed through it. Post-run did the 2min HR recovery test, then a short walk around the block to cool down properly. +> +> Overall a solid run. I did a hard burst and did NOT die after it. 💪 + +## Comparison + +| Metric | Jul 10 (Recovery) | Jul 12 (Beach hang) | **Jul 13 (Burst)** | +|--------|-------------------|--------------------|--------------------| +| Distance | 2.50 km | 1.98 km | **2.50 km** | +| Duration | 14:52 | 13:13 | **14:40** | +| Avg pace | 5'57" | 6'41" | **5'52"** ⚡ | +| Fastest pace | 4'46" | 5'45" | **3'53"** 🏆 NEW PB | +| Avg HR | 151 bpm | 144 bpm | **154 bpm** | +| Max HR | 164 bpm | 155 bpm | **178 bpm** ⬆️ | +| Cadence | 170 spm | 165 spm | **172 spm** | +| VO₂Max | 41 🆕 | 41 | **41** ✅ held | + +**Verdict:** This is your best structured run in weeks. The same distance as Jul 10 (2.50 km) but with a faster avg pace (5'52" vs 5'57"), a **new fastest pace record (3'53")**, and clear evidence you can recover from a high-intensity burst without falling apart. The fact that you hit Z5 for 3 minutes with HR peaking at 178 and still finished strong is real fitness progress. The side stitch was handled perfectly — slowed, breathed through it, finished. No foot numbness mentioned either. Good session. 🏃🔥 + +## Connected + +- [[Sleep/2026-07-13]] +- [[Runs/2026-07-12]] +- [[Runs/2026-07-10]] \ No newline at end of file diff --git a/Runs/2026-07-15.md b/Runs/2026-07-15.md new file mode 100644 index 0000000..b42308b --- /dev/null +++ b/Runs/2026-07-15.md @@ -0,0 +1,75 @@ +--- +date: 2026-07-15 +type: run +tags: [run, afternoon, long-run, óbuda] +--- + +# Run — 2026-07-15 + +**5.02 km in 35:55 — Second 5K ever. Afternoon run, slower pace but held it together for the full distance.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | **5.02 km** | +| Duration | **35:55** | +| Avg pace | 7'09" | +| Fastest pace | **6'01"** | +| Avg HR | 155 bpm | +| Max HR | 178 bpm | +| Cadence | 156 spm | +| Max Cadence | 176 spm | +| Steps | 5,603 | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 21 bpm (174→131) | +| VO₂Max | **41 ml/kg/min** ✅ held | +| Training load | 79 (Low) | +| Recovery time | 17h | +| GCT | 307 ms (Good) · Min 268 ms | +| Balance | L 50.0% / R 50.0% (perfect) | +| Vertical oscillation | 9.1 cm (Avg) / 10.3 cm (Max) | +| Stride | 94 cm | +| Speed | 8.39 km/h | +| Elevation | +6.5m / −8.0m | +| Route | Óbuda side | + +**HR zone distribution:** Extreme (Z5) ~3 min · Anaerobic (Z4) <1 min · Threshold · Aerobic (Z3) · Fat-burning ~5 min · Warm-up + +## Sleep — Night before + +**5h 52min** (watch) + **~50min post-wake nap** → ~6h 42min total · 01:36→07:50 · REM: 19% · Deep: 23% · HRV: **93ms** · Resting HR: 54 · Score: 72/100 + +> Short night — only 5h 52min, below the 6-10h reference range. Light sleep dominated at 58% (above the 55% reference — sign of restless/compensatory light sleep). Woke 2 times. HRV at 93ms is within range (78-132) but well below your sober baseline (110-135ms) — comparable to your ~2-drink nights. Deep sleep 23% is technically normal but that's only 1h 21min of actual deep sleep on such a short night. You napped ~50min after waking, bringing total sleep to ~6h 42min — still below your ideal. Breathing quality held at 98, SpO₂ 98%. + +## How it felt + +> Really wasn't feeling it today. Hard day mentally — lot of clutter in my head. At the end of the workday I decided to just go for a run, see if it would clear things out. Ate 2 muesli bars beforehand and made my sports drink (30g sugar + pinch of salt in water). +> +> The heat was killing me though. Afternoon sun + summer temps made it a slog. Combined with the short sleep and mental fatigue, this was pure grind — not a fun run by any stretch. But I finished it. + +## Comparison + +| Metric | Jul 5 (PB) | Jul 10 | Jul 12 | Jul 13 | **Jul 15** | +|--------|-----------|--------|--------|--------|------------| +| Distance | **5.30 km** 🚀 | 2.50 km | 1.98 km | 2.50 km | **5.02 km** | +| Duration | 34:29 | 14:52 | 13:13 | 14:40 | **35:55** | +| Avg pace | 6'30" | 5'57" | 6'41" | **5'52"** | **7'09"** ⬇️ | +| Fastest pace | 5'23" | 4'46" | 5'45" | **3'53"** 🏆 | **6'01"** | +| Avg HR | 155 bpm | 151 bpm | 144 bpm | 154 bpm | **155 bpm** | +| Max HR | 169 bpm | 164 bpm | 155 bpm | **178 bpm** | **178 bpm** | +| Cadence | 167 spm | 170 spm | 165 spm | **172 spm** | **156 spm** ⬇️ | +| VO₂Max | 40 | **41** 🆕 | 41 | 41 | **41** ✅ | +| Sleep (night before) | 8h 11m · HRV 135 | 7h 42m · HRV 94 | 7h 41m · HRV 78 | 6h 47m · HRV 121 | **5h 52m · HRV 93** | + +**Verdict:** Second 5K in the books — and you finished it. But the numbers tell a clear story: **same average heart rate (155 bpm) as Jul 5 but 39 seconds slower per km**. That's a significant efficiency drop driven almost entirely by sleep. You ran Jul 5 on 8+ hours of sleep with HRV at 135ms (top of range); today you ran on 5h 52min with HRV at 93ms. The cadence drop (156 vs your usual 165-172) and higher max HR (178, matching your all-time peak) suggest your body was working much harder to produce less output — classic under-recovered physiology. HR recovery was also weaker: 21 bpm vs 25 bpm on Jul 5. + +The bright side: **VO₂Max held at 41**, you finished the full 5K without stopping, and you kept perfect 50/50 balance. The afternoon timing (17:52) + summer heat + mental fatigue were a triple headwind — your body is used to morning runs in cooler conditions. This was a grit-finish, not a performance run — and sometimes that's the kind you need. 🏃 + +## Connected + +- [[Sleep/2026-07-15]] +- [[Runs/2026-07-13]] +- [[Runs/2026-07-05]] \ No newline at end of file diff --git a/Runs/2026-07-18.md b/Runs/2026-07-18.md new file mode 100644 index 0000000..c05ae36 --- /dev/null +++ b/Runs/2026-07-18.md @@ -0,0 +1,70 @@ +--- +date: 2026-07-18 +type: run +tags: [run, morning, short-run, vo2max-pr] +--- + +# Run — 2026-07-18 + +**2.01 km in 12:20 — Short and clean. VO₂Max bumped to 42. No water = dry cough at the end.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | 2.01 km | +| Duration | **12:20** | +| Avg pace | 6'08" | +| Fastest pace | **5'03"** | +| Avg HR | 147 bpm | +| Max HR | 158 bpm | +| Cadence | 172 spm | +| Steps | 2,124 | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 18 bpm | +| VO₂Max | **42 ml/kg/min** 🆕 NEW PB | +| Training load | 17 (Low) | +| Recovery time | 6h | +| GCT | 284 ms (Good) · Min 256 ms | +| Balance | L 49.9% / R 50.1% | +| Vertical oscillation | 8.8 cm | +| Stride | 95 cm | +| Speed | 9.78 km/h | +| Route | Szabadság tér / Lipótváros (District V) | + +**HR zone distribution:** Aerobic ~7 min · Fat-burning <1 min · Anaerobic <1 min · Extreme 0 min · Warm-up <1 min + +## Sleep — Night before + +**8h 33min** · 00:32→09:16 · REM: 13% · Deep: 31% · HRV: **116ms** · Resting HR: 52 · Score: 87/100 + +> Much better. A full 8.5 hours with HRV back at 116ms — solidly in the sober baseline range (110-135). Deep sleep 31% (2h 40min actual) is excellent. Light sleep still a touch high at 56% but that's minor. This is what recovery looks like. Night-and-day vs the Jul 15 5K prep (5h52m, HRV 93). + +## How it felt + +> Nothing fancy, nothing new. Didn't take water with me today. At the end I felt something fucking up my throat — dry coughing, was bad. After a while it eased, and went away completely after drinking some water. + +## Comparison + +| Metric | Jul 12 | Jul 13 | Jul 15 | **Jul 18** | +|--------|--------|--------|--------|------------| +| Distance | 1.98 km | 2.50 km | 5.02 km | **2.01 km** | +| Duration | 13:13 | 14:40 | 35:55 | **12:20** | +| Avg pace | 6'41" | 5'52" | 7'09" | **6'08"** | +| Fastest pace | 5'45" | **3'53"** 🏆 | 6'01" | **5'03"** ⚡ | +| Avg HR | 144 bpm | 154 bpm | 155 bpm | **147 bpm** | +| Max HR | 155 bpm | **178 bpm** | **178 bpm** | **158 bpm** | +| Cadence | 165 spm | **172 spm** | 156 spm | **172 spm** | +| VO₂Max | 41 | 41 | 41 | **42** 🆕 | + +**Verdict:** This is what a properly-recovered short run looks like. 6'08" at 147 bpm avg with cadence back to 172 — clean, efficient, no drama. Compare to Jul 12 (beach hangover run): same distance, but 33s/km faster today at only +3 bpm HR. The VO₂Max bump to 42 is the real news — that's your third increase in 8 runs (39→40→41→42) and confirms the trend is real, not noise. + +The dry cough is classic exercise-induced throat irritation — breathing hard through the mouth dries out the mucous membranes, especially without water. On short runs (<15 min) it's usually fine to skip water, but if you're pushing pace or it's warm, even a small sip before heading out can prevent it. The fact it resolved immediately after drinking confirms it was just dryness, not anything respiratory. + +## Connected + +- [[Sleep/2026-07-18]] +- [[Runs/2026-07-15]] +- [[Runs/2026-07-13]] \ No newline at end of file diff --git a/Runs/2026-07-20.md b/Runs/2026-07-20.md new file mode 100644 index 0000000..a23b221 --- /dev/null +++ b/Runs/2026-07-20.md @@ -0,0 +1,77 @@ +--- +date: 2026-07-20 +type: run +tags: [run, morning, 3k-pb] +--- + +# Run — 2026-07-20 + +**3.01 km in 17:55 — 3K PB at 5'57" pace! Hit 3'58" instantaneous. Had ~40 sec at a red light — real pace was even faster.** + +## Data + +| Metric | Value | +|--------|-------| +| Distance | **3.01 km** | +| Duration | **17:55** | +| Avg pace | **5'57"** | +| Fastest pace | **3'58"** 🔥 (matches all-time PB) | +| Avg HR | 158 bpm | +| Max HR | 170 bpm | +| Cadence | 171 spm | +| Max Cadence | 189 spm | +| Steps | 3,081 | + +| Metric | Value | +|--------|-------| +| HR recovery (2min) | 25 bpm | +| VO₂Max | **42 ml/kg/min** ✅ held | +| Training load | 42 (Low) | +| Recovery time | 14h | +| GCT | 282 ms (Good) · Min 239 ms | +| Balance | L 49.9% / R 50.1% | +| Vertical oscillation | 8.7 cm | +| Stride | 98 cm | +| Speed | 10.08 km/h | +| Route | Terézváros / Lipótváros | + +**HR zone distribution:** Anaerobic ~3 min · Aerobic most of the run · Fat-burning <1 min · Extreme 0 min + +## Sleep — Night before + +**8h 24min** · 23:33→08:56 · REM: 11% · Deep: 37% · HRV: **107ms** · Resting HR: 52 · Score: 90/100 + +> Exceptional sleep despite context. Deep sleep at 37% (3h 6min actual) is the highest recorded — deep continuity scored a perfect 100. Light sleep finally normalized at 52% (under the 55% threshold for the first time). REM was suppressed at 11% (only 54 min), likely from the weed. Woke up mid-night (as reported) but fell back asleep. HRV at 107ms is in baseline range — no hangover penalty. Score of 90 / top 1% is the best yet. + +## How it felt + +> Yesterday got really high on weed, got home a bit late. Woke up in the middle of the night and fell asleep again. Today morning ate my breakfast and since I had no tasks at work, thought I might as well go for a run. +> +> The watch said this is my PB for 3 km. I stood at a red light for ~40 seconds — so the real pace was even faster. Otherwise the run felt solid. + +## Comparison + +| Metric | Jul 13 | Jul 15 | Jul 18 | **Jul 20** | +|--------|--------|--------|--------|------------| +| Distance | 2.50 km | 5.02 km | 2.01 km | **3.01 km** | +| Duration | 14:40 | 35:55 | 12:20 | **17:55** | +| Avg pace | 5'52" | 7'09" | 6'08" | **5'57"** | +| Fastest pace | **3'53"** 🏆 | 6'01" | 5'03" | **3'58"** ⚡ | +| Avg HR | 154 bpm | 155 bpm | 147 bpm | **158 bpm** | +| Max HR | 178 bpm | 178 bpm | 158 bpm | **170 bpm** | +| Cadence | 172 spm | 156 spm | 172 spm | **171 spm** | +| VO₂Max | 41 | 41 | **42** 🆕 | **42** ✅ | +| Sleep score | 86 | 72 | 87 | **90** 🏆 | + +### 3K progression + +| Date | Distance | Time | Pace | Avg HR | +|------|----------|------|------|--------| +| Jul 1 | 3.04 km | 19:11 | 6'19" | 155 bpm | +| **Jul 20** | **3.01 km** | **17:55** | **5'57"** | **158 bpm** | + +**Verdict:** 3K PB — and it would have been even faster without the red light (~40 sec idle → adjusted ~17:15, pace ~5'44"/km). Compared to the Jul 1 3K: **1:16 faster** over the same distance at only +3 bpm HR. That's a massive efficiency gain in 3 weeks. + +The numbers are clean: 5'57" average, touched 3'58" instantaneous (matching your all-time fastest pace from the Jul 8 rage-run, but this time in a controlled 3K rather than a 1.5K burnout). Cadence at 171 with 98cm stride is efficient. Max HR 170 is well-managed — you're working hard but not redlining. HR recovery at 25 bpm is back to your best levels (matches Jul 5 & Jul 10). + +The sleep paradox is interesting: weed suppressed REM (11%) but boosted deep sleep to 37% — your highest ever. Deep continuity at 100 is perfect. The mid-night awakening is a known cannabis effect (rebound arousal as it metabolizes), but you fell back asleep. The overall recovery was clearly sufficient — you ran a PB on it. Not advocating weed as a sleep aid (REM is important for learning/memory), but for raw physical recovery before a run, that deep sleep delivered. 🏃🔥 \ No newline at end of file diff --git a/Sleep/2026-06-29.md b/Sleep/2026-06-29.md new file mode 100644 index 0000000..9721c7b --- /dev/null +++ b/Sleep/2026-06-29.md @@ -0,0 +1,17 @@ +--- +date: 2026-06-28 +type: sleep +tags: [sleep, recovery, poor-rem] +--- + +# Sleep — 2026-06-28 → 2026-06-29 + +**6h 31min** · 23:??→07:15 · REM: 5% · Deep: 22% · HRV: 130 · Resting HR: 47 · Woke: 0x + +> Couldn't fall asleep before midnight. Got out of bed at 00:45 for Michael Sealey meditation. Felt half-awake. Mind racing with excitement, not anxiety. + +**Interpretation:** Classic first-night schedule shift. Low REM = circadian rhythm still off. Resting HR at 47 despite poor sleep suggests cardiovascular base is solid. + +## Connected + +- [[Runs/2026-06-29]] \ No newline at end of file diff --git a/Sleep/2026-06-30.md b/Sleep/2026-06-30.md new file mode 100644 index 0000000..1110cf3 --- /dev/null +++ b/Sleep/2026-06-30.md @@ -0,0 +1,17 @@ +--- +date: 2026-06-29 +type: sleep +tags: [sleep, recovery, good-rem] +--- + +# Sleep — 2026-06-29 → 2026-06-30 + +**7h 48min** · 23:22→07:12 · REM: 14% · Deep: 23% · HRV: 112 · Resting HR: 54 · Woke: 1x · Score: 85/100 + +> Went to bed at 23:22 — almost an hour earlier than the night before. Much easier to fall asleep. Result: REM tripled (21 min → 65 min), deep sleep continuity normal (75 pts vs 64). + +**Interpretation:** Consistent wake time is driving bedtime earlier naturally. This is what a recovering sleep schedule looks like. + +## Connected + +- [[Runs/2026-06-30]] \ No newline at end of file diff --git a/Sleep/2026-07-01.md b/Sleep/2026-07-01.md new file mode 100644 index 0000000..0ad8b08 --- /dev/null +++ b/Sleep/2026-07-01.md @@ -0,0 +1,17 @@ +--- +date: 2026-06-30 +type: sleep +tags: [sleep, recovery, alcohol-effect] +--- + +# Sleep — 2026-06-30 → 2026-07-01 + +**7h 24min** · 23:47→07:12 · REM: 17% · Deep: 38% · HRV: 77 · Resting HR: 58 · Score: 88/100 + +> Had 2 Fröccs with friends in the evening but left early. HRV dropped below personal range (80-136) — alcohol effect visible even with just 2 drinks. Sleep architecture held up well though: deep sleep at 38% is excellent and REM at 17% is solid. + +**Interpretation:** Even light drinking affects HRV next morning. But sleep structure itself was good. The early bedtime and moderate drinking kept the damage contained. + +## Connected + +- [[Runs/2026-07-01]] \ No newline at end of file diff --git a/Sleep/2026-07-02.md b/Sleep/2026-07-02.md new file mode 100644 index 0000000..1c4e0b9 --- /dev/null +++ b/Sleep/2026-07-02.md @@ -0,0 +1,17 @@ +--- +date: 2026-07-02 +type: sleep +tags: [sleep, recovery, disrupted] +--- + +**8h 13min** · 23:30→08:59 · REM: 16% · Deep: 28% · HRV: 102ms · Resting HR: 55 · Score: 85/100 + +> Rough night. Came home early (~10pm) but procrastinated winding down — doomscrolled, avoided sleep. Went to bed late (23:30), couldn't fall asleep due to anxiety about being tired the next day. Got up, read in beanbag, fell asleep there. Woke ~5am, moved to bed, then hit snooze for 30min. Woke up at 09:00 "shitface tired." Woke 3 times throughout (above average). + +**Duration** was good (8h 13min, within range), and most metrics are solid — **HRV 102ms**, **resting HR 55**, **SpO2 97%**, **breathing quality 98**. But the fragmented sleep (3 wake-ups) and the mental context made it feel worse than the numbers suggest. Deep sleep (28%) and REM (16%) both within normal ranges, so the body did recover decently despite the disruption. + +**What stands out:** This is a classic pattern — coming home early with good intentions → procrastination → late bed → anxiety about next day → can't sleep. The sleep *quantity* was fine, but the *quality perception* tanked because of the mental spiral. + +## Connected + +- No run today (skipped due to poor sleep and mental fatigue) \ No newline at end of file diff --git a/Sleep/2026-07-03.md b/Sleep/2026-07-03.md new file mode 100644 index 0000000..919461a --- /dev/null +++ b/Sleep/2026-07-03.md @@ -0,0 +1,15 @@ +--- +date: 2026-07-03 +type: sleep +tags: [sleep, recovery, post-drinking] +--- + +**7h 28min** · 23:49→07:17 · REM: 14% · Deep: 31% · HRV: 113 · Resting HR: 50 · Woke: 0x · Score: 86/100 🔥 + +> Solid sleep — only 2 drinks, got home early. Skipped dinner though, so went to bed a bit hungry. Took a while to fall asleep (rolling in bed for a bit), but it was bearable. Fell asleep around 23:49, classic pre-run excited-brain mode. Zero wake-ups, deep sleep at 31% (high end), HRV at 113ms well within range, breathing quality 98/100 pristine. + +**What stands out:** The rest day + early night (even with just 2 drinks) gave the best recovery metrics of the week. 86/100, better than 96% of users. The pre-run racing thoughts didn't affect sleep quality — that's a good sign. + +## Connected + +- [[Runs/2026-07-03]] \ No newline at end of file diff --git a/Sleep/2026-07-05.md b/Sleep/2026-07-05.md new file mode 100644 index 0000000..ca32707 --- /dev/null +++ b/Sleep/2026-07-05.md @@ -0,0 +1,17 @@ +--- +date: 2026-07-05 +type: sleep +tags: [sleep, recovery, late-bedtime] +--- + +# Sleep — 2026-07-04 → 2026-07-05 + +**8h 11min** · 00:44→08:55 · REM: 9% · Deep: 29% · HRV: 135 · Resting HR: 49 · Woke: 0x · Score: 89/100 + +> Late bedtime again (00:44) — 2 rest days in a row and went to bed past midnight. Still got 8+ hours of sleep because woke up at 08:55. HRV was excellent at 135ms (at the top of personal range 79-135). REM was low at 9% (below 10-30% reference). Light sleep was high at 62% (above 55% reference). Deep sleep at 29% is solid-normal. Zero wake-ups. Breathing quality 98/100 pristine. + +**Interpretation:** The late bedtime is becoming a pattern — this is the second night past midnight. The good news is the sleep bank is full (8h11min) and recovery metrics are strong (HRV 135, resting HR 49, score 89). The low REM could be from the late bedtime disrupting sleep cycles. That 5.3 km run went well despite it. + +## Connected + +- [[Runs/2026-07-05]] \ No newline at end of file diff --git a/Sleep/2026-07-08.md b/Sleep/2026-07-08.md new file mode 100644 index 0000000..58af764 --- /dev/null +++ b/Sleep/2026-07-08.md @@ -0,0 +1,15 @@ +--- +date: 2026-07-08 +type: sleep +tags: [sleep, recovery, alcohol] +--- + +# Sleep — 2026-07-08 (night of Jul 7→Jul 8) + +**6h 42min** · 01:24→08:20 · REM: 25% · Deep: 25% · HRV: 71ms · Resting HR: 58 · Woke: 1x · Score: 82/100 + +> Came home drunk after a night out drinking with friends. Slept 6h42 — short but not terrible for a drinking night. Deep sleep was 25% (1h42) but continuity was low at 69pts, meaning it was fragmented. HRV at 71ms is below personal range (78-134) — the alcohol effect is clear. Breathing quality stayed high at 98pts. Woke up feeling tired and grumpy, not hungover per se but absolutely drained. + +## Connected + +- [[Runs/2026-07-08]] diff --git a/Sleep/2026-07-10.md b/Sleep/2026-07-10.md new file mode 100644 index 0000000..41ff153 --- /dev/null +++ b/Sleep/2026-07-10.md @@ -0,0 +1,15 @@ +--- +date: 2026-07-10 +type: sleep +tags: [sleep, recovery] +--- + +# Sleep — 2026-07-10 (night of Jul 9→Jul 10) + +**7h 42min** · 01:01→08:50 · REM: 14% · Deep: 31% · HRV: 94ms · Resting HR: 55 · Woke: 2x · Score: 87/100 + +> Had 2 drinks yesterday (didn't get drunk) — not enough to derail recovery. Sleep metrics are good (7h42, 31% deep, HRV 94) but waking up was a struggle — very sleepy. Had vivid, slightly unsettling dreams: floating mattress over a void while drunk, and a running race where I sat in glowing blue spider webs. Despite the dreams, felt well-rested. Legs/feet slightly sore from the run. + +## Connected + +- [[Runs/2026-07-10]] diff --git a/Sleep/2026-07-12.md b/Sleep/2026-07-12.md new file mode 100644 index 0000000..79fd1ee --- /dev/null +++ b/Sleep/2026-07-12.md @@ -0,0 +1,15 @@ +--- +date: 2026-07-12 +type: sleep +tags: [sleep, recovery, beach-day, late-night] +--- + +# Sleep — 2026-07-12 (night of Jul 11→Jul 12) + +**7h 41min** · 02:25→10:21 · REM: 14% · Deep: 30% · HRV: 78ms · Resting HR: 59 · Woke: 1x · Score: 87/100 + +> Beach day + arriving home at 2am pushed bedtime to 02:25 — the latest in a while. Despite the late hour, the actual sleep quality was decent: 7h41 total, deep sleep 30% (good ratio), HRV at 78ms is at the bottom of personal range (78-132) but not critically low. Resting HR elevated to 59 (normally 49-55). Woke up only once. Breathing quality 98/100 excellent. Sleep continuity 86/100. The Huawei Health analysis basically says: "good quality, but you went to bed way too late — and you've done this multiple times before." + +## Connected + +- [[Runs/2026-07-12]] \ No newline at end of file diff --git a/Sleep/2026-07-13.md b/Sleep/2026-07-13.md new file mode 100644 index 0000000..f7d1328 --- /dev/null +++ b/Sleep/2026-07-13.md @@ -0,0 +1,19 @@ +--- +date: 2026-07-13 +type: sleep +tags: [sleep, recovery, late-night, diary-breakthrough] +--- + +# Sleep — 2026-07-13 (night of Jul 12→Jul 13) + +**6h 47min** (watch) / ~7h 47min (actual) · 01:13→08:00 (watch) / →~09:00 (actual) · REM: 16% · Deep: 25% · Light: 59% · HRV: 121ms · Resting HR: 51 · SpO₂: 98% · Score: 86/100 + +> Bedtime was 01:13 — came in with racing thoughts about everything needing to be done. Got up, wrote in diary, made a concrete task list for today, and could finally fall asleep. +> +> **The watch says I woke at 08:00, but I snoozed/dreamt until ~09:00.** It wasn't the deepest sleep but it was sleep — and I was dreaming during it. Actual sleep quality was surprisingly good for the late bedtime: HRV at 121ms (excellent, well within 78-132 range), resting HR at 51 (solid), SpO₂ 98%, breathing quality 98/100. Deep sleep continuity perfect at 100/100, zero wake-ups. +> +> The discovery: when the racing thoughts hit, getting up and *externalizing* them (diary → task list) breaks the loop completely. The abstract "I NEED to do everything" becomes a concrete "here are 3-4 things for tomorrow" — and the panic evaporates. + +## Connected + +- [[Runs/2026-07-13]] \ No newline at end of file diff --git a/Sleep/2026-07-15.md b/Sleep/2026-07-15.md new file mode 100644 index 0000000..0e5e2d7 --- /dev/null +++ b/Sleep/2026-07-15.md @@ -0,0 +1,46 @@ +--- +date: 2026-07-15 +type: sleep +tags: [sleep, recovery, short-sleep, nap] +--- + +# Sleep — 2026-07-15 + +**5h 52min** (watch) + **~50min nap** → ~6h 42min · 01:36→07:50 · REM: 19% · Deep: 23% · HRV: **93ms** · Resting HR: 54 · Score: 72/100 + +## Details + +| Metric | Value | Status | +|--------|-------|--------| +| Bed time | 01:36 | Late | +| Rise time | 07:50 | | +| Night sleep | 5h 52min | Below average (ref: 6-10h) | +| Post-wake nap | ~50 min | | +| **Total sleep** | **~6h 42min** | | +| Deep sleep | 1h 21min (23%) | Normal (20-60%) | +| Light sleep | 3h 24min (58%) | **High** (ref: <55%) | +| REM sleep | 1h 7min (19%) | Normal (10-30%) | +| Times woke | 2 | Slightly above avg (ref: 0-1) | +| Score | 72/100 | Better than 25% | +| Deep continuity | 94 pts | Normal (70-100) | +| Breathing quality | 98 pts | Normal (70-100) | +| Avg HR | 54 bpm | Within range (49-59) | +| HRV | 93 ms | Within range (78-132) | +| SpO₂ | 98% | Within range (96-99) | +| Respiratory rate | 15 brpm | Within range (12-16) | + +## Analysis + +Short night — only 5h 52min of watch-tracked sleep. Light sleep dominated at 58% (above the 55% reference), which is typical for short/restless nights — the body compensates for insufficient deep and REM with more light sleep. Woke up 2 times, slightly above the 0-1 reference. + +The post-wake nap of ~50 minutes is significant — it suggests your body was genuinely sleep-deprived and needed to catch up. Total sleep including the nap: ~6h 42min — still short of your usual 7-8h. + +HRV at 93ms is technically within range but notably below your sober baseline (110-135ms). This is the same HRV territory as your ~2-drink nights (94ms). Combined with the late bedtime (01:36), this points to either light drinking, high evening stimulation, or both. Resting HR at 54 is within your personal range but slightly elevated from your best (49). + +**Context:** Gutca described the prior day as "a hard day mentally, lot of clutter." Mental stress and rumination are well-established HRV suppressors — the same autonomic disruption as alcohol, just through a different pathway (high sympathetic tone from mental load rather than physiological recovery from toxins). The late bedtime + mental clutter + 2 wake-ups paint a picture of a brain that wouldn't shut off. This wasn't a drinking night — it was a stress night. Same HRV outcome, different cause. + +**Run impact:** Running on this level of sleep produced a 7'09" pace at 155 bpm — vs 6'30" at the same HR on Jul 5 with 8h sleep and HRV 135. That's a 39s/km efficiency penalty directly attributable to recovery debt. + +## Connected + +- [[Runs/2026-07-15]] \ No newline at end of file diff --git a/Sleep/2026-07-18.md b/Sleep/2026-07-18.md new file mode 100644 index 0000000..1fa1799 --- /dev/null +++ b/Sleep/2026-07-18.md @@ -0,0 +1,43 @@ +--- +date: 2026-07-18 +type: sleep +tags: [sleep, recovery, good-sleep] +--- + +# Sleep — 2026-07-18 + +**8h 33min** · 00:32→09:16 · REM: 13% · Deep: 31% · HRV: **116ms** · Resting HR: 52 · Score: 87/100 + +## Details + +| Metric | Value | Status | +|--------|-------|--------| +| Bed time | 00:32 | | +| Rise time | 09:16 | | +| Night sleep | 8h 33min | Normal (ref: 6-10h) | +| Deep sleep | 2h 40min (31%) | Normal (20-60%) | +| Light sleep | 4h 46min (56%) | High (ref: <55%) | +| REM sleep | 1h 7min (13%) | Normal (10-30%) | +| Times woke | 2 | High (ref: 0-1) | +| Score | 87/100 | Better than 98% | +| Deep continuity | 85 pts | Normal (70-100) | +| Breathing quality | 98 pts | Normal (70-100) | +| Avg HR | 52 bpm | Within range (49-58) | +| HRV | 116 ms | Within range (78-133) | +| SpO₂ | 98% | Within range (96-99) | +| Respiratory rate | 15 brpm | Within range (12-16) | + +## Analysis + +This is a textbook recovery night. 8h 33min of sleep with HRV back at 116ms — solidly in the sober baseline range (110-135ms). Deep sleep at 31% (2h 40min of actual deep sleep) is excellent and well above the Jul 15 sleep (23%, only 1h 21min). Resting HR at 52 is back to normal range. + +The only minor flag is light sleep at 56% — barely above the 55% reference. Given the deep sleep was so strong, this isn't concerning. The 2 wake-ups persist (consistent pattern across most nights) but don't seem to impact overall recovery quality. + +This is the polar opposite of the Jul 14→15 sleep (5h 52min · HRV 93 · Score 72) — whatever you did differently between these two nights, it worked. Three days of recovery between runs may have helped as well. + +**Run impact:** Running on full recovery showed: 2.01 km at 6'08" pace with 147 bpm avg and VO₂Max bumping to 42. Clean, efficient output — exactly what proper sleep enables. + +## Connected + +- [[Runs/2026-07-18]] +- [[Sleep/2026-07-15]] \ No newline at end of file diff --git a/Sleep/2026-07-20.md b/Sleep/2026-07-20.md new file mode 100644 index 0000000..9320623 --- /dev/null +++ b/Sleep/2026-07-20.md @@ -0,0 +1,45 @@ +--- +date: 2026-07-20 +type: sleep +tags: [sleep, recovery, deep-sleep-record, weed] +--- + +# Sleep — 2026-07-20 + +**8h 24min** · 23:33→08:56 · REM: 11% · Deep: **37%** 🔥 · HRV: **107ms** · Resting HR: 52 · Score: 90/100 + +## Details + +| Metric | Value | Status | +|--------|-------|--------| +| Bed time | 23:33 | | +| Rise time | 08:56 | | +| Night sleep | 8h 24min | Normal (ref: 6-10h) | +| Deep sleep | 3h 6min (37%) | Normal (20-60%) — **highest ever** | +| Light sleep | 4h 24min (52%) | **Normal** (ref: <55%) | +| REM sleep | 54 min (11%) | Normal (10-30%) — low end | +| Times woke | 2 | High (ref: 0-1) | +| Score | 90/100 | Better than 99% 🏆 | +| Deep continuity | **100 pts** | Normal (70-100) — perfect | +| Breathing quality | 98 pts | Normal (70-100) | +| Avg HR | 52 bpm | Within range (49-58) | +| HRV | 107 ms | Within range (79-134) | +| SpO₂ | 97% | Within range (96-99) | +| Respiratory rate | 14 brpm | Within range (12-16) | + +## Analysis + +Best sleep score yet at 90 — top 1% of users. Deep sleep hit an all-time high of 37% (3h 6min actual), with deep continuity scoring a perfect 100. Light sleep finally normalized at 52% — the first night under the 55% threshold after a long streak of elevated light sleep. + +**Weed effect:** Gutca reported getting "really high" the evening before. This explains the sleep architecture: cannabis is known to increase slow-wave (deep) sleep while suppressing REM. The 37% deep / 11% REM split is a textbook THC signature. The mid-night awakening (which the user confirmed) is a common rebound effect as THC metabolizes — but falling back asleep prevented significant disruption. + +Despite the artificial architecture, recovery metrics were strong: HRV at 107ms (baseline), resting HR 52, SpO₂ 97%. The 2 wake-ups persist but don't impact overall quality — deep continuity at 100 proves sleep was uninterrupted during the deep phases where it mattered most. + +**Run impact:** This sleep fueled a 3K PB — 3.01 km in 17:55 at 5'57" pace, beating the Jul 1 3K by 1:16 at only +3 bpm HR. The deep sleep delivered for physical recovery even though REM was shortchanged. + +**Caveat:** While deep sleep is great for physical recovery, REM suppression over time impacts emotional regulation, memory consolidation, and learning. This isn't a sustainable sleep optimization strategy — but as a one-off, the acute recovery benefit is undeniable. + +## Connected + +- [[Runs/2026-07-20]] +- [[Sleep/2026-07-18]] \ No newline at end of file diff --git a/System/Assistant/context.md b/System/Assistant/context.md new file mode 100644 index 0000000..f0e1e70 --- /dev/null +++ b/System/Assistant/context.md @@ -0,0 +1,65 @@ +# Assistant — Context + +Current life situation, health protocols, and active things to track. +Read when context matters for decisions or advice. + +--- + +## Identity + +- Name: Csizmadia Zsombor (goes by Gutca) +- Age: 23 +- Location: Budapest, Hungary (CET timezone) +- Languages: English preferred, Hungarian native +- Occupation: Junior software developer + +## Lifestyle + +- Smoker (~5-6/day). Affects lung capacity, recovery speed, REM sleep. +- Not a morning person. Best realistic wake time: 7:30-7:45. +- Late drinking with friends is a recurring sleep disruptor. +- Runs for mood and structure — losing the habit causes rapid decline in wellbeing. + +## Running Profile + +- Beginner runner. Had a strong 1.5 month streak, then a 2-week break. +- Motivation: gamification (1km = 2k Ft savings), structure, mood anchor. +- Feels better running even on bad sleep than not running at all. +- First morning run ever was June 29, 2026. +- Previous runs were afternoon/evening. Heat + bad footing caused the 2-week break. + +## Work Context + +- Home office most days (Tue/Thu office). +- Struggles with procrastination on hard tasks (especially frontend/ Angular). +- Doomscrolls on HO days if not anchored by exercise. +- Morning run → better work day: feels agency instead of reactivity. + +## Health Notes + +- Running shows positive cardiovascular impact: 47 bpm resting HR despite smoking. +- Anxiety triggers identifiable: poor sleep + caffeine + avoidance = fight-or-flight. +- Self-aware about sleep issues; knows not to force it. +- **Flat feet** — causes ankle pain on longer runs or consecutive days. +- **Overweight:** 172 cm, 83.5-84.5 kg. +- **Shoes:** Kiprun Jogflow 190.1. Great for short distances (<4 km). At 4 km+ causes numbness and foot pain. + +## Equipment + +- Watch: Huawei Watch Fit 4 Pro +- Running surface: Budapest streets (Terezvaros, Andrassy ut, Rakoczi area) + +## Daily Supplements + +| Supplement | Role in context | +|-----------|----------------| +| Vitamin C + Zinc | Immune support, recovery | +| Vitamin D (3000-4000 IU) | Bone health, mood — relevant given Budapest latitude | +| Omega 3 | Anti-inflammatory, joint health — relevant for flat feet / ankle pain | +| Selenium | Antioxidant, thyroid function | +| Creatine | Muscle recovery, cognitive function | +| Magnesium (before sleep, if available) | Sleep quality, muscle relaxation — currently out of stock | + +--- + +*Last updated: 2026-06-29* \ No newline at end of file diff --git a/System/Assistant/environment.md b/System/Assistant/environment.md new file mode 100644 index 0000000..b1b80a8 --- /dev/null +++ b/System/Assistant/environment.md @@ -0,0 +1,48 @@ +# Assistant — Environment & Technical Setup + +Hardware, tools, quirks, and gotchas. Read when troubleshooting or configuring. + +--- + +## Hardware + +- Primary machine: Windows 10/11 desktop +- Watch: Huawei Watch Fit 4 Pro +- IDE: IntelliJ +- Plans to migrate to Linux later + +## Services & Accounts + +- Actual Budget: self-hosted at budgeting.gutcanet.duckdns.org (read-only) +- Gmail, Google Calendar, Google Drive +- Docker not actively running containers currently +- GitHub: PR-based workflow, no squash merges + +## Vault Paths + +| Resource | Path | +|----------|------| +| Vault root | `D:\hermes-folder\obsidian-vault\` | +| Run logs | `D:\hermes-folder\obsidian-vault\Runs\YYYY-MM-DD.md` | +| Sleep logs | `D:\hermes-folder\obsidian-vault\Sleep\YYYY-MM-DD.md` | +| Daily logs | `D:\hermes-folder\obsidian-vault\Daily\YYYY-MM-DD.md` | +| SportNote blueprint | `D:\hermes-folder\obsidian-vault\sportnote-blueprint.md` | + +## Project Paths + +| Project | Path | +|---------|------| +| Work (general) | Not specified | +| SportNote | Blueprint in Obsidian, stack planned: Spring Boot + Angular + SQLite/Turso | +| Actual Budget scripts | `D:\hermes-folder\actual-budget-reader\` | + +## Known Issues & Patterns + +- Windows terminal uses git-bash/MSYS, not PowerShell — POSIX syntax only. +- Python 3.11 installed, pip missing, uv installed as package manager. +- OCR/screenshot extraction: install easyocr at runtime (needs PyTorch deps). +- Reddit and some sites block requests aggressively — use user-agent or alternative sources. + +--- + +*Last updated: 2026-06-29* \ No newline at end of file diff --git a/System/Assistant/preferences.md b/System/Assistant/preferences.md new file mode 100644 index 0000000..d64d9b5 --- /dev/null +++ b/System/Assistant/preferences.md @@ -0,0 +1,43 @@ +# Assistant — Preferences + +How you like things done. Read this when unsure about tone, format, or approach. + +--- + +## Communication + +- **Always English.** Never use Hungarian unless explicitly asked. +- Casual and direct. Step-by-step explanations when collaborating on projects. +- Concise first, detailed if needed. Bullets/tables/short paragraphs preferred. +- Casual tone comfortable. Not overly formal. + +## Priority Hierarchy + +As defined by the user: + +> Raw exercise data > nutrition > sleep data > mental context. Sleep is important, maybe the most important, but mental context is background only. + +| Layer | Role | +|-------|------| +| Exercise data | Primary subject. All insights tie back to this. | +| Nutrition | Secondary context for performance. | +| Sleep data | Critical context. Always check before interpreting a run. | +| Mental context | Background. Useful when explaining anomalies, not main topic. | + +## Obsidian Vault Rules + +- **Always write in English** in vault notes. +- Run logs go to `Runs/YYYY-MM-DD.md` +- Sleep logs go to `Sleep/YYYY-MM-DD.md` +- Daily logs go to `Daily/YYYY-MM-DD.md` +- The SportNote blueprint lives in the root as reference. + +## Decision Style + +- Deep analysis, best value, quality + simplicity over complexity. +- Prefers realistic constraints over aspirational plans. +- Adjusts when user pushes back — negotiate, don't dictate. + +--- + +*Last updated: 2026-06-29* \ No newline at end of file diff --git a/flag_fetch.md b/flag_fetch.md new file mode 100644 index 0000000..e69de29 diff --git a/flag_rebuild.md b/flag_rebuild.md new file mode 100644 index 0000000..e69de29 diff --git a/index.md b/index.md new file mode 100644 index 0000000..cb31169 --- /dev/null +++ b/index.md @@ -0,0 +1,21 @@ +# Obsidian Vault — Gutca + +## Permanent Reference +- [[sportnote-blueprint]] — SportNote project specification +- [[Running Log]] — historical running log + +## Daily Log System + +### 2026-06-29 +- [[Runs/2026-06-29]] — First morning run, comeback 2.03 km +- [[Sleep/2026-06-29]] — 6h 31min, 5% REM, disrupted circadian rhythm + +## Vault Structure + +- `Runs/` — per-run logs with structured data + self-report +- `Sleep/` — per-night sleep logs with vitals + analysis +- `Daily/` — broader daily logs (future) +- `System/Assistant/` — AI context, preferences, environment + - [[System/Assistant/context]] + - [[System/Assistant/preferences]] + - [[System/Assistant/environment]] \ No newline at end of file diff --git a/koltsegvetes-julius-2026.md b/koltsegvetes-julius-2026.md new file mode 100644 index 0000000..a6b423a --- /dev/null +++ b/koltsegvetes-julius-2026.md @@ -0,0 +1,67 @@ +# Költségvetés — Július 2026 + +## Bevétel +| Forrás | Összeg | +|---|---| +| Fizetés (Tigra Zrt) | +619 000 Ft | +| **Összesen** | **+619 000 Ft** | + +## Kiadások + +### Kötelező / FIX kiadások +| Kategória | Összeg | Megjegyzés | +|---|---|---| +| Lakbér | 200 000 Ft | Tulaj, K&H | +| Számlák | 34 000 Ft | Biztosítás + Netfone + Spotify + rezsiköltségek + BKK | +| Egészség | 80 000 Ft | Terápia 4×15k + vitaminok/kiegészítők ~20k | +| *Részösszeg* | *314 000 Ft* | | + +### Mindennapi élet +| Kategória | Összeg | Megjegyzés | +|---|---|---| +| Étterem / péksüti | 70 000 Ft | 3:2 arány felé (~1x-vel kevesebb/hét) | +| Bevásárlások | 55 000 Ft | Több főzés = több bevásárlás | +| Egyéb - Mindennapi | 30 000 Ft | Impulzus vásárlásokra (pl. asztal) | +| Közlekedés | 8 000 Ft | BKK-n felüli utazások | +| Cigaretta | 10 000 Ft | | +| *Részösszeg* | *173 000 Ft* | | + +### Szabadidő +| Kategória | Összeg | Megjegyzés | +|---|---|---| +| Kocsmázás / Lógások | 28 000 Ft | ~1 körrel kevesebb/hét | +| Hobbik / Sport | 20 000 Ft | Openrouter + egyéb | +| Egyéb - Szabad | 20 000 Ft | | +| Ajándékok | 8 000 Ft | | +| *Részösszeg* | *76 000 Ft* | | + +### Megtakarítások +| Kategória | Összeg | Megjegyzés | +|---|---|---| +| TBSZ (10%) | 62 000 Ft | STOXX Europe 600 | +| *Részösszeg* | *62 000 Ft* | | + +--- + +## Összegzés +| | Összeg | +|---|---| +| **Összes kiadás** | **625 000 Ft** | +| **Bevétel** | **619 000 Ft** | +| **Különbség** | **~6 000 Ft** *(EUR-ból fedezi)* | + +## Social ratio +- Étterem + Kocsmázás: **98 000 Ft** +- Bevásárlás: **55 000 Ft** +- Arány: **1.78:1** (júniusban 2.6:1 volt, cél 1.5:1) + +## EUR stratégia +EUR → HUF váltás Revoluton belül, K&H helyett. ~EUR 200-300 felhasználása júliusban. + +## Backup állás +| | Összeg | +|---|---| +| Július elején | 1 035 000 Ft (672k HUF + 363k EUR) | +| EUR felhasználás | ~ -100 000 Ft | +| Július végén | ~950 000 Ft | +| Helyreállás | Szeptemberre vissza >1M | \ No newline at end of file diff --git a/sportnote-blueprint.md b/sportnote-blueprint.md new file mode 100644 index 0000000..e3c9824 --- /dev/null +++ b/sportnote-blueprint.md @@ -0,0 +1,456 @@ +# SportNote Blueprint + +> Derived from the June 29, 2026 morning run conversation with Hermes Agent. +> This chat is the target experience for the SportNote project. + +--- + +## 1. Information Sources the AI Must Ingest + +### Explicit (user says it) +- Run goals, constraints (meeting time, commute type) +- Self-assessment ("haven't run in 2 weeks", "feet were bad before", "I'm not a morning person") +- Previous performance context ("first 1.5 months felt great, then it fell apart") +- Sleep history ("can't fall asleep before 2 AM", "was drinking with friends") +- Feelings post-run ("felt great", "feet are fine", "like I didn't lose fitness") +- **Work/mental context** — procrastination levels, home office struggles, anxiety triggers. Low priority on its own, but valuable for interpreting exercise + sleep patterns. + +### Imported (from devices / screenshots) +- **Run data:** distance, duration, pace, speed, cadence, stride, heart rate zones, calories, route map +- **Sleep data:** total duration, deep/light/REM breakdown (%), REM minutes, times awoken, resting HR, HRV, SpO2, breathing quality, respiratory rate + +### Known (from user profile / historical data) +- Age, location, climate, experience level +- Running history, personal records, trend lines +- Motivation triggers (gamification: 1km = 2k Ft, structure = mood anchor) +- Schedule patterns (home office vs. office days) +- Sleep chronotype (night owl, shifted from habit not biology) + +--- + +## 2. Processing Pipeline + +| Step | What | Example from today | +|------|------|-------------------| +| **Data pull** | Fetch external conditions | Weather API → 27°C at 6 AM, 33°C by 9 AM → morning-only window | +| **Constraint mapping** | Backward plan from hard deadline | 9 AM meeting → wake → 30 min run → shower → breakfast → coffee → desk | +| **Reality check** | Compare plan against user profile | "Wake at 6:30" vs "never falls asleep before 2 AM" → adjust to 7:15 | +| **Negotiation** | User pushes back with constraints → AI adapts | "I can't do 5 AM, best I can do is 7:30" → recalculate | +| **Image ingestion** | OCR screenshots → extract structured data | easyocr on Huawei Health → parse pace, distance, sleep breakdown | +| **Cross-reference** | Connect sleep data to run performance | 5'52"/km on 5% REM → "your cardiovascular fitness held, your sleep architecture didn't" | +| **Interpretation** | Data + self-report → meaningful story | Pace numbers mean nothing without "this felt great" — the two together tell the real story | +| **Recalibration** | AI misunderstands → user corrects → AI adapts | "Didn't go anywhere" = surprise at maintained fitness, not frustration | + +--- + +## 3. Conversation Architecture (3-Act Pattern) + +### Act 1: Pre-Run Planning +- User asks "what should I do?" +- AI pulls data (weather, time, user profile) +- AI proposes plan with reasoning +- User pushes back with real-life constraints +- AI adjusts +- Agreement reached + +### Act 2: Post-Run Analysis +- User shares run data (screenshots or device sync) +- AI extracts structured data +- User gives self-assessment ("how it felt") +- AI interprets data against self-assessment +- Real story emerges + +### Act 3: Meta-Reflection +- User explains *why* something happened (e.g. racing mind at night) +- AI reframes or validates +- User confirms / elaborates +- Next-day plan naturally forms + +--- + +## 4. Key Insight: Data Alone Is Useless + +> The most valuable part was never the data alone. It was the data + user self-report + AI interpretation connecting the two. + +| Raw Data | User Self-Report | Interpretation | +|----------|-----------------|----------------| +| 5'52"/km pace | "Felt great, feet were fine" | Fitness held through 2-week break | +| 5% REM sleep | "Mind was racing with plans" | Circadian disruption + excitement, not anxiety | +| 6h 31min total sleep | "I know how sleep issues work, it is what it is" | Mature mindset, no panic cycle | +| 47 bpm resting HR | "Never ran in the morning before" | Cardiovascular base is solid even on bad sleep | + +--- + +## 5. Onboarding: The Lifestyle Interview + +> Idea: when you first open the app, it interviews you about lifestyle factors that affect performance but that no fitness app asks about. + +### Interview Topics + +| Category | What It Asks | Why It Matters | +|----------|-------------|----------------| +| **Smoking** | Do you smoke? How much / how often? | Affects lung capacity, heart rate zones, recovery speed, REM sleep reduction | +| **Alcohol** | How often do you drink? Pattern (social/weekends/daily)? | Disrupts REM sleep, elevates resting HR for 24-48h, dehydrates, kills morning motivation | +| **Caffeine** | When's your last coffee of the day? | After 2 PM → delayed sleep onset, reduced deep sleep | +| **Sleep chronotype** | Are you naturally an early bird or night owl? | Determines realistic wake windows, not generic "wake at 5 AM" advice | +| **Work schedule** | Office days? Remote days? Fixed meeting times? | Maps hard constraints for run scheduling | +| **Eating patterns** | Do you eat before running? What time is dinner usually? | Empty stomach OK for short runs, late dinner → poor sleep → bad run next morning | +| **Motivation style** | What keeps you going? Streaks? Data? Competition? Gamification? | Personalizes the AI's tone and nudges | +| **Previous injuries** | Feet? Knees? Back? Anything that flares up? | Adjusts distance/pace recommendations, surface suggestions | +| **Running history** | Ever run before? How long ago? Best streak? What killed it? | Context for comebacks, avoids treating a returner like a beginner | +| **Mental health context** | Does running help your mood? Is it an anchor for structure? | Changes the framing — "discipline" vs "medicine" vs "performance" | + +### Design Principle + +The interview should feel like a conversation, not a form. One question at a time, follow-ups based on answers. Example: + +> *"Do you smoke?"* +> → Yes +> *"Got it. Roughly how much per day?"* +> → 5-6 +> *"Thanks — that helps me understand your heart rate zones and recovery better. Next: how often do you have a drink?"* + +This is how the AI builds its mental model of you before you've ever run. + +--- + +## 6. Product Identity: Not a Tracker — An AI Agent for Health & Sports + +> The user realized: *"I am kinda imagining an AI agent but for health and sports."* + +### Agent vs. Tracker + +| Tracker App | AI Health Agent | +|-------------|-----------------| +| Shows you what you did | Talks to you about what it means | +| Charts and graphs | Stories and insights | +| Generic goals ("10,000 steps") | Personalized context ("you slept 5h, 30 min easy run today") | +| You tell it things | It asks you things | +| Silent between workouts | Checks in, connects today to yesterday | +| Feature parity with competitors | Relationship with the user | + +### Core Agent Behaviors + +1. **Remembers** — your history, your patterns, your excuses, your breakthroughs +2. **Connects** — sleep data → run performance → lifestyle factors → mood → next recommendation +3. **Negotiates** — proposes a plan, you push back, it adapts. Not a dictator. +4. **Self-corrects** — misunderstands, you clarify, it learns. Trust through being wrong sometimes. +5. **Contextualizes** — 5'52/km means nothing alone. "5'52/km as a smoker on 5% REM sleep after 2 weeks off, first morning run ever" means everything. +6. **Uses your language** — motivation system (gamification 1km = 2k Ft), metaphors you respond to, tone that fits your personality + +### What It Replaces + +Not just your fitness tracker. It replaces: +- The training plan you never follow +- The sleep journal you never write in +- The "how did I feel last time" you can't remember +- The motivation you lose between runs +- The coach you can't afford + +### Priority Hierarchy for the Agent + +As the user defined it: + +> *"Raw exercise data > nutrition > sleep data > mental context. Sleep is already an extra — important, maybe the most important, but yeah."* + +| Layer | What it includes | Role in the conversation | +|-------|-----------------|------------------------| +| **Exercise data** | Pace, distance, HR, cadence, route, calories, duration | Primary subject. The reason the app exists. All insights should eventually tie back to this. | +| **Nutrition** | Pre/post-run eating, hydration, timing | Secondary. Context for performance ("you ran on empty stomach / after a heavy meal"). | +| **Sleep data** | Duration, deep/REM/light, HRV, resting HR, SpO2, breathing quality | Critical context. The strongest modifier of exercise performance. The agent should always check sleep before interpreting a run. | +| **Mental context** | Work stress, procrastination, anxiety, home office patterns | Background context. Valuable when it explains anomalies (good sleep + good physicals → bad performance = likely mental factor). Should not be the main topic of conversation unless the user brings it up. | + +### The Home Office Connection + +This morning was a concrete example: the user dreads home office days — doomscrolling, instant morning meetings bombarding his brain with information, procrastination on hard tasks (rewriting Angular 11 → 21 with zero frontend experience). + +**The morning run changed the HO experience:** + +| Before (no run) | After (with run) | +|----------------|-----------------| +| Wake up → instantly into morning meeting → information overload | Wake up → run → shower → breakfast → coffee → *then* meeting | +| Brain starts in reactive mode | Brain starts with agency | +| Doomscrolls instead of working | Felt anxiety, recognized it, calmed down with binaural beats, then worked for 3 hours | +| Avoids the hard task for a week | Finally sits down to do it | + +The run didn't make the task easier. It made the user **ready** to face it. The agent should recognize this pattern: when the user reports procrastination or HO dread, suggest anchoring the day with exercise first. The agent is not a therapist, but it knows that movement breaks avoidance loops. + +--- + +## 7. Required Features for SportNote + +### Must Have +1. **OCR / image ingestion** — users share watch screenshots; manual entry kills adoption +2. **Sleep + run correlation** — the killer feature no app has in one sentence +3. **User profile with persistent memory** — location, age, running history, chronotype, motivation system +4. **Lifestyle factors** — smoking, alcohol, caffeine, eating patterns, previous injuries → all affect performance interpretation +5. **Onboarding interview** — conversational first-run experience that builds the AI's model of you +6. **Self-reporting input** — "how did it feel?" as important as wearables +7. **Weather-aware planning** — time-window recommendations based on heat/conditions +8. **Conversational structure** — 3-act pattern (plan → analyze → reflect) with natural back-and-forth + +### Should Have +9. **Misunderstanding as a feature** — AI gets things wrong, user corrects, trust builds +10. **Trend comparison** — this run vs. average, vs. last run, vs. peak performance +11. **Constraint-aware scheduling** — meeting times, office days, realistic wake windows +12. **Motivation system integration** — gamification (1km = 2k Ft), streak tracking, "structure = mood" + +### Nice to Have +13. Route suggestions based on weather + shade +14. Pre-run nutrition guidance based on distance + time of day +15. Sleep hygiene nudges ("consistent wake time > early bedtime") + +--- + +## 8. Today's Top 5 Actionable Insights + +| # | Insight | Source | +|---|---------|--------| +| 1 | Fitness held through 2-week break — pace matched previous peak | OCR + self-report | +| 2 | REM sleep at 5% = circadian rhythm still off from late nights | Sleep screenshot | +| 3 | Racing mind before sleep = excitement/anticipation, not anxiety | Self-report + reframe | +| 4 | Weather window (27°C at 6 AM, 33°C by 9 AM) forced morning slot | wttr.in API | +| 5 | 30 min run is comeback sweet spot — short enough to commit, long enough to feel it | Negotiated from constraints | + +--- + +## 9. Historical Benchmarking + +> When we have previous run data, use it as a benchmark — not just for numbers, but for **how the run felt**. + +### Benchmark Dimensions + +| Dimension | Data Source | Example | +|-----------|------------|---------| +| **Performance** | Pace, distance, HR zones | Today's 5'52"/km vs. historical average | +| **Recovery** | Sleep quality before run, HRV, resting HR | 5% REM tonight vs. a well-rested night's 20%+ REM | +| **Feel** | Self-reported RPE / free text | "Felt great" vs. "last run was a nightmare" | +| **Conditions** | Weather, time of day, route | 27°C morning → 33°C by 9 AM forced the morning slot | +| **Context** | Life factors | First morning run ever, comeback after 2 weeks off | + +### How the Benchmarking Works + +1. **On data import**: compare raw numbers to last 5 runs, last 30 days, and all-time personal records +2. **On self-report**: if the user says "felt great" but pace was 30s/km slower than average → that's a story (maybe weather, maybe intentional easy day) +3. **On self-report mismatch**: if pace is *better* than usual but user feels bad → possible overtraining or illness signal +4. **The benchmark is never the conclusion, it's the conversation starter**: "You beat your average pace by 15s/km, and your REM sleep was only 5%. What does that tell you?" + +### Today's Example + +Today I didn't have your historical run data in structured form. But you provided the benchmark verbally: + +> *"It felt like I was continuing on one of my highest performance. The previous run was an actual nightmare: bad footing, really big heat, really bad heart rate."* + +That self-provided benchmark was more useful than any numerical comparison I could have pulled. Your memory of the *feel* of the last bad run gave today's run its meaning. **SportNote should prompt this: "Compared to your last run, how was this one?"** — and file both the data and the answer. + +--- + +## 10. Screenshot Extraction: Edge Over Other AI Models + +> *"Whenever I used an AI chat before, none could export the data from the pictures this well like you did. Did not matter if it was the Gemini Pro model or the DeepSeek-v4 Expert, none did a job this great."* + +### What Made the Difference + +Most AI chats treat screenshots as images to *describe* — they'll tell you "it's a Huawei Health screenshot showing a run." They won't actually extract structured data from it unless you're in a dedicated vision model with clear instructions. + +What worked here: + +| Factor | Why It Mattered | +|--------|-----------------| +| **Screenshot = task, not object** | I treated the image as data to extract, not a picture to describe | +| **OCR via easyocr** | Instead of relying on the model's vision capabilities, I installed a dedicated Python OCR pipeline at runtime | +| **Tall scrolling captures (12,000px)** | I cropped to the relevant top section (first 2,000px) rather than feeding the whole 12,321px image into a context window | +| **Structured parsing** | I didn't just dump raw OCR text — I parsed and formatted it into readable tables | +| **Sleep + run correlation** | Most AIs would process each screenshot separately. I connected the sleep data to the run data in a single interpretation | + +### Implication for SportNote + +A general-purpose chat model might not be enough for this. SportNote needs either: + +- **A dedicated vision + OCR pipeline** that extracts numeric data from watch app screenshots before the LLM sees it +- **A vision-capable LLM** with strong OCR that can process these screenshots natively (this may improve as models evolve, but today's approach worked better than Gemini Pro / DeepSeek-v4 Expert) +- **Or better yet: direct API/Bluetooth import** so users never need to screenshot in the first place. Screenshots are a workaround for a missing integration. + +The multi-step approach (crop → OCR → parse → correlate) outperformed single-pass vision models because each step was specialized, not generic. + +--- + +## 11. Vault Structure & Daily Logging + +The Obsidian vault is organized as a three-tier memory system (inspired by the r/hermesagent community): + +| Tier | What | Where | Purpose | +|------|------|-------|---------| +| **Hot Memory** | Built-in Hermes memory (~5K chars) | Injected every turn | Preferences, corrections, fast facts | +| **Vault Living Files** | Stable reference | `System/Assistant/*.md` | context.md, preferences.md, environment.md | +| **Daily Notes** | Timestamped logs | `Runs/`, `Sleep/`, `Daily/` | Searchable permanent history | + +### Folder Structure + +``` +Vault/ +├── Runs/ # Run logs with full structured data +│ └── YYYY-MM-DD.md # distance, pace, HR, route, conditions, self-report +├── Sleep/ # Sleep logs with vitals +│ └── YYYY-MM-DD.md # duration, REM/Deep/Light %, HRV, SpO2, personal notes +├── Daily/ # Broad daily logs (future) +│ └── YYYY-MM-DD.md # tasks, schedule, events, wins +├── System/ +│ └── Assistant/ +│ ├── context.md # User profile, lifestyle, health, equipment +│ ├── preferences.md # Communication style, priority hierarchy, vault rules +│ └── environment.md # Hardware, services, paths, known issues +└── index.md # Vault root with wiki-links to everything +``` + +### Run Log Template (example from 2026-06-29) + +```yaml +--- +date: YYYY-MM-DD +type: run +tags: [run, morning, comeback] +--- + +# Run — YYYY-MM-DD + +## Activity Data +- Distance, duration, pace, speed, cadence, stride, calories + +## Route +- Location, area + +## Conditions +- Temperature, weather, wind, time of day + +## Self-Report +> Free-text feeling. This is as important as the structured data. + +## Pre-Run Sleep +- Cross-reference to [[Sleep/YYYY-MM-DD]] + +## Post-Run Notes +- How the day went, anxiety/work context, anything notable + +## Connected Notes +- [[Sleep/YYYY-MM-DD]] +- [[sportnote-blueprint]] +``` + +### Sleep Log Template (example from 2026-06-28→29) + +```yaml +--- +date: YYYY-MM-DD +type: sleep +tags: [sleep, recovery] +--- + +# Sleep — YYYY-MM-DD → YYYY-MM-DD+1 + +## Overview +- Total, deep/light/REM %, times awoke, deep sleep continuity + +## Vital Signs +- Avg HR, HRV, SpO2, breathing quality, respiratory rate + +## Self-Report +- Subjective experience, what affected the sleep + +## Analysis +- Interpretation: what the numbers mean for recovery +``` + +### Key Principle + +> Raw exercise data > nutrition > sleep data > mental context. +> +> Sleep is the most important modifier of performance. +> Mental context stays background unless the user brings it up. +> +> Every run log cross-references the sleep from the night before. +> Every analysis starts with the data, interprets with sleep, and contextualizes with mental/ work factors last. + +--- + +## 12. Design Principles (Derived from Initial Testing) + +The first test session (2-day streak with a novice runner) revealed these general patterns the app should account for: + +### Sleep Recovery Can Be Fast + +Consistent wake time (even if not early) drives earlier bedtime naturally within 1-2 days. The app should: +- Never push unrealistic wake times +- Let the user's actual wake window drive schedule recommendations +- Track REM% as a leading indicator of recovery quality, not just total sleep duration + +### Consecutive-Day Fatigue + +Back-to-back runs after a break will feel *harder* on Day 2 even with better sleep. The app should: +- Expect "slower + sleepier" self-report on Day 2 +- Recommend easier pace, not longer distance, for consecutive days +- Ask "how hard was waking up today?" as a fatigue gauge + +### Caffeine Timing as a Variable + +Poor sleep + immediate post-run coffee → measurable anxiety/fight-or-flight response in some users. The app should: +- Track coffee timing relative to run end time +- Suggest delaying coffee by 45-60 min on low-sleep nights +- Correlate caffeine timing with self-reported anxiety + +### Physical Constraints Must Be Known Upfront + +Learned via conversation, not predefined forms. The app should: +- Discover limitations (flat feet, past injuries, shoe distance limits) through natural conversation, not a checklist +- Store them as immutable constraints that affect distance/pace recommendations +- Never recommend distances past known equipment limits without a warning + +### Lean Data Storage + +Initial testing confirmed that ~80% of wearable metrics are noise for a novice user. The app should: + +**Store:** +- Distance, duration, pace, pace by km +- Avg HR, max HR, HR zone breakdown +- HR recovery (2 min drop after run) +- Cadence avg + max +- Sleep: total, REM%, deep%, HRV, resting HR +- Self-report (free text) +- Caffeine timing + +**Skip:** +- Ground contact time +- Vertical oscillation +- Balance left-right +- Stride length +- Training load / proprietary scores +- Recovery time (estimated by watch) +- Elevation gain/loss (unless route is notably hilly) + +Every stored metric should answer: *"Would this change my advice?"* + +### Self-Regulation as a Positive Signal + +When a user intentionally runs slower but further, that's pacing awareness — a learned skill. The app should: +- Praise pacing decisions, not just speed +- Help users notice pacing patterns (consistent first-km adrenaline, positive splits) +- Track behavioral trends (are they learning to pace? or always going out too fast?) + +### Schedule Awareness + +Home office vs. office days affect available time and mental energy. The app should: +- Know commute days +- Adjust recommendations accordingly +- Recognize that office days compress the morning window, HO days relax it + +### Lean Log Format + +A ~14-line template per run replaces verbose form data. Every field is chosen because it would change the agent's interpretation or advice. + +--- + +## 13. Related Notes + +- [[Running Log]] — daily run entries +- [[Sleep Tracking]] — sleep quality trends +- [[SportNote Architecture]] — tech stack & design decisions