diff --git a/.obsidian/app 2.json b/.obsidian/app 2.json new file mode 100644 index 0000000..020ed0d --- /dev/null +++ b/.obsidian/app 2.json @@ -0,0 +1,11 @@ +{ + "alwaysUpdateLinks": true, + "promptDelete": false, + "pdfExportSettings": { + "includeName": true, + "pageSize": "Letter", + "landscape": false, + "margin": "0", + "downscalePercent": 100 + } +} \ No newline at end of file diff --git a/.obsidian/app(1).json b/.obsidian/app(1).json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/app(1).json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/app.json b/.obsidian/app.json index 020ed0d..5ae1b47 100644 --- a/.obsidian/app.json +++ b/.obsidian/app.json @@ -1,11 +1,12 @@ -{ - "alwaysUpdateLinks": true, - "promptDelete": false, - "pdfExportSettings": { - "includeName": true, - "pageSize": "Letter", - "landscape": false, - "margin": "0", - "downscalePercent": 100 - } +{} +{ + "alwaysUpdateLinks": true, + "promptDelete": false, + "pdfExportSettings": { + "includeName": true, + "pageSize": "Letter", + "landscape": false, + "margin": "0", + "downscalePercent": 100 + } } \ No newline at end of file diff --git a/.obsidian/appearance(1).json b/.obsidian/appearance(1).json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/appearance(1).json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/community-plugins 2.json b/.obsidian/community-plugins 2.json new file mode 100644 index 0000000..e0667d8 --- /dev/null +++ b/.obsidian/community-plugins 2.json @@ -0,0 +1,7 @@ +[ + "obsidian-git", + "obsidian-importer", + "numerals", + "nldates-obsidian", + "calendar" +] \ No newline at end of file diff --git a/.obsidian/community-plugins 3.json b/.obsidian/community-plugins 3.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/.obsidian/community-plugins 3.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/.obsidian/community-plugins 4.json b/.obsidian/community-plugins 4.json new file mode 100644 index 0000000..fbb9884 --- /dev/null +++ b/.obsidian/community-plugins 4.json @@ -0,0 +1,4 @@ +[ + "nldates-obsidian", + "obsidian-importer" +] \ No newline at end of file diff --git a/.obsidian/community-plugins 5.json b/.obsidian/community-plugins 5.json new file mode 100644 index 0000000..22a98f0 --- /dev/null +++ b/.obsidian/community-plugins 5.json @@ -0,0 +1,7 @@ +[ + "nldates-obsidian", + "obsidian-importer", + "obsidian-git", + "calendar", + "numerals" +] \ No newline at end of file diff --git a/.obsidian/community-plugins(1).json b/.obsidian/community-plugins(1).json new file mode 100644 index 0000000..d3f66fa --- /dev/null +++ b/.obsidian/community-plugins(1).json @@ -0,0 +1,3 @@ +[ + "obsidian-git" +] \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json index 8343b94..8db9bca 100644 --- a/.obsidian/community-plugins.json +++ b/.obsidian/community-plugins.json @@ -1,8 +1,12 @@ [ - "obsidian-git", - "obsidian-importer", - "numerals", "nldates-obsidian", +<<<<<<< HEAD "calendar", "obsidian-read-it-later" +======= + "obsidian-importer", + "calendar", + "numerals", + "obsidian-git" +>>>>>>> origin/main ] \ No newline at end of file diff --git a/.obsidian/core-plugins 2.json b/.obsidian/core-plugins 2.json new file mode 100644 index 0000000..da4f2de --- /dev/null +++ b/.obsidian/core-plugins 2.json @@ -0,0 +1,30 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "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": true, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": false +} \ No newline at end of file diff --git a/.obsidian/core-plugins(1).json b/.obsidian/core-plugins(1).json new file mode 100644 index 0000000..436f43c --- /dev/null +++ b/.obsidian/core-plugins(1).json @@ -0,0 +1,30 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": false, + "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": false +} \ No newline at end of file diff --git a/.obsidian/core-plugins-migration 2.json b/.obsidian/core-plugins-migration 2.json new file mode 100644 index 0000000..da4f2de --- /dev/null +++ b/.obsidian/core-plugins-migration 2.json @@ -0,0 +1,30 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "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": true, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": false +} \ No newline at end of file diff --git a/.obsidian/core-plugins-migration(1).json b/.obsidian/core-plugins-migration(1).json new file mode 100644 index 0000000..436f43c --- /dev/null +++ b/.obsidian/core-plugins-migration(1).json @@ -0,0 +1,30 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": false, + "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": false +} \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json index da4f2de..4377320 100644 --- a/.obsidian/core-plugins.json +++ b/.obsidian/core-plugins.json @@ -27,4 +27,34 @@ "file-recovery": true, "publish": false, "sync": false +} +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": false, + "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": false } \ No newline at end of file diff --git a/.obsidian/plugins(1)/obsidian-git/data.json b/.obsidian/plugins(1)/obsidian-git/data.json new file mode 100644 index 0000000..c11a74b --- /dev/null +++ b/.obsidian/plugins(1)/obsidian-git/data.json @@ -0,0 +1,56 @@ +{ + "commitMessage": "vault backup: {{date}}", + "commitDateFormat": "YYYY-MM-DD HH:mm:ss", + "autoSaveInterval": 0, + "autoPushInterval": 0, + "autoPullInterval": 0, + "autoPullOnBoot": false, + "disablePush": false, + "pullBeforePush": true, + "disablePopups": false, + "disablePopupsForNoChanges": false, + "listChangedFilesInMessageBody": false, + "showStatusBar": true, + "updateSubmodules": false, + "syncMethod": "merge", + "customMessageOnAutoBackup": false, + "autoBackupAfterFileChange": false, + "treeStructure": false, + "refreshSourceControl": false, + "basePath": "", + "differentIntervalCommitAndPush": false, + "changedFilesInStatusBar": false, + "showedMobileNotice": true, + "refreshSourceControlTimer": 7000, + "showBranchStatusBar": true, + "setLastSaveToLastCommit": false, + "submoduleRecurseCheckout": false, + "gitDir": "", + "showFileMenu": true, + "authorInHistoryView": "hide", + "dateInHistoryView": false, + "lineAuthor": { + "show": false, + "followMovement": "inactive", + "authorDisplay": "initials", + "showCommitHash": false, + "dateTimeFormatOptions": "date", + "dateTimeFormatCustomString": "YYYY-MM-DD HH:mm", + "dateTimeTimezone": "viewer-local", + "coloringMaxAge": "1y", + "colorNew": { + "r": 255, + "g": 150, + "b": 150 + }, + "colorOld": { + "r": 120, + "g": 160, + "b": 255 + }, + "textColorCss": "var(--text-muted)", + "ignoreWhitespace": false, + "gutterSpacingFallbackLength": 5 + }, + "autoCommitMessage": "vault backup: {{date}}" +} \ No newline at end of file diff --git a/.obsidian/plugins(1)/obsidian-git/main.js b/.obsidian/plugins(1)/obsidian-git/main.js new file mode 100644 index 0000000..c2859ac --- /dev/null +++ b/.obsidian/plugins(1)/obsidian-git/main.js @@ -0,0 +1,350 @@ +/* +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 xk=Object.create;var ka=Object.defineProperty;var _k=Object.getOwnPropertyDescriptor;var Sk=Object.getOwnPropertyNames;var Ek=Object.getPrototypeOf,kk=Object.prototype.hasOwnProperty;var Ak=(t,e,n)=>e in t?ka(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Tk=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ck=(t,e)=>{for(var n in e)ka(t,n,{get:e[n],enumerable:!0})},Gp=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Sk(e))!kk.call(t,i)&&i!==n&&ka(t,i,{get:()=>e[i],enumerable:!(r=_k(e,i))||r.enumerable});return t};var Ve=(t,e,n)=>(n=t!=null?xk(Ek(t)):{},Gp(e||!t||!t.__esModule?ka(n,"default",{value:t,enumerable:!0}):n,t)),Fk=t=>Gp(ka({},"__esModule",{value:!0}),t);var ot=(t,e,n)=>Ak(t,typeof e!="symbol"?e+"":e,n);var qp=L(so=>{"use strict";v();so.byteLength=Ok;so.toByteArray=Pk;so.fromByteArray=jk;var mn=[],Yt=[],Mk=typeof Uint8Array!="undefined"?Uint8Array:Array,ru="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tr=0,Vp=ru.length;Tr0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function Ok(t){var e=Wp(t),n=e[0],r=e[1];return(n+r)*3/4-r}function Ik(t,e,n){return(e+n)*3/4-n}function Pk(t){var e,n=Wp(t),r=n[0],i=n[1],a=new Mk(Ik(t,r,i)),s=0,o=i>0?r-4:r,l;for(l=0;l>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Yt[t.charCodeAt(l)]<<2|Yt[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Yt[t.charCodeAt(l)]<<10|Yt[t.charCodeAt(l+1)]<<4|Yt[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Rk(t){return mn[t>>18&63]+mn[t>>12&63]+mn[t>>6&63]+mn[t&63]}function Lk(t,e,n){for(var r,i=[],a=e;ao?o:s+a));return r===1?(e=t[n-1],i.push(mn[e>>2]+mn[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(mn[e>>10]+mn[e>>4&63]+mn[e<<2&63]+"=")),i.join("")}});var Xp=L(iu=>{v();iu.read=function(t,e,n,r,i){var a,s,o=i*8-r-1,l=(1<>1,u=-7,f=n?i-1:0,d=n?-1:1,h=t[e+f];for(f+=d,a=h&(1<<-u)-1,h>>=-u,u+=o;u>0;a=a*256+t[e+f],f+=d,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=r;u>0;s=s*256+t[e+f],f+=d,u-=8);if(a===0)a=1-c;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-c}return(h?-1:1)*s*Math.pow(2,a-r)};iu.write=function(t,e,n,r,i,a){var s,o,l,c=a*8-i-1,u=(1<>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,p=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+h]=o&255,h+=p,o/=256,i-=8);for(s=s<0;t[n+h]=s&255,h+=p,s/=256,c-=8);t[n+h-p]|=m*128}});var hu=L(ci=>{"use strict";v();var au=qp(),oi=Xp(),Yp=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ci.Buffer=I;ci.SlowBuffer=Uk;ci.INSPECT_MAX_BYTES=50;var oo=2147483647;ci.kMaxLength=oo;I.TYPED_ARRAY_SUPPORT=Dk();!I.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 Dk(){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(I.prototype,"parent",{enumerable:!0,get:function(){if(I.isBuffer(this))return this.buffer}});Object.defineProperty(I.prototype,"offset",{enumerable:!0,get:function(){if(I.isBuffer(this))return this.byteOffset}});function Pn(t){if(t>oo)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,I.prototype),e}function I(t,e,n){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return cu(t)}return Jp(t,e,n)}I.poolSize=8192;function Jp(t,e,n){if(typeof t=="string")return Nk(t,e);if(ArrayBuffer.isView(t))return $k(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(gn(t,ArrayBuffer)||t&&gn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(gn(t,SharedArrayBuffer)||t&&gn(t.buffer,SharedArrayBuffer)))return ou(t,e,n);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return I.from(r,e,n);let i=Hk(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return I.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}I.from=function(t,e,n){return Jp(t,e,n)};Object.setPrototypeOf(I.prototype,Uint8Array.prototype);Object.setPrototypeOf(I,Uint8Array);function em(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 Bk(t,e,n){return em(t),t<=0?Pn(t):e!==void 0?typeof n=="string"?Pn(t).fill(e,n):Pn(t).fill(e):Pn(t)}I.alloc=function(t,e,n){return Bk(t,e,n)};function cu(t){return em(t),Pn(t<0?0:uu(t)|0)}I.allocUnsafe=function(t){return cu(t)};I.allocUnsafeSlow=function(t){return cu(t)};function Nk(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!I.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=tm(t,e)|0,r=Pn(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function su(t){let e=t.length<0?0:uu(t.length)|0,n=Pn(e);for(let r=0;r=oo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oo.toString(16)+" bytes");return t|0}function Uk(t){return+t!=t&&(t=0),I.alloc(+t)}I.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==I.prototype};I.compare=function(e,n){if(gn(e,Uint8Array)&&(e=I.from(e,e.offset,e.byteLength)),gn(n,Uint8Array)&&(n=I.from(n,n.offset,n.byteLength)),!I.isBuffer(e)||!I.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===n)return 0;let r=e.length,i=n.length;for(let a=0,s=Math.min(r,i);ai.length?(I.isBuffer(s)||(s=I.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(I.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function tm(t,e){if(I.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||gn(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 n=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return lu(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return um(t).length;default:if(i)return r?-1:lu(t).length;e=(""+e).toLowerCase(),i=!0}}I.byteLength=tm;function zk(t,e,n){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Jk(this,e,n);case"utf8":case"utf-8":return rm(this,e,n);case"ascii":return Kk(this,e,n);case"latin1":case"binary":return Qk(this,e,n);case"base64":return Yk(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return eA(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}I.prototype._isBuffer=!0;function Cr(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}I.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 n=0;nn&&(e+=" ... "),""};Yp&&(I.prototype[Yp]=I.prototype.inspect);I.prototype.compare=function(e,n,r,i,a){if(gn(e,Uint8Array)&&(e=I.from(e,e.offset,e.byteLength)),!I.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(n===void 0&&(n=0),r===void 0&&(r=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),n<0||r>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&n>=r)return 0;if(i>=a)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,a>>>=0,this===e)return 0;let s=a-i,o=r-n,l=Math.min(s,o),c=this.slice(i,a),u=e.slice(n,r);for(let f=0;f2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,du(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof e=="string"&&(e=I.from(e,r)),I.isBuffer(e))return e.length===0?-1:Zp(t,e,n,r,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):Zp(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Zp(t,e,n,r,i){let a=1,s=t.length,o=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;a=2,s/=2,o/=2,n/=2}function l(u,f){return a===1?u[f]:u.readUInt16BE(f*a)}let c;if(i){let u=-1;for(c=n;cs&&(n=s-o),c=n;c>=0;c--){let u=!0;for(let f=0;fi&&(r=i)):r=i;let a=e.length;r>a/2&&(r=a/2);let s;for(s=0;s>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-n;if((r===void 0||r>a)&&(r=a),e.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return Gk(this,e,n,r);case"utf8":case"utf-8":return Vk(this,e,n,r);case"ascii":case"latin1":case"binary":return Wk(this,e,n,r);case"base64":return qk(this,e,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xk(this,e,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};I.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Yk(t,e,n){return e===0&&n===t.length?au.fromByteArray(t):au.fromByteArray(t.slice(e,n))}function rm(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i239?4:a>223?3:a>191?2:1;if(i+o<=n){let l,c,u,f;switch(o){case 1:a<128&&(s=a);break;case 2:l=t[i+1],(l&192)===128&&(f=(a&31)<<6|l&63,f>127&&(s=f));break;case 3:l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(f=(a&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(a&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=o}return Zk(r)}var Kp=4096;function Zk(t){let e=t.length;if(e<=Kp)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr)&&(n=r);let i="";for(let a=e;ar&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),nn)throw new RangeError("Trying to access beyond buffer length")}I.prototype.readUintLE=I.prototype.readUIntLE=function(e,n,r){e=e>>>0,n=n>>>0,r||lt(e,n,this.length);let i=this[e],a=1,s=0;for(;++s>>0,n=n>>>0,r||lt(e,n,this.length);let i=this[e+--n],a=1;for(;n>0&&(a*=256);)i+=this[e+--n]*a;return i};I.prototype.readUint8=I.prototype.readUInt8=function(e,n){return e=e>>>0,n||lt(e,1,this.length),this[e]};I.prototype.readUint16LE=I.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||lt(e,2,this.length),this[e]|this[e+1]<<8};I.prototype.readUint16BE=I.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||lt(e,2,this.length),this[e]<<8|this[e+1]};I.prototype.readUint32LE=I.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};I.prototype.readUint32BE=I.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};I.prototype.readBigUInt64LE=Kn(function(e){e=e>>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=n+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(i)+(BigInt(a)<>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=n*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(i)<>>0,n=n>>>0,r||lt(e,n,this.length);let i=this[e],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*n)),i};I.prototype.readIntBE=function(e,n,r){e=e>>>0,n=n>>>0,r||lt(e,n,this.length);let i=n,a=1,s=this[e+--i];for(;i>0&&(a*=256);)s+=this[e+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*n)),s};I.prototype.readInt8=function(e,n){return e=e>>>0,n||lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};I.prototype.readInt16LE=function(e,n){e=e>>>0,n||lt(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};I.prototype.readInt16BE=function(e,n){e=e>>>0,n||lt(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};I.prototype.readInt32LE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};I.prototype.readInt32BE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};I.prototype.readBigInt64LE=Kn(function(e){e=e>>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(i)<>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=(n<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,n||lt(e,4,this.length),oi.read(this,e,!0,23,4)};I.prototype.readFloatBE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),oi.read(this,e,!1,23,4)};I.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||lt(e,8,this.length),oi.read(this,e,!0,52,8)};I.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||lt(e,8,this.length),oi.read(this,e,!1,52,8)};function Ft(t,e,n,r,i,a){if(!I.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}I.prototype.writeUintLE=I.prototype.writeUIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Ft(this,e,n,r,o,0)}let a=1,s=0;for(this[n]=e&255;++s>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Ft(this,e,n,r,o,0)}let a=r-1,s=1;for(this[n+a]=e&255;--a>=0&&(s*=256);)this[n+a]=e/s&255;return n+r};I.prototype.writeUint8=I.prototype.writeUInt8=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,1,255,0),this[n]=e&255,n+1};I.prototype.writeUint16LE=I.prototype.writeUInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2};I.prototype.writeUint16BE=I.prototype.writeUInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2};I.prototype.writeUint32LE=I.prototype.writeUInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4};I.prototype.writeUint32BE=I.prototype.writeUInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function im(t,e,n,r,i){cm(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,n}function am(t,e,n,r,i){cm(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n+7]=a,a=a>>8,t[n+6]=a,a=a>>8,t[n+5]=a,a=a>>8,t[n+4]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s=s>>8,t[n+2]=s,s=s>>8,t[n+1]=s,s=s>>8,t[n]=s,n+8}I.prototype.writeBigUInt64LE=Kn(function(e,n=0){return im(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});I.prototype.writeBigUInt64BE=Kn(function(e,n=0){return am(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});I.prototype.writeIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Ft(this,e,n,r,l-1,-l)}let a=0,s=1,o=0;for(this[n]=e&255;++a>0)-o&255;return n+r};I.prototype.writeIntBE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Ft(this,e,n,r,l-1,-l)}let a=r-1,s=1,o=0;for(this[n+a]=e&255;--a>=0&&(s*=256);)e<0&&o===0&&this[n+a+1]!==0&&(o=1),this[n+a]=(e/s>>0)-o&255;return n+r};I.prototype.writeInt8=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1};I.prototype.writeInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2};I.prototype.writeInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2};I.prototype.writeInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4};I.prototype.writeInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};I.prototype.writeBigInt64LE=Kn(function(e,n=0){return im(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});I.prototype.writeBigInt64BE=Kn(function(e,n=0){return am(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function sm(t,e,n,r,i,a){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function om(t,e,n,r,i){return e=+e,n=n>>>0,i||sm(t,e,n,4,34028234663852886e22,-34028234663852886e22),oi.write(t,e,n,r,23,4),n+4}I.prototype.writeFloatLE=function(e,n,r){return om(this,e,n,!0,r)};I.prototype.writeFloatBE=function(e,n,r){return om(this,e,n,!1,r)};function lm(t,e,n,r,i){return e=+e,n=n>>>0,i||sm(t,e,n,8,17976931348623157e292,-17976931348623157e292),oi.write(t,e,n,r,52,8),n+8}I.prototype.writeDoubleLE=function(e,n,r){return lm(this,e,n,!0,r)};I.prototype.writeDoubleBE=function(e,n,r){return lm(this,e,n,!1,r)};I.prototype.copy=function(e,n,r,i){if(!I.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),n>=e.length&&(n=e.length),n||(n=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-n>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let a;if(typeof e=="number")for(a=n;a2**32?i=Qp(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=Qp(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);function Qp(t){let e="",n=t.length,r=t[0]==="-"?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function tA(t,e,n){li(e,"offset"),(t[e]===void 0||t[e+n]===void 0)&&Aa(e,t.length-(n+1))}function cm(t,e,n,r,i,a){if(t>n||t3?e===0||e===BigInt(0)?o=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:o=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:o=`>= ${e}${s} and <= ${n}${s}`,new si.ERR_OUT_OF_RANGE("value",o,t)}tA(r,i,a)}function li(t,e){if(typeof t!="number")throw new si.ERR_INVALID_ARG_TYPE(e,"number",t)}function Aa(t,e,n){throw Math.floor(t)!==t?(li(t,n),new si.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new si.ERR_BUFFER_OUT_OF_BOUNDS:new si.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}var nA=/[^+/0-9A-Za-z-_]/g;function rA(t){if(t=t.split("=")[0],t=t.trim().replace(nA,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function lu(t,e){e=e||1/0;let n,r=t.length,i=null,a=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(s+1===r){(e-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return a}function iA(t){let e=[];for(let n=0;n>8,i=n%256,a.push(i),a.push(r);return a}function um(t){return au.toByteArray(rA(t))}function lo(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function gn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function du(t){return t!==t}var sA=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Kn(t){return typeof BigInt=="undefined"?oA:t}function oA(){throw new Error("BigInt not supported")}});var fm,pu,Buffer,v=Tk(()=>{fm=require("obsidian");fm.Platform.isMobileApp?pu=hu().Buffer:pu=global.Buffer;Buffer=pu});var hm=L((_j,dm)=>{"use strict";v();var Dt=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||Dt.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Dt.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Dt.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Dt.DEFAULT_MAX_PENDING};Dt.DEFAULT_TIMEOUT=0;Dt.DEFAULT_MAX_OCCUPATION_TIME=0;Dt.DEFAULT_MAX_EXECUTION_TIME=0;Dt.DEFAULT_MAX_PENDING=1e3;Dt.prototype.acquire=function(t,e,n,r){if(Array.isArray(t))return this._acquireBatch(t,e,n,r);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof n!="function"&&(r=n,n=null,s=new this.Promise(function(b,x){i=b,a=x})),r=r||{};var o=!1,l=null,c=null,u=null,f=this,d=function(b,x,E){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||(s?x?a(x):i(E):typeof n=="function"&&n(x,E),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 x=r.maxExecutionTime||f.maxExecutionTime;if(x&&(u=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},x)),e.length===1){var E=!1;try{e(function(_,T){E||(E=!0,d(b,_,T))})}catch(_){E||(E=!0,d(b,_))}}else f._promiseTry(function(){return e()}).then(function(_){d(b,void 0,_)},function(_){d(b,_)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=r.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 m=function(){h(!0)};r.skipQueue?f.queues[t].unshift(m):f.queues[t].push(m);var g=r.timeout||f.timeout;g&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},g))}var w=r.maxOccupationTime||f.maxOccupationTime;if(w&&(c=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),s)return s};Dt.prototype._acquireBatch=function(t,e,n,r){typeof n!="function"&&(r=n,n=null);var i=this,a=function(o,l){return function(c){i.acquire(o,l,c,r)}},s=t.reduceRight(function(o,l){return a(l,o)},e);if(typeof n=="function")s(n);else return new this.Promise(function(o,l){s.length===1?s(function(c,u){c?l(c):o(u)}):o(s())})};Dt.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Dt.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};dm.exports=Dt});var mm=L((Ej,pm)=>{"use strict";v();pm.exports=hm()});var gm=L((Aj,mu)=>{v();typeof Object.create=="function"?mu.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:mu.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}});var yu=L((gu,vm)=>{v();var co=hu(),yn=co.Buffer;function ym(t,e){for(var n in t)e[n]=t[n]}yn.from&&yn.alloc&&yn.allocUnsafe&&yn.allocUnsafeSlow?vm.exports=co:(ym(co,gu),gu.Buffer=Fr);function Fr(t,e,n){return yn(t,e,n)}Fr.prototype=Object.create(yn.prototype);ym(yn,Fr);Fr.from=function(t,e,n){if(typeof t=="number")throw new TypeError("Argument must not be a number");return yn(t,e,n)};Fr.alloc=function(t,e,n){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=yn(t);return e!==void 0?typeof n=="string"?r.fill(e,n):r.fill(e):r.fill(0),r};Fr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return yn(t)};Fr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return co.SlowBuffer(t)}});var xm=L((Fj,bm)=>{v();var wm=yu().Buffer;function uo(t,e){this._block=wm.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}uo.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=wm.from(t,e));for(var n=this._block,r=this._blockSize,i=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=this._len*8;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(n&4294967295)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a};uo.prototype._update=function(){throw new Error("_update must be implemented by subclass")};bm.exports=uo});var Em=L((Oj,Sm)=>{v();var lA=gm(),_m=xm(),cA=yu().Buffer,uA=[1518500249,1859775393,-1894007588,-899497514],fA=new Array(80);function Ta(){this.init(),this._w=fA,_m.call(this,64,56)}lA(Ta,_m);Ta.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function dA(t){return t<<1|t>>>31}function hA(t){return t<<5|t>>>27}function pA(t){return t<<30|t>>>2}function mA(t,e,n,r){return t===0?e&n|~e&r:t===2?e&n|e&r|n&r:e^n^r}Ta.prototype._update=function(t){for(var e=this._w,n=this._a|0,r=this._b|0,i=this._c|0,a=this._d|0,s=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=dA(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=hA(n)+mA(c,r,i,a)+s+e[l]+uA[c]|0;s=a,a=i,i=pA(r),r=n,n=u}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Ta.prototype._hash=function(){var t=cA.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};Sm.exports=Ta});var Am=L(vu=>{v();var km;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof vu=="object"?t(vu):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(km={}):t(km={})})(function(t){t.version="1.2.2";function e(){for(var y=0,S=new Array(256),k=0;k!=256;++k)y=k,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,S[k]=y;return typeof Int32Array!="undefined"?new Int32Array(S):S}var n=e();function r(y){var S=0,k=0,C=0,M=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(C=0;C!=256;++C)M[C]=y[C];for(C=0;C!=256;++C)for(k=y[C],S=256+C;S<4096;S+=256)k=M[S]=k>>>8^y[k&255];var P=[];for(C=1;C!=16;++C)P[C-1]=typeof Int32Array!="undefined"?M.subarray(C*256,C*256+256):M.slice(C*256,C*256+256);return P}var i=r(n),a=i[0],s=i[1],o=i[2],l=i[3],c=i[4],u=i[5],f=i[6],d=i[7],h=i[8],p=i[9],m=i[10],g=i[11],w=i[12],b=i[13],x=i[14];function E(y,S){for(var k=S^-1,C=0,M=y.length;C>>8^n[(k^y.charCodeAt(C++))&255];return~k}function _(y,S){for(var k=S^-1,C=y.length-15,M=0;M>8&255]^w[y[M++]^k>>16&255]^g[y[M++]^k>>>24]^m[y[M++]]^p[y[M++]]^h[y[M++]]^d[y[M++]]^f[y[M++]]^u[y[M++]]^c[y[M++]]^l[y[M++]]^o[y[M++]]^s[y[M++]]^a[y[M++]]^n[y[M++]];for(C+=15;M>>8^n[(k^y[M++])&255];return~k}function T(y,S){for(var k=S^-1,C=0,M=y.length,P=0,$=0;C>>8^n[(k^P)&255]:P<2048?(k=k>>>8^n[(k^(192|P>>6&31))&255],k=k>>>8^n[(k^(128|P&63))&255]):P>=55296&&P<57344?(P=(P&1023)+64,$=y.charCodeAt(C++)&1023,k=k>>>8^n[(k^(240|P>>8&7))&255],k=k>>>8^n[(k^(128|P>>2&63))&255],k=k>>>8^n[(k^(128|$>>6&15|(P&3)<<4))&255],k=k>>>8^n[(k^(128|$&63))&255]):(k=k>>>8^n[(k^(224|P>>12&15))&255],k=k>>>8^n[(k^(128|P>>6&63))&255],k=k>>>8^n[(k^(128|P&63))&255]);return~k}t.table=n,t.bstr=E,t.buf=_,t.str=T})});var Rn=L(St=>{"use strict";v();var gA=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function yA(t,e){return Object.prototype.hasOwnProperty.call(t,e)}St.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)yA(n,r)&&(t[r]=n[r])}}return t};St.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var vA={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray){t.set(e.subarray(n,n+r),i);return}for(var a=0;a{"use strict";v();var bA=Rn(),xA=4,Tm=0,Cm=1,_A=2;function fi(t){for(var e=t.length;--e>=0;)t[e]=0}var SA=0,Rm=1,EA=2,kA=3,AA=258,ku=29,Pa=256,Fa=Pa+1+ku,ui=30,Au=19,Lm=2*Fa+1,Mr=15,wu=16,TA=7,Tu=256,jm=16,Dm=17,Bm=18,Su=[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],fo=[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],CA=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Nm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],FA=512,Ln=new Array((Fa+2)*2);fi(Ln);var Ca=new Array(ui*2);fi(Ca);var Ma=new Array(FA);fi(Ma);var Oa=new Array(AA-kA+1);fi(Oa);var Cu=new Array(ku);fi(Cu);var ho=new Array(ui);fi(ho);function bu(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}var $m,Hm,Um;function xu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function zm(t){return t<256?Ma[t]:Ma[256+(t>>>7)]}function Ia(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Mt(t,e,n){t.bi_valid>wu-n?(t.bi_buf|=e<>wu-t.bi_valid,t.bi_valid+=n-wu):(t.bi_buf|=e<>>=1,n<<=1;while(--e>0);return n>>>1}function MA(t){t.bi_valid===16?(Ia(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 OA(t,e){var n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,p,m=0;for(d=0;d<=Mr;d++)t.bl_count[d]=0;for(n[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(d=l,m++),n[u*2+1]=d,!(u>r)&&(t.bl_count[d]++,h=0,u>=o&&(h=s[u-o]),p=n[u*2],t.opt_len+=p*(d+h),a&&(t.static_len+=p*(i[u*2+1]+h)));if(m!==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]--,m-=2}while(m>0);for(d=l;d!==0;d--)for(u=t.bl_count[d];u!==0;)f=t.heap[--c],!(f>r)&&(n[f*2+1]!==d&&(t.opt_len+=(d-n[f*2+1])*n[f*2],n[f*2+1]=d),u--)}}function Vm(t,e,n){var r=new Array(Mr+1),i=0,a,s;for(a=1;a<=Mr;a++)r[a]=i=i+n[a-1]<<1;for(s=0;s<=e;s++){var o=t[s*2+1];o!==0&&(t[s*2]=Gm(r[o]++,o))}}function IA(){var t,e,n,r,i,a=new Array(Mr+1);for(n=0,r=0;r>=7;r8?Ia(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 PA(t,e,n,r){qm(t),r&&(Ia(t,n),Ia(t,~n)),bA.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function Fm(t,e,n,r){var i=e*2,a=n*2;return t[i]>1;s>=1;s--)_u(t,n,s);c=a;do s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],_u(t,n,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,n[c*2]=n[s*2]+n[o*2],t.depth[c]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,n[s*2+1]=n[o*2+1]=c,t.heap[1]=c++,_u(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],OA(t,e),Vm(n,l,t.bl_count)}function Om(t,e,n){var r,i=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=s,s=e[(r+1)*2+1],!(++o=3&&t.bl_tree[Nm[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function LA(t,e,n,r){var i;for(Mt(t,e-257,5),Mt(t,n-1,5),Mt(t,r-4,4),i=0;i>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return Tm;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Cm;for(n=32;n0?(t.strm.data_type===_A&&(t.strm.data_type=jA(t)),Eu(t,t.l_desc),Eu(t,t.d_desc),s=RA(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&e!==-1?Xm(t,e,n,r):t.strategy===xA||a===i?(Mt(t,(Rm<<1)+(r?1:0),3),Mm(t,Ln,Ca)):(Mt(t,(EA<<1)+(r?1:0),3),LA(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Mm(t,t.dyn_ltree,t.dyn_dtree)),Wm(t),r&&qm(t)}function $A(t,e,n){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]=n&255,t.last_lit++,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(Oa[n]+Pa+1)*2]++,t.dyn_dtree[zm(e)*2]++),t.last_lit===t.lit_bufsize-1}di._tr_init=DA;di._tr_stored_block=Xm;di._tr_flush_block=NA;di._tr_tally=$A;di._tr_align=BA});var Fu=L((Nj,Zm)=>{"use strict";v();function HA(t,e,n,r){for(var i=t&65535|0,a=t>>>16&65535|0,s=0;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+e[r++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}Zm.exports=HA});var Mu=L((Hj,Km)=>{"use strict";v();function UA(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e}var zA=UA();function GA(t,e,n,r){var i=zA,a=r+n;t^=-1;for(var s=r;s>>8^i[(t^e[s])&255];return t^-1}Km.exports=GA});var po=L((zj,Qm)=>{"use strict";v();Qm.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 og=L(xn=>{"use strict";v();var Et=Rn(),Zt=Ym(),ng=Fu(),Qn=Mu(),VA=po(),Rr=0,WA=1,qA=3,rr=4,Jm=5,bn=0,eg=1,Kt=-2,XA=-3,Ou=-5,YA=-1,ZA=1,mo=2,KA=3,QA=4,JA=0,e3=2,wo=8,t3=9,n3=15,r3=8,i3=29,a3=256,Pu=a3+1+i3,s3=30,o3=19,l3=2*Pu+1,c3=15,me=3,tr=258,on=tr+me+1,u3=32,bo=42,Ru=69,go=73,yo=91,vo=103,Or=113,La=666,rt=1,ja=2,Ir=3,mi=4,f3=3;function nr(t,e){return t.msg=VA[e],e}function tg(t){return(t<<1)-(t>4?9:0)}function er(t){for(var e=t.length;--e>=0;)t[e]=0}function Jn(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(Et.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))}function dt(t,e){Zt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Jn(t.strm)}function ve(t,e){t.pending_buf[t.pending++]=e}function Ra(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function d3(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,Et.arraySet(e,t.input,t.next_in,i,n),t.state.wrap===1?t.adler=ng(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Qn(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function rg(t,e){var n=t.max_chain_length,r=t.strstart,i,a,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-on?t.strstart-(t.w_size-on):0,c=t.window,u=t.w_mask,f=t.prev,d=t.strstart+tr,h=c[r+s-1],p=c[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(c[i+s]!==p||c[i+s-1]!==h||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&rs){if(t.match_start=e,s=a,a>=o)break;h=c[r+s-1],p=c[r+s]}}while((e=f[e&u])>l&&--n!==0);return s<=t.lookahead?s:t.lookahead}function Pr(t){var e=t.w_size,n,r,i,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-on)){Et.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,r=t.hash_size,n=r;do i=t.head[--n],t.head[n]=i>=e?i-e:0;while(--r);r=e,n=r;do i=t.prev[--n],t.prev[n]=i>=e?i-e:0;while(--r);a+=e}if(t.strm.avail_in===0)break;if(r=d3(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=r,t.lookahead+t.insert>=me)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Pr(t),t.lookahead===0&&e===Rr)return rt;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((t.strstart===0||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,dt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-on&&(dt(t,!1),t.strm.avail_out===0))return rt}return t.insert=0,e===rr?(dt(t,!0),t.strm.avail_out===0?Ir:mi):(t.strstart>t.block_start&&(dt(t,!1),t.strm.avail_out===0),rt)}function Iu(t,e){for(var n,r;;){if(t.lookahead=me&&(t.ins_h=(t.ins_h<=me)if(r=Zt._tr_tally(t,t.strstart-t.match_start,t.match_length-me),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=me){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=me&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=me-1)),t.prev_length>=me&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-me,r=Zt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-me),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<=me&&t.strstart>0&&(i=t.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){a=t.strstart+tr;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=me?(n=Zt._tr_tally(t,1,t.match_length-me),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Zt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(dt(t,!1),t.strm.avail_out===0))return rt}return t.insert=0,e===rr?(dt(t,!0),t.strm.avail_out===0?Ir:mi):t.last_lit&&(dt(t,!1),t.strm.avail_out===0)?rt:ja}function m3(t,e){for(var n;;){if(t.lookahead===0&&(Pr(t),t.lookahead===0)){if(e===Rr)return rt;break}if(t.match_length=0,n=Zt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(dt(t,!1),t.strm.avail_out===0))return rt}return t.insert=0,e===rr?(dt(t,!0),t.strm.avail_out===0?Ir:mi):t.last_lit&&(dt(t,!1),t.strm.avail_out===0)?rt:ja}function wn(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}var pi;pi=[new wn(0,0,0,0,h3),new wn(4,4,8,4,Iu),new wn(4,5,16,8,Iu),new wn(4,6,32,32,Iu),new wn(4,4,16,16,hi),new wn(8,16,32,32,hi),new wn(8,16,128,128,hi),new wn(8,32,128,256,hi),new wn(32,128,258,1024,hi),new wn(32,258,258,4096,hi)];function g3(t){t.window_size=2*t.w_size,er(t.head),t.max_lazy_match=pi[t.level].max_lazy,t.good_match=pi[t.level].good_length,t.nice_match=pi[t.level].nice_length,t.max_chain_length=pi[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=me-1,t.match_available=0,t.ins_h=0}function y3(){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=wo,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 Et.Buf16(l3*2),this.dyn_dtree=new Et.Buf16((2*s3+1)*2),this.bl_tree=new Et.Buf16((2*o3+1)*2),er(this.dyn_ltree),er(this.dyn_dtree),er(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Et.Buf16(c3+1),this.heap=new Et.Buf16(2*Pu+1),er(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Et.Buf16(2*Pu+1),er(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 ig(t){var e;return!t||!t.state?nr(t,Kt):(t.total_in=t.total_out=0,t.data_type=e3,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?bo:Or,t.adler=e.wrap===2?0:1,e.last_flush=Rr,Zt._tr_init(e),bn)}function ag(t){var e=ig(t);return e===bn&&g3(t.state),e}function v3(t,e){return!t||!t.state||t.state.wrap!==2?Kt:(t.state.gzhead=e,bn)}function sg(t,e,n,r,i,a){if(!t)return Kt;var s=1;if(e===YA&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>t3||n!==wo||r<8||r>15||e<0||e>9||a<0||a>QA)return nr(t,Kt);r===8&&(r=9);var o=new y3;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<Jm||e<0)return t?nr(t,Kt):Kt;if(r=t.state,!t.output||!t.input&&t.avail_in!==0||r.status===La&&e!==rr)return nr(t,t.avail_out===0?Ou:Kt);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===bo)if(r.wrap===2)t.adler=0,ve(r,31),ve(r,139),ve(r,8),r.gzhead?(ve(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ve(r,r.gzhead.time&255),ve(r,r.gzhead.time>>8&255),ve(r,r.gzhead.time>>16&255),ve(r,r.gzhead.time>>24&255),ve(r,r.level===9?2:r.strategy>=mo||r.level<2?4:0),ve(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ve(r,r.gzhead.extra.length&255),ve(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Qn(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Ru):(ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,r.level===9?2:r.strategy>=mo||r.level<2?4:0),ve(r,f3),r.status=Or);else{var s=wo+(r.w_bits-8<<4)<<8,o=-1;r.strategy>=mo||r.level<2?o=0:r.level<6?o=1:r.level===6?o=2:o=3,s|=o<<6,r.strstart!==0&&(s|=u3),s+=31-s%31,r.status=Or,Ra(r,s),r.strstart!==0&&(Ra(r,t.adler>>>16),Ra(r,t.adler&65535)),t.adler=1}if(r.status===Ru)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),Jn(t),i=r.pending,r.pending===r.pending_buf_size));)ve(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=go)}else r.status=go;if(r.status===go)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),Jn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.gzindex=0,r.status=yo)}else r.status=yo;if(r.status===yo)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),Jn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.status=vo)}else r.status=vo;if(r.status===vo&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Jn(t),r.pending+2<=r.pending_buf_size&&(ve(r,t.adler&255),ve(r,t.adler>>8&255),t.adler=0,r.status=Or)):r.status=Or),r.pending!==0){if(Jn(t),t.avail_out===0)return r.last_flush=-1,bn}else if(t.avail_in===0&&tg(e)<=tg(n)&&e!==rr)return nr(t,Ou);if(r.status===La&&t.avail_in!==0)return nr(t,Ou);if(t.avail_in!==0||r.lookahead!==0||e!==Rr&&r.status!==La){var l=r.strategy===mo?m3(r,e):r.strategy===KA?p3(r,e):pi[r.level].func(r,e);if((l===Ir||l===mi)&&(r.status=La),l===rt||l===Ir)return t.avail_out===0&&(r.last_flush=-1),bn;if(l===ja&&(e===WA?Zt._tr_align(r):e!==Jm&&(Zt._tr_stored_block(r,0,0,!1),e===qA&&(er(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Jn(t),t.avail_out===0))return r.last_flush=-1,bn}return e!==rr?bn:r.wrap<=0?eg:(r.wrap===2?(ve(r,t.adler&255),ve(r,t.adler>>8&255),ve(r,t.adler>>16&255),ve(r,t.adler>>24&255),ve(r,t.total_in&255),ve(r,t.total_in>>8&255),ve(r,t.total_in>>16&255),ve(r,t.total_in>>24&255)):(Ra(r,t.adler>>>16),Ra(r,t.adler&65535)),Jn(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?bn:eg)}function x3(t){var e;return!t||!t.state?Kt:(e=t.state.status,e!==bo&&e!==Ru&&e!==go&&e!==yo&&e!==vo&&e!==Or&&e!==La?nr(t,Kt):(t.state=null,e===Or?nr(t,XA):bn))}function _3(t,e){var n=e.length,r,i,a,s,o,l,c,u;if(!t||!t.state||(r=t.state,s=r.wrap,s===2||s===1&&r.status!==bo||r.lookahead))return Kt;for(s===1&&(t.adler=ng(t.adler,e,n,0)),r.wrap=0,n>=r.w_size&&(s===0&&(er(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new Et.Buf8(r.w_size),Et.arraySet(u,e,n-r.w_size,r.w_size,0),e=u,n=r.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=n,t.next_in=0,t.input=e,Pr(r);r.lookahead>=me;){i=r.strstart,a=r.lookahead-(me-1);do r.ins_h=(r.ins_h<{"use strict";v();var xo=Rn(),lg=!0,cg=!0;try{String.fromCharCode.apply(null,[0])}catch(t){lg=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){cg=!1}var Da=new xo.Buf8(256);for(jn=0;jn<256;jn++)Da[jn]=jn>=252?6:jn>=248?5:jn>=240?4:jn>=224?3:jn>=192?2:1;var jn;Da[254]=Da[254]=1;gi.string2buf=function(t){var e,n,r,i,a,s=t.length,o=0;for(i=0;i>>6,e[a++]=128|n&63):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|n&63):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|n&63);return e};function ug(t,e){if(e<65534&&(t.subarray&&cg||!t.subarray&&lg))return String.fromCharCode.apply(null,xo.shrinkBuf(t,e));for(var n="",r=0;r4){o[r++]=65533,n+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&n1){o[r++]=65533;continue}i<65536?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|i&1023)}return ug(o,r)};gi.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+Da[t[n]]>e?n:e}});var ju=L((Yj,fg)=>{"use strict";v();function S3(){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}fg.exports=S3});var mg=L($a=>{"use strict";v();var Ba=og(),Na=Rn(),Bu=Lu(),Nu=po(),E3=ju(),pg=Object.prototype.toString,k3=0,Du=4,yi=0,dg=1,hg=2,A3=-1,T3=0,C3=8;function Lr(t){if(!(this instanceof Lr))return new Lr(t);this.options=Na.assign({level:A3,method:C3,chunkSize:16384,windowBits:15,memLevel:8,strategy:T3,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 E3,this.strm.avail_out=0;var n=Ba.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==yi)throw new Error(Nu[n]);if(e.header&&Ba.deflateSetHeader(this.strm,e.header),e.dictionary){var r;if(typeof e.dictionary=="string"?r=Bu.string2buf(e.dictionary):pg.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=Ba.deflateSetDictionary(this.strm,r),n!==yi)throw new Error(Nu[n]);this._dict_set=!0}}Lr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;a=e===~~e?e:e===!0?Du:k3,typeof t=="string"?n.input=Bu.string2buf(t):pg.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Na.Buf8(r),n.next_out=0,n.avail_out=r),i=Ba.deflate(n,a),i!==dg&&i!==yi)return this.onEnd(i),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===Du||a===hg))&&(this.options.to==="string"?this.onData(Bu.buf2binstring(Na.shrinkBuf(n.output,n.next_out))):this.onData(Na.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&i!==dg);return a===Du?(i=Ba.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===yi):(a===hg&&(this.onEnd(yi),n.avail_out=0),!0)};Lr.prototype.onData=function(t){this.chunks.push(t)};Lr.prototype.onEnd=function(t){t===yi&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Na.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function $u(t,e){var n=new Lr(e);if(n.push(t,!0),n.err)throw n.msg||Nu[n.err];return n.result}function F3(t,e){return e=e||{},e.raw=!0,$u(t,e)}function M3(t,e){return e=e||{},e.gzip=!0,$u(t,e)}$a.Deflate=Lr;$a.deflate=$u;$a.deflateRaw=F3;$a.gzip=M3});var yg=L((Jj,gg)=>{"use strict";v();var _o=30,O3=12;gg.exports=function(e,n){var r,i,a,s,o,l,c,u,f,d,h,p,m,g,w,b,x,E,_,T,y,S,k,C,M;r=e.state,i=e.next_in,C=e.input,a=i+(e.avail_in-5),s=e.next_out,M=e.output,o=s-(n-e.avail_out),l=s+(e.avail_out-257),c=r.dmax,u=r.wsize,f=r.whave,d=r.wnext,h=r.window,p=r.hold,m=r.bits,g=r.lencode,w=r.distcode,b=(1<>>24,p>>>=_,m-=_,_=E>>>16&255,_===0)M[s++]=E&65535;else if(_&16){T=E&65535,_&=15,_&&(m<_&&(p+=C[i++]<>>=_,m-=_),m<15&&(p+=C[i++]<>>24,p>>>=_,m-=_,_=E>>>16&255,_&16){if(y=E&65535,_&=15,m<_&&(p+=C[i++]<c){e.msg="invalid distance too far back",r.mode=_o;break e}if(p>>>=_,m-=_,_=s-o,y>_){if(_=y-_,_>f&&r.sane){e.msg="invalid distance too far back",r.mode=_o;break e}if(S=0,k=h,d===0){if(S+=u-_,_2;)M[s++]=k[S++],M[s++]=k[S++],M[s++]=k[S++],T-=3;T&&(M[s++]=k[S++],T>1&&(M[s++]=k[S++]))}else{S=s-y;do M[s++]=M[S++],M[s++]=M[S++],M[s++]=M[S++],T-=3;while(T>2);T&&(M[s++]=M[S++],T>1&&(M[s++]=M[S++]))}}else if(_&64){e.msg="invalid distance code",r.mode=_o;break e}else{E=w[(E&65535)+(p&(1<<_)-1)];continue n}break}}else if(_&64)if(_&32){r.mode=O3;break e}else{e.msg="invalid literal/length code",r.mode=_o;break e}else{E=g[(E&65535)+(p&(1<<_)-1)];continue t}break}}while(i>3,i-=T,m-=T<<3,p&=(1<{"use strict";v();var vg=Rn(),vi=15,wg=852,bg=592,xg=0,Hu=1,_g=2,I3=[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],P3=[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],R3=[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],L3=[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];Sg.exports=function(e,n,r,i,a,s,o,l){var c=l.bits,u=0,f=0,d=0,h=0,p=0,m=0,g=0,w=0,b=0,x=0,E,_,T,y,S,k=null,C=0,M,P=new vg.Buf16(vi+1),$=new vg.Buf16(vi+1),j=null,Q=0,le,de,re;for(u=0;u<=vi;u++)P[u]=0;for(f=0;f=1&&P[h]===0;h--);if(p>h&&(p=h),h===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===xg||h!==1))return-1;for($[1]=0,u=1;uwg||e===_g&&b>bg)return 1;for(;;){le=u-g,o[f]M?(de=j[Q+o[f]],re=k[C+o[f]]):(de=96,re=0),E=1<>g)+_]=le<<24|de<<16|re|0;while(_!==0);for(E=1<>=1;if(E!==0?(x&=E-1,x+=E):x=0,f++,--P[u]===0){if(u===h)break;u=n[r+o[f]]}if(u>p&&(x&y)!==T){for(g===0&&(g=p),S+=d,m=u-g,w=1<wg||e===_g&&b>bg)return 1;T=x&y,a[T]=p<<24|m<<16|S-s|0}}return x!==0&&(a[S+x]=u-g<<24|64<<16|0),l.bits=p,0}});var a0=L(ln=>{"use strict";v();var Bt=Rn(),qu=Fu(),_n=Mu(),j3=yg(),Ha=Eg(),D3=0,Zg=1,Kg=2,kg=4,B3=5,So=6,jr=0,N3=1,$3=2,Qt=-2,Qg=-3,Xu=-4,H3=-5,Ag=8,Jg=1,Tg=2,Cg=3,Fg=4,Mg=5,Og=6,Ig=7,Pg=8,Rg=9,Lg=10,Ao=11,Dn=12,Uu=13,jg=14,zu=15,Dg=16,Bg=17,Ng=18,$g=19,Eo=20,ko=21,Hg=22,Ug=23,zg=24,Gg=25,Vg=26,Gu=27,Wg=28,qg=29,Le=30,Yu=31,U3=32,z3=852,G3=592,V3=15,W3=V3;function Xg(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function q3(){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 Bt.Buf16(320),this.work=new Bt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function e0(t){var e;return!t||!t.state?Qt:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Jg,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Bt.Buf32(z3),e.distcode=e.distdyn=new Bt.Buf32(G3),e.sane=1,e.back=-1,jr)}function t0(t){var e;return!t||!t.state?Qt:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,e0(t))}function n0(t,e){var n,r;return!t||!t.state||(r=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Qt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,t0(t))}function r0(t,e){var n,r;return t?(r=new q3,t.state=r,r.window=null,n=n0(t,e),n!==jr&&(t.state=null),n):Qt}function X3(t){return r0(t,W3)}var Yg=!0,Vu,Wu;function Y3(t){if(Yg){var e;for(Vu=new Bt.Buf32(512),Wu=new Bt.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(Ha(Zg,t.lens,0,288,Vu,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ha(Kg,t.lens,0,32,Wu,0,t.work,{bits:5}),Yg=!1}t.lencode=Vu,t.lenbits=9,t.distcode=Wu,t.distbits=5}function i0(t,e,n,r){var i,a=t.state;return a.window===null&&(a.wsize=1<=a.wsize?(Bt.arraySet(a.window,e,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),Bt.arraySet(a.window,e,n-r,i,a.wnext),r-=i,r?(Bt.arraySet(a.window,e,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=_n(n.check,k,2,0),c=0,u=0,n.mode=Tg;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=Le;break}if((c&15)!==Ag){t.msg="unknown compression method",n.mode=Le;break}if(c>>>=4,u-=4,y=(c&15)+8,n.wbits===0)n.wbits=y;else if(y>n.wbits){t.msg="invalid window size",n.mode=Le;break}n.dmax=1<>8&1),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,n.check=_n(n.check,k,2,0)),c=0,u=0,n.mode=Cg;case Cg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>8&255,k[2]=c>>>16&255,k[3]=c>>>24&255,n.check=_n(n.check,k,4,0)),c=0,u=0,n.mode=Fg;case Fg:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>8),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,n.check=_n(n.check,k,2,0)),c=0,u=0,n.mode=Mg;case Mg:if(n.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>>8&255,n.check=_n(n.check,k,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=Og;case Og:if(n.flags&1024&&(h=n.length,h>o&&(h=o),h&&(n.head&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Bt.arraySet(n.head.extra,r,a,h,y)),n.flags&512&&(n.check=_n(n.check,r,h,a)),o-=h,a+=h,n.length-=h),n.length))break e;n.length=0,n.mode=Ig;case Ig:if(n.flags&2048){if(o===0)break e;h=0;do y=r[a+h++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y));while(y&&h>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Dn;break;case Lg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>=u&7,u-=u&7,n.mode=Gu;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<>>=1,u-=1,c&3){case 0:n.mode=jg;break;case 1:if(Y3(n),n.mode=Eo,e===So){c>>>=2,u-=2;break e}break;case 2:n.mode=Bg;break;case 3:t.msg="invalid block type",n.mode=Le}c>>>=2,u-=2;break;case jg:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=Le;break}if(n.length=c&65535,c=0,u=0,n.mode=zu,e===So)break e;case zu:n.mode=Dg;case Dg:if(h=n.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;Bt.arraySet(i,r,a,h,s),o-=h,a+=h,l-=h,s+=h,n.length-=h;break}n.mode=Dn;break;case Bg:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Le;break}n.have=0,n.mode=Ng;case Ng:for(;n.have>>=3,u-=3}for(;n.have<19;)n.lens[P[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,C={bits:n.lenbits},S=Ha(D3,n.lens,0,19,n.lencode,0,n.work,C),n.lenbits=C.bits,S){t.msg="invalid code lengths set",n.mode=Le;break}n.have=0,n.mode=$g;case $g:for(;n.have>>24,b=g>>>16&255,x=g&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=w,u-=w,n.lens[n.have++]=x;else{if(x===16){for(M=w+2;u>>=w,u-=w,n.have===0){t.msg="invalid bit length repeat",n.mode=Le;break}y=n.lens[n.have-1],h=3+(c&3),c>>>=2,u-=2}else if(x===17){for(M=w+3;u>>=w,u-=w,y=0,h=3+(c&7),c>>>=3,u-=3}else{for(M=w+7;u>>=w,u-=w,y=0,h=11+(c&127),c>>>=7,u-=7}if(n.have+h>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Le;break}for(;h--;)n.lens[n.have++]=y}}if(n.mode===Le)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Le;break}if(n.lenbits=9,C={bits:n.lenbits},S=Ha(Zg,n.lens,0,n.nlen,n.lencode,0,n.work,C),n.lenbits=C.bits,S){t.msg="invalid literal/lengths set",n.mode=Le;break}if(n.distbits=6,n.distcode=n.distdyn,C={bits:n.distbits},S=Ha(Kg,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,C),n.distbits=C.bits,S){t.msg="invalid distances set",n.mode=Le;break}if(n.mode=Eo,e===So)break e;case Eo:n.mode=ko;case ko:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=a,t.avail_in=o,n.hold=c,n.bits=u,j3(t,d),s=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,o=t.avail_in,c=n.hold,u=n.bits,n.mode===Dn&&(n.back=-1);break}for(n.back=0;g=n.lencode[c&(1<>>24,b=g>>>16&255,x=g&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>E)],w=g>>>24,b=g>>>16&255,x=g&65535,!(E+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=E,u-=E,n.back+=E}if(c>>>=w,u-=w,n.back+=w,n.length=x,b===0){n.mode=Vg;break}if(b&32){n.back=-1,n.mode=Dn;break}if(b&64){t.msg="invalid literal/length code",n.mode=Le;break}n.extra=b&15,n.mode=Hg;case Hg:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Ug;case Ug:for(;g=n.distcode[c&(1<>>24,b=g>>>16&255,x=g&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>E)],w=g>>>24,b=g>>>16&255,x=g&65535,!(E+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=E,u-=E,n.back+=E}if(c>>>=w,u-=w,n.back+=w,b&64){t.msg="invalid distance code",n.mode=Le;break}n.offset=x,n.extra=b&15,n.mode=zg;case zg:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Le;break}n.mode=Gg;case Gg:if(l===0)break e;if(h=d-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Le;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=s-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[s++]=m[p++];while(--h);n.length===0&&(n.mode=ko);break;case Vg:if(l===0)break e;i[s++]=n.length,l--,n.mode=ko;break;case Gu:if(n.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<{"use strict";v();s0.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 l0=L((o7,o0)=>{"use strict";v();function eT(){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}o0.exports=eT});var u0=L(za=>{"use strict";v();var wi=a0(),Ua=Rn(),To=Lu(),We=Zu(),Ku=po(),tT=ju(),nT=l0(),c0=Object.prototype.toString;function Dr(t){if(!(this instanceof Dr))return new Dr(t);this.options=Ua.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||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new tT,this.strm.avail_out=0;var n=wi.inflateInit2(this.strm,e.windowBits);if(n!==We.Z_OK)throw new Error(Ku[n]);if(this.header=new nT,wi.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=To.string2buf(e.dictionary):c0.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=wi.inflateSetDictionary(this.strm,e.dictionary),n!==We.Z_OK)))throw new Error(Ku[n])}Dr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,s,o,l,c,u=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?We.Z_FINISH:We.Z_NO_FLUSH,typeof t=="string"?n.input=To.binstring2buf(t):c0.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Ua.Buf8(r),n.next_out=0,n.avail_out=r),a=wi.inflate(n,We.Z_NO_FLUSH),a===We.Z_NEED_DICT&&i&&(a=wi.inflateSetDictionary(this.strm,i)),a===We.Z_BUF_ERROR&&u===!0&&(a=We.Z_OK,u=!1),a!==We.Z_STREAM_END&&a!==We.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===We.Z_STREAM_END||n.avail_in===0&&(s===We.Z_FINISH||s===We.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=To.utf8border(n.output,n.next_out),l=n.next_out-o,c=To.buf2string(n.output,o),n.next_out=l,n.avail_out=r-l,l&&Ua.arraySet(n.output,n.output,o,l,0),this.onData(c)):this.onData(Ua.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(u=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==We.Z_STREAM_END);return a===We.Z_STREAM_END&&(s=We.Z_FINISH),s===We.Z_FINISH?(a=wi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===We.Z_OK):(s===We.Z_SYNC_FLUSH&&(this.onEnd(We.Z_OK),n.avail_out=0),!0)};Dr.prototype.onData=function(t){this.chunks.push(t)};Dr.prototype.onEnd=function(t){t===We.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ua.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Qu(t,e){var n=new Dr(e);if(n.push(t,!0),n.err)throw n.msg||Ku[n.err];return n.result}function rT(t,e){return e=e||{},e.raw=!0,Qu(t,e)}za.Inflate=Dr;za.inflate=Qu;za.inflateRaw=rT;za.ungzip=Qu});var h0=L((f7,d0)=>{"use strict";v();var iT=Rn().assign,aT=mg(),sT=u0(),oT=Zu(),f0={};iT(f0,aT,sT,oT);d0.exports=f0});var g0=L((h7,m0)=>{"use strict";v();var p0=(t,e)=>function(...n){let r=e.promiseModule;return new r((i,a)=>{e.multiArgs?n.push((...s)=>{e.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):e.errorFirst?n.push((s,o)=>{s?a(s):i(o)}):n.push(i),t.apply(this,n)})};m0.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let n=typeof t;if(!(t!==null&&(n==="object"||n==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":n}\``);let r=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return e.include?e.include.some(s):!e.exclude.some(s)},i;n==="function"?i=function(...a){return e.excludeMain?t(...a):p0(t,e).apply(this,a)}:i=Object.create(Object.getPrototypeOf(t));for(let a in t){let s=t[a];i[a]=typeof s=="function"&&r(a)?p0(s,e):s}return i}});var k0=L((m7,E0)=>{v();function y0(t){return Array.isArray(t)?t:[t]}var tf="",v0=" ",Ju="\\",lT=/^\s+$/,cT=/(?:[^\\]|^)\\$/,uT=/^\\!/,fT=/^\\#/,dT=/\r?\n/g,hT=/^\.*\/|^\.+$/,ef="/",x0="node-ignore";typeof Symbol!="undefined"&&(x0=Symbol.for("node-ignore"));var w0=x0,pT=(t,e,n)=>Object.defineProperty(t,e,{value:n}),mT=/([0-z])-([0-z])/g,_0=()=>!1,gT=t=>t.replace(mT,(e,n,r)=>n.charCodeAt(0)<=r.charCodeAt(0)?e:tf),yT=t=>{let{length:e}=t;return t.slice(0,e-e%2)},vT=[[/^\uFEFF/,()=>tf],[/\\?\s+$/,t=>t.indexOf("\\")===0?v0:tf],[/\\\s/g,()=>v0],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,n)=>e+6{let r=n.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Ju],[/\\\\/g,()=>Ju],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,n,r,i)=>e===Ju?`\\[${n}${yT(r)}${i}`:i==="]"&&r.length%2===0?`[${gT(n)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],b0=Object.create(null),wT=(t,e)=>{let n=b0[t];return n||(n=vT.reduce((r,i)=>r.replace(i[0],i[1].bind(t)),t),b0[t]=n),e?new RegExp(n,"i"):new RegExp(n)},af=t=>typeof t=="string",bT=t=>t&&af(t)&&!lT.test(t)&&!cT.test(t)&&t.indexOf("#")!==0,xT=t=>t.split(dT),nf=class{constructor(e,n,r,i){this.origin=e,this.pattern=n,this.negative=r,this.regex=i}},_T=(t,e)=>{let n=t,r=!1;t.indexOf("!")===0&&(r=!0,t=t.substr(1)),t=t.replace(uT,"!").replace(fT,"#");let i=wT(t,e);return new nf(n,t,r,i)},ST=(t,e)=>{throw new e(t)},Bn=(t,e,n)=>af(t)?t?Bn.isNotRelative(t)?n(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${e}\``,TypeError),S0=t=>hT.test(t);Bn.isNotRelative=S0;Bn.convert=t=>t;var rf=class{constructor({ignorecase:e=!0,ignoreCase:n=e,allowRelativePaths:r=!1}={}){pT(this,w0,!0),this._rules=[],this._ignoreCase=n,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[w0]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(bT(e)){let n=_T(e,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(e){return this._added=!1,y0(af(e)?xT(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,n){let r=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&r!==i||s&&!r&&!i&&!n)return;a.regex.test(e)&&(r=!s,i=s)}),{ignored:r,unignored:i}}_test(e,n,r,i){let a=e&&Bn.convert(e);return Bn(a,e,this._allowRelativePaths?_0:ST),this._t(a,n,r,i)}_t(e,n,r,i){if(e in n)return n[e];if(i||(i=e.split(ef)),i.pop(),!i.length)return n[e]=this._testOne(e,r);let a=this._t(i.join(ef)+ef,n,r,i);return n[e]=a.ignored?a:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return y0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Co=t=>new rf(t),ET=t=>Bn(t&&Bn.convert(t),t,_0);Co.isPathValid=ET;Co.default=Co;E0.exports=Co;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");Bn.convert=t;let e=/^[a-z]:\//i;Bn.isNotRelative=n=>e.test(n)||S0(n)}});var T0=L((y7,A0)=>{"use strict";v();function kT(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sn(t,e,n){return e=e instanceof RegExp?e:new RegExp(kT(e),"g"),t.replace(e,n)}var AT={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Sn(e,"./","/"),e=Sn(e,"..","."),e=Sn(e," ","-"),e=Sn(e,/^[~^:?*\\\-]/g,""),e=Sn(e,/[~^:?*\\]/g,"-"),e=Sn(e,/[~^:?*\\\-]$/g,""),e=Sn(e,"@{","-"),e=Sn(e,/\.$/g,""),e=Sn(e,/\/$/g,""),e=Sn(e,/\.lock$/g,""),e}};A0.exports=AT});var F0=L((w7,C0)=>{v();C0.exports=function(t,e){var n=t,r=e,i=n.length,a=r.length,s=!1,o=null,l=i+1,c=[],u=[],f=[],d="",h=-1,p=0,m=1,g,w,b=function(){i>=a&&(g=n,w=i,n=r,r=g,i=a,a=w,s=!0,l=i+1)},x=function(y,S,k){return{x:y,y:S,k}},E=function(y,S){return{elem:y,t:S}},_=function(y,S,k){var C,M,P;for(S>k?C=c[y-1+l]:C=c[y+1+l],P=Math.max(S,k),M=P-y;M=0;--P)for(;CM-C?(s?f[f.length]=new E(r[M],h):f[f.length]=new E(r[M],m),++k,++M):y[P].y-y[P].x=y+1;--j)k[j+l]=_(j,k[j-1+l]+1,k[j+1+l]);k[y+l]=_(y,k[y-1+l]+1,k[y+1+l])}while(k[y+l]!==a);for(o=y+2*C,M=c[y+l],P=[];M!==-1;)P[P.length]=new x(u[M].x,u[M].y,null),M=u[M].k;T(P)}}}});var I0=L((x7,O0)=>{v();var TT=F0();function CT(t,e){var n=new TT(t,e);n.compose();for(var r=n.getses(),i,a,s=t.length-1,o=e.length-1,l=r.length-1;l>=0;--l)r[l].t===n.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):(i={file1index:s,file2index:o,chain:null},a=i),s--,o--):r[l].t===n.SES_DELETE?s--:r[l].t===n.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return a?(a.chain=c,i):c}function M0(t,e){for(var n=[],r=t.length,i=e.length,a=CT(t,e);a!==null;a=a.chain){var s=r-a.file1index-1,o=i-a.file2index-1;r=a.file1index,i=a.file2index,(s||o)&&n.push({file1:[r+1,s],file2:[i+1,o]})}return n.reverse(),n}function FT(t,e,n){var r,i=M0(e,t),a=M0(e,n),s=[];function o($,j){s.push([$.file1[0],j,$.file1[1],$.file2[0],$.file2[1]])}for(r=0;rc&&(l.push([1,c,$-c]),c=$)}for(var f=0;fm)break;m=Math.max(m,w+g[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:[n.length,-1,e.length,-1]};for(r=d;r<=f;r++){h=s[r];var x=h[1],E=b[x],_=h[0],T=_+h[2],y=h[3],S=y+h[4];E[0]=Math.min(y,E[0]),E[1]=Math.max(S,E[1]),E[2]=Math.min(_,E[2]),E[3]=Math.max(T,E[3])}var k=b[0][0]+(p-b[0][2]),C=b[0][1]+(m-b[0][3]),M=b[2][0]+(p-b[2][2]),P=b[2][1]+(m-b[2][3]);l.push([-1,k,C-k,p,m-p,M,P-M])}c=m}return u(e.length),l}function MT(t,e,n){var r=[],i=[t,e,n],a=FT(t,e,n),s=[];function o(){s.length&&r.push({ok:s}),s=[]}function l(h){for(var p=0;p{v();var Di=1e3,Bi=Di*60,Ni=Bi*60,Gr=Ni*24,P6=Gr*7,R6=Gr*365.25;L1.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return L6(t);if(n==="number"&&isFinite(t))return e.long?D6(t):j6(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function L6(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 n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*R6;case"weeks":case"week":case"w":return n*P6;case"days":case"day":case"d":return n*Gr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Ni;case"minutes":case"minute":case"mins":case"min":case"m":return n*Bi;case"seconds":case"second":case"secs":case"sec":case"s":return n*Di;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function j6(t){var e=Math.abs(t);return e>=Gr?Math.round(t/Gr)+"d":e>=Ni?Math.round(t/Ni)+"h":e>=Bi?Math.round(t/Bi)+"m":e>=Di?Math.round(t/Di)+"s":t+"ms"}function D6(t){var e=Math.abs(t);return e>=Gr?Yo(t,e,Gr,"day"):e>=Ni?Yo(t,e,Ni,"hour"):e>=Bi?Yo(t,e,Bi,"minute"):e>=Di?Yo(t,e,Di,"second"):t+" ms"}function Yo(t,e,n,r){var i=e>=n*1.5;return Math.round(t/n)+" "+r+(i?"s":"")}});var B1=L((M7,D1)=>{v();function B6(t){n.debug=n,n.default=n,n.coerce=l,n.disable=a,n.enable=i,n.enabled=s,n.humanize=j1(),n.destroy=c,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let d=0;d{if(T==="%%")return"%";E++;let S=n.formatters[y];if(typeof S=="function"){let k=g[E];T=S.call(w,k),g.splice(E,1),E--}return T}),n.formatArgs.call(w,g),(w.log||n.log).apply(w,g)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==n.namespaces&&(h=n.namespaces,p=n.enabled(u)),p),set:g=>{d=g}}),typeof n.init=="function"&&n.init(m),m}function r(u,f){let d=n(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f,d=(typeof u=="string"?u:"").split(/[\s,]+/),h=d.length;for(f=0;f"-"+f)].join(",");return n.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let f,d;for(f=0,d=n.skips.length;f{v();Ht.formatArgs=$6;Ht.save=H6;Ht.load=U6;Ht.useColors=N6;Ht.storage=z6();Ht.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`."))}})();Ht.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 N6(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1: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&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $6(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Zo.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(n++,i==="%c"&&(r=n))}),t.splice(r,0,e)}Ht.log=console.debug||console.log||(()=>{});function H6(t){try{t?Ht.storage.setItem("debug",t):Ht.storage.removeItem("debug")}catch(e){}}function U6(){let t;try{t=Ht.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function z6(){try{return localStorage}catch(t){}}Zo.exports=B1()(Ht);var{formatters:G6}=Zo.exports;G6.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var N1=L(Ut=>{"use strict";v();var V6=Ut&&Ut.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ut,"__esModule",{value:!0});var W6=require("fs"),q6=V6(Ko()),$i=q6.default("@kwsites/file-exists");function X6(t,e,n){$i("checking %s",t);try{let r=W6.statSync(t);return r.isFile()&&e?($i("[OK] path represents a file"),!0):r.isDirectory()&&n?($i("[OK] path represents a directory"),!0):($i("[FAIL] path represents something other than a file or directory"),!1)}catch(r){if(r.code==="ENOENT")return $i("[FAIL] path is not accessible: %o",r),!1;throw $i("[FATAL] %o",r),r}}function Y6(t,e=Ut.READABLE){return X6(t,(e&Ut.FILE)>0,(e&Ut.FOLDER)>0)}Ut.exists=Y6;Ut.FILE=1;Ut.FOLDER=2;Ut.READABLE=Ut.FILE+Ut.FOLDER});var $1=L(Qo=>{"use strict";v();function Z6(t){for(var e in t)Qo.hasOwnProperty(e)||(Qo[e]=t[e])}Object.defineProperty(Qo,"__esModule",{value:!0});Z6(N1())});var Lf=L(Vr=>{"use strict";v();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.createDeferred=Vr.deferred=void 0;function Rf(){let t,e,n="pending";return{promise:new Promise((i,a)=>{t=i,e=a}),done(i){n==="pending"&&(n="resolved",t(i))},fail(i){n==="pending"&&(n="rejected",e(i))},get fulfilled(){return n!=="pending"},get status(){return n}}}Vr.deferred=Rf;Vr.createDeferred=Rf;Vr.default=Rf});var y2=L((bD,g2)=>{"use strict";v();g2.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 w2=L((_D,v2)=>{v();var kd={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}};v2.exports=function(t,e,n,r){if(!kd.hasOwnProperty(n))throw new Error("Cannot convert to "+n);if(!kd[n].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+n);var i=kd[n][e]*t;return r!==!1?(r=Math.pow(10,parseInt(r)||5),Math.round(i*r)/r):i}});var P2=L(zn=>{"use strict";v();Object.defineProperty(zn,"__esModule",{value:!0});zn.fromRgba=Wi;zn.fromRgb=Ad;zn.fromHsla=wl;zn.fromHsl=O2;zn.fromString=I2;zn.default=void 0;var b2=S2(y2()),ZF=S2(w2());function S2(t){return t&&t.__esModule?t:{default:t}}function KF(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function x2(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n-1}function rM(t,e,n){var r=t/255,i=e/255,a=n/255,s=Math.max(r,i,a),o=Math.min(r,i,a),l=s-o,c=(s+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(s){case r:return(i-a)/l%6;case i:return(a-r)/l+2;default:return(r-i)/l+4}}();return[f*60,u*100,c*100]}function iM(t,e,n){var r=t/60,i=e/100,a=n/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(r%2-1)),l=a-s/2,c=function(){return r<1?[s,o,0]:r<2?[o,s,0]:r<3?[0,s,o]:r<4?[0,o,s]:r<5?[o,0,s]:[s,0,o]}(),u=Ct(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var aM=function(){function t(e){var n=Ct(e,4),r=n[0],i=n[1],a=n[2],s=n[3];KF(this,t),this.values=[Math.max(Math.min(parseInt(r,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return QF(t,[{key:"toRgbString",value:function(){var n=Ct(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return s===1?"rgb(".concat(r,", ").concat(i,", ").concat(a,")"):"rgba(".concat(r,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var n=this.toHslaArray(),r=Ct(n,4),i=r[0],a=r[1],s=r[2],o=r[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var n=Ct(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return r=Number(r).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(r).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var n=Ct(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3],o=rM(r,i,a),l=Ct(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,s]}}]),t}();function Wi(t){var e=Ct(t,4),n=e[0],r=e[1],i=e[2],a=e[3];return new aM([n,r,i,a])}function Ad(t){var e=Ct(t,3),n=e[0],r=e[1],i=e[2];return Wi([n,r,i,1])}function wl(t){var e=Ct(t,4),n=e[0],r=e[1],i=e[2],a=e[3],s=iM(n,r,i),o=Ct(s,3),l=o[0],c=o[1],u=o[2];return Wi([l,c,u,a])}function O2(t){var e=Ct(t,3),n=e[0],r=e[1],i=e[2];return wl([n,r,i,1])}function sM(t){var e=E2.exec(t)||k2.exec(t),n=Ct(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=parseInt(r.length<2?r.repeat(2):r,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,Wi([r,i,a,s])}function oM(t){var e=A2.exec(t)||C2.exec(t)||T2.exec(t)||F2.exec(t),n=Ct(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=Es(r,"%")?parseInt(r,10)*255/100:parseInt(r,10),i=Es(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=Es(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Es(s,"%")?100:1),Wi([r,i,a,s])}function lM(t){var e=M2.exec(t),n=Ct(e,6),r=n[1],i=n[2],a=n[3],s=n[4],o=n[5];return i=i||"deg",r=(0,ZF.default)(parseFloat(r),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Es(o,"%")?100:1),wl([r,a,s,o])}function I2(t){return b2.default[t]?Ad(b2.default[t]):E2.test(t)||k2.test(t)?sM(t):A2.test(t)||C2.test(t)||T2.test(t)||F2.test(t)?oM(t):M2.test(t)?lM(t):null}var cM={fromString:I2,fromRgb:Ad,fromRgba:Wi,fromHsl:O2,fromHsla:wl};zn.default=cM});var Td=L((AD,L2)=>{"use strict";v();var R2=Object.prototype.toString;L2.exports=function(e){var n=R2.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&R2.call(e.callee)==="[object Function]"),r}});var G2=L((CD,z2)=>{"use strict";v();var U2;Object.keys||(ks=Object.prototype.hasOwnProperty,Cd=Object.prototype.toString,j2=Td(),Fd=Object.prototype.propertyIsEnumerable,D2=!Fd.call({toString:null},"toString"),B2=Fd.call(function(){},"prototype"),As=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],bl=function(t){var e=t.constructor;return e&&e.prototype===t},N2={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},$2=function(){if(typeof window=="undefined")return!1;for(var t in window)try{if(!N2["$"+t]&&ks.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{bl(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),H2=function(t){if(typeof window=="undefined"||!$2)return bl(t);try{return bl(t)}catch(e){return!1}},U2=function(e){var n=e!==null&&typeof e=="object",r=Cd.call(e)==="[object Function]",i=j2(e),a=n&&Cd.call(e)==="[object String]",s=[];if(!n&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var o=B2&&r;if(a&&e.length>0&&!ks.call(e,0))for(var l=0;l0)for(var c=0;c{"use strict";v();var uM=Array.prototype.slice,fM=Td(),V2=Object.keys,xl=V2?function(e){return V2(e)}:G2(),W2=Object.keys;xl.shim=function(){if(Object.keys){var e=function(){var n=Object.keys(arguments);return n&&n.length===arguments.length}(1,2);e||(Object.keys=function(r){return fM(r)?W2(uM.call(r)):W2(r)})}else Object.keys=xl;return Object.keys||xl};q2.exports=xl});var Y2=L((ID,X2)=>{"use strict";v();X2.exports=Error});var K2=L((RD,Z2)=>{"use strict";v();Z2.exports=EvalError});var J2=L((jD,Q2)=>{"use strict";v();Q2.exports=RangeError});var tw=L((BD,ew)=>{"use strict";v();ew.exports=ReferenceError});var Md=L(($D,nw)=>{"use strict";v();nw.exports=SyntaxError});var Gn=L((UD,rw)=>{"use strict";v();rw.exports=TypeError});var aw=L((GD,iw)=>{"use strict";v();iw.exports=URIError});var Ts=L((WD,sw)=>{"use strict";v();sw.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[n]=i;for(n 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]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,n);if(s.value!==i||s.enumerable!==!0)return!1}return!0}});var Sl=L((XD,lw)=>{"use strict";v();var ow=typeof Symbol!="undefined"&&Symbol,dM=Ts();lw.exports=function(){return typeof ow!="function"||typeof Symbol!="function"||typeof ow("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:dM()}});var uw=L((ZD,cw)=>{"use strict";v();var Od={__proto__:null,foo:{}},hM=Object;cw.exports=function(){return{__proto__:Od}.foo===Od.foo&&!(Od instanceof hM)}});var hw=L((QD,dw)=>{"use strict";v();var pM="Function.prototype.bind called on incompatible ",mM=Object.prototype.toString,gM=Math.max,yM="[object Function]",fw=function(e,n){for(var r=[],i=0;i{"use strict";v();var bM=hw();pw.exports=Function.prototype.bind||bM});var Id=L((n9,mw)=>{"use strict";v();var xM=Function.prototype.call,_M=Object.prototype.hasOwnProperty,SM=El();mw.exports=SM.call(xM,_M)});var dn=L((i9,bw)=>{"use strict";v();var pe,EM=Y2(),kM=K2(),AM=J2(),TM=tw(),Zi=Md(),Yi=Gn(),CM=aw(),ww=Function,Pd=function(t){try{return ww('"use strict"; return ('+t+").constructor;")()}catch(e){}},Yr=Object.getOwnPropertyDescriptor;if(Yr)try{Yr({},"")}catch(t){Yr=null}var Rd=function(){throw new Yi},FM=Yr?function(){try{return arguments.callee,Rd}catch(t){try{return Yr(arguments,"callee").get}catch(e){return Rd}}}():Rd,qi=Sl()(),MM=uw()(),ct=Object.getPrototypeOf||(MM?function(t){return t.__proto__}:null),Xi={},OM=typeof Uint8Array=="undefined"||!ct?pe:ct(Uint8Array),Zr={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?pe:ArrayBuffer,"%ArrayIteratorPrototype%":qi&&ct?ct([][Symbol.iterator]()):pe,"%AsyncFromSyncIteratorPrototype%":pe,"%AsyncFunction%":Xi,"%AsyncGenerator%":Xi,"%AsyncGeneratorFunction%":Xi,"%AsyncIteratorPrototype%":Xi,"%Atomics%":typeof Atomics=="undefined"?pe:Atomics,"%BigInt%":typeof BigInt=="undefined"?pe:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":EM,"%eval%":eval,"%EvalError%":kM,"%Float32Array%":typeof Float32Array=="undefined"?pe:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?pe:FinalizationRegistry,"%Function%":ww,"%GeneratorFunction%":Xi,"%Int8Array%":typeof Int8Array=="undefined"?pe:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?pe:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qi&&ct?ct(ct([][Symbol.iterator]())):pe,"%JSON%":typeof JSON=="object"?JSON:pe,"%Map%":typeof Map=="undefined"?pe:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!qi||!ct?pe:ct(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?pe:Promise,"%Proxy%":typeof Proxy=="undefined"?pe:Proxy,"%RangeError%":AM,"%ReferenceError%":TM,"%Reflect%":typeof Reflect=="undefined"?pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?pe:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!qi||!ct?pe:ct(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qi&&ct?ct(""[Symbol.iterator]()):pe,"%Symbol%":qi?Symbol:pe,"%SyntaxError%":Zi,"%ThrowTypeError%":FM,"%TypedArray%":OM,"%TypeError%":Yi,"%Uint8Array%":typeof Uint8Array=="undefined"?pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?pe:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?pe:Uint32Array,"%URIError%":CM,"%WeakMap%":typeof WeakMap=="undefined"?pe:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?pe:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?pe:WeakSet};if(ct)try{null.error}catch(t){gw=ct(ct(t)),Zr["%Error.prototype%"]=gw}var gw,IM=function t(e){var n;if(e==="%AsyncFunction%")n=Pd("async function () {}");else if(e==="%GeneratorFunction%")n=Pd("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=Pd("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&ct&&(n=ct(i.prototype))}return Zr[e]=n,n},yw={__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"]},Cs=El(),kl=Id(),PM=Cs.call(Function.call,Array.prototype.concat),RM=Cs.call(Function.apply,Array.prototype.splice),vw=Cs.call(Function.call,String.prototype.replace),Al=Cs.call(Function.call,String.prototype.slice),LM=Cs.call(Function.call,RegExp.prototype.exec),jM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,DM=/\\(\\)?/g,BM=function(e){var n=Al(e,0,1),r=Al(e,-1);if(n==="%"&&r!=="%")throw new Zi("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Zi("invalid intrinsic syntax, expected opening `%`");var i=[];return vw(e,jM,function(a,s,o,l){i[i.length]=o?vw(l,DM,"$1"):s||a}),i},NM=function(e,n){var r=e,i;if(kl(yw,r)&&(i=yw[r],r="%"+i[0]+"%"),kl(Zr,r)){var a=Zr[r];if(a===Xi&&(a=IM(r)),typeof a=="undefined"&&!n)throw new Yi("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new Zi("intrinsic "+e+" does not exist!")};bw.exports=function(e,n){if(typeof e!="string"||e.length===0)throw new Yi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Yi('"allowMissing" argument must be a boolean');if(LM(/^%?[^%]*%?$/,e)===null)throw new Zi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=BM(e),i=r.length>0?r[0]:"",a=NM("%"+i+"%",n),s=a.name,o=a.value,l=!1,c=a.alias;c&&(i=c[0],RM(r,PM([0,1],c)));for(var u=1,f=!0;u=r.length){var m=Yr(o,d);f=!!m,f&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[d]}else f=kl(o,d),o=o[d];f&&!l&&(Zr[s]=o)}}return o}});var Cl=L((s9,xw)=>{"use strict";v();var $M=dn(),Tl=$M("%Object.defineProperty%",!0)||!1;if(Tl)try{Tl({},"a",{value:1})}catch(t){Tl=!1}xw.exports=Tl});var Ml=L((l9,_w)=>{"use strict";v();var HM=dn(),Fl=HM("%Object.getOwnPropertyDescriptor%",!0);if(Fl)try{Fl([],"length")}catch(t){Fl=null}_w.exports=Fl});var Ol=L((u9,kw)=>{"use strict";v();var Sw=Cl(),UM=Md(),Ki=Gn(),Ew=Ml();kw.exports=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Ki("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Ki("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ki("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ki("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ki("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ki("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!Ew&&Ew(e,n);if(Sw)Sw(e,n,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:a===null&&l?l.writable:!a});else if(o||!i&&!a&&!s)e[n]=r;else throw new UM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Il=L((d9,Tw)=>{"use strict";v();var Ld=Cl(),Aw=function(){return!!Ld};Aw.hasArrayLengthDefineBug=function(){if(!Ld)return null;try{return Ld([],"length",{value:1}).length!==1}catch(e){return!0}};Tw.exports=Aw});var hr=L((p9,Ow)=>{"use strict";v();var zM=_l(),GM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",VM=Object.prototype.toString,WM=Array.prototype.concat,Cw=Ol(),qM=function(t){return typeof t=="function"&&VM.call(t)==="[object Function]"},Fw=Il()(),XM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!qM(r)||!r())return}Fw?Cw(t,e,n,!0):Cw(t,e,n)},Mw=function(t,e){var n=arguments.length>2?arguments[2]:{},r=zM(e);GM&&(r=WM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i{"use strict";v();var YM=dn(),Iw=Ol(),ZM=Il()(),Pw=Ml(),Rw=Gn(),KM=YM("%Math.floor%");Lw.exports=function(e,n){if(typeof e!="function")throw new Rw("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||KM(n)!==n)throw new Rw("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Pw){var s=Pw(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!r)&&(ZM?Iw(e,"length",n,!0,!0):Iw(e,"length",n)),e}});var Kr=L((v9,Pl)=>{"use strict";v();var jd=El(),Rl=dn(),QM=jw(),JM=Gn(),Nw=Rl("%Function.prototype.apply%"),$w=Rl("%Function.prototype.call%"),Hw=Rl("%Reflect.apply%",!0)||jd.call($w,Nw),Dw=Cl(),eO=Rl("%Math.max%");Pl.exports=function(e){if(typeof e!="function")throw new JM("a function is required");var n=Hw(jd,$w,arguments);return QM(n,1+eO(0,e.length-(arguments.length-1)),!0)};var Bw=function(){return Hw(jd,Nw,arguments)};Dw?Dw(Pl.exports,"apply",{value:Bw}):Pl.exports.apply=Bw});var Wt=L((b9,Gw)=>{"use strict";v();var Uw=dn(),zw=Kr(),tO=zw(Uw("String.prototype.indexOf"));Gw.exports=function(e,n){var r=Uw(e,!!n);return typeof r=="function"&&tO(e,".prototype.")>-1?zw(r):r}});var Dd=L((_9,Yw)=>{"use strict";v();var nO=_l(),qw=Ts()(),Xw=Wt(),Vw=Object,rO=Xw("Array.prototype.push"),Ww=Xw("Object.prototype.propertyIsEnumerable"),iO=qw?Object.getOwnPropertySymbols:null;Yw.exports=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Vw(e);if(arguments.length===1)return r;for(var i=1;i{"use strict";v();var Bd=Dd(),aO=function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),n={},r=0;r{"use strict";v();var oO=hr(),lO=Nd();Kw.exports=function(){var e=lO();return oO(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var nb=L((C9,tb)=>{"use strict";v();var cO=hr(),uO=Kr(),fO=Dd(),Jw=Nd(),dO=Qw(),hO=uO.apply(Jw()),eb=function(e,n){return hO(Object,arguments)};cO(eb,{getPolyfill:Jw,implementation:fO,shim:dO});tb.exports=eb});var ib=L((M9,rb)=>{"use strict";v();var Ms=function(){return typeof function(){}.name=="string"},Fs=Object.getOwnPropertyDescriptor;if(Fs)try{Fs([],"length")}catch(t){Fs=null}Ms.functionsHaveConfigurableNames=function(){if(!Ms()||!Fs)return!1;var e=Fs(function(){},"name");return!!e&&!!e.configurable};var pO=Function.prototype.bind;Ms.boundFunctionsHaveNames=function(){return Ms()&&typeof pO=="function"&&function(){}.bind().name!==""};rb.exports=Ms});var ob=L((I9,sb)=>{"use strict";v();var ab=Ol(),mO=Il()(),gO=ib().functionsHaveConfigurableNames(),yO=Gn();sb.exports=function(e,n){if(typeof e!="function")throw new yO("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||gO)&&(mO?ab(e,"name",n,!0,!0):ab(e,"name",n)),e}});var $d=L((R9,lb)=>{"use strict";v();var vO=ob(),wO=Gn(),bO=Object;lb.exports=vO(function(){if(this==null||this!==bO(this))throw new wO("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var Hd=L((j9,cb)=>{"use strict";v();var xO=$d(),_O=hr().supportsDescriptors,SO=Object.getOwnPropertyDescriptor;cb.exports=function(){if(_O&&/a/mig.flags==="gim"){var e=SO(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return xO}});var db=L((B9,fb)=>{"use strict";v();var EO=hr().supportsDescriptors,kO=Hd(),AO=Object.getOwnPropertyDescriptor,TO=Object.defineProperty,CO=TypeError,ub=Object.getPrototypeOf,FO=/a/;fb.exports=function(){if(!EO||!ub)throw new CO("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=kO(),n=ub(FO),r=AO(n,"flags");return(!r||r.get!==e)&&TO(n,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var gb=L(($9,mb)=>{"use strict";v();var MO=hr(),OO=Kr(),IO=$d(),hb=Hd(),PO=db(),pb=OO(hb());MO(pb,{getPolyfill:hb,implementation:IO,shim:PO});mb.exports=pb});var pr=L((U9,yb)=>{"use strict";v();var RO=Ts();yb.exports=function(){return RO()&&!!Symbol.toStringTag}});var zd=L((G9,wb)=>{"use strict";v();var LO=pr()(),jO=Wt(),Ud=jO("Object.prototype.toString"),Ll=function(e){return LO&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Ud(e)==="[object Arguments]"},vb=function(e){return Ll(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ud(e)!=="[object Array]"&&Ud(e.callee)==="[object Function]"},DO=function(){return Ll(arguments)}();Ll.isLegacyArguments=vb;wb.exports=DO?Ll:vb});var bb=L(()=>{v()});var $b=L((Y9,Nb)=>{v();var Jd=typeof Map=="function"&&Map.prototype,Gd=Object.getOwnPropertyDescriptor&&Jd?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Dl=Jd&&Gd&&typeof Gd.get=="function"?Gd.get:null,xb=Jd&&Map.prototype.forEach,eh=typeof Set=="function"&&Set.prototype,Vd=Object.getOwnPropertyDescriptor&&eh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Bl=eh&&Vd&&typeof Vd.get=="function"?Vd.get:null,_b=eh&&Set.prototype.forEach,BO=typeof WeakMap=="function"&&WeakMap.prototype,Is=BO?WeakMap.prototype.has:null,NO=typeof WeakSet=="function"&&WeakSet.prototype,Ps=NO?WeakSet.prototype.has:null,$O=typeof WeakRef=="function"&&WeakRef.prototype,Sb=$O?WeakRef.prototype.deref:null,HO=Boolean.prototype.valueOf,UO=Object.prototype.toString,zO=Function.prototype.toString,GO=String.prototype.match,th=String.prototype.slice,gr=String.prototype.replace,VO=String.prototype.toUpperCase,Eb=String.prototype.toLowerCase,Pb=RegExp.prototype.test,kb=Array.prototype.concat,Tn=Array.prototype.join,WO=Array.prototype.slice,Ab=Math.floor,Xd=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Wd=Object.getOwnPropertySymbols,Yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",yt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qi||!0)?Symbol.toStringTag:null,Rb=Object.prototype.propertyIsEnumerable,Tb=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Cb(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Pb.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Ab(-t):Ab(t);if(r!==t){var i=String(r),a=th.call(e,i.length+1);return gr.call(i,n,"$&_")+"."+gr.call(gr.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return gr.call(e,n,"$&_")}var Zd=bb(),Fb=Zd.custom,Mb=jb(Fb)?Fb:null;Nb.exports=function t(e,n,r,i){var a=n||{};if(mr(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(mr(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=mr(a,"customInspect")?a.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(mr(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(mr(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=a.numericSeparator;if(typeof e=="undefined")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Bb(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?Cb(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return o?Cb(e,c):c}var u=typeof a.depth=="undefined"?5:a.depth;if(typeof r=="undefined"&&(r=0),r>=u&&u>0&&typeof e=="object")return Kd(e)?"[Array]":"[Object]";var f=uI(a,r);if(typeof i=="undefined")i=[];else if(Db(i,e)>=0)return"[Circular]";function d($,j,Q){if(j&&(i=WO.call(i),i.push(j)),Q){var le={depth:a.depth};return mr(a,"quoteStyle")&&(le.quoteStyle=a.quoteStyle),t($,le,r+1,i)}return t($,a,r+1,i)}if(typeof e=="function"&&!Ob(e)){var h=tI(e),p=jl(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(p.length>0?" { "+Tn.call(p,", ")+" }":"")}if(jb(e)){var m=Qi?gr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yd.call(e);return typeof e=="object"&&!Qi?Os(m):m}if(oI(e)){for(var g="<"+Eb.call(String(e.nodeName)),w=e.attributes||[],b=0;b",g}if(Kd(e)){if(e.length===0)return"[]";var x=jl(e,d);return f&&!cI(x)?"["+Qd(x,f)+"]":"[ "+Tn.call(x,", ")+" ]"}if(YO(e)){var E=jl(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Rb.call(e,"cause")?"{ ["+String(e)+"] "+Tn.call(kb.call("[cause]: "+d(e.cause),E),", ")+" }":E.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Tn.call(E,", ")+" }"}if(typeof e=="object"&&s){if(Mb&&typeof e[Mb]=="function"&&Zd)return Zd(e,{depth:u-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(nI(e)){var _=[];return xb&&xb.call(e,function($,j){_.push(d(j,e,!0)+" => "+d($,e))}),Ib("Map",Dl.call(e),_,f)}if(aI(e)){var T=[];return _b&&_b.call(e,function($){T.push(d($,e))}),Ib("Set",Bl.call(e),T,f)}if(rI(e))return qd("WeakMap");if(sI(e))return qd("WeakSet");if(iI(e))return qd("WeakRef");if(KO(e))return Os(d(Number(e)));if(JO(e))return Os(d(Xd.call(e)));if(QO(e))return Os(HO.call(e));if(ZO(e))return Os(d(String(e)));if(typeof window!="undefined"&&e===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&e===globalThis||typeof global!="undefined"&&e===global)return"{ [object globalThis] }";if(!XO(e)&&!Ob(e)){var y=jl(e,d),S=Tb?Tb(e)===Object.prototype:e instanceof Object||e.constructor===Object,k=e instanceof Object?"":"null prototype",C=!S&&yt&&Object(e)===e&&yt in e?th.call(yr(e),8,-1):k?"Object":"",M=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",P=M+(C||k?"["+Tn.call(kb.call([],C||[],k||[]),": ")+"] ":"");return y.length===0?P+"{}":f?P+"{"+Qd(y,f)+"}":P+"{ "+Tn.call(y,", ")+" }"}return String(e)};function Lb(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function qO(t){return gr.call(String(t),/"/g,""")}function Kd(t){return yr(t)==="[object Array]"&&(!yt||!(typeof t=="object"&&yt in t))}function XO(t){return yr(t)==="[object Date]"&&(!yt||!(typeof t=="object"&&yt in t))}function Ob(t){return yr(t)==="[object RegExp]"&&(!yt||!(typeof t=="object"&&yt in t))}function YO(t){return yr(t)==="[object Error]"&&(!yt||!(typeof t=="object"&&yt in t))}function ZO(t){return yr(t)==="[object String]"&&(!yt||!(typeof t=="object"&&yt in t))}function KO(t){return yr(t)==="[object Number]"&&(!yt||!(typeof t=="object"&&yt in t))}function QO(t){return yr(t)==="[object Boolean]"&&(!yt||!(typeof t=="object"&&yt in t))}function jb(t){if(Qi)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Yd)return!1;try{return Yd.call(t),!0}catch(e){}return!1}function JO(t){if(!t||typeof t!="object"||!Xd)return!1;try{return Xd.call(t),!0}catch(e){}return!1}var eI=Object.prototype.hasOwnProperty||function(t){return t in this};function mr(t,e){return eI.call(t,e)}function yr(t){return UO.call(t)}function tI(t){if(t.name)return t.name;var e=GO.call(zO.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Db(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return Bb(th.call(t,0,e.maxStringLength),e)+r}var i=gr.call(gr.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lI);return Lb(i,"single",e)}function lI(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+VO.call(e.toString(16))}function Os(t){return"Object("+t+")"}function qd(t){return t+" { ? }"}function Ib(t,e,n,r){var i=r?Qd(n,r):Tn.call(n,", ");return t+" ("+e+") {"+i+"}"}function cI(t){for(var e=0;e=0)return!1;return!0}function uI(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=Tn.call(Array(t.indent+1)," ");else return null;return{base:n,prev:Tn.call(Array(e+1),n)}}function Qd(t,e){if(t.length===0)return"";var n=` +`+e.prev+e.base;return n+Tn.call(t,","+n)+` +`+e.prev}function jl(t,e){var n=Kd(t),r=[];if(n){r.length=t.length;for(var i=0;i{"use strict";v();var Hb=dn(),Ji=Wt(),fI=$b(),dI=Gn(),Nl=Hb("%WeakMap%",!0),$l=Hb("%Map%",!0),hI=Ji("WeakMap.prototype.get",!0),pI=Ji("WeakMap.prototype.set",!0),mI=Ji("WeakMap.prototype.has",!0),gI=Ji("Map.prototype.get",!0),yI=Ji("Map.prototype.set",!0),vI=Ji("Map.prototype.has",!0),nh=function(t,e){for(var n=t,r;(r=n.next)!==null;n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r},wI=function(t,e){var n=nh(t,e);return n&&n.value},bI=function(t,e,n){var r=nh(t,e);r?r.value=n:t.next={key:e,next:t.next,value:n}},xI=function(t,e){return!!nh(t,e)};Ub.exports=function(){var e,n,r,i={assert:function(a){if(!i.has(a))throw new dI("Side channel does not contain "+fI(a))},get:function(a){if(Nl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return hI(e,a)}else if($l){if(n)return gI(n,a)}else if(r)return wI(r,a)},has:function(a){if(Nl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return mI(e,a)}else if($l){if(n)return vI(n,a)}else if(r)return xI(r,a);return!1},set:function(a,s){Nl&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new Nl),pI(e,a,s)):$l?(n||(n=new $l),yI(n,a,s)):(r||(r={key:{},next:null}),bI(r,a,s))}};return i}});var Gb=L((J9,zb)=>{"use strict";v();var _I=Id(),Rs=rh()(),Vn=Gn(),ih={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");if(Rs.assert(t),!ih.has(t,e))throw new Vn("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");var n=Rs.get(t);return n&&n["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");var n=Rs.get(t);return!!n&&_I(n,"$"+e)},set:function(t,e,n){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");var r=Rs.get(t);r||(r={},Rs.set(t,r)),r["$"+e]=n}};Object.freeze&&Object.freeze(ih);zb.exports=ih});var qb=L((tB,Wb)=>{"use strict";v();var Ls=Gb(),SI=SyntaxError,Vb=typeof StopIteration=="object"?StopIteration:null;Wb.exports=function(e){if(!Vb)throw new SI("this environment lacks StopIteration");Ls.set(e,"[[Done]]",!1);var n={next:function(){var i=Ls.get(this,"[[Iterator]]"),a=Ls.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Ls.set(i,"[[Done]]",!0),s!==Vb)throw s;return{done:!0,value:void 0}}}};return Ls.set(n,"[[Iterator]]",e),n}});var ah=L((rB,Xb)=>{v();var EI={}.toString;Xb.exports=Array.isArray||function(t){return EI.call(t)=="[object Array]"}});var sh=L((aB,Yb)=>{"use strict";v();var kI=String.prototype.valueOf,AI=function(e){try{return kI.call(e),!0}catch(n){return!1}},TI=Object.prototype.toString,CI="[object String]",FI=pr()();Yb.exports=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:FI?AI(e):TI.call(e)===CI}});var lh=L((oB,Qb)=>{"use strict";v();var oh=typeof Map=="function"&&Map.prototype?Map:null,MI=typeof Set=="function"&&Set.prototype?Set:null,Hl;oh||(Hl=function(e){return!1});var Kb=oh?Map.prototype.has:null,Zb=MI?Set.prototype.has:null;!Hl&&!Kb&&(Hl=function(e){return!1});Qb.exports=Hl||function(e){if(!e||typeof e!="object")return!1;try{if(Kb.call(e),Zb)try{Zb.call(e)}catch(n){return!0}return e instanceof oh}catch(n){}return!1}});var uh=L((cB,tx)=>{"use strict";v();var OI=typeof Map=="function"&&Map.prototype?Map:null,ch=typeof Set=="function"&&Set.prototype?Set:null,Ul;ch||(Ul=function(e){return!1});var Jb=OI?Map.prototype.has:null,ex=ch?Set.prototype.has:null;!Ul&&!ex&&(Ul=function(e){return!1});tx.exports=Ul||function(e){if(!e||typeof e!="object")return!1;try{if(ex.call(e),Jb)try{Jb.call(e)}catch(n){return!0}return e instanceof ch}catch(n){}return!1}});var hx=L((fB,Vl)=>{"use strict";v();var nx=zd(),rx=qb();Sl()()||Ts()()?(zl=Symbol.iterator,Vl.exports=function(e){if(e!=null&&typeof e[zl]!="undefined")return e[zl]();if(nx(e))return Array.prototype[zl].call(e)}):(ix=ah(),ax=sh(),fh=dn(),sx=fh("%Map%",!0),ox=fh("%Set%",!0),nn=Wt(),dh=nn("Array.prototype.push"),hh=nn("String.prototype.charCodeAt"),lx=nn("String.prototype.slice"),cx=function(e,n){var r=e.length;if(n+1>=r)return n+1;var i=hh(e,n);if(i<55296||i>56319)return n+1;var a=hh(e,n+1);return a<56320||a>57343?n+1:n+2},Gl=function(e){var n=0;return{next:function(){var i=n>=e.length,a;return i||(a=e[n],n+=1),{done:i,value:a}}}},ph=function(e,n){if(ix(e)||nx(e))return Gl(e);if(ax(e)){var r=0;return{next:function(){var a=cx(e,r),s=lx(e,r,a);return r=a,{done:a>e.length,value:s}}}}if(n&&typeof e["_es6-shim iterator_"]!="undefined")return e["_es6-shim iterator_"]()},!sx&&!ox?Vl.exports=function(e){if(e!=null)return ph(e,!0)}:(ux=lh(),fx=uh(),mh=nn("Map.prototype.forEach",!0),gh=nn("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(yh=nn("Map.prototype.iterator",!0),vh=nn("Set.prototype.iterator",!0)),wh=nn("Map.prototype.@@iterator",!0)||nn("Map.prototype._es6-shim iterator_",!0),bh=nn("Set.prototype.@@iterator",!0)||nn("Set.prototype._es6-shim iterator_",!0),dx=function(e){if(ux(e)){if(yh)return rx(yh(e));if(wh)return wh(e);if(mh){var n=[];return mh(e,function(i,a){dh(n,[a,i])}),Gl(n)}}if(fx(e)){if(vh)return rx(vh(e));if(bh)return bh(e);if(gh){var r=[];return gh(e,function(i){dh(r,i)}),Gl(r)}}},Vl.exports=function(e){return dx(e)||ph(e)}));var zl,ix,ax,fh,sx,ox,nn,dh,hh,lx,cx,Gl,ph,ux,fx,mh,gh,yh,vh,wh,bh,dx});var xh=L((hB,mx)=>{"use strict";v();var px=function(t){return t!==t};mx.exports=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||px(e)&&px(n))}});var _h=L((mB,gx)=>{"use strict";v();var II=xh();gx.exports=function(){return typeof Object.is=="function"?Object.is:II}});var vx=L((yB,yx)=>{"use strict";v();var PI=_h(),RI=hr();yx.exports=function(){var e=PI();return RI(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var _x=L((wB,xx)=>{"use strict";v();var LI=hr(),jI=Kr(),DI=xh(),wx=_h(),BI=vx(),bx=jI(wx(),Object);LI(bx,{getPolyfill:wx,implementation:DI,shim:BI});xx.exports=bx});var Eh=L((xB,Ax)=>{"use strict";v();var NI=Kr(),kx=Wt(),$I=dn(),Sh=$I("%ArrayBuffer%",!0),Wl=kx("ArrayBuffer.prototype.byteLength",!0),HI=kx("Object.prototype.toString"),Sx=!!Sh&&!Wl&&new Sh(0).slice,Ex=!!Sx&&NI(Sx);Ax.exports=Wl||Ex?function(e){if(!e||typeof e!="object")return!1;try{return Wl?Wl(e):Ex(e,0),!0}catch(n){return!1}}:Sh?function(e){return HI(e)==="[object ArrayBuffer]"}:function(e){return!1}});var Cx=L((SB,Tx)=>{"use strict";v();var UI=Date.prototype.getDay,zI=function(e){try{return UI.call(e),!0}catch(n){return!1}},GI=Object.prototype.toString,VI="[object Date]",WI=pr()();Tx.exports=function(e){return typeof e!="object"||e===null?!1:WI?zI(e):GI.call(e)===VI}});var Px=L((kB,Ix)=>{"use strict";v();var kh=Wt(),Fx=pr()(),Mx,Ox,Ah,Th;Fx&&(Mx=kh("Object.prototype.hasOwnProperty"),Ox=kh("RegExp.prototype.exec"),Ah={},ql=function(){throw Ah},Th={toString:ql,valueOf:ql},typeof Symbol.toPrimitive=="symbol"&&(Th[Symbol.toPrimitive]=ql));var ql,qI=kh("Object.prototype.toString"),XI=Object.getOwnPropertyDescriptor,YI="[object RegExp]";Ix.exports=Fx?function(e){if(!e||typeof e!="object")return!1;var n=XI(e,"lastIndex"),r=n&&Mx(n,"value");if(!r)return!1;try{Ox(e,Th)}catch(i){return i===Ah}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:qI(e)===YI}});var jx=L((TB,Lx)=>{"use strict";v();var ZI=Wt(),Rx=ZI("SharedArrayBuffer.prototype.byteLength",!0);Lx.exports=Rx?function(e){if(!e||typeof e!="object")return!1;try{return Rx(e),!0}catch(n){return!1}}:function(e){return!1}});var Bx=L((FB,Dx)=>{"use strict";v();var KI=Number.prototype.toString,QI=function(e){try{return KI.call(e),!0}catch(n){return!1}},JI=Object.prototype.toString,eP="[object Number]",tP=pr()();Dx.exports=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:tP?QI(e):JI.call(e)===eP}});var Hx=L((OB,$x)=>{"use strict";v();var Nx=Wt(),nP=Nx("Boolean.prototype.toString"),rP=Nx("Object.prototype.toString"),iP=function(e){try{return nP(e),!0}catch(n){return!1}},aP="[object Boolean]",sP=pr()();$x.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:sP&&Symbol.toStringTag in e?iP(e):rP(e)===aP}});var Vx=L((PB,Ch)=>{"use strict";v();var oP=Object.prototype.toString,lP=Sl()();lP?(Ux=Symbol.prototype.toString,zx=/^Symbol\(.*\)$/,Gx=function(e){return typeof e.valueOf()!="symbol"?!1:zx.test(Ux.call(e))},Ch.exports=function(e){if(typeof e=="symbol")return!0;if(oP.call(e)!=="[object Symbol]")return!1;try{return Gx(e)}catch(n){return!1}}):Ch.exports=function(e){return!1};var Ux,zx,Gx});var Xx=L((LB,qx)=>{"use strict";v();var Wx=typeof BigInt!="undefined"&&BigInt;qx.exports=function(){return typeof Wx=="function"&&typeof BigInt=="function"&&typeof Wx(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var Kx=L((DB,Fh)=>{"use strict";v();var cP=Xx()();cP?(Yx=BigInt.prototype.valueOf,Zx=function(e){try{return Yx.call(e),!0}catch(n){}return!1},Fh.exports=function(e){return e===null||typeof e=="undefined"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:Zx(e)}):Fh.exports=function(e){return!1};var Yx,Zx});var Jx=L((NB,Qx)=>{"use strict";v();var uP=sh(),fP=Bx(),dP=Hx(),hP=Vx(),pP=Kx();Qx.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(uP(e))return"String";if(fP(e))return"Number";if(dP(e))return"Boolean";if(hP(e))return"Symbol";if(pP(e))return"BigInt"}});var n_=L((HB,t_)=>{"use strict";v();var Xl=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,e_=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Yl;Xl||(Yl=function(e){return!1});var Oh=Xl?Xl.prototype.has:null,Mh=e_?e_.prototype.has:null;!Yl&&!Oh&&(Yl=function(e){return!1});t_.exports=Yl||function(e){if(!e||typeof e!="object")return!1;try{if(Oh.call(e,Oh),Mh)try{Mh.call(e,Mh)}catch(n){return!0}return e instanceof Xl}catch(n){}return!1}});var i_=L((zB,Ph)=>{"use strict";v();var mP=dn(),r_=Wt(),gP=mP("%WeakSet%",!0),Ih=r_("WeakSet.prototype.has",!0);Ih?(Zl=r_("WeakMap.prototype.has",!0),Ph.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Ih(e,Ih),Zl)try{Zl(e,Zl)}catch(n){return!0}return e instanceof gP}catch(n){}return!1}):Ph.exports=function(e){return!1};var Zl});var s_=L((VB,a_)=>{"use strict";v();var yP=lh(),vP=uh(),wP=n_(),bP=i_();a_.exports=function(e){if(e&&typeof e=="object"){if(yP(e))return"Map";if(vP(e))return"Set";if(wP(e))return"WeakMap";if(bP(e))return"WeakSet"}return!1}});var u_=L((qB,c_)=>{"use strict";v();var l_=Function.prototype.toString,ea=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Lh,Kl;if(typeof ea=="function"&&typeof Object.defineProperty=="function")try{Lh=Object.defineProperty({},"length",{get:function(){throw Kl}}),Kl={},ea(function(){throw 42},null,Lh)}catch(t){t!==Kl&&(ea=null)}else ea=null;var xP=/^\s*class\b/,jh=function(e){try{var n=l_.call(e);return xP.test(n)}catch(r){return!1}},Rh=function(e){try{return jh(e)?!1:(l_.call(e),!0)}catch(n){return!1}},Ql=Object.prototype.toString,_P="[object Object]",SP="[object Function]",EP="[object GeneratorFunction]",kP="[object HTMLAllCollection]",AP="[object HTML document.all class]",TP="[object HTMLCollection]",CP=typeof Symbol=="function"&&!!Symbol.toStringTag,FP=!(0 in[,]),Dh=function(){return!1};typeof document=="object"&&(o_=document.all,Ql.call(o_)===Ql.call(document.all)&&(Dh=function(e){if((FP||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var n=Ql.call(e);return(n===kP||n===AP||n===TP||n===_P)&&e("")==null}catch(r){}return!1}));var o_;c_.exports=ea?function(e){if(Dh(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ea(e,null,Lh)}catch(n){if(n!==Kl)return!1}return!jh(e)&&Rh(e)}:function(e){if(Dh(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(CP)return Rh(e);if(jh(e))return!1;var n=Ql.call(e);return n!==SP&&n!==EP&&!/^\[object HTML/.test(n)?!1:Rh(e)}});var h_=L((YB,d_)=>{"use strict";v();var MP=u_(),OP=Object.prototype.toString,f_=Object.prototype.hasOwnProperty,IP=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),OP.call(e)==="[object Array]"?IP(e,n,i):typeof e=="string"?PP(e,n,i):RP(e,n,i)};d_.exports=LP});var m_=L((KB,p_)=>{"use strict";v();p_.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var y_=L((JB,g_)=>{"use strict";v();var Bh=m_(),jP=typeof globalThis=="undefined"?global:globalThis;g_.exports=function(){for(var e=[],n=0;n{"use strict";v();var ec=h_(),DP=y_(),v_=Kr(),Hh=Wt(),Jl=Ml(),BP=Hh("Object.prototype.toString"),b_=pr()(),w_=typeof globalThis=="undefined"?global:globalThis,$h=DP(),Uh=Hh("String.prototype.slice"),Nh=Object.getPrototypeOf,NP=Hh("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:HP(e)}return Jl?$P(e):null}});var k_=L((rN,E_)=>{"use strict";v();var UP=Wt(),S_=UP("ArrayBuffer.prototype.byteLength",!0),zP=Eh();E_.exports=function(e){return zP(e)?S_?S_(e):e.byteLength:NaN}});var Z_=L((aN,Y_)=>{"use strict";v();var W_=nb(),Cn=Wt(),A_=gb(),GP=dn(),ta=hx(),VP=rh(),T_=_x(),C_=zd(),F_=ah(),M_=Eh(),O_=Cx(),I_=Px(),P_=jx(),R_=_l(),L_=Jx(),j_=s_(),D_=__(),B_=k_(),N_=Cn("SharedArrayBuffer.prototype.byteLength",!0),$_=Cn("Date.prototype.getTime"),zh=Object.getPrototypeOf,H_=Cn("Object.prototype.toString"),rc=GP("%Set%",!0),Gh=Cn("Map.prototype.has",!0),ic=Cn("Map.prototype.get",!0),U_=Cn("Map.prototype.size",!0),ac=Cn("Set.prototype.add",!0),q_=Cn("Set.prototype.delete",!0),sc=Cn("Set.prototype.has",!0),nc=Cn("Set.prototype.size",!0);function z_(t,e,n,r){for(var i=ta(t),a;(a=i.next())&&!a.done;)if(hn(e,a.value,n,r))return q_(t,a.value),!0;return!1}function X_(t){if(typeof t=="undefined")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function WP(t,e,n,r,i,a){var s=X_(n);if(s!=null)return s;var o=ic(e,s),l=W_({},i,{strict:!1});return typeof o=="undefined"&&!Gh(e,s)||!hn(r,o,l,a)?!1:!Gh(t,s)&&hn(r,o,l,a)}function qP(t,e,n){var r=X_(n);return r!=null?r:sc(e,r)&&!sc(t,r)}function G_(t,e,n,r,i,a){for(var s=ta(t),o,l;(o=s.next())&&!o.done;)if(l=o.value,hn(n,l,i,a)&&hn(r,ic(e,l),i,a))return q_(t,l),!0;return!1}function hn(t,e,n,r){var i=n||{};if(i.strict?T_(t,e):t===e)return!0;var a=L_(t),s=L_(e);if(a!==s)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?T_(t,e):t==e;var o=r.has(t),l=r.has(e),c;if(o&&l){if(r.get(t)===r.get(e))return!0}else c={};return o||r.set(t,c),l||r.set(e,c),ZP(t,e,i,r)}function V_(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function XP(t,e,n,r){if(nc(t)!==nc(e))return!1;for(var i=ta(t),a=ta(e),s,o,l;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")l||(l=new rc),ac(l,s.value);else if(!sc(e,s.value)){if(n.strict||!qP(t,e,s.value))return!1;l||(l=new rc),ac(l,s.value)}if(l){for(;(o=a.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!z_(l,o.value,n.strict,r))return!1}else if(!n.strict&&!sc(t,o.value)&&!z_(l,o.value,n.strict,r))return!1;return nc(l)===0}return!0}function YP(t,e,n,r){if(U_(t)!==U_(e))return!1;for(var i=ta(t),a=ta(e),s,o,l,c,u,f;(s=i.next())&&!s.done;)if(c=s.value[0],u=s.value[1],c&&typeof c=="object")l||(l=new rc),ac(l,c);else if(f=ic(e,c),typeof f=="undefined"&&!Gh(e,c)||!hn(u,f,n,r)){if(n.strict||!WP(t,e,c,u,n,r))return!1;l||(l=new rc),ac(l,c)}if(l){for(;(o=a.next())&&!o.done;)if(c=o.value[0],f=o.value[1],c&&typeof c=="object"){if(!G_(l,t,c,f,n,r))return!1}else if(!n.strict&&(!t.has(c)||!hn(ic(t,c),f,n,r))&&!G_(l,t,c,f,W_({},n,{strict:!1}),r))return!1;return nc(l)===0}return!0}function ZP(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||H_(t)!==H_(e)||C_(t)!==C_(e))return!1;var s=F_(t),o=F_(e);if(s!==o)return!1;var l=t instanceof Error,c=e instanceof Error;if(l!==c||(l||c)&&(t.name!==e.name||t.message!==e.message))return!1;var u=I_(t),f=I_(e);if(u!==f||(u||f)&&(t.source!==e.source||A_(t)!==A_(e)))return!1;var d=O_(t),h=O_(e);if(d!==h||(d||h)&&$_(t)!==$_(e)||n.strict&&zh&&zh(t)!==zh(e))return!1;var p=D_(t),m=D_(e);if(p!==m)return!1;if(p||m){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(T[i]!=y[i])return!1;for(i=T.length-1;i>=0;i--)if(a=T[i],!hn(t[a],e[a],n,r))return!1;var S=j_(t),k=j_(e);return S!==k?!1:S==="Set"||k==="Set"?XP(t,e,n,r):S==="Map"?YP(t,e,n,r):!0}Y_.exports=function(e,n,r){return hn(e,n,r,VP())}});var Zh=L((exports,module)=>{v();(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(n){return new Sha256(e,!0).update(n)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(i){return e.create().update(i)};for(var n=0;n>2]|=t[i]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|r&63)<=57344?(o[a>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<=64?(this.block=o[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=this.blocks,c,u,f,d,h,p,m,g,w,b,x;for(c=16;c<64;++c)h=l[c-15],u=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,h=l[c-2],f=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,l[c]=l[c-16]+u+l[c-7]+f<<0;for(x=e&n,c=0;c<64;c+=4)this.first?(this.is224?(g=300032,h=l[0]-1413257819,o=h-150054599<<0,r=h+24177077<<0):(g=704751109,h=l[0]-210244248,o=h-1521486534<<0,r=h+143694565<<0),this.first=!1):(u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),g=t&e,d=g^t&n^x,m=i&a^~i&s,h=o+f+m+K[c]+l[c],p=u+d,o=r+h<<0,r=h+p<<0),u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=r&t,d=w^r&e^g,m=o&i^~o&a,h=s+f+m+K[c+1]+l[c+1],p=u+d,s=n+h<<0,n=h+p<<0,u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=n&r,d=b^n&t^w,m=s&o^~s&i,h=a+f+m+K[c+2]+l[c+2],p=u+d,a=e+h<<0,e=h+p<<0,u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),x=e&n,d=x^e&r^b,m=a&s^~a&o,h=i+f+m+K[c+3]+l[c+3],p=u+d,i=t+h<<0,t=h+p<<0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+s<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15];return this.is224||(l+=HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,r>>24&255,r>>16&255,r>>8&255,r&255,i>>24&255,i>>16&255,i>>8&255,i&255,a>>24&255,a>>16&255,a>>8&255,a&255,s>>24&255,s>>16&255,s>>8&255,s&255];return this.is224||l.push(o>>24&255,o>>16&255,o>>8&255,o&255),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};function HmacSha256(t,e,n){var r,i=typeof t;if(i==="string"){var a=[],s=t.length,o=0,l;for(r=0;r>6,a[o++]=128|l&63):l<55296||l>=57344?(a[o++]=224|l>>12,a[o++]=128|l>>6&63,a[o++]=128|l&63):(l=65536+((l&1023)<<10|t.charCodeAt(++r)&1023),a[o++]=240|l>>18,a[o++]=128|l>>12&63,a[o++]=128|l>>6&63,a[o++]=128|l&63);t=a}else if(i==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);t.length>64&&(t=new Sha256(e,!0).update(t).array());var c=[],u=[];for(r=0;r<64;++r){var f=t[r]||0;c[r]=92^f,u[r]=54^f}Sha256.call(this,e,n),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=n}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var pE=L(_p=>{v();(function(t){var e=/\S/,n=/\"/g,r=/\n/g,i=/\r/g,a=/\\/g,s=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(S,k){var C=S.length,M=0,P=1,$=2,j=M,Q=null,le=null,de="",re=[],Ae=!1,he=0,H=0,U="{{",D="}}";function se(){de.length>0&&(re.push({tag:"_t",text:new String(de)}),de="")}function _e(){for(var Te=!0,Be=H;Be"&&(Re.indent=re[Je].text.toString()),re.splice(Je,1));else Be||re.push({tag:` +`});Ae=!1,H=re.length}function X(Te,Be){var Je="="+D,Re=Te.indexOf(Je,Be),V=c(Te.substring(Te.indexOf("=",Be)+1,Re)).split(" ");return U=V[0],D=V[V.length-1],Re+Je.length-1}for(k&&(k=k.split(" "),U=k[0],D=k[1]),he=0;he0;){if(j=y.shift(),$&&$.tag=="<"&&!(j.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[j.tag]<=t.tags.$||h(j,C))k.push(j),j.nodes=d(y,j.tag,k,C);else if(j.tag=="/"){if(k.length===0)throw new Error("Closing tag without opener: /"+j.n);if(P=k.pop(),j.n!=P.n&&!p(j.n,P.n,C))throw new Error("Nesting error: "+P.n+" vs. "+j.n);return P.end=j.i,M}else j.tag==` +`&&(j.last=y.length==0||y[0].tag==` +`);M.push(j)}if(k.length>0)throw new Error("missing closing tag: "+k.pop().n);return M}function h(y,S){for(var k=0,C=S.length;k":E,"<":function(y,S){var k={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,k);var C=S.partials[E(y,S)];C.subs=k.subs,C.partials=k.partials},$:function(y,S){var k={subs:{},code:"",partials:S.partials,prefix:y.n};t.walk(y.nodes,k),S.subs[y.n]=k.code,S.inPartial||(S.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,S){S.code+=T('"\\n"'+(y.last?"":" + i"))},_v:function(y,S){S.code+="t.b(t.v(t."+x(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,S){S.code+=T('"'+b(y.text)+'"')},"{":_,"&":_};function _(y,S){S.code+="t.b(t.t(t."+x(y.n)+'("'+b(y.n)+'",c,p,0)));'}function T(y){return"t.b("+y+");"}t.walk=function(y,S){for(var k,C=0,M=y.length;C{v();var sL={};(function(t){t.Template=function(d,h,p,m){d=d||{},this.r=d.code||this.r,this.c=p,this.options=m||{},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,m){return this.ri([h],p||{},m)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],m=h[p.name];if(p.instance&&p.base==m)return p.instance;if(typeof m=="string"){if(!this.c)throw new Error("No compiler available.");m=this.c.compile(m,this.options)}if(!m)return null;if(this.partials[d].base=m,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);m=n(m,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=m,m},rp:function(d,h,p,m){var g=this.ep(d,p);return g?g.ri(h,p,m):""},rs:function(d,h,p){var m=d[d.length-1];if(!f(m)){p(d,h,this);return}for(var g=0;g=0;E--)if(w=h[E],g=e(d,w,x),g!==void 0){b=!0;break}return b?(!m&&typeof g=="function"&&(g=this.mv(g,h,p)),g):m?!1:""},ls:function(d,h,p,m,g){var w=this.options.delimiters;return this.options.delimiters=g,this.b(this.ct(c(d.call(h,m)),h,p)),this.options.delimiters=w,!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,m,g,w,b){var x,E=h[h.length-1],_=d.call(E);return typeof _=="function"?m?!0:(x=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(_,E,p,x.substring(g,w),b)):_},mv:function(d,h,p){var m=h[h.length-1],g=d.call(m);return typeof g=="function"?this.ct(c(g.call(m)),m,p):g},sub:function(d,h,p,m){var g=this.subs[d];g&&(this.activeSub=d,g(h,p,this,m),this.activeSub=!1)}};function e(d,h,p){var m;return h&&typeof h=="object"&&(h[d]!==void 0?m=h[d]:p&&h.get&&typeof h.get=="function"&&(m=h.get(d))),m}function n(d,h,p,m,g,w){function b(){}b.prototype=d;function x(){}x.prototype=d.subs;var E,_=new b;_.subs=new x,_.subsText={},_.buf="",m=m||{},_.stackSubs=m,_.subsText=w;for(E in h)m[E]||(m[E]=h[E]);for(E in m)_.subs[E]=m[E];g=g||{},_.stackPartials=g;for(E in p)g[E]||(g[E]=p[E]);for(E in g)_.partials[E]=g[E];return _}var r=/&/g,i=//g,s=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(r,"&").replace(i,"<").replace(a,">").replace(s,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof Sp!="undefined"?Sp:sL)});var Ep=L((lU,gE)=>{v();var Rc=pE();Rc.Template=mE().Template;Rc.template=Rc.Template;gE.exports=Rc});var JE=L((ro,Np)=>{v();(function(e,n){typeof ro=="object"&&typeof Np=="object"?Np.exports=n():typeof define=="function"&&define.amd?define([],n):typeof ro=="object"?ro.feather=n():e.feather=n()})(typeof self!="undefined"?self:ro,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,a){n.o(r,i)||Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:a})},n.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=0)}({"./dist/icons.json":function(t){t.exports={activity:'',airplay:'',"alert-circle":'',"alert-octagon":'',"alert-triangle":'',"align-center":'',"align-justify":'',"align-left":'',"align-right":'',anchor:'',aperture:'',archive:'',"arrow-down-circle":'',"arrow-down-left":'',"arrow-down-right":'',"arrow-down":'',"arrow-left-circle":'',"arrow-left":'',"arrow-right-circle":'',"arrow-right":'',"arrow-up-circle":'',"arrow-up-left":'',"arrow-up-right":'',"arrow-up":'',"at-sign":'',award:'',"bar-chart-2":'',"bar-chart":'',"battery-charging":'',battery:'',"bell-off":'',bell:'',bluetooth:'',bold:'',"book-open":'',book:'',bookmark:'',box:'',briefcase:'',calendar:'',"camera-off":'',camera:'',cast:'',"check-circle":'',"check-square":'',check:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"chevrons-down":'',"chevrons-left":'',"chevrons-right":'',"chevrons-up":'',chrome:'',circle:'',clipboard:'',clock:'',"cloud-drizzle":'',"cloud-lightning":'',"cloud-off":'',"cloud-rain":'',"cloud-snow":'',cloud:'',code:'',codepen:'',codesandbox:'',coffee:'',columns:'',command:'',compass:'',copy:'',"corner-down-left":'',"corner-down-right":'',"corner-left-down":'',"corner-left-up":'',"corner-right-down":'',"corner-right-up":'',"corner-up-left":'',"corner-up-right":'',cpu:'',"credit-card":'',crop:'',crosshair:'',database:'',delete:'',disc:'',"divide-circle":'',"divide-square":'',divide:'',"dollar-sign":'',"download-cloud":'',download:'',dribbble:'',droplet:'',"edit-2":'',"edit-3":'',edit:'',"external-link":'',"eye-off":'',eye:'',facebook:'',"fast-forward":'',feather:'',figma:'',"file-minus":'',"file-plus":'',"file-text":'',file:'',film:'',filter:'',flag:'',"folder-minus":'',"folder-plus":'',folder:'',framer:'',frown:'',gift:'',"git-branch":'',"git-commit":'',"git-merge":'',"git-pull-request":'',github:'',gitlab:'',globe:'',grid:'',"hard-drive":'',hash:'',headphones:'',heart:'',"help-circle":'',hexagon:'',home:'',image:'',inbox:'',info:'',instagram:'',italic:'',key:'',layers:'',layout:'',"life-buoy":'',"link-2":'',link:'',linkedin:'',list:'',loader:'',lock:'',"log-in":'',"log-out":'',mail:'',"map-pin":'',map:'',"maximize-2":'',maximize:'',meh:'',menu:'',"message-circle":'',"message-square":'',"mic-off":'',mic:'',"minimize-2":'',minimize:'',"minus-circle":'',"minus-square":'',minus:'',monitor:'',moon:'',"more-horizontal":'',"more-vertical":'',"mouse-pointer":'',move:'',music:'',"navigation-2":'',navigation:'',octagon:'',package:'',paperclip:'',"pause-circle":'',pause:'',"pen-tool":'',percent:'',"phone-call":'',"phone-forwarded":'',"phone-incoming":'',"phone-missed":'',"phone-off":'',"phone-outgoing":'',phone:'',"pie-chart":'',"play-circle":'',play:'',"plus-circle":'',"plus-square":'',plus:'',pocket:'',power:'',printer:'',radio:'',"refresh-ccw":'',"refresh-cw":'',repeat:'',rewind:'',"rotate-ccw":'',"rotate-cw":'',rss:'',save:'',scissors:'',search:'',send:'',server:'',settings:'',"share-2":'',share:'',"shield-off":'',shield:'',"shopping-bag":'',"shopping-cart":'',shuffle:'',sidebar:'',"skip-back":'',"skip-forward":'',slack:'',slash:'',sliders:'',smartphone:'',smile:'',speaker:'',square:'',star:'',"stop-circle":'',sun:'',sunrise:'',sunset:'',table:'',tablet:'',tag:'',target:'',terminal:'',thermometer:'',"thumbs-down":'',"thumbs-up":'',"toggle-left":'',"toggle-right":'',tool:'',"trash-2":'',trash:'',trello:'',"trending-down":'',"trending-up":'',triangle:'',truck:'',tv:'',twitch:'',twitter:'',type:'',umbrella:'',underline:'',unlock:'',"upload-cloud":'',upload:'',"user-check":'',"user-minus":'',"user-plus":'',"user-x":'',user:'',users:'',"video-off":'',video:'',voicemail:'',"volume-1":'',"volume-2":'',"volume-x":'',volume:'',watch:'',"wifi-off":'',wifi:'',wind:'',"x-circle":'',"x-octagon":'',"x-square":'',x:'',youtube:'',"zap-off":'',zap:'',"zoom-in":'',"zoom-out":''}},"./node_modules/classnames/dedupe.js":function(t,e,n){var r,i;(function(){"use strict";var a=function(){function s(){}s.prototype=Object.create(null);function o(m,g){for(var w=g.length,b=0;b1?arguments[1]:void 0,g=m!==void 0,w=0,b=c(d),x,E,_,T;if(g&&(m=r(m,p>2?arguments[2]:void 0,2)),b!=null&&!(h==Array&&s(b)))for(T=b.call(d),E=new h;!(_=T.next()).done;w++)l(E,w,g?a(T,m,[_.value,w],!0):_.value);else for(x=o(d.length),E=new h(x);x>w;w++)l(E,w,g?m(d[w],w):d[w]);return E.length=w,E}},"./node_modules/core-js/internals/array-includes.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-indexed-object.js"),i=n("./node_modules/core-js/internals/to-length.js"),a=n("./node_modules/core-js/internals/to-absolute-index.js");t.exports=function(s){return function(o,l,c){var u=r(o),f=i(u.length),d=a(c,f),h;if(s&&l!=l){for(;f>d;)if(h=u[d++],h!=h)return!0}else for(;f>d;d++)if((s||d in u)&&u[d]===l)return s||d||0;return!s&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(t,e,n){var r=n("./node_modules/core-js/internals/a-function.js");t.exports=function(i,a,s){if(r(i),a===void 0)return i;switch(s){case 0:return function(){return i.call(a)};case 1:return function(o){return i.call(a,o)};case 2:return function(o,l){return i.call(a,o,l)};case 3:return function(o,l,c){return i.call(a,o,l,c)}}return function(){return i.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(t,e,n){var r=n("./node_modules/core-js/internals/an-object.js");t.exports=function(i,a,s,o){try{return o?a(r(s)[0],s[1]):a(s)}catch(c){var l=i.return;throw l!==void 0&&r(l.call(i)),c}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(t,e,n){var r=n("./node_modules/core-js/internals/well-known-symbol.js"),i=r("iterator"),a=!1;try{var s=0,o={next:function(){return{done:!!s++}},return:function(){a=!0}};o[i]=function(){return this},Array.from(o,function(){throw 2})}catch(l){}t.exports=function(l,c){if(!c&&!a)return!1;var u=!1;try{var f={};f[i]=function(){return{next:function(){return{done:u=!0}}}},l(f)}catch(d){}return u}},"./node_modules/core-js/internals/classof-raw.js":function(t,e){var n={}.toString;t.exports=function(r){return n.call(r).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(t,e,n){var r=n("./node_modules/core-js/internals/classof-raw.js"),i=n("./node_modules/core-js/internals/well-known-symbol.js"),a=i("toStringTag"),s=r(function(){return arguments}())=="Arguments",o=function(l,c){try{return l[c]}catch(u){}};t.exports=function(l){var c,u,f;return l===void 0?"Undefined":l===null?"Null":typeof(u=o(c=Object(l),a))=="string"?u:s?r(c):(f=r(c))=="Object"&&typeof c.callee=="function"?"Arguments":f}},"./node_modules/core-js/internals/copy-constructor-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/own-keys.js"),a=n("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),s=n("./node_modules/core-js/internals/object-define-property.js");t.exports=function(o,l){for(var c=i(l),u=s.f,f=a.f,d=0;d",x="java"+w+":",E;for(p.style.display="none",o.appendChild(p),p.src=String(x),E=p.contentWindow.document,E.open(),E.write(g+w+b+"document.F=Object"+g+"/"+w+b),E.close(),h=E.F;m--;)delete h[f][a[m]];return h()};t.exports=Object.create||function(m,g){var w;return m!==null?(d[f]=r(m),w=new d,d[f]=null,w[u]=m):w=h(),g===void 0?w:i(w,g)},s[u]=!0},"./node_modules/core-js/internals/object-define-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-define-property.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/object-keys.js");t.exports=r?Object.defineProperties:function(l,c){a(l);for(var u=s(c),f=u.length,d=0,h;f>d;)i.f(l,h=u[d++],c[h]);return l}},"./node_modules/core-js/internals/object-define-property.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/ie8-dom-define.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/to-primitive.js"),o=Object.defineProperty;e.f=r?o:function(c,u,f){if(a(c),u=s(u,!0),a(f),i)try{return o(c,u,f)}catch(d){}if("get"in f||"set"in f)throw TypeError("Accessors not supported");return"value"in f&&(c[u]=f.value),c}},"./node_modules/core-js/internals/object-get-own-property-descriptor.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-property-is-enumerable.js"),a=n("./node_modules/core-js/internals/create-property-descriptor.js"),s=n("./node_modules/core-js/internals/to-indexed-object.js"),o=n("./node_modules/core-js/internals/to-primitive.js"),l=n("./node_modules/core-js/internals/has.js"),c=n("./node_modules/core-js/internals/ie8-dom-define.js"),u=Object.getOwnPropertyDescriptor;e.f=r?u:function(d,h){if(d=s(d),h=o(h,!0),c)try{return u(d,h)}catch(p){}if(l(d,h))return a(!i.f.call(d,h),d[h])}},"./node_modules/core-js/internals/object-get-own-property-names.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js"),a=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return r(o,a)}},"./node_modules/core-js/internals/object-get-own-property-symbols.js":function(t,e){e.f=Object.getOwnPropertySymbols},"./node_modules/core-js/internals/object-get-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-object.js"),a=n("./node_modules/core-js/internals/shared-key.js"),s=n("./node_modules/core-js/internals/correct-prototype-getter.js"),o=a("IE_PROTO"),l=Object.prototype;t.exports=s?Object.getPrototypeOf:function(c){return c=i(c),r(c,o)?c[o]:typeof c.constructor=="function"&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?l:null}},"./node_modules/core-js/internals/object-keys-internal.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-indexed-object.js"),a=n("./node_modules/core-js/internals/array-includes.js"),s=n("./node_modules/core-js/internals/hidden-keys.js"),o=a(!1);t.exports=function(l,c){var u=i(l),f=0,d=[],h;for(h in u)!r(s,h)&&r(u,h)&&d.push(h);for(;c.length>f;)r(u,h=c[f++])&&(~o(d,h)||d.push(h));return d}},"./node_modules/core-js/internals/object-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js");t.exports=Object.keys||function(s){return r(s,i)}},"./node_modules/core-js/internals/object-property-is-enumerable.js":function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!r.call({1:2},1);e.f=a?function(o){var l=i(this,o);return!!l&&l.enumerable}:r},"./node_modules/core-js/internals/object-set-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,a={},s;try{s=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,s.call(a,[]),i=a instanceof Array}catch(o){}return function(l,c){return r(l,c),i?s.call(l,c):l.__proto__=c,l}}():void 0)},"./node_modules/core-js/internals/own-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/object-get-own-property-names.js"),a=n("./node_modules/core-js/internals/object-get-own-property-symbols.js"),s=n("./node_modules/core-js/internals/an-object.js"),o=r.Reflect;t.exports=o&&o.ownKeys||function(c){var u=i.f(s(c)),f=a.f;return f?u.concat(f(c)):u}},"./node_modules/core-js/internals/path.js":function(t,e,n){t.exports=n("./node_modules/core-js/internals/global.js")},"./node_modules/core-js/internals/redefine.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/hide.js"),s=n("./node_modules/core-js/internals/has.js"),o=n("./node_modules/core-js/internals/set-global.js"),l=n("./node_modules/core-js/internals/function-to-string.js"),c=n("./node_modules/core-js/internals/internal-state.js"),u=c.get,f=c.enforce,d=String(l).split("toString");i("inspectSource",function(h){return l.call(h)}),(t.exports=function(h,p,m,g){var w=g?!!g.unsafe:!1,b=g?!!g.enumerable:!1,x=g?!!g.noTargetGet:!1;if(typeof m=="function"&&(typeof p=="string"&&!s(m,"name")&&a(m,"name",p),f(m).source=d.join(typeof p=="string"?p:"")),h===r){b?h[p]=m:o(p,m);return}else w?!x&&h[p]&&(b=!0):delete h[p];b?h[p]=m:a(h,p,m)})(Function.prototype,"toString",function(){return typeof this=="function"&&u(this).source||l.call(this)})},"./node_modules/core-js/internals/require-object-coercible.js":function(t,e){t.exports=function(n){if(n==null)throw TypeError("Can't call method on "+n);return n}},"./node_modules/core-js/internals/set-global.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/hide.js");t.exports=function(a,s){try{i(r,a,s)}catch(o){r[a]=s}return s}},"./node_modules/core-js/internals/set-to-string-tag.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-define-property.js").f,i=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/well-known-symbol.js"),s=a("toStringTag");t.exports=function(o,l,c){o&&!i(o=c?o:o.prototype,s)&&r(o,s,{configurable:!0,value:l})}},"./node_modules/core-js/internals/shared-key.js":function(t,e,n){var r=n("./node_modules/core-js/internals/shared.js"),i=n("./node_modules/core-js/internals/uid.js"),a=r("keys");t.exports=function(s){return a[s]||(a[s]=i(s))}},"./node_modules/core-js/internals/shared.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/set-global.js"),a=n("./node_modules/core-js/internals/is-pure.js"),s="__core-js_shared__",o=r[s]||i(s,{});(t.exports=function(l,c){return o[l]||(o[l]=c!==void 0?c:{})})("versions",[]).push({version:"3.1.3",mode:a?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},"./node_modules/core-js/internals/string-at.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a,s,o){var l=String(i(a)),c=r(s),u=l.length,f,d;return c<0||c>=u?o?"":void 0:(f=l.charCodeAt(c),f<55296||f>56319||c+1===u||(d=l.charCodeAt(c+1))<56320||d>57343?o?l.charAt(c):f:o?l.slice(c,c+2):(f-55296<<10)+(d-56320)+65536)}},"./node_modules/core-js/internals/to-absolute-index.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.max,a=Math.min;t.exports=function(s,o){var l=r(s);return l<0?i(l+o,0):a(l,o)}},"./node_modules/core-js/internals/to-indexed-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/indexed-object.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a){return r(i(a))}},"./node_modules/core-js/internals/to-integer.js":function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(i){return isNaN(i=+i)?0:(i>0?r:n)(i)}},"./node_modules/core-js/internals/to-length.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.min;t.exports=function(a){return a>0?i(r(a),9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(i){return Object(r(i))}},"./node_modules/core-js/internals/to-primitive.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js");t.exports=function(i,a){if(!r(i))return i;var s,o;if(a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i))||typeof(s=i.valueOf)=="function"&&!r(o=s.call(i))||!a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i)))return o;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/internals/uid.js":function(t,e){var n=0,r=Math.random();t.exports=function(i){return"Symbol(".concat(i===void 0?"":i,")_",(++n+r).toString(36))}},"./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js"),i=n("./node_modules/core-js/internals/an-object.js");t.exports=function(a,s){if(i(a),!r(s)&&s!==null)throw TypeError("Can't set "+String(s)+" as a prototype")}},"./node_modules/core-js/internals/well-known-symbol.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/uid.js"),s=n("./node_modules/core-js/internals/native-symbol.js"),o=r.Symbol,l=i("wks");t.exports=function(c){return l[c]||(l[c]=s&&o[c]||(s?o:a)("Symbol."+c))}},"./node_modules/core-js/modules/es.array.from.js":function(t,e,n){var r=n("./node_modules/core-js/internals/export.js"),i=n("./node_modules/core-js/internals/array-from.js"),a=n("./node_modules/core-js/internals/check-correctness-of-iteration.js"),s=!a(function(o){Array.from(o)});r({target:"Array",stat:!0,forced:s},{from:i})},"./node_modules/core-js/modules/es.string.iterator.js":function(t,e,n){"use strict";var r=n("./node_modules/core-js/internals/string-at.js"),i=n("./node_modules/core-js/internals/internal-state.js"),a=n("./node_modules/core-js/internals/define-iterator.js"),s="String Iterator",o=i.set,l=i.getterFor(s);a(String,"String",function(c){o(this,{type:s,string:String(c),index:0})},function(){var u=l(this),f=u.string,d=u.index,h;return d>=f.length?{value:void 0,done:!0}:(h=r(f,d,!0),u.index+=h.length,{value:h,done:!1})})},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(r){typeof window=="object"&&(n=window)}t.exports=n},"./src/default-attrs.json":function(t){t.exports={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"}},"./src/icon.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(h){for(var p=1;p2&&arguments[2]!==void 0?arguments[2]:[];u(this,h),this.name=p,this.contents=m,this.tags=g,this.attrs=r({},l.default,{class:"feather feather-"+p})}return i(h,[{key:"toSvg",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},g=r({},this.attrs,m,{class:(0,s.default)(this.attrs.class,m.class)});return""+this.contents+""}},{key:"toString",value:function(){return this.contents}}]),h}();function d(h){return Object.keys(h).map(function(p){return p+'="'+h[p]+'"'}).join(" ")}e.default=f},"./src/icons.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icon.js"),i=c(r),a=n("./dist/icons.json"),s=c(a),o=n("./src/tags.json"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}e.default=Object.keys(s.default).map(function(u){return new i.default(u,s.default[u],l.default[u])}).reduce(function(u,f){return u[f.name]=f,u},{})},"./src/index.js":function(t,e,n){"use strict";var r=n("./src/icons.js"),i=c(r),a=n("./src/to-svg.js"),s=c(a),o=n("./src/replace.js"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}t.exports={icons:i.default,toSvg:s.default,replace:l.default}},"./src/replace.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(d){for(var h=1;h0&&arguments[0]!==void 0?arguments[0]:{};if(typeof document=="undefined")throw new Error("`feather.replace()` only works in a browser environment.");var h=document.querySelectorAll("[data-feather]");Array.from(h).forEach(function(p){return u(p,d)})}function u(d){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=f(d),m=p["data-feather"];if(delete p["data-feather"],o.default[m]===void 0){console.warn("feather: '"+m+"' is not a valid icon");return}var g=o.default[m].toSvg(r({},h,p,{class:(0,a.default)(h.class,p.class)})),w=new DOMParser().parseFromString(g,"image/svg+xml"),b=w.querySelector("svg");d.parentNode.replaceChild(b,d)}function f(d){return Array.from(d.attributes).reduce(function(h,p){return h[p.name]=p.value,h},{})}e.default=c},"./src/tags.json":function(t){t.exports={activity:["pulse","health","action","motion"],airplay:["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],anchor:[],archive:["index","box"],"at-sign":["mention","at","email","message"],award:["achievement","badge"],aperture:["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],battery:["power","electricity"],"battery-charging":["power","electricity"],bell:["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],bluetooth:["wireless"],"book-open":["read","library"],book:["read","dictionary","booklet","magazine","library"],bookmark:["read","clip","marker","tag"],box:["cube"],briefcase:["work","bag","baggage","folder"],calendar:["date"],camera:["photo"],cast:["chromecast","airplay"],"chevron-down":["expand"],"chevron-up":["collapse"],circle:["off","zero","record"],clipboard:["copy"],clock:["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],cloud:["weather"],codepen:["logo"],codesandbox:["logo"],code:["source","programming"],coffee:["drink","cup","mug","tea","cafe","hot","beverage"],columns:["layout"],command:["keyboard","cmd","terminal","prompt"],compass:["navigation","safari","travel","direction"],copy:["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],cpu:["processor","technology"],"credit-card":["purchase","payment","cc"],crop:["photo","image"],crosshair:["aim","target"],database:["storage","memory"],delete:["remove"],disc:["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],droplet:["water"],edit:["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],eye:["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],facebook:["logo","social"],"fast-forward":["music"],figma:["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],film:["movie","video"],filter:["funnel","hopper"],flag:["report"],"folder-minus":["directory"],"folder-plus":["directory"],folder:["directory"],framer:["logo","design","tool"],frown:["emoji","face","bad","sad","emotion"],gift:["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],github:["logo","version control"],gitlab:["logo","version control"],globe:["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],hash:["hashtag","number","pound"],headphones:["music","audio","sound"],heart:["like","love","emotion"],"help-circle":["question mark"],hexagon:["shape","node.js","logo"],home:["house","living"],image:["picture"],inbox:["email"],instagram:["logo","camera"],key:["password","login","authentication","secure"],layers:["stack"],layout:["window","webpage"],"life-buoy":["help","life ring","support"],link:["chain","url"],"link-2":["chain","url"],linkedin:["logo","social media"],list:["options"],lock:["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],mail:["email","message"],"map-pin":["location","navigation","travel","marker"],map:["location","navigation","travel"],maximize:["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],meh:["emoji","face","neutral","emotion"],menu:["bars","navigation","hamburger"],"message-circle":["comment","chat"],"message-square":["comment","chat"],"mic-off":["record","sound","mute"],mic:["record","sound","listen"],minimize:["exit fullscreen","close"],"minimize-2":["exit fullscreen","arrows","close"],minus:["subtract"],monitor:["tv","screen","display"],moon:["dark","night"],"more-horizontal":["ellipsis"],"more-vertical":["ellipsis"],"mouse-pointer":["arrow","cursor"],move:["arrows"],music:["note"],navigation:["location","travel"],"navigation-2":["location","travel"],octagon:["stop"],package:["box","container"],paperclip:["attachment"],pause:["music","stop"],"pause-circle":["music","audio","stop"],"pen-tool":["vector","drawing"],percent:["discount"],"phone-call":["ring"],"phone-forwarded":["call"],"phone-incoming":["call"],"phone-missed":["call"],"phone-off":["call","mute"],"phone-outgoing":["call"],phone:["call"],play:["music","start"],"pie-chart":["statistics","diagram"],"play-circle":["music","start"],plus:["add","new"],"plus-circle":["add","new"],"plus-square":["add","new"],pocket:["logo","save"],power:["on","off"],printer:["fax","office","device"],radio:["signal"],"refresh-cw":["synchronise","arrows"],"refresh-ccw":["arrows"],repeat:["loop","arrows"],rewind:["music"],"rotate-ccw":["arrow"],"rotate-cw":["arrow"],rss:["feed","subscribe"],save:["floppy disk"],scissors:["cut"],search:["find","magnifier","magnifying glass"],send:["message","mail","email","paper airplane","paper aeroplane"],settings:["cog","edit","gear","preferences"],"share-2":["network","connections"],shield:["security","secure"],"shield-off":["security","insecure"],"shopping-bag":["ecommerce","cart","purchase","store"],"shopping-cart":["ecommerce","cart","purchase","store"],shuffle:["music"],"skip-back":["music"],"skip-forward":["music"],slack:["logo"],slash:["ban","no"],sliders:["settings","controls"],smartphone:["cellphone","device"],smile:["emoji","face","happy","good","emotion"],speaker:["audio","music"],star:["bookmark","favorite","like"],"stop-circle":["media","music"],sun:["brightness","weather","light"],sunrise:["weather","time","morning","day"],sunset:["weather","time","evening","night"],tablet:["device"],tag:["label"],target:["logo","bullseye"],terminal:["code","command line","prompt"],thermometer:["temperature","celsius","fahrenheit","weather"],"thumbs-down":["dislike","bad","emotion"],"thumbs-up":["like","good","emotion"],"toggle-left":["on","off","switch"],"toggle-right":["on","off","switch"],tool:["settings","spanner"],trash:["garbage","delete","remove","bin"],"trash-2":["garbage","delete","remove","bin"],triangle:["delta"],truck:["delivery","van","shipping","transport","lorry"],tv:["television","stream"],twitch:["logo"],twitter:["logo","social"],type:["text"],umbrella:["rain","weather"],unlock:["security"],"user-check":["followed","subscribed"],"user-minus":["delete","remove","unfollow","unsubscribe"],"user-plus":["new","add","create","follow","subscribe"],"user-x":["delete","remove","unfollow","unsubscribe","unavailable"],user:["person","account"],users:["group"],"video-off":["camera","movie","film"],video:["camera","movie","film"],voicemail:["phone"],volume:["music","sound","mute"],"volume-1":["music","sound"],"volume-2":["music","sound"],"volume-x":["music","sound","mute"],watch:["clock","time"],"wifi-off":["disabled"],wifi:["connection","signal","wireless"],wind:["weather","air"],"x-circle":["cancel","close","delete","remove","times","clear"],"x-octagon":["delete","stop","alert","warning","times","clear"],"x-square":["cancel","close","delete","remove","times","clear"],x:["cancel","close","delete","remove","times","clear"],youtube:["logo","video","play"],"zap-off":["flash","camera","lightning"],zap:["flash","camera","lightning"],"zoom-in":["magnifying glass"],"zoom-out":["magnifying glass"]}},"./src/to-svg.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icons.js"),i=a(r);function a(o){return o&&o.__esModule?o:{default:o}}function s(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead."),!o)throw new Error("The required `key` (icon name) parameter is missing.");if(!i.default[o])throw new Error("No icon matching '"+o+"'. See the complete list of icons at https://feathericons.com");return i.default[o].toSvg(l)}e.default=s},0:function(t,e,n){n("./node_modules/core-js/es/array/from.js"),t.exports=n("./src/index.js")}})})});var dj={};Ck(dj,{default:()=>tu});module.exports=Fk(dj);v();v();var Va=Ve(mm(),1),Cf=Ve(Em(),1),t1=Ve(Am(),1),Uo=Ve(h0(),1),Oo=Ve(g0(),1),n1=Ve(k0(),1),cn=Ve(T0(),1),r1=Ve(I0(),1),ge=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 n=new t(e.message);return n.code=e.code,n.data=e.data,n.caller=e.caller,n.stack=e.stack,n}get isIsomorphicGitError(){return!0}},Wa=class t extends ge{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}}};Wa.code="UnmergedPathsError";var ce=class t extends ge{constructor(e){super(`An internal error caused this command to fail. 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}}};ce.code="InternalError";var _i=class t extends ge{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};_i.code="UnsafeFilepathError";var Jt=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 n=this.buffer.slice(this._start,this._start+e);return this._start+=e,n}toString(e,n){let r=this.buffer.toString(e,this._start,this._start+n);return this._start+=n,r}write(e,n,r){let i=this.buffer.write(e,this._start,n,r);return this._start+=n,i}copy(e,n,r){let i=e.copy(this.buffer,this._start,n,r);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let n=this.buffer.writeUInt8(e,this._start);return this._start+=1,n}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let n=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,n}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let n=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,n}};function zo(t,e){return-(te)}function i1(t,e){return zo(t.path,e.path)}function a1(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let n=t&511;return n&73?n=493:n=420,e!==8&&(n=0),(e<<12)+n}var En=2**32;function P0(t,e,n,r){if(t!==void 0&&e!==void 0)return[t,e];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3),a=(n-i*1e3)*1e6;return[i,a]}function Si(t){let[e,n]=P0(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[r,i]=P0(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%En,ctimeNanoseconds:n%En,mtimeSeconds:r%En,mtimeNanoseconds:i%En,dev:t.dev%En,ino:t.ino%En,mode:a1(t.mode%En),uid:t.uid%En,gid:t.gid%En,size:t.size>-1?t.size%En:0}}function OT(t){let e="";for(let n of new Uint8Array(t))n<16&&(e+="0"),e+=n.toString(16);return e}var sf=null;async function $n(t){return sf===null&&(sf=await PT()),sf?s1(t):IT(t)}function IT(t){return new Cf.default().update(t).digest("hex")}async function s1(t){let e=await crypto.subtle.digest("SHA-1",t);return OT(e)}async function PT(){try{if(await s1(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch(t){}return!1}function RT(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function LT(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var gf=class t{constructor(e,n){this._dirty=!1,this._unmergedPaths=n||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 n=this._entries.get(e.path);n||(this._entries.set(e.path,e),n=e),n.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new ce("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ce("Index file is empty (.git/index)");let n=new t,r=new Jt(e),i=r.toString("utf8",4);if(i!=="DIRC")throw new ce(`Invalid dircache magic file number: ${i}`);let a=await $n(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new ce(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=r.readUInt32BE();if(o!==2)throw new ce(`Unsupported dircache version: ${o}`);let l=r.readUInt32BE(),c=0;for(;!r.eof()&&ce.stages.length>1?e.stages.filter(n=>n):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:n,oid:r,stage:i=0}){n||(n={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),n=Si(n);let a=Buffer.from(e),s={ctimeSeconds:n.ctimeSeconds,ctimeNanoseconds:n.ctimeNanoseconds,mtimeSeconds:n.mtimeSeconds,mtimeNanoseconds:n.mtimeNanoseconds,dev:n.dev,ino:n.ino,mode:n.mode||33188,uid:n.uid,gid:n.gid,size:n.size,path:e,oid:r,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let n of this._entries.keys())n.startsWith(e+"/")&&this._entries.delete(n);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 n=Buffer.from(e.path),r=Math.ceil((62+n.length+1)/8)*8,i=Buffer.alloc(r),a=new Jt(i),s=Si(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(LT(e)),a.write(e.path,n.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),n=new Jt(e);n.write("DIRC",4,"utf8"),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let r=[];for(let o of this.entries)if(r.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&r.push(t._entryToBuffer(l));r=await Promise.all(r);let i=Buffer.concat(r),a=Buffer.concat([e,i]),s=await $n(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Io(t,e,n=!0,r=!0){let i=Si(t),a=Si(e);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}var of=null,bi=Symbol("IndexCache");function jT(){return{map:new Map,stats:new Map}}async function DT(t,e,n){let r=await t.lstat(e),i=await t.read(e),a=await gf.from(i);n.map.set(e,a),n.stats.set(e,r)}async function BT(t,e,n){let r=n.stats.get(e);if(r===void 0)return!0;let i=await t.lstat(e);return r===null||i===null?!1:Io(r,i)}var it=class{static async acquire({fs:e,gitdir:n,cache:r,allowUnmerged:i=!0},a){r[bi]||(r[bi]=jT());let s=`${n}/index`;of===null&&(of=new Va.default({maxPending:1/0}));let o,l=[];return await of.acquire(s,async()=>{await BT(e,s,r[bi])&&await DT(e,s,r[bi]);let c=r[bi].map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new Wa(l);if(o=await a(c),c._dirty){let u=await c.toObject();await e.write(s,u),r[bi].stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function Po(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function Ei(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function o1(t){let e=new Map,n=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:Po(i),metadata:{},children:[]};e.set(i,a),a.parent=n(Ei(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},r=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:Po(i),metadata:a,parent:n(Ei(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};n(".");for(let i of t)r(i.path,i);return e}function NT(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 ce(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var yf=class{constructor({fs:e,gitdir:n,cache:r}){this.treePromise=it.acquire({fs:e,gitdir:n,cache:r},async function(a){return o1(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let n=e._fullpath,i=(await this.treePromise).get(n);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${n}'`);let a=i.children.map(s=>s.fullpath);return a.sort(zo),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 r=(await this.treePromise).get(e._fullpath);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.type==="tree"?{}:Si(r.metadata);e._type=r.type==="tree"?"tree":NT(i.mode),e._mode=i.mode,r.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let r=(await this.treePromise).get(e._fullpath);e._oid=r.metadata.oid}return e._oid}},Go=Symbol("GitWalkSymbol");function Vo(){let t=Object.create(null);return Object.defineProperty(t,Go,{value:function({fs:e,gitdir:n,cache:r}){return new yf({fs:e,gitdir:n,cache:r})}}),Object.freeze(t),t}var Me=class t extends ge{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Me.code="NotFoundError";var kt=class t extends ge{constructor(e,n,r,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=t.code,this.data={oid:e,actual:n,expected:r,filepath:i}}};kt.code="ObjectTypeError";var or=class t extends ge{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};or.code="InvalidOidError";var qa=class t extends ge{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}}};qa.code="NoRefspecError";var Ro=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let n=null;this.parsedConfig=e.trim().split(` +`).map(r=>{if(/^\s*#/.test(r))return{line:r,comment:!0};let i=r.indexOf(" ");if(r.startsWith("^")){let a=r.slice(1);return this.refs.set(n+"^{}",a),{line:r,ref:n,peeled:a}}else{let a=r.slice(0,i);return n=r.slice(i+1),this.refs.set(n,a),{line:r,ref:n,oid:a}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(n=>n.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` +`)+` +`}},Lo=class t{constructor({remotePath:e,localPath:n,force:r,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:n,force:r,matchPrefix:i})}static from(e){let[n,r,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=n==="+",l=i==="*";if(l!==(s==="*"))throw new ce("Invalid refspec");return new t({remotePath:r,localPath:a,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}},vf=class t{constructor(e=[]){this.rules=e}static from(e){let n=[];for(let r of e)n.push(Lo.from(r));return new t(n)}add(e){let n=Lo.from(e);this.rules.push(n)}translate(e){let n=[];for(let r of this.rules)for(let i of e){let a=r.translate(i);a&&n.push([i,a])}return n}translateOne(e){let n=null;for(let r of this.rules){let i=r.translate(e);i&&(n=i)}return n}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function $T(t,e){let n=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),i=-(nr);return i===0?t.endsWith("^{}")?1:-1:i}var R0=new Map;function L0(t){let e=R0.get(t);return e||(e=HT(t),R0.set(t,e)),e}function HT(t){return t=t.split("/./").join("/").replace(/\/{2,}/g,"/"),t==="/."?"/":t==="./"||(t.startsWith("./")&&(t=t.slice(2)),t.endsWith("/.")&&(t=t.slice(0,-2)),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t==="")?".":t}function B(...t){return L0(t.map(L0).join("/"))}var UT=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},Ga=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}`)},j0={core:{filemode:Ga,bare:Ga,logallrefupdates:Ga,symlinks:Ga,ignorecase:Ga,bigFileThreshold:UT}},zT=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,GT=/^[A-Za-z0-9-.]+$/,VT=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,WT=/^[A-Za-z][A-Za-z-]*$/,qT=/^(.*?)( *[#;].*)$/,XT=t=>{let e=zT.exec(t);if(e!=null){let[n,r]=e.slice(1);return[n,r]}return null},YT=t=>{let e=VT.exec(t);if(e!=null){let[n,r="true"]=e.slice(1),i=ZT(r),a=KT(i);return[n,a]}return null},ZT=t=>{let e=qT.exec(t);if(e==null)return t;let[n,r]=e.slice(1);return D0(n)&&D0(r)?`${n}${r}`:n},D0=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,KT=t=>t.split("").reduce((e,n,r,i)=>{let a=n==='"'&&i[r-1]!=="\\",s=n==="\\"&&i[r+1]==='"';return a||s?e:e+n},""),B0=t=>t!=null?t.toLowerCase():null,wf=(t,e,n)=>[B0(t),e,B0(n)].filter(r=>r!=null).join("."),N0=t=>{let e=t.split("."),n=e.shift(),r=e.pop(),i=e.length?e.join("."):void 0;return{section:n,subsection:i,name:r,path:wf(n,i,r),sectionPath:wf(n,i,null)}},QT=(t,e)=>t.reduce((n,r,i)=>e(r)?i:n,-1),bf=class t{constructor(e){let n=null,r=null;this.parsedConfig=e?e.split(` +`).map(i=>{let a=null,s=null,o=i.trim(),l=XT(o),c=l!=null;if(c)[n,r]=l;else{let f=YT(o);f!=null&&([a,s]=f)}let u=wf(n,r,a);return{line:i,isSection:c,section:n,subsection:r,name:a,value:s,path:u}}):[]}static from(e){return new t(e)}async get(e,n=!1){let r=N0(e).path,i=this.parsedConfig.filter(a=>a.path===r).map(({section:a,name:s,value:o})=>{let l=j0[a]&&j0[a][s];return l?l(o):o});return n?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(n=>n.section===e&&n.isSection).map(n=>n.subsection)}async deleteSection(e,n){this.parsedConfig=this.parsedConfig.filter(r=>!(r.section===e&&r.subsection===n))}async append(e,n){return this.set(e,n,!0)}async set(e,n,r=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l}=N0(e),c=QT(this.parsedConfig,u=>u.path===o);if(n==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let u=this.parsedConfig[c],f=Object.assign({},u,{name:s,value:n,modified:!0});r?this.parsedConfig.splice(c+1,0,f):this.parsedConfig[c]=f}else{let u=this.parsedConfig.findIndex(d=>d.path===l),f={section:i,subsection:a,name:s,value:n,modified:!0,path:o};if(GT.test(i)&&WT.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,f);else{let d={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(d,f)}}}toString(){return this.parsedConfig.map(({line:e,section:n,subsection:r,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:r!=null?`[${n} "${r}"]`:`[${n}]`:e).join(` +`)}},$e=class{static async get({fs:e,gitdir:n}){let r=await e.read(`${n}/config`,{encoding:"utf8"});return bf.from(r)}static async save({fs:e,gitdir:n,config:r}){await e.write(`${n}/config`,r.toString(),{encoding:"utf8"})}},Fo=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],JT=["config","description","index","shallow","commondir"],lf;async function ir(t,e){return lf===void 0&&(lf=new Va.default),lf.acquire(t,e)}var W=class t{static async updateRemoteRefs({fs:e,gitdir:n,remote:r,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let g of i.values())if(!g.match(/[0-9a-f]{40}/))throw new or(g);let u=await $e.get({fs:e,gitdir:n});if(!o){if(o=await u.getall(`remote.${r}.fetch`),o.length===0)throw new qa(r);o.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let f=vf.from(o),d=new Map;if(c){let g=await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:n,refs:g.map(w=>`refs/tags/${w}`)})}if(s){for(let g of i.keys())if(g.startsWith("refs/tags")&&!g.endsWith("^{}")&&!await t.exists({fs:e,gitdir:n,ref:g})){let w=i.get(g);d.set(g,w)}}let h=f.translate([...i.keys()]);for(let[g,w]of h){let b=i.get(g);d.set(w,b)}let p=f.translate([...a.keys()]);for(let[g,w]of p){let b=a.get(g),x=f.translateOne(b);x&&d.set(w,`ref: ${x}`)}let m=[];if(l){for(let g of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:n,filepath:g})).map(b=>`${g}/${b}`);for(let b of w)d.has(b)||m.push(b)}m.length>0&&await t.deleteRefs({fs:e,gitdir:n,refs:m})}for(let[g,w]of d)await ir(g,async()=>e.write(B(n,g),`${w.trim()} +`,"utf8"));return{pruned:m}}static async writeRef({fs:e,gitdir:n,ref:r,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new or(i);await ir(r,async()=>e.write(B(n,r),`${i.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:n,ref:r,value:i}){await ir(r,async()=>e.write(B(n,r),`ref: ${i.trim()} +`,"utf8"))}static async deleteRef({fs:e,gitdir:n,ref:r}){return t.deleteRefs({fs:e,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:n,refs:r}){await Promise.all(r.map(o=>e.rm(B(n,o))));let i=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"})),a=Ro.from(i),s=a.refs.size;for(let o of r)a.refs.has(o)&&a.delete(o);a.refs.sizee.write(`${n}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith("ref: "))return r=r.slice(5),t.resolve({fs:e,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let a=await t.packedRefs({fs:e,gitdir:n}),s=Fo(r).filter(o=>!JT.includes(o));for(let o of s){let l=await ir(o,async()=>await e.read(`${n}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:n,ref:l.trim(),depth:i})}throw new Me(r)}static async exists({fs:e,gitdir:n,ref:r}){try{return await t.expand({fs:e,gitdir:n,ref:r}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await t.packedRefs({fs:e,gitdir:n}),a=Fo(r);for(let s of a)if(await ir(s,async()=>e.exists(`${n}/${s}`))||i.has(s))return s;throw new Me(r)}static async expandAgainstMap({ref:e,map:n}){let r=Fo(e);for(let i of r)if(await n.has(i))return i;throw new Me(e)}static resolveAgainstMap({ref:e,fullref:n=e,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:n,depth:r,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:n,oid:e};let a=Fo(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:r,map:i})}throw new Me(e)}static async packedRefs({fs:e,gitdir:n}){let r=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"}));return Ro.from(r).refs}static async listRefs({fs:e,gitdir:n,filepath:r}){let i=t.packedRefs({fs:e,gitdir:n}),a=null;try{a=await e.readdirDeep(`${n}/${r}`),a=a.map(s=>s.replace(`${n}/${r}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(r)&&(s=s.replace(r+"/",""),a.includes(s)||a.push(s));return a.sort($T),a}static async listBranches({fs:e,gitdir:n,remote:r}){return r?t.listRefs({fs:e,gitdir:n,filepath:`refs/remotes/${r}`}):t.listRefs({fs:e,gitdir:n,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:n}){return(await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function e5(t,e){return zo($0(t),$0(e))}function $0(t){return t.mode==="040000"?t.path+"/":t.path}function l1(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 ce(`Unexpected GitTree entry mode: ${t}`)}function t5(t){let e=[],n=0;for(;n`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(e5),Buffer.concat(e.map(n=>{let r=Buffer.from(n.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(n.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(n.oid,"hex");return Buffer.concat([r,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},lr=class{static wrap({type:e,object:n}){return Buffer.concat([Buffer.from(`${e} ${n.byteLength.toString()}\0`),Buffer.from(n)])}static unwrap(e){let n=e.indexOf(32),r=e.indexOf(0),i=e.slice(0,n).toString("utf8"),a=e.slice(n+1,r).toString("utf8"),s=e.length-(r+1);if(parseInt(a)!==s)throw new ce(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(r+1))}}};async function i5({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await t.read(`${e}/${r}`);return i?{object:i,format:"deflated",source:r}:null}function a5(t,e){let n=new Jt(t),r=H0(n);if(r!==e.byteLength)throw new ce(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);let i=H0(n),a,s=z0(n,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Jt(a);for(o.copy(s);!n.eof();)o.copy(z0(n,e));let l=o.tell();if(i!==l)throw new ce(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function H0(t){let e=0,n=0,r=null;do r=t.readUInt8(),e|=(r&127)<>=1,i+=8;return r}function z0(t,e){let n=t.readUInt8(),r=128,i=15,a=112;if(n&r){let s=U0(t,n&i,4),o=U0(t,(n&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(n)}function s5(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function c1(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:s5(t)}var jo=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=c1(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:n}=await this.stream.next();return e&&(this._ended=!0,!n)?Buffer.alloc(0):(n&&(n=Buffer.from(n)),n)}_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 n=[this.buffer];for(;this.cursor+e>o5(n);){let r=await this._next();if(this._ended)break;n.push(r)}this.buffer=Buffer.concat(n)}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 o5(t){return t.reduce((e,n)=>e+n.length,0)}async function l5(t,e){let n=new jo(t),r=await n.read(4);if(r=r.toString("utf8"),r!=="PACK")throw new ce(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new ce(`Invalid packfile version: ${i}`);let a=await n.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!n.eof()&&a--;){let s=n.tell(),{type:o,length:l,ofs:c,reference:u}=await c5(n),f=new Uo.default.Inflate;for(;!f.result;){let d=await n.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new ce(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new ce("Inflated object size is different from that stated in packfile.");await n.undo(),await n.read(d.length-f.strm.avail_in);let h=n.tell();await e({data:f.result,type:o,num:a,offset:s,end:h,reference:u,ofs:c})}}}}async function c5(t){let e=await t.byte(),n=e>>4&7,r=e&15;if(e&128){let s=4;do e=await t.byte(),r|=(e&127)<i+1<<7|a,-1)}function h5(t,e){let n=e,r=4,i=null;do i=t.readUInt8(),n|=(i&127)<2048*1024*1024)throw new ce("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");r.seek(r.tell()+4*255);let s=r.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=E);let _=Math.floor((u-E)*100/u);_!==f&&r&&await r({phase:"Receiving objects",loaded:u-E,total:u}),f=_,w=i[w],["commit","tree","blob","tag"].includes(w)?a[x]={type:w,offset:x}:w==="ofs-delta"?a[x]={type:w,offset:x}:w==="ref-delta"&&(a[x]={type:w,offset:x})});let d=Object.keys(a).map(Number);for(let[g,w]of d.entries()){let b=g+1===d.length?e.byteLength-20:d[g+1],x=a[w],E=t1.default.buf(e.slice(w,b))>>>0;x.end=b,x.crc=E}let h=new t({pack:Promise.resolve(e),packfileSha:s,crcs:l,hashes:o,offsets:c,getExternalRefDelta:n});f=null;let p=0,m=[0,0,0,0,0,0,0,0,0,0,0,0];for(let g in a){g=Number(g);let w=Math.floor(p*100/u);w!==f&&r&&await r({phase:"Resolving deltas",loaded:p,total:u}),p++,f=w;let b=a[g];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:x,object:E}=await h.readSlice({start:g});m[h.readDepth]+=1;let _=await $n(lr.wrap({type:x,object:E}));b.oid=_,o.push(_),c.set(_,g),l[_]=b.crc}catch(x){continue}}return o.sort(),h}async toBuffer(){let e=[],n=(c,u)=>{e.push(Buffer.from(c,u))};n("ff744f63","hex"),n("00000002","hex");let r=new Jt(Buffer.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++;r.writeUInt32BE(u)}e.push(r.buffer);for(let c of this.hashes)n(c,"hex");let i=new Jt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);e.push(i.buffer);let a=new Jt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)a.writeUInt32BE(this.offsets.get(c));e.push(a.buffer),n(this.packfileSha,"hex");let s=Buffer.concat(e),o=await $n(s),l=Buffer.alloc(20);return l.write(o,"hex"),Buffer.concat([s,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 ce(`Could not read object ${e} from packfile`)}let n=this.offsets.get(e);return this.readSlice({start:n})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let n={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new ce("Tried to read from a GitPackIndex with no packfile loaded into memory");let r=(await this.pack).slice(e),i=new Jt(r),a=i.readUInt8(),s=a&112,o=n[s];if(o===void 0)throw new ce("Unrecognized type: 0b"+s.toString(2));let l=a&15,c=l;a&128&&(c=h5(i,l));let f=null,d=null;if(o==="ofs_delta"){let p=d5(i),m=e-p;({object:f,type:o}=await this.readSlice({start:m}))}if(o==="ref_delta"){let p=i.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:p}))}let h=r.slice(i.tell());if(d=Buffer.from(await u1(h)),d.byteLength!==c)throw new ce(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return f&&(d=Buffer.from(a5(d,f))),this.readDepth>3&&(this.offsetCache[e]={type:o,object:d}),{type:o,format:"content",object:d}}},Mo=Symbol("PackfileCache");async function p5({fs:t,filename:e,getExternalRefDelta:n,emitter:r,emitterPrefix:i}){let a=await t.read(e);return Xa.fromIdx({idx:a,getExternalRefDelta:n})}function Ff({fs:t,cache:e,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}){e[Mo]||(e[Mo]=new Map);let s=e[Mo].get(n);return s||(s=p5({fs:t,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}),e[Mo].set(n,s)),s}async function m5({fs:t,cache:e,gitdir:n,oid:r,format:i="content",getExternalRefDelta:a}){let s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await Ff({fs:t,cache:e,filename:l,getExternalRefDelta:a});if(c.error)throw new ce(c.error);if(c.offsets.has(r)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=t.read(f)}let u=await c.read({oid:r,getExternalRefDelta:a});return u.format="content",u.source=`objects/pack/${o.replace(/idx$/,"pack")}`,u}}return null}async function He({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=u=>He({fs:t,cache:e,gitdir:n,oid:u}),s;if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await i5({fs:t,gitdir:n,oid:r})),!s){if(s=await m5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a}),!s)throw new Me(r);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await u1(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await $n(s.object);if(o!==r)throw new ce(`SHA check failed! Expected ${r}, computed ${o}`);let{object:l,type:c}=lr.unwrap(s.object);if(s.type=c,s.object=l,s.format="content",i==="content")return s;throw new ce(`invalid requested format "${i}"`)}var un=class t extends ge{constructor(e,n,r=!0){super(`Failed to create ${e} at ${n} because it already exists.${r?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:n,canForce:r}}};un.code="AlreadyExistsError";var Ya=class t extends ge{constructor(e,n,r){super(`Found multiple ${e} matching "${n}" (${r.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:n,matches:r}}};Ya.code="AmbiguousError";var Za=class t extends ge{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}}};Za.code="CheckoutConflictError";var Ka=class t extends ge{constructor(e,n){super(`Failed to checkout "${e}" because commit ${n} 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:n}}};Ka.code="CommitNotFetchedError";var Qa=class t extends ge{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};Qa.code="EmptyServerResponseError";var Ja=class t extends ge{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Ja.code="FastForwardError";var es=class t extends ge{constructor(e,n){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:n}}};es.code="GitPushError";var ki=class t extends ge{constructor(e,n,r){super(`HTTP Error: ${e} ${n}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:n,response:r}}};ki.code="HttpError";var cr=class t extends ge{constructor(e){let n="invalid filepath";e==="leading-slash"||e==="trailing-slash"?n='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(n='"filepath" should not be a directory.'),super(n),this.code=this.name=t.code,this.data={reason:e}}};cr.code="InvalidFilepathError";var Hn=class t extends ge{constructor(e,n){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:n}}};Hn.code="InvalidRefNameError";var ts=class t extends ge{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};ts.code="MaxDepthError";var Ai=class t extends ge{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Ai.code="MergeNotSupportedError";var Ti=class t extends ge{constructor(e,n,r,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:n,deleteByUs:r,deleteByTheirs:i}}};Ti.code="MergeConflictError";var At=class t extends ge{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}}};At.code="MissingNameError";var Ot=class t extends ge{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Ot.code="MissingParameterError";var ns=class t extends ge{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}};ns.code="MultipleGitError";var $r=class t extends ge{constructor(e,n){super(`Expected "${e}" but received "${n}".`),this.code=this.name=t.code,this.data={expected:e,actual:n}}};$r.code="ParseError";var Ci=class t extends ge{constructor(e){let n="";e==="not-fast-forward"?n=" because it was not a simple fast-forward":e==="tag-exists"&&(n=" because tag already exists"),super(`Push rejected${n}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Ci.code="PushRejectedError";var ar=class t extends ge{constructor(e,n){super(`Remote does not support the "${e}" so the "${n}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:n}}};ar.code="RemoteCapabilityError";var rs=class t extends ge{constructor(e,n){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:n}}};rs.code="SmartHttpError";var is=class t extends ge{constructor(e,n,r){super(`Git remote "${e}" uses an unrecognized transport protocol: "${n}"`),this.code=this.name=t.code,this.data={url:e,transport:n,suggestion:r}}};is.code="UnknownTransportError";var as=class t extends ge{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};as.code="UrlParseError";var Fi=class t extends ge{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Fi.code="UserCanceledError";var ss=class t extends ge{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}}};ss.code="IndexResetError";var os=class t extends ge{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}}};os.code="NoCommitError";var cs=Object.freeze({__proto__:null,AlreadyExistsError:un,AmbiguousError:Ya,CheckoutConflictError:Za,CommitNotFetchedError:Ka,EmptyServerResponseError:Qa,FastForwardError:Ja,GitPushError:es,HttpError:ki,InternalError:ce,InvalidFilepathError:cr,InvalidOidError:or,InvalidRefNameError:Hn,MaxDepthError:ts,MergeNotSupportedError:Ai,MergeConflictError:Ti,MissingNameError:At,MissingParameterError:Ot,MultipleGitError:ns,NoRefspecError:qa,NotFoundError:Me,ObjectTypeError:kt,ParseError:$r,PushRejectedError:Ci,RemoteCapabilityError:ar,SmartHttpError:rs,UnknownTransportError:is,UnsafeFilepathError:_i,UrlParseError:as,UserCanceledError:Fi,UnmergedPathsError:Wa,IndexResetError:ss,NoCommitError:os});function xf({name:t,email:e,timestamp:n,timezoneOffset:r}){return r=g5(r),`${t} <${e}> ${n} ${r}`}function g5(t){let e=y5(v5(t));t=Math.abs(t);let n=Math.floor(t/60);t-=n*60;let r=String(n),i=String(t);return r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),(e===-1?"-":"+")+r+i}function y5(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function v5(t){return t===0?t:-t}function Nn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function Do(t){let[,e,n,r,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:n,timestamp:Number(r),timezoneOffset:w5(i)}}function w5(t){let[,e,n,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=(e==="+"?1:-1)*(Number(n)*60+Number(r)),b5(r)}function b5(t){return t===0?t:-t}var Nt=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ce("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 ${xf(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(` +`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` +`+i.slice(1):n.push(i);let r={};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.tagger&&(r.tagger=Do(r.tagger)),r.committer&&(r.committer=Do(r.committer)),r}withoutSignature(){let e=Nn(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 Nn(e)}payload(){return this.withoutSignature()+` +`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,n,r){let i=e.payload(),{signature:a}=await n({payload:i,secretKey:r});a=Nn(a);let s=i+a;return t.from(s)}};function uf(t){return t.trim().split(` +`).map(e=>" "+e).join(` +`)+` +`}function x5(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var Pt=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ce("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:n}){let r=t.justHeaders(e),i=t.justMessage(e),a=Nn(r+` +gpgsig`+uf(n)+` +`+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Nn(e.slice(e.indexOf(` + +`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` + +`))}parseHeaders(){let e=t.justHeaders(this._commit).split(` +`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` +`+i.slice(1):n.push(i);let r={parent:[]};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.author&&(r.author=Do(r.author)),r.committer&&(r.committer=Do(r.committer)),r}static renderHeaders(e){let n="";if(e.tree?n+=`tree ${e.tree} +`:n+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 +`,e.parent){if(e.parent.length===void 0)throw new ce("commit 'parent' property should be an array");for(let a of e.parent)n+=`parent ${a} +`}let r=e.author;n+=`author ${xf(r)} +`;let i=e.committer||e.author;return n+=`committer ${xf(i)} +`,e.gpgsig&&(n+="gpgsig"+uf(e.gpgsig)),n}static render(e){return t.renderHeaders(e)+` +`+Nn(e.message)}render(){return this._commit}withoutSignature(){let e=Nn(this._commit);if(e.indexOf(` +gpgsig`)===-1)return e;let n=e.slice(0,e.indexOf(` +gpgsig`)),r=e.slice(e.indexOf(`-----END PGP SIGNATURE----- +`)+28);return Nn(n+` +`+r)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return x5(e)}static async sign(e,n,r){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await n({payload:i,secretKey:r});s=Nn(s);let l=t.justHeaders(e._commit)+` +gpgsig`+uf(s)+` +`+a;return t.from(l)}};async function Mi({fs:t,cache:e,gitdir:n,oid:r}){if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:It.from([]),oid:r};let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Nt.from(a).parse().object,Mi({fs:t,cache:e,gitdir:n,oid:r});if(i==="commit")return r=Pt.from(a).parse().tree,Mi({fs:t,cache:e,gitdir:n,oid:r});if(i!=="tree")throw new kt(r,i,"tree");return{tree:It.from(a),oid:r}}var _f=class{constructor({fs:e,gitdir:n,ref:r,cache:i}){this.fs=e,this.cache=i,this.gitdir=n,this.mapPromise=(async()=>{let s=new Map,o;try{o=await W.resolve({fs:e,gitdir:n,ref:r})}catch(c){c instanceof Me&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Mi({fs:e,cache:this.cache,gitdir:n,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),s})();let a=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 a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(n);if(!o)throw new Error(`No obj for ${n}`);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 He({fs:r,cache:i,gitdir:a,oid:l});if(c!==o.type)throw new kt(l,c,o.type);let f=It.from(u);for(let d of f)s.set(B(n,d.path),d);return f.entries().map(d=>B(n,d.path))}async type(e){if(e._type===!1){let n=await this.mapPromise,{type:r}=n.get(e._fullpath);e._type=r}return e._type}async mode(e){if(e._mode===!1){let n=await this.mapPromise,{mode:r}=n.get(e._fullpath);e._mode=a1(parseInt(r,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let n=await this.mapPromise,{fs:r,cache:i,gitdir:a}=this,o=n.get(e._fullpath).oid,{type:l,object:c}=await He({fs:r,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let r=(await this.mapPromise).get(e._fullpath);e._oid=r.oid}return e._oid}};function sr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Go,{value:function({fs:n,gitdir:r,cache:i}){return new _f({fs:n,gitdir:r,ref:t,cache:i})}}),Object.freeze(e),e}var Sf=class{constructor({fs:e,dir:n,gitdir:r,cache:i}){this.fs=e,this.cache=i,this.dir=n,this.gitdir=r;let a=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 a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,dir:i}=this,a=await r.readdir(B(i,n));return a===null?null:a.map(s=>B(n,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{fs:n,dir:r}=this,i=await n.lstat(`${r}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=Si(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:n,dir:r,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await $e.get({fs:n,gitdir:i})).get("core.autocrlf"),o=await n.read(`${r}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let{fs:n,gitdir:r,cache:i}=this,a;await it.acquire({fs:n,gitdir:r,cache:i},async function(s){let o=s.entriesMap.get(e._fullpath),l=await e.stat(),u=await(await $e.get({fs:n,gitdir:r})).get("core.filemode"),f=typeof process!="undefined"?process.platform!=="win32":!0;!o||Io(l,o,u,f)?await e.content()===void 0?a=void 0:(a=await $n(lr.wrap({type:"blob",object:await e.content()})),o&&a===o.oid&&(!u||l.mode===o.mode)&&Io(l,o,u,f)&&s.insert({filepath:e._fullpath,stats:l,oid:a})):a=o.oid}),e._oid=a}return e._oid}};function Wo(){let t=Object.create(null);return Object.defineProperty(t,Go,{value:function({fs:e,dir:n,gitdir:r,cache:i}){return new Sf({fs:e,dir:n,gitdir:r,cache:i})}}),Object.freeze(t),t}function _5(t,e){let n=e-t;return Array.from({length:n},(r,i)=>t+i)}var f1=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,n)=>e.concat(n),[]):t=>t.flat(),Ef=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:s=async(l,c)=>{let u=f1(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(h=>h[Go]({fs:t,dir:n,gitdir:r,cache:e})),c=new Array(l.length).fill("."),u=_5(0,l.length),f=async h=>{u.map(g=>{h[g]=h[g]&&new l[g].ConstructEntry(h[g])});let m=(await Promise.all(u.map(g=>h[g]?l[g].readdir(h[g]):[]))).map(g=>g===null?[]:g).map(g=>g[Symbol.iterator]());return{entries:h,children:S5(m)}},d=async h=>{let{entries:p,children:m}=await f(h),g=p.find(b=>b&&b._fullpath)._fullpath,w=await a(g,p);if(w!==null){let b=await o(d,m);return b=b.filter(x=>x!==void 0),s(w,b)}};return d(c)}async function kf(t,e){let n=await t.readdir(e);n==null?await t.rm(e):n.length?await Promise.all(n.map(r=>{let i=B(e,r);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?kf(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function E5(t){return k5(t)&&G0(t.then)&&G0(t.catch)}function k5(t){return t&&typeof t=="object"}function G0(t){return typeof t=="function"}function V0(t){return E5((n=>{try{return n.readFile().catch(r=>r)}catch(r){return r}})(t))}var W0=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function q0(t,e){if(V0(e))for(let n of W0)t[`_${n}`]=e[n].bind(e);else for(let n of W0)t[`_${n}`]=(0,Oo.default)(e[n].bind(e));V0(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=kf.bind(null,t):e.rm?t._rm=(0,Oo.default)(e.rm.bind(e)):e.rmdir.length>2?t._rm=(0,Oo.default)(e.rmdir.bind(e)):t._rm=kf.bind(null,t)}var ee=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let n=Object.getOwnPropertyDescriptor(e,"promises");n&&n.enumerable?q0(this,e.promises):q0(this,e),this._original_unwrapped_fs=e}async exists(e,n={}){try{return await this._stat(e),!0}catch(r){if(r.code==="ENOENT"||r.code==="ENOTDIR")return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',r),r}}async read(e,n={}){try{let r=await this._readFile(e,n);if(n.autocrlf==="true")try{r=new TextDecoder("utf8",{fatal:!0}).decode(r),r=r.replace(/\r\n/g,` +`),r=new TextEncoder().encode(r)}catch(i){}return typeof r!="string"&&(r=Buffer.from(r)),r}catch(r){return null}}async write(e,n,r={}){try{await this._writeFile(e,n,r);return}catch(i){await this.mkdir(Ei(e)),await this._writeFile(e,n,r)}}async mkdir(e,n=!1){try{await this._mkdir(e);return}catch(r){if(r===null||r.code==="EEXIST")return;if(n)throw r;if(r.code==="ENOENT"){let i=Ei(e);if(i==="."||i==="/"||i===e)throw r;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(n){if(n.code!=="ENOENT")throw n}}async rmdir(e,n){try{n&&n.recursive?await this._rm(e,n):await this._rmdir(e)}catch(r){if(r.code!=="ENOENT")throw r}}async readdir(e){try{let n=await this._readdir(e);return n.sort(zo),n}catch(n){return n.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let n=await this._readdir(e);return(await Promise.all(n.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(n){if(n.code==="ENOENT")return null;throw n}}async readlink(e,n={encoding:"buffer"}){try{let r=await this._readlink(e,n);return Buffer.isBuffer(r)?r:Buffer.from(r)}catch(r){if(r.code==="ENOENT")return null;throw r}}async writelink(e,n){return this._symlink(n.toString("utf8"),e)}};function F(t,e){if(e===void 0)throw new Ot(t)}async function Bo(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 A5({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r="HEAD",cache:i={}}){try{F("fs",t),F("dir",e),F("gitdir",n);let a=new ee(t),s=[sr({ref:r}),Wo(),Vo()],o=[];await it.acquire({fs:a,gitdir:n,cache:i},async function(c){o=c.unmergedPaths});let l=await Oi({fs:a,cache:i,dir:e,gitdir:n,trees:s,map:async function(c,[u,f,d]){let h=!await Bo(f,d),p=o.includes(c),m=!await Bo(d,u);if(h||p)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(m)return!1;throw new ss(c)}});await it.acquire({fs:a,gitdir:n,cache:i},async function(c){for(let u of l)if(u!==!1){if(!u){await a.rmdir(`${e}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${e}/${u.path}`,f,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var Ii=class{static async isIgnored({fs:e,dir:n,gitdir:r=B(n,".git"),filepath:i}){if(Po(i)===".git")return!0;if(i===".")return!1;let a="",s=B(r,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:B(n,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;uAf({dir:e,gitdir:n,fs:o,filepath:r,index:l,force:a,parallel:s}))}catch(o){throw o.caller="git.add",o}}async function Af({dir:t,gitdir:e,fs:n,filepath:r,index:i,force:a,parallel:s}){r=Array.isArray(r)?r:[r];let o=r.map(async f=>{if(!a&&await Ii.isIgnored({fs:n,dir:t,gitdir:e,filepath:f}))return;let d=await n.lstat(B(t,f));if(!d)throw new Me(f);if(d.isDirectory()){let h=await n.readdir(B(t,f));if(s){let p=h.map(m=>Af({dir:t,gitdir:e,fs:n,filepath:[B(f,m)],index:i,force:a,parallel:s}));await Promise.all(p)}else for(let p of h)await Af({dir:t,gitdir:e,fs:n,filepath:[B(f,p)],index:i,force:a,parallel:s})}else{let p=await(await $e.get({fs:n,gitdir:e})).get("core.autocrlf"),m=d.isSymbolicLink()?await n.readlink(B(t,f)).then(M5):await n.read(B(t,f),{autocrlf:p});if(m===null)throw new Me(f);let g=await $t({fs:n,gitdir:e,type:"blob",object:m});i.insert({filepath:f,stats:d,oid:g})}}),l=await Promise.allSettled(o),c=l.filter(f=>f.status==="rejected").map(f=>f.reason);if(c.length>1)throw new ns(c);if(c.length===1)throw c[0];return l.filter(f=>f.status==="fulfilled"&&f.value).map(f=>f.value)}async function ls({fs:t,gitdir:e,path:n}){return(await $e.get({fs:t,gitdir:e})).get(n)}function h1(t,...e){for(let n of e)if(n)for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(t[r]=i)}return t}async function Hr({fs:t,gitdir:e,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),a={name:await ls({fs:t,gitdir:e,path:"user.name"}),email:await ls({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=h1({},a,r?r.author:void 0,n);if(s.name!==void 0)return s}async function Pi({fs:t,gitdir:e,author:n,committer:r,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await ls({fs:t,gitdir:e,path:"user.name"}),email:await ls({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=h1({},s,i?i.committer:void 0,n,r);if(o.name!==void 0)return o}async function p1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Nt.from(a).parse().object,p1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="commit")throw new kt(r,i,"commit");return{commit:Pt.from(a),oid:r}}async function No({fs:t,cache:e,gitdir:n,oid:r}){let{commit:i,oid:a}=await p1({fs:t,cache:e,gitdir:n,oid:r});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function qo({fs:t,cache:e,onSign:n,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h}){let p=!1;f||(f=await W.resolve({fs:t,gitdir:r,ref:"HEAD",depth:2}));let m,g;try{m=await W.resolve({fs:t,gitdir:r,ref:f}),g=await No({fs:t,gitdir:r,oid:m,cache:{}})}catch(x){p=!0}if(l&&p)throw new os(f);let w=l?await Hr({fs:t,gitdir:r,author:a,commit:g.commit}):await Hr({fs:t,gitdir:r,author:a});if(!w)throw new At("author");let b=l?await Pi({fs:t,gitdir:r,author:w,committer:s,commit:g.commit}):await Pi({fs:t,gitdir:r,author:w,committer:s});if(!b)throw new At("committer");return it.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async function(x){let _=o1(x.entries).get(".");if(h||(h=await m1({fs:t,gitdir:r,inode:_,dryRun:c})),d?d=await Promise.all(d.map(S=>W.resolve({fs:t,gitdir:r,ref:S}))):l?d=g.commit.parent:d=m?[m]:[],!i)if(l)i=g.commit.message;else throw new Ot("message");let T=Pt.from({tree:h,parent:d,author:w,committer:b,message:i});o&&(T=await Pt.sign(T,n,o));let y=await $t({fs:t,gitdir:r,type:"commit",object:T.toObject(),dryRun:c});return!u&&!c&&await W.writeRef({fs:t,gitdir:r,ref:f,value:y}),y})}async function m1({fs:t,gitdir:e,inode:n,dryRun:r}){let i=n.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await m1({fs:t,gitdir:e,inode:l,dryRun:r}));let a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),s=It.from(a);return await $t({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:r})}async function us({fs:t,cache:e,gitdir:n,oid:r,filepath:i}){if(i.startsWith("/"))throw new cr("leading-slash");if(i.endsWith("/"))throw new cr("trailing-slash");let a=r,s=await Mi({fs:t,cache:e,gitdir:n,oid:r}),o=s.tree;if(i==="")r=s.oid;else{let l=i.split("/");r=await g1({fs:t,cache:e,gitdir:n,tree:o,pathArray:l,oid:a,filepath:i})}return r}async function g1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let l of r)if(l.path===o){if(i.length===0)return l.oid;{let{type:c,object:u}=await He({fs:t,cache:e,gitdir:n,oid:l.oid});if(c!=="tree")throw new kt(a,c,"tree",s);return r=It.from(u),g1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s})}}throw new Me(`file or directory found at "${a}:${s}"`)}async function ji({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){i!==void 0&&(r=await us({fs:t,cache:e,gitdir:n,oid:r,filepath:i}));let{tree:a,oid:s}=await Mi({fs:t,cache:e,gitdir:n,oid:r});return{oid:s,tree:a.entries()}}async function Mf({fs:t,gitdir:e,tree:n}){let r=It.from(n).toObject();return await $t({fs:t,gitdir:e,type:"tree",object:r,format:"content"})}async function I5({fs:t,cache:e,onSign:n,gitdir:r,ref:i,oid:a,note:s,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await W.resolve({gitdir:r,fs:t,ref:i})}catch(w){if(!(w instanceof Me))throw w}let h=(await ji({fs:t,cache:e,gitdir:r,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(w=>w.path!==a);else for(let w of h)if(w.path===a)throw new un("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let p=await $t({fs:t,gitdir:r,type:"blob",object:s,format:"content"});h.push({mode:"100644",path:a,oid:p,type:"blob"});let m=await Mf({fs:t,gitdir:r,tree:h});return await qo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:m,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:c,signingKey:u})}async function P5({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{F("fs",t),F("gitdir",r),F("oid",a),F("note",s),u&&F("onSign",e);let d=new ee(t),h=await Hr({fs:d,gitdir:r,author:l});if(!h)throw new At("author");let p=await Pi({fs:d,gitdir:r,author:h,committer:c});if(!p)throw new At("committer");return await I5({fs:new ee(d),cache:f,onSign:e,gitdir:r,ref:i,oid:a,note:s,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}async function y1({fs:t,gitdir:e,remote:n,url:r,force:i}){if(n!==cn.default.clean(n))throw new Hn(n,cn.default.clean(n));let a=await $e.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(n)&&r!==await a.get(`remote.${n}.url`))throw new un("remote",n);await a.set(`remote.${n}.url`,r),await a.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await $e.save({fs:t,gitdir:e,config:a})}async function R5({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r,url:i,force:a=!1}){try{return F("fs",t),F("gitdir",n),F("remote",r),F("url",i),await y1({fs:new ee(t),gitdir:n,remote:r,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function L5({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await W.exists({fs:t,gitdir:r,ref:i}))throw new un("tag",i);let f=await W.resolve({fs:t,gitdir:r,ref:l||"HEAD"}),{type:d}=await He({fs:t,cache:e,gitdir:r,oid:f}),h=Nt.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});c&&(h=await Nt.sign(h,n,c));let p=await $t({fs:t,gitdir:r,type:"tag",object:h.toObject()});await W.writeRef({fs:t,gitdir:r,ref:i,value:p})}async function j5({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{F("fs",t),F("gitdir",r),F("ref",i),c&&F("onSign",e);let d=new ee(t),h=await Hr({fs:d,gitdir:r,author:a});if(!h)throw new At("tagger");return await L5({fs:d,cache:f,onSign:e,gitdir:r,ref:i,tagger:h,message:s,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function D5({fs:t,gitdir:e,ref:n,object:r,checkout:i=!1,force:a=!1}){if(n!==cn.default.clean(n))throw new Hn(n,cn.default.clean(n));let s=`refs/heads/${n}`;if(!a&&await W.exists({fs:t,gitdir:e,ref:s}))throw new un("branch",n,!1);let o;try{o=await W.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch(l){}o&&await W.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function B5({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,checkout:a=!1,force:s=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),await D5({fs:new ee(t),gitdir:n,ref:r,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var v1=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Of({fs:t,cache:e,onProgress:n,onPostCheckout:r,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0}){let p;if(r)try{p=await W.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(g){p="0000000000000000000000000000000000000000"}let m;try{m=await W.resolve({fs:t,gitdir:a,ref:o})}catch(g){if(o==="HEAD")throw g;let w=`${s}/${o}`;if(m=await W.resolve({fs:t,gitdir:a,ref:w}),h){let b=await $e.get({fs:t,gitdir:a});await b.set(`branch.${o}.remote`,s),await b.set(`branch.${o}.merge`,`refs/heads/${o}`),await $e.save({fs:t,gitdir:a,config:b})}await W.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:m})}if(!c){let g;try{g=await N5({fs:t,cache:e,onProgress:n,dir:i,gitdir:a,ref:o,force:d,filepaths:l})}catch(_){throw _ instanceof Me&&_.data.what===m?new Ka(o,m):_}let w=g.filter(([_])=>_==="conflict").map(([_,T])=>T);if(w.length>0)throw new Za(w);let b=g.filter(([_])=>_==="error").map(([_,T])=>T);if(b.length>0)throw new ce(b.join(", "));if(f){r&&await r({previousHead:p,newHead:m,type:l!=null&&l.length>0?"file":"branch"});return}let x=0,E=g.length;await it.acquire({fs:t,gitdir:a,cache:e},async function(_){await Promise.all(g.filter(([T])=>T==="delete"||T==="delete-index").map(async function([T,y]){let S=`${i}/${y}`;T==="delete"&&await t.rm(S),_.delete({filepath:y}),n&&await n({phase:"Updating workdir",loaded:++x,total:E})}))}),await it.acquire({fs:t,gitdir:a,cache:e},async function(_){for(let[T,y]of g)if(T==="rmdir"||T==="rmdir-index"){let S=`${i}/${y}`;try{T==="rmdir-index"&&_.delete({filepath:y}),await t.rmdir(S),n&&await n({phase:"Updating workdir",loaded:++x,total:E})}catch(k){if(k.code==="ENOTEMPTY")console.log(`Did not delete ${y} because directory is not empty`);else throw k}}}),await Promise.all(g.filter(([_])=>_==="mkdir"||_==="mkdir-index").map(async function([_,T]){let y=`${i}/${T}`;await t.mkdir(y),n&&await n({phase:"Updating workdir",loaded:++x,total:E})})),await it.acquire({fs:t,gitdir:a,cache:e},async function(_){await Promise.all(g.filter(([T])=>T==="create"||T==="create-index"||T==="update"||T==="mkdir-index").map(async function([T,y,S,k,C]){let M=`${i}/${y}`;try{if(T!=="create-index"&&T!=="mkdir-index"){let{object:$}=await He({fs:t,cache:e,gitdir:a,oid:S});if(C&&await t.rm(M),k===33188)await t.write(M,$);else if(k===33261)await t.write(M,$,{mode:511});else if(k===40960)await t.writelink(M,$);else throw new ce(`Invalid mode 0o${k.toString(8)} detected in blob ${S}`)}let P=await t.lstat(M);k===33261&&(P.mode=493),T==="mkdir-index"&&(P.mode=57344),_.insert({filepath:y,stats:P,oid:S}),n&&await n({phase:"Updating workdir",loaded:++x,total:E})}catch(P){console.log(P)}}))}),r&&await r({previousHead:p,newHead:m,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let g=await W.expand({fs:t,gitdir:a,ref:o});g.startsWith("refs/heads")?await W.writeSymbolicRef({fs:t,gitdir:a,ref:"HEAD",value:g}):await W.writeRef({fs:t,gitdir:a,ref:"HEAD",value:m})}}async function N5({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,ref:a,force:s,filepaths:o}){let l=0;return Oi({fs:t,cache:e,dir:r,gitdir:i,trees:[sr({ref:a}),Wo(),Vo()],map:async function(c,[u,f,d]){if(c===".")return;if(o&&!o.some(p=>v1(c,p)))return null;switch(n&&await n({phase:"Analyzing workdir",loaded:++l}),[!!d,!!u,!!f].map(Number).join("")){case"000":return;case"001":return s&&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()?s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?s?["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",c];case"blob":return await d.oid()!==await f.oid()?s?["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()&&!s)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(s)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=f1(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function $5({fs:t,onProgress:e,onPostCheckout:n,dir:r,gitdir:i=B(r,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:l=!1,noUpdateHead:c=s===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={}}){try{F("fs",t),F("dir",r),F("gitdir",i);let p=s||"HEAD";return await Of({fs:new ee(t),cache:h,onProgress:e,onPostCheckout:n,dir:r,gitdir:i,remote:a,ref:p,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d})}catch(p){throw p.caller="git.checkout",p}}var H5=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Nr(t){let e=H5.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function zr({fs:t,gitdir:e,fullname:n=!1,test:r=!1}){let i=await W.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(r)try{await W.resolve({fs:t,gitdir:e,ref:i})}catch(a){return}if(i.startsWith("refs/"))return n?i:Nr(i)}function U5(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function w1({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function fs(t,e){let n=c1(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function $o(t){let e=0,n=[];await fs(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}function X0(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[n,r]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:n,password:r}}}function Tf(t,e){let n=e.toString(16);return"0".repeat(t-n.length)+n}var Ne=class{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let n=e.length+4,r=Tf(4,n);return Buffer.concat([Buffer.from(r,"utf8"),e])}static streamReader(e){let n=new jo(e);return async function(){try{let i=await n.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await n.read(i-4);return a==null?!0:a}catch(i){return e.error=i,!0}}}};async function Y0(t){let e={},n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let r=n.indexOf("=");if(r>-1){let i=n.slice(0,r),a=n.slice(r+1);e[i]=a}else e[n]=!0}return{protocolVersion:2,capabilities2:e}}async function Z0(t,{service:e}){let n=new Set,r=new Map,i=new Map,a=Ne.streamReader(t),s=await a();for(;s===null;)s=await a();if(s===!0)throw new Qa;if(s.includes("version 2"))return Y0(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new $r(`# service=${e}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:n,refs:r,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return Y0(a);let[l,c]=df(o,"\0","\\x00");if(c.split(" ").map(u=>n.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=df(l," "," ");for(r.set(f,u);;){let d=await a();if(d===!0)break;if(d!==null){let[h,p]=df(d.toString("utf8")," "," ");r.set(p,h)}}}for(let u of n)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:n,refs:r,symrefs:i}}function df(t,e,n){let r=t.trim().split(e);if(r.length!==2)throw new $r(`Two strings separated by '${n}'`,t.toString("utf8"));return r}var K0=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,Q0=(t,e)=>{(e.username||e.password)&&(t.Authorization=w1(e)),e.headers&&Object.assign(t,e.headers)},hf=async t=>{try{let e=Buffer.from(await $o(t.body)),n=e.toString("utf8");return{preview:n.length<256?n:n.slice(0,256)+"...",response:n,data:e}}catch(e){return{}}},Ri=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:n,onAuth:r,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=X0(l),h=s?K0(s,f):f;(d.username||d.password)&&(c.Authorization=w1(d)),u===2&&(c["Git-Protocol"]="version=2");let p,m,g=!1;do if(p=await e.request({onProgress:n,method:"GET",url:`${h}/info/refs?service=${o}`,headers:c}),m=!1,p.statusCode===401||p.statusCode===203){let w=g?a:r;if(w){if(d=await w(f,{...d,headers:{...c}}),d&&d.cancel)throw new Fi;d&&(Q0(c,d),g=!0,m=!0)}}else p.statusCode===200&&g&&i&&await i(f,d);while(m);if(p.statusCode!==200){let{response:w}=await hf(p);throw new ki(p.statusCode,p.statusMessage,w)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let w=await Z0(p.body,{service:o});return w.auth=d,w}else{let{preview:w,response:b,data:x}=await hf(p);try{let E=await Z0([x],{service:o});return E.auth=d,E}catch(E){throw new rs(w,b)}}}static async connect({http:e,onProgress:n,corsProxy:r,service:i,url:a,auth:s,body:o,headers:l}){let c=X0(a);c&&(a=c.url),r&&(a=K0(r,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,Q0(l,s);let u=await e.request({onProgress:n,method:"POST",url:`${a}/${i}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=hf(u);throw new ki(u.statusCode,u.statusMessage,f)}return u}};function z5({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 Li=class{static getRemoteHelperFor({url:e}){let n=new Map;n.set("http",Ri),n.set("https",Ri);let r=z5({url:e});if(!r)throw new as(e);if(n.has(r.transport))return n.get(r.transport);throw new is(e,r.transport,r.transport==="ssh"?U5(e):void 0)}},Br=null,Ur=class{static async read({fs:e,gitdir:n}){Br===null&&(Br=new Va.default);let r=B(n,"shallow"),i=new Set;return await Br.acquire(r,async function(){let a=await e.read(r,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(` +`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:n,oids:r}){Br===null&&(Br=new Va.default);let i=B(n,"shallow");if(r.size>0){let a=[...r].join(` +`)+` +`;await Br.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Br.acquire(i,async function(){await e.rm(i)})}};async function G5({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return t.exists(`${e}/${r}`)}async function V5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await t.readdir(B(n,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${n}/objects/pack/${s}`,l=await Ff({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new ce(l.error);if(l.offsets.has(r))return!0}return!1}async function J0({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=o=>He({fs:t,cache:e,gitdir:n,oid:o}),s=await G5({fs:t,gitdir:n,oid:r});return s||(s=await V5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a})),s}function W5(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function b1(t,e){let n=t.map(r=>r.split("=",1)[0]);return e.filter(r=>{let i=r.split("=",1)[0];return n.includes(i)})}var Xo={name:"isomorphic-git",version:"1.27.1",agent:"git/isomorphic-git@1.27.1"},xi=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 n=this._waiting;this._waiting=null,n({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 q5(t){let e=t.indexOf("\r"),n=t.indexOf(` +`);return e===-1&&n===-1?-1:e===-1?n+1:n===-1?e+1:n===e+1?n+1:Math.min(e,n)+1}function x1(t){let e=new xi,n="";return(async()=>(await fs(t,r=>{for(r=r.toString("utf8"),n+=r;;){let i=q5(n);if(i===-1)break;e.write(n.slice(0,i)),n=n.slice(i)}}),n.length>0&&e.write(n),e.end()))(),e}var Ho=class{static demux(e){let n=Ne.streamReader(e),r=new xi,i=new xi,a=new xi,s=async function(){let o=await n();if(o===null)return s();if(o===!0){r.end(),a.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let l=o.slice(1);a.write(l),r.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:r.write(o)}s()};return s(),{packetlines:r,packfile:i,progress:a}}};async function X5(t){let{packetlines:e,packfile:n,progress:r}=Ho.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((c,u)=>{fs(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new or(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new or(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");s.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:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))})})}function Y5({capabilities:t=[],wants:e=[],haves:n=[],shallows:r=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(Ne.encode(`want ${c}${l} +`)),l="";for(let c of r)o.push(Ne.encode(`shallow ${c} +`));i!==null&&o.push(Ne.encode(`deepen ${i} +`)),a!==null&&o.push(Ne.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)} +`));for(let c of s)o.push(Ne.encode(`deepen-not ${c} +`));o.push(Ne.flush());for(let c of n)o.push(Ne.encode(`have ${c} +`));return o.push(Ne.encode(`done +`)),o}async function If({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:g=[],relative:w=!1,tags:b=!1,singleBranch:x=!1,headers:E={},prune:_=!1,pruneTags:T=!1}){let y=c||await zr({fs:t,gitdir:l,test:!0}),S=await $e.get({fs:t,gitdir:l}),k=f||y&&await S.get(`branch.${y}.remote`)||"origin",C=d||await S.get(`remote.${k}.url`);if(typeof C=="undefined")throw new Ot("remote OR url");let M=u||y&&await S.get(`branch.${y}.merge`)||c||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let P=Li.getRemoteHelperFor({url:C}),$=await P.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:C,headers:E,protocolVersion:1}),j=$.auth,Q=$.refs;if(Q.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!$.capabilities.has("shallow"))throw new ar("shallow","depth");if(m!==null&&!$.capabilities.has("deepen-since"))throw new ar("deepen-since","since");if(g.length>0&&!$.capabilities.has("deepen-not"))throw new ar("deepen-not","exclude");if(w===!0&&!$.capabilities.has("deepen-relative"))throw new ar("deepen-relative","relative");let{oid:le,fullref:de}=W.resolveAgainstMap({ref:M,map:Q});for(let V of Q.keys())V===de||V==="HEAD"||V.startsWith("refs/heads/")||b&&V.startsWith("refs/tags/")||Q.delete(V);let re=b1([...$.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Xo.agent}`]);w&&re.push("deepen-relative");let Ae=x?[le]:Q.values(),he=x?[y]:await W.listRefs({fs:t,gitdir:l,filepath:"refs"}),H=[];for(let V of he)try{V=await W.expand({fs:t,gitdir:l,ref:V});let et=await W.resolve({fs:t,gitdir:l,ref:V});await J0({fs:t,cache:e,gitdir:l,oid:et})&&H.push(et)}catch(et){}H=[...new Set(H)];let U=await Ur.read({fs:t,gitdir:l}),D=$.capabilities.has("shallow")?[...U]:[],se=Y5({capabilities:re,wants:Ae,haves:H,shallows:D,depth:p,since:m,exclude:g}),_e=Buffer.from(await $o(se)),mt=await P.connect({http:n,onProgress:r,corsProxy:h,service:"git-upload-pack",url:C,auth:j,body:[_e],headers:E}),X=await X5(mt.body);mt.headers&&(X.headers=mt.headers);for(let V of X.shallows)if(!U.has(V))try{let{object:et}=await He({fs:t,cache:e,gitdir:l,oid:V}),N=new Pt(et),Y=await Promise.all(N.headers().parent.map(Ge=>J0({fs:t,cache:e,gitdir:l,oid:Ge})));Y.length===0||Y.every(Ge=>Ge)||U.add(V)}catch(et){U.add(V)}for(let V of X.unshallows)U.delete(V);if(await Ur.write({fs:t,gitdir:l,oids:U}),x){let V=new Map([[de,le]]),et=new Map,N=10,Y=de;for(;N--;){let _t=$.symrefs.get(Y);if(_t===void 0)break;et.set(Y,_t),Y=_t}let ye=Q.get(Y);ye&&V.set(Y,ye);let{pruned:Ge}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:k,refs:V,symrefs:et,tags:b,prune:_});_&&(X.pruned=Ge)}else{let{pruned:V}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:k,refs:Q,symrefs:$.symrefs,tags:b,prune:_,pruneTags:T});_&&(X.pruned=V)}if(X.HEAD=$.symrefs.get("HEAD"),X.HEAD===void 0){let{oid:V}=W.resolveAgainstMap({ref:"HEAD",map:Q});for(let[et,N]of Q.entries())if(et!=="HEAD"&&N===V){X.HEAD=et;break}}let Te=de.startsWith("refs/tags")?"tag":"branch";if(X.FETCH_HEAD={oid:le,description:`${Te} '${Nr(de)}' of ${C}`},r||i){let V=x1(X.progress);fs(V,async et=>{if(i&&await i(et),r){let N=et.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);N&&await r({phase:N[1].trim(),loaded:parseInt(N[2],10),total:parseInt(N[3],10)})}})}let Be=Buffer.from(await $o(X.packfile));if(mt.body.error)throw mt.body.error;let Je=Be.slice(-20).toString("hex"),Re={defaultBranch:X.HEAD,fetchHead:X.FETCH_HEAD.oid,fetchHeadDescription:X.FETCH_HEAD.description};if(X.headers&&(Re.headers=X.headers),_&&(Re.pruned=X.pruned),Je!==""&&!W5(Be)){Re.packfile=`objects/pack/pack-${Je}.pack`;let V=B(l,Re.packfile);await t.write(V,Be);let et=Y=>He({fs:t,cache:e,gitdir:l,oid:Y}),N=await Xa.fromPack({pack:Be,getExternalRefDelta:et,onProgress:r});await t.write(V.replace(/\.pack$/,".idx"),await N.toBuffer())}return Re}async function _1({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){if(await t.exists(r+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>r+"/"+s);for(let s of a)await t.mkdir(s);await t.write(r+"/config",`[core] + repositoryformatversion = 0 + filemode = false + bare = ${e} +`+(e?"":` logallrefupdates = true +`)+` symlinks = false + ignorecase = true +`),await t.write(r+"/HEAD",`ref: refs/heads/${i} +`)}async function Z5({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:m,since:g,exclude:w,relative:b,singleBranch:x,noCheckout:E,noTags:_,headers:T}){try{if(await _1({fs:t,gitdir:u}),await y1({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let k=await $e.get({fs:t,gitdir:u});await k.set("http.corsProxy",d),await $e.save({fs:t,gitdir:u,config:k})}let{defaultBranch:y,fetchHead:S}=await If({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:m,since:g,exclude:w,relative:b,singleBranch:x,headers:T,tags:!_});if(S===null)return;h=h||y,h=h.replace("refs/heads/",""),await Of({fs:t,cache:e,onProgress:r,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:E})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function K5({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:m=void 0,exclude:g=[],relative:w=!1,singleBranch:b=!1,noCheckout:x=!1,noTags:E=!1,headers:_={},cache:T={}}){try{return F("fs",t),F("http",e),F("gitdir",c),x||F("dir",l),F("url",u),await Z5({fs:new ee(t),cache:T,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:m,exclude:g,relative:w,singleBranch:b,noCheckout:x,noTags:E,headers:_})}catch(y){throw y.caller="git.clone",y}}async function Q5({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{F("fs",t),l||F("message",i),o&&F("onSign",e);let m=new ee(t);return await qo({fs:m,cache:p,onSign:e,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(m){throw m.caller="git.commit",m}}async function J5({fs:t,dir:e,gitdir:n=B(e,".git"),fullname:r=!1,test:i=!1}){try{return F("fs",t),F("gitdir",n),await zr({fs:new ee(t),gitdir:n,fullname:r,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function eC({fs:t,gitdir:e,ref:n}){if(n=n.startsWith("refs/heads/")?n:`refs/heads/${n}`,!await W.exists({fs:t,gitdir:e,ref:n}))throw new Me(n);let i=await W.expand({fs:t,gitdir:e,ref:n}),a=await zr({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await W.resolve({fs:t,gitdir:e,ref:i});await W.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await W.deleteRef({fs:t,gitdir:e,ref:i});let s=Nr(n),o=await $e.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await $e.save({fs:t,gitdir:e,config:o})}async function tC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await eC({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteBranch",i}}async function nC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{F("fs",t),F("ref",r),await W.deleteRef({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteRef",i}}async function rC({fs:t,gitdir:e,remote:n}){let r=await $e.get({fs:t,gitdir:e});await r.deleteSection("remote",n),await $e.save({fs:t,gitdir:e,config:r})}async function iC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("remote",r),await rC({fs:new ee(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.deleteRemote",i}}async function aC({fs:t,gitdir:e,ref:n}){n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,await W.deleteRef({fs:t,gitdir:e,ref:n})}async function sC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await aC({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteTag",i}}async function oC({fs:t,gitdir:e,oid:n}){let r=n.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map(a=>`${r}${a}`).filter(a=>a.startsWith(n))}async function lC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=[],s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await Ff({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new ce(c.error);for(let u of c.offsets.keys())u.startsWith(r)&&a.push(u)}return a}async function cC({fs:t,cache:e,gitdir:n,oid:r}){let i=o=>He({fs:t,cache:e,gitdir:n,oid:o}),a=await oC({fs:t,gitdir:n,oid:r}),s=await lC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new Ya("oids",r,a):new Me(`an object matching "${r}"`)}async function uC({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await cC({fs:new ee(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.expandOid",a}}async function fC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("gitdir",n),F("ref",r),await W.expand({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.expandRef",i}}async function Pf({fs:t,cache:e,gitdir:n,oids:r}){let i={},a=r.length,s=r.map((o,l)=>({index:l,oid:o}));for(;s.length;){let o=new Set;for(let{oid:c,index:u}of s)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===a&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of s)try{let{object:f}=await He({fs:t,cache:e,gitdir:n,oid:c}),d=Pt.from(f),{parent:h}=d.parseHeaders();for(let p of h)(!i[p]||!i[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}s=Array.from(l.values())}return[]}var pf=/^.*(\r?\n|$)/gm;function dC({branches:t,contents:e}){let n=t[1],r=t[2],i=e[0],a=e[1],s=e[2],o=a.match(pf),l=i.match(pf),c=s.match(pf),u=(0,r1.default)(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)} ${n} +`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)} +`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${r} +`);return{cleanMerge:h,mergedText:d}}async function hC({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=sr({ref:a}),m=sr({ref:s}),g=sr({ref:o}),w=[],b=[],x=[],E=[],_=await Oi({fs:t,cache:e,dir:n,gitdir:r,trees:[p,m,g],map:async function(T,[y,S,k]){let C=Po(T),M=await Bo(y,S),P=await Bo(k,S);switch(`${M}-${P}`){case"false-false":return{mode:await S.mode(),path:C,oid:await S.oid(),type:await S.type()};case"false-true":return k?{mode:await k.mode(),path:C,oid:await k.oid(),type:await k.type()}:void 0;case"true-false":return y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&S&&k&&await y.type()==="blob"&&await S.type()==="blob"&&await k.type()==="blob")return pC({fs:t,gitdir:r,path:C,ours:y,base:S,theirs:k,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async $=>{if($.cleanMerge)d||i.insert({filepath:T,oid:$.mergeResult.oid,stage:0});else if(w.push(T),b.push(T),!d){let j=await S.oid(),Q=await y.oid(),le=await k.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:j,stage:1}),i.insert({filepath:T,oid:Q,stage:2}),i.insert({filepath:T,oid:le,stage:3})}return $.mergeResult});if(S&&!y&&k&&await S.type()==="blob"&&await k.type()==="blob"){if(w.push(T),x.push(T),!d){let $=await S.oid(),j=await k.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:$,stage:1}),i.insert({filepath:T,oid:j,stage:3})}return{mode:await k.mode(),oid:await k.oid(),type:"blob",path:C}}if(S&&y&&!k&&await S.type()==="blob"&&await y.type()==="blob"){if(w.push(T),E.push(T),!d){let $=await S.oid(),j=await y.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:$,stage:1}),i.insert({filepath:T,oid:j,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(S&&!y&&!k&&await S.type()==="blob")return;throw new Ai}}},reduce:w.length!==0&&(!n||d)?void 0:async(T,y)=>{let S=y.filter(Boolean);if(T&&!(T&&T.type==="tree"&&S.length===0)){if(S.length>0){let C=new It(S).toObject(),M=await $t({fs:t,gitdir:r,type:"tree",object:C,dryRun:f});T.oid=M}return T}}});return w.length!==0?(n&&!d&&await Oi({fs:t,cache:e,dir:n,gitdir:r,trees:[sr({ref:_.oid})],map:async function(T,[y]){let S=`${n}/${T}`;if(await y.type()==="blob"){let k=await y.mode(),C=new TextDecoder().decode(await y.content());await t.write(S,C,{mode:k})}return!0}}),new Ti(w,b,x,E)):_.oid}async function pC({fs:t,gitdir:e,path:n,ours:r,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:c,mergeDriver:u=dC}){let f="blob",d=await i.mode()===await r.mode()?await a.mode():await r.mode();if(await r.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:n,oid:await r.oid(),type:f}};if(await r.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:n,oid:await a.oid(),type:f}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:n,oid:await r.oid(),type:f}};let h=Buffer.from(await r.content()).toString("utf8"),p=Buffer.from(await i.content()).toString("utf8"),m=Buffer.from(await a.content()).toString("utf8"),{mergedText:g,cleanMerge:w}=await u({branches:[l,s,o],contents:[p,h,m],path:n}),b=await $t({fs:t,gitdir:e,type:"blob",object:Buffer.from(g,"utf8"),dryRun:c});return{cleanMerge:w,mergeResult:{mode:d,path:n,oid:b,type:f}}}async function S1({fs:t,cache:e,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:m,mergeDriver:g}){i===void 0&&(i=await zr({fs:t,gitdir:r,fullname:!0})),i=await W.expand({fs:t,gitdir:r,ref:i}),a=await W.expand({fs:t,gitdir:r,ref:a});let w=await W.resolve({fs:t,gitdir:r,ref:i}),b=await W.resolve({fs:t,gitdir:r,ref:a}),x=await Pf({fs:t,cache:e,gitdir:r,oids:[w,b]});if(x.length!==1)throw new Ai;let E=x[0];if(E===b)return{oid:w,alreadyMerged:!0};if(s&&E===w)return!l&&!c&&await W.writeRef({fs:t,gitdir:r,ref:i,value:b}),{oid:b,fastForward:!0};{if(o)throw new Ja;let _=await it.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async y=>hC({fs:t,cache:e,dir:n,gitdir:r,index:y,ourOid:w,theirOid:b,baseOid:E,ourName:Nr(i),baseName:"base",theirName:Nr(a),dryRun:l,abortOnConflict:u,mergeDriver:g}));if(_ instanceof Ti)throw _;return f||(f=`Merge branch '${Nr(a)}' into ${Nr(i)}`),{oid:await qo({fs:t,cache:e,gitdir:r,message:f,ref:i,tree:_,parent:[w,b],author:d,committer:h,signingKey:p,onSign:m,dryRun:l,noUpdateBranch:c}),tree:_,mergeCommit:!0}}}async function E1({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:m,fastForward:g,fastForwardOnly:w,corsProxy:b,singleBranch:x,headers:E,author:_,committer:T,signingKey:y}){try{if(!u){let C=await zr({fs:t,gitdir:c});if(!C)throw new Ot("ref");u=C}let{fetchHead:S,fetchHeadDescription:k}=await If({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:d,remoteRef:h,singleBranch:x,headers:E,prune:p,pruneTags:m});await S1({fs:t,cache:e,gitdir:c,ours:u,theirs:S,fastForward:g,fastForwardOnly:w,message:`Merge ${k}`,author:_,committer:T,signingKey:y,dryRun:!1,noUpdateBranch:!1}),await Of({fs:t,cache:e,onProgress:r,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(S){throw S.caller="git.pull",S}}async function mC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:p,headers:m={},cache:g={}}){try{F("fs",t),F("http",e),F("gitdir",l);let w={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await E1({fs:new ee(t),cache:g,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:m,author:w,committer:w})}catch(w){throw w.caller="git.fastForward",w}}async function gC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:g=[],relative:w=!1,tags:b=!1,singleBranch:x=!1,headers:E={},prune:_=!1,pruneTags:T=!1,cache:y={}}){try{return F("fs",t),F("http",e),F("gitdir",l),await If({fs:new ee(t),cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:l,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p,since:m,exclude:g,relative:w,tags:b,singleBranch:x,headers:E,prune:_,pruneTags:T})}catch(S){throw S.caller="git.fetch",S}}async function yC({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await Pf({fs:new ee(t),cache:i,gitdir:n,oids:r})}catch(a){throw a.caller="git.findMergeBase",a}}async function k1({fs:t,filepath:e}){if(await t.exists(B(e,".git")))return e;{let n=Ei(e);if(n===e)throw new Me(`git root for ${e}`);return k1({fs:t,filepath:n})}}async function vC({fs:t,filepath:e}){try{return F("fs",t),F("filepath",e),await k1({fs:new ee(t),filepath:e})}catch(n){throw n.caller="git.findRoot",n}}async function wC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await ls({fs:new ee(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfig",i}}async function bC({fs:t,gitdir:e,path:n}){return(await $e.get({fs:t,gitdir:e})).getall(n)}async function xC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await bC({fs:new ee(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfigAll",i}}async function _C({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{F("http",t),F("url",a);let c=await Li.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),p=h.pop(),m=u;for(let g of h)m[g]=m[g]||{},m=m[g];m[p]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),p=h.pop(),m=u;for(let g of h)m[g]=m[g]||{},m=m[g];m[p]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function A1(t,e,n,r){let i=[];for(let[a,s]of t.refs){if(e&&!a.startsWith(e))continue;if(a.endsWith("^{}")){if(r){let l=a.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=s}continue}let o={ref:a,oid:s};n&&t.symrefs.has(a)&&(o.target=t.symrefs.get(a)),i.push(o)}return i}async function SC({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2}){try{F("http",t),F("url",a);let u=await Li.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,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:A1(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function EC({type:t,object:e,format:n="content",oid:r=void 0}){return n!=="deflated"&&(n!=="wrapped"&&(e=lr.wrap({type:t,object:e})),r=await $n(e)),{oid:r,object:e}}async function kC({object:t}){try{F("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t=Buffer.from(t);let e="blob",{oid:n,object:r}=await EC({type:"blob",format:"content",object:t});return{oid:n,type:e,object:new Uint8Array(r),format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function AC({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,filepath:a}){try{a=B(r,a);let s=await t.read(a),o=c=>He({fs:t,cache:e,gitdir:i,oid:c}),l=await Xa.fromPack({pack:s,getExternalRefDelta:o,onProgress:n});return await t.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function TC({fs:t,onProgress:e,dir:n,gitdir:r=B(n,".git"),filepath:i,cache:a={}}){try{return F("fs",t),F("dir",n),F("gitdir",n),F("filepath",i),await AC({fs:new ee(t),cache:a,onProgress:e,dir:n,gitdir:r,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function CC({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){try{return F("fs",t),F("gitdir",r),e||F("dir",n),await _1({fs:new ee(t),bare:e,dir:n,gitdir:r,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function T1({fs:t,cache:e,gitdir:n,oid:r,ancestor:i,depth:a}){let s=await Ur.read({fs:t,gitdir:n});if(!r)throw new Ot("oid");if(!i)throw new Ot("ancestor");if(r===i)return!1;let o=[r],l=new Set,c=0;for(;o.length;){if(c++===a)throw new ts(a);let u=o.shift(),{type:f,object:d}=await He({fs:t,cache:e,gitdir:n,oid:u});if(f!=="commit")throw new kt(u,f,"commit");let h=Pt.from(d).parse();for(let p of h.parent)if(p===i)return!0;if(!s.has(u))for(let p of h.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function FC({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,ancestor:i,depth:a=-1,cache:s={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),F("ancestor",i),await T1({fs:new ee(t),cache:s,gitdir:n,oid:r,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function MC({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r}){try{return F("fs",t),F("dir",e),F("gitdir",n),F("filepath",r),Ii.isIgnored({fs:new ee(t),dir:e,gitdir:n,filepath:r})}catch(i){throw i.caller="git.isIgnored",i}}async function OC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("gitdir",n),W.listBranches({fs:new ee(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.listBranches",i}}async function IC({fs:t,gitdir:e,ref:n,cache:r}){if(n){let i=await W.resolve({gitdir:e,fs:t,ref:n}),a=[];return await C1({fs:t,cache:r,gitdir:e,oid:i,filenames:a,prefix:""}),a}else return it.acquire({fs:t,gitdir:e,cache:r},async function(i){return i.entries.map(a=>a.path)})}async function C1({fs:t,cache:e,gitdir:n,oid:r,filenames:i,prefix:a}){let{tree:s}=await ji({fs:t,cache:e,gitdir:n,oid:r});for(let o of s)o.type==="tree"?await C1({fs:t,cache:e,gitdir:n,oid:o.oid,filenames:i,prefix:B(a,o.path)}):i.push(B(a,o.path))}async function PC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),await IC({fs:new ee(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listFiles",a}}async function RC({fs:t,cache:e,gitdir:n,ref:r}){let i;try{i=await W.resolve({gitdir:n,fs:t,ref:r})}catch(o){if(o instanceof Me)return[]}return(await ji({fs:t,cache:e,gitdir:n,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function LC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",cache:i={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),await RC({fs:new ee(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listNotes",a}}async function jC({fs:t,gitdir:e}){let n=await $e.get({fs:t,gitdir:e}),r=await n.getSubsections("remote");return Promise.all(r.map(async a=>{let s=await n.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function DC({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),await jC({fs:new ee(t),gitdir:n})}catch(r){throw r.caller="git.listRemotes",r}}async function BC(t){let e=Ne.streamReader(t),n=[],r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let[i,a,...s]=r.split(" "),o={ref:a,oid:i};for(let l of s){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}n.push(o)}return n}async function NC({prefix:t,symrefs:e,peelTags:n}){let r=[];return r.push(Ne.encode(`command=ls-refs +`)),r.push(Ne.encode(`agent=${Xo.agent} +`)),(n||e||t)&&r.push(Ne.delim()),n&&r.push(Ne.encode("peel")),e&&r.push(Ne.encode("symrefs")),t&&r.push(Ne.encode(`ref-prefix ${t}`)),r.push(Ne.flush()),r}async function $C({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{F("http",t),F("url",a);let d=await Ri.discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(d.protocolVersion===1)return A1(d,c,u,f);let h=await NC({prefix:c,symrefs:u,peelTags:f}),p=await Ri.connect({http:t,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return BC(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function HC({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),W.listTags({fs:new ee(t),gitdir:n})}catch(r){throw r.caller="git.listTags",r}}function UC(t,e){return t.committer.timestamp-e.committer.timestamp}var zC="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function e1({fs:t,cache:e,gitdir:n,oid:r,fileId:i}){if(i===zC)return;let a=r,s,o=await Mi({fs:t,cache:e,gitdir:n,oid:r}),l=o.tree;return i===o.oid?s=o.path:(s=await F1({fs:t,cache:e,gitdir:n,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function F1({fs:t,cache:e,gitdir:n,tree:r,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=r.entries().map(function(c){let u;return c.oid===i?(u=B(o,c.path),s.push(u)):c.type==="tree"&&(u=He({fs:t,cache:e,gitdir:n,oid:c.oid}).then(function({object:f}){return F1({fs:t,cache:e,gitdir:n,tree:It.from(f),fileId:i,oid:a,filepaths:s,parentPath:B(o,c.path)})})),u});return await Promise.all(l),s}async function GC({fs:t,cache:e,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l}){let c=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await Ur.read({fs:t,gitdir:n}),d=await W.resolve({fs:t,gitdir:n,ref:i}),h=[await No({fs:t,cache:e,gitdir:n,oid:d})],p,m,g;function w(b){g&&r&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(r){let x;try{x=await us({fs:t,cache:e,gitdir:n,oid:b.commit.tree,filepath:r}),m&&p!==x&&u.push(m),p=x,m=b,g=!0}catch(E){if(E instanceof Me){let _=l&&p;if(_&&(_=await e1({fs:t,cache:e,gitdir:n,oid:b.commit.tree,fileId:p}),_))if(Array.isArray(_)){if(m){let T=await e1({fs:t,cache:e,gitdir:n,oid:m.commit.tree,fileId:p});if(Array.isArray(T))if(_=_.filter(y=>T.indexOf(y)===-1),_.length===1)_=_[0],r=_,m&&u.push(m);else{_=!1,m&&u.push(m);break}}}else r=_,m&&u.push(m);if(!_){if(g&&p&&(u.push(m),!o))break;if(!o&&!l)throw E}m=b,g=!1}else throw E}}else u.push(b);if(a!==void 0&&u.length===a){w(b);break}if(!f.has(b.oid))for(let x of b.commit.parent){let E=await No({fs:t,cache:e,gitdir:n,oid:x});h.map(_=>_.oid).includes(E.oid)||h.push(E)}h.length===0&&w(b),h.sort((x,E)=>UC(x.commit,E.commit))}return u}async function VC({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:c={}}){try{return F("fs",t),F("gitdir",n),F("ref",i),await GC({fs:new ee(t),cache:c,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function WC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:m={},mergeDriver:g}){try{F("fs",t),p&&F("onSign",e);let w=new ee(t),b=await Hr({fs:w,gitdir:r,author:d});if(!b&&(!o||!s))throw new At("author");let x=await Pi({fs:w,gitdir:r,author:b,committer:h});if(!x&&(!o||!s))throw new At("committer");return await S1({fs:w,cache:m,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:b,committer:x,signingKey:p,onSign:e,mergeDriver:g})}catch(w){throw w.caller="git.merge",w}}var qC={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function M1({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Cf.default,s=[];function o(u,f){let d=Buffer.from(u,f);s.push(d),a.update(d)}async function l({stype:u,object:f}){let d=qC[u],h=f.length,p=h>15?128:0,m=h&15;h=h>>>4;let g=(p|d|m).toString(16);for(o(g,"hex");p;)p=h>127?128:0,g=p|h&127,o(Tf(2,g),"hex"),h=h>>>7;o(Buffer.from(await d1(f)))}o("PACK"),o("00000002","hex"),o(Tf(8,i.length),"hex");for(let u of i){let{type:f,object:d}=await He({fs:t,cache:e,gitdir:r,oid:u});await l({write:o,object:d,stype:f})}let c=a.digest();return s.push(c),s}async function XC({fs:t,cache:e,gitdir:n,oids:r,write:i}){let a=await M1({fs:t,cache:e,gitdir:n,oids:r}),s=Buffer.from(await $o(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(B(n,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function YC({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,write:i=!1,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await XC({fs:new ee(t),cache:a,gitdir:n,oids:r,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function ZC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:m=!0,fastForwardOnly:g=!1,corsProxy:w,singleBranch:b,headers:x={},author:E,committer:_,signingKey:T,cache:y={}}){try{F("fs",t),F("gitdir",l);let S=new ee(t),k=await Hr({fs:S,gitdir:l,author:E});if(!k)throw new At("author");let C=await Pi({fs:S,gitdir:l,author:k,committer:_});if(!C)throw new At("committer");return await E1({fs:S,cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:d,fastForward:m,fastForwardOnly:g,corsProxy:w,singleBranch:b,headers:x,author:k,committer:C,signingKey:T,prune:h,pruneTags:p})}catch(S){throw S.caller="git.pull",S}}async function KC({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),start:i,finish:a}){let s=await Ur.read({fs:t,gitdir:r}),o=new Set,l=new Set;for(let f of i)o.add(await W.resolve({fs:t,gitdir:r,ref:f}));for(let f of a)try{let d=await W.resolve({fs:t,gitdir:r,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await He({fs:t,cache:e,gitdir:r,oid:f});if(d==="tag"){let m=Nt.from(h).headers().object;return u(m)}if(d!=="commit")throw new kt(f,d,"commit");if(!s.has(f)){let m=Pt.from(h).headers().parent;for(f of m)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of o)await u(f);return c}async function mf({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:l,object:c}=await He({fs:t,cache:e,gitdir:r,oid:o});if(l==="tag"){let f=Nt.from(c).headers().object;await s(f)}else if(l==="commit"){let f=Pt.from(c).headers().tree;await s(f)}else if(l==="tree"){let u=It.from(c);for(let f of u)f.type==="blob"&&a.add(f.oid),f.type==="tree"&&await s(f.oid)}}for(let o of i)await s(o);return a}async function QC(t){let e={},n="",r=Ne.streamReader(t),i=await r();for(;i!==!0;)i!==null&&(n+=i.toString("utf8")+` +`),i=await r();let a=n.toString("utf8").split(` +`);if(i=a.shift(),!i.startsWith("unpack "))throw new $r('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.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 JC({capabilities:t=[],triplets:e=[]}){let n=[],r=`\0 ${t.join(" ")}`;for(let i of e)n.push(Ne.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${r} +`)),r="";return n.push(Ne.flush()),n}async function e6({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:m=!1,corsProxy:g,headers:w={}}){let b=u||await zr({fs:t,gitdir:c});if(typeof b=="undefined")throw new Ot("ref");let x=await $e.get({fs:t,gitdir:c});d=d||await x.get(`branch.${b}.pushRemote`)||await x.get("remote.pushDefault")||await x.get(`branch.${b}.remote`)||"origin";let E=h||await x.get(`remote.${d}.pushurl`)||await x.get(`remote.${d}.url`);if(typeof E=="undefined")throw new Ot("remote OR url");let _=f||await x.get(`branch.${b}.merge`);if(typeof E=="undefined")throw new Ot("remoteRef");g===void 0&&(g=await x.get("http.corsProxy"));let T=await W.expand({fs:t,gitdir:c,ref:b}),y=m?"0000000000000000000000000000000000000000":await W.resolve({fs:t,gitdir:c,ref:T}),S=Li.getRemoteHelperFor({url:E}),k=await S.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:g,service:"git-receive-pack",url:E,headers:w,protocolVersion:1}),C=k.auth,M;if(!_)M=T;else try{M=await W.expandAgainstMap({ref:_,map:k.refs})}catch(U){if(U instanceof Me)M=_.startsWith("refs/")?_:`refs/heads/${_}`;else throw U}let P=k.refs.get(M)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:E,localRef:{ref:m?"(delete)":T,oid:y},remoteRef:{ref:M,oid:P}}))throw new Fi;let $=!k.capabilities.has("no-thin"),j=new Set;if(!m){let U=[...k.refs.values()],D=new Set;if(P!=="0000000000000000000000000000000000000000"){let se=await Pf({fs:t,cache:e,gitdir:c,oids:[y,P]});for(let _e of se)U.push(_e);$&&(D=await mf({fs:t,cache:e,gitdir:c,oids:se}))}if(!U.includes(y)){let se=await KC({fs:t,cache:e,gitdir:c,start:[y],finish:U});j=await mf({fs:t,cache:e,gitdir:c,oids:se})}if($){try{let se=await W.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:_e}=await W.resolveAgainstMap({ref:se.replace(`refs/remotes/${d}/`,""),fullref:se,map:k.refs}),mt=[_e];for(let X of await mf({fs:t,cache:e,gitdir:c,oids:mt}))D.add(X)}catch(se){}for(let se of D)j.delete(se)}if(y===P&&(p=!0),!p){if(T.startsWith("refs/tags")&&P!=="0000000000000000000000000000000000000000")throw new Ci("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&P!=="0000000000000000000000000000000000000000"&&!await T1({fs:t,cache:e,gitdir:c,oid:y,ancestor:P,depth:-1}))throw new Ci("not-fast-forward")}}let Q=b1([...k.capabilities],["report-status","side-band-64k",`agent=${Xo.agent}`]),le=await JC({capabilities:Q,triplets:[{oldoid:P,oid:y,fullRef:M}]}),de=m?[]:await M1({fs:t,cache:e,gitdir:c,oids:[...j]}),re=await S.connect({http:n,onProgress:r,corsProxy:g,service:"git-receive-pack",url:E,auth:C,headers:w,body:[...le,...de]}),{packfile:Ae,progress:he}=await Ho.demux(re.body);if(i){let U=x1(he);fs(U,async D=>{await i(D)})}let H=await QC(Ae);if(re.headers&&(H.headers=re.headers),d&&H.ok&&H.refs[M].ok&&!T.startsWith("refs/tags")){let U=`refs/remotes/${d}/${M.replace("refs/heads","")}`;m?await W.deleteRef({fs:t,gitdir:c,ref:U}):await W.writeRef({fs:t,gitdir:c,ref:U,value:y})}if(H.ok&&Object.values(H.refs).every(U=>U.ok))return H;{let U=Object.entries(H.refs).filter(([D,se])=>!se.ok).map(([D,se])=>` + - ${D}: ${se.error}`).join("");throw new es(U,H)}}async function t6({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:m=!1,corsProxy:g,headers:w={},cache:b={}}){try{return F("fs",t),F("http",e),F("gitdir",c),await e6({fs:new ee(t),cache:b,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:m,corsProxy:g,headers:w})}catch(x){throw x.caller="git.push",x}}async function O1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Nt.from(a).parse().object,O1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="blob")throw new kt(r,i,"blob");return{oid:r,blob:new Uint8Array(a)}}async function I1({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){return i!==void 0&&(r=await us({fs:t,cache:e,gitdir:n,oid:r,filepath:i})),await O1({fs:t,cache:e,gitdir:n,oid:r})}async function ds({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await I1({fs:new ee(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function n6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await No({fs:new ee(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readCommit",a}}async function r6({fs:t,cache:e,gitdir:n,ref:r="refs/notes/commits",oid:i}){let a=await W.resolve({gitdir:n,fs:t,ref:r}),{blob:s}=await I1({fs:t,cache:e,gitdir:n,oid:a,filepath:i});return s}async function i6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",oid:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oid",i),await r6({fs:new ee(t),cache:a,gitdir:n,ref:r,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function a6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{F("fs",t),F("gitdir",n),F("oid",r);let l=new ee(t);a!==void 0&&(r=await us({fs:l,cache:o,gitdir:n,oid:r,filepath:a}));let u=await He({fs:l,cache:o,gitdir:n,oid:r,format:i==="parsed"?"content":i});if(u.oid=r,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=Pt.from(u.object).parse();break;case"tree":u.object=It.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Nt.from(u.object).parse();break;default:throw new kt(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(l){throw l.caller="git.readObject",l}}async function s6({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r,format:"content"});if(i!=="tag")throw new kt(r,i,"tag");let s=Nt.from(a);return{oid:r,tag:s.parse(),payload:s.payload()}}async function o6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await s6({fs:new ee(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readTag",a}}async function l6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i=void 0,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await ji({fs:new ee(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function c6({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r),await it.acquire({fs:new ee(t),gitdir:n,cache:i},async function(a){a.delete({filepath:r})})}catch(a){throw a.caller="git.remove",a}}async function u6({fs:t,cache:e,onSign:n,gitdir:r,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let c;try{c=await W.resolve({gitdir:r,fs:t,ref:i})}catch(p){if(!(p instanceof Me))throw p}let f=(await ji({fs:t,gitdir:r,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let d=await Mf({fs:t,gitdir:r,tree:f});return await qo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' +`,author:s,committer:o,signingKey:l})}async function f6({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:c={}}){try{F("fs",t),F("gitdir",r),F("oid",a);let u=new ee(t),f=await Hr({fs:u,gitdir:r,author:s});if(!f)throw new At("author");let d=await Pi({fs:u,gitdir:r,author:f,committer:o});if(!d)throw new At("committer");return await u6({fs:u,cache:c,onSign:e,gitdir:r,ref:i,oid:a,author:f,committer:d,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function d6({fs:t,gitdir:e,oldref:n,ref:r,checkout:i=!1}){if(r!==cn.default.clean(r))throw new Hn(r,cn.default.clean(r));if(n!==cn.default.clean(n))throw new Hn(n,cn.default.clean(n));let a=`refs/heads/${n}`,s=`refs/heads/${r}`;if(await W.exists({fs:t,gitdir:e,ref:s}))throw new un("branch",r,!1);let l=await W.resolve({fs:t,gitdir:e,ref:a,depth:1});await W.writeRef({fs:t,gitdir:e,ref:s,value:l}),await W.deleteRef({fs:t,gitdir:e,ref:a});let u=await zr({fs:t,gitdir:e,fullname:!0})===a;(i||u)&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function h6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,oldref:i,checkout:a=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oldref",i),await d6({fs:new ee(t),gitdir:n,ref:r,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function P1({gitdir:t,type:e,object:n}){return $n(lr.wrap({type:e,object:n}))}async function p6({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i,cache:a={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let s=new ee(t),o,l;try{o=await W.resolve({fs:s,gitdir:n,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await us({fs:s,cache:a,gitdir:n,oid:o,filepath:r})}catch(f){o=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await s.read(B(e,r));u&&(l=await P1({gitdir:n,type:"blob",object:u}),o===l&&(c=await s.lstat(B(e,r)))),await it.acquire({fs:s,gitdir:n,cache:a},async function(f){f.delete({filepath:r}),o&&f.insert({filepath:r,stats:c,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function m6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,depth:i}){try{return F("fs",t),F("gitdir",n),F("ref",r),await W.resolve({fs:new ee(t),gitdir:n,ref:r,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function g6({fs:t,dir:e,gitdir:n=B(e,".git"),path:r,value:i,append:a=!1}){try{F("fs",t),F("gitdir",n),F("path",r);let s=new ee(t),o=await $e.get({fs:s,gitdir:n});a?await o.append(r,i):await o.set(r,i),await $e.save({fs:s,gitdir:n,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function y6({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let a=new ee(t);if(await Ii.isIgnored({fs:a,gitdir:n,dir:e,filepath:r}))return"ignored";let o=await v6({fs:a,cache:i,gitdir:n}),l=await R1({fs:a,cache:i,gitdir:n,tree:o,path:r}),c=await it.acquire({fs:a,gitdir:n,cache:i},async function(m){for(let g of m)if(g.path===r)return g;return null}),u=await a.lstat(B(e,r)),f=l!==null,d=c!==null,h=u!==null,p=async()=>{if(d&&!Io(c,u))return c.oid;{let m=await a.read(B(e,r)),g=await P1({gitdir:n,type:"blob",object:m});return d&&c.oid===g&&u.size!==-1&&it.acquire({fs:a,gitdir:n,cache:i},async function(w){w.insert({filepath:r,stats:u,oid:g})}),g}};if(!f&&!h&&!d)return"absent";if(!f&&!h&&d)return"*absent";if(!f&&h&&!d)return"*added";if(!f&&h&&d)return await p()===c.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return l===c.oid,"*deleted";if(f&&h&&!d)return await p()===l?"*undeleted":"*undeletemodified";if(f&&h&&d){let m=await p();return m===l?m===c.oid?"unmodified":"*unmodified":m===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function R1({fs:t,cache:e,gitdir:n,tree:r,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of r)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await He({fs:t,cache:e,gitdir:n,oid:s.oid});if(o==="tree"){let c=It.from(l);return R1({fs:t,cache:e,gitdir:n,tree:c,path:i})}if(o==="blob")throw new kt(s.oid,o,"blob",i.join("/"))}return null}async function v6({fs:t,cache:e,gitdir:n}){let r;try{r=await W.resolve({fs:t,gitdir:n,ref:"HEAD"})}catch(a){if(a instanceof Me)return[]}let{tree:i}=await ji({fs:t,cache:e,gitdir:n,oid:r});return i}async function w6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let l=new ee(t);return await Oi({fs:l,cache:s,dir:e,gitdir:n,trees:[sr({ref:r}),Wo(),Vo()],map:async function(c,[u,f,d]){if(!u&&!d&&f&&!o&&await Ii.isIgnored({fs:l,dir:e,filepath:c})||!i.some(T=>v1(c,T)))return null;if(a&&!a(c))return;let[h,p,m]=await Promise.all([u&&u.type(),f&&f.type(),d&&d.type()]),g=[h,p,m].includes("blob");if((h==="tree"||h==="special")&&!g)return;if(h==="commit")return null;if((p==="tree"||p==="special")&&!g)return;if(m==="commit")return null;if((m==="tree"||m==="special")&&!g)return;let w=h==="blob"?await u.oid():void 0,b=m==="blob"?await d.oid():void 0,x;h!=="blob"&&p==="blob"&&m!=="blob"?x="42":p==="blob"&&(x=await f.oid());let E=[void 0,w,x,b],_=E.map(T=>E.indexOf(T));return _.shift(),[c,..._]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function b6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,force:a=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let s=new ee(t);if(r===void 0)throw new Ot("ref");r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`;let o=await W.resolve({fs:s,gitdir:n,ref:i||"HEAD"});if(!a&&await W.exists({fs:s,gitdir:n,ref:r}))throw new un("tag",r);await W.writeRef({fs:s,gitdir:n,ref:r,value:o})}catch(s){throw s.caller="git.tag",s}}async function x6({fs:t,dir:e,gitdir:n=B(e,".git"),cache:r={},filepath:i,oid:a,mode:s,add:o,remove:l,force:c}){try{F("fs",t),F("gitdir",n),F("filepath",i);let u=new ee(t);if(l)return await it.acquire({fs:u,gitdir:n,cache:r},async function(d){let h;if(!c&&(h=await u.lstat(B(e,i)),h)){if(h.isDirectory())throw new cr("directory");return}d.has({filepath:i})&&d.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(B(e,i)),!f)throw new Me(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new cr("directory")}return await it.acquire({fs:u,gitdir:n,cache:r},async function(d){if(!o&&!d.has({filepath:i}))throw new Me(`file at "${i}" in index and "add" not set`);let h={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};if(!a){h=f;let p=h.isSymbolicLink()?await u.readlink(B(e,i)):await u.read(B(e,i));a=await $t({fs:u,gitdir:n,type:"blob",format:"content",object:p})}return d.insert({filepath:i,oid:a,stats:h}),a})}catch(u){throw u.caller="git.updateIndex",u}}function _6(){try{return Xo.version}catch(t){throw t.caller="git.version",t}}async function S6({fs:t,dir:e,gitdir:n=B(e,".git"),trees:r,map:i,reduce:a,iterate:s,cache:o={}}){try{return F("fs",t),F("gitdir",n),F("trees",r),await Oi({fs:new ee(t),cache:o,dir:e,gitdir:n,trees:r,map:i,reduce:a,iterate:s})}catch(l){throw l.caller="git.walk",l}}async function E6({fs:t,dir:e,gitdir:n=B(e,".git"),blob:r}){try{return F("fs",t),F("gitdir",n),F("blob",r),await $t({fs:new ee(t),gitdir:n,type:"blob",object:r,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function k6({fs:t,gitdir:e,commit:n}){let r=Pt.from(n).toObject();return await $t({fs:t,gitdir:e,type:"commit",object:r,format:"content"})}async function A6({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r}){try{return F("fs",t),F("gitdir",n),F("commit",r),await k6({fs:new ee(t),gitdir:n,commit:r})}catch(i){throw i.caller="git.writeCommit",i}}async function T6({fs:t,dir:e,gitdir:n=B(e,".git"),type:r,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let l=new ee(t);if(a==="parsed"){switch(r){case"commit":i=Pt.from(i).toObject();break;case"tree":i=It.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=Nt.from(i).toObject();break;default:throw new kt(s||"",r,"blob|commit|tag|tree")}a="content"}return s=await $t({fs:l,gitdir:n,type:r,object:i,oid:s,format:a}),s}catch(l){throw l.caller="git.writeObject",l}}async function C6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,value:i,force:a=!1,symbolic:s=!1}){try{F("fs",t),F("gitdir",n),F("ref",r),F("value",i);let o=new ee(t);if(r!==cn.default.clean(r))throw new Hn(r,cn.default.clean(r));if(!a&&await W.exists({fs:o,gitdir:n,ref:r}))throw new un("ref",r);s?await W.writeSymbolicRef({fs:o,gitdir:n,ref:r,value:i}):(i=await W.resolve({fs:o,gitdir:n,ref:i}),await W.writeRef({fs:o,gitdir:n,ref:r,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function F6({fs:t,gitdir:e,tag:n}){let r=Nt.from(n).toObject();return await $t({fs:t,gitdir:e,type:"tag",object:r,format:"content"})}async function M6({fs:t,dir:e,gitdir:n=B(e,".git"),tag:r}){try{return F("fs",t),F("gitdir",n),F("tag",r),await F6({fs:new ee(t),gitdir:n,tag:r})}catch(i){throw i.caller="git.writeTag",i}}async function O6({fs:t,dir:e,gitdir:n=B(e,".git"),tree:r}){try{return F("fs",t),F("gitdir",n),F("tree",r),await Mf({fs:new ee(t),gitdir:n,tree:r})}catch(i){throw i.caller="git.writeTree",i}}var I6={Errors:cs,STAGE:Vo,TREE:sr,WORKDIR:Wo,add:O5,abortMerge:A5,addNote:P5,addRemote:R5,annotatedTag:j5,branch:B5,checkout:$5,clone:K5,commit:Q5,getConfig:wC,getConfigAll:xC,setConfig:g6,currentBranch:J5,deleteBranch:tC,deleteRef:nC,deleteRemote:iC,deleteTag:sC,expandOid:uC,expandRef:fC,fastForward:mC,fetch:gC,findMergeBase:yC,findRoot:vC,getRemoteInfo:_C,getRemoteInfo2:SC,hashBlob:kC,indexPack:TC,init:CC,isDescendent:FC,isIgnored:MC,listBranches:OC,listFiles:PC,listNotes:LC,listRemotes:DC,listServerRefs:$C,listTags:HC,log:VC,merge:WC,packObjects:YC,pull:ZC,push:t6,readBlob:ds,readCommit:n6,readNote:i6,readObject:a6,readTag:o6,readTree:l6,remove:c6,removeNote:f6,renameBranch:h6,resetIndex:p6,updateIndex:x6,resolveRef:m6,status:y6,statusMatrix:w6,tag:b6,version:_6,walk:S6,writeBlob:E6,writeCommit:A6,writeObject:T6,writeRef:C6,writeTag:M6,writeTree:O6},ie=I6;var xe=require("obsidian");v();var Hs=require("obsidian");v();var oS=require("child_process"),lS=Ve(Ko()),Qr=require("obsidian"),vt=Ve(require("path")),Ds=require("path");v();var cl=Ve($1(),1),sl=Ve(Ko(),1),av=require("child_process"),Hv=Ve(Lf(),1),Ui=Ve(Lf(),1),ll=Object.defineProperty,K6=Object.defineProperties,Q6=Object.getOwnPropertyDescriptor,J6=Object.getOwnPropertyDescriptors,Jf=Object.getOwnPropertyNames,H1=Object.getOwnPropertySymbols,yy=Object.prototype.hasOwnProperty,e8=Object.prototype.propertyIsEnumerable,U1=(t,e,n)=>e in t?ll(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,tn=(t,e)=>{for(var n in e||(e={}))yy.call(e,n)&&U1(t,n,e[n]);if(H1)for(var n of H1(e))e8.call(e,n)&&U1(t,n,e[n]);return t},ms=(t,e)=>K6(t,J6(e)),t8=t=>ll(t,"__esModule",{value:!0}),q=(t,e)=>function(){return t&&(e=(0,t[Jf(t)[0]])(t=0)),e},n8=(t,e)=>function(){return e||(0,t[Jf(t)[0]])((e={exports:{}}).exports,e),e.exports},qe=(t,e)=>{for(var n in e)ll(t,n,{get:e[n],enumerable:!0})},r8=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Jf(e))!yy.call(t,i)&&(n||i!=="default")&&ll(t,i,{get:()=>e[i],enumerable:!(r=Q6(e,i))||r.enumerable});return t},Ue=(t=>(e,n)=>t&&t.get(e)||(n=r8(t8({}),e,1),t&&t.set(e,n),n))(typeof WeakMap!="undefined"?new WeakMap:0),ps=(t,e,n)=>new Promise((r,i)=>{var a=l=>{try{o(n.next(l))}catch(c){i(c)}},s=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((n=n.apply(t,e)).next())}),Un,dr=q({"src/lib/errors/git-error.ts"(){Un=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),ws,Gi=q({"src/lib/errors/git-response-error.ts"(){dr(),ws=class extends Un{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),vy,wy=q({"src/lib/errors/task-configuration-error.ts"(){dr(),vy=class extends Un{constructor(t){super(void 0,t)}}}});function by(t){return typeof t=="function"?t:Xr}function xy(t){return typeof t=="function"&&t!==Xr}function _y(t,e){let n=t.indexOf(e);return n<=0?[t,""]:[t.substr(0,n),t.substr(n+1)]}function Sy(t,e=0){return Ey(t)&&t.length>e?t[e]:void 0}function qr(t,e=0){if(Ey(t)&&t.length>e)return t[t.length-1-e]}function Ey(t){return!!(t&&typeof t.length=="number")}function bs(t="",e=!0,n=` +`){return t.split(n).reduce((r,i)=>{let a=e?i.trim():i;return a&&r.push(a),r},[])}function ed(t,e){return bs(t,!0).map(n=>e(n))}function td(t){return(0,cl.exists)(t,cl.FOLDER)}function we(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function ky(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ul(t,e){if(Array.isArray(t)){let n=t.indexOf(e);n>=0&&t.splice(n,1)}else t.delete(e);return e}function fr(t){return Array.isArray(t)?t:[t]}function Ay(t){return fr(t).map(String)}function je(t,e=0){if(t==null)return e;let n=parseInt(t,10);return isNaN(n)?e:n}function gs(t,e){let n=[];for(let r=0,i=t.length;rn in t?{[n]:t[n]}:{}))}function Hf(t=0){return new Promise(e=>setTimeout(e,t))}var zi,Xr,xs,fl=q({"src/lib/utils/util.ts"(){zi="\0",Xr=()=>{},xs=Object.prototype.toString.call.bind(Object.prototype.toString)}});function kn(t,e,n){return e(t)?t:arguments.length>2?n:void 0}function nd(t,e){return/number|string|boolean/.test(typeof t)&&(!e||!e.includes(typeof t))}function rd(t){return!!t&&xs(t)==="[object Object]"}function Cy(t){return typeof t=="function"}var _s,gt,Fy,al,id,My=q({"src/lib/utils/argument-filters.ts"(){fl(),_s=t=>Array.isArray(t),gt=t=>typeof t=="string",Fy=t=>Array.isArray(t)&&t.every(gt),al=t=>gt(t)||Array.isArray(t)&&t.every(gt),id=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),Uf,i8=q({"src/lib/utils/exit-codes.ts"(){Uf=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Uf||{})}}),vs,a8=q({"src/lib/utils/git-output-streams.ts"(){vs=class{constructor(t,e){this.stdOut=t,this.stdErr=e}asStrings(){return new vs(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),ue,ur,s8=q({"src/lib/utils/line-parser.ts"(){ue=class{constructor(t,e){this.matches=[],this.parse=(n,r)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,n(a)))?this.useMatches(r,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,n){let r=n&&t.exec(n);return r&&this.pushMatch(e,r),!!r}pushMatch(t,e){this.matches.push(...e.slice(1))}},ur=class extends ue{addMatch(t,e,n){return/^remote:\s/.test(String(n))&&super.addMatch(t,e,n)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function Oy(...t){let e=process.cwd(),n=Object.assign(tn({baseDir:e},Iy),...t.filter(r=>typeof r=="object"&&r));return n.baseDir=n.baseDir||e,n.trimmed=n.trimmed===!0,n}var Iy,o8=q({"src/lib/utils/simple-git-options.ts"(){Iy={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function ad(t,e=[]){return rd(t)?Object.keys(t).reduce((n,r)=>{let i=t[r];return nd(i,["boolean"])?n.push(r+"="+i):n.push(r),n},e):e}function en(t,e=0,n=!1){let r=[];for(let i=0,a=e<0?t.length:e;i{for(let a=bs(i,r),s=0,o=a.length;s{if(!(s+c>=o))return a[s+c]};e.some(({parse:c})=>c(l,t))}}),t}var u8=q({"src/lib/utils/task-parser.ts"(){fl()}}),Py={};qe(Py,{ExitCodes:()=>Uf,GitOutputStreams:()=>vs,LineParser:()=>ue,NOOP:()=>Xr,NULL:()=>zi,RemoteLineParser:()=>ur,append:()=>we,appendTaskOptions:()=>ad,asArray:()=>fr,asFunction:()=>by,asNumber:()=>je,asStringArray:()=>Ay,bufferToString:()=>ys,callTaskParser:()=>zf,createInstanceConfig:()=>Oy,delay:()=>Hf,filterArray:()=>_s,filterFunction:()=>Cy,filterHasLength:()=>id,filterPlainObject:()=>rd,filterPrimitives:()=>nd,filterString:()=>gt,filterStringArray:()=>Fy,filterStringOrStringArray:()=>al,filterType:()=>kn,first:()=>Sy,folderExists:()=>td,forEachLineWithContent:()=>ed,getTrailingOptions:()=>en,including:()=>ky,isUserFunction:()=>xy,last:()=>qr,objectToString:()=>xs,parseStringResponse:()=>Vt,pick:()=>Ty,prefixedArray:()=>gs,remove:()=>ul,splitOn:()=>_y,toLinesWithContent:()=>bs,trailingFunctionArgument:()=>at,trailingOptionsArgument:()=>sd});var fe=q({"src/lib/utils/index.ts"(){My(),i8(),a8(),s8(),o8(),c8(),u8(),fl()}}),Ry={};qe(Ry,{CheckRepoActions:()=>Gf,checkIsBareRepoTask:()=>jy,checkIsRepoRootTask:()=>Ly,checkIsRepoTask:()=>f8});function f8(t){switch(t){case"bare":return jy();case"root":return Ly()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:dl,parser:od}}function Ly(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:dl,parser(e){return/^\.(git)?$/.test(e.trim())}}}function jy(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:dl,parser:od}}function d8(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var Gf,dl,od,Dy=q({"src/lib/tasks/check-is-repo.ts"(){fe(),Gf=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(Gf||{}),dl=({exitCode:t},e,n,r)=>{if(t===128&&d8(e))return n(Buffer.from("false"));r(e)},od=t=>t.trim()==="true"}});function h8(t,e){let n=new By(t),r=t?$y:Ny;return bs(e).forEach(i=>{let a=i.replace(r,"");n.paths.push(a),(Hy.test(a)?n.folders:n.files).push(a)}),n}var By,Ny,$y,Hy,p8=q({"src/lib/responses/CleanSummary.ts"(){fe(),By=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},Ny=/^[a-z]+\s*/i,$y=/^[a-z]+\s+[a-z]+\s*/i,Hy=/\/$/}}),Vf={};qe(Vf,{EMPTY_COMMANDS:()=>hl,adhocExecTask:()=>Uy,configurationErrorTask:()=>Rt,isBufferTask:()=>zy,isEmptyTask:()=>Gy,straightThroughBufferTask:()=>m8,straightThroughStringTask:()=>Gt});function Uy(t){return{commands:hl,format:"empty",parser:t}}function Rt(t){return{commands:hl,format:"empty",parser(){throw typeof t=="string"?new vy(t):t}}}function Gt(t,e=!1){return{commands:t,format:"utf-8",parser(n){return e?String(n).trim():n}}}function m8(t){return{commands:t,format:"buffer",parser(e){return e}}}function zy(t){return t.format==="buffer"}function Gy(t){return t.format==="empty"||!t.commands.length}var hl,st=q({"src/lib/tasks/task.ts"(){wy(),hl=[]}}),Vy={};qe(Vy,{CONFIG_ERROR_INTERACTIVE_MODE:()=>ld,CONFIG_ERROR_MODE_REQUIRED:()=>cd,CONFIG_ERROR_UNKNOWN_OPTION:()=>ud,CleanOptions:()=>tl,cleanTask:()=>Wy,cleanWithOptionsTask:()=>g8,isCleanOptionsArray:()=>y8});function g8(t,e){let{cleanMode:n,options:r,valid:i}=v8(t);return n?i.options?(r.push(...e),r.some(x8)?Rt(ld):Wy(n,r)):Rt(ud+JSON.stringify(t)):Rt(cd)}function Wy(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(r){return h8(t==="n",r)}}}function y8(t){return Array.isArray(t)&&t.every(e=>fd.has(e))}function v8(t){let e,n=[],r={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{w8(i)?(e=i,r.cleanMode=!0):r.options=r.options&&b8(n[n.length]=`-${i}`)}),{cleanMode:e,options:n,valid:r}}function w8(t){return t==="f"||t==="n"}function b8(t){return/^-[a-z]$/i.test(t)&&fd.has(t.charAt(1))}function x8(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var ld,cd,ud,tl,fd,qy=q({"src/lib/tasks/clean.ts"(){p8(),fe(),st(),ld="Git clean interactive mode is not supported",cd='Git clean mode parameter ("n" or "f") is required',ud="Git clean unknown option found in: ",tl=(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))(tl||{}),fd=new Set(["i",...Ay(Object.values(tl))])}});function _8(t){let e=new Yy;for(let n of Xy(t))e.addValue(n.file,String(n.key),n.value);return e}function S8(t,e){let n=null,r=[],i=new Map;for(let a of Xy(t,e))a.key===e&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:e,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function E8(t){return t.replace(/^(file):/,"")}function*Xy(t,e=null){let n=t.split("\0");for(let r=0,i=n.length-1;rObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=qr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,n){let r=this.addFile(t);r.hasOwnProperty(e)?Array.isArray(r[e])?r[e].push(n):r[e]=[r[e],n]:r[e]=n,this._all=void 0}}}});function jf(t,e){return typeof t=="string"&&Wf.hasOwnProperty(t)?t:e}function A8(t,e,n,r){let i=["config",`--${r}`];return n&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function T8(t,e){let n=["config","--null","--show-origin","--get-all",t];return e&&n.splice(1,0,`--${e}`),{commands:n,format:"utf-8",parser(r){return S8(r,t)}}}function C8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(n){return _8(n)}}}function F8(){return{addConfig(t,e,...n){return this._runTask(A8(t,e,n[0]===!0,jf(n[1],"local")),at(arguments))},getConfig(t,e){return this._runTask(T8(t,jf(e,void 0)),at(arguments))},listConfig(...t){return this._runTask(C8(jf(t[0],void 0)),at(arguments))}}}var Wf,Zy=q({"src/lib/tasks/config.ts"(){k8(),fe(),Wf=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Wf||{})}});function M8(...t){return new Qy().param(...t)}function O8(t){let e=new Set,n={};return ed(t,r=>{let[i,a,s]=r.split(zi);e.add(i),(n[i]=n[i]||[]).push({line:je(a),path:i,preview:s})}),{paths:e,results:n}}function I8(){return{grep(t){let e=at(arguments),n=en(arguments);for(let i of Ky)if(n.includes(i))return this._runTask(Rt(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=M8().param(t));let r=["grep","--null","-n","--full-name",...n,...t];return this._runTask({commands:r,format:"utf-8",parser(i){return O8(i)}},e)}}}var Ky,hs,z1,Qy,Jy=q({"src/lib/tasks/grep.ts"(){fe(),st(),Ky=["-h"],hs=Symbol("grepQuery"),Qy=class{constructor(){this[z1]=[]}*[(z1=hs,Symbol.iterator)](){for(let t of this[hs])yield t}and(...t){return t.length&&this[hs].push("--and","(",...gs(t,"-e"),")"),this}param(...t){return this[hs].push(...gs(t,"-e")),this}}}}),ev={};qe(ev,{ResetMode:()=>nl,getResetMode:()=>R8,resetTask:()=>P8});function P8(t,e){let n=["reset"];return tv(t)&&n.push(`--${t}`),n.push(...e),Gt(n)}function R8(t){if(tv(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function tv(t){return nv.includes(t)}var nl,nv,rv=q({"src/lib/tasks/reset.ts"(){st(),nl=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(nl||{}),nv=Array.from(Object.values(nl))}});function L8(){return(0,sl.default)("simple-git")}function G1(t,e,n){return!e||!String(e).replace(/\s*/,"")?n?(r,...i)=>{t(r,...i),n(r,...i)}:t:(r,...i)=>{t(`%s ${r}`,e,...i),n&&n(r,...i)}}function j8(t,e,{namespace:n}){if(typeof t=="string")return t;let r=e&&e.namespace||"";return r.startsWith(n)?r.substr(n.length+1):r||n}function dd(t,e,n,r=L8()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?r.extend(e):e,o=j8(kn(e,gt),s,r);return c(n);function l(u,f){return we(a,dd(t,o.replace(/^[^:]+/,u),f,r))}function c(u){let f=u&&`[${u}]`||"",d=s&&G1(s,f)||Xr,h=G1(r,`${i} ${f}`,d);return Object.assign(s?d:h,{label:t,sibling:l,info:h,step:c})}}var iv=q({"src/lib/git-logger.ts"(){fe(),sl.default.formatters.L=t=>String(id(t)?t.length:"-"),sl.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):xs(t)}}),Jo,qf,D8=q({"src/lib/runners/tasks-pending-queue.ts"(){dr(),iv(),Jo=class{constructor(t="GitExecutor"){this.logLabel=t,this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){let e=Jo.getName(t.commands[0]),n=dd(this.logLabel,e);return{task:t,logger:n,name:e}}push(t){let e=this.createProgress(t);return e.logger("Adding task to the queue, commands = %o",t.commands),this._queue.set(t,e),e}fatal(t){for(let[e,{logger:n}]of Array.from(this._queue.entries()))e===t.task?(n.info("Failed %o",t),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",t.message),this.complete(e);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(t){this.withProgress(t)&&this._queue.delete(t)}attempt(t){let e=this.withProgress(t);if(!e)throw new Un(void 0,"TasksPendingQueue: attempt called for an unknown task");return e.logger("Starting task"),e}static getName(t="empty"){return`task:${t}:${++Jo.counter}`}},qf=Jo,qf.counter=0}});function Hi(t,e){return{method:Sy(t.commands)||"",commands:e}}function B8(t,e){return n=>{e("[ERROR] child process exception %o",n),t.push(Buffer.from(String(n.stack),"ascii"))}}function V1(t,e,n,r){return i=>{n("%s received %L bytes",e,i),r("%B",i),t.push(i)}}var Xf,N8=q({"src/lib/runners/git-executor-chain.ts"(){dr(),st(),fe(),D8(),Xf=class{constructor(t,e,n){this._executor=t,this._scheduler=e,this._plugins=n,this._chain=Promise.resolve(),this._queue=new qf}get binary(){return this._executor.binary}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))}attemptTask(t){return ps(this,null,function*(){let e=yield this._scheduler.next(),n=()=>this._queue.complete(t);try{let{logger:r}=this._queue.attempt(t);return yield Gy(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{n(),e()}})}onFatalException(t,e){let n=e instanceof Un?Object.assign(e,{task:t}):new Un(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(n),n}attemptRemoteTask(t,e){return ps(this,null,function*(){let n=this._plugins.exec("spawn.args",[...t.commands],Hi(t,t.commands)),r=yield this.gitResponse(t,this.binary,n,this.outputHandler,e.step("SPAWN")),i=yield this.handleTaskData(t,n,r,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),zy(t)?zf(t.parser,i):zf(t.parser,i.asStrings())})}attemptEmptyTask(t,e){return ps(this,null,function*(){return e("empty task bypassing child process to call to task's parser"),t.parser(this)})}handleTaskData(t,e,n,r){let{exitCode:i,rejection:a,stdOut:s,stdErr:o}=n;return new Promise((l,c)=>{r("Preparing to handle process response exitCode=%d stdOut=",i);let{error:u}=this._plugins.exec("task.error",{error:a},tn(tn({},Hi(t,e)),n));if(u&&t.onError)return r.info("exitCode=%s handling with custom error handler"),t.onError(n,u,f=>{r.info("custom error handler treated as success"),r("custom error returned a %s",xs(f)),l(new vs(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},c);if(u)return r.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,o.length,a),c(u);r.info("retrieving task output complete"),l(new vs(Buffer.concat(s),Buffer.concat(o)))})}gitResponse(t,e,n,r,i){return ps(this,null,function*(){let a=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Hi(t,t.commands));return new Promise(o=>{let l=[],c=[];i.info("%s %o",e,n),i("%O",s);let u=this._beforeSpawn(t,n);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,ms(tn({},Hi(t,n)),{kill(d){u=d||u}}));let f=(0,av.spawn)(e,n,s);f.stdout.on("data",V1(l,"stdOut",i,a.step("stdOut"))),f.stderr.on("data",V1(c,"stdErr",i,a.step("stdErr"))),f.on("error",B8(c,i)),r&&(i("Passing child process stdOut/stdErr to custom outputHandler"),r(e,f.stdout,f.stderr,[...n])),this._plugins.exec("spawn.after",void 0,ms(tn({},Hi(t,n)),{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 n;return this._plugins.exec("spawn.before",void 0,ms(tn({},Hi(t,e)),{kill(r){n=r||n}})),n}}}}),sv={};qe(sv,{GitExecutor:()=>ov});var ov,$8=q({"src/lib/runners/git-executor.ts"(){N8(),ov=class{constructor(t="git",e,n,r){this.binary=t,this.cwd=e,this._scheduler=n,this._plugins=r,this._chain=new Xf(this,this._scheduler,this._plugins)}chain(){return new Xf(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function H8(t,e,n=Xr){let r=a=>{n(null,a)},i=a=>{(a==null?void 0:a.task)===t&&n(a instanceof ws?U8(a):a,void 0)};e.then(r,i)}function U8(t){let e=r=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${r} should be GitResponseError.git.${r}, this will no longer be available in version 3`),e=Xr};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(n,{}));function n(r,i){return i in t||(r[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),r}}var z8=q({"src/lib/task-callback.ts"(){Gi(),fe()}});function W1(t,e){return Uy(n=>{if(!td(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||n).cwd=t})}var G8=q({"src/lib/tasks/change-working-directory.ts"(){fe(),st()}});function Df(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=ul(e,"-B")),Gt(e)}function V8(){return{checkout(){return this._runTask(Df(en(arguments,1)),at(arguments))},checkoutBranch(t,e){return this._runTask(Df(["-b",t,e,...en(arguments)]),at(arguments))},checkoutLocalBranch(t){return this._runTask(Df(["-b",t,...en(arguments)]),at(arguments))}}}var W8=q({"src/lib/tasks/checkout.ts"(){fe(),st()}});function q8(t){return Vt({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},lv,t)}var lv,X8=q({"src/lib/parsers/parse-commit.ts"(){fe(),lv=[new ue(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,n,r])=>{t.branch=e,t.commit=r,t.root=!!n}),new ue(/\s*Author:\s(.+)/i,(t,[e])=>{let n=e.split("<"),r=n.pop();!r||!r.includes("@")||(t.author={email:r.substr(0,r.length-1),name:n.join("<").trim()})}),new ue(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(n,10)||0,t.summary.deletions=parseInt(r,10)||0}),new ue(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(n,10)||0;r==="-"?t.summary.deletions=i:r==="+"&&(t.summary.insertions=i)})]}});function Y8(t,e,n){return{commands:["-c","core.abbrev=40","commit",...gs(t,"-m"),...e,...n],format:"utf-8",parser:q8}}function Z8(){return{commit(e,...n){let r=at(arguments),i=t(e)||Y8(fr(e),fr(kn(n[0],al,[])),[...kn(n[1],_s,[]),...en(arguments,0,!0)]);return this._runTask(i,r)}};function t(e){return!al(e)&&Rt("git.commit: requires the commit message to be supplied as a string/string[]")}}var K8=q({"src/lib/tasks/commit.ts"(){X8(),fe(),st()}});function Q8(t,e){let n=["hash-object",t];return e&&n.push("-w"),Gt(n,!0)}var J8=q({"src/lib/tasks/hash-object.ts"(){st()}});function e4(t,e,n){let r=String(n).trim(),i;if(i=cv.exec(r))return new rl(t,e,!1,i[1]);if(i=uv.exec(r))return new rl(t,e,!0,i[1]);let a="",s=r.split(" ");for(;s.length;)if(s.shift()==="in"){a=s.join(" ");break}return new rl(t,e,/^re/i.test(r),a)}var rl,cv,uv,t4=q({"src/lib/responses/InitSummary.ts"(){rl=class{constructor(t,e,n,r){this.bare=t,this.path=e,this.existing=n,this.gitDir=r}},cv=/^Init.+ repository in (.+)$/,uv=/^Rein.+ in (.+)$/}});function n4(t){return t.includes(hd)}function r4(t=!1,e,n){let r=["init",...n];return t&&!n4(r)&&r.splice(1,0,hd),{commands:r,format:"utf-8",parser(i){return e4(r.includes("--bare"),e,i)}}}var hd,i4=q({"src/lib/tasks/init.ts"(){t4(),hd="--bare"}});function pd(t){for(let e=0;eVt(new fv,e,n,!1)}var Bf,q1,X1,Y1,hv,pv=q({"src/lib/parsers/parse-diff-summary.ts"(){Ss(),s4(),fe(),Bf=[new ue(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,n,r=""])=>{t.files.push({file:e.trim(),changes:je(n),insertions:r.replace(/[^+]/g,"").length,deletions:r.replace(/[^-]/g,"").length,binary:!1})}),new ue(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,n,r])=>{t.files.push({file:e.trim(),before:je(n),after:je(r),binary:!0})}),new ue(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);t.changed=je(e),t.insertions=je(r==null?void 0:r[1]),t.deletions=je(i==null?void 0:i[1])})],q1=[new ue(/(\d+)\t(\d+)\t(.+)$/,(t,[e,n,r])=>{let i=je(e),a=je(n);t.changed++,t.insertions+=i,t.deletions+=a,t.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new ue(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],X1=[new ue(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],Y1=[new ue(/([ACDMRTUXB])([0-9][0-9][0-9])?\t(.[^\t]+)\t?(.*)?$/,(t,[e,n,r,i])=>{t.changed++,t.files.push({file:i!=null?i:r,changes:0,status:e,insertions:0,deletions:0,binary:!1})})],hv={"":Bf,"--stat":Bf,"--numstat":q1,"--name-status":Y1,"--name-only":X1}}});function o4(t,e){return e.reduce((n,r,i)=>(n[r]=t[i]||"",n),Object.create({diff:null}))}function mv(t=vd,e=gv,n=""){let r=dv(n);return function(i){let a=bs(i,!0,gd).map(function(s){let o=s.trim().split(yd),l=o4(o[0].trim().split(t),e);return o.length>1&&o[1].trim()&&(l.diff=r(o[1])),l});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var gd,yd,vd,gv,yv=q({"src/lib/parsers/parse-list-log-summary.ts"(){fe(),pv(),Ss(),gd="\xF2\xF2\xF2\xF2\xF2\xF2 ",yd=" \xF2\xF2",vd=" \xF2 ",gv=["hash","date","message","refs","author_name","author_email"]}}),vv={};qe(vv,{diffSummaryTask:()=>l4,validateLogFormatConfig:()=>pl});function l4(t){let e=pd(t),n=["diff"];return e===""&&(e="--stat",n.push("--stat=4096")),n.push(...t),pl(n)||{commands:n,format:"utf-8",parser:dv(e)}}function pl(t){let e=t.filter(a4);if(e.length>1)return Rt(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return Rt(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var wd=q({"src/lib/tasks/diff.ts"(){Ss(),pv(),st()}});function c4(t,e){let n=[],r=[];return Object.keys(t).forEach(i=>{n.push(i),r.push(String(t[i]))}),[n,r.join(e)]}function u4(t){return Object.keys(t).reduce((e,n)=>(n in Yf||(e[n]=t[n]),e),{})}function wv(t={},e=[]){let n=kn(t.splitter,gt,vd),r=!nd(t.format)&&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"},[i,a]=c4(r,n),s=[],o=[`--pretty=format:${gd}${a}${yd}`,...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?"...":"..";s.push(`${t.from||""}${c}${t.to||""}`)}return gt(t.file)&&s.push("--follow",t.file),ad(u4(t),o),{fields:i,splitter:n,commands:[...o,...s]}}function f4(t,e,n){let r=mv(t,e,pd(n));return{commands:["log",...n],format:"utf-8",parser:r}}function d4(){return{log(...n){let r=at(arguments),i=wv(sd(arguments),kn(arguments[0],_s)),a=e(...n)||pl(i.commands)||t(i);return this._runTask(a,r)}};function t(n){return f4(n.splitter,n.fields,n.commands)}function e(n,r){return gt(n)&>(r)&&Rt("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Yf,bv=q({"src/lib/tasks/log.ts"(){Ss(),yv(),fe(),st(),wd(),Yf=(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))(Yf||{})}}),il,xv,h4=q({"src/lib/responses/MergeSummary.ts"(){il=class{constructor(t,e=null,n){this.reason=t,this.file=e,this.meta=n}toString(){return`${this.file}:${this.reason}`}},xv=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"}}}}),Zf,_v,p4=q({"src/lib/responses/PullSummary.ts"(){Zf=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},_v=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Nf(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 Z1(t){let e=/^\s*(\d+)/.exec(t),n=/delta (\d+)/i.exec(t);return{count:je(e&&e[1]||"0"),delta:je(n&&n[1]||"0")}}var Sv,m4=q({"src/lib/parsers/parse-remote-objects.ts"(){fe(),Sv=[new ur(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Nf(t.remoteMessages);Object.assign(i,{[r]:je(n)})}),new ur(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Nf(t.remoteMessages);Object.assign(i,{[r]:je(n)})}),new ur(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,n,r])=>{let i=Nf(t.remoteMessages);i.total=Z1(e),i.reused=Z1(n),i.packReused=je(r)})]}});function Ev(t,e){return Vt({remoteMessages:new Av},kv,e)}var kv,Av,Tv=q({"src/lib/parsers/parse-remote-messages.ts"(){fe(),m4(),kv=[new ur(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Sv,new ur([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new ur([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,n,r])=>{t.remoteMessages.vulnerabilities={count:je(e),summary:n,url:r}})],Av=class{constructor(){this.all=[]}}}});function g4(t,e){let n=Vt(new _v,Cv,[t,e]);return n.message&&n}var K1,Q1,J1,ey,Cv,ty,bd,Fv=q({"src/lib/parsers/parse-pull.ts"(){p4(),fe(),Tv(),K1=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,Q1=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,J1=/^(create|delete) mode \d+ (.+)/,ey=[new ue(K1,(t,[e,n,r])=>{t.files.push(e),n&&(t.insertions[e]=n.length),r&&(t.deletions[e]=r.length)}),new ue(Q1,(t,[e,,n,,r])=>n!==void 0||r!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+n||0,t.summary.deletions=+r||0,!0):!1),new ue(J1,(t,[e,n])=>{we(t.files,n),we(e==="create"?t.created:t.deleted,n)})],Cv=[new ue(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new ue(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new ue(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,n,r,i])=>{t.branch.local=r,t.hash.local=e,t.branch.remote=i,t.hash.remote=n})],ty=(t,e)=>Vt(new Zf,ey,[t,e]),bd=(t,e)=>Object.assign(new Zf,ty(t,e),Ev(t,e))}}),ny,Mv,ry,y4=q({"src/lib/parsers/parse-merge.ts"(){h4(),fe(),Fv(),ny=[new ue(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new ue(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,n])=>{t.conflicts.push(new il(e,n))}),new ue(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,n,r])=>{t.conflicts.push(new il(e,n,{deleteRef:r}))}),new ue(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new il(e,null))}),new ue(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Mv=(t,e)=>Object.assign(ry(t,e),bd(t,e)),ry=t=>Vt(new xv,ny,t)}});function iy(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,n){let r=Mv(e,n);if(r.failed)throw new ws(r);return r}}:Rt("Git.merge requires at least one option")}var v4=q({"src/lib/tasks/merge.ts"(){Gi(),y4(),st()}});function w4(t,e,n){let r=n.includes("deleted"),i=n.includes("tag")||/^refs\/tags/.test(t),a=!n.includes("new");return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:t,remote:e}}var ay,Ov,sy,b4=q({"src/lib/parsers/parse-push.ts"(){fe(),Tv(),ay=[new ue(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new ue(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref=ms(tn({},t.ref||{}),{local:e})}),new ue(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,n,r])=>{t.pushed.push(w4(e,n,r))}),new ue(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,n,r])=>{t.branch=ms(tn({},t.branch||{}),{local:e,remote:n,remoteName:r})}),new ue(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,n,r,i])=>{t.update={head:{local:e,remote:n},hash:{from:r,to:i}}})],Ov=(t,e)=>{let n=sy(t,e),r=Ev(t,e);return tn(tn({},n),r)},sy=(t,e)=>Vt({pushed:[]},ay,[t,e])}}),Iv={};qe(Iv,{pushTagsTask:()=>x4,pushTask:()=>xd});function x4(t={},e){return we(e,"--tags"),xd(t,e)}function xd(t={},e){let n=["push",...e];return t.branch&&n.splice(1,0,t.branch),t.remote&&n.splice(1,0,t.remote),ul(n,"-v"),we(n,"--verbose"),we(n,"--porcelain"),{commands:n,format:"utf-8",parser:Ov}}var Pv=q({"src/lib/tasks/push.ts"(){b4(),fe()}}),oy,Rv,_4=q({"src/lib/responses/FileStatusSummary.ts"(){oy=/^(.+) -> (.+)$/,Rv=class{constructor(t,e,n){if(this.path=t,this.index=e,this.working_dir=n,e+n==="R"){let r=oy.exec(t)||[null,t,t];this.from=r[1]||"",this.path=r[2]||""}}}}});function ly(t){let[e,n]=t.split(zi);return{from:n||e,to:e}}function zt(t,e,n){return[`${t}${e}`,n]}function $f(t,...e){return e.map(n=>zt(t,n,(r,i)=>we(r.conflicted,i)))}function S4(t,e){let n=e.trim();switch(" "){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.substr(3));case n.charAt(1):return r(" ",n.charAt(0),n.substr(2));default:return}function r(i,a,s){let o=`${i}${a}`,l=Lv.get(o);l&&l(t,s),o!=="##"&&o!=="!!"&&t.files.push(new Rv(s.replace(/\0.+$/,""),i,a))}}var cy,Lv,jv,E4=q({"src/lib/responses/StatusSummary.ts"(){fe(),_4(),cy=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}},Lv=new Map([zt(" ","A",(t,e)=>we(t.created,e)),zt(" ","D",(t,e)=>we(t.deleted,e)),zt(" ","M",(t,e)=>we(t.modified,e)),zt("A"," ",(t,e)=>we(t.created,e)&&we(t.staged,e)),zt("A","M",(t,e)=>we(t.created,e)&&we(t.staged,e)&&we(t.modified,e)),zt("D"," ",(t,e)=>we(t.deleted,e)&&we(t.staged,e)),zt("M"," ",(t,e)=>we(t.modified,e)&&we(t.staged,e)),zt("M","M",(t,e)=>we(t.modified,e)&&we(t.staged,e)),zt("R"," ",(t,e)=>{we(t.renamed,ly(e))}),zt("R","M",(t,e)=>{let n=ly(e);we(t.renamed,n),we(t.modified,n.to)}),zt("!","!",(t,e)=>{we(t.ignored=t.ignored||[],e)}),zt("?","?",(t,e)=>we(t.not_added,e)),...$f("A","A","U"),...$f("D","D","U"),...$f("U","A","D","U"),["##",(t,e)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,s=/\son\s([\S]+)$/,o;o=n.exec(e),t.ahead=o&&+o[1]||0,o=r.exec(e),t.behind=o&&+o[1]||0,o=i.exec(e),t.current=o&&o[1],o=a.exec(e),t.tracking=o&&o[1],o=s.exec(e),t.current=o&&o[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),jv=function(t){let e=t.split(zi),n=new cy;for(let r=0,i=e.length;r!Dv.includes(n))],parser(n){return jv(n)}}}var Dv,A4=q({"src/lib/tasks/status.ts"(){E4(),Dv=["--null","-z"]}});function ol(t=0,e=0,n=0,r="",i=!0){return Object.defineProperty({major:t,minor:e,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function T4(){return ol(0,0,0,"",!1)}function C4(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:F4,onError(t,e,n,r){if(t.exitCode===-2)return n(Buffer.from(_d));r(e)}})}}}function F4(t){return t===_d?T4():Vt(ol(0,0,0,t),Bv,t)}var _d,Bv,M4=q({"src/lib/tasks/version.ts"(){fe(),_d="installed=false",Bv=[new ue(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,n,r,i=""])=>{Object.assign(t,ol(je(e),je(n),je(r),i))}),new ue(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,n,r,i=""])=>{Object.assign(t,ol(je(e),je(n),r,i))})]}}),Nv={};qe(Nv,{SimpleGitApi:()=>Kf});var Kf,O4=q({"src/lib/simple-git-api.ts"(){z8(),G8(),W8(),K8(),Zy(),Jy(),J8(),i4(),bv(),v4(),Pv(),A4(),st(),M4(),fe(),Kf=class{constructor(t){this._executor=t}_runTask(t,e){let n=this._executor.chain(),r=n.push(t);return e&&H8(t,r,e),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(t){return this._runTask(Gt(["add",...fr(t)]),at(arguments))}cwd(t){let e=at(arguments);return typeof t=="string"?this._runTask(W1(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(W1(t.path,t.root&&this._executor||void 0),e):this._runTask(Rt("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Q8(t,e===!0),at(arguments))}init(t){return this._runTask(r4(t===!0,this._executor.cwd,en(arguments)),at(arguments))}merge(){return this._runTask(iy(en(arguments)),at(arguments))}mergeFromTo(t,e){return gt(t)&>(e)?this._runTask(iy([t,e,...en(arguments)]),at(arguments,!1)):this._runTask(Rt("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=xd({remote:kn(arguments[0],gt),branch:kn(arguments[1],gt)},en(arguments));return this._runTask(t,at(arguments))}stash(){return this._runTask(Gt(["stash",...en(arguments)]),at(arguments))}status(){return this._runTask(k4(en(arguments)),at(arguments))}},Object.assign(Kf.prototype,V8(),Z8(),F8(),I8(),d4(),C4())}}),$v={};qe($v,{Scheduler:()=>Uv});var uy,Uv,I4=q({"src/lib/runners/scheduler.ts"(){fe(),iv(),uy=(()=>{let t=0;return()=>{t++;let{promise:e,done:n}=(0,Hv.createDeferred)();return{promise:e,done:n,id:t}}})(),Uv=class{constructor(t=2){this.concurrency=t,this.logger=dd("","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=we(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),ul(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=we(this.pending,uy());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),zv={};qe(zv,{applyPatchTask:()=>P4});function P4(t,e){return Gt(["apply",...e,...t])}var R4=q({"src/lib/tasks/apply-patch.ts"(){st()}});function L4(t,e){return{branch:t,hash:e,success:!0}}function j4(t){return{branch:t,hash:null,success:!1}}var Gv,D4=q({"src/lib/responses/BranchDeleteSummary.ts"(){Gv=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Vv(t,e){return e===1&&Qf.test(t)}var fy,Qf,dy,ml,B4=q({"src/lib/parsers/parse-branch-delete.ts"(){D4(),fe(),fy=/(\S+)\s+\(\S+\s([^)]+)\)/,Qf=/^error[^']+'([^']+)'/m,dy=[new ue(fy,(t,[e,n])=>{let r=L4(e,n);t.all.push(r),t.branches[e]=r}),new ue(Qf,(t,[e])=>{let n=j4(e);t.errors.push(n),t.all.push(n),t.branches[e]=n})],ml=(t,e)=>Vt(new Gv,dy,[t,e])}}),Wv,N4=q({"src/lib/responses/BranchSummary.ts"(){Wv=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,n,r,i){t==="*"&&(this.detached=e,this.current=n),this.all.push(n),this.branches[n]={current:t==="*",linkedWorkTree:t==="+",name:n,commit:r,label:i}}}}});function hy(t){return t?t.charAt(0):""}function qv(t){return Vt(new Wv,Xv,t)}var Xv,$4=q({"src/lib/parsers/parse-branch.ts"(){N4(),fe(),Xv=[new ue(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,n,r,i])=>{t.push(hy(e),!0,n,r,i)}),new ue(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,n,r,i])=>{t.push(hy(e),!1,n,r,i)})]}}),Yv={};qe(Yv,{branchLocalTask:()=>U4,branchTask:()=>H4,containsDeleteBranchCommand:()=>Zv,deleteBranchTask:()=>G4,deleteBranchesTask:()=>z4});function Zv(t){let e=["-d","-D","--delete"];return t.some(n=>e.includes(n))}function H4(t){let e=Zv(t),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(r,i){return e?ml(r,i).all[0]:qv(r)}}}function U4(){return{format:"utf-8",commands:["branch","-v"],parser:qv}}function z4(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(n,r){return ml(n,r)},onError({exitCode:n,stdOut:r},i,a,s){if(!Vv(String(i),n))return s(i);a(r)}}}function G4(t,e=!1){let n={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(r,i){return ml(r,i).branches[t]},onError({exitCode:r,stdErr:i,stdOut:a},s,o,l){if(!Vv(String(s),r))return l(s);throw new ws(n.parser(ys(a),ys(i)),String(s))}};return n}var V4=q({"src/lib/tasks/branch.ts"(){Gi(),B4(),$4(),fe()}}),Kv,W4=q({"src/lib/responses/CheckIgnore.ts"(){Kv=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),Qv={};qe(Qv,{checkIgnoreTask:()=>q4});function q4(t){return{commands:["check-ignore",...t],format:"utf-8",parser:Kv}}var X4=q({"src/lib/tasks/check-ignore.ts"(){W4()}}),Jv={};qe(Jv,{cloneMirrorTask:()=>Z4,cloneTask:()=>e2});function Y4(t){return/^--upload-pack(=|$)/.test(t)}function e2(t,e,n){let r=["clone",...n];return gt(t)&&r.push(t),gt(e)&&r.push(e),r.find(Y4)?Rt("git.fetch: potential exploit argument blocked."):Gt(r)}function Z4(t,e,n){return we(n,"--mirror"),e2(t,e,n)}var K4=q({"src/lib/tasks/clone.ts"(){st(),fe()}});function Q4(t,e){return Vt({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},t2,[t,e])}var t2,J4=q({"src/lib/parsers/parse-fetch.ts"(){fe(),t2=[new ue(/From (.+)$/,(t,[e])=>{t.remote=e}),new ue(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.branches.push({name:e,tracking:n})}),new ue(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.tags.push({name:e,tracking:n})}),new ue(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new ue(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,n,r,i])=>{t.updated.push({name:r,tracking:i,to:n,from:e})})]}}),n2={};qe(n2,{fetchTask:()=>tF});function eF(t){return/^--upload-pack(=|$)/.test(t)}function tF(t,e,n){let r=["fetch",...n];return t&&e&&r.push(t,e),r.find(eF)?Rt("git.fetch: potential exploit argument blocked."):{commands:r,format:"utf-8",parser:Q4}}var nF=q({"src/lib/tasks/fetch.ts"(){J4(),st()}});function rF(t){return Vt({moves:[]},r2,t)}var r2,iF=q({"src/lib/parsers/parse-move.ts"(){fe(),r2=[new ue(/^Renaming (.+) to (.+)$/,(t,[e,n])=>{t.moves.push({from:e,to:n})})]}}),i2={};qe(i2,{moveTask:()=>aF});function aF(t,e){return{commands:["mv","-v",...fr(t),e],format:"utf-8",parser:rF}}var sF=q({"src/lib/tasks/move.ts"(){iF(),fe()}}),a2={};qe(a2,{pullTask:()=>oF});function oF(t,e,n){let r=["pull",...n];return t&&e&&r.splice(1,0,t,e),{commands:r,format:"utf-8",parser(i,a){return bd(i,a)},onError(i,a,s,o){let l=g4(ys(i.stdOut),ys(i.stdErr));if(l)return o(new ws(l));o(a)}}}var lF=q({"src/lib/tasks/pull.ts"(){Gi(),Fv(),fe()}});function cF(t){let e={};return s2(t,([n])=>e[n]={name:n}),Object.values(e)}function uF(t){let e={};return s2(t,([n,r,i])=>{e.hasOwnProperty(n)||(e[n]={name:n,refs:{fetch:"",push:""}}),i&&r&&(e[n].refs[i.replace(/[^a-z]/g,"")]=r)}),Object.values(e)}function s2(t,e){ed(t,n=>e(n.split(/\s+/)))}var fF=q({"src/lib/responses/GetRemoteSummary.ts"(){fe()}}),o2={};qe(o2,{addRemoteTask:()=>dF,getRemotesTask:()=>hF,listRemotesTask:()=>pF,remoteTask:()=>mF,removeRemoteTask:()=>gF});function dF(t,e,n=[]){return Gt(["remote","add",...n,t,e])}function hF(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?uF:cF}}function pF(t=[]){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),Gt(e)}function mF(t=[]){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),Gt(e)}function gF(t){return Gt(["remote","remove",t])}var yF=q({"src/lib/tasks/remote.ts"(){fF(),st()}}),l2={};qe(l2,{stashListTask:()=>vF});function vF(t={},e){let n=wv(t),r=["stash","list",...n.commands,...e],i=mv(n.splitter,n.fields,pd(r));return pl(r)||{commands:r,format:"utf-8",parser:i}}var wF=q({"src/lib/tasks/stash-list.ts"(){Ss(),yv(),wd(),bv()}}),c2={};qe(c2,{addSubModuleTask:()=>bF,initSubModuleTask:()=>xF,subModuleTask:()=>gl,updateSubModuleTask:()=>_F});function bF(t,e){return gl(["add",t,e])}function xF(t){return gl(["init",...t])}function gl(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),Gt(e)}function _F(t){return gl(["update",...t])}var SF=q({"src/lib/tasks/sub-module.ts"(){st()}});function EF(t,e){let n=isNaN(t),r=isNaN(e);return n!==r?n?1:-1:n?u2(t,e):0}function u2(t,e){return t===e?0:t>e?1:-1}function kF(t){return t.trim()}function el(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var py,f2,AF=q({"src/lib/responses/TagList.ts"(){py=class{constructor(t,e){this.all=t,this.latest=e}},f2=function(t,e=!1){let n=t.split(` +`).map(kF).filter(Boolean);e||n.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return EF(el(s[0]),el(o[0]));for(let l=0,c=Math.max(s.length,o.length);li.indexOf(".")>=0);return new py(n,r)}}}),d2={};qe(d2,{addAnnotatedTagTask:()=>FF,addTagTask:()=>CF,tagListTask:()=>TF});function TF(t=[]){let e=t.some(n=>/^--sort=/.test(n));return{format:"utf-8",commands:["tag","-l",...t],parser(n){return f2(n,e)}}}function CF(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function FF(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var MF=q({"src/lib/tasks/tag.ts"(){AF()}}),OF=n8({"src/git.js"(t,e){var{GitExecutor:n}=($8(),Ue(sv)),{SimpleGitApi:r}=(O4(),Ue(Nv)),{Scheduler:i}=(I4(),Ue($v)),{configurationErrorTask:a}=(st(),Ue(Vf)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:p}=(fe(),Ue(Py)),{applyPatchTask:m}=(R4(),Ue(zv)),{branchTask:g,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:x}=(V4(),Ue(Yv)),{checkIgnoreTask:E}=(X4(),Ue(Qv)),{checkIsRepoTask:_}=(Dy(),Ue(Ry)),{cloneTask:T,cloneMirrorTask:y}=(K4(),Ue(Jv)),{cleanWithOptionsTask:S,isCleanOptionsArray:k}=(qy(),Ue(Vy)),{diffSummaryTask:C}=(wd(),Ue(vv)),{fetchTask:M}=(nF(),Ue(n2)),{moveTask:P}=(sF(),Ue(i2)),{pullTask:$}=(lF(),Ue(a2)),{pushTagsTask:j}=(Pv(),Ue(Iv)),{addRemoteTask:Q,getRemotesTask:le,listRemotesTask:de,remoteTask:re,removeRemoteTask:Ae}=(yF(),Ue(o2)),{getResetMode:he,resetTask:H}=(rv(),Ue(ev)),{stashListTask:U}=(wF(),Ue(l2)),{addSubModuleTask:D,initSubModuleTask:se,subModuleTask:_e,updateSubModuleTask:mt}=(SF(),Ue(c2)),{addAnnotatedTagTask:X,addTagTask:Te,tagListTask:Be}=(MF(),Ue(d2)),{straightThroughBufferTask:Je,straightThroughStringTask:Re}=(st(),Ue(Vf));function V(N,Y){this._executor=new n(N.binary,N.baseDir,new i(N.maxConcurrentProcesses),Y),this._trimmed=N.trimmed}(V.prototype=Object.create(r.prototype)).constructor=V,V.prototype.customBinary=function(N){return this._executor.binary=N,this},V.prototype.env=function(N,Y){return arguments.length===1&&typeof N=="object"?this._executor.env=N:(this._executor.env=this._executor.env||{})[N]=Y,this},V.prototype.stashList=function(N){return this._runTask(U(p(arguments)||{},o(N)&&N||[]),h(arguments))};function et(N,Y,ye,Ge){return typeof ye!="string"?a(`git.${N}() requires a string 'repoPath'`):Y(ye,f(Ge,c),d(arguments))}V.prototype.clone=function(){return this._runTask(et("clone",T,...arguments),h(arguments))},V.prototype.mirror=function(){return this._runTask(et("mirror",y,...arguments),h(arguments))},V.prototype.mv=function(N,Y){return this._runTask(P(N,Y),h(arguments))},V.prototype.checkoutLatestTag=function(N){var Y=this;return this.pull(function(){Y.tags(function(ye,Ge){Y.checkout(Ge.latest,N)})})},V.prototype.pull=function(N,Y,ye,Ge){return this._runTask($(f(N,c),f(Y,c),d(arguments)),h(arguments))},V.prototype.fetch=function(N,Y){return this._runTask(M(f(N,c),f(Y,c),d(arguments)),h(arguments))},V.prototype.silent=function(N){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},V.prototype.tags=function(N,Y){return this._runTask(Be(d(arguments)),h(arguments))},V.prototype.rebase=function(){return this._runTask(Re(["rebase",...d(arguments)]),h(arguments))},V.prototype.reset=function(N){return this._runTask(H(he(N),d(arguments)),h(arguments))},V.prototype.revert=function(N){let Y=h(arguments);return typeof N!="string"?this._runTask(a("Commit must be a string"),Y):this._runTask(Re(["revert",...d(arguments,0,!0),N]),Y)},V.prototype.addTag=function(N){let Y=typeof N=="string"?Te(N):a("Git.addTag requires a tag name");return this._runTask(Y,h(arguments))},V.prototype.addAnnotatedTag=function(N,Y){return this._runTask(X(N,Y),h(arguments))},V.prototype.deleteLocalBranch=function(N,Y,ye){return this._runTask(x(N,typeof Y=="boolean"?Y:!1),h(arguments))},V.prototype.deleteLocalBranches=function(N,Y,ye){return this._runTask(b(N,typeof Y=="boolean"?Y:!1),h(arguments))},V.prototype.branch=function(N,Y){return this._runTask(g(d(arguments)),h(arguments))},V.prototype.branchLocal=function(N){return this._runTask(w(),h(arguments))},V.prototype.raw=function(N){let Y=!Array.isArray(N),ye=[].slice.call(Y?arguments:N,0);for(let _t=0;_tt.removeEventListener("abort",a))}}]:void 0}function RF(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function LF(t,e){if(RF(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new Wr(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function jF(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new Wr(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&/^\s*-u\b/.test(t))throw new Wr(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new Wr(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function DF({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(n,r){return n.forEach((i,a)=>{let s=aHf(i))).then(s.done)}return{type:"spawn.after",action(i,a){return ps(this,arguments,function*(s,{spawned:o,close:l}){var c,u;let f=n(),d=!0,h=()=>void(d=!1);(c=o.stdout)==null||c.on("data",h),(u=o.stderr)==null||u.on("data",h),o.on("error",h),o.on("close",p=>f.close(p)),o.on("exit",p=>f.exit(p));try{yield f.result,d&&(yield Hf(50)),l(f.exitCode)}catch(p){l(f.exitCode,p)}})}}}dr();function $F(t){return!!(t.exitCode&&t.stdErr.length)}function HF(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function UF(t=!1,e=$F,n=HF){return(r,i)=>!t&&r||!e(i)?r:n(i)}function gy(t){return{type:"task.error",action(e,n){let r=t(e.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new Un(void 0,r.toString("utf-8"))}:{error:r}}}}fe();var zF=class{constructor(){this.plugins=new Set}add(t){let e=[];return fr(t).forEach(n=>n&&this.plugins.add(we(e,n))),()=>{e.forEach(n=>this.plugins.delete(n))}}exec(t,e,n){let r=e,i=Object.freeze(Object.create(n));for(let a of this.plugins)a.type===t&&(r=a.action(r,i));return r}};fe();function GF(t){let e="--progress",n=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,s){return n.includes(s.method)?ky(a,e):a}},{type:"spawn.after",action(a,s){var o;s.commands.includes(e)&&((o=s.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:s.method,stage:VF(c[1]),progress:je(c[2]),processed:je(c[3]),total:je(c[4])})}))}}]}function VF(t){return String(t.toLowerCase().split(" ",1))||"unknown"}fe();function WF(t){let e=Ty(t,["uid","gid"]);return{type:"spawn.options",action(n){return tn(tn({},e),n)}}}function qF({block:t,stdErr:e=!0,stdOut:n=!0}){if(t>0)return{type:"spawn.after",action(r,i){var a,s;let o;function l(){o&&clearTimeout(o),o=setTimeout(u,t)}function c(){var f,d;(f=i.spawned.stdout)==null||f.off("data",l),(d=i.spawned.stderr)==null||d.off("data",l),i.spawned.off("exit",c),i.spawned.off("close",c),o&&clearTimeout(o)}function u(){c(),i.kill(new Wr(void 0,"timeout","block timeout reached"))}n&&((a=i.spawned.stdout)==null||a.on("data",l)),e&&((s=i.spawned.stderr)==null||s.on("data",l)),i.spawned.on("exit",c),i.spawned.on("close",c),l()}}}fe();var XF=OF();function YF(t,e){let n=new zF,r=Oy(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!td(r.baseDir))throw new IF(r,"Cannot use simple-git on a directory that does not exist");return Array.isArray(r.config)&&n.add(BF(r.config)),n.add(DF(r.unsafe)),n.add(NF(r.completion)),r.abort&&n.add(PF(r.abort)),r.progress&&n.add(GF(r.progress)),r.timeout&&n.add(qF(r.timeout)),r.spawnOptions&&n.add(WF(r.spawnOptions)),n.add(gy(UF(!0))),r.errors&&n.add(gy(r.errors)),new XF(r,n)}Gi();var h2=YF;v();var p2=require("obsidian"),yl="YYYY-MM-DD",Sd=`${yl} HH:mm`,Ed=`${yl} HH:mm:ss`,vl=40,Vi="conflict-files-obsidian-git.md",An={commitMessage:"vault backup: {{date}}",commitDateFormat:Ed,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:p2.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:Sd,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,gutterSpacingFallbackLength:5}},ht={type:"git-view",name:"Source Control",icon:"git-pull-request"},fn={type:"git-history-view",name:"History",icon:"history"},Tt={type:"diff-view",name:"Diff View",icon:"git-pull-request"};v();function m2(t,e){let n=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:n})}v();var K_=Ve(P2()),Q_=Ve(Z_()),na=require("obsidian"),Vh=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function qt(t){let e;if(t){if(t.button===0||t.button===1){let n=na.Keymap.isModEvent(t);e=app.workspace.getLeaf(n)}}else e=app.workspace.getLeaf(!1);return e}function Fn(t,e,n,r,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(n);if(a!=null){let s=new na.Menu;t.workspace.trigger("file-menu",s,a,i,r),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function vr(t){throw new Error("Impossible branch: "+t)}function Wh(t){return`rgb(${t.r},${t.g},${t.b})`}function J_(t){var a;let e=(a=K_.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[n,r,i]=e;return{r:n,g:r,b:i}}function eS(t){return t.diff(na.moment.unix(0),"seconds")}function tS(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function nS(t,e){return(0,Q_.default)(t,e,{strict:!0})}function rS(t,e,n){return t.length<=e?new Array(e-t.length).fill(n).join("")+t:t.substring(t.length-e)}function iS(t,e){if(e<=0)return t;let n=new Array(e).fill(" ").join(""),r=t.substring(e,t.length);return n+r}function qh(t,e,n){return t<=e&&e<=n}function wr(t){let[e,...n]=t.split("/");return[e,n.length===0?void 0:n.join("/")]}function Lt(t){return t.endsWith("/")?t:t.split("/").last().replace(".md","")}function js(t){return t===1?"1 minute":`${t} minutes`}v();var ra=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,n=!0){return n&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}_getTreeStructure(e,n=0){let r=[];for(e=[...e];e.length>0;){let i=e.first(),a=i.path.substring(n);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=e.filter(c=>c.path.substring(n).startsWith(s+"/"));o.forEach(c=>e.remove(c));let l=i.path.substring(0,a.indexOf("/")+n);r.push({title:s,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(n>0?n+s.length:s.length)+1)})}else r.push({title:a,data:i,path:i.path,vaultPath:this.getRelativeVaultPath(i.path)}),e.remove(i)}return r}simplify(e){var n,r,i,a;for(let s of e){for(;;){let o=((n=s.children)==null?void 0:n.length)==1,l=((i=(r=s.children)==null?void 0:r.first())==null?void 0:i.data)==null;if(!(s.children!=null&&o&&l))break;let c=s.children.first();s.title+="/"+c.title,s.data=c.data,s.path=c.path,s.vaultPath=c.vaultPath,s.children=c.children}s.children!=null&&this.simplify(s.children),(a=s.children)==null||a.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((s,o)=>{let l=(o.data==null?1:0)-(s.data==null?1:0);return l!=0?l:s.title.localeCompare(o.title)})}getTreeStructure(e){let n=this._getTreeStructure(e);return this.simplify(n)}async formatCommitMessage(e){let n;if(e.includes("{{numFiles}}")){n=await this.status();let i=n.staged.length;e=e.replace("{{numFiles}}",String(i))}if(e.includes("{{hostname}}")){let i=this.plugin.localStorage.getHostname()||"";e=e.replace("{{hostname}}",i)}if(e.includes("{{files}}")){n=n!=null?n:await this.status();let i={},a="";if(n.staged.length<100){n.staged.forEach(o=>{o.index in i?i[o.index].push(o.path):i[o.index]=[o.path]});let s=[];for(let[o,l]of Object.entries(i))s.push(o+" "+l.join(" "));a=s.join(", ")}else a="Too many files to list";e=e.replace("{{files}}",a)}let r=window.moment;if(e=e.replace("{{date}}",r().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let i=n!=null?n:await this.status(),a="";i.staged.length<100?a=i.staged.map(s=>s.path).join(` +`):a="Too many files to list",e=e+` + +Affected files: +`+a}return e}};var Oe=class extends ra{constructor(e){super(e)}async setGitInstance(e=!1){if(this.isGitInstalled()){let n=this.app.vault.adapter,r=n.getBasePath(),i=r;this.plugin.settings.basePath&&(await n.exists((0,Qr.normalizePath)(this.plugin.settings.basePath))?i=vt.join(r,this.plugin.settings.basePath):e||new Qr.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=i,this.git=h2({baseDir:i,binary:this.plugin.localStorage.getGitPath()||void 0,config:["core.quotepath=off"]});let a=this.plugin.localStorage.getPATHPaths(),s=this.plugin.localStorage.getEnvVars(),o=this.plugin.settings.gitDir;if(a.length>0){let l=process.env.PATH+":"+a.join(":");process.env.PATH=l}o&&(process.env.GIT_DIR=o);for(let l of s){let[c,u]=l.split("=");process.env[c]=u}if(lS.default.enable("simple-git"),await this.git.checkIsRepo()){let l=await this.git.revparse("--show-cdup"),c=(0,Ds.resolve)(i+Ds.sep+l);this.absoluteRepoPath=c,await this.git.cwd(c)}}}getRelativeVaultPath(e){let r=this.app.vault.adapter.getBasePath(),i=vt.join(this.absoluteRepoPath,e),a=vt.relative(r,i);return Qr.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(e,n=!0){if(n){let i=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,s=vt.join(i,e),o=vt.relative(a,s);return Qr.Platform.isWin&&(o=o.replace(/\\/g,"/")),o}return e}async status(){this.plugin.setState(1);let e=await this.git.status(r=>this.onError(r));this.plugin.setState(0);let n=e.files.map(r=>{let i=this.formatPath(r);return{path:i.path,from:i.from,index:r.index==="?"?"U":r.index,working_dir:r.working_dir==="?"?"U":r.working_dir,vault_path:this.getRelativeVaultPath(i.path)}});return{all:n,changed:n.filter(r=>r.working_dir!==" "),staged:n.filter(r=>r.index!==" "&&r.index!="U"),conflicted:e.conflicted.map(r=>this.formatPath({path:r}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(e){let n=this.getRelativeRepoPath(e),i=["-C",vt.dirname(n),"rev-parse","HEAD"],a=this.git.raw(i);return a.catch(s=>console.warn("obsidian-git: rev-parse error:",s)),a}async getSubmodulePaths(){return new Promise(async e=>{this.git.outputHandler(async(n,r,i,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let s="",o=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");r.on("data",l=>{s+=l.toString("utf8")}),r.on("end",async()=>{let c=s.split(` +`).map(u=>{let f=u.match(/'([^']*)'/);if(f!=null)return o+"/"+f[1]+Ds.sep}).filter(u=>!!u);c.reverse(),e(c)})}),await this.git.subModule(["foreach","--recursive",""]),this.git.outputHandler(()=>{})})}formatPath(e,n=!1){function r(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return n?{from:r(e.from),path:r(e.path)}:{path:r(e.path)}}async blame(e,n,r){if(e=this.getRelativeRepoPath(e),!await this.isTracked(e))return"untracked";let i=await this.getSubmoduleOfFile(e),a=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:e;a.push("blame","--porcelain"),r&&a.push("-w");let o=`-C${vl}`;switch(n){case"inactive":break;case"same-commit":a.push("-C",o);break;case"all-commits":a.push("-C","-C",o);break;default:vr(n)}a.push("--",s);let l=await this.git.raw(a,c=>c&&console.warn("git-blame",c));return KP(l)}async isTracked(e){let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("ls-files","--",i),this.git.raw(r,a=>a&&console.warn("ls-files",a)).then(a=>a.trim()!=="")}async commitAll({message:e}){if(this.plugin.settings.updateSubmodules){this.plugin.setState(4);let r=await this.getSubmodulePaths();for(let i of r)await this.git.cwd({path:i,root:!1}).add("-A",a=>this.onError(a)),await this.git.cwd({path:i,root:!1}).commit(await this.formatCommitMessage(e),a=>this.onError(a))}this.plugin.setState(3),await this.git.add("-A",r=>this.onError(r)),this.plugin.setState(4);let n=await this.git.commit(await this.formatCommitMessage(e),r=>this.onError(r));return dispatchEvent(new CustomEvent("git-head-update")),n.summary.changes}async commit({message:e,amend:n}){this.plugin.setState(4);let r=(await this.git.commit(await this.formatCommitMessage(e),n?["--amend"]:[],i=>this.onError(i))).summary.changes;return dispatchEvent(new CustomEvent("git-head-update")),this.plugin.setState(0),r}async stage(e,n){this.plugin.setState(3),e=this.getRelativeRepoPath(e,n),await this.git.add(["--",e],r=>this.onError(r)),this.plugin.setState(0)}async stageAll({dir:e}){this.plugin.setState(3),await this.git.add(e!=null?e:"-A",n=>this.onError(n)),this.plugin.setState(0)}async unstageAll({dir:e}){this.plugin.setState(3),await this.git.reset(e!=null?["--",e]:[],n=>this.onError(n)),this.plugin.setState(0)}async unstage(e,n){this.plugin.setState(3),e=this.getRelativeRepoPath(e,n),await this.git.reset(["--",e],r=>this.onError(r)),this.plugin.setState(0)}async discard(e){this.plugin.setState(3),await this.isTracked(e)?await this.git.checkout(["--",e],n=>this.onError(n)):await this.app.vault.adapter.rmdir(this.getRelativeVaultPath(e),!0),this.plugin.setState(0)}async hashObject(e){e=this.getRelativeRepoPath(e);let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;r.push("hash-object","--",i);let a=this.git.raw(r);return a.catch(s=>s&&console.warn("obsidian-git. hash-object failed:",s==null?void 0:s.message)),a}async discardAll({dir:e}){return this.discard(e!=null?e:".")}async pull(){this.plugin.setState(2),this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"],i=>this.onError(i));let e=await this.branchInfo(),n=await this.git.revparse([e.current],i=>this.onError(i));if(!e.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(i=>this.onError(i));let r=await this.git.revparse([e.tracking],i=>this.onError(i));if(n!==r){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{switch(this.plugin.settings.syncMethod){case"merge":await this.git.merge([e.tracking]);break;case"rebase":await this.git.rebase([e.tracking])}}catch(s){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${s.message}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${e.current}`,r],s=>this.onError(s)),await this.unstageAll({})}catch(s){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${s.message}`)}dispatchEvent(new CustomEvent("git-head-update"));let i=await this.git.revparse([e.current],s=>this.onError(s));return(await this.git.diff([`${n}..${i}`,"--name-only"])).split(/\r\n|\r|\n/).filter(s=>s.length>0).map(s=>({path:s,working_dir:"P",vault_path:this.getRelativeVaultPath(s)}))}else return[]}async push(){if(this.plugin.setState(5),this.plugin.settings.updateSubmodules){let a=await this.git.env({...process.env,OBSIDIAN_GIT:1}).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`],s=>this.onError(s));console.log(a)}let e=await this.git.status(),n=e.tracking,r=e.current;if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let i=(await this.git.diffSummary([r,n,"--"],a=>this.onError(a))).changed;return await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(a=>this.onError(a)),i}async getUnpushedCommits(){let e=await this.git.status(),n=e.tracking,r=e.current;return n==null||r==null?0:(await this.git.diffSummary([r,n,"--"],a=>this.onError(a))).changed}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let e=await this.git.status(a=>this.onError(a)),n=e.tracking,r=e.current;return n?(await this.git.diffSummary([r,n,"--"])).changed!==0:!1}async checkRequirements(){return this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let e=await this.git.status(r=>this.onError(r)),n=await this.git.branch(["--no-color"],r=>this.onError(r));return{current:e.current||void 0,tracking:e.tracking||void 0,branches:n.all}}async getRemoteUrl(e){try{return await this.git.remote(["get-url",e])||void 0}catch(n){if(n.toString().contains(e))return;this.onError(n)}}async log(e,n=!0,r){let i;return e&&(i=this.getRelativeRepoPath(e,n)),(await this.git.log({file:i,maxCount:r,"-m":null,"--name-status":null},s=>this.onError(s))).all.map(s=>{var o,l,c,u;return{...s,author:{name:s.author_name,email:s.author_email},refs:s.refs.split(", ").filter(f=>f.length>0),diff:{...s.diff,files:(l=(o=s.diff)==null?void 0:o.files.map(f=>({...f,status:f.status,path:f.file,hash:s.hash,vault_path:this.getRelativeVaultPath(f.file)})))!=null?l:[]},fileName:(u=(c=s.diff)==null?void 0:c.files.first())==null?void 0:u.file}})}async show(e,n,r=!0){let i=this.getRelativeRepoPath(n,r);return this.git.show([e+":"+i],a=>this.onError(a))}async checkout(e,n){if(n&&(e=`${n}/${e}`),await this.git.checkout(e,r=>this.onError(r)),this.plugin.settings.submoduleRecurseCheckout){let r=await this.getSubmodulePaths();for(let i of r){let a=await this.git.cwd({path:i,root:!1}).branch();Object.keys(a.branches).includes(e)&&await this.git.cwd({path:i,root:!1}).checkout(e,s=>this.onError(s))}}}async createBranch(e){await this.git.checkout(["-b",e],n=>this.onError(n))}async deleteBranch(e,n){await this.git.branch([n?"-D":"-d",e],r=>this.onError(r))}async branchIsMerged(e){return!(await this.git.branch(["--no-merged"],r=>this.onError(r))).all.contains(e)}async init(){await this.git.init(!1,e=>this.onError(e))}async clone(e,n,r){await this.git.clone(e,vt.join(this.app.vault.adapter.getBasePath(),n),r?["--depth",`${r}`]:[],i=>this.onError(i))}async setConfig(e,n){n==null?await this.git.raw(["config","--local","--unset",e]):await this.git.addConfig(e,n,r=>this.onError(r))}async getConfig(e){return(await this.git.listConfig("local",r=>this.onError(r))).all[e]}async fetch(e){await this.git.fetch(e!=null?[e]:[],n=>this.onError(n))}async setRemote(e,n){(await this.getRemotes()).includes(e)?await this.git.remote(["set-url",e,n],r=>this.onError(r)):await this.git.remote(["add",e,n],r=>this.onError(r))}async getRemoteBranches(e){let n=await this.git.branch(["-r","--list",`${e}*`],i=>this.onError(i)),r=[];for(let i in n.branches)r.push(n.branches[i].name);return r}async getRemotes(){let e=await this.git.remote([],n=>this.onError(n));return e?e.trim().split(` +`):[]}async removeRemote(e){await this.git.removeRemote(e)}async updateUpstreamBranch(e){try{await this.git.branch(["--set-upstream-to",e])}catch(n){console.error(n);try{await this.git.branch(["--set-upstream",e])}catch(r){console.error(r),await this.git.push(["--set-upstream",...wr(e)],i=>this.onError(i))}}}updateGitPath(e){this.setGitInstance()}updateBasePath(e){this.setGitInstance(!0)}async getDiffString(e,n=!1,r){return n?await this.git.diff(["--cached","--",e]):r?await this.git.show([`${r}`,"--",e]):await this.git.diff(["--",e])}async diff(e,n,r){return await this.git.diff([`${n}..${r}`,"--",e])}async getSubmoduleOfFile(e){if(!await this.app.vault.adapter.exists(vt.dirname(e)))return;let n=await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-toplevel"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message));if(n=n.trim(),(await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-superproject-working-tree"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(vt.normalize(e)),s=vt.relative(n,a);return{submodule:n,relativeFilepath:s}}async getLastCommitTime(){let e=await this.git.log({n:1},n=>this.onError(n));if(e!=null&&e.latest!=null)return new Date(e.latest.date)}isGitInstalled(){let e=(0,oS.spawnSync)(this.plugin.localStorage.getGitPath()||"git",["--version"],{stdio:"ignore"});return e.error?(console.error(e.error),!1):!0}onError(e){if(e){let n=e.message.contains("Could not resolve host")||e.message.match(/ssh: connect to host .*? port .*?: Operation timed out/)||e.message.match(/ssh: connect to host .*? port .*?: Network is unreachable/);n?this.plugin.offlineMode||this.plugin.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3):(this.plugin.displayError(e.message),this.plugin.setState(0)),n&&(this.plugin.offlineMode=!0,this.plugin.setState(0))}}},cS={hash:"000000",isZeroCommit:!0,summary:""};function KP(t){let n=t.replace(`\r +`,` +`).split(` +`),r={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a=4&&n.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return r}function JP(t,e,n){let r=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[n],s=e.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(r){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=sS(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=sS(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}e.commits.set(a,s)}function eR(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Xh(t.author)&&(t.author=void 0),Xh(t.committer)&&(t.committer=void 0),Xh(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Xh(t){return!t||Object.keys(t).length===0}function aS(t){return t.length>0&&t[0].trim()===t[0]}function sS(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}v();var HS=require("@codemirror/state");v();var bS=require("@codemirror/state"),mc=require("obsidian");v();var Yh=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,n){if(e)return this.ensureInitialized(e),n(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(n=>n.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()}},ia=new Yh;v();var dc=require("@codemirror/state"),mS=Ve(Zh());v();var z=require("obsidian");v();v();function Wn(){}Wn.prototype={diff:function(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={}),this.options=i;var s=this;function o(E){return a?(setTimeout(function(){a(void 0,E)},0),!0):E}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var l=n.length,c=e.length,u=1,f=l+c;i.maxEditLength&&(f=Math.min(f,i.maxEditLength));var d=(r=i.timeout)!==null&&r!==void 0?r:1/0,h=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(p[0],n,e,0);if(p[0].oldPos+1>=c&&m+1>=l)return o([{value:this.join(n),count:n.length}]);var g=-1/0,w=1/0;function b(){for(var E=Math.max(g,-u);E<=Math.min(w,u);E+=2){var _=void 0,T=p[E-1],y=p[E+1];T&&(p[E-1]=void 0);var S=!1;if(y){var k=y.oldPos-E;S=y&&0<=k&&k=c&&m+1>=l)return o(tR(s,_.lastComponent,n,e,s.useLongestToken));p[E]=_,_.oldPos+1>=c&&(w=Math.min(w,E-1)),m+1>=l&&(g=Math.max(g,E+1))}u++}if(a)(function E(){setTimeout(function(){if(u>f||Date.now()>h)return a();b()||E()},0)})();else for(;u<=f&&Date.now()<=h;){var x=b();if(x)return x}},addToPath:function(e,n,r,i){var a=e.lastComponent;return a&&a.added===n&&a.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}},extractCommon:function(e,n,r,i){for(var a=n.length,s=r.length,o=e.oldPos,l=o-i,c=0;l+1m.length?w:m}),f.value=t.join(d)}else f.value=t.join(n.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}var p=a[l-1];return l>1&&typeof p.value=="string"&&(p.added||p.removed)&&t.equals("",p.value)&&(a[l-2].value+=p.value,a.pop()),a}var xN=new Wn;var uS=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,fS=/\S/,dS=new Wn;dS.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!fS.test(t)&&!fS.test(e)};dS.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?l(T.lines.slice(-s.context)):[],u-=d.length,f-=d.length)}(_=d).push.apply(_,Kh(E.map(function(j){return(x.added?"+":"-")+j}))),x.added?p+=E.length:h+=E.length}else{if(u)if(E.length<=s.context*2&&b=o.length-2&&E.length<=s.context){var M=/\n$/.test(n),P=/\n$/.test(r),$=E.length==0&&d.length>C.oldLines;!M&&$&&n.length>0&&d.splice(C.oldLines,0,"\\ No newline at end of file"),(!M&&!$||!P)&&d.push("\\ No newline at end of file")}c.push(C),u=0,f=0,d=[]}h+=E.length,p+=E.length}},g=0;g{this.resolve=e})}selectSuggestion(e,n){if(this.resolve){let r;this.config.allowEmpty&&e===" "?r="":e==="..."?r=void 0:r=e,this.resolve(r)}super.selectSuggestion(e,n)}onClose(){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,n){n.setText(e)}onChooseSuggestion(e,n){}};v();var br=require("obsidian"),cc=class{constructor(e,n){this.plugin=n;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,n){var r;if(this.maybeLog("Read: "+e+JSON.stringify(n)),n=="utf8"||n.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):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)):(r=this.index)!=null?r:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,n){if(this.maybeLog("Write: "+e),typeof n=="string"){let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modify(r,n):this.adapter.write(e,n)}else if(e.endsWith(this.gitDir+"/index"))this.index=n,this.indexmtime=Date.now();else{let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modifyBinary(r,n):this.adapter.writeBinary(e,n)}}async readdir(e){e==="."&&(e="/");let n=await this.adapter.list(e),r=[...n.files,...n.folders],i;return e!=="/"?i=r.map(a=>(0,br.normalizePath)(a.substring(e.length))):i=r,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,n){var r,i;return this.adapter.rmdir(e,(i=(r=n==null?void 0:n.options)==null?void 0:r.recursive)!=null?i:!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.length,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let r=await this.adapter.stat(e);if(r==null)throw{code:"ENOENT"};return this.indexctime=r.ctime,this.indexmtime=r.mtime,{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let n=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),n instanceof br.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:n.stat.ctime,mtimeMs:n.stat.mtime,size:n.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let r=await this.adapter.stat(e);if(r)return{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:r.type==="folder"?"directory":r.type,isFile:()=>r.type==="file",isDirectory:()=>r.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var pn=class extends ra{constructor(n){super(n);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 cc(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var n,r;return{username:(n=this.plugin.localStorage.getUsername())!=null?n:void 0,password:(r=this.plugin.localStorage.getPassword())!=null?r:void 0}},onAuthFailure:async()=>{new Jr.Notice("Authentication failed. Please try with different credentials");let n=await new ze({placeholder:"Specify your username"}).open();if(n){let r=await new ze({placeholder:"Specify your password/personal access token"}).open();if(r)return this.plugin.localStorage.setUsername(n),this.plugin.localStorage.setPassword(r),{username:n,password:r}}return{cancel:!0}},http:{async request({url:n,method:r,headers:i,body:a}){a&&(a=await gR(a),a=a.buffer);let s=await(0,Jr.requestUrl)({url:n,method:r,headers:i,body:a,throw:!1});return{url:n,method:r,headers:s.headers,body:[new Uint8Array(s.arrayBuffer)],statusCode:s.status,statusMessage:s.status.toString()}}}}}async wrapFS(n){try{let r=await n;return await this.fs.saveAndClear(),r}catch(r){throw await this.fs.saveAndClear(),r}}async status(){let n,r=window.setTimeout(function(){n=new Jr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setState(1);let i=(await this.wrapFS(ie.statusMatrix({...this.getRepo()}))).map(l=>this.getFileStatusResult(l)),a=i.filter(l=>l.working_dir!==" "),s=i.filter(l=>l.index!==" "&&l.index!=="U"),o=[];return window.clearTimeout(r),n==null||n.hide(),{all:i,changed:a,staged:s,conflicted:o}}catch(i){throw window.clearTimeout(r),n==null||n.hide(),this.plugin.displayError(i),i}}async commitAll({message:n,status:r,unstagedFiles:i}){try{return await this.checkAuthorInfo(),await this.stageAll({status:r,unstagedFiles:i}),this.commit({message:n})}catch(a){throw this.plugin.displayError(a),a}}async commit({message:n}){try{await this.checkAuthorInfo(),this.plugin.setState(4);let r=await this.formatCommitMessage(n),i=this.plugin.localStorage.getConflict(),a;if(i){let s=await this.branchInfo();a=[s.current,s.tracking]}await this.wrapFS(ie.commit({...this.getRepo(),message:r,parent:a})),this.plugin.localStorage.setConflict(!1);return}catch(r){throw this.plugin.displayError(r),r}}async stage(n,r){let i=this.getRelativeRepoPath(n,r),a;r?a=n:a=this.getRelativeVaultPath(n);try{this.plugin.setState(3),await this.app.vault.adapter.exists(a)?await this.wrapFS(ie.add({...this.getRepo(),filepath:i})):await this.wrapFS(ie.remove({...this.getRepo(),filepath:i}))}catch(s){throw this.plugin.displayError(s),s}}async stageAll({dir:n,status:r,unstagedFiles:i}){try{if(r)await Promise.all(r.changed.map(a=>a.working_dir!=="D"?this.wrapFS(ie.add({...this.getRepo(),filepath:a.path})):ie.remove({...this.getRepo(),filepath:a.path})));else{let a=i!=null?i:await this.getUnstagedFiles(n!=null?n:".");await Promise.all(a.map(({filepath:s,deleted:o})=>o?ie.remove({...this.getRepo(),filepath:s}):this.wrapFS(ie.add({...this.getRepo(),filepath:s}))))}}catch(a){throw this.plugin.displayError(a),a}}async unstage(n,r){try{this.plugin.setState(3),n=this.getRelativeRepoPath(n,r),await this.wrapFS(ie.resetIndex({...this.getRepo(),filepath:n}))}catch(i){throw this.plugin.displayError(i),i}}async unstageAll({dir:n,status:r}){try{let i;r?i=r.staged.map(a=>a.path):i=(await this.getStagedFiles(n!=null?n:".")).map(({filepath:s})=>s),await this.wrapFS(Promise.all(i.map(a=>ie.resetIndex({...this.getRepo(),filepath:a}))))}catch(i){throw this.plugin.displayError(i),i}}async discard(n){try{this.plugin.setState(3),await this.wrapFS(ie.checkout({...this.getRepo(),filepaths:[n],force:!0}))}catch(r){throw this.plugin.displayError(r),r}}async discardAll({dir:n,status:r}){let i=[];r?n!=null?i=r.changed.filter(a=>a.path.startsWith(n)).map(a=>a.path):i=r.changed.map(a=>a.path):i=(await this.getUnstagedFiles(n)).map(({filepath:a})=>a);try{await this.wrapFS(ie.checkout({...this.getRepo(),filepaths:i,force:!0}))}catch(a){throw this.plugin.displayError(a),a}}getProgressText(n,r){let i=`${n} progress:`;return r.phase&&(i=`${i} ${r.phase}:`),r.loaded&&(i=`${i} ${r.loaded}`,r.total&&(i=`${i} of ${r.total}`)),i}resolveRef(n){return this.wrapFS(ie.resolveRef({...this.getRepo(),ref:n}))}async pull(){let n=this.showNotice("Initializing pull");try{this.plugin.setState(2);let r=await this.resolveRef("HEAD");await this.fetch();let i=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(ie.merge({...this.getRepo(),ours:i.current,theirs:i.tracking,abortOnConflict:!1}))).alreadyMerged||await this.wrapFS(ie.checkout({...this.getRepo(),ref:i.current,onProgress:l=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:i.remote})),n==null||n.hide();let s=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(r,s);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,working_dir:"P",index:"P",vault_path:this.getRelativeVaultPath(l.path)}))}catch(r){throw n==null||n.hide(),r instanceof cs.MergeConflictError&&this.plugin.handleConflict(r.data.filepaths.map(i=>this.getRelativeVaultPath(i))),this.plugin.displayError(r),r}}async push(){if(!await this.canPush())return 0;let n=this.showNotice("Initializing push");try{this.plugin.setState(1);let r=await this.branchInfo(),i=r.tracking,a=r.current,s=(await this.getFileChangesCount(a,i)).length;return this.plugin.setState(5),await this.wrapFS(ie.push({...this.getRepo(),onProgress:o=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Pushing",o))}})),n==null||n.hide(),s}catch(r){throw n==null||n.hide(),this.plugin.displayError(r),r}}async getUnpushedCommits(){let n=await this.branchInfo(),r=n.tracking,i=n.current;if(r==null||i==null)return 0;let a=await this.resolveRef(i),s=await this.resolveRef(r);return(await this.getFileChangesCount(a,s)).length}async canPush(){let n=await this.branchInfo(),r=n.tracking,i=n.current,a=await this.resolveRef(i),s=await this.resolveRef(r);return a!=s}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var n,r;try{let i=await ie.currentBranch(this.getRepo())||"",a=await ie.listBranches(this.getRepo()),s=(n=await this.getConfig(`branch.${i}.remote`))!=null?n:"origin",o=(r=await this.getConfig(`branch.${i}.merge`))==null?void 0:r.split("refs/heads")[1],l=o?s+o:void 0;return{current:i,tracking:l,branches:a,remote:s}}catch(i){throw this.plugin.displayError(i),i}}async getCurrentRemote(){var i;let n=await ie.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${n}.remote`))!=null?i:"origin"}async checkout(n,r){try{return this.wrapFS(ie.checkout({...this.getRepo(),ref:n,force:!!r,remote:r}))}catch(i){throw this.plugin.displayError(i),i}}async createBranch(n){try{await this.wrapFS(ie.branch({...this.getRepo(),ref:n,checkout:!0}))}catch(r){throw this.plugin.displayError(r),r}}async deleteBranch(n){try{await this.wrapFS(ie.deleteBranch({...this.getRepo(),ref:n}))}catch(r){throw this.plugin.displayError(r),r}}async branchIsMerged(n){return!0}async init(){try{await this.wrapFS(ie.init(this.getRepo()))}catch(n){throw this.plugin.displayError(n),n}}async clone(n,r,i){let a=this.showNotice("Initializing clone");try{await this.wrapFS(ie.clone({...this.getRepo(),dir:r,url:n,depth:i,onProgress:s=>{a!==void 0&&(a.noticeEl.innerText=this.getProgressText("Cloning",s))}})),a==null||a.hide()}catch(s){throw a==null||a.hide(),this.plugin.displayError(s),s}}async setConfig(n,r){try{return this.wrapFS(ie.setConfig({...this.getRepo(),path:n,value:r}))}catch(i){throw this.plugin.displayError(i),i}}async getConfig(n){try{return this.wrapFS(ie.getConfig({...this.getRepo(),path:n}))}catch(r){throw this.plugin.displayError(r),r}}async fetch(n){let r=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:a=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Fetching",a))},remote:n!=null?n:await this.getCurrentRemote()};await this.wrapFS(ie.fetch(i)),r==null||r.hide()}catch(i){throw this.plugin.displayError(i),r==null||r.hide(),i}}async setRemote(n,r){try{await this.wrapFS(ie.addRemote({...this.getRepo(),remote:n,url:r,force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async getRemoteBranches(n){let r=[];return r.push(...await this.wrapFS(ie.listBranches({...this.getRepo(),remote:n}))),r.remove("HEAD"),r=r.map(i=>`${n}/${i}`),r}async getRemotes(){return(await this.wrapFS(ie.listRemotes({...this.getRepo()}))).map(n=>n.remote)}async removeRemote(n){await this.wrapFS(ie.deleteRemote({...this.getRepo(),remote:n}))}async getRemoteUrl(n){var r;return(r=(await this.wrapFS(ie.listRemotes({...this.getRepo()}))).filter(i=>i.remote==n)[0])==null?void 0:r.url}async log(n,r=!0,i){let a=await this.wrapFS(ie.log({...this.getRepo(),depth:i}));return Promise.all(a.map(async s=>{let o=s.commit.message.split(` + +`);return{message:o[0],author:{name:s.commit.author.name,email:s.commit.author.email},body:o.slice(1).join(` + +`),date:new Date(s.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(s.commit.parent.first(),s.oid)).map(l=>({path:l.path,status:l.type,vault_path:this.getRelativeVaultPath(l.path),hash:s.oid,binary:void 0}))},hash:s.oid,refs:[]}}))}updateBasePath(n){this.getRepo().dir=n}async updateUpstreamBranch(n){let[r,i]=wr(n),a=await this.branchInfo();await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`),await this.setConfig(`branch.${i}.remote`,r)}updateGitPath(n){}async getFileChangesCount(n,r){return this.walkDifference({walkers:[ie.TREE({ref:n}),ie.TREE({ref:r})]})}async walkDifference({walkers:n,dir:r}){return await this.wrapFS(ie.walk({...this.getRepo(),trees:n,map:async function(a,[s,o]){if(!Vh(a,r))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.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(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(n="."){return(await this.walkDifference({walkers:[ie.TREE({ref:"HEAD"}),ie.STAGE()],dir:n})).map(i=>({vault_path:this.getRelativeVaultPath(i.path),filepath:i.path}))}async getUnstagedFiles(n="."){let r,i=window.setTimeout(function(){r=new Jr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(ie.walk({...a,trees:[ie.WORKDIR(),ie.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await ie.isIgnored({...a,filepath:o})||!Vh(o,n))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?p!==h?{filepath:o,deleted:!1}:null:{filepath:o,deleted:!0}}}));return window.clearTimeout(i),r==null||r.hide(),s}catch(a){throw window.clearTimeout(i),r==null||r.hide(),this.plugin.displayError(a),a}}async getDiffString(n,r=!1,i){let a=this.getRelativeVaultPath(n),s=async(c,[u])=>{if(n==c){let f=await u.oid();return(await ie.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await ds({...this.getRepo(),filepath:n,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h}),u=await ie.readCommit({...this.getRepo(),oid:i}),f=await ds({...this.getRepo(),filepath:n,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h});return lc(a,f!=null?f:"",c!=null?c:"")}let o=(await ie.walk({...this.getRepo(),trees:[ie.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(r){let c=await this.resolveRef("HEAD").then(f=>ds({...this.getRepo(),filepath:n,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ie.Errors.NotFoundError))throw f});return lc(a,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(a)?c=await this.app.vault.adapter.read(a):c="",lc(a,l,c)}}async getLastCommitTime(){let n=this.getRepo(),r=await this.resolveRef("HEAD"),a=(await ie.readCommit({...n,oid:r})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(n){let r=this.status_mapping[`${n[this.HEAD]}${n[this.WORKDIR]}${n[this.STAGE]}`];return{index:r[0]=="?"?"U":r[0],working_dir:r[1]=="?"?"U":r[1],path:n[this.FILE],vault_path:this.getRelativeVaultPath(n[this.FILE])}}async checkAuthorInfo(){let n=await this.getConfig("user.name"),r=await this.getConfig("user.email");if(!n||!r)throw"Git author information is not set. Please set it in the settings."}showNotice(n,r=!0){if(!this.plugin.settings.disablePopups)return new Jr.Notice(n,r?this.noticeLength:void 0)}};function hR(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function pR(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:hR(t)}async function mR(t,e){let n=pR(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function gR(t){let e=0,n=[];await mR(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}var yR="https://momentjs.com/docs/#/parsing/string-format/",vR="https://publish.obsidian.md/git-doc/Line+Authoring",uc=class extends z.PluginSettingTab{constructor(n,r){super(n,r);this.plugin=r;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:n}=this,r=this.plugin,i;r.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=r.gitReady;n.empty(),a||(n.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),n.createEl("br"));let s;if(a){new z.Setting(n).setName("Automatic").setHeading(),new z.Setting(n).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(u=>u.setValue(r.settings.differentIntervalCommitAndPush).onChange(f=>{r.settings.differentIntervalCommitAndPush=f,r.saveSettings(),r.automaticsManager.reload("commit","push"),this.display()})),new z.Setting(n).setName(`Auto ${i} interval (minutes)`).setDesc(`${r.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(u=>u.setValue(String(r.settings.autoSaveInterval)).onChange(f=>{isNaN(Number(f))?new z.Notice("Please specify a valid number."):(r.settings.autoSaveInterval=Number(f),r.saveSettings(),r.automaticsManager.reload("commit"),r.settings.autoSaveInterval>0?new z.Notice(`Automatic ${i} enabled! Every ${js(r.settings.autoSaveInterval)}.`):r.settings.autoSaveInterval<=0&&new z.Notice(`Automatic ${i} disabled!`))})),s=new z.Setting(n).setName(`Auto ${i} after stopping file edits`).setDesc(`Requires the ${i} interval not to be 0. + If turned on, do auto ${i} every ${js(r.settings.autoSaveInterval)} after stopping file edits. + This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(u=>u.setValue(r.settings.autoBackupAfterFileChange).onChange(f=>{r.settings.autoBackupAfterFileChange=f,this.display(),r.saveSettings(),r.automaticsManager.reload("commit")})),this.mayDisableSetting(s,r.settings.setLastSaveToLastCommit),s=new z.Setting(n).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(u=>u.setValue(r.settings.setLastSaveToLastCommit).onChange(async f=>{r.settings.setLastSaveToLastCommit=f,r.saveSettings(),r.automaticsManager.reload("commit"),this.display()})),this.mayDisableSetting(s,r.settings.autoBackupAfterFileChange),s=new z.Setting(n).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPushInterval)).onChange(f=>{isNaN(Number(f))?new z.Notice("Please specify a valid number."):(r.settings.autoPushInterval=Number(f),r.saveSettings(),r.settings.autoPushInterval>0?(r.automaticsManager.reload("push"),new z.Notice(`Automatic push enabled! Every ${js(r.settings.autoPushInterval)}.`)):r.settings.autoPushInterval<=0&&new z.Notice("Automatic push disabled!"))})),this.mayDisableSetting(s,!r.settings.differentIntervalCommitAndPush),new z.Setting(n).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPullInterval)).onChange(f=>{isNaN(Number(f))?new z.Notice("Please specify a valid number."):(r.settings.autoPullInterval=Number(f),r.saveSettings(),r.settings.autoPullInterval>0?(r.automaticsManager.reload("pull"),new z.Notice(`Automatic pull enabled! Every ${js(r.settings.autoPullInterval)}.`)):r.settings.autoPullInterval<=0&&new z.Notice("Automatic pull disabled!"))})),new z.Setting(n).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(u=>u.setValue(r.settings.customMessageOnAutoBackup).onChange(f=>{r.settings.customMessageOnAutoBackup=f,r.saveSettings(),this.display()})),s=new z.Setting(n).setName(`Commit message on auto ${i}`).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(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.autoCommitMessage).onChange(f=>{r.settings.autoCommitMessage=f,r.saveSettings()})),this.mayDisableSetting(s,r.settings.customMessageOnAutoBackup),new z.Setting(n).setName("Commit message").setHeading(),new z.Setting(n).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).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.commitMessage?r.settings.commitMessage:"").onChange(f=>{r.settings.commitMessage=f,r.saveSettings()}));let c=new z.Setting(n).setName("{{date}} placeholder format").addMomentFormat(u=>u.setDefaultFormat(r.settings.commitDateFormat).setValue(r.settings.commitDateFormat).onChange(async f=>{r.settings.commitDateFormat=f,await r.saveSettings()}));c.descEl.innerHTML=` + Specify custom date format. E.g. "${Ed}. See Moment.js for more formats.`,new z.Setting(n).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(u=>{var f;return u.setValue((f=r.localStorage.getHostname())!=null?f:"").onChange(async d=>{r.localStorage.setHostname(d)})}),new z.Setting(n).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await r.gitManager.formatCommitMessage(r.settings.commitMessage);new z.Notice(`${f}`)})),new z.Setting(n).setName("List filenames affected by commit in the commit body").addToggle(u=>u.setValue(r.settings.listChangedFilesInMessageBody).onChange(f=>{r.settings.listChangedFilesInMessageBody=f,r.saveSettings()})),new z.Setting(n).setName("Pull").setHeading(),r.gitManager instanceof Oe&&new z.Setting(n).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(u=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};u.addOptions(f),u.setValue(r.settings.syncMethod),u.onChange(async d=>{r.settings.syncMethod=d,r.saveSettings()})}),new z.Setting(n).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(u=>u.setValue(r.settings.autoPullOnBoot).onChange(f=>{r.settings.autoPullOnBoot=f,r.saveSettings()})),new z.Setting(n).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(),s=new z.Setting(n).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 only. It will still be called commit-and-sync.").addToggle(u=>u.setValue(!r.settings.disablePush).onChange(f=>{r.settings.disablePush=!f,r.saveSettings()})),new z.Setting(n).setName("Pull on commit-and-sync").setDesc("On commit-and-sync, pull commits before pushing. Turning this off turns a commit-and-sync action into commit and push only.").addToggle(u=>u.setValue(r.settings.pullBeforePush).onChange(f=>{r.settings.pullBeforePush=f,r.saveSettings()})),r.gitManager instanceof Oe&&(new z.Setting(n).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new z.Setting(n).setName("History view").setHeading(),new z.Setting(n).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(r.settings.authorInHistoryView),c.onChange(async f=>{r.settings.authorInHistoryView=f,r.saveSettings(),r.refresh()})}),new z.Setting(n).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(r.settings.dateInHistoryView).onChange(u=>{r.settings.dateInHistoryView=u,r.saveSettings(),r.refresh()})),new z.Setting(n).setName("Source control view").setHeading(),new z.Setting(n).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(r.settings.refreshSourceControl).onChange(u=>{r.settings.refreshSourceControl=u,r.saveSettings()})),new z.Setting(n).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>c.setValue(r.settings.refreshSourceControlTimer.toString()).setPlaceholder("7000").onChange(u=>{r.settings.refreshSourceControlTimer=Math.max(parseInt(u),500),r.saveSettings(),r.setRefreshDebouncer()})),new z.Setting(n).setName("Miscellaneous").setHeading(),new z.Setting(n).setName("Disable notifications").setDesc("Disable notifications for git operations to minimize distraction (refer to status bar for updates). Errors are still shown as notifications even if you enable this setting.").addToggle(c=>c.setValue(r.settings.disablePopups).onChange(u=>{r.settings.disablePopups=u,this.display(),r.saveSettings()})),r.settings.disablePopups||new z.Setting(n).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(r.settings.disablePopupsForNoChanges).onChange(u=>{r.settings.disablePopupsForNoChanges=u,r.saveSettings()})),new z.Setting(n).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showStatusBar).onChange(u=>{r.settings.showStatusBar=u,r.saveSettings()})),new z.Setting(n).setName("Show stage/unstage button in file menu").addToggle(c=>c.setValue(r.settings.showFileMenu).onChange(u=>{r.settings.showFileMenu=u,r.saveSettings()})),new z.Setting(n).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showBranchStatusBar).onChange(u=>{r.settings.showBranchStatusBar=u,r.saveSettings()})),new z.Setting(n).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(r.settings.changedFilesInStatusBar).onChange(u=>{r.settings.changedFilesInStatusBar=u,r.saveSettings()})),r.gitManager instanceof pn?new z.Setting(n).setName("Authentication/commit author").setHeading():new z.Setting(n).setName("Commit author").setHeading(),r.gitManager instanceof pn&&new z.Setting(n).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=r.localStorage.getUsername())!=null?u:""),c.onChange(f=>{r.localStorage.setUsername(f)})}),r.gitManager instanceof pn&&new z.Setting(n).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=>{r.localStorage.setPassword(u)})}),r.gitReady&&new z.Setting(n).setName("Author name for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.name")),c.onChange(u=>{r.gitManager.setConfig("user.name",u==""?void 0:u)})}),r.gitReady&&new z.Setting(n).setName("Author email for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.email")),c.onChange(u=>{r.gitManager.setConfig("user.email",u==""?void 0:u)})}),new z.Setting(n).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be requried for special setups.").setHeading(),r.gitManager instanceof Oe&&(new z.Setting(n).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(r.settings.updateSubmodules).onChange(u=>{r.settings.updateSubmodules=u,r.saveSettings()})),r.settings.updateSubmodules&&new z.Setting(n).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(r.settings.submoduleRecurseCheckout).onChange(u=>{r.settings.submoduleRecurseCheckout=u,r.saveSettings()}))),r.gitManager instanceof Oe&&new z.Setting(n).setName("Custom Git binary path").addText(c=>{var u;c.setValue((u=r.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{r.localStorage.setGitPath(f),r.gitManager.updateGitPath(f||"git")})}),r.gitManager instanceof Oe&&new z.Setting(n).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(r.localStorage.getEnvVars().join(` +`)),c.onChange(u=>{r.localStorage.setEnvVars(u.split(` +`))})}),r.gitManager instanceof Oe&&new z.Setting(n).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(r.localStorage.getPATHPaths().join(` +`)),c.onChange(u=>{r.localStorage.setPATHPaths(u.split(` +`))})}),r.gitManager instanceof Oe&&new z.Setting(n).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(()=>{r.gitManager.setGitInstance()})}),new z.Setting(n).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(r.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(u=>{r.settings.basePath=u,r.saveSettings(),r.gitManager.updateBasePath(u||"")})}),new z.Setting(n).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(r.settings.gitDir),c.setPlaceholder(".git"),c.onChange(u=>{r.settings.gitDir=u,r.saveSettings()})}),new z.Setting(n).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(r.localStorage.getPluginDisabled()).onChange(u=>{r.localStorage.setPluginDisabled(u),u?r.unloadPlugin():r.loadPlugin(),new z.Notice("Obsidian must be restarted for the changes to take affect.")})),new z.Setting(n).setName("Support").setHeading(),new z.Setting(n).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{c.buttonEl.outerHTML="Buy Me a Coffee at ko-fi.com"});let o=n.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=()=>{window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new z.Notice("Debug information copied to clipboard. May contain sensitive information!")},z.Platform.isDesktopApp){let c=n.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=n.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),z.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(n,r){r&&(n.setDisabled(r),n.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(n){this.settings.lineAuthor.show=n,this.plugin.saveSettings(),n?this.plugin.lineAuthoringFeature.activateFeature():this.plugin.lineAuthoringFeature.deactivateFeature()}lineAuthorSettingHandler(n,r){this.settings.lineAuthor[n]=r,this.plugin.saveSettings(),this.plugin.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let n=this.settings.lineAuthor;n.authorDisplay!=="hide"&&(n.lastShownAuthorDisplay=n.authorDisplay),n.dateTimeFormatOptions!=="hide"&&(n.lastShownDateTimeFormatOptions=n.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let n=new z.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.innerHTML=` + Feature guide and quick examples
+ The commit hash, author name and authoring date can all be individually toggled.
Hide everything, to only show the age-colored sidebar.`,n.addToggle(r=>r.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.display()})),this.settings.lineAuthor.show){let r=new z.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(a=>{a.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),a.setValue(this.settings.lineAuthor.followMovement),a.onChange(s=>this.lineAuthorSettingHandler("followMovement",s))});if(r.descEl.innerHTML=` + By default (deactivated), each line only shows the newest commit where it was changed. +
+ With same commit, cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown. +
+ With all commits, cut-copy-paste-ing text inbetween multiple commits will be detected. +
+ It uses git-blame and + for matches (at least ${vl} characters) within the same (or all) commit(s), the originating commit's information is shown.`,new z.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(async s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new z.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new z.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.display()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new z.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(o=>{this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new z.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=` + 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 + UTC\xB100:00. + `;let i=new z.Setting(this.containerEl).setName("Oldest age in coloring");i.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],i.addText(a=>{a.setPlaceholder("1y"),a.setValue(this.settings.lineAuthor.coloringMaxAge),a.onChange(s=>{let[o,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new z.Setting(this.containerEl).setName("Text color").addText(a=>{a.setValue(this.settings.lineAuthor.textColorCss),a.onChange(s=>{this.lineAuthorSettingHandler("textColorCss",s)})}).descEl.innerHTML=` + The CSS color of the gutter text.
+ + It is higly recommended to use + + CSS variables + defined by themes + (e.g.
var(--text-muted)
or +
var(--text-on-accent)
, + because they automatically adapt to theme changes.
+ + See: + List of available CSS variables in Obsidian + + `,new z.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(a=>{a.setValue(this.settings.lineAuthor.ignoreWhitespace),a.onChange(s=>this.lineAuthorSettingHandler("ignoreWhitespace",s))}).descEl.innerHTML=` + 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. +
+ 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(n){let r=new z.Setting(this.containerEl).setName("").addText(i=>{let a=np(n,this.settings.lineAuthor),s=np(n,An.lineAuthor);i.setPlaceholder(Wh(s)),i.setValue(Wh(a)),i.onChange(o=>{let l=J_(o);if(l!==void 0){let c=n==="newest"?"colorNew":"colorOld";this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(n,l)})});this.lineAuthorColorSettings.set(n,r),this.refreshColorSettingsName(n),this.refreshColorSettingsDesc(n,np(n,this.settings.lineAuthor))}refreshColorSettingsName(n){let r=this.lineAuthorColorSettings.get(n);if(r){let i=n==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";r.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(n,r){let i=this.lineAuthorColorSettings.get(n);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(n,this.settings.lineAuthor,r!==void 0))}colorSettingPreviewDescHtml(n,r,i){let a=i?rp(n,r):"rgba(127,127,127,0.3)",s=z.moment.unix(z.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and + named colors (e.g. 'black', 'purple'). Color preview: ${`
${o}
`}`}previewCustomDateTimeDescriptionHtml(n){let r=(0,z.moment)().format(n);return`
Format string to display the authoring date.
Currently: ${r}`}previewOldestAgeDescriptionHtml(n){let r=fc(n);return[`The oldest age in the line author coloring. Everything older will have the same color. +
Smallest valid age is "1d". Currently: ${r!==void 0?`${r.asDays()} days`:"invalid!"}`,r]}};function np(t,e){return t==="oldest"?e.colorOld:e.colorNew}function fc(t){let e=z.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}function gS(t,e,n){if(!(t===void 0||e===void 0||n===void 0))return`head${t}-obj${e}-path${n}`}var yS=dc.Annotation.define();function vS(t,e,n){return n.update({annotations:yS.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}function wR(t){return t.annotation(yS)}var aa=dc.StateField.define({create:t=>{},update:(t,e)=>{var n;return(n=wR(e))!=null?n:bR(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function hc(t){var a;let e=mS.sha256.create();if(!t)return e;let{la:n,key:r,lineOffsetsFromUnsavedChanges:i}=t;e.update(n==="untracked"?"t":"f"),e.update(r);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var rn={get:void 0,save:void 0};function wS(t,e){rn.get=t,rn.save=e}function pc(t){var e,n;return(n=(e=fc(t.coloringMaxAge))==null?void 0:e.asDays())!=null?n:fc(An.lineAuthor.coloringMaxAge).asDays()}function bR(t,e){if(e)return t.changes.empty||t.changes.iterChanges((n,r,i,a)=>{var p;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(n).number,c=s.lineAt(r).number,u=o.lineAt(i).number,f=o.lineAt(a).number,d=c-l+1,h=f-u+1;for(let m=u;m<=f;m++){let g=(p=e.lineOffsetsFromUnsavedChanges.get(m))!=null?p:0,w=f===m,b=h-d;w&&(g+=b),e.lineOffsetsFromUnsavedChanges.set(m,g)}}),e}var ip=class{constructor(e){this.state=e;this.subscribeMe()}async notifyLineAuthoring(e,n){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let r=this.view.state,i=vS(e,n,r);this.view.dispatch(i)}updateToNewState(e){let n=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=e,n&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(ia.ifFilepathDefinedTransformSubscribers(this.filepath,e=>e.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(e){ia.ifFilepathDefinedTransformSubscribers(e,n=>n.delete(this))}get filepath(){var e,n;return(n=(e=this.state.field(mc.editorViewField))==null?void 0:e.file)==null?void 0:n.path}get view(){return this.state.field(mc.editorEditorField)}},xS=bS.StateField.define({create:t=>new ip(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});v();function _S(){sa=void 0,ap=[],gc=0,vc.clear(),wc.clear(),oa.clear()}var sa,yc=()=>sa;function SS(t,e){var i;let n=e.length;if(n<((i=sa==null?void 0:sa.length)!=null?i:0))return;sa={gutter:t,length:n,text:e};let r=rn.get();n!==r.gutterSpacingFallbackLength&&(r.gutterSpacingFallbackLength=n,rn.save(r))}var ap=[],xR=15,gc=0;function ES(t){ap[gc]=t,gc=(gc+1)%xR}function kS(){return tS(ap)}var vc=new Map,wc=new Map,oa=new Set;v();var BS=require("@codemirror/state"),NS=require("@codemirror/view");v();var cp=require("@codemirror/view"),RS=Ve(Zh()),_c=require("obsidian");v();v();var bc={x:-10,y:-10};function AS(){bc.x===-10&&window.addEventListener("mousedown",t=>{bc.x=t.clientX,bc.y=t.clientY})}function TS(){for(let t of oa)if(_R(t,bc))return t}function _R(t,e){let{x:n,y:r,width:i,height:a}=t.getBoundingClientRect();return n<=e.x&&e.x<=n+i&&r<=e.y&&e.y<=r+a}v();var $s={};var CS="data-commit";function FS(t,e,n){if(e.hasFocus())return;let r=TS();if(!r)return;let i=ER(r);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&SR(i,t),sp("showCommitHash",t),sp("authorDisplay",t),sp("dateTimeFormatOptions",t))}function SR(t,e){e.addItem(n=>n.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(r=>navigator.clipboard.writeText(t.hash)))}function sp(t,e){var l,c;let n,r,i=$s.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=An.lineAuthor[t];if(t==="showCommitHash")n="Show commit hash",r=!a;else if(t==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:o;n="Show author "+(s?a:u),r=s?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=i.lastShownDateTimeFormatOptions)!=null?c:o;n="Show "+(s?a:u),n+=n.contains("date")?"":" date",r=s?"hide":u}else vr(t);e.addItem(u=>u.setTitle(n).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var d,h;return(h=(d=$s.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,r)}))}function MS(t,e,n){n.setAttr(CS,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function ER(t){let e=t.getAttr(CS);return e?JSON.parse(e):void 0}v();function rp(t,e){return t==="oldest"?xc(0,!1,e).color:xc(void 0,!0,e).color}function xc(t,e,n){let r=pc(n),i=Date.now()/1e3,a=t!=null?t:0,o=(e?0:i-a)/60/60/24,l=Math.pow(Math.clamp(o/r,0,1),1/2.3),c=kR(),u=n.colorNew,f=n.colorOld,d=c?.4:1,h=op(u.r,f.r,l)*d,p=op(u.g,f.g,l)*d,m=op(u.b,f.b,l)*d;return{color:`rgba(${h},${p},${m},${c?.75:.25})`,daysSinceCommit:o}}function op(t,e,n){return t+(e-t)*n}function kR(){let t=window==null?void 0:window.app;return(t==null?void 0:t.getTheme())==="obsidian"}function OS(t){document.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}v();function IS(t,e,n){let r;for(let i=e;i<=n;i++){let a=t.hashPerLine[i],s=t.commits.get(a);(!r||s.isZeroCommit||AR(s,r))&&(r=s)}return r}function AR(t,e){var i,a,s,o;let n=(a=(i=t.author)==null?void 0:i.epochSeconds)!=null?a:0,r=(o=(s=e.author)==null?void 0:s.epochSeconds)!=null?o:0;return n>r}var PS="-",TR="+",CR=3,FR="*",MR=/\S/g,OR="%",la=class extends cp.GutterMarker{constructor(n){super();this.text=n}eq(n){return this.text===(n==null?void 0:n.text)}toDOM(){return document.createTextNode(this.text)}destroy(n){document.body.contains(n)||n.remove()}},lp=class extends cp.GutterMarker{constructor(n,r,i,a,s,o){super();this.lineAuthoring=n;this.startLine=r;this.endLine=i;this.key=a;this.settings=s;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(n){return this.key===(n==null?void 0:n.key)&&this.startLine===(n==null?void 0:n.startLine)&&this.endLine===(n==null?void 0:n.endLine)&&(this==null?void 0:this.options)===(n==null?void 0:n.options)}toDOM(){var n;return this.precomputedDomProvider=(n=this.precomputedDomProvider)!=null?n:this.computeDom(),this.precomputedDomProvider()}destroy(n){document.body.contains(n)||(n.remove(),oa.delete(n))}computeDom(){let n=IS(this.lineAuthoring,this.startLine,this.endLine),r=n.isZeroCommit?"":this.renderNonZeroCommit(n);return!n.isZeroCommit&&this.options!=="waiting-for-result"?SS(this,r):r=this.adaptTextForFakeCommit(n,r,this.options),this.createHtmlNode(n,r,this.options==="waiting-for-result")}createHtmlNode(n,r,i){var c;let a=window.createDiv();a.innerText=r;let{color:s,daysSinceCommit:o}=xc((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds,n==null?void 0:n.isZeroCommit,this.settings);a.style.backgroundColor=s,MS(n,i,a);function l(){let u=a.cloneNode(!0);return oa.add(u),i||ES(o),u}return l}renderNonZeroCommit(n){let r=this.settings.showCommitHash?this.renderHash(n):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(n,this.settings.authorDisplay)}`,a=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(n,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[r,i,a].filter(o=>o.length>=1).join(" ")}renderHash(n){return n.hash.substring(0,6)}renderAuthorName(n,r){var o,l,c,u;let i=(l=(o=n==null?void 0:n.author)==null?void 0:o.name)!=null?l:"",a=i.split(" ").filter(f=>f.length>=1),s;switch(r){case"initials":s=a.map(f=>f[0].toUpperCase()).join("");break;case"first name":s=(c=a.first())!=null?c:PS;break;case"last name":s=(u=a.last())!=null?u:PS;break;case"full":s=i;break;default:return vr(r)}return nS(n==null?void 0:n.author,n==null?void 0:n.committer)||(s=s+FR),s}renderAuthoringDate(n,r,i,a){var c;let s="?";if(((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds)===void 0)return s;let o;switch(r){case"date":o=yl;break;case"datetime":o=Sd;break;case"custom":o=i;break;case"natural language":o=u=>{let f=u.diff((0,_c.moment)());return _c.moment.duration(f).humanize(!0)};break;default:return vr(r)}let l=_c.moment.unix(n.author.epochSeconds);switch(a){case"viewer-local":break;case"author-local":l=l.utcOffset(n.author.tz),o+=" Z";break;case"utc0000":l=l.utc(),o+="[Z]";break;default:return vr(a)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(n,r,i){var l,c,u,f;let a=(c=(l=yc())==null?void 0:l.text)!=null?c:r,s=i!=="waiting-for-result"&&n.isZeroCommit?TR:OR;r=a.replace(MR,s);let o=(f=(u=rn.get())==null?void 0:u.gutterSpacingFallbackLength)!=null?f:r.length;if(r=rS(r,o,s),i!=="waiting-for-result"&&n.isZeroCommit){let d=Math.min(o,CR);r=iS(r,o-d)}return r}};function ei(t,e,n,r,i,a){let s=RS.sha256.create();s.update(Object.values(i).join(",")),s.update(`s${e}-e${n}-k${r}-o${a}`);let o=s.hex(),l=vc.get(o);if(l)return l;let c=new lp(t,e,n,r,i,a);return vc.set(o,c),c}v();var LS=require("obsidian");function up(){var e,n;let t=(n=(e=rn.get())==null?void 0:e.gutterSpacingFallbackLength)!=null?n:An.lineAuthor.gutterSpacingFallbackLength;return new la(Array(t).fill("-").join(""))}function fp(t){let{lineAuthoring:e,ageForInitialRender:n}=IR(t);return ei(e,1,1,"initialGutter"+n,t,"waiting-for-result")}function IR(t){var a;let e=(a=kS())!=null?a:pc(t)*.25,n=(0,LS.moment)().add(-e,"days"),r={name:"",epochSeconds:eS(n),tz:"+0000"},i={hash:"waiting-for-result",author:r,committer:r,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:e}}v();function jS(t,e){return ei({hashPerLine:[void 0,"000000"],commits:new Map([["000000",cS]])},1,1,t,e)}var dp=new la(""),$S=(0,NS.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(aa,!1);return PR(t,e)},lineMarkerChange(t){let e=hc(t.state.field(aa));return hc(t.startState.field(aa))!==e},renderEmptyElements:!0,initialSpacer:t=>(DS(t),up()),updateSpacer:(t,e)=>{var n,r;return DS(e.view),(r=(n=yc())==null?void 0:n.gutter)!=null?r:up()}});function PR(t,e){let n=hc(e),r=t.state.doc,i=new Map;for(let u=1;u<=r.lines;u++){let f=r.line(u).from,d=t.lineBlockAt(f).to;i.set(u,[f,d]),n.update([f,d,0])}let a=rn.get();n.update("s"+Object.values(rn).join(","));let s=n.hex(),o=wc.get(s);if(o)return o;let{result:l,allowCache:c}=RR(r,i,a,e);return c&&wc.set(s,l),l}function RR(t,e,n,r){let i=!0,a=t.lines,s=[];function o(f,d,h){return s.push(h.range(f,d))}let l=LR(a,r),c=t.length===0,u=t.iterLines(a,a+1).next().value==="";for(let f=1;f<=a;f++){let[d,h]=e.get(f),p=t.lineAt(h).number;if(c){o(d,h,dp);continue}if(f===a&&u){o(d,h,dp);continue}if(r===void 0){o(d,h,fp(n)),i=!1;continue}let{key:m,la:g}=r;if(g==="untracked"){o(d,h,jS(g,n));continue}let w=g.hashPerLine.length-1,b=l[f],x=l[p];if(x&&x>w&&o(d,h,dp),b!==void 0&&qh(1,b,w)&&x!==void 0&&qh(1,x,w)){o(d,h,ei(g,b,x,m,n));continue}if(w<1){o(d,h,fp(n)),i=!1;continue}let E=Math.clamp(b!=null?b:f,1,w),_=Math.clamp(x!=null?x:p,1,w);o(d,h,ei(g,E,_,m+"computing",n,"waiting-for-result"))}return{result:BS.RangeSet.of(s,!0),allowCache:i}}function LR(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),i=>i);let n=[void 0],r=0;for(let i=1;i<=t;i++){let a=e.lineOffsetsFromUnsavedChanges.get(i);r+=a!=null?a:0,n[i]=a===void 0?i-r:void 0}return n}function DS(t){t.dom.querySelectorAll(".cm-gutters").forEach(n=>{n!=null&&n.style&&(n.style.marginLeft||(n.style.marginLeft="unset"))})}var Sc=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){this.trackChangedHelper(e).catch(n=>(console.warn("Git: Error in trackChanged."+n),Promise.reject(n)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}this.computeLineAuthorInfo(e.path)}}destroy(){this.lineAuthorings.clear(),ia.clear(),_S()}async computeLineAuthorInfo(e){let n=this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,r=await n.submoduleAwareHeadRevisonInContainingDirectory(e),i=await n.hashObject(e),a=gS(r,i,e);if(a!==void 0){if(!this.lineAuthorings.has(a)){let s=await n.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(a,s)}this.notifyComputationResultToSubscribers(e,a)}}notifyComputationResultToSubscribers(e,n){ia.ifFilepathDefinedTransformSubscribers(e,async r=>r.forEach(i=>i.notifyLineAuthoring(n,this.lineAuthorings.get(n))))}},US=HS.Prec.high([xS,aa,$S]);var Ec=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{let n=e==null?void 0:e.view,r=n==null?void 0:n.file;if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}r===void 0||(n==null?void 0:n.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),wS(()=>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;OS(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new Sc(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&&Hs.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Oe?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(US),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.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),AS(),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.fileRenameEvent)}destroyEventHandlers(){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.fileRenameEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var n;return(n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e)})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,n)=>{var r;return e instanceof Hs.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var n;return e instanceof Hs.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",FS)}};v();var kc=class{constructor(){this.tasks=[]}addTask(e){this.tasks.push(e),this.tasks.length===1&&this.handleTask()}async handleTask(){this.tasks.length>0&&this.tasks[0]().finally(()=>{this.tasks.shift(),this.handleTask()})}};v();var Mn=require("obsidian");var Ac=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),addEventListener("git-refresh",this.refreshCommitTimestamp.bind(this))}displayMessage(e,n){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:n}),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.iconEl=this.statusBarEl.createDiv(),this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px",this.iconEl.style.float="left"),this.plugin.state){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,Mn.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,Mn.setIcon)(this.iconEl,"refresh-w"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,Mn.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,Mn.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,Mn.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;case 6:this.statusBarEl.ariaLabel="You have conflict files...",(0,Mn.setIcon)(this.iconEl,"alert-circle"),this.statusBarEl.addClass(this.base+"conflict");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Mn.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var n;let e=this.lastCommitTimestamp;if(e){let r=window.moment,i=r(e).fromNow();this.statusBarEl.ariaLabel=`${this.plugin.offlineMode?"Offline: ":""}Last Commit: ${i}`,(n=this.unPushedCommits)!=null&&n&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=this.plugin.offlineMode?"Git is offline":"Git is ready";this.plugin.offlineMode?(0,Mn.setIcon)(this.iconEl,"globe"):(0,Mn.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()}};v();var zS=require("obsidian"),Tc=class extends zS.SuggestModal{constructor(n,r){super(n.app);this.fromAutoBackup=r;this.resolve=null;this.plugin=n,this.setPlaceholder("Type your message and select optional the version with the added date.")}open(){return super.open(),new Promise(n=>{this.resolve=n})}onClose(){this.resolve&&this.resolve(void 0)}selectSuggestion(n,r){this.resolve&&this.resolve(n),super.selectSuggestion(n,r)}getSuggestions(n){let r=window.moment().format(this.plugin.settings.commitDateFormat);return n==""&&(n="..."),[n,`${r}: ${n}`,`${n}: ${r}`]}renderSuggestion(n,r){r.innerText=n}onChooseSuggestion(n,r){}};v();var GS=require("obsidian"),Us=class{constructor(e){this.plugin=e}saveLastAuto(e,n){n==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):n==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):n==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,n,r;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((n=this.plugin.localStorage.getLastAutoPull())!=null?n:""),push:new Date((r=this.plugin.localStorage.getLastAutoPush())!=null?r:"")}}async init(){this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let n=new Date,r=this.plugin.settings.autoPushInterval-Math.round((n.getTime()-e.push.getTime())/1e3/60);this.startAutoPush(r<=0?0:r)}if(this.plugin.settings.autoPullInterval>0){let n=new Date,r=this.plugin.settings.autoPullInterval-Math.round((n.getTime()-e.pull.getTime())/1e3/60);this.startAutoPull(r<=0?0:r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){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.plugin.localStorage.setLastAutoBackup(e.toString())}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let n=new Date,r=this.plugin.settings.autoSaveInterval-Math.round((n.getTime()-e.backup.getTime())/1e3/60);this.startAutoCommitAndSync(r<=0?0:r)}}}startAutoCommitAndSync(e){let n=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,GS.debounce)(()=>this.doAutoCommitAndSync(),n,!0):(n>2147483647&&(n=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),n))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(()=>this.plugin.settings.differentIntervalCommitAndPush?this.plugin.commit({fromAuto:!0}):this.plugin.commitAndSync(!0)),this.saveLastAuto(new Date,"backup"),this.plugin.saveSettings(),this.startAutoCommitAndSync()}startAutoPull(e){let n=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPull=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote()),this.saveLastAuto(new Date,"pull"),this.plugin.saveSettings(),this.startAutoPull()},n)}startAutoPush(e){let n=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPush=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.push()),this.saveLastAuto(new Date,"push"),this.plugin.saveSettings(),this.startAutoPush()},n)}clearAutoCommitAndSync(){var n;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((n=this.plugin.autoCommitDebouncer)==null||n.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}};v();var Gs=require("obsidian");v();var zs=require("obsidian");async function VS(t,e,n){let r=await qS(e,n);if(r.result==="failure"){new zs.Notice(r.reason);return}let{isGitHub:i,branch:a,repo:s,user:o,filePath:l}=r;if(i){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}-L${u}`)}else new zs.Notice("It seems like you are not using GitHub")}async function WS(t,e){let n=await qS(t,e);if(n.result==="failure"){new zs.Notice(n.reason);return}let{isGitHub:r,branch:i,repo:a,user:s,filePath:o}=n;r?window.open(`https://github.com/${s}/${a}/commits/${i}/${o}`):new zs.Notice("It seems like you are not using GitHub")}async function qS(t,e){let n=await e.branchInfo(),r=n.tracking,i=n.current,a,s=e.getRelativeRepoPath(t.path);if(e instanceof Oe){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){s=l.relativeFilepath;let c=await e.git.cwd({path:l.submodule,root:!1}).status();if(r=c.tracking||void 0,i=c.current||void 0,r){let u=r.substring(0,r.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)a=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(r==null)return{result:"failure",reason:"Remote branch is not configured"};if(i==null)return{result:"failure",reason:"Failed to get current branch name"};if(a==null){let l=r.substring(0,r.indexOf("/"));if(a=await e.getConfig(`remote.${l}.url`),a==null)return{result:"failure",reason:"Failed to get remote url"}}let o=a.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:i,filePath:s}}}v();var XS=require("obsidian"),Cc=class extends XS.FuzzySuggestModal{constructor(e,n){super(e.app),this.plugin=e,this.changedFiles=n,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.working_dir=="U")return`Untracked | ${e.vault_path}`;let n="",r="";return e.working_dir!=" "&&(n=`Working Dir: ${e.working_dir} `),e.index!=" "&&(r=`Index: ${e.index}`),`${n}${r} | ${e.vault_path}`}onChooseItem(e,n){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vault_path,"")==null?this.app.openWithDefaultApp(e.vault_path):this.plugin.app.workspace.openLinkText(e.vault_path,"/")}};v();var YS=require("obsidian"),Fc=class extends YS.Modal{constructor(n,r){super(n);this.content=r;this.resolve=null}open(){return super.open(),new Promise(n=>{this.resolve=n})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText("Edit .gitignore");let i=n.createDiv(),a=i.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});i.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",async()=>{this.resolve(a.value),this.close()})}onClose(){let{contentEl:n}=this;this.resolve(void 0),n.empty()}};function ZS(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let n=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(n)||e.vault.adapter.write(n,"");let r=await e.vault.adapter.read(n),a=await new Fc(e,r).open();a!==void 0&&(await e.vault.adapter.write(n,a),t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(ht.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:ht.type})):r=n.first(),e.workspace.revealLeaf(r)}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(fn.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:fn.type})):r=n.first(),e.workspace.revealLeaf(r)}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:n=>{var i;let r=e.workspace.getActiveFile();if(n)return r!==null;(i=qt())==null||i.setViewState({type:Tt.type,active:!0,state:{staged:!1,file:t.gitManager.getRelativeRepoPath(r.path,!0)}})}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(n,{file:r})=>{if(r)return VS(n,r,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(n,{file:r})=>{if(r)return WS(r,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:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.addFileToGitignore(r)}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync(!1),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1,!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-staged",name:"Commit staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:!0}))}),Gs.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Commit Amend",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>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:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.stageFile(r))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.unstageFile(r))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:async()=>t.editRemotes()}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:async()=>t.removeRemote()}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:async()=>t.setUpstreamBranch()}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new ze({options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? plugin action cannot be undone.",onlySelection:!0}).open()==="YES"&&(await e.vault.adapter.rmdir(`${t.settings.basePath}/.git`,!0),new Gs.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),t.init()):new Gs.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:async()=>t.createNewRepo()}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:async()=>t.cloneNewRepo()}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(!await t.isAllInitialized())return;let n=await t.gitManager.status();if(console.log(n),t.setState(0),n.changed.length+n.staged.length>500){t.displayError("Too many changes to display");return}new Cc(t,n.all).open()}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch()}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch()}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch()}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{if(!await t.isAllInitialized())return!1;await new ze({options:["NO","YES"],placeholder:"Do you want to discard all changes to tracked files? plugin action cannot be undone.",onlySelection:!0}).open()==="YES"&&t.promiseQueue.addTask(()=>t.discardAll())}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var n;return(n=t.settingsTab)==null?void 0:n.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}})}v();var Mc=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":"}migrate(){let e=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let n of e){let r=localStorage.getItem(this.prefix+n);app.loadLocalStorage(this.prefix+n)==null&&r!=null&&r!=null&&(app.saveLocalStorage(this.prefix+n,r),localStorage.removeItem(this.prefix+n))}}getPassword(){return app.loadLocalStorage(this.prefix+"password")}setPassword(e){return app.saveLocalStorage(this.prefix+"password",e)}getUsername(){return app.loadLocalStorage(this.prefix+"username")}setUsername(e){return app.saveLocalStorage(this.prefix+"username",e)}getHostname(){return app.loadLocalStorage(this.prefix+"hostname")}setHostname(e){return app.saveLocalStorage(this.prefix+"hostname",e)}getConflict(){return app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(e){return app.saveLocalStorage(this.prefix+"conflict",`${e}`)}getLastAutoPull(){return app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(e){return app.saveLocalStorage(this.prefix+"lastAutoPull",e)}getLastAutoBackup(){return app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(e){return app.saveLocalStorage(this.prefix+"lastAutoBackup",e)}getLastAutoPush(){return app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(e){return app.saveLocalStorage(this.prefix+"lastAutoPush",e)}getGitPath(){return app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(e){return app.saveLocalStorage(this.prefix+"gitPath",e)}getPATHPaths(){var e,n;return(n=(e=app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?n:[]}setPATHPaths(e){return app.saveLocalStorage(this.prefix+"PATHPaths",e.join(":"))}getEnvVars(){var e;return JSON.parse((e=app.loadLocalStorage(this.prefix+"envVars"))!=null?e:"[]")}setEnvVars(e){return app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(e))}getPluginDisabled(){return app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(e){return app.saveLocalStorage(this.prefix+"pluginDisabled",`${e}`)}};v();v();v();v();var De;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(De||(De={}));var KS={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},QS={LINES:"lines",WORDS:"words",NONE:"none"},JS={WORD:"word",CHAR:"char"},ti;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(ti||(ti={}));v();var jR=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],DR=RegExp("["+jR.join("\\")+"]","g");function eE(t){return t.replace(DR,"\\$&")}function hp(t){return t&&t.replace(/\\/g,"/")}function tE(t){let e,n,r,i=0;for(e=0,r=t.length;e1?n[n.length-1]:e}function rE(t,e){return e.reduce((n,r)=>n||t.startsWith(r),!1)}var iE=["a/","b/","i/","w/","c/","o/"];function xr(t,e,n){let r=n!==void 0?[...iE,n]:iE,i=e?new RegExp(`^${eE(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=r.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function BR(t,e){return xr(t,"---",e)}function NR(t,e){return xr(t,"+++",e)}function aE(t,e={}){let n=[],r=null,i=null,a=null,s=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,m=/^deleted file mode (\d{6})/,g=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,x=/^rename from "?(.+)"?/,E=/^rename to "?(.+)"?/,_=/^similarity index (\d+)%/,T=/^dissimilarity index (\d+)%/,y=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,k=/^GIT binary patch/,C=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,M=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,P=/^new file mode (\d{6})/,$=/^deleted file mode (\d{6}),(\d{6})/,j=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function Q(){i!==null&&r!==null&&(r.blocks.push(i),i=null)}function le(){r!==null&&(!r.oldName&&l!==null&&(r.oldName=l),!r.newName&&c!==null&&(r.newName=c),r.newName&&(n.push(r),r=null)),l=null,c=null}function de(){Q(),le(),r={blocks:[],deletedLines:0,addedLines:0}}function re(H){Q();let U;r!==null&&((U=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(H))?(r.isCombined=!1,a=parseInt(U[1],10),o=parseInt(U[2],10)):(U=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(H))?(r.isCombined=!0,a=parseInt(U[1],10),s=parseInt(U[2],10),o=parseInt(U[3],10)):(H.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,r.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:H}}function Ae(H){if(r===null||i===null||a===null||o===null)return;let U={content:H},D=r.isCombined?["+ "," +","++"]:["+"],se=r.isCombined?["- "," -","--"]:["-"];rE(H,D)?(r.addedLines++,U.type=De.INSERT,U.oldNumber=void 0,U.newNumber=o++):rE(H,se)?(r.deletedLines++,U.type=De.DELETE,U.oldNumber=a++,U.newNumber=void 0):(U.type=De.CONTEXT,U.oldNumber=a++,U.newNumber=o++),i.lines.push(U)}function he(H,U){let D=U;for(;D{if(!H||H.startsWith("*"))return;let D,se=j[U-1],_e=j[U+1],mt=j[U+2];if(H.startsWith("diff --git")||H.startsWith("diff --combined")){if(de(),(D=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(H))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isGitDiff=!0;return}if(H.startsWith("Binary files")&&!(r!=null&&r.isGitDiff)){if(de(),(D=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(H))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isBinary=!0;return}if((!r||!r.isGitDiff&&r&&H.startsWith(u)&&_e.startsWith(f)&&mt.startsWith(d))&&de(),r!=null&&r.isTooBig)return;if(r&&(typeof e.diffMaxChanges=="number"&&r.addedLines+r.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&H.length>e.diffMaxLineLength)){r.isTooBig=!0,r.addedLines=0,r.deletedLines=0,r.blocks=[],i=null;let Te=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(n.length):"Diff too big to be displayed";re(Te);return}if(H.startsWith(u)&&_e.startsWith(f)||H.startsWith(f)&&se.startsWith(u)){if(r&&!r.oldName&&H.startsWith("--- ")&&(D=BR(H,e.srcPrefix))){r.oldName=D,r.language=nE(r.oldName,r.language);return}if(r&&!r.newName&&H.startsWith("+++ ")&&(D=NR(H,e.dstPrefix))){r.newName=D,r.language=nE(r.newName,r.language);return}}if(r&&(H.startsWith(d)||r.isGitDiff&&r.oldName&&r.newName&&!i)){re(H);return}if(i&&(H.startsWith("+")||H.startsWith("-")||H.startsWith(" "))){Ae(H);return}let X=!he(H,U);if(r===null)throw new Error("Where is my file !!!");(D=h.exec(H))?r.oldMode=D[1]:(D=p.exec(H))?r.newMode=D[1]:(D=m.exec(H))?(r.deletedFileMode=D[1],r.isDeleted=!0):(D=g.exec(H))?(r.newFileMode=D[1],r.isNew=!0):(D=w.exec(H))?(X&&(r.oldName=D[1]),r.isCopy=!0):(D=b.exec(H))?(X&&(r.newName=D[1]),r.isCopy=!0):(D=x.exec(H))?(X&&(r.oldName=D[1]),r.isRename=!0):(D=E.exec(H))?(X&&(r.newName=D[1]),r.isRename=!0):(D=S.exec(H))?(r.isBinary=!0,r.oldName=xr(D[1],void 0,e.srcPrefix),r.newName=xr(D[2],void 0,e.dstPrefix),re("Binary file")):k.test(H)?(r.isBinary=!0,re(H)):(D=_.exec(H))?r.unchangedPercentage=parseInt(D[1],10):(D=T.exec(H))?r.changedPercentage=parseInt(D[1],10):(D=y.exec(H))?(r.checksumBefore=D[1],r.checksumAfter=D[2],D[3]&&(r.mode=D[3])):(D=C.exec(H))?(r.checksumBefore=[D[2],D[3]],r.checksumAfter=D[1]):(D=M.exec(H))?(r.oldMode=[D[2],D[3]],r.newMode=D[1]):(D=P.exec(H))?(r.newFileMode=D[1],r.isNew=!0):(D=$.exec(H))&&(r.deletedFileMode=D[1],r.isDeleted=!0)}),Q(),le(),n}v();v();v();function qn(){}qn.prototype={diff:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.callback;typeof r=="function"&&(i=r,r={}),this.options=r;var a=this;function s(m){return i?(setTimeout(function(){i(void 0,m)},0),!0):m}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var o=n.length,l=e.length,c=1,u=o+l;r.maxEditLength&&(u=Math.min(u,r.maxEditLength));var f=[{newPos:-1,components:[]}],d=this.extractCommon(f[0],n,e,0);if(f[0].newPos+1>=o&&d+1>=l)return s([{value:this.join(n),count:n.length}]);function h(){for(var m=-1*c;m<=c;m+=2){var g=void 0,w=f[m-1],b=f[m+1],x=(b?b.newPos:0)-m;w&&(f[m-1]=void 0);var E=w&&w.newPos+1=o&&x+1>=l)return s(HR(a,g.components,n,e,a.useLongestToken));f[m]=g}c++}if(i)(function m(){setTimeout(function(){if(c>u)return i();h()||m()},0)})();else for(;c<=u;){var p=h();if(p)return p}},pushComponent:function(e,n,r){var i=e[e.length-1];i&&i.added===n&&i.removed===r?e[e.length-1]={count:i.count+1,added:n,removed:r}:e.push({count:1,added:n,removed:r})},extractCommon:function(e,n,r,i){for(var a=n.length,s=r.length,o=e.newPos,l=o-i,c=0;o+1h.length?m:h}),c.value=t.join(u)}else c.value=t.join(n.slice(o,o+c.count));o+=c.count,c.added||(l+=c.count)}}var d=e[s-1];return s>1&&typeof d.value=="string"&&(d.added||d.removed)&&t.equals("",d.value)&&(e[s-2].value+=d.value,e.pop()),e}function UR(t){return{newPos:t.newPos,components:t.components.slice(0)}}var zR=new qn;function lE(t,e,n){return zR.diff(t,e,n)}var sE=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,oE=/\S/,gp=new qn;gp.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!oE.test(t)&&!oE.test(e)};gp.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n{let r=t(e).trim(),i=t(n).trim();return XR(r,i)/(r.length+i.length)}}function ua(t){function e(r,i,a=new Map){let s=1/0,o;for(let l=0;l0||o.indexB>0)&&(x=g.concat(x)),(r.length>d||i.length>h)&&(x=x.concat(b)),x}return n}var pt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},ni={matching:QS.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:JS.WORD,colorScheme:ti.LIGHT},On="/",fE=ca(t=>t.value),YR=ua(fE);function vp(t){return t.indexOf("dev/null")!==-1}function ZR(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function KR(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function fa(t){switch(t){case De.CONTEXT:return pt.CONTEXT;case De.INSERT:return pt.INSERTS;case De.DELETE:return pt.DELETES}}function da(t){switch(t){case ti.DARK:return"d2h-dark-color-scheme";case ti.AUTO:return"d2h-auto-color-scheme";case ti.LIGHT:default:return"d2h-light-color-scheme"}}function QR(t){return t?2:1}function _r(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function an(t,e,n=!0){let r=QR(e);return{prefix:t.substring(0,r),content:n?_r(t.substring(r)):t.substring(r)}}function ri(t){let e=hp(t.oldName),n=hp(t.newName);if(e!==n&&!vp(e)&&!vp(n)){let r=[],i=[],a=e.split(On),s=n.split(On),o=a.length,l=s.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&a[u]===s[f];)i.unshift(s[f]),u-=1,f-=1;let d=r.join(On),h=i.join(On),p=a.slice(c,u+1).join(On),m=s.slice(c,f+1).join(On);return d.length&&h.length?d+On+"{"+p+" \u2192 "+m+"}"+On+h:d.length?d+On+"{"+p+" \u2192 "+m+"}":h.length?"{"+p+" \u2192 "+m+"}"+On+h:e+" \u2192 "+n}else return vp(n)?e:n}function ha(t){return`d2h-${tE(ri(t)).toString().slice(-6)}`}function pa(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 Ic(t,e,n,r={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},ni),r),l=an(t,n,!1),c=an(e,n,!1);if(l.content.length>a||c.content.length>a)return{oldLine:{prefix:l.prefix,content:_r(l.content)},newLine:{prefix:c.prefix,content:_r(c.content)}};let u=o==="char"?lE(l.content,c.content):cE(l.content,c.content),f=[];if(o==="word"&&i==="words"){let h=u.filter(g=>g.removed),p=u.filter(g=>g.added);YR(p,h).forEach(g=>{g[0].length===1&&g[1].length===1&&fE(g[0][0],g[1][0]){let m=p.added?"ins":p.removed?"del":null,g=f.indexOf(p)>-1?' class="d2h-change"':"",w=_r(p.value);return m!==null?`${h}<${m}${g}>${w}`:`${h}${w}`},"");return{oldLine:{prefix:l.prefix,content:ZR(d)},newLine:{prefix:c.prefix,content:KR(d)}}}var dE="file-summary",JR="icon",eL={colorScheme:ni.colorScheme},Pc=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},eL),n)}render(e){let n=e.map(r=>this.hoganUtils.render(dE,"line",{fileHtmlId:ha(r),oldName:r.oldName,newName:r.newName,fileName:ri(r),deletedLines:"-"+r.deletedLines,addedLines:"+"+r.addedLines},{fileIcon:this.hoganUtils.template(JR,pa(r))})).join(` +`);return this.hoganUtils.render(dE,"wrapper",{colorScheme:da(this.config.colorScheme),filesNumber:e.length,files:n})}};v();var bp=Object.assign(Object.assign({},ni),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ws="generic",hE="line-by-line",tL="icon",nL="tag",qs=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},bp),n)}render(e){let n=e.map(r=>{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` +`);return this.hoganUtils.render(Ws,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(hE,"file-diff"),i=this.hoganUtils.template(Ws,"file-path"),a=this.hoganUtils.template(tL,"file"),s=this.hoganUtils.template(nL,pa(e));return r.render({file:e,fileHtmlId:ha(e),diffs:n,filePath:i.render({fileDiffName:ri(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(Ws,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:pt})}generateFileHtml(e){let n=ua(ca(r=>an(r.content,e.isCombined).content));return e.blocks.map(r=>{let i=this.hoganUtils.render(Ws,"block-header",{CSSLineClass:pt,blockHeader:e.isTooBig?r.header:_r(r.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=an(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:pt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(` +`)}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===De.CONTEXT?n.push([[s],[],[]]):s.type===De.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===De.INSERT&&r.length>0?i.push(s):s.type===De.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` +`);return this.hoganUtils.render(Xs,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(rL,"file-diff"),i=this.hoganUtils.template(Xs,"file-path"),a=this.hoganUtils.template(iL,"file"),s=this.hoganUtils.template(aL,pa(e));return r.render({file:e,fileHtmlId:ha(e),diffs:n,filePath:i.render({fileDiffName:ri(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Xs,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:pt})}}generateFileHtml(e){let n=ua(ca(r=>an(r.content,e.isCombined).content));return e.blocks.map(r=>{let i={left:this.makeHeaderHtml(r.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=an(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:pt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:pt.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((r,i)=>({left:r.left+i.left,right:r.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===De.CONTEXT?n.push([[s],[],[]]):s.type===De.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===De.INSERT&&r.length>0?i.push(s):s.type===De.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(r.rp("'),r.b(r.v(r.f("fileName",t,e,0))),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(r.v(r.f("addedLines",t,e,0))),r.b(""),r.b(` +`+n),r.b(' '),r.b(r.v(r.f("deletedLines",t,e,0))),r.b(""),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{"'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' Files changed ('),r.b(r.v(r.f("filesNumber",t,e,0))),r.b(")"),r.b(` +`+n),r.b(' hide'),r.b(` +`+n),r.b(' show'),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("files",t,e,0))),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-block-header"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
'),r.s(r.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),r.s(r.f("blockHeader",t,e,1),t,e,1,0,0,"")||r.b(" "),r.b("
"),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-empty-diff"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(" File without changes"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-file-path"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(''),r.b(` +`+n),r.b(r.rp("'),r.b(r.v(r.f("fileDiffName",t,e,0))),r.b(""),r.b(` +`+n),r.b(r.rp(""),r.b(` +`+n),r.b('"),r.fl()},partials:{""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("lineNumber",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.s(r.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("prefix",i,a,0))),s.b(""),s.b(` +`+n)}),t.pop()),r.s(r.f("prefix",t,e,1),t,e,1,0,0,"")||(r.b('  '),r.b(` +`+n)),r.s(r.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("content",i,a,0))),s.b(""),s.b(` +`+n)}),t.pop()),r.s(r.f("content",t,e,1),t,e,1,0,0,"")||(r.b('
'),r.b(` +`+n)),r.b("
"),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-wrapper"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("content",t,e,0))),r.b(` +`+n),r.b("
"),r.fl()},partials:{},subs:{}});Xe["icon-file-added"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file-changed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file-deleted"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file-renamed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["line-by-line-file-diff"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("diffs",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.fl()},partials:{},subs:{}});Xe["line-by-line-numbers"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(r.v(r.f("oldNumber",t,e,0))),r.b("
"),r.b(` +`+n),r.b('
'),r.b(r.v(r.f("newNumber",t,e,0))),r.b("
"),r.fl()},partials:{},subs:{}});Xe["side-by-side-file-diff"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.d("diffs.left",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.d("diffs.right",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.fl()},partials:{},subs:{}});Xe["tag-file-added"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('ADDED'),r.fl()},partials:{},subs:{}});Xe["tag-file-changed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('CHANGED'),r.fl()},partials:{},subs:{}});Xe["tag-file-deleted"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('DELETED'),r.fl()},partials:{},subs:{}});Xe["tag-file-renamed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('RENAMED'),r.fl()},partials:{},subs:{}});var Zs=class{constructor({compiledTemplates:e={},rawTemplates:n={}}){let r=Object.entries(n).reduce((i,[a,s])=>{let o=kp.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Xe),e),r)}static compile(e){return kp.compile(e,{asString:!1})}render(e,n,r,i,a){let s=this.templateKey(e,n);try{return this.preCompiledTemplates[s].render(r,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,n){return this.preCompiledTemplates[this.templateKey(e,n)]}templateKey(e,n){return`${e}-${n}`}};var oL=Object.assign(Object.assign(Object.assign({},bp),xp),{outputFormat:KS.LINE_BY_LINE,drawFileList:!0});function yE(t,e={}){let n=Object.assign(Object.assign({},oL),e),r=typeof t=="string"?aE(t,n):t,i=new Zs(n),{colorScheme:a}=n,s={colorScheme:a},o=n.drawFileList?new Pc(i,s).render(r):"",l=n.outputFormat==="side-by-side"?new Ys(i,n).render(r):new qs(i,n).render(r);return o+l}var Lc=require("obsidian");var ma=class extends Lc.ItemView{constructor(n,r){super(n);this.plugin=r;this.gettingDiff=!1;this.gitRefreshBind=this.refresh.bind(this);this.gitViewRefreshBind=this.refresh.bind(this);this.parser=new DOMParser,this.navigation=!0,addEventListener("git-refresh",this.gitRefreshBind),addEventListener("git-view-refresh",this.gitViewRefreshBind)}getViewType(){return Tt.type}getDisplayText(){var n;if(((n=this.state)==null?void 0:n.file)!=null){let r=this.state.file.split("/").last();return r!=null&&r.endsWith(".md")&&(r=r.slice(0,-3)),Tt.name+` (${r})`}return Tt.name}getIcon(){return Tt.icon}async setState(n,r){this.state=n,Lc.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return removeEventListener("git-refresh",this.gitRefreshBind),removeEventListener("git-view-refresh",this.gitViewRefreshBind),super.onClose()}onOpen(){return this.refresh(),super.onOpen()}async refresh(){var n;if((n=this.state)!=null&&n.file&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let r=await this.plugin.gitManager.getDiffString(this.state.file,this.state.staged,this.state.hash);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.file);if(!r){if(this.plugin.gitManager instanceof Oe&&await this.plugin.gitManager.isTracked(this.state.file))r=[`--- ${this.state.file}`,`+++ ${this.state.file}`,""].join(` +`);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);r=[...`--- /dev/null ++++ ${this.state.file} +@@ -0,0 +1,${a.split(` +`).length} @@`.split(` +`),...a.split(` +`).map(o=>`+${o}`)].join(` +`)}}if(r){let a=this.parser.parseFromString(yE(r),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(a)}else{let a=this.contentEl.createDiv({cls:"obsidian-git-center"});a.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),a.createEl("br"),a.createSpan({text:"File not found: "+this.state.file})}}finally{this.gettingDiff=!1}}}};v();var ZE=require("obsidian");v();v();v();v();function Fe(){}var Ks=t=>t;function Ap(t){return t()}function jc(){return Object.create(null)}function Se(t){t.forEach(Ap)}function ga(t){return typeof t=="function"}function ut(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function vE(t){return Object.keys(t).length===0}v();var wE=typeof window!="undefined",Tp=wE?()=>window.performance.now():()=>Date.now(),Qs=wE?t=>requestAnimationFrame(t):Fe;v();var ya=new Set;function bE(t){ya.forEach(e=>{e.c(t)||(ya.delete(e),e.f())}),ya.size!==0&&Qs(bE)}function Cp(t){let e;return ya.size===0&&Qs(bE),{promise:new Promise(n=>{ya.add(e={c:t,f:n})}),abort(){ya.delete(e)}}}v();v();v();v();var Fp=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Dc=class t{constructor(e){ot(this,"_listeners","WeakMap"in Fp?new WeakMap:void 0);ot(this,"_observer");ot(this,"options");this.options=e}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(n=>{var r;for(let i of n)t.entries.set(i.target,i),(r=this._listeners.get(i.target))==null||r(i)})}};Dc.entries="WeakMap"in Fp?new WeakMap:void 0;var xE=!1;function _E(){xE=!0}function SE(){xE=!1}function O(t,e){t.appendChild(e)}function jt(t,e,n){let r=Bc(t);if(!r.getElementById(e)){let i=R("style");i.id=e,i.textContent=n,kE(r,i)}}function Bc(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function EE(t){let e=R("style");return e.textContent="/* empty */",kE(Bc(t),e),e.sheet}function kE(t,e){return O(t.head||t,e),e.sheet}function ae(t,e,n){t.insertBefore(e,n||null)}function ne(t){t.parentNode&&t.parentNode.removeChild(t)}function sn(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function be(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function A(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function AE(t){return Array.from(t.childNodes)}function Ie(t,e){e=""+e,t.data!==e&&(t.data=e)}function Mp(t,e){t.value=e==null?"":e}function Xt(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function oe(t,e,n){t.classList.toggle(e,!!n)}function Nc(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function TE(t){let e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}var $c=new Map,Hc=0;function cL(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function uL(t,e){let n={stylesheet:EE(e),rules:{}};return $c.set(t,n),n}function Uc(t,e,n,r,i,a,s,o=0){let l=16.666/r,c=`{ +`;for(let g=0;g<=1;g+=l){let w=e+(n-e)*a(g);c+=g*100+`%{${s(w,1-w)}} +`}let u=c+`100% {${s(n,1-n)}} +}`,f=`__svelte_${cL(u)}_${o}`,d=Bc(t),{stylesheet:h,rules:p}=$c.get(d)||uL(d,t);p[f]||(p[f]=!0,h.insertRule(`@keyframes ${f} ${u}`,h.cssRules.length));let m=t.style.animation||"";return t.style.animation=`${m?`${m}, `:""}${f} ${r}ms linear ${i}ms 1 both`,Hc+=1,f}function Op(t,e){let n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Hc-=i,Hc||fL())}function fL(){Qs(()=>{Hc||($c.forEach(t=>{let{ownerNode:e}=t.stylesheet;e&&ne(e)}),$c.clear())})}v();v();v();v();var Sr;function Xn(t){Sr=t}function CE(){if(!Sr)throw new Error("Function called outside component initialization");return Sr}function Js(t){CE().$$.on_destroy.push(t)}function Er(t,e){let n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}var ii=[];var Pe=[],wa=[],FE=[],dL=Promise.resolve(),Pp=!1;function ME(){Pp||(Pp=!0,dL.then(zc))}function wt(t){wa.push(t)}var Ip=new Set,va=0;function zc(){if(va!==0)return;let t=Sr;do{try{for(;vat.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),wa=e}var eo;function pL(){return eo||(eo=Promise.resolve(),eo.then(()=>{eo=null})),eo}function Rp(t,e,n){t.dispatchEvent(Nc(`${e?"intro":"outro"}${n}`))}var Gc=new Set,Yn;function Ee(){Yn={r:0,c:[],p:Yn}}function ke(){Yn.r||Se(Yn.c),Yn=Yn.p}function G(t,e){t&&t.i&&(Gc.delete(t),t.i(e))}function Z(t,e,n,r){if(t&&t.o){if(Gc.has(t))return;Gc.add(t),Yn.c.push(()=>{Gc.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}var mL={duration:0};function bt(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,l=null,c=null,u;function f(){c&&Op(t,c)}function d(p,m){let g=p.b-s;return m*=Math.abs(g),{a:s,b:p.b,d:g,duration:m,start:p.start,end:p.start+m,group:p.group}}function h(p){let{delay:m=0,duration:g=300,easing:w=Ks,tick:b=Fe,css:x}=a||mL,E={start:Tp()+m,b:p};p||(E.group=Yn,Yn.r+=1),"inert"in t&&(p?u!==void 0&&(t.inert=u):(u=t.inert,t.inert=!0)),o||l?l=E:(x&&(f(),c=Uc(t,s,p,g,m,w,x)),p&&b(0,1),o=d(E,g),wt(()=>Rp(t,p,"start")),Cp(_=>{if(l&&_>l.start&&(o=d(l,g),l=null,Rp(t,o.b,"start"),x&&(f(),c=Uc(t,s,o.b,o.duration,0,w,a.css))),o){if(_>=o.end)b(s=o.b,1-s),Rp(t,o.b,"end"),l||(o.b?f():--o.group.r||Se(o.group.c)),o=null;else if(_>=o.start){let T=_-o.start;s=o.a+o.d*w(T/o.duration),b(s,1-s)}}return!!(o||l)}))}return{run(p){ga(a)?pL().then(()=>{a=a({direction:p?"in":"out"}),h(p)}):h(p)},end(){f(),o=l=null}}}v();function Ye(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}v();v();v();var gL=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],yL=new Set([...gL]);v();v();function nt(t){t&&t.c()}function Ke(t,e,n){let{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),wt(()=>{let a=t.$$.on_mount.map(Ap).filter(ga);t.$$.on_destroy?t.$$.on_destroy.push(...a):Se(a),t.$$.on_mount=[]}),i.forEach(wt)}function Qe(t,e){let n=t.$$;n.fragment!==null&&(OE(n.after_update),Se(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function wL(t,e){t.$$.dirty[0]===-1&&(ii.push(t),ME(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let p=h.length?h[0]:d;return c.ctx&&i(c.ctx[f],c.ctx[f]=p)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](p),u&&wL(t,f)),d}):[],c.update(),u=!0,Se(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){_E();let f=AE(e.target);c.fragment&&c.fragment.l(f),f.forEach(ne)}else c.fragment&&c.fragment.c();e.intro&&G(t.$$.fragment),Ke(t,e.target,e.anchor),SE(),zc()}Xn(l)}var bL;typeof HTMLElement=="function"&&(bL=class extends HTMLElement{constructor(e,n,r){super();ot(this,"$$ctor");ot(this,"$$s");ot(this,"$$c");ot(this,"$$cn",!1);ot(this,"$$d",{});ot(this,"$$r",!1);ot(this,"$$p_d",{});ot(this,"$$l",{});ot(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(e,n,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(n),this.$$c){let i=this.$$c.$on(e,n);this.$$l_u.set(n,i)}super.addEventListener(e,n,r)}removeEventListener(e,n,r){if(super.removeEventListener(e,n,r),this.$$c){let i=this.$$l_u.get(n);i&&(i(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(a){return()=>{let s;return{c:function(){s=R("slot"),a!=="default"&&A(s,"name",a)},m:function(c,u){ae(c,s,u)},d:function(c){c&&ne(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let n={},r=TE(this);for(let a of this.$$s)a in r&&(n[a]=[e(a)]);for(let a of this.attributes){let s=this.$$g_p(a.name);s in this.$$d||(this.$$d[s]=Lp(s,a.value,this.$$p_d,"toProp"))}for(let a in this.$$p_d)!(a in this.$$d)&&this[a]!==void 0&&(this.$$d[a]=this[a],delete this[a]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$scope:{ctx:[]}}});let i=()=>{this.$$r=!0;for(let a in this.$$p_d)if(this.$$d[a]=this.$$c.$$.ctx[this.$$c.$$.props[a]],this.$$p_d[a].reflect){let s=Lp(a,this.$$d[a],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,s)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(let a in this.$$l)for(let s of this.$$l[a]){let o=this.$$c.$on(a,s);this.$$l_u.set(s,o)}this.$$l={}}}attributeChangedCallback(e,n,r){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Lp(e,r,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(n=>this.$$p_d[n].attribute===e||!this.$$p_d[n].attribute&&n.toLowerCase()===e)||e}});function Lp(t,e,n,r){var a;let i=(a=n[t])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(i){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(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Ze=class{constructor(){ot(this,"$$");ot(this,"$$set")}$destroy(){Qe(this,1),this.$destroy=Fe}$on(e,n){if(!ga(n))return Fe;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!vE(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};v();v();var IE="4";v();typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(IE);v();function ba(t,e,n,r){function i(a){return a instanceof n?a:new n(function(s){s(a)})}return new(n||(n=Promise))(function(a,s){function o(u){try{c(r.next(u))}catch(f){s(f)}}function l(u){try{c(r.throw(u))}catch(f){s(f)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((r=r.apply(t,e||[])).next())})}var qc=require("obsidian");v();v();var to=require("obsidian");v();v();function PE(t){let e=t-1;return e*e*e+1}function xt(t,{delay:e=0,duration:n=400,easing:r=PE,axis:i="y"}={}){let a=getComputedStyle(t),s=+a.opacity,o=i==="y"?"height":"width",l=parseFloat(a[o]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),f=parseFloat(a[`padding${u[0]}`]),d=parseFloat(a[`padding${u[1]}`]),h=parseFloat(a[`margin${u[0]}`]),p=parseFloat(a[`margin${u[1]}`]),m=parseFloat(a[`border${u[0]}Width`]),g=parseFloat(a[`border${u[1]}Width`]);return{delay:e,duration:n,easing:r,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${o}: ${w*l}px;padding-${c[0]}: ${w*f}px;padding-${c[1]}: ${w*d}px;margin-${c[0]}: ${w*h}px;margin-${c[1]}: ${w*p}px;border-${c[0]}-width: ${w*m}px;border-${c[1]}-width: ${w*g}px;`}}v();var xa=require("obsidian");function xL(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function RE(t){let e,n,r;return{c(){e=R("div"),A(e,"data-icon","go-to-file"),A(e,"aria-label","Open File"),A(e,"class","clickable-icon")},m(i,a){ae(i,e,a),t[7](e),n||(r=[te(e,"auxclick",be(t[4])),te(e,"click",be(t[4]))],n=!0)},p:Fe,d(i){i&&ne(e),t[7](null),n=!1,Se(r)}}}function _L(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof xa.TFile,u,f,d=t[0].status+"",h,p,m,g,w,b,x=c&&RE(t);return{c(){var E,_;e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("div"),x&&x.c(),u=J(),f=R("span"),h=Ce(d),A(r,"class","tree-item-inner nav-file-title-content"),A(l,"class","buttons"),A(f,"class","type"),A(f,"data-type",p=t[0].status),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",m=t[0].vault_path),A(n,"data-tooltip-position",t[3]),A(n,"aria-label",g=t[0].vault_path),oe(n,"is-active",((E=t[1].plugin.lastDiffViewState)==null?void 0:E.file)==t[0].vault_path&&((_=t[1].plugin.lastDiffViewState)==null?void 0:_.hash)),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(E,_){ae(E,e,_),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),x&&x.m(l,null),O(o,u),O(o,f),O(f,h),w||(b=[te(e,"click",be(t[5])),te(e,"auxclick",be(t[8])),te(e,"focus",t[6])],w=!0)},p(E,[_]){var T,y;_&1&&i!==(i=Lt(E[0].vault_path)+"")&&Ie(a,i),_&3&&(c=E[1].app.vault.getAbstractFileByPath(E[0].vault_path)instanceof xa.TFile),c?x?x.p(E,_):(x=RE(E),x.c(),x.m(l,null)):x&&(x.d(1),x=null),_&1&&d!==(d=E[0].status+"")&&Ie(h,d),_&1&&p!==(p=E[0].status)&&A(f,"data-type",p),_&1&&m!==(m=E[0].vault_path)&&A(n,"data-path",m),_&8&&A(n,"data-tooltip-position",E[3]),_&1&&g!==(g=E[0].vault_path)&&A(n,"aria-label",g),_&3&&oe(n,"is-active",((T=E[1].plugin.lastDiffViewState)==null?void 0:T.file)==E[0].vault_path&&((y=E[1].plugin.lastDiffViewState)==null?void 0:y.hash))},i:Fe,o:Fe,d(E){E&&ne(e),x&&x.d(),w=!1,Se(b)}}}function SL(t,e,n){let r,{diff:i}=e,{view:a}=e,s=[];window.setTimeout(()=>s.forEach(d=>(0,xa.setIcon)(d,d.getAttr("data-icon"))),0);function o(d){var h;let p=a.app.vault.getAbstractFileByPath(i.vault_path);p instanceof xa.TFile&&((h=qt(d))===null||h===void 0||h.openFile(p))}function l(d){var h;(h=qt(d))===null||h===void 0||h.setViewState({type:Tt.type,active:!0,state:{file:i.path,staged:!1,hash:i.hash}})}function c(d){Er.call(this,t,d)}function u(d){Pe[d?"unshift":"push"](()=>{s[0]=d,n(2,s)})}let f=d=>{d.button==2?Fn(a.app,d,i.vault_path,a.leaf,"git-history"):l(d)};return t.$$set=d=>{"diff"in d&&n(0,i=d.diff),"view"in d&&n(1,a=d.view)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,r,o,l,c,u,f]}var jp=class extends Ze{constructor(e){super(),ft(this,e,SL,_L,ut,{diff:0,view:1},xL)}},Vc=jp;v();function EL(t){jt(t,"svelte-1lnl15d","main.svelte-1lnl15d .nav-folder-title-content.svelte-1lnl15d{display:flex;align-items:center}")}function LE(t,e,n){let r=t.slice();return r[8]=e[n],r}function kL(t){let e,n,r,i,a,s,o,l=t[8].title+"",c,u,f,d,h,p,m;function g(){return t[7](t[8])}let w=!t[4][t[8].title]&&jE(t);return{c(){e=R("div"),n=R("div"),r=R("div"),i=J(),a=R("div"),a.innerHTML='',s=J(),o=R("div"),c=Ce(l),f=J(),w&&w.c(),d=J(),A(r,"data-icon","folder"),Xt(r,"padding-right","5px"),Xt(r,"display","flex"),A(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(a,"is-collapsed",t[4][t[8].title]),A(o,"class","tree-item-inner nav-folder-title-content svelte-1lnl15d"),A(n,"class","tree-item-self is-clickable nav-folder-title"),A(n,"data-tooltip-position",t[5]),A(n,"aria-label",u=t[8].vaultPath),A(e,"class","tree-item nav-folder"),oe(e,"is-collapsed",t[4][t[8].title])},m(b,x){ae(b,e,x),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,f),w&&w.m(e,null),O(e,d),h=!0,p||(m=te(n,"click",g),p=!0)},p(b,x){t=b,(!h||x&17)&&oe(a,"is-collapsed",t[4][t[8].title]),(!h||x&1)&&l!==(l=t[8].title+"")&&Ie(c,l),(!h||x&32)&&A(n,"data-tooltip-position",t[5]),(!h||x&1&&u!==(u=t[8].vaultPath))&&A(n,"aria-label",u),t[4][t[8].title]?w&&(Ee(),Z(w,1,1,()=>{w=null}),ke()):w?(w.p(t,x),x&17&&G(w,1)):(w=jE(t),w.c(),G(w,1),w.m(e,d)),(!h||x&17)&&oe(e,"is-collapsed",t[4][t[8].title])},i(b){h||(G(w),h=!0)},o(b){Z(w),h=!1},d(b){b&&ne(e),w&&w.d(),p=!1,m()}}}function AL(t){let e,n,r,i;return n=new Vc({props:{diff:t[8].data,view:t[2]}}),{c(){e=R("div"),nt(n.$$.fragment),r=J()},m(a,s){ae(a,e,s),Ke(n,e,null),O(e,r),i=!0},p(a,s){let o={};s&1&&(o.diff=a[8].data),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(G(n.$$.fragment,a),i=!0)},o(a){Z(n.$$.fragment,a),i=!1},d(a){a&&ne(e),Qe(n)}}}function jE(t){let e,n,r,i;return n=new Wc({props:{hierarchy:t[8],plugin:t[1],view:t[2]}}),{c(){e=R("div"),nt(n.$$.fragment),A(e,"class","tree-item-children nav-folder-children")},m(a,s){ae(a,e,s),Ke(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[8]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(G(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){Z(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Qe(n),a&&r&&r.end()}}}function DE(t){let e,n,r,i,a=[AL,kL],s=[];function o(l,c){return l[8].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=In()},m(l,c){s[e].m(l,c),ae(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ee(),Z(s[u],1,1,()=>{s[u]=null}),ke(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),G(n,1),n.m(r.parentNode,r))},i(l){i||(G(n),i=!0)},o(l){Z(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function TL(t){let e,n,r=Ye(t[0].children),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){e=R("main");for(let s=0;sc(f);return t.$$set=f=>{"hierarchy"in f&&n(0,i=f.hierarchy),"plugin"in f&&n(1,a=f.plugin),"view"in f&&n(2,s=f.view),"topLevel"in f&&n(3,o=f.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(5,r=s.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,o,l,r,c,u]}var Wc=class extends Ze{constructor(e){super(),ft(this,e,CL,TL,ut,{hierarchy:0,plugin:1,view:2,topLevel:3},EL)}},BE=Wc;function NE(t,e,n){let r=t.slice();return r[9]=e[n],r}function $E(t){let e,n=t[0].refs.join(", ")+"",r;return{c(){e=R("div"),r=Ce(n),A(e,"class","git-ref")},m(i,a){ae(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[0].refs.join(", ")+"")&&Ie(r,n)},d(i){i&&ne(e)}}}function HE(t){let e,n=t[7](t[0])+"",r;return{c(){e=R("div"),r=Ce(n),A(e,"class","git-author")},m(i,a){ae(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[7](i[0])+"")&&Ie(r,n)},d(i){i&&ne(e)}}}function UE(t){let e,n=(0,to.moment)(t[0].date).format(t[3].settings.commitDateFormat)+"",r;return{c(){e=R("div"),r=Ce(n),A(e,"class","git-date")},m(i,a){ae(i,e,a),O(e,r)},p(i,a){a&9&&n!==(n=(0,to.moment)(i[0].date).format(i[3].settings.commitDateFormat)+"")&&Ie(r,n)},d(i){i&&ne(e)}}}function zE(t){let e,n,r,i,a,s=[ML,FL],o=[];function l(c,u){return c[2]?0:1}return n=l(t,-1),r=o[n]=s[n](t),{c(){e=R("div"),r.c(),A(e,"class","tree-item-children nav-folder-children")},m(c,u){ae(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function FL(t){let e,n,r=Ye(t[0].diff.files),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s0&&$E(t),x=t[3].settings.authorInHistoryView!="hide"&&((T=t[0].author)==null?void 0:T.name)&&HE(t),E=t[3].settings.dateInHistoryView&&UE(t),_=!t[4]&&zE(t);return{c(){var y;e=R("main"),n=R("div"),r=R("div"),i=R("div"),i.innerHTML='',a=J(),s=R("div"),b&&b.c(),o=J(),x&&x.c(),l=J(),E&&E.c(),c=J(),u=R("div"),d=Ce(f),p=J(),_&&_.c(),A(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(i,"is-collapsed",t[4]),A(u,"class","tree-item-inner nav-folder-title-content"),A(r,"class","tree-item-self is-clickable nav-folder-title"),A(r,"aria-label",h=`${t[0].refs.length>0?t[0].refs.join(", ")+` +`:""}${(y=t[0].author)==null?void 0:y.name} +${(0,to.moment)(t[0].date).format(t[3].settings.commitDateFormat)} +${t[0].message}`),A(r,"data-tooltip-position",t[5]),A(n,"class","tree-item nav-folder"),oe(n,"is-collapsed",t[4])},m(y,S){ae(y,e,S),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),b&&b.m(s,null),O(s,o),x&&x.m(s,null),O(s,l),E&&E.m(s,null),O(s,c),O(s,u),O(u,d),O(n,p),_&&_.m(n,null),m=!0,g||(w=te(r,"click",t[8]),g=!0)},p(y,[S]){var k,C;(!m||S&16)&&oe(i,"is-collapsed",y[4]),y[0].refs.length>0?b?b.p(y,S):(b=$E(y),b.c(),b.m(s,o)):b&&(b.d(1),b=null),y[3].settings.authorInHistoryView!="hide"&&((k=y[0].author)!=null&&k.name)?x?x.p(y,S):(x=HE(y),x.c(),x.m(s,l)):x&&(x.d(1),x=null),y[3].settings.dateInHistoryView?E?E.p(y,S):(E=UE(y),E.c(),E.m(s,c)):E&&(E.d(1),E=null),(!m||S&1)&&f!==(f=y[0].message+"")&&Ie(d,f),(!m||S&9&&h!==(h=`${y[0].refs.length>0?y[0].refs.join(", ")+` +`:""}${(C=y[0].author)==null?void 0:C.name} +${(0,to.moment)(y[0].date).format(y[3].settings.commitDateFormat)} +${y[0].message}`))&&A(r,"aria-label",h),(!m||S&32)&&A(r,"data-tooltip-position",y[5]),y[4]?_&&(Ee(),Z(_,1,1,()=>{_=null}),ke()):_?(_.p(y,S),S&16&&G(_,1)):(_=zE(y),_.c(),G(_,1),_.m(n,null)),(!m||S&16)&&oe(n,"is-collapsed",y[4])},i(y){m||(G(_),m=!0)},o(y){Z(_),m=!1},d(y){y&&ne(e),b&&b.d(),x&&x.d(),E&&E.d(),_&&_.d(),g=!1,w()}}}function IL(t,e,n){let r,i,{log:a}=e,{view:s}=e,{showTree:o}=e,{plugin:l}=e,c=!0;function u(d){let h=d.author.name;if(l.settings.authorInHistoryView=="full")return h;if(l.settings.authorInHistoryView=="initials")return h.split(" ").filter(m=>m.length>0).map(m=>m[0].toUpperCase()).join("")}let f=()=>n(4,c=!c);return t.$$set=d=>{"log"in d&&n(0,a=d.log),"view"in d&&n(1,s=d.view),"showTree"in d&&n(2,o=d.showTree),"plugin"in d&&n(3,l=d.plugin)},t.$$.update=()=>{t.$$.dirty&9&&n(6,r={title:"",path:"",vaultPath:"",children:l.gitManager.getTreeStructure(a.diff.files)}),t.$$.dirty&2&&n(5,i=s.leaf.getRoot().side=="left"?"right":"left")},[a,s,o,l,c,i,r,u,f]}var Dp=class extends Ze{constructor(e){super(),ft(this,e,IL,OL,ut,{log:0,view:1,showTree:2,plugin:3})}},VE=Dp;function WE(t,e,n){let r=t.slice();return r[11]=e[n],r}function qE(t){let e,n,r=Ye(t[6]),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){e=R("div");for(let s=0;s{d=null}),ke())},i(h){c||(G(d),c=!0)},o(h){Z(d),c=!1},d(h){h&&ne(e),t[7](null),t[9](null),d&&d.d(),u=!1,Se(f)}}}function RL(){dispatchEvent(new CustomEvent("git-refresh"))}function LL(t,e,n){let{plugin:r}=e,{view:i}=e,a,s=[],o,l=r.settings.treeStructure,c;addEventListener("git-view-refresh",u),u(),r.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{s.forEach(p=>(0,qc.setIcon)(p,p.getAttr("data-icon"))),(0,qc.setIcon)(c,l?"list":"folder")},0)}),Js(()=>{removeEventListener("git-view-refresh",u)});function u(){return ba(this,void 0,void 0,function*(){if(!r.gitReady){n(6,o=void 0);return}n(4,a=!0);let p=r.gitManager instanceof Oe;n(6,o=yield r.gitManager.log(void 0,!1,p?50:10)),n(4,a=!1)})}function f(p){Pe[p?"unshift":"push"](()=>{c=p,n(3,c)})}let d=()=>{n(2,l=!l),n(0,r.settings.treeStructure=l,r),r.saveSettings()};function h(p){Pe[p?"unshift":"push"](()=>{s[6]=p,n(5,s)})}return t.$$set=p=>{"plugin"in p&&n(0,r=p.plugin),"view"in p&&n(1,i=p.view)},t.$$.update=()=>{t.$$.dirty&12&&c&&(c.empty(),(0,qc.setIcon)(c,l?"list":"folder"))},[r,i,l,c,a,s,o,f,d,h]}var Bp=class extends Ze{constructor(e){super(),ft(this,e,LL,PL,ut,{plugin:0,view:1})}},YE=Bp;var no=class extends ZE.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return fn.type}getDisplayText(){return fn.name}getIcon(){return fn.icon}onClose(){return super.onClose()}onOpen(){return this._view=new YE({target:this.contentEl,props:{plugin:this.plugin,view:this}}),super.onOpen()}};v();var KE=require("obsidian"),Xc=class extends KE.FuzzySuggestModal{constructor(n){super(app);this.branches=n;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(n){return n}onChooseItem(n,r){this.resolve(n)}open(){return super.open(),new Promise(n=>{this.resolve=n})}async onClose(){await new Promise(n=>setTimeout(n,10)),this.resolve&&this.resolve(void 0)}};v();var wk=require("obsidian");v();var Ea=require("obsidian");v();var QE=require("obsidian"),kr=class extends QE.Modal{constructor(n,r,i){super(n);this.deletion=r;this.filename=i;this.resolve=null}myOpen(){return this.open(),new Promise(n=>{this.resolve=n})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText(`${this.deletion?"Delete":"Discard"} this file?`),n.createEl("p").setText(`Do you really want to ${this.deletion?"delete":"discard the changes of"} "${this.filename}"`);let i=n.createDiv({cls:"modal-button-container"}),a=i.createEl("button",{cls:"mod-warning",text:this.deletion?"Delete":"Discard"});a.addEventListener("click",async()=>{this.resolve&&this.resolve(!0),this.close()}),a.addEventListener("keypress",async()=>{this.resolve&&this.resolve(!0),this.close()});let s=i.createEl("button",{text:"Cancel"});s.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),s.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:n}=this;n.empty()}};v();var _a=require("obsidian");v();v();var jL=Ve(JE()),Ar=require("obsidian");function ai(t,e,n){let r=t.target;app.workspace.trigger("hover-link",{event:t,source:e.getViewType(),hoverParent:e,targetEl:r,linktext:n})}function DL(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function ek(t){let e,n,r;return{c(){e=R("div"),A(e,"data-icon","go-to-file"),A(e,"aria-label","Open File"),A(e,"class","clickable-icon")},m(i,a){ae(i,e,a),t[11](e),n||(r=[te(e,"auxclick",be(t[5])),te(e,"click",be(t[5]))],n=!0)},p:Fe,d(i){i&&ne(e),t[11](null),n=!1,Se(r)}}}function BL(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof _a.TFile,u,f,d,h,p,m,g=t[0].working_dir+"",w,b,x,E,_,T,y=c&&ek(t);return{c(){var S,k,C;e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("div"),y&&y.c(),u=J(),f=R("div"),d=J(),h=R("div"),p=J(),m=R("div"),w=Ce(g),A(r,"class","tree-item-inner nav-file-title-content"),A(f,"data-icon","undo"),A(f,"aria-label","Discard"),A(f,"class","clickable-icon"),A(h,"data-icon","plus"),A(h,"aria-label","Stage"),A(h,"class","clickable-icon"),A(l,"class","buttons"),A(m,"class","type"),A(m,"data-type",b=t[0].working_dir),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",x=t[0].vault_path),A(n,"data-tooltip-position",t[3]),A(n,"aria-label",E=t[0].vault_path),oe(n,"is-active",((S=t[1].plugin.lastDiffViewState)==null?void 0:S.file)==t[0].vault_path&&!((k=t[1].plugin.lastDiffViewState)!=null&&k.hash)&&!((C=t[1].plugin.lastDiffViewState)!=null&&C.staged)),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(S,k){ae(S,e,k),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),y&&y.m(l,null),O(l,u),O(l,f),t[12](f),O(l,d),O(l,h),t[13](h),O(o,p),O(o,m),O(m,w),_||(T=[te(f,"click",be(t[8])),te(h,"click",be(t[6])),te(e,"mouseover",t[4]),te(e,"click",be(t[7])),te(e,"auxclick",be(t[14])),te(e,"focus",t[10])],_=!0)},p(S,[k]){var C,M,P;k&1&&i!==(i=Lt(S[0].vault_path)+"")&&Ie(a,i),k&3&&(c=S[1].app.vault.getAbstractFileByPath(S[0].vault_path)instanceof _a.TFile),c?y?y.p(S,k):(y=ek(S),y.c(),y.m(l,u)):y&&(y.d(1),y=null),k&1&&g!==(g=S[0].working_dir+"")&&Ie(w,g),k&1&&b!==(b=S[0].working_dir)&&A(m,"data-type",b),k&1&&x!==(x=S[0].vault_path)&&A(n,"data-path",x),k&8&&A(n,"data-tooltip-position",S[3]),k&1&&E!==(E=S[0].vault_path)&&A(n,"aria-label",E),k&3&&oe(n,"is-active",((C=S[1].plugin.lastDiffViewState)==null?void 0:C.file)==S[0].vault_path&&!((M=S[1].plugin.lastDiffViewState)!=null&&M.hash)&&!((P=S[1].plugin.lastDiffViewState)!=null&&P.staged))},i:Fe,o:Fe,d(S){S&&ne(e),y&&y.d(),t[12](null),t[13](null),_=!1,Se(T)}}}function NL(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(b=>(0,_a.setIcon)(b,b.getAttr("data-icon"))),0);function l(b){a.app.vault.getAbstractFileByPath(i.vault_path)&&ai(b,a,i.vault_path)}function c(b){var x;let E=a.app.vault.getAbstractFileByPath(i.vault_path);E instanceof _a.TFile&&((x=qt(b))===null||x===void 0||x.openFile(E))}function u(){s.stage(i.path,!1).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})}function f(b){var x;(x=qt(b))===null||x===void 0||x.setViewState({type:Tt.type,active:!0,state:{file:i.path,staged:!1}})}function d(){let b=i.working_dir=="U";new kr(a.app,b,i.vault_path).myOpen().then(x=>{x===!0&&(b?a.app.vault.adapter.remove(i.vault_path).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))}):s.discard(i.path).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))}))})}function h(b){Er.call(this,t,b)}function p(b){Pe[b?"unshift":"push"](()=>{o[1]=b,n(2,o)})}function m(b){Pe[b?"unshift":"push"](()=>{o[0]=b,n(2,o)})}function g(b){Pe[b?"unshift":"push"](()=>{o[2]=b,n(2,o)})}let w=b=>{b.button==2?Fn(a.app,b,i.vault_path,a.leaf,"git-source-control"):f(b)};return t.$$set=b=>{"change"in b&&n(0,i=b.change),"view"in b&&n(1,a=b.view),"manager"in b&&n(9,s=b.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,d,s,h,p,m,g,w]}var $p=class extends Ze{constructor(e){super(),ft(this,e,NL,BL,ut,{change:0,view:1,manager:9},DL)}},Yc=$p;v();var tk=require("obsidian");function $L(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function HL(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[0].working_dir+"",u,f,d,h,p,m;return{c(){e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("span"),u=Ce(c),A(r,"class","tree-item-inner nav-file-title-content"),A(l,"class","type"),A(l,"data-type",f=t[0].working_dir),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",d=t[0].vault_path),A(n,"data-tooltip-position",t[2]),A(n,"aria-label",h=t[0].vault_path),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(g,w){ae(g,e,w),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),O(l,u),p||(m=[te(e,"mouseover",t[3]),te(e,"click",be(t[4])),te(e,"auxclick",be(t[6])),te(e,"focus",t[5])],p=!0)},p(g,[w]){w&1&&i!==(i=Lt(g[0].vault_path)+"")&&Ie(a,i),w&1&&c!==(c=g[0].working_dir+"")&&Ie(u,c),w&1&&f!==(f=g[0].working_dir)&&A(l,"data-type",f),w&1&&d!==(d=g[0].vault_path)&&A(n,"data-path",d),w&4&&A(n,"data-tooltip-position",g[2]),w&1&&h!==(h=g[0].vault_path)&&A(n,"aria-label",h)},i:Fe,o:Fe,d(g){g&&ne(e),p=!1,Se(m)}}}function UL(t,e,n){let r,{change:i}=e,{view:a}=e;function s(u){app.vault.getAbstractFileByPath(i.vault_path)&&ai(u,a,i.vault_path)}function o(u){var f;let d=a.app.vault.getAbstractFileByPath(i.vault_path);d instanceof tk.TFile&&((f=qt(u))===null||f===void 0||f.openFile(d))}function l(u){Er.call(this,t,u)}let c=u=>{u.button==2?Fn(a.app,u,i.vault_path,a.leaf,"git-source-control"):o(u)};return t.$$set=u=>{"change"in u&&n(0,i=u.change),"view"in u&&n(1,a=u.view)},t.$$.update=()=>{t.$$.dirty&2&&n(2,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,r,s,o,l,c]}var Hp=class extends Ze{constructor(e){super(),ft(this,e,UL,HL,ut,{change:0,view:1},$L)}},Zc=Hp;v();var Sa=require("obsidian");function zL(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function nk(t){let e,n,r;return{c(){e=R("div"),A(e,"data-icon","go-to-file"),A(e,"aria-label","Open File"),A(e,"class","clickable-icon")},m(i,a){ae(i,e,a),t[10](e),n||(r=te(e,"click",be(t[5])),n=!0)},p:Fe,d(i){i&&ne(e),t[10](null),n=!1,r()}}}function GL(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof Sa.TFile,u,f,d,h,p=t[0].index+"",m,g,w,b,x,E,_=c&&nk(t);return{c(){var T,y,S;e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("div"),_&&_.c(),u=J(),f=R("div"),d=J(),h=R("div"),m=Ce(p),A(r,"class","tree-item-inner nav-file-title-content"),A(f,"data-icon","minus"),A(f,"aria-label","Unstage"),A(f,"class","clickable-icon"),A(l,"class","buttons"),A(h,"class","type"),A(h,"data-type",g=t[0].index),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",w=t[0].vault_path),A(n,"data-tooltip-position",t[3]),A(n,"aria-label",b=t[0].vault_path),oe(n,"is-active",((T=t[1].plugin.lastDiffViewState)==null?void 0:T.file)==t[0].vault_path&&!((y=t[1].plugin.lastDiffViewState)!=null&&y.hash)&&((S=t[1].plugin.lastDiffViewState)==null?void 0:S.staged)),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(T,y){ae(T,e,y),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),_&&_.m(l,null),O(l,u),O(l,f),t[11](f),O(o,d),O(o,h),O(h,m),x||(E=[te(f,"click",be(t[7])),te(e,"mouseover",t[4]),te(e,"focus",t[9]),te(e,"click",be(t[6])),te(e,"auxclick",be(t[12]))],x=!0)},p(T,[y]){var S,k,C;y&1&&i!==(i=Lt(T[0].vault_path)+"")&&Ie(a,i),y&3&&(c=T[1].app.vault.getAbstractFileByPath(T[0].vault_path)instanceof Sa.TFile),c?_?_.p(T,y):(_=nk(T),_.c(),_.m(l,u)):_&&(_.d(1),_=null),y&1&&p!==(p=T[0].index+"")&&Ie(m,p),y&1&&g!==(g=T[0].index)&&A(h,"data-type",g),y&1&&w!==(w=T[0].vault_path)&&A(n,"data-path",w),y&8&&A(n,"data-tooltip-position",T[3]),y&1&&b!==(b=T[0].vault_path)&&A(n,"aria-label",b),y&3&&oe(n,"is-active",((S=T[1].plugin.lastDiffViewState)==null?void 0:S.file)==T[0].vault_path&&!((k=T[1].plugin.lastDiffViewState)!=null&&k.hash)&&((C=T[1].plugin.lastDiffViewState)==null?void 0:C.staged))},i:Fe,o:Fe,d(T){T&&ne(e),_&&_.d(),t[11](null),x=!1,Se(E)}}}function VL(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(g=>(0,Sa.setIcon)(g,g.getAttr("data-icon"))),0);function l(g){a.app.vault.getFileByPath(i.vault_path)&&ai(g,a,i.vault_path)}function c(g){var w;let b=a.app.vault.getAbstractFileByPath(i.vault_path);b instanceof Sa.TFile&&((w=qt(g))===null||w===void 0||w.openFile(b))}function u(g){var w;(w=qt(g))===null||w===void 0||w.setViewState({type:Tt.type,active:!0,state:{file:i.path,staged:!0}})}function f(){s.unstage(i.path,!1).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})}function d(g){Er.call(this,t,g)}function h(g){Pe[g?"unshift":"push"](()=>{o[1]=g,n(2,o)})}function p(g){Pe[g?"unshift":"push"](()=>{o[0]=g,n(2,o)})}let m=g=>{g.button==2?Fn(a.app,g,i.vault_path,a.leaf,"git-source-control"):u(g)};return t.$$set=g=>{"change"in g&&n(0,i=g.change),"view"in g&&n(1,a=g.view),"manager"in g&&n(8,s=g.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,s,d,h,p,m]}var Up=class extends Ze{constructor(e){super(),ft(this,e,VL,GL,ut,{change:0,view:1,manager:8},zL)}},Kc=Up;v();function qL(t){jt(t,"svelte-hup5mn","main.svelte-hup5mn .nav-folder-title.svelte-hup5mn{align-items:center}")}function rk(t,e,n){let r=t.slice();return r[16]=e[n],r}function XL(t){let e,n,r,i,a,s,o,l=t[16].title+"",c,u,f,d,h,p,m,g,w,b,x,E;function _(M,P){return M[3]==0?KL:ZL}let T=_(t,-1),y=T(t),S=!t[5][t[16].title]&&ik(t);function k(){return t[14](t[16])}function C(...M){return t[15](t[16],...M)}return{c(){e=R("div"),n=R("div"),r=R("div"),i=J(),a=R("div"),a.innerHTML='',s=J(),o=R("div"),c=Ce(l),u=J(),f=R("div"),d=R("div"),y.c(),h=J(),p=R("div"),g=J(),S&&S.c(),w=J(),A(r,"data-icon","folder"),Xt(r,"padding-right","5px"),Xt(r,"display","flex"),A(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(a,"is-collapsed",t[5][t[16].title]),A(o,"class","tree-item-inner nav-folder-title-content"),Xt(p,"width","11px"),A(d,"class","buttons"),A(f,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-folder-title svelte-hup5mn"),A(n,"data-tooltip-position",t[6]),A(n,"aria-label",m=t[16].vaultPath),A(e,"class","tree-item nav-folder"),oe(e,"is-collapsed",t[5][t[16].title])},m(M,P){ae(M,e,P),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(n,u),O(n,f),O(f,d),y.m(d,null),O(d,h),O(d,p),O(e,g),S&&S.m(e,null),O(e,w),b=!0,x||(E=[te(e,"click",be(k)),te(e,"auxclick",be(C))],x=!0)},p(M,P){t=M,(!b||P&33)&&oe(a,"is-collapsed",t[5][t[16].title]),(!b||P&1)&&l!==(l=t[16].title+"")&&Ie(c,l),T===(T=_(t,P))&&y?y.p(t,P):(y.d(1),y=T(t),y&&(y.c(),y.m(d,h))),(!b||P&64)&&A(n,"data-tooltip-position",t[6]),(!b||P&1&&m!==(m=t[16].vaultPath))&&A(n,"aria-label",m),t[5][t[16].title]?S&&(Ee(),Z(S,1,1,()=>{S=null}),ke()):S?(S.p(t,P),P&33&&G(S,1)):(S=ik(t),S.c(),G(S,1),S.m(e,w)),(!b||P&33)&&oe(e,"is-collapsed",t[5][t[16].title])},i(M){b||(G(S),b=!0)},o(M){Z(S),b=!1},d(M){M&&ne(e),y.d(),S&&S.d(),x=!1,Se(E)}}}function YL(t){let e,n,r,i,a,s=[ej,JL,QL],o=[];function l(c,u){return c[3]==0?0:c[3]==1?1:c[3]==2?2:-1}return~(n=l(t,-1))&&(r=o[n]=s[n](t)),{c(){e=R("div"),r&&r.c(),i=J()},m(c,u){ae(c,e,u),~n&&o[n].m(e,null),O(e,i),a=!0},p(c,u){let f=n;n=l(c,u),n===f?~n&&o[n].p(c,u):(r&&(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke()),~n?(r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,i)):r=null)},i(c){a||(G(r),a=!0)},o(c){Z(r),a=!1},d(c){c&&ne(e),~n&&o[n].d()}}}function ZL(t){let e,n,r,i,a;function s(){return t[12](t[16])}function o(){return t[13](t[16])}return{c(){e=R("div"),e.innerHTML='',n=J(),r=R("div"),r.innerHTML='',A(e,"data-icon","undo"),A(e,"aria-label","Discard"),A(e,"class","clickable-icon"),A(r,"data-icon","plus"),A(r,"aria-label","Stage"),A(r,"class","clickable-icon")},m(l,c){ae(l,e,c),ae(l,n,c),ae(l,r,c),i||(a=[te(e,"click",be(s)),te(r,"click",be(o))],i=!0)},p(l,c){t=l},d(l){l&&(ne(e),ne(n),ne(r)),i=!1,Se(a)}}}function KL(t){let e,n,r;function i(){return t[11](t[16])}return{c(){e=R("div"),e.innerHTML='',A(e,"data-icon","minus"),A(e,"aria-label","Unstage"),A(e,"class","clickable-icon")},m(a,s){ae(a,e,s),n||(r=te(e,"click",be(i)),n=!0)},p(a,s){t=a},d(a){a&&ne(e),n=!1,r()}}}function ik(t){let e,n,r,i;return n=new Qc({props:{hierarchy:t[16],plugin:t[1],view:t[2],fileType:t[3]}}),{c(){e=R("div"),nt(n.$$.fragment),A(e,"class","tree-item-children nav-folder-children")},m(a,s){ae(a,e,s),Ke(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[16]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),s&8&&(o.fileType=a[3]),n.$set(o)},i(a){i||(G(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){Z(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Qe(n),a&&r&&r.end()}}}function QL(t){let e,n;return e=new Zc({props:{change:t[16].data,view:t[2]}}),{c(){nt(e.$$.fragment)},m(r,i){Ke(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[16].data),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(G(e.$$.fragment,r),n=!0)},o(r){Z(e.$$.fragment,r),n=!1},d(r){Qe(e,r)}}}function JL(t){let e,n;return e=new Yc({props:{change:t[16].data,manager:t[1].gitManager,view:t[2]}}),{c(){nt(e.$$.fragment)},m(r,i){Ke(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[16].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(G(e.$$.fragment,r),n=!0)},o(r){Z(e.$$.fragment,r),n=!1},d(r){Qe(e,r)}}}function ej(t){let e,n;return e=new Kc({props:{change:t[16].data,manager:t[1].gitManager,view:t[2]}}),{c(){nt(e.$$.fragment)},m(r,i){Ke(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[16].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(G(e.$$.fragment,r),n=!0)},o(r){Z(e.$$.fragment,r),n=!1},d(r){Qe(e,r)}}}function ak(t){let e,n,r,i,a=[YL,XL],s=[];function o(l,c){return l[16].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=In()},m(l,c){s[e].m(l,c),ae(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ee(),Z(s[u],1,1,()=>{s[u]=null}),ke(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),G(n,1),n.m(r.parentNode,r))},i(l){i||(G(n),i=!0)},o(l){Z(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function tj(t){let e,n,r=Ye(t[0].children),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){e=R("main");for(let s=0;s{dispatchEvent(new CustomEvent("git-refresh"))})}function f(x){a.gitManager.unstageAll({dir:x}).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})}function d(x){new kr(s.app,!1,x.vaultPath).myOpen().then(E=>{E===!0&&a.gitManager.discardAll({dir:x.path,status:a.cachedStatus}).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})})}function h(x){n(5,c[x.title]=!c[x.title],c)}let p=x=>f(x.path),m=x=>d(x),g=x=>u(x.path),w=x=>h(x),b=(x,E)=>Fn(s.app,E,x.vaultPath,s.leaf,"git-source-control");return t.$$set=x=>{"hierarchy"in x&&n(0,i=x.hierarchy),"plugin"in x&&n(1,a=x.plugin),"view"in x&&n(2,s=x.view),"fileType"in x&&n(3,o=x.fileType),"topLevel"in x&&n(4,l=x.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(6,r=s.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,o,l,c,r,u,f,d,h,p,m,g,w,b]}var Qc=class extends Ze{constructor(e){super(),ft(this,e,nj,tj,ut,{hierarchy:0,plugin:1,view:2,fileType:3,topLevel:4},qL)}},Jc=Qc;function rj(t){jt(t,"svelte-11adhly",`.commit-msg-input.svelte-11adhly.svelte-11adhly{width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field)}.git-commit-msg.svelte-11adhly.svelte-11adhly{position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto}main.svelte-11adhly .git-tools .files-count.svelte-11adhly{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}.nav-folder-title.svelte-11adhly.svelte-11adhly{align-items:center}.git-commit-msg-clear-button.svelte-11adhly.svelte-11adhly{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-11adhly.svelte-11adhly: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 sk(t,e,n){let r=t.slice();return r[40]=e[n],r}function ok(t,e,n){let r=t.slice();return r[40]=e[n],r}function lk(t,e,n){let r=t.slice();return r[45]=e[n],r}function ck(t){let e,n,r,i;return{c(){e=R("div"),A(e,"class","git-commit-msg-clear-button svelte-11adhly"),A(e,"aria-label",n="Clear")},m(a,s){ae(a,e,s),r||(i=te(e,"click",t[33]),r=!0)},p:Fe,d(a){a&&ne(e),r=!1,i()}}}function uk(t){let e,n,r,i,a,s,o,l,c,u,f,d,h=t[6].staged.length+"",p,m,g,w,b,x,E,_,T,y,S,k,C,M,P,$,j=t[6].changed.length+"",Q,le,de,re,Ae,he,H=t[13]&&fk(t),U=t[12]&&hk(t),D=t[7].length>0&&mk(t);return{c(){e=R("div"),n=R("div"),r=R("div"),i=R("div"),i.innerHTML='',a=J(),s=R("div"),s.textContent="Staged Changes",o=J(),l=R("div"),c=R("div"),u=R("div"),u.innerHTML='',f=J(),d=R("div"),p=Ce(h),m=J(),H&&H.c(),g=J(),w=R("div"),b=R("div"),x=R("div"),x.innerHTML='',E=J(),_=R("div"),_.textContent="Changes",T=J(),y=R("div"),S=R("div"),k=R("div"),k.innerHTML='',C=J(),M=R("div"),M.innerHTML='',P=J(),$=R("div"),Q=Ce(j),le=J(),U&&U.c(),de=J(),D&&D.c(),A(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(i,"is-collapsed",!t[13]),A(s,"class","tree-item-inner nav-folder-title-content"),A(u,"data-icon","minus"),A(u,"aria-label","Unstage"),A(u,"class","clickable-icon"),A(c,"class","buttons"),A(d,"class","files-count svelte-11adhly"),A(l,"class","git-tools"),A(r,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),A(n,"class","staged tree-item nav-folder"),oe(n,"is-collapsed",!t[13]),A(x,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(x,"is-collapsed",!t[12]),A(_,"class","tree-item-inner nav-folder-title-content"),A(k,"data-icon","undo"),A(k,"aria-label","Discard"),A(k,"class","clickable-icon"),A(M,"data-icon","plus"),A(M,"aria-label","Stage"),A(M,"class","clickable-icon"),A(S,"class","buttons"),A($,"class","files-count svelte-11adhly"),A(y,"class","git-tools"),A(b,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),A(w,"class","changes tree-item nav-folder"),oe(w,"is-collapsed",!t[12]),A(e,"class","tree-item nav-folder mod-root")},m(se,_e){ae(se,e,_e),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),O(r,o),O(r,l),O(l,c),O(c,u),t[34](u),O(l,f),O(l,d),O(d,p),O(n,m),H&&H.m(n,null),O(e,g),O(e,w),O(w,b),O(b,x),O(b,E),O(b,_),O(b,T),O(b,y),O(y,S),O(S,k),O(S,C),O(S,M),t[36](M),O(y,P),O(y,$),O($,Q),O(w,le),U&&U.m(w,null),O(e,de),D&&D.m(e,null),re=!0,Ae||(he=[te(u,"click",be(t[19])),te(r,"click",t[35]),te(k,"click",be(t[22])),te(M,"click",be(t[18])),te(b,"click",t[37])],Ae=!0)},p(se,_e){(!re||_e[0]&8192)&&oe(i,"is-collapsed",!se[13]),(!re||_e[0]&64)&&h!==(h=se[6].staged.length+"")&&Ie(p,h),se[13]?H?(H.p(se,_e),_e[0]&8192&&G(H,1)):(H=fk(se),H.c(),G(H,1),H.m(n,null)):H&&(Ee(),Z(H,1,1,()=>{H=null}),ke()),(!re||_e[0]&8192)&&oe(n,"is-collapsed",!se[13]),(!re||_e[0]&4096)&&oe(x,"is-collapsed",!se[12]),(!re||_e[0]&64)&&j!==(j=se[6].changed.length+"")&&Ie(Q,j),se[12]?U?(U.p(se,_e),_e[0]&4096&&G(U,1)):(U=hk(se),U.c(),G(U,1),U.m(w,null)):U&&(Ee(),Z(U,1,1,()=>{U=null}),ke()),(!re||_e[0]&4096)&&oe(w,"is-collapsed",!se[12]),se[7].length>0?D?(D.p(se,_e),_e[0]&128&&G(D,1)):(D=mk(se),D.c(),G(D,1),D.m(e,null)):D&&(Ee(),Z(D,1,1,()=>{D=null}),ke())},i(se){re||(G(H),G(U),G(D),re=!0)},o(se){Z(H),Z(U),Z(D),re=!1},d(se){se&&ne(e),t[34](null),H&&H.d(),t[36](null),U&&U.d(),D&&D.d(),Ae=!1,Se(he)}}}function fk(t){let e,n,r,i,a,s=[aj,ij],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=R("div"),r.c(),A(e,"class","tree-item-children nav-folder-children")},m(c,u){ae(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function ij(t){let e,n,r=Ye(t[6].staged),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function sj(t){let e,n,r=Ye(t[6].changed),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s',i=J(),a=R("div"),a.textContent="Recently Pulled Files",s=J(),o=R("span"),c=Ce(l),u=J(),p&&p.c(),A(r,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),A(a,"class","tree-item-inner nav-folder-title-content"),A(o,"class","tree-item-flair"),A(n,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),A(e,"class","pulled nav-folder"),oe(e,"is-collapsed",!t[14])},m(m,g){ae(m,e,g),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,u),p&&p.m(e,null),f=!0,d||(h=te(n,"click",t[38]),d=!0)},p(m,g){(!f||g[0]&128)&&l!==(l=m[7].length+"")&&Ie(c,l),m[14]?p?(p.p(m,g),g[0]&16384&&G(p,1)):(p=gk(m),p.c(),G(p,1),p.m(e,null)):p&&(Ee(),Z(p,1,1,()=>{p=null}),ke()),(!f||g[0]&16384)&&oe(e,"is-collapsed",!m[14])},i(m){f||(G(p),f=!0)},o(m){Z(p),f=!1},d(m){m&&ne(e),p&&p.d(),d=!1,h()}}}function gk(t){let e,n,r,i,a,s=[cj,lj],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=R("div"),r.c(),A(e,"class","tree-item-children nav-folder-children")},m(c,u){ae(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function lj(t){let e,n,r=Ye(t[7]),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s{j=null}),ke())},i(Q){C||(G(j),C=!0)},o(Q){Z(j),C=!1},d(Q){Q&&ne(e),t[23](null),t[24](null),t[25](null),t[26](null),t[27](null),t[28](null),t[29](null),t[31](null),$&&$.d(),j&&j.d(),M=!1,Se(P)}}}function Zn(){dispatchEvent(new CustomEvent("git-refresh"))}function fj(t,e,n){let r,{plugin:i}=e,{view:a}=e,s,o,l=[],c=i.settings.commitMessage,u=[],f,d,h,p=!0,m=!0,g=!0,w=i.settings.treeStructure,b;addEventListener("git-view-refresh",_),_(),i.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{u.forEach(X=>(0,Ea.setIcon)(X,X.getAttr("data-icon"))),(0,Ea.setIcon)(b,w?"list":"folder")},0)}),Js(()=>{removeEventListener("git-view-refresh",_)});function x(){return ba(this,void 0,void 0,function*(){if(n(5,s=!0),o){if(yield i.tools.hasTooBigFiles(o.staged))return i.setState(0),!1;i.promiseQueue.addTask(()=>i.gitManager.commit({message:c}).then(()=>{c!==i.settings.commitMessage&&n(2,c=""),i.automaticsManager.setUpAutoCommitAndSync()}).finally(Zn))}})}function E(){return ba(this,void 0,void 0,function*(){n(5,s=!0),o&&i.promiseQueue.addTask(()=>i.commitAndSync(!1,!1,c).then(()=>{c!==i.settings.commitMessage&&n(2,c="")}).finally(Zn))})}function _(){return ba(this,void 0,void 0,function*(){if(!i.gitReady){n(6,o=void 0);return}let X=yield i.gitManager.getUnpushedCommits();if(u.forEach(Te=>{var Be,Je;Ea.Platform.isMobile?(Te.removeClass("button-border"),Te.id=="push"&&X>0&&Te.addClass("button-border")):((Be=Te.firstElementChild)===null||Be===void 0||Be.removeAttribute("color"),Te.id=="push"&&X>0&&((Je=Te.firstElementChild)===null||Je===void 0||Je.setAttr("color","var(--text-accent)")))}),n(6,o=i.cachedStatus),i.lastPulledFiles&&i.lastPulledFiles!=l&&(n(7,l=i.lastPulledFiles),n(11,h={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(l)})),o){let Te=(Be,Je)=>Be.vault_path.split("/").last().localeCompare(Lt(Je.vault_path));o.changed.sort(Te),o.staged.sort(Te),o.changed.length+o.staged.length>500?(n(6,o=void 0),i.loading||i.displayError("Too many changes to display")):(n(9,f={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.changed)}),n(10,d={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.staged)}))}else n(9,f=void 0),n(10,d=void 0);n(5,s=i.loading)})}function T(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.stageAll({status:o}).finally(Zn))}function y(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.unstageAll({status:o}).finally(Zn))}function S(){n(5,s=!0),i.promiseQueue.addTask(()=>i.push().finally(Zn))}function k(){n(5,s=!0),i.promiseQueue.addTask(()=>i.pullChangesFromRemote().finally(Zn))}function C(){new kr(a.app,!1,i.gitManager.getRelativeVaultPath("/")).myOpen().then(X=>{X===!0&&i.promiseQueue.addTask(()=>i.gitManager.discardAll({status:i.cachedStatus}).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))}))})}function M(X){Pe[X?"unshift":"push"](()=>{u[5]=X,n(8,u)})}function P(X){Pe[X?"unshift":"push"](()=>{u[0]=X,n(8,u)})}function $(X){Pe[X?"unshift":"push"](()=>{u[1]=X,n(8,u)})}function j(X){Pe[X?"unshift":"push"](()=>{u[2]=X,n(8,u)})}function Q(X){Pe[X?"unshift":"push"](()=>{u[3]=X,n(8,u)})}function le(X){Pe[X?"unshift":"push"](()=>{u[4]=X,n(8,u)})}function de(X){Pe[X?"unshift":"push"](()=>{b=X,n(4,b)})}let re=()=>{n(3,w=!w),n(0,i.settings.treeStructure=w,i),i.saveSettings()};function Ae(X){Pe[X?"unshift":"push"](()=>{u[6]=X,n(8,u)})}function he(){c=this.value,n(2,c)}let H=()=>n(2,c="");function U(X){Pe[X?"unshift":"push"](()=>{u[8]=X,n(8,u)})}let D=()=>n(13,m=!m);function se(X){Pe[X?"unshift":"push"](()=>{u[9]=X,n(8,u)})}let _e=()=>n(12,p=!p),mt=()=>n(14,g=!g);return t.$$set=X=>{"plugin"in X&&n(0,i=X.plugin),"view"in X&&n(1,a=X.view)},t.$$.update=()=>{t.$$.dirty[0]&24&&b&&(b.empty(),(0,Ea.setIcon)(b,w?"list":"folder")),t.$$.dirty[0]&4&&n(15,r=(c.match(/\n/g)||[]).length+1||1)},[i,a,c,w,b,s,o,l,u,f,d,h,p,m,g,r,x,E,T,y,S,k,C,M,P,$,j,Q,le,de,re,Ae,he,H,U,D,se,_e,mt]}var zp=class extends Ze{constructor(e){super(),ft(this,e,fj,uj,ut,{plugin:0,view:1},rj,[-1,-1])}},vk=zp;var io=class extends wk.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return ht.type}getDisplayText(){return ht.name}getIcon(){return ht.icon}onClose(){return super.onClose()}onOpen(){return this._view=new vk({target:this.contentEl,props:{plugin:this.plugin,view:this}}),super.onOpen()}};v();var eu=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(r=>{this.plugin.switchBranch()})}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()}};v();var bk=require("obsidian");var ao=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let n=await this.plugin.gitManager.branchInfo(),r=n.tracking?wr(n.tracking)[0]:null;if(r){let i=await this.plugin.gitManager.getRemoteUrl(r);if(i!=null&&i.includes("github.com")){let a=e.filter(s=>{let o=this.plugin.app.vault.getAbstractFileByPath(s.vault_path);return o instanceof bk.TFile?o.stat.size>=1e8:!1});if(a.length>0)return this.plugin.displayError(`Did not commit, because following files are too big: ${a.map(s=>s.vault_path)}. Please remove them.`),!0}}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(Vi,e);let n=!1;this.plugin.app.workspace.iterateAllLeaves(r=>{r.getDisplayText()!=""&&Vi.startsWith(r.getDisplayText())&&(n=!0)}),n||this.plugin.app.workspace.openLinkText(Vi,"/",!0)}};var tu=class extends xe.Plugin{constructor(){super(...arguments);this.tools=new ao(this);this.gitReady=!1;this.promiseQueue=new kc;this.offlineMode=!1;this.loading=!1;this.lineAuthoringFeature=new Ec(this)}setState(n){var r;this.state=n,(r=this.statusBar)==null||r.display()}async updateCachedStatus(){return this.cachedStatus=await this.gitManager.status(),this.cachedStatus}async refresh(){if(!this.gitReady)return;let n=this.app.workspace.getLeavesOfType(ht.type),r=this.app.workspace.getLeavesOfType(fn.type);(this.settings.changedFilesInStatusBar||n.length>0||r.length>0)&&(this.loading=!0,dispatchEvent(new CustomEvent("git-view-refresh")),await this.updateCachedStatus(),this.loading=!1,dispatchEvent(new CustomEvent("git-view-refresh")))}async refreshUpdatedHead(){this.lineAuthoringFeature.refreshLineAuthorViews()}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),$s.plugin=this,this.localStorage=new Mc(this),this.localStorage.migrate(),await this.loadSettings(),this.migrateSettings(),this.settingsTab=new uc(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||this.loadPlugin()}async loadPlugin(){if(addEventListener("git-refresh",this.refresh.bind(this)),addEventListener("git-head-update",this.refreshUpdatedHead.bind(this)),this.registerView(ht.type,n=>new io(n,this)),this.registerView(fn.type,n=>new no(n,this)),this.registerView(Tt.type,n=>new ma(n,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let n=this.app.workspace.getLeavesOfType(ht.type),r;n.length===0?(r=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await r.setViewState({type:ht.type})):r=n.first(),this.app.workspace.revealLeaf(r),dispatchEvent(new CustomEvent("git-refresh"))}),this.lineAuthoringFeature.onLoadPlugin(),this.registerHoverLinkSource(ht.type,{display:"Git View",defaultMod:!0}),this.setRefreshDebouncer(),ZS(this),this.registerEvent(this.app.workspace.on("file-menu",(n,r,i)=>{this.handleFileMenu(n,r,i)})),this.settings.showStatusBar){let n=this.addStatusBarItem();this.statusBar=new Ac(n,this),this.registerInterval(window.setInterval(()=>{var r;return(r=this.statusBar)==null?void 0:r.display()},1e3))}if(xe.Platform.isDesktop&&this.settings.showBranchStatusBar){let n=this.addStatusBarItem();this.branchBar=new eu(n,this),this.registerInterval(window.setInterval(()=>{var r;return(r=this.branchBar)==null?void 0:r.display()},6e4))}this.app.workspace.onLayoutReady(()=>this.init())}setRefreshDebouncer(){var n;(n=this.debRefresh)==null||n.cancel(),this.debRefresh=(0,xe.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh()},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(n){await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+this.gitManager.getRelativeRepoPath(n.path,!0)),this.refresh()}handleFileMenu(n,r,i){this.gitReady&&this.settings.showFileMenu&&r&&(this.settings.showFileMenu&&i=="file-explorer-context-menu"&&(n.addItem(a=>{a.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof xe.TFile?await this.gitManager.stage(r.path,!0):await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Staged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof xe.TFile?await this.gitManager.unstage(r.path,!0):await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Unstaged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r)})})),i=="git-source-control"&&n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r)})}))}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(){this.gitReady=!1,dispatchEvent(new CustomEvent("git-refresh")),this.lineAuthoringFeature.deactivateFeature(),this.automaticsManager.unload(),removeEventListener("git-refresh",this.refresh.bind(this)),removeEventListener("git-head-update",this.refreshUpdatedHead.bind(this)),this.app.workspace.offref(this.openEvent),this.app.metadataCache.offref(this.modifyEvent),this.app.metadataCache.offref(this.deleteEvent),this.app.metadataCache.offref(this.createEvent),this.app.metadataCache.offref(this.renameEvent),this.debRefresh.cancel()}async onunload(){this.app.workspace.unregisterHoverLinkSource(ht.type),this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let n=await this.loadData();n==null&&(n={showedMobileNotice:!0}),this.settings=m2(An,n)}async saveSettings(){var n;(n=this.settingsTab)==null||n.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return xe.Platform.isDesktopApp}async init(){var n;try{this.useSimpleGit?(this.gitManager=new Oe(this),await this.gitManager.setGitInstance()):this.gitManager=new pn(this);let r=await this.gitManager.checkRequirements();switch(r){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new xe.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":this.gitReady=!0,this.setState(0),this.openEvent=this.app.workspace.on("active-leaf-change",i=>this.handleViewActiveState(i)),this.modifyEvent=this.app.vault.on("modify",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.deleteEvent=this.app.vault.on("delete",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.createEvent=this.app.vault.on("create",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.renameEvent=this.app.vault.on("rename",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.registerEvent(this.modifyEvent),this.registerEvent(this.deleteEvent),this.registerEvent(this.createEvent),this.registerEvent(this.renameEvent),(n=this.branchBar)==null||n.display(),this.lineAuthoringFeature.conditionallyActivateBySettings(),dispatchEvent(new CustomEvent("git-refresh")),this.settings.autoPullOnBoot&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),this.automaticsManager=new Us(this),await this.automaticsManager.init();break;default:this.log("Something weird happened. The 'checkRequirements' result is "+r)}}catch(r){this.displayError(r),console.error(r)}}async createNewRepo(){await this.gitManager.init(),new xe.Notice("Initialized new repo"),await this.init()}async cloneNewRepo(){let r=await new ze({placeholder:"Enter remote URL"}).open();if(r){let i="Vault Root",a=await new ze({options:this.gitManager instanceof pn?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof pn}).open();if(a!==void 0){if(a===i&&(a="."),a=(0,xe.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new ze({options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.app.vault.configDir} directory at the root?`,onlySelection:!0}).open();if(f===void 0){new xe.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new ze({options:["Abort clone",d],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).open()===d)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new xe.Notice("Aborted clone");return}}}let s=await new ze({placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).open(),o;if(s!==""&&(o=parseInt(s),isNaN(o))){new xe.Notice("Invalid depth. Aborting clone.");return}new xe.Notice(`Cloning new repo into "${a}"`);let l=this.settings.basePath,c=a&&a!==".";c&&(this.settings.basePath=a);try{await this.gitManager.clone(r,a,o)}catch(u){throw this.settings.basePath=l,this.saveSettings(),u}new xe.Notice("Cloned new repo."),new xe.Notice("Please restart Obsidian"),c&&this.saveSettings()}}}async isAllInitialized(){return this.gitReady||await this.init(),this.gitReady}async pullChangesFromRemote(){if(!await this.isAllInitialized())return;let n=await this.pull();if(this.automaticsManager.setUpAutoCommitAndSync(),n!==!1){if(n||this.displayMessage("Everything is up-to-date"),this.gitManager instanceof Oe){let r=await this.gitManager.status();r.conflicted.length>0&&(this.displayError(`You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),this.handleConflict(r.conflicted))}dispatchEvent(new CustomEvent("git-refresh")),this.setState(0)}}async commitAndSync(n,r=!1,i){await this.isAllInitialized()&&(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),await this.commit({fromAuto:n,requestCustomMessage:r,commitMessage:i})&&(this.settings.disablePush||(await this.remotesAreSet()&&await this.gitManager.canPush()?(this.settings.syncMethod!="reset"&&this.settings.pullBeforePush&&await this.pull(),await this.push()):this.displayMessage("No changes to push")),this.setState(0)))}async commit({fromAuto:n,requestCustomMessage:r=!1,onlyStaged:i=!1,commitMessage:a,amend:s=!1}){if(!await this.isAllInitialized())return!1;let o=this.localStorage.getConflict(),l,c,u;if(this.gitManager instanceof Oe){if(this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),c.conflicted.length==0&&(this.localStorage.setConflict(!1),o=!1),n&&c.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${c.conflicted.length} ${c.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),this.handleConflict(c.conflicted),!1;l=[...c.changed,...c.staged]}else{if(n&&o)return this.setState(6),this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;o?(await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),l=[...c.changed,...c.staged]):i?l=await this.gitManager.getStagedFiles():(u=await this.gitManager.getUnstagedFiles(),l=u.map(({filepath:f})=>({vault_path:this.gitManager.getRelativeVaultPath(f)})))}if(await this.tools.hasTooBigFiles(l))return this.setState(0),!1;if(l.length!==0||o){let f=a!=null?a:a=n?this.settings.autoCommitMessage:this.settings.commitMessage;if(n&&this.settings.customMessageOnAutoBackup||r){!this.settings.disablePopups&&n&&new xe.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let p=await new Tc(this,!0).open();if(p!=null&&p!=""&&p!="...")f=p;else return this.setState(0),!1}let d;i?d=await this.gitManager.commit({message:f,amend:s}):d=await this.gitManager.commitAll({message:f,status:c,unstagedFiles:u,amend:s}),this.gitManager instanceof Oe&&(await this.updateCachedStatus()).conflicted.length==0&&this.localStorage.setConflict(!1);let h=!1;d===void 0&&(h=!0,d=l.length),this.automaticsManager.setUpAutoCommitAndSync(),this.displayMessage(`Committed${h?" approx.":""} ${d} ${d==1?"file":"files"}`)}else this.displayMessage("No changes to commit");return dispatchEvent(new CustomEvent("git-refresh")),this.setState(0),!0}async push(){if(!await this.isAllInitialized()||!await this.remotesAreSet())return!1;let n=this.localStorage.getConflict();this.gitManager instanceof Oe&&await this.mayDeleteConflictFile();let r;if(this.gitManager instanceof Oe&&(r=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),this.handleConflict(r.conflicted),!1;if(this.gitManager instanceof pn&&n)return this.displayError("Cannot push. You have conflicts"),this.setState(6),!1;this.log("Pushing....");let i=await this.gitManager.push();return i!==void 0&&(this.log("Pushed!",i),i>0?this.displayMessage(`Pushed ${i} ${i==1?"file":"files"} to remote`):this.displayMessage("No changes to push")),this.offlineMode=!1,this.setState(0),dispatchEvent(new CustomEvent("git-refresh")),!0}async pull(){if(!await this.remotesAreSet())return!1;let n=await this.gitManager.pull()||[];return this.offlineMode=!1,n.length>0&&(this.displayMessage(`Pulled ${n.length} ${n.length==1?"file":"files"} from remote`),this.lastPulledFiles=n),n.length}async fetch(){await this.remotesAreSet()&&(await this.gitManager.fetch(),this.displayMessage("Fetched from remote"),this.offlineMode=!1,dispatchEvent(new CustomEvent("git-refresh")))}async mayDeleteConflictFile(){let n=this.app.vault.getAbstractFileByPath(Vi);n&&(this.app.workspace.iterateAllLeaves(r=>{var i;r.view instanceof xe.MarkdownView&&((i=r.view.file)==null?void 0:i.path)==n.path&&r.detach()}),await this.app.vault.delete(n))}async stageFile(n){return await this.isAllInitialized()?(await this.gitManager.stage(n.path,!0),this.displayMessage(`Staged ${n.path}`),dispatchEvent(new CustomEvent("git-refresh")),this.setState(0),!0):!1}async unstageFile(n){return await this.isAllInitialized()?(await this.gitManager.unstage(n.path,!0),this.displayMessage(`Unstaged ${n.path}`),dispatchEvent(new CustomEvent("git-refresh")),this.setState(0),!0):!1}async switchBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo(),r=await new Xc(n.branches).open();if(r!=null)return await this.gitManager.checkout(r),this.displayMessage(`Switched to ${r}`),(i=this.branchBar)==null||i.display(),r}async switchRemoteBranch(){var a;if(!await this.isAllInitialized())return;let n=await this.selectRemoteBranch()||"",[r,i]=wr(n);if(i!=null&&r!=null)return await this.gitManager.checkout(i,r),this.displayMessage(`Switched to ${n}`),(a=this.branchBar)==null||a.display(),n}async createBranch(){var r;if(!await this.isAllInitialized())return;let n=await new ze({placeholder:"Create new branch"}).open();if(n!=null)return await this.gitManager.createBranch(n),this.displayMessage(`Created new branch ${n}`),(r=this.branchBar)==null||r.display(),n}async deleteBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo();n.current&&n.branches.remove(n.current);let r=await new ze({options:n.branches,placeholder:"Delete branch",onlySelection:!0}).open();if(r!=null){let a=!1;if(!await this.gitManager.branchIsMerged(r)){let o=await new ze({options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).open();if(o!=="YES")return;a=o==="YES"}return await this.gitManager.deleteBranch(r,a),this.displayMessage(`Deleted branch ${r}`),(i=this.branchBar)==null||i.display(),r}}async remotesAreSet(){return this.settings.updateSubmodules||(await this.gitManager.branchInfo()).tracking?!0:(new xe.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let n=await this.selectRemoteBranch();return n==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setState(0),!1):(await this.gitManager.updateUpstreamBranch(n),this.displayMessage(`Set upstream branch to ${n}`),this.setState(0),!0)}async discardAll(){await this.gitManager.discardAll({status:this.cachedStatus}),new xe.Notice("All local changes have been discarded. New files remain untouched.")}async handleConflict(n){this.setState(6),this.localStorage.setConflict(!0);let r;n!==void 0&&(r=["# 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","",...n.map(i=>{let a=this.app.vault.getAbstractFileByPath(i);return a instanceof xe.TFile?`- [[${this.app.metadataCache.fileToLinktext(a,"/")}]]`:`- Not a file: ${i}`}),` +# 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 +\`\`\``]),this.tools.writeAndOpenFile(r==null?void 0:r.join(` +`))}async editRemotes(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new ze({options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}).open();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new ze({initialValue:a}).open();if(o)return await this.gitManager.setRemote(i,o),i}}async selectRemoteBranch(){let n=await this.gitManager.getRemotes(),r;n.length===0&&(r=await this.editRemotes(),r==null&&(n=await this.gitManager.getRemotes()));let i=new ze({options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=r!=null?r:await i.open();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a);return await new ze({options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).open()}}async removeRemote(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new ze({options:n,placeholder:"Select a remote"}).open();i&&this.gitManager.removeRemote(i)}handleViewActiveState(n){var a,s;if(!(n!=null&&n.view.getState().file))return;let r=this.app.workspace.getLeavesOfType(ht.type).first(),i=this.app.workspace.getLeavesOfType(fn.type).first();if((a=r==null?void 0:r.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||a.removeClass("is-active"),(s=i==null?void 0:i.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||s.removeClass("is-active"),(n==null?void 0:n.view)instanceof ma){let o=n.view.state.file;this.lastDiffViewState=n.view.getState();let l;r&&n.view.state.staged?l=r.view.containerEl.querySelector(`div.staged div.nav-file-title[data-path='${o}']`):r&&n.view.state.staged===!1&&!n.view.state.hash?l=r.view.containerEl.querySelector(`div.changes div.nav-file-title[data-path='${o}']`):i&&n.view.state.hash&&(l=i.view.containerEl.querySelector(`div.nav-file-title[data-path='${o}']`)),l==null||l.addClass("is-active")}else this.lastDiffViewState=void 0}displayMessage(n,r=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(n.toLowerCase(),r),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!n.startsWith("No changes"))&&new xe.Notice(n,5*1e3),this.log(n)}displayError(n,r=10*1e3){var i;if(n instanceof cs.UserCanceledError){new xe.Notice("Aborted");return}n=n.toString(),new xe.Notice(n,r),this.log(`error: ${n}`),(i=this.statusBar)==null||i.displayMessage(n.toLowerCase(),r)}log(...n){console.log(`${this.manifest.id}:`,...n)}}; +/*! 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 *) + +js-sha256/src/sha256.js: + (** + * [js-sha256]{@link https://github.com/emn178/js-sha256} + * + * @version 0.9.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2017 + * @license MIT + *) + +feather-icons/dist/feather.js: + (*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames + *) +*/ diff --git a/.obsidian/plugins(1)/obsidian-git/manifest.json b/.obsidian/plugins(1)/obsidian-git/manifest.json new file mode 100644 index 0000000..3f4b1a2 --- /dev/null +++ b/.obsidian/plugins(1)/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.27.0" +} diff --git a/.obsidian/plugins(1)/obsidian-git/styles.css b/.obsidian/plugins(1)/obsidian-git/styles.css new file mode 100644 index 0000000..abe81d4 --- /dev/null +++ b/.obsidian/plugins(1)/obsidian-git/styles.css @@ -0,0 +1,566 @@ +@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: 0; +} + +.workspace-leaf-content[data-type="git-history-view"] .view-content { + padding: 0; +} + +.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; +} +.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 0; + height: auto; +} + +.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); +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-d-none { + display: none; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper { + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-header { + background-color: var(--background-primary); + border-bottom: 1px solid var(--interactive-accent); + font-family: var(--font-monospace); + height: 35px; + padding: 5px 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-header, +.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats { + display: -webkit-box; + display: -ms-flexbox; + display: flex; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats { + font-size: 14px; + margin-left: auto; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added { + border: 1px solid #b4e2b4; + border-radius: 5px 0 0 5px; + color: #399839; + padding: 2px; + text-align: right; + vertical-align: middle; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted { + border: 1px solid #e9aeae; + border-radius: 0 5px 5px 0; + color: #c33; + margin-left: 1px; + padding: 2px; + text-align: left; + vertical-align: middle; +} + +.workspace-leaf-content[data-type="diff-view"] .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%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-name { + overflow-x: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper { + border: 1px solid var(--background-modifier-border); + border-radius: 3px; + margin-bottom: 1em; +} + +.workspace-leaf-content[data-type="diff-view"] .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-modifier-border); + border-radius: 3px; + cursor: pointer; + display: none; + font-size: 12px; + justify-content: flex-end; + padding: 4px 8px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected { + background-color: #c8e1ff; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input { + margin: 0 4px 0 0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table { + border-collapse: collapse; + font-family: Menlo, Consolas, monospace; + font-size: 13px; + width: 100%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff { + width: 100%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff { + overflow-y: hidden; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff { + display: inline-block; + margin-bottom: -8px; + margin-right: -4px; + overflow-x: scroll; + overflow-y: hidden; + width: 50%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line { + padding: 0 8em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line, +.workspace-leaf-content[data-type="diff-view"] .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%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line { + padding: 0 4.5em; +} + +.workspace-leaf-content[data-type="diff-view"] .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; + white-space: pre; + width: 100%; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + del { + background-color: #ffb6ba; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + del { + background-color: #8d232881; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins { + border-radius: 0.2em; + display: inline-block; + margin-top: -1px; + text-decoration: none; + vertical-align: middle; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + ins { + background-color: #97f295; + text-align: left; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + ins { + background-color: #1d921996; + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix { + word-wrap: normal; + background: none; + display: inline; + padding: 0; + white-space: pre; +} + +.workspace-leaf-content[data-type="diff-view"] .line-num1 { + float: left; +} + +.workspace-leaf-content[data-type="diff-view"] .line-num1, +.workspace-leaf-content[data-type="diff-view"] .line-num2 { + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + padding: 0 0.5em; + text-overflow: ellipsis; + width: 3.5em; +} + +.workspace-leaf-content[data-type="diff-view"] .line-num2 { + float: right; +} + +.workspace-leaf-content[data-type="diff-view"] .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-muted); + cursor: pointer; + display: inline-block; + position: absolute; + text-align: right; + width: 7.5em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after { + content: "\200b"; +} + +.workspace-leaf-content[data-type="diff-view"] .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-muted); + cursor: pointer; + display: inline-block; + overflow: hidden; + padding: 0 0.5em; + position: absolute; + text-align: right; + text-overflow: ellipsis; + width: 4em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-diff-tbody tr { + position: relative; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after { + content: "\200b"; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder, +.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber, +.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber { + direction: rtl; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del { + background-color: #fee8e9; + border-color: #e9aeae; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins { + background-color: #dfd; + border-color: #b4e2b4; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del { + background-color: #521b1d83; + border-color: #691d1d73; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins { + background-color: rgba(30, 71, 30, 0.5); + border-color: #13501381; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-info { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + color: var(--text-normal); +} + +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-del.d2h-change { + background-color: #fdf2d0; +} + +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-del.d2h-change { + background-color: #55492480; +} + +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-ins.d2h-change { + background-color: #ded; +} + +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-ins.d2h-change { + background-color: rgba(37, 78, 37, 0.418); +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper { + margin-bottom: 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a { + color: #3572b0; + text-decoration: none; +} + +.workspace-leaf-content[data-type="diff-view"] + .d2h-file-list-wrapper + a:visited { + color: #3572b0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header { + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title { + font-weight: 700; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list { + display: block; + list-style: none; + margin: 0; + padding: 0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li { + border-bottom: 1px solid var(--background-modifier-border); + margin: 0; + padding: 5px 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child { + border-bottom: none; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch { + cursor: pointer; + display: none; + font-size: 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-icon { + fill: currentColor; + margin-right: 10px; + vertical-align: middle; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-deleted { + color: #c33; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-added { + color: #399839; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-changed { + color: #d0b44c; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-moved { + color: #3572b0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-tag { + background-color: var(--background-primary); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 10px; + margin-left: 5px; + padding: 0 2px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag { + border: 2px solid #c33; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag { + border: 1px solid #399839; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag { + border: 1px solid #d0b44c; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag { + border: 1px solid #3572b0; +} + +/* ====================== 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 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 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; + } +} diff --git a/.obsidian/plugins/obsidian-git/main.js b/.obsidian/plugins/obsidian-git/main.js index d0d2c09..008ca6e 100644 --- a/.obsidian/plugins/obsidian-git/main.js +++ b/.obsidian/plugins/obsidian-git/main.js @@ -3,32914 +3,144 @@ 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 __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; -var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; -}; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key2 of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key2) && key2 !== except) - __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); -var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value); - -// node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js -var require_base64_js = __commonJS({ - "node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - exports2.byteLength = byteLength; - exports2.toByteArray = toByteArray; - exports2.fromByteArray = fromByteArray; - var lookup = []; - var revLookup = []; - var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; - var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - for (i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; - } - var i; - var len; - revLookup["-".charCodeAt(0)] = 62; - revLookup["_".charCodeAt(0)] = 63; - function getLens(b64) { - var len2 = b64.length; - if (len2 % 4 > 0) { - throw new Error("Invalid string. Length must be a multiple of 4"); - } - var validLen = b64.indexOf("="); - if (validLen === -1) validLen = len2; - var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4; - return [validLen, placeHoldersLen]; - } - function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; - } - function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; - } - function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i2; - for (i2 = 0; i2 < len2; i2 += 4) { - tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)]; - arr[curByte++] = tmp >> 16 & 255; - arr[curByte++] = tmp >> 8 & 255; - arr[curByte++] = tmp & 255; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4; - arr[curByte++] = tmp & 255; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 255; - arr[curByte++] = tmp & 255; - } - return arr; - } - function tripletToBase64(num2) { - return lookup[num2 >> 18 & 63] + lookup[num2 >> 12 & 63] + lookup[num2 >> 6 & 63] + lookup[num2 & 63]; - } - function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for (var i2 = start; i2 < end; i2 += 3) { - tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255); - output.push(tripletToBase64(tmp)); - } - return output.join(""); - } - function fromByteArray(uint8) { - var tmp; - var len2 = uint8.length; - var extraBytes = len2 % 3; - var parts = []; - var maxChunkLength = 16383; - for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) { - parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength)); - } - if (extraBytes === 1) { - tmp = uint8[len2 - 1]; - parts.push( - lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==" - ); - } else if (extraBytes === 2) { - tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1]; - parts.push( - lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=" - ); - } - return parts.join(""); - } - } -}); - -// node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js -var require_ieee754 = __commonJS({ - "node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js"(exports2) { - init_polyfill_buffer(); - exports2.read = function(buffer2, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer2[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) { - } - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) { - } - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : (s ? -1 : 1) * Infinity; - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); - }; - exports2.write = function(buffer2, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) { - value += rt / c; - } else { - value += rt * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) { - } - e = e << mLen | m; - eLen += mLen; - for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) { - } - buffer2[offset + i - d] |= s * 128; - }; - } -}); - -// node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js -var require_buffer = __commonJS({ - "node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var base64 = require_base64_js(); - var ieee754 = require_ieee754(); - var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports2.Buffer = Buffer2; - exports2.SlowBuffer = SlowBuffer; - exports2.INSPECT_MAX_BYTES = 50; - var K_MAX_LENGTH = 2147483647; - exports2.kMaxLength = K_MAX_LENGTH; - Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer2.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 typedArraySupport() { - try { - const arr = new Uint8Array(1); - const proto = { foo: function() { - return 42; - } }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } - } - Object.defineProperty(Buffer2.prototype, "parent", { - enumerable: true, - get: function() { - if (!Buffer2.isBuffer(this)) return void 0; - return this.buffer; - } - }); - Object.defineProperty(Buffer2.prototype, "offset", { - enumerable: true, - get: function() { - if (!Buffer2.isBuffer(this)) return void 0; - return this.byteOffset; - } - }); - function createBuffer(length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"'); - } - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer2.prototype); - return buf; - } - function Buffer2(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - if (typeof encodingOrOffset === "string") { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ); - } - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); - } - Buffer2.poolSize = 8192; - function from(value, encodingOrOffset, length) { - if (typeof value === "string") { - return fromString2(value, encodingOrOffset); - } - if (ArrayBuffer.isView(value)) { - return fromArrayView(value); - } - if (value == null) { - throw new TypeError( - "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value - ); - } - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof value === "number") { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ); - } - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) { - return Buffer2.from(valueOf, encodingOrOffset, length); - } - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); - } - throw new TypeError( - "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value - ); - } - Buffer2.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); - }; - Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer2, Uint8Array); - function assertSize(size) { - if (typeof size !== "number") { - throw new TypeError('"size" argument must be of type number'); - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"'); - } - } - function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) { - return createBuffer(size); - } - if (fill !== void 0) { - return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - } - return createBuffer(size); - } - Buffer2.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); - }; - function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); - } - Buffer2.allocUnsafe = function(size) { - return allocUnsafe(size); - }; - Buffer2.allocUnsafeSlow = function(size) { - return allocUnsafe(size); - }; - function fromString2(string, encoding) { - if (typeof encoding !== "string" || encoding === "") { - encoding = "utf8"; - } - if (!Buffer2.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) { - buf = buf.slice(0, actual); - } - return buf; - } - function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for (let i = 0; i < length; i += 1) { - buf[i] = array[i] & 255; - } - return buf; - } - function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy2 = new Uint8Array(arrayView); - return fromArrayBuffer(copy2.buffer, copy2.byteOffset, copy2.byteLength); - } - return fromArrayLike(arrayView); - } - function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds'); - } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds'); - } - let buf; - if (byteOffset === void 0 && length === void 0) { - buf = new Uint8Array(array); - } else if (length === void 0) { - buf = new Uint8Array(array, byteOffset); - } else { - buf = new Uint8Array(array, byteOffset, length); - } - Object.setPrototypeOf(buf, Buffer2.prototype); - return buf; - } - function fromObject(obj) { - if (Buffer2.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) { - return buf; - } - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== void 0) { - if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { - return createBuffer(0); - } - return fromArrayLike(obj); - } - if (obj.type === "Buffer" && Array.isArray(obj.data)) { - return fromArrayLike(obj.data); - } - } - function checked(length) { - if (length >= K_MAX_LENGTH) { - throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); - } - return length | 0; - } - function SlowBuffer(length) { - if (+length != length) { - length = 0; - } - return Buffer2.alloc(+length); - } - Buffer2.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer2.prototype; - }; - Buffer2.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer2.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer2.from(b, b.offset, b.byteLength); - if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ); - } - if (a === b) return 0; - let x = a.length; - let y = b.length; - for (let i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) return -1; - if (y < x) return 1; - return 0; - }; - Buffer2.isEncoding = function isEncoding(encoding) { - switch (String(encoding).toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "latin1": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return true; - default: - return false; - } - }; - Buffer2.concat = function concat(list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } - if (list.length === 0) { - return Buffer2.alloc(0); - } - let i; - if (length === void 0) { - length = 0; - for (i = 0; i < list.length; ++i) { - length += list[i].length; - } - } - const buffer2 = Buffer2.allocUnsafe(length); - let pos = 0; - for (i = 0; i < list.length; ++i) { - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer2.length) { - if (!Buffer2.isBuffer(buf)) buf = Buffer2.from(buf); - buf.copy(buffer2, pos); - } else { - Uint8Array.prototype.set.call( - buffer2, - buf, - pos - ); - } - } else if (!Buffer2.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } else { - buf.copy(buffer2, pos); - } - pos += buf.length; - } - return buffer2; - }; - function byteLength(string, encoding) { - if (Buffer2.isBuffer(string)) { - return string.length; - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength; - } - if (typeof string !== "string") { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string - ); - } - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - let loweredCase = false; - for (; ; ) { - switch (encoding) { - case "ascii": - case "latin1": - case "binary": - return len; - case "utf8": - case "utf-8": - return utf8ToBytes(string).length; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return len * 2; - case "hex": - return len >>> 1; - case "base64": - return base64ToBytes(string).length; - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length; - } - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - } - Buffer2.byteLength = byteLength; - function slowToString(encoding, start, end) { - let loweredCase = false; - if (start === void 0 || start < 0) { - start = 0; - } - if (start > this.length) { - return ""; - } - if (end === void 0 || end > this.length) { - end = this.length; - } - if (end <= 0) { - return ""; - } - end >>>= 0; - start >>>= 0; - if (end <= start) { - return ""; - } - if (!encoding) encoding = "utf8"; - while (true) { - switch (encoding) { - case "hex": - return hexSlice(this, start, end); - case "utf8": - case "utf-8": - return utf8Slice(this, start, end); - case "ascii": - return asciiSlice(this, start, end); - case "latin1": - case "binary": - return latin1Slice(this, start, end); - case "base64": - return base64Slice(this, start, end); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return utf16leSlice(this, start, end); - default: - if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); - encoding = (encoding + "").toLowerCase(); - loweredCase = true; - } - } - } - Buffer2.prototype._isBuffer = true; - function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; - } - Buffer2.prototype.swap16 = function swap16() { - const len = this.length; - if (len % 2 !== 0) { - throw new RangeError("Buffer size must be a multiple of 16-bits"); - } - for (let i = 0; i < len; i += 2) { - swap(this, i, i + 1); - } - return this; - }; - Buffer2.prototype.swap32 = function swap32() { - const len = this.length; - if (len % 4 !== 0) { - throw new RangeError("Buffer size must be a multiple of 32-bits"); - } - for (let i = 0; i < len; i += 4) { - swap(this, i, i + 3); - swap(this, i + 1, i + 2); - } - return this; - }; - Buffer2.prototype.swap64 = function swap64() { - const len = this.length; - if (len % 8 !== 0) { - throw new RangeError("Buffer size must be a multiple of 64-bits"); - } - for (let i = 0; i < len; i += 8) { - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); - } - return this; - }; - Buffer2.prototype.toString = function toString() { - const length = this.length; - if (length === 0) return ""; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); - }; - Buffer2.prototype.toLocaleString = Buffer2.prototype.toString; - Buffer2.prototype.equals = function equals3(b) { - if (!Buffer2.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); - if (this === b) return true; - return Buffer2.compare(this, b) === 0; - }; - Buffer2.prototype.inspect = function inspect() { - let str = ""; - const max = exports2.INSPECT_MAX_BYTES; - str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); - if (this.length > max) str += " ... "; - return ""; - }; - if (customInspectSymbol) { - Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect; - } - Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer2.from(target, target.offset, target.byteLength); - } - if (!Buffer2.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target - ); - } - if (start === void 0) { - start = 0; - } - if (end === void 0) { - end = target ? target.length : 0; - } - if (thisStart === void 0) { - thisStart = 0; - } - if (thisEnd === void 0) { - thisEnd = this.length; - } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError("out of range index"); - } - if (thisStart >= thisEnd && start >= end) { - return 0; - } - if (thisStart >= thisEnd) { - return -1; - } - if (start >= end) { - return 1; - } - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for (let i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; - } - } - if (x < y) return -1; - if (y < x) return 1; - return 0; - }; - function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) { - if (buffer2.length === 0) return -1; - if (typeof byteOffset === "string") { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 2147483647) { - byteOffset = 2147483647; - } else if (byteOffset < -2147483648) { - byteOffset = -2147483648; - } - byteOffset = +byteOffset; - if (numberIsNaN(byteOffset)) { - byteOffset = dir ? 0 : buffer2.length - 1; - } - if (byteOffset < 0) byteOffset = buffer2.length + byteOffset; - if (byteOffset >= buffer2.length) { - if (dir) return -1; - else byteOffset = buffer2.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - if (typeof val === "string") { - val = Buffer2.from(val, encoding); - } - if (Buffer2.isBuffer(val)) { - if (val.length === 0) { - return -1; - } - return arrayIndexOf(buffer2, val, byteOffset, encoding, dir); - } else if (typeof val === "number") { - val = val & 255; - if (typeof Uint8Array.prototype.indexOf === "function") { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer2, val, byteOffset); - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset); - } - } - return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir); - } - throw new TypeError("val must be string, number or Buffer"); - } - function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== void 0) { - encoding = String(encoding).toLowerCase(); - if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { - if (arr.length < 2 || val.length < 2) { - return -1; - } - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i2) { - if (indexSize === 1) { - return buf[i2]; - } else { - return buf.readUInt16BE(i2 * indexSize); - } - } - let i; - if (dir) { - let foundIndex = -1; - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for (i = byteOffset; i >= 0; i--) { - let found = true; - for (let j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - } - if (found) return i; - } - } - return -1; - } - Buffer2.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; - }; - Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); - }; - Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); - }; - function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) { - length = remaining; - } else { - length = Number(length); - if (length > remaining) { - length = remaining; - } - } - const strLen = string.length; - if (length > strLen / 2) { - length = strLen / 2; - } - let i; - for (i = 0; i < length; ++i) { - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; - } - return i; - } - function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); - } - function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); - } - function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); - } - function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); - } - Buffer2.prototype.write = function write(string, offset, length, encoding) { - if (offset === void 0) { - encoding = "utf8"; - length = this.length; - offset = 0; - } else if (length === void 0 && typeof offset === "string") { - encoding = offset; - length = this.length; - offset = 0; - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === void 0) encoding = "utf8"; - } else { - encoding = length; - length = void 0; - } - } else { - throw new Error( - "Buffer.write(string, encoding, offset[, length]) is no longer supported" - ); - } - const remaining = this.length - offset; - if (length === void 0 || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { - throw new RangeError("Attempt to write outside buffer bounds"); - } - if (!encoding) encoding = "utf8"; - let loweredCase = false; - for (; ; ) { - switch (encoding) { - case "hex": - return hexWrite(this, string, offset, length); - case "utf8": - case "utf-8": - return utf8Write(this, string, offset, length); - case "ascii": - case "latin1": - case "binary": - return asciiWrite(this, string, offset, length); - case "base64": - return base64Write(this, string, offset, length); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - }; - Buffer2.prototype.toJSON = function toJSON() { - return { - type: "Buffer", - data: Array.prototype.slice.call(this._arr || this, 0) - }; - }; - function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf); - } else { - return base64.fromByteArray(buf.slice(start, end)); - } - } - function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while (i < end) { - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch (bytesPerSequence) { - case 1: - if (firstByte < 128) { - codePoint = firstByte; - } - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 192) === 128) { - tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; - if (tempCodePoint > 127) { - codePoint = tempCodePoint; - } - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; - if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { - codePoint = tempCodePoint; - } - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; - if (tempCodePoint > 65535 && tempCodePoint < 1114112) { - codePoint = tempCodePoint; - } - } - } - } - if (codePoint === null) { - codePoint = 65533; - bytesPerSequence = 1; - } else if (codePoint > 65535) { - codePoint -= 65536; - res.push(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); - } - var MAX_ARGUMENTS_LENGTH = 4096; - function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints); - } - let res = ""; - let i = 0; - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ); - } - return res; - } - function asciiSlice(buf, start, end) { - let ret = ""; - end = Math.min(buf.length, end); - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 127); - } - return ret; - } - function latin1Slice(buf, start, end) { - let ret = ""; - end = Math.min(buf.length, end); - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]); - } - return ret; - } - function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ""; - for (let i = start; i < end; ++i) { - out += hexSliceLookupTable[buf[i]]; - } - return out; - } - function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ""; - for (let i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - } - return res; - } - Buffer2.prototype.slice = function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === void 0 ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) { - start = len; - } - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) { - end = len; - } - if (end < start) end = start; - const newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer2.prototype); - return newBuf; - }; - function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint"); - if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); - } - Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) checkOffset(offset, byteLength2, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - return val; - }; - Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - checkOffset(offset, byteLength2, this.length); - } - let val = this[offset + --byteLength2]; - let mul = 1; - while (byteLength2 > 0 && (mul *= 256)) { - val += this[offset + --byteLength2] * mul; - } - return val; - }; - Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; - }; - Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; - }; - Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; - }; - Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; - }; - Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); - }; - Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first2 = this[offset]; - const last2 = this[offset + 7]; - if (first2 === void 0 || last2 === void 0) { - boundsError(offset, this.length - 8); - } - const lo = first2 + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last2 * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); - }); - Buffer2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first2 = this[offset]; - const last2 = this[offset + 7]; - if (first2 === void 0 || last2 === void 0) { - boundsError(offset, this.length - 8); - } - const hi = first2 * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last2; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); - }); - Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) checkOffset(offset, byteLength2, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - mul *= 128; - if (val >= mul) val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) checkOffset(offset, byteLength2, this.length); - let i = byteLength2; - let mul = 1; - let val = this[offset + --i]; - while (i > 0 && (mul *= 256)) { - val += this[offset + --i] * mul; - } - mul *= 128; - if (val >= mul) val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 128)) return this[offset]; - return (255 - this[offset] + 1) * -1; - }; - Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; - }; - Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; - }; - Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first2 = this[offset]; - const last2 = this[offset + 7]; - if (first2 === void 0 || last2 === void 0) { - boundsError(offset, this.length - 8); - } - const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last2 << 24); - return (BigInt(val) << BigInt(32)) + BigInt(first2 + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); - }); - Buffer2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first2 = this[offset]; - const last2 = this[offset + 7]; - if (first2 === void 0 || last2 === void 0) { - boundsError(offset, this.length - 8); - } - const val = (first2 << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last2); - }); - Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); - }; - Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); - }; - Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); - }; - Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); - }; - function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer2.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError("Index out of range"); - } - Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - this[offset + i] = value / mul & 255; - } - return offset + byteLength2; - }; - Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); - } - let i = byteLength2 - 1; - let mul = 1; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - this[offset + i] = value / mul & 255; - } - return offset + byteLength2; - }; - Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 255, 0); - this[offset] = value & 255; - return offset + 1; - }; - Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 255; - return offset + 4; - }; - Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }; - function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(4294967295)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(4294967295)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; - } - function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(4294967295)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(4294967295)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; - } - Buffer2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); - }); - Buffer2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); - }); - Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); - } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; - } - return offset + byteLength2; - }; - Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); - } - let i = byteLength2 - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; - } - return offset + byteLength2; - }; - Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 127, -128); - if (value < 0) value = 255 + value + 1; - this[offset] = value & 255; - return offset + 1; - }; - Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; - }; - Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648); - if (value < 0) value = 4294967295 + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }; - Buffer2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); - }); - Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); - }); - function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError("Index out of range"); - if (offset < 0) throw new RangeError("Index out of range"); - } - function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22); - } - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; - } - Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); - }; - Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); - }; - function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292); - } - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; - } - Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); - }; - Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); - }; - Buffer2.prototype.copy = function copy2(target, targetStart, start, end) { - if (!Buffer2.isBuffer(target)) throw new TypeError("argument should be a Buffer"); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - if (targetStart < 0) { - throw new RangeError("targetStart out of bounds"); - } - if (start < 0 || start >= this.length) throw new RangeError("Index out of range"); - if (end < 0) throw new RangeError("sourceEnd out of bounds"); - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start; - } - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === "function") { - this.copyWithin(targetStart, start, end); - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ); - } - return len; - }; - Buffer2.prototype.fill = function fill(val, start, end, encoding) { - if (typeof val === "string") { - if (typeof start === "string") { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === "string") { - encoding = end; - end = this.length; - } - if (encoding !== void 0 && typeof encoding !== "string") { - throw new TypeError("encoding must be a string"); - } - if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === "utf8" && code < 128 || encoding === "latin1") { - val = code; - } - } - } else if (typeof val === "number") { - val = val & 255; - } else if (typeof val === "boolean") { - val = Number(val); - } - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError("Out of range index"); - } - if (end <= start) { - return this; - } - start = start >>> 0; - end = end === void 0 ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === "number") { - for (i = start; i < end; ++i) { - this[i] = val; - } - } else { - const bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding); - const len = bytes.length; - if (len === 0) { - throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len]; - } - } - return this; - }; - var errors = {}; - function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor() { - super(); - Object.defineProperty(this, "message", { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - this.name = `${this.name} [${sym}]`; - this.stack; - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, "code", { - configurable: true, - enumerable: true, - value, - writable: true - }); - } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; - } - E( - "ERR_BUFFER_OUT_OF_BOUNDS", - function(name) { - if (name) { - return `${name} is outside of buffer bounds`; - } - return "Attempt to access memory outside buffer bounds"; - }, - RangeError - ); - E( - "ERR_INVALID_ARG_TYPE", - function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; - }, - TypeError - ); - E( - "ERR_OUT_OF_RANGE", - function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)); - } else if (typeof input === "bigint") { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { - received = addNumericalSeparator(received); - } - received += "n"; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; - }, - RangeError - ); - function addNumericalSeparator(val) { - let res = ""; - let i = val.length; - const start = val[0] === "-" ? 1 : 0; - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}`; - } - return `${val.slice(0, i)}${res}`; - } - function checkBounds(buf, offset, byteLength2) { - validateNumber(offset, "offset"); - if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) { - boundsError(offset, buf.length - (byteLength2 + 1)); - } - } - function checkIntBI(value, min, max, buf, offset, byteLength2) { - if (value > max || value < min) { - const n = typeof min === "bigint" ? "n" : ""; - let range; - if (byteLength2 > 3) { - if (min === 0 || min === BigInt(0)) { - range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`; - } else { - range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`; - } - } else { - range = `>= ${min}${n} and <= ${max}${n}`; - } - throw new errors.ERR_OUT_OF_RANGE("value", range, value); - } - checkBounds(buf, offset, byteLength2); - } - function validateNumber(value, name) { - if (typeof value !== "number") { - throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value); - } - } - function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value); - } - if (length < 0) { - throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - } - throw new errors.ERR_OUT_OF_RANGE( - type || "offset", - `>= ${type ? 1 : 0} and <= ${length}`, - value - ); - } - var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; - function base64clean(str) { - str = str.split("=")[0]; - str = str.trim().replace(INVALID_BASE64_RE, ""); - if (str.length < 2) return ""; - while (str.length % 4 !== 0) { - str = str + "="; - } - return str; - } - function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for (let i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i); - if (codePoint > 55295 && codePoint < 57344) { - if (!leadSurrogate) { - if (codePoint > 56319) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - continue; - } else if (i + 1 === length) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - continue; - } - leadSurrogate = codePoint; - continue; - } - if (codePoint < 56320) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - leadSurrogate = codePoint; - continue; - } - codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; - } else if (leadSurrogate) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - } - leadSurrogate = null; - if (codePoint < 128) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 2048) { - if ((units -= 2) < 0) break; - bytes.push( - codePoint >> 6 | 192, - codePoint & 63 | 128 - ); - } else if (codePoint < 65536) { - if ((units -= 3) < 0) break; - bytes.push( - codePoint >> 12 | 224, - codePoint >> 6 & 63 | 128, - codePoint & 63 | 128 - ); - } else if (codePoint < 1114112) { - if ((units -= 4) < 0) break; - bytes.push( - codePoint >> 18 | 240, - codePoint >> 12 & 63 | 128, - codePoint >> 6 & 63 | 128, - codePoint & 63 | 128 - ); - } else { - throw new Error("Invalid code point"); - } - } - return bytes; - } - function asciiToBytes(str) { - const byteArray = []; - for (let i = 0; i < str.length; ++i) { - byteArray.push(str.charCodeAt(i) & 255); - } - return byteArray; - } - function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for (let i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; - } - function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); - } - function blitBuffer(src, dst, offset, length) { - let i; - for (i = 0; i < length; ++i) { - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; - } - return i; - } - function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; - } - function numberIsNaN(obj) { - return obj !== obj; - } - var hexSliceLookupTable = function() { - const alphabet = "0123456789abcdef"; - const table = new Array(256); - for (let i = 0; i < 16; ++i) { - const i16 = i * 16; - for (let j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j]; - } - } - return table; - }(); - function defineBigIntMethod(fn) { - return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn; - } - function BufferBigIntNotDefined() { - throw new Error("BigInt not supported"); - } - } -}); - -// polyfill_buffer.js -var import_obsidian, buffer, Buffer; -var init_polyfill_buffer = __esm({ - "polyfill_buffer.js"() { - import_obsidian = require("obsidian"); - if (import_obsidian.Platform.isMobileApp) { - buffer = require_buffer().Buffer; - } else { - buffer = global.Buffer; - } - Buffer = buffer; - } -}); - -// node_modules/.pnpm/async-lock@1.4.1/node_modules/async-lock/lib/index.js -var require_lib = __commonJS({ - "node_modules/.pnpm/async-lock@1.4.1/node_modules/async-lock/lib/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var AsyncLock2 = function(opts) { - opts = opts || {}; - this.Promise = opts.Promise || Promise; - this.queues = /* @__PURE__ */ Object.create(null); - this.domainReentrant = opts.domainReentrant || false; - if (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 = /* @__PURE__ */ Object.create(null); - } - this.timeout = opts.timeout || AsyncLock2.DEFAULT_TIMEOUT; - this.maxOccupationTime = opts.maxOccupationTime || AsyncLock2.DEFAULT_MAX_OCCUPATION_TIME; - this.maxExecutionTime = opts.maxExecutionTime || AsyncLock2.DEFAULT_MAX_EXECUTION_TIME; - if (opts.maxPending === Infinity || Number.isInteger(opts.maxPending) && opts.maxPending >= 0) { - this.maxPending = opts.maxPending; - } else { - this.maxPending = AsyncLock2.DEFAULT_MAX_PENDING; - } - }; - AsyncLock2.DEFAULT_TIMEOUT = 0; - AsyncLock2.DEFAULT_MAX_OCCUPATION_TIME = 0; - AsyncLock2.DEFAULT_MAX_EXECUTION_TIME = 0; - AsyncLock2.DEFAULT_MAX_PENDING = 1e3; - AsyncLock2.prototype.acquire = function(key2, fn, cb, opts) { - if (Array.isArray(key2)) { - return this._acquireBatch(key2, fn, cb, opts); - } - if (typeof fn !== "function") { - throw new Error("You must pass a function to execute"); - } - var deferredResolve = null; - var deferredReject = null; - var deferred2 = null; - if (typeof cb !== "function") { - opts = cb; - cb = null; - deferred2 = new this.Promise(function(resolve2, reject) { - deferredResolve = resolve2; - deferredReject = reject; - }); - } - opts = opts || {}; - var resolved = false; - var timer = null; - var occupationTimer = null; - var executionTimer = null; - var self2 = this; - var done = function(locked, err, ret) { - if (occupationTimer) { - clearTimeout(occupationTimer); - occupationTimer = null; - } - if (executionTimer) { - clearTimeout(executionTimer); - executionTimer = null; - } - if (locked) { - if (!!self2.queues[key2] && self2.queues[key2].length === 0) { - delete self2.queues[key2]; - } - if (self2.domainReentrant) { - delete self2.domains[key2]; - } - } - if (!resolved) { - if (!deferred2) { - if (typeof cb === "function") { - cb(err, ret); - } - } else { - if (err) { - deferredReject(err); - } else { - deferredResolve(ret); - } - } - resolved = true; - } - if (locked) { - if (!!self2.queues[key2] && self2.queues[key2].length > 0) { - self2.queues[key2].shift()(); - } - } - }; - var exec = function(locked) { - if (resolved) { - return done(locked); - } - if (timer) { - clearTimeout(timer); - timer = null; - } - if (self2.domainReentrant && locked) { - self2.domains[key2] = process.domain; - } - var maxExecutionTime = opts.maxExecutionTime || self2.maxExecutionTime; - if (maxExecutionTime) { - executionTimer = setTimeout(function() { - if (!!self2.queues[key2]) { - done(locked, new Error("Maximum execution time is exceeded " + key2)); - } - }, maxExecutionTime); - } - if (fn.length === 1) { - var called = false; - try { - fn(function(err, ret) { - if (!called) { - called = true; - done(locked, err, ret); - } - }); - } catch (err) { - if (!called) { - called = true; - done(locked, err); - } - } - } else { - self2._promiseTry(function() { - return fn(); - }).then(function(ret) { - done(locked, void 0, ret); - }, function(error) { - done(locked, error); - }); - } - }; - if (self2.domainReentrant && !!process.domain) { - exec = process.domain.bind(exec); - } - var maxPending = opts.maxPending || self2.maxPending; - if (!self2.queues[key2]) { - self2.queues[key2] = []; - exec(true); - } else if (self2.domainReentrant && !!process.domain && process.domain === self2.domains[key2]) { - exec(false); - } else if (self2.queues[key2].length >= maxPending) { - done(false, new Error("Too many pending tasks in queue " + key2)); - } else { - var taskFn = function() { - exec(true); - }; - if (opts.skipQueue) { - self2.queues[key2].unshift(taskFn); - } else { - self2.queues[key2].push(taskFn); - } - var timeout = opts.timeout || self2.timeout; - if (timeout) { - timer = setTimeout(function() { - timer = null; - done(false, new Error("async-lock timed out in queue " + key2)); - }, timeout); - } - } - var maxOccupationTime = opts.maxOccupationTime || self2.maxOccupationTime; - if (maxOccupationTime) { - occupationTimer = setTimeout(function() { - if (!!self2.queues[key2]) { - done(false, new Error("Maximum occupation time is exceeded in queue " + key2)); - } - }, maxOccupationTime); - } - if (deferred2) { - return deferred2; - } - }; - AsyncLock2.prototype._acquireBatch = function(keys, fn, cb, opts) { - if (typeof cb !== "function") { - opts = cb; - cb = null; - } - var self2 = this; - var getFn = function(key2, fn2) { - return function(cb2) { - self2.acquire(key2, fn2, cb2, opts); - }; - }; - var fnx = keys.reduceRight(function(prev, key2) { - return getFn(key2, prev); - }, fn); - if (typeof cb === "function") { - fnx(cb); - } else { - return new this.Promise(function(resolve2, reject) { - if (fnx.length === 1) { - fnx(function(err, ret) { - if (err) { - reject(err); - } else { - resolve2(ret); - } - }); - } else { - resolve2(fnx()); - } - }); - } - }; - AsyncLock2.prototype.isBusy = function(key2) { - if (!key2) { - return Object.keys(this.queues).length > 0; - } else { - return !!this.queues[key2]; - } - }; - AsyncLock2.prototype._promiseTry = function(fn) { - try { - return this.Promise.resolve(fn()); - } catch (e) { - return this.Promise.reject(e); - } - }; - module2.exports = AsyncLock2; - } -}); - -// node_modules/.pnpm/async-lock@1.4.1/node_modules/async-lock/index.js -var require_async_lock = __commonJS({ - "node_modules/.pnpm/async-lock@1.4.1/node_modules/async-lock/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = require_lib(); - } -}); - -// node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js -var require_inherits_browser = __commonJS({ - "node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports2, module2) { - init_polyfill_buffer(); - if (typeof Object.create === "function") { - module2.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } - }; - } else { - module2.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor; - var TempCtor = function() { - }; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - }; - } - } -}); - -// node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js -var require_safe_buffer = __commonJS({ - "node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports2, module2) { - init_polyfill_buffer(); - var buffer2 = require_buffer(); - var Buffer2 = buffer2.Buffer; - function copyProps(src, dst) { - for (var key2 in src) { - dst[key2] = src[key2]; - } - } - if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) { - module2.exports = buffer2; - } else { - copyProps(buffer2, exports2); - exports2.Buffer = SafeBuffer; - } - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer2(arg, encodingOrOffset, length); - } - SafeBuffer.prototype = Object.create(Buffer2.prototype); - copyProps(Buffer2, SafeBuffer); - SafeBuffer.from = function(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - throw new TypeError("Argument must not be a number"); - } - return Buffer2(arg, encodingOrOffset, length); - }; - SafeBuffer.alloc = function(size, fill, encoding) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - var buf = Buffer2(size); - if (fill !== void 0) { - if (typeof encoding === "string") { - buf.fill(fill, encoding); - } else { - buf.fill(fill); - } - } else { - buf.fill(0); - } - return buf; - }; - SafeBuffer.allocUnsafe = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return Buffer2(size); - }; - SafeBuffer.allocUnsafeSlow = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return buffer2.SlowBuffer(size); - }; - } -}); - -// node_modules/.pnpm/sha.js@2.4.11/node_modules/sha.js/hash.js -var require_hash = __commonJS({ - "node_modules/.pnpm/sha.js@2.4.11/node_modules/sha.js/hash.js"(exports2, module2) { - init_polyfill_buffer(); - var Buffer2 = require_safe_buffer().Buffer; - function Hash2(blockSize, finalSize) { - this._block = Buffer2.alloc(blockSize); - this._finalSize = finalSize; - this._blockSize = blockSize; - this._len = 0; - } - Hash2.prototype.update = function(data, enc) { - if (typeof data === "string") { - enc = enc || "utf8"; - data = Buffer2.from(data, enc); - } - var block = this._block; - var blockSize = this._blockSize; - var length = data.length; - var accum = this._len; - for (var offset = 0; offset < length; ) { - var assigned = accum % blockSize; - var remainder = Math.min(length - offset, blockSize - assigned); - for (var i = 0; i < remainder; i++) { - block[assigned + i] = data[offset + i]; - } - accum += remainder; - offset += remainder; - if (accum % blockSize === 0) { - this._update(block); - } - } - this._len += length; - return this; - }; - Hash2.prototype.digest = function(enc) { - var rem = this._len % this._blockSize; - this._block[rem] = 128; - this._block.fill(0, rem + 1); - if (rem >= this._finalSize) { - this._update(this._block); - this._block.fill(0); - } - var bits = this._len * 8; - if (bits <= 4294967295) { - this._block.writeUInt32BE(bits, this._blockSize - 4); - } else { - var lowBits = (bits & 4294967295) >>> 0; - var highBits = (bits - lowBits) / 4294967296; - this._block.writeUInt32BE(highBits, this._blockSize - 8); - this._block.writeUInt32BE(lowBits, this._blockSize - 4); - } - this._update(this._block); - var hash2 = this._hash(); - return enc ? hash2.toString(enc) : hash2; - }; - Hash2.prototype._update = function() { - throw new Error("_update must be implemented by subclass"); - }; - module2.exports = Hash2; - } -}); - -// node_modules/.pnpm/sha.js@2.4.11/node_modules/sha.js/sha1.js -var require_sha1 = __commonJS({ - "node_modules/.pnpm/sha.js@2.4.11/node_modules/sha.js/sha1.js"(exports2, module2) { - init_polyfill_buffer(); - var inherits = require_inherits_browser(); - var Hash2 = require_hash(); - var Buffer2 = require_safe_buffer().Buffer; - var K2 = [ - 1518500249, - 1859775393, - 2400959708 | 0, - 3395469782 | 0 - ]; - var W = new Array(80); - function Sha1() { - this.init(); - this._w = W; - Hash2.call(this, 64, 56); - } - inherits(Sha1, Hash2); - Sha1.prototype.init = function() { - this._a = 1732584193; - this._b = 4023233417; - this._c = 2562383102; - this._d = 271733878; - this._e = 3285377520; - return this; - }; - function rotl1(num2) { - return num2 << 1 | num2 >>> 31; - } - function rotl5(num2) { - return num2 << 5 | num2 >>> 27; - } - function rotl30(num2) { - return num2 << 30 | num2 >>> 2; - } - function ft(s, b, c, d) { - if (s === 0) return b & c | ~b & d; - if (s === 2) return b & c | b & d | c & d; - return b ^ c ^ d; - } - Sha1.prototype._update = function(M) { - var W2 = this._w; - var a = this._a | 0; - var b = this._b | 0; - var c = this._c | 0; - var d = this._d | 0; - var e = this._e | 0; - for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4); - for (; i < 80; ++i) W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]); - for (var j = 0; j < 80; ++j) { - var s = ~~(j / 20); - var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K2[s] | 0; - e = d; - d = c; - c = rotl30(b); - b = a; - a = t; - } - this._a = a + this._a | 0; - this._b = b + this._b | 0; - this._c = c + this._c | 0; - this._d = d + this._d | 0; - this._e = e + this._e | 0; - }; - Sha1.prototype._hash = function() { - var H = Buffer2.allocUnsafe(20); - H.writeInt32BE(this._a | 0, 0); - H.writeInt32BE(this._b | 0, 4); - H.writeInt32BE(this._c | 0, 8); - H.writeInt32BE(this._d | 0, 12); - H.writeInt32BE(this._e | 0, 16); - return H; - }; - module2.exports = Sha1; - } -}); - -// node_modules/.pnpm/crc-32@1.2.2/node_modules/crc-32/crc32.js -var require_crc32 = __commonJS({ - "node_modules/.pnpm/crc-32@1.2.2/node_modules/crc-32/crc32.js"(exports2) { - init_polyfill_buffer(); - var CRC32; - (function(factory) { - if (typeof DO_NOT_EXPORT_CRC === "undefined") { - if ("object" === typeof exports2) { - factory(exports2); - } else if ("function" === typeof define && define.amd) { - define(function() { - var module3 = {}; - factory(module3); - return module3; - }); - } else { - factory(CRC32 = {}); - } - } else { - factory(CRC32 = {}); - } - })(function(CRC322) { - CRC322.version = "1.2.2"; - function signed_crc_table() { - var c = 0, table = new Array(256); - for (var n = 0; n != 256; ++n) { - c = n; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - table[n] = c; - } - return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; - } - var T0 = signed_crc_table(); - function slice_by_16_tables(T) { - var c = 0, v = 0, n = 0, table = typeof Int32Array !== "undefined" ? new Int32Array(4096) : new Array(4096); - for (n = 0; n != 256; ++n) table[n] = T[n]; - for (n = 0; n != 256; ++n) { - v = T[n]; - for (c = 256 + n; c < 4096; c += 256) v = table[c] = v >>> 8 ^ T[v & 255]; - } - var out = []; - for (n = 1; n != 16; ++n) out[n - 1] = typeof Int32Array !== "undefined" ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256); - return out; - } - var TT = slice_by_16_tables(T0); - var T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4]; - var T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9]; - var Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14]; - function crc32_bstr(bstr, seed) { - var C = seed ^ -1; - for (var i = 0, L = bstr.length; i < L; ) C = C >>> 8 ^ T0[(C ^ bstr.charCodeAt(i++)) & 255]; - return ~C; - } - function crc32_buf(B, seed) { - var C = seed ^ -1, L = B.length - 15, i = 0; - for (; i < L; ) C = Tf[B[i++] ^ C & 255] ^ Te[B[i++] ^ C >> 8 & 255] ^ Td[B[i++] ^ C >> 16 & 255] ^ Tc[B[i++] ^ C >>> 24] ^ Tb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^ T7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^ T3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]]; - L += 15; - while (i < L) C = C >>> 8 ^ T0[(C ^ B[i++]) & 255]; - return ~C; - } - function crc32_str(str, seed) { - var C = seed ^ -1; - for (var i = 0, L = str.length, c = 0, d = 0; i < L; ) { - c = str.charCodeAt(i++); - if (c < 128) { - C = C >>> 8 ^ T0[(C ^ c) & 255]; - } else if (c < 2048) { - C = C >>> 8 ^ T0[(C ^ (192 | c >> 6 & 31)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255]; - } else if (c >= 55296 && c < 57344) { - c = (c & 1023) + 64; - d = str.charCodeAt(i++) & 1023; - C = C >>> 8 ^ T0[(C ^ (240 | c >> 8 & 7)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c >> 2 & 63)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | d & 63)) & 255]; - } else { - C = C >>> 8 ^ T0[(C ^ (224 | c >> 12 & 15)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c >> 6 & 63)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255]; - } - } - return ~C; - } - CRC322.table = T0; - CRC322.bstr = crc32_bstr; - CRC322.buf = crc32_buf; - CRC322.str = crc32_str; - }); - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js -var require_common = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var TYPED_OK = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined"; - function _has(obj, key2) { - return Object.prototype.hasOwnProperty.call(obj, key2); - } - exports2.assign = function(obj) { - var sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - var source = sources.shift(); - if (!source) { - continue; - } - if (typeof source !== "object") { - throw new TypeError(source + "must be non-object"); - } - for (var p in source) { - if (_has(source, p)) { - obj[p] = source[p]; - } - } - } - return obj; - }; - exports2.shrinkBuf = function(buf, size) { - if (buf.length === size) { - return buf; - } - if (buf.subarray) { - return buf.subarray(0, size); - } - buf.length = size; - return buf; - }; - var fnTyped = { - arraySet: function(dest, src, src_offs, len, dest_offs) { - if (src.subarray && dest.subarray) { - dest.set(src.subarray(src_offs, src_offs + len), dest_offs); - return; - } - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function(chunks) { - var i, l, len, pos, chunk, result; - len = 0; - for (i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; - } - result = new Uint8Array(len); - pos = 0; - for (i = 0, l = chunks.length; i < l; i++) { - chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; - } - return result; - } - }; - var fnUntyped = { - arraySet: function(dest, src, src_offs, len, dest_offs) { - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function(chunks) { - return [].concat.apply([], chunks); - } - }; - exports2.setTyped = function(on) { - if (on) { - exports2.Buf8 = Uint8Array; - exports2.Buf16 = Uint16Array; - exports2.Buf32 = Int32Array; - exports2.assign(exports2, fnTyped); - } else { - exports2.Buf8 = Array; - exports2.Buf16 = Array; - exports2.Buf32 = Array; - exports2.assign(exports2, fnUntyped); - } - }; - exports2.setTyped(TYPED_OK); - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js -var require_trees = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var utils = require_common(); - var Z_FIXED = 4; - var Z_BINARY = 0; - var Z_TEXT = 1; - var Z_UNKNOWN = 2; - function zero(buf) { - var len = buf.length; - while (--len >= 0) { - buf[len] = 0; - } - } - var STORED_BLOCK = 0; - var STATIC_TREES = 1; - var DYN_TREES = 2; - var MIN_MATCH = 3; - var MAX_MATCH = 258; - var LENGTH_CODES = 29; - var LITERALS = 256; - var L_CODES = LITERALS + 1 + LENGTH_CODES; - var D_CODES = 30; - var BL_CODES = 19; - var HEAP_SIZE = 2 * L_CODES + 1; - var MAX_BITS = 15; - var Buf_size = 16; - var MAX_BL_BITS = 7; - var END_BLOCK = 256; - var REP_3_6 = 16; - var REPZ_3_10 = 17; - var REPZ_11_138 = 18; - var extra_lbits = ( - /* extra bits for each length code */ - [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] - ); - var extra_dbits = ( - /* extra bits for each distance code */ - [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] - ); - var extra_blbits = ( - /* extra bits for each bit length code */ - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7] - ); - var bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; - var DIST_CODE_LEN = 512; - var static_ltree = new Array((L_CODES + 2) * 2); - zero(static_ltree); - var static_dtree = new Array(D_CODES * 2); - zero(static_dtree); - var _dist_code = new Array(DIST_CODE_LEN); - zero(_dist_code); - var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); - zero(_length_code); - var base_length = new Array(LENGTH_CODES); - zero(base_length); - var base_dist = new Array(D_CODES); - zero(base_dist); - function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - this.static_tree = static_tree; - this.extra_bits = extra_bits; - this.extra_base = extra_base; - this.elems = elems; - this.max_length = max_length; - this.has_stree = static_tree && static_tree.length; - } - var static_l_desc; - var static_d_desc; - var static_bl_desc; - function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; - this.max_code = 0; - this.stat_desc = stat_desc; - } - function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; - } - function put_short(s, w) { - s.pending_buf[s.pending++] = w & 255; - s.pending_buf[s.pending++] = w >>> 8 & 255; - } - function send_bits(s, value, length) { - if (s.bi_valid > Buf_size - length) { - s.bi_buf |= value << s.bi_valid & 65535; - put_short(s, s.bi_buf); - s.bi_buf = value >> Buf_size - s.bi_valid; - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= value << s.bi_valid & 65535; - s.bi_valid += length; - } - } - function send_code(s, c, tree) { - send_bits( - s, - tree[c * 2], - tree[c * 2 + 1] - /*.Len*/ - ); - } - function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; - } - function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 255; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } - } - function gen_bitlen(s, desc) { - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; - var n, m; - var bits; - var xbits; - var f; - var overflow = 0; - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - tree[s.heap[s.heap_max] * 2 + 1] = 0; - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1] * 2 + 1] + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1] = bits; - if (n > max_code) { - continue; - } - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1] + xbits); - } - } - if (overflow === 0) { - return; - } - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { - bits--; - } - s.bl_count[bits]--; - s.bl_count[bits + 1] += 2; - s.bl_count[max_length]--; - overflow -= 2; - } while (overflow > 0); - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { - continue; - } - if (tree[m * 2 + 1] !== bits) { - s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2]; - tree[m * 2 + 1] = bits; - } - n--; - } - } - } - function gen_codes(tree, max_code, bl_count) { - var next_code = new Array(MAX_BITS + 1); - var code = 0; - var bits; - var n; - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = code + bl_count[bits - 1] << 1; - } - for (n = 0; n <= max_code; n++) { - var len = tree[n * 2 + 1]; - if (len === 0) { - continue; - } - tree[n * 2] = bi_reverse(next_code[len]++, len); - } - } - function tr_static_init() { - var n; - var bits; - var length; - var code; - var dist; - var bl_count = new Array(MAX_BITS + 1); - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < 1 << extra_lbits[code]; n++) { - _length_code[length++] = code; - } - } - _length_code[length - 1] = code; - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < 1 << extra_dbits[code]; n++) { - _dist_code[dist++] = code; - } - } - dist >>= 7; - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < 1 << extra_dbits[code] - 7; n++) { - _dist_code[256 + dist++] = code; - } - } - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1] = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1] = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1] = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1] = 8; - n++; - bl_count[8]++; - } - gen_codes(static_ltree, L_CODES + 1, bl_count); - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1] = 5; - static_dtree[n * 2] = bi_reverse(n, 5); - } - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - } - function init_block(s) { - var n; - for (n = 0; n < L_CODES; n++) { - s.dyn_ltree[n * 2] = 0; - } - for (n = 0; n < D_CODES; n++) { - s.dyn_dtree[n * 2] = 0; - } - for (n = 0; n < BL_CODES; n++) { - s.bl_tree[n * 2] = 0; - } - s.dyn_ltree[END_BLOCK * 2] = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; - } - function bi_windup(s) { - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; - } - function copy_block(s, buf, len, header) { - bi_windup(s); - if (header) { - put_short(s, len); - put_short(s, ~len); - } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; - } - function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m]; - } - function pqdownheap(s, tree, k) { - var v = s.heap[k]; - var j = k << 1; - while (j <= s.heap_len) { - if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - if (smaller(tree, v, s.heap[j], s.depth)) { - break; - } - s.heap[k] = s.heap[j]; - k = j; - j <<= 1; - } - s.heap[k] = v; - } - function compress_block(s, ltree, dtree) { - var dist; - var lc; - var lx = 0; - var code; - var extra; - if (s.last_lit !== 0) { - do { - dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1]; - lc = s.pending_buf[s.l_buf + lx]; - lx++; - if (dist === 0) { - send_code(s, lc, ltree); - } else { - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); - } - dist--; - code = d_code(dist); - send_code(s, code, dtree); - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); - } - } - } while (lx < s.last_lit); - } - send_code(s, END_BLOCK, ltree); - } - function build_tree(s, desc) { - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; - var max_code = -1; - var node; - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - for (n = 0; n < elems; n++) { - if (tree[n * 2] !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - } else { - tree[n * 2 + 1] = 0; - } - } - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0; - tree[node * 2] = 1; - s.depth[node] = 0; - s.opt_len--; - if (has_stree) { - s.static_len -= stree[node * 2 + 1]; - } - } - desc.max_code = max_code; - for (n = s.heap_len >> 1; n >= 1; n--) { - pqdownheap(s, tree, n); - } - node = elems; - do { - n = s.heap[ - 1 - /*SMALLEST*/ - ]; - s.heap[ - 1 - /*SMALLEST*/ - ] = s.heap[s.heap_len--]; - pqdownheap( - s, - tree, - 1 - /*SMALLEST*/ - ); - m = s.heap[ - 1 - /*SMALLEST*/ - ]; - s.heap[--s.heap_max] = n; - s.heap[--s.heap_max] = m; - tree[node * 2] = tree[n * 2] + tree[m * 2]; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1] = tree[m * 2 + 1] = node; - s.heap[ - 1 - /*SMALLEST*/ - ] = node++; - pqdownheap( - s, - tree, - 1 - /*SMALLEST*/ - ); - } while (s.heap_len >= 2); - s.heap[--s.heap_max] = s.heap[ - 1 - /*SMALLEST*/ - ]; - gen_bitlen(s, desc); - gen_codes(tree, max_code, s.bl_count); - } - function scan_tree(s, tree, max_code) { - var n; - var prevlen = -1; - var curlen; - var nextlen = tree[0 * 2 + 1]; - var count = 0; - var max_count = 7; - var min_count = 4; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1] = 65535; - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - s.bl_tree[curlen * 2] += count; - } else if (curlen !== 0) { - if (curlen !== prevlen) { - s.bl_tree[curlen * 2]++; - } - s.bl_tree[REP_3_6 * 2]++; - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]++; - } else { - s.bl_tree[REPZ_11_138 * 2]++; - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } - } - function send_tree(s, tree, max_code) { - var n; - var prevlen = -1; - var curlen; - var nextlen = tree[0 * 2 + 1]; - var count = 0; - var max_count = 7; - var min_count = 4; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - do { - send_code(s, curlen, s.bl_tree); - } while (--count !== 0); - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } - } - function build_bl_tree(s) { - var max_blindex; - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - build_tree(s, s.bl_desc); - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) { - break; - } - } - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - return max_blindex; - } - function send_all_trees(s, lcodes, dcodes, blcodes) { - var rank; - send_bits(s, lcodes - 257, 5); - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); - for (rank = 0; rank < blcodes; rank++) { - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3); - } - send_tree(s, s.dyn_ltree, lcodes - 1); - send_tree(s, s.dyn_dtree, dcodes - 1); - } - function detect_data_type(s) { - var black_mask = 4093624447; - var n; - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if (black_mask & 1 && s.dyn_ltree[n * 2] !== 0) { - return Z_BINARY; - } - } - if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2] !== 0) { - return Z_TEXT; - } - } - return Z_BINARY; - } - var static_init_done = false; - function _tr_init(s) { - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - s.bi_buf = 0; - s.bi_valid = 0; - init_block(s); - } - function _tr_stored_block(s, buf, stored_len, last2) { - send_bits(s, (STORED_BLOCK << 1) + (last2 ? 1 : 0), 3); - copy_block(s, buf, stored_len, true); - } - function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); - } - function _tr_flush_block(s, buf, stored_len, last2) { - var opt_lenb, static_lenb; - var max_blindex = 0; - if (s.level > 0) { - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - build_tree(s, s.l_desc); - build_tree(s, s.d_desc); - max_blindex = build_bl_tree(s); - opt_lenb = s.opt_len + 3 + 7 >>> 3; - static_lenb = s.static_len + 3 + 7 >>> 3; - if (static_lenb <= opt_lenb) { - opt_lenb = static_lenb; - } - } else { - opt_lenb = static_lenb = stored_len + 5; - } - if (stored_len + 4 <= opt_lenb && buf !== -1) { - _tr_stored_block(s, buf, stored_len, last2); - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - send_bits(s, (STATIC_TREES << 1) + (last2 ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - } else { - send_bits(s, (DYN_TREES << 1) + (last2 ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - init_block(s); - if (last2) { - bi_windup(s); - } - } - function _tr_tally(s, dist, lc) { - s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 255; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 255; - s.pending_buf[s.l_buf + s.last_lit] = lc & 255; - s.last_lit++; - if (dist === 0) { - s.dyn_ltree[lc * 2]++; - } else { - s.matches++; - dist--; - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++; - s.dyn_dtree[d_code(dist) * 2]++; - } - return s.last_lit === s.lit_bufsize - 1; - } - exports2._tr_init = _tr_init; - exports2._tr_stored_block = _tr_stored_block; - exports2._tr_flush_block = _tr_flush_block; - exports2._tr_tally = _tr_tally; - exports2._tr_align = _tr_align; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js -var require_adler32 = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - function adler32(adler, buf, len, pos) { - var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0; - while (len !== 0) { - n = len > 2e3 ? 2e3 : len; - len -= n; - do { - s1 = s1 + buf[pos++] | 0; - s2 = s2 + s1 | 0; - } while (--n); - s1 %= 65521; - s2 %= 65521; - } - return s1 | s2 << 16 | 0; - } - module2.exports = adler32; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js -var require_crc322 = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - function makeTable() { - var c, table = []; - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; - } - table[n] = c; - } - return table; - } - var crcTable = makeTable(); - function crc322(crc, buf, len, pos) { - var t = crcTable, end = pos + len; - crc ^= -1; - for (var i = pos; i < end; i++) { - crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255]; - } - return crc ^ -1; - } - module2.exports = crc322; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js -var require_messages = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = { - 2: "need dictionary", - /* Z_NEED_DICT 2 */ - 1: "stream end", - /* Z_STREAM_END 1 */ - 0: "", - /* Z_OK 0 */ - "-1": "file error", - /* Z_ERRNO (-1) */ - "-2": "stream error", - /* Z_STREAM_ERROR (-2) */ - "-3": "data error", - /* Z_DATA_ERROR (-3) */ - "-4": "insufficient memory", - /* Z_MEM_ERROR (-4) */ - "-5": "buffer error", - /* Z_BUF_ERROR (-5) */ - "-6": "incompatible version" - /* Z_VERSION_ERROR (-6) */ - }; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js -var require_deflate = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var utils = require_common(); - var trees = require_trees(); - var adler32 = require_adler32(); - var crc322 = require_crc322(); - var msg = require_messages(); - var Z_NO_FLUSH = 0; - var Z_PARTIAL_FLUSH = 1; - var Z_FULL_FLUSH = 3; - var Z_FINISH = 4; - var Z_BLOCK = 5; - var Z_OK = 0; - var Z_STREAM_END = 1; - var Z_STREAM_ERROR = -2; - var Z_DATA_ERROR = -3; - var Z_BUF_ERROR = -5; - var Z_DEFAULT_COMPRESSION = -1; - var Z_FILTERED = 1; - var Z_HUFFMAN_ONLY = 2; - var Z_RLE = 3; - var Z_FIXED = 4; - var Z_DEFAULT_STRATEGY = 0; - var Z_UNKNOWN = 2; - var Z_DEFLATED = 8; - var MAX_MEM_LEVEL = 9; - var MAX_WBITS = 15; - var DEF_MEM_LEVEL = 8; - var LENGTH_CODES = 29; - var LITERALS = 256; - var L_CODES = LITERALS + 1 + LENGTH_CODES; - var D_CODES = 30; - var BL_CODES = 19; - var HEAP_SIZE = 2 * L_CODES + 1; - var MAX_BITS = 15; - var MIN_MATCH = 3; - var MAX_MATCH = 258; - var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; - var PRESET_DICT = 32; - var INIT_STATE = 42; - var EXTRA_STATE = 69; - var NAME_STATE = 73; - var COMMENT_STATE = 91; - var HCRC_STATE = 103; - var BUSY_STATE = 113; - var FINISH_STATE = 666; - var BS_NEED_MORE = 1; - var BS_BLOCK_DONE = 2; - var BS_FINISH_STARTED = 3; - var BS_FINISH_DONE = 4; - var OS_CODE = 3; - function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; - } - function rank(f) { - return (f << 1) - (f > 4 ? 9 : 0); - } - function zero(buf) { - var len = buf.length; - while (--len >= 0) { - buf[len] = 0; - } - } - function flush_pending(strm) { - var s = strm.state; - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { - return; - } - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } - } - function flush_block_only(s, last2) { - trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last2); - s.block_start = s.strstart; - flush_pending(s.strm); - } - function put_byte(s, b) { - s.pending_buf[s.pending++] = b; - } - function putShortMSB(s, b) { - s.pending_buf[s.pending++] = b >>> 8 & 255; - s.pending_buf[s.pending++] = b & 255; - } - function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - if (len > size) { - len = size; - } - if (len === 0) { - return 0; - } - strm.avail_in -= len; - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } else if (strm.state.wrap === 2) { - strm.adler = crc322(strm.adler, buf, len, start); - } - strm.next_in += len; - strm.total_in += len; - return len; - } - function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; - var scan = s.strstart; - var match; - var len; - var best_len = s.prev_length; - var nice_match = s.nice_match; - var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0; - var _win = s.window; - var wmask = s.w_mask; - var prev = s.prev; - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - if (nice_match > s.lookahead) { - nice_match = s.lookahead; - } - do { - match = cur_match; - if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { - continue; - } - scan += 2; - match++; - do { - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; - } - function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - do { - more = s.window_size - s.lookahead - s.strstart; - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - s.block_start -= _w_size; - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = m >= _w_size ? m - _w_size : 0; - } while (--n); - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = m >= _w_size ? m - _w_size : 0; - } while (--n); - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask; - while (s.insert) { - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - } - function deflate_stored(s, flush2) { - var max_block_size = 65535; - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - for (; ; ) { - if (s.lookahead <= 1) { - fill_window(s); - if (s.lookahead === 0 && flush2 === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } - } - s.strstart += s.lookahead; - s.lookahead = 0; - var max_start = s.block_start + max_block_size; - if (s.strstart === 0 || s.strstart >= max_start) { - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } - s.insert = 0; - if (flush2 === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.strstart > s.block_start) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_NEED_MORE; - } - function deflate_fast(s, flush2) { - var hash_head; - var bflush; - for (; ; ) { - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush2 === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } - } - hash_head = 0; - if (s.lookahead >= MIN_MATCH) { - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } - if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { - s.match_length = longest_match(s, hash_head); - } - if (s.match_length >= MIN_MATCH) { - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - s.lookahead -= s.match_length; - if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) { - s.match_length--; - do { - s.strstart++; - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } while (--s.match_length !== 0); - s.strstart++; - } else { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask; - } - } else { - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - } - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush2 === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.last_lit) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; - } - function deflate_slow(s, flush2) { - var hash_head; - var bflush; - var max_insert; - for (; ; ) { - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush2 === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } - } - hash_head = 0; - if (s.lookahead >= MIN_MATCH) { - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { - s.match_length = longest_match(s, hash_head); - if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096)) { - s.match_length = MIN_MATCH - 1; - } - } - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } else if (s.match_available) { - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - if (bflush) { - flush_block_only(s, false); - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - if (s.match_available) { - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush2 === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.last_lit) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; - } - function deflate_rle(s, flush2) { - var bflush; - var prev; - var scan, strend; - var _win = s.window; - for (; ; ) { - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush2 === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } - } - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - } - if (s.match_length >= MIN_MATCH) { - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - } - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } - s.insert = 0; - if (flush2 === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.last_lit) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; - } - function deflate_huff(s, flush2) { - var bflush; - for (; ; ) { - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush2 === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; - } - } - s.match_length = 0; - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } - s.insert = 0; - if (flush2 === Z_FINISH) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.last_lit) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; - } - function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; - } - var configuration_table; - configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), - /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), - /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), - /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), - /* 3 */ - new Config(4, 4, 16, 16, deflate_slow), - /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), - /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), - /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), - /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), - /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) - /* 9 max compression */ - ]; - function lm_init(s) { - s.window_size = 2 * s.w_size; - zero(s.head); - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; - } - function DeflateState() { - 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 = Z_DEFLATED; - 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 utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - this.l_desc = null; - this.d_desc = null; - this.bl_desc = null; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - this.heap = new utils.Buf16(2 * L_CODES + 1); - zero(this.heap); - this.heap_len = 0; - this.heap_max = 0; - this.depth = new utils.Buf16(2 * L_CODES + 1); - zero(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 deflateResetKeep(strm) { - var s; - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - s = strm.state; - s.pending = 0; - s.pending_out = 0; - if (s.wrap < 0) { - s.wrap = -s.wrap; - } - s.status = s.wrap ? INIT_STATE : BUSY_STATE; - strm.adler = s.wrap === 2 ? 0 : 1; - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; - } - function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; - } - function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - if (strm.state.wrap !== 2) { - return Z_STREAM_ERROR; - } - strm.state.gzhead = head; - return Z_OK; - } - function deflateInit2(strm, level, method2, windowBits, memLevel, strategy) { - if (!strm) { - return Z_STREAM_ERROR; - } - var wrap = 1; - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else if (windowBits > 15) { - wrap = 2; - windowBits -= 16; - } - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method2 !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - if (windowBits === 8) { - windowBits = 9; - } - var s = new DeflateState(); - strm.state = s; - s.strm = strm; - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - s.lit_bufsize = 1 << memLevel + 6; - s.pending_buf_size = s.lit_bufsize * 4; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - s.d_buf = 1 * s.lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - s.level = level; - s.strategy = strategy; - s.method = method2; - return deflateReset(strm); - } - function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); - } - function deflate2(strm, flush2) { - var old_flush, s; - var beg, val; - if (!strm || !strm.state || flush2 > Z_BLOCK || flush2 < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - s = strm.state; - if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush2 !== Z_FINISH) { - return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - s.strm = strm; - old_flush = s.last_flush; - s.last_flush = flush2; - if (s.status === INIT_STATE) { - if (s.wrap === 2) { - strm.adler = 0; - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } else { - put_byte( - s, - (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 255); - put_byte(s, s.gzhead.time >> 8 & 255); - put_byte(s, s.gzhead.time >> 16 & 255); - put_byte(s, s.gzhead.time >> 24 & 255); - put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); - put_byte(s, s.gzhead.os & 255); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 255); - put_byte(s, s.gzhead.extra.length >> 8 & 255); - } - if (s.gzhead.hcrc) { - strm.adler = crc322(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } else { - var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8; - var level_flags = -1; - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= level_flags << 6; - if (s.strstart !== 0) { - header |= PRESET_DICT; - } - header += 31 - header % 31; - s.status = BUSY_STATE; - putShortMSB(s, header); - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 65535); - } - strm.adler = 1; - } - } - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra) { - beg = s.pending; - while (s.gzindex < (s.gzhead.extra.length & 65535)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc322(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 255); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc322(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name) { - beg = s.pending; - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc322(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 255; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc322(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment) { - beg = s.pending; - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc322(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc322(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 255); - put_byte(s, strm.adler >> 8 & 255); - strm.adler = 0; - s.status = BUSY_STATE; - } - } else { - s.status = BUSY_STATE; - } - } - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; - return Z_OK; - } - } else if (strm.avail_in === 0 && rank(flush2) <= rank(old_flush) && flush2 !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - if (strm.avail_in !== 0 || s.lookahead !== 0 || flush2 !== Z_NO_FLUSH && s.status !== FINISH_STATE) { - var bstate = s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush2) : s.strategy === Z_RLE ? deflate_rle(s, flush2) : configuration_table[s.level].func(s, flush2); - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - } - return Z_OK; - } - if (bstate === BS_BLOCK_DONE) { - if (flush2 === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } else if (flush2 !== Z_BLOCK) { - trees._tr_stored_block(s, 0, 0, false); - if (flush2 === Z_FULL_FLUSH) { - zero(s.head); - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; - return Z_OK; - } - } - } - if (flush2 !== Z_FINISH) { - return Z_OK; - } - if (s.wrap <= 0) { - return Z_STREAM_END; - } - if (s.wrap === 2) { - put_byte(s, strm.adler & 255); - put_byte(s, strm.adler >> 8 & 255); - put_byte(s, strm.adler >> 16 & 255); - put_byte(s, strm.adler >> 24 & 255); - put_byte(s, strm.total_in & 255); - put_byte(s, strm.total_in >> 8 & 255); - put_byte(s, strm.total_in >> 16 & 255); - put_byte(s, strm.total_in >> 24 & 255); - } else { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 65535); - } - flush_pending(strm); - if (s.wrap > 0) { - s.wrap = -s.wrap; - } - return s.pending !== 0 ? Z_OK : Z_STREAM_END; - } - function deflateEnd(strm) { - var status2; - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - status2 = strm.state.status; - if (status2 !== INIT_STATE && status2 !== EXTRA_STATE && status2 !== NAME_STATE && status2 !== COMMENT_STATE && status2 !== HCRC_STATE && status2 !== BUSY_STATE && status2 !== FINISH_STATE) { - return err(strm, Z_STREAM_ERROR); - } - strm.state = null; - return status2 === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; - } - function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - s = strm.state; - wrap = s.wrap; - if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) { - return Z_STREAM_ERROR; - } - if (wrap === 1) { - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - s.wrap = 0; - if (dictLength >= s.w_size) { - if (wrap === 0) { - zero(s.head); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; - } - exports2.deflateInit = deflateInit; - exports2.deflateInit2 = deflateInit2; - exports2.deflateReset = deflateReset; - exports2.deflateResetKeep = deflateResetKeep; - exports2.deflateSetHeader = deflateSetHeader; - exports2.deflate = deflate2; - exports2.deflateEnd = deflateEnd; - exports2.deflateSetDictionary = deflateSetDictionary; - exports2.deflateInfo = "pako deflate (from Nodeca project)"; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js -var require_strings = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var utils = require_common(); - var STR_APPLY_OK = true; - var STR_APPLY_UIA_OK = true; - try { - String.fromCharCode.apply(null, [0]); - } catch (__) { - STR_APPLY_OK = false; - } - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch (__) { - STR_APPLY_UIA_OK = false; - } - var _utf8len = new utils.Buf8(256); - for (q = 0; q < 256; q++) { - _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; - } - var q; - _utf8len[254] = _utf8len[254] = 1; - exports2.string2buf = function(str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 64512) === 55296 && m_pos + 1 < str_len) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 64512) === 56320) { - c = 65536 + (c - 55296 << 10) + (c2 - 56320); - m_pos++; - } - } - buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4; - } - buf = new utils.Buf8(buf_len); - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 64512) === 55296 && m_pos + 1 < str_len) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 64512) === 56320) { - c = 65536 + (c - 55296 << 10) + (c2 - 56320); - m_pos++; - } - } - if (c < 128) { - buf[i++] = c; - } else if (c < 2048) { - buf[i++] = 192 | c >>> 6; - buf[i++] = 128 | c & 63; - } else if (c < 65536) { - buf[i++] = 224 | c >>> 12; - buf[i++] = 128 | c >>> 6 & 63; - buf[i++] = 128 | c & 63; - } else { - buf[i++] = 240 | c >>> 18; - buf[i++] = 128 | c >>> 12 & 63; - buf[i++] = 128 | c >>> 6 & 63; - buf[i++] = 128 | c & 63; - } - } - return buf; - }; - function buf2binstring(buf, len) { - if (len < 65534) { - if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) { - return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); - } - } - var result = ""; - for (var i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); - } - return result; - } - exports2.buf2binstring = function(buf) { - return buf2binstring(buf, buf.length); - }; - exports2.binstring2buf = function(str) { - var buf = new utils.Buf8(str.length); - for (var i = 0, len = buf.length; i < len; i++) { - buf[i] = str.charCodeAt(i); - } - return buf; - }; - exports2.buf2string = function(buf, max) { - var i, out, c, c_len; - var len = max || buf.length; - var utf16buf = new Array(len * 2); - for (out = 0, i = 0; i < len; ) { - c = buf[i++]; - if (c < 128) { - utf16buf[out++] = c; - continue; - } - c_len = _utf8len[c]; - if (c_len > 4) { - utf16buf[out++] = 65533; - i += c_len - 1; - continue; - } - c &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; - while (c_len > 1 && i < len) { - c = c << 6 | buf[i++] & 63; - c_len--; - } - if (c_len > 1) { - utf16buf[out++] = 65533; - continue; - } - if (c < 65536) { - utf16buf[out++] = c; - } else { - c -= 65536; - utf16buf[out++] = 55296 | c >> 10 & 1023; - utf16buf[out++] = 56320 | c & 1023; - } - } - return buf2binstring(utf16buf, out); - }; - exports2.utf8border = function(buf, max) { - var pos; - max = max || buf.length; - if (max > buf.length) { - max = buf.length; - } - pos = max - 1; - while (pos >= 0 && (buf[pos] & 192) === 128) { - pos--; - } - if (pos < 0) { - return max; - } - if (pos === 0) { - return max; - } - return pos + _utf8len[buf[pos]] > max ? pos : max; - }; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js -var require_zstream = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - function ZStream() { - 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; - } - module2.exports = ZStream; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js -var require_deflate2 = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var zlib_deflate = require_deflate(); - var utils = require_common(); - var strings = require_strings(); - var msg = require_messages(); - var ZStream = require_zstream(); - var toString = Object.prototype.toString; - var Z_NO_FLUSH = 0; - var Z_FINISH = 4; - var Z_OK = 0; - var Z_STREAM_END = 1; - var Z_SYNC_FLUSH = 2; - var Z_DEFAULT_COMPRESSION = -1; - var Z_DEFAULT_STRATEGY = 0; - var Z_DEFLATED = 8; - function Deflate(options) { - if (!(this instanceof Deflate)) return new Deflate(options); - this.options = utils.assign({ - level: Z_DEFAULT_COMPRESSION, - method: Z_DEFLATED, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Z_DEFAULT_STRATEGY, - to: "" - }, options || {}); - var opt = this.options; - if (opt.raw && opt.windowBits > 0) { - opt.windowBits = -opt.windowBits; - } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) { - opt.windowBits += 16; - } - this.err = 0; - this.msg = ""; - this.ended = false; - this.chunks = []; - this.strm = new ZStream(); - this.strm.avail_out = 0; - var status2 = zlib_deflate.deflateInit2( - this.strm, - opt.level, - opt.method, - opt.windowBits, - opt.memLevel, - opt.strategy - ); - if (status2 !== Z_OK) { - throw new Error(msg[status2]); - } - if (opt.header) { - zlib_deflate.deflateSetHeader(this.strm, opt.header); - } - if (opt.dictionary) { - var dict; - if (typeof opt.dictionary === "string") { - dict = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { - dict = new Uint8Array(opt.dictionary); - } else { - dict = opt.dictionary; - } - status2 = zlib_deflate.deflateSetDictionary(this.strm, dict); - if (status2 !== Z_OK) { - throw new Error(msg[status2]); - } - this._dict_set = true; - } - } - Deflate.prototype.push = function(data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var status2, _mode; - if (this.ended) { - return false; - } - _mode = mode === ~~mode ? mode : mode === true ? Z_FINISH : Z_NO_FLUSH; - if (typeof data === "string") { - strm.input = strings.string2buf(data); - } else if (toString.call(data) === "[object ArrayBuffer]") { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - strm.next_in = 0; - strm.avail_in = strm.input.length; - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status2 = zlib_deflate.deflate(strm, _mode); - if (status2 !== Z_STREAM_END && status2 !== Z_OK) { - this.onEnd(status2); - this.ended = true; - return false; - } - if (strm.avail_out === 0 || strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH)) { - if (this.options.to === "string") { - this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status2 !== Z_STREAM_END); - if (_mode === Z_FINISH) { - status2 = zlib_deflate.deflateEnd(this.strm); - this.onEnd(status2); - this.ended = true; - return status2 === Z_OK; - } - if (_mode === Z_SYNC_FLUSH) { - this.onEnd(Z_OK); - strm.avail_out = 0; - return true; - } - return true; - }; - Deflate.prototype.onData = function(chunk) { - this.chunks.push(chunk); - }; - Deflate.prototype.onEnd = function(status2) { - if (status2 === Z_OK) { - if (this.options.to === "string") { - this.result = this.chunks.join(""); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status2; - this.msg = this.strm.msg; - }; - function deflate2(input, options) { - var deflator = new Deflate(options); - deflator.push(input, true); - if (deflator.err) { - throw deflator.msg || msg[deflator.err]; - } - return deflator.result; - } - function deflateRaw(input, options) { - options = options || {}; - options.raw = true; - return deflate2(input, options); - } - function gzip(input, options) { - options = options || {}; - options.gzip = true; - return deflate2(input, options); - } - exports2.Deflate = Deflate; - exports2.deflate = deflate2; - exports2.deflateRaw = deflateRaw; - exports2.gzip = gzip; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js -var require_inffast = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var BAD = 30; - var TYPE = 12; - module2.exports = function inflate_fast(strm, start) { - var state; - var _in; - var last2; - var _out; - var beg; - var end; - var dmax; - var wsize; - var whave; - var wnext; - var s_window; - var hold; - var bits; - var lcode; - var dcode; - var lmask; - var dmask; - var here; - var op; - var len; - var dist; - var from; - var from_source; - var input, output; - state = strm.state; - _in = strm.next_in; - input = strm.input; - last2 = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); - dmax = state.dmax; - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = lcode[hold & lmask]; - dolen: - for (; ; ) { - op = here >>> 24; - hold >>>= op; - bits -= op; - op = here >>> 16 & 255; - if (op === 0) { - output[_out++] = here & 65535; - } else if (op & 16) { - len = here & 65535; - op &= 15; - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & (1 << op) - 1; - hold >>>= op; - bits -= op; - } - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - dodist: - for (; ; ) { - op = here >>> 24; - hold >>>= op; - bits -= op; - op = here >>> 16 & 255; - if (op & 16) { - dist = here & 65535; - op &= 15; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & (1 << op) - 1; - if (dist > dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break top; - } - hold >>>= op; - bits -= op; - op = _out - beg; - if (dist > op) { - op = dist - op; - if (op > whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break top; - } - } - from = 0; - from_source = s_window; - if (wnext === 0) { - from += wsize - op; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } else if (wnext < op) { - from += wsize + wnext - op; - op -= wnext; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } - } else { - from += wnext - op; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } else { - from = _out - dist; - do { - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } else if ((op & 64) === 0) { - here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; - continue dodist; - } else { - strm.msg = "invalid distance code"; - state.mode = BAD; - break top; - } - break; - } - } else if ((op & 64) === 0) { - here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; - continue dolen; - } else if (op & 32) { - state.mode = TYPE; - break top; - } else { - strm.msg = "invalid literal/length code"; - state.mode = BAD; - break top; - } - break; - } - } while (_in < last2 && _out < end); - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = _in < last2 ? 5 + (last2 - _in) : 5 - (_in - last2); - strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); - state.hold = hold; - state.bits = bits; - return; - }; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js -var require_inftrees = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var utils = require_common(); - var MAXBITS = 15; - var ENOUGH_LENS = 852; - var ENOUGH_DISTS = 592; - var CODES = 0; - var LENS = 1; - var DISTS = 2; - var lbase = [ - /* Length codes 257..285 base */ - 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 - ]; - var lext = [ - /* Length codes 257..285 extra */ - 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 - ]; - var dbase = [ - /* Distance codes 0..29 base */ - 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 - ]; - var dext = [ - /* Distance codes 0..29 extra */ - 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 - ]; - module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { - var bits = opts.bits; - var len = 0; - var sym = 0; - var min = 0, max = 0; - var root2 = 0; - var curr = 0; - var drop = 0; - var left = 0; - var used = 0; - var huff = 0; - var incr; - var fill; - var low; - var mask; - var next; - var base = null; - var base_index = 0; - var end; - var count = new utils.Buf16(MAXBITS + 1); - var offs = new utils.Buf16(MAXBITS + 1); - var extra = null; - var extra_index = 0; - var here_bits, here_op, here_val; - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - root2 = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { - break; - } - } - if (root2 > max) { - root2 = max; - } - if (max === 0) { - table[table_index++] = 1 << 24 | 64 << 16 | 0; - table[table_index++] = 1 << 24 | 64 << 16 | 0; - opts.bits = 1; - return 0; - } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { - break; - } - } - if (root2 < min) { - root2 = min; - } - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } - } - if (left > 0 && (type === CODES || max !== 1)) { - return -1; - } - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - if (type === CODES) { - base = extra = work; - end = 19; - } else if (type === LENS) { - base = lbase; - base_index -= 257; - extra = lext; - extra_index -= 257; - end = 256; - } else { - base = dbase; - extra = dext; - end = -1; - } - huff = 0; - sym = 0; - len = min; - next = table_index; - curr = root2; - drop = 0; - low = -1; - used = 1 << root2; - mask = used - 1; - if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { - return 1; - } - for (; ; ) { - here_bits = len - drop; - if (work[sym] < end) { - here_op = 0; - here_val = work[sym]; - } else if (work[sym] > end) { - here_op = extra[extra_index + work[sym]]; - here_val = base[base_index + work[sym]]; - } else { - here_op = 32 + 64; - here_val = 0; - } - incr = 1 << len - drop; - fill = 1 << curr; - min = fill; - do { - fill -= incr; - table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; - } while (fill !== 0); - incr = 1 << len - 1; - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - sym++; - if (--count[len] === 0) { - if (len === max) { - break; - } - len = lens[lens_index + work[sym]]; - } - if (len > root2 && (huff & mask) !== low) { - if (drop === 0) { - drop = root2; - } - next += min; - curr = len - drop; - left = 1 << curr; - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) { - break; - } - curr++; - left <<= 1; - } - used += 1 << curr; - if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { - return 1; - } - low = huff & mask; - table[low] = root2 << 24 | curr << 16 | next - table_index | 0; - } - } - if (huff !== 0) { - table[next + huff] = len - drop << 24 | 64 << 16 | 0; - } - opts.bits = root2; - return 0; - }; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js -var require_inflate = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var utils = require_common(); - var adler32 = require_adler32(); - var crc322 = require_crc322(); - var inflate_fast = require_inffast(); - var inflate_table = require_inftrees(); - var CODES = 0; - var LENS = 1; - var DISTS = 2; - var Z_FINISH = 4; - var Z_BLOCK = 5; - var Z_TREES = 6; - var Z_OK = 0; - var Z_STREAM_END = 1; - var Z_NEED_DICT = 2; - var Z_STREAM_ERROR = -2; - var Z_DATA_ERROR = -3; - var Z_MEM_ERROR = -4; - var Z_BUF_ERROR = -5; - var Z_DEFLATED = 8; - var HEAD = 1; - var FLAGS = 2; - var TIME = 3; - var OS = 4; - var EXLEN = 5; - var EXTRA2 = 6; - var NAME = 7; - var COMMENT = 8; - var HCRC = 9; - var DICTID = 10; - var DICT = 11; - var TYPE = 12; - var TYPEDO = 13; - var STORED = 14; - var COPY_ = 15; - var COPY = 16; - var TABLE = 17; - var LENLENS = 18; - var CODELENS = 19; - var LEN_ = 20; - var LEN = 21; - var LENEXT = 22; - var DIST = 23; - var DISTEXT = 24; - var MATCH = 25; - var LIT = 26; - var CHECK = 27; - var LENGTH = 28; - var DONE = 29; - var BAD = 30; - var MEM = 31; - var SYNC = 32; - var ENOUGH_LENS = 852; - var ENOUGH_DISTS = 592; - var MAX_WBITS = 15; - var DEF_WBITS = MAX_WBITS; - function zswap32(q) { - return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); - } - function InflateState() { - this.mode = 0; - this.last = false; - this.wrap = 0; - this.havedict = false; - 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 utils.Buf16(320); - this.work = new utils.Buf16(288); - this.lendyn = null; - this.distdyn = null; - this.sane = 0; - this.back = 0; - this.was = 0; - } - function inflateResetKeep(strm) { - var state; - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ""; - if (state.wrap) { - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.dmax = 32768; - state.head = null; - state.hold = 0; - state.bits = 0; - state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); - state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); - state.sane = 1; - state.back = -1; - return Z_OK; - } - function inflateReset(strm) { - var state; - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); - } - function inflateReset2(strm, windowBits) { - var wrap; - var state; - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - state = strm.state; - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else { - wrap = (windowBits >> 4) + 1; - if (windowBits < 48) { - windowBits &= 15; - } - } - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); - } - function inflateInit2(strm, windowBits) { - var ret; - var state; - if (!strm) { - return Z_STREAM_ERROR; - } - state = new InflateState(); - strm.state = state; - state.window = null; - ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null; - } - return ret; - } - function inflateInit(strm) { - return inflateInit2(strm, DEF_WBITS); - } - var virgin = true; - var lenfix; - var distfix; - function fixedtables(state) { - if (virgin) { - var sym; - lenfix = new utils.Buf32(512); - distfix = new utils.Buf32(32); - sym = 0; - while (sym < 144) { - state.lens[sym++] = 8; - } - while (sym < 256) { - state.lens[sym++] = 9; - } - while (sym < 280) { - state.lens[sym++] = 7; - } - while (sym < 288) { - state.lens[sym++] = 8; - } - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - sym = 0; - while (sym < 32) { - state.lens[sym++] = 5; - } - inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - virgin = false; - } - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; - } - function updatewindow(strm, src, end, copy2) { - var dist; - var state = strm.state; - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - state.window = new utils.Buf8(state.wsize); - } - if (copy2 >= state.wsize) { - utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); - state.wnext = 0; - state.whave = state.wsize; - } else { - dist = state.wsize - state.wnext; - if (dist > copy2) { - dist = copy2; - } - utils.arraySet(state.window, src, end - copy2, dist, state.wnext); - copy2 -= dist; - if (copy2) { - utils.arraySet(state.window, src, end - copy2, copy2, 0); - state.wnext = copy2; - state.whave = state.wsize; - } else { - state.wnext += dist; - if (state.wnext === state.wsize) { - state.wnext = 0; - } - if (state.whave < state.wsize) { - state.whave += dist; - } - } - } - return 0; - } - function inflate2(strm, flush2) { - var state; - var input, output; - var next; - var put; - var have, left; - var hold; - var bits; - var _in, _out; - var copy2; - var from; - var from_source; - var here = 0; - var here_bits, here_op, here_val; - var last_bits, last_op, last_val; - var len; - var ret; - var hbuf = new utils.Buf8(4); - var opts; - var n; - var order = ( - /* permutation of code lengths */ - [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] - ); - if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) { - return Z_STREAM_ERROR; - } - state = strm.state; - if (state.mode === TYPE) { - state.mode = TYPEDO; - } - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - _in = have; - _out = left; - ret = Z_OK; - inf_leave: - for (; ; ) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.wrap & 2 && hold === 35615) { - state.check = 0; - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc322(state.check, hbuf, 2, 0); - hold = 0; - bits = 0; - state.mode = FLAGS; - break; - } - state.flags = 0; - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 255) << 8) + (hold >> 8)) % 31) { - strm.msg = "incorrect header check"; - state.mode = BAD; - break; - } - if ((hold & 15) !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - hold >>>= 4; - bits -= 4; - len = (hold & 15) + 8; - if (state.wbits === 0) { - state.wbits = len; - } else if (len > state.wbits) { - strm.msg = "invalid window size"; - state.mode = BAD; - break; - } - state.dmax = 1 << len; - strm.adler = state.check = 1; - state.mode = hold & 512 ? DICTID : TYPE; - hold = 0; - bits = 0; - break; - case FLAGS: - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.flags = hold; - if ((state.flags & 255) !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - if (state.flags & 57344) { - strm.msg = "unknown header flags set"; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = hold >> 8 & 1; - } - if (state.flags & 512) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc322(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - state.mode = TIME; - case TIME: - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.head) { - state.head.time = hold; - } - if (state.flags & 512) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - hbuf[2] = hold >>> 16 & 255; - hbuf[3] = hold >>> 24 & 255; - state.check = crc322(state.check, hbuf, 4, 0); - } - hold = 0; - bits = 0; - state.mode = OS; - case OS: - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.head) { - state.head.xflags = hold & 255; - state.head.os = hold >> 8; - } - if (state.flags & 512) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc322(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - state.mode = EXLEN; - case EXLEN: - if (state.flags & 1024) { - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 512) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc322(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - } else if (state.head) { - state.head.extra = null; - } - state.mode = EXTRA2; - case EXTRA2: - if (state.flags & 1024) { - copy2 = state.length; - if (copy2 > have) { - copy2 = have; - } - if (copy2) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - state.head.extra = new Array(state.head.extra_len); - } - utils.arraySet( - state.head.extra, - input, - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - copy2, - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - } - if (state.flags & 512) { - state.check = crc322(state.check, input, copy2, next); - } - have -= copy2; - next += copy2; - state.length -= copy2; - } - if (state.length) { - break inf_leave; - } - } - state.length = 0; - state.mode = NAME; - case NAME: - if (state.flags & 2048) { - if (have === 0) { - break inf_leave; - } - copy2 = 0; - do { - len = input[next + copy2++]; - if (state.head && len && state.length < 65536) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy2 < have); - if (state.flags & 512) { - state.check = crc322(state.check, input, copy2, next); - } - have -= copy2; - next += copy2; - if (len) { - break inf_leave; - } - } else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - case COMMENT: - if (state.flags & 4096) { - if (have === 0) { - break inf_leave; - } - copy2 = 0; - do { - len = input[next + copy2++]; - if (state.head && len && state.length < 65536) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy2 < have); - if (state.flags & 512) { - state.check = crc322(state.check, input, copy2, next); - } - have -= copy2; - next += copy2; - if (len) { - break inf_leave; - } - } else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - case HCRC: - if (state.flags & 512) { - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (hold !== (state.check & 65535)) { - strm.msg = "header crc mismatch"; - state.mode = BAD; - break; - } - hold = 0; - bits = 0; - } - if (state.head) { - state.head.hcrc = state.flags >> 9 & 1; - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - strm.adler = state.check = zswap32(hold); - hold = 0; - bits = 0; - state.mode = DICT; - case DICT: - if (state.havedict === 0) { - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - return Z_NEED_DICT; - } - strm.adler = state.check = 1; - state.mode = TYPE; - case TYPE: - if (flush2 === Z_BLOCK || flush2 === Z_TREES) { - break inf_leave; - } - case TYPEDO: - if (state.last) { - hold >>>= bits & 7; - bits -= bits & 7; - state.mode = CHECK; - break; - } - while (bits < 3) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.last = hold & 1; - hold >>>= 1; - bits -= 1; - switch (hold & 3) { - case 0: - state.mode = STORED; - break; - case 1: - fixedtables(state); - state.mode = LEN_; - if (flush2 === Z_TREES) { - hold >>>= 2; - bits -= 2; - break inf_leave; - } - break; - case 2: - state.mode = TABLE; - break; - case 3: - strm.msg = "invalid block type"; - state.mode = BAD; - } - hold >>>= 2; - bits -= 2; - break; - case STORED: - hold >>>= bits & 7; - bits -= bits & 7; - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { - strm.msg = "invalid stored block lengths"; - state.mode = BAD; - break; - } - state.length = hold & 65535; - hold = 0; - bits = 0; - state.mode = COPY_; - if (flush2 === Z_TREES) { - break inf_leave; - } - case COPY_: - state.mode = COPY; - case COPY: - copy2 = state.length; - if (copy2) { - if (copy2 > have) { - copy2 = have; - } - if (copy2 > left) { - copy2 = left; - } - if (copy2 === 0) { - break inf_leave; - } - utils.arraySet(output, input, next, copy2, put); - have -= copy2; - next += copy2; - left -= copy2; - put += copy2; - state.length -= copy2; - break; - } - state.mode = TYPE; - break; - case TABLE: - while (bits < 14) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.nlen = (hold & 31) + 257; - hold >>>= 5; - bits -= 5; - state.ndist = (hold & 31) + 1; - hold >>>= 5; - bits -= 5; - state.ncode = (hold & 15) + 4; - hold >>>= 4; - bits -= 4; - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = "too many length or distance symbols"; - state.mode = BAD; - break; - } - state.have = 0; - state.mode = LENLENS; - case LENLENS: - while (state.have < state.ncode) { - while (bits < 3) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.lens[order[state.have++]] = hold & 7; - hold >>>= 3; - bits -= 3; - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - state.lencode = state.lendyn; - state.lenbits = 7; - opts = { bits: state.lenbits }; - ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - if (ret) { - strm.msg = "invalid code lengths set"; - state.mode = BAD; - break; - } - state.have = 0; - state.mode = CODELENS; - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (; ; ) { - here = state.lencode[hold & (1 << state.lenbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (here_val < 16) { - hold >>>= here_bits; - bits -= here_bits; - state.lens[state.have++] = here_val; - } else { - if (here_val === 16) { - n = here_bits + 2; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - if (state.have === 0) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy2 = 3 + (hold & 3); - hold >>>= 2; - bits -= 2; - } else if (here_val === 17) { - n = here_bits + 3; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - len = 0; - copy2 = 3 + (hold & 7); - hold >>>= 3; - bits -= 3; - } else { - n = here_bits + 7; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - len = 0; - copy2 = 11 + (hold & 127); - hold >>>= 7; - bits -= 7; - } - if (state.have + copy2 > state.nlen + state.ndist) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - while (copy2--) { - state.lens[state.have++] = len; - } - } - } - if (state.mode === BAD) { - break; - } - if (state.lens[256] === 0) { - strm.msg = "invalid code -- missing end-of-block"; - state.mode = BAD; - break; - } - state.lenbits = 9; - opts = { bits: state.lenbits }; - ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - if (ret) { - strm.msg = "invalid literal/lengths set"; - state.mode = BAD; - break; - } - state.distbits = 6; - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - state.distbits = opts.bits; - if (ret) { - strm.msg = "invalid distances set"; - state.mode = BAD; - break; - } - state.mode = LEN_; - if (flush2 === Z_TREES) { - break inf_leave; - } - case LEN_: - state.mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - inflate_fast(strm, _out); - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (; ; ) { - here = state.lencode[hold & (1 << state.lenbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (here_op && (here_op & 240) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (; ; ) { - here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (last_bits + here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= last_bits; - bits -= last_bits; - state.back += last_bits; - } - hold >>>= here_bits; - bits -= here_bits; - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - state.mode = LIT; - break; - } - if (here_op & 32) { - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = "invalid literal/length code"; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - case LENEXT: - if (state.extra) { - n = state.extra; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.length += hold & (1 << state.extra) - 1; - hold >>>= state.extra; - bits -= state.extra; - state.back += state.extra; - } - state.was = state.length; - state.mode = DIST; - case DIST: - for (; ; ) { - here = state.distcode[hold & (1 << state.distbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if ((here_op & 240) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (; ; ) { - here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (last_bits + here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= last_bits; - bits -= last_bits; - state.back += last_bits; - } - hold >>>= here_bits; - bits -= here_bits; - state.back += here_bits; - if (here_op & 64) { - strm.msg = "invalid distance code"; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = here_op & 15; - state.mode = DISTEXT; - case DISTEXT: - if (state.extra) { - n = state.extra; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.offset += hold & (1 << state.extra) - 1; - hold >>>= state.extra; - bits -= state.extra; - state.back += state.extra; - } - if (state.offset > state.dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; - } - state.mode = MATCH; - case MATCH: - if (left === 0) { - break inf_leave; - } - copy2 = _out - left; - if (state.offset > copy2) { - copy2 = state.offset - copy2; - if (copy2 > state.whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; - } - } - if (copy2 > state.wnext) { - copy2 -= state.wnext; - from = state.wsize - copy2; - } else { - from = state.wnext - copy2; - } - if (copy2 > state.length) { - copy2 = state.length; - } - from_source = state.window; - } else { - from_source = output; - from = put - state.offset; - copy2 = state.length; - } - if (copy2 > left) { - copy2 = left; - } - left -= copy2; - state.length -= copy2; - do { - output[put++] = from_source[from++]; - } while (--copy2); - if (state.length === 0) { - state.mode = LEN; - } - break; - case LIT: - if (left === 0) { - break inf_leave; - } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold |= input[next++] << bits; - bits += 8; - } - _out -= left; - strm.total_out += _out; - state.total += _out; - if (_out) { - strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ - state.flags ? crc322(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out); - } - _out = left; - if ((state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = "incorrect data check"; - state.mode = BAD; - break; - } - hold = 0; - bits = 0; - } - state.mode = LENGTH; - case LENGTH: - if (state.wrap && state.flags) { - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (hold !== (state.total & 4294967295)) { - strm.msg = "incorrect length check"; - state.mode = BAD; - break; - } - hold = 0; - bits = 0; - } - state.mode = DONE; - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - } - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush2 !== Z_FINISH)) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; - } - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap && _out) { - strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - state.flags ? crc322(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if ((_in === 0 && _out === 0 || flush2 === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; - } - return ret; - } - function inflateEnd(strm) { - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - var state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK; - } - function inflateGetHeader(strm, head) { - var state; - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - state = strm.state; - if ((state.wrap & 2) === 0) { - return Z_STREAM_ERROR; - } - state.head = head; - head.done = false; - return Z_OK; - } - function inflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - var state; - var dictid; - var ret; - if (!strm || !strm.state) { - return Z_STREAM_ERROR; - } - state = strm.state; - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; - } - if (state.mode === DICT) { - dictid = 1; - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; - } - } - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; - } - state.havedict = 1; - return Z_OK; - } - exports2.inflateReset = inflateReset; - exports2.inflateReset2 = inflateReset2; - exports2.inflateResetKeep = inflateResetKeep; - exports2.inflateInit = inflateInit; - exports2.inflateInit2 = inflateInit2; - exports2.inflate = inflate2; - exports2.inflateEnd = inflateEnd; - exports2.inflateGetHeader = inflateGetHeader; - exports2.inflateSetDictionary = inflateSetDictionary; - exports2.inflateInfo = "pako inflate (from Nodeca project)"; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js -var require_constants = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = { - /* Allowed flush values; see deflate() and inflate() below for details */ - 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, - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - //Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - /* compression levels */ - 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, - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type - }; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js -var require_gzheader = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - function GZheader() { - 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 = false; - } - module2.exports = GZheader; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js -var require_inflate2 = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var zlib_inflate = require_inflate(); - var utils = require_common(); - var strings = require_strings(); - var c = require_constants(); - var msg = require_messages(); - var ZStream = require_zstream(); - var GZheader = require_gzheader(); - var toString = Object.prototype.toString; - function Inflate(options) { - if (!(this instanceof Inflate)) return new Inflate(options); - this.options = utils.assign({ - chunkSize: 16384, - windowBits: 0, - to: "" - }, options || {}); - var opt = this.options; - if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { - opt.windowBits = -opt.windowBits; - if (opt.windowBits === 0) { - opt.windowBits = -15; - } - } - if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { - opt.windowBits += 32; - } - if (opt.windowBits > 15 && opt.windowBits < 48) { - if ((opt.windowBits & 15) === 0) { - opt.windowBits |= 15; - } - } - this.err = 0; - this.msg = ""; - this.ended = false; - this.chunks = []; - this.strm = new ZStream(); - this.strm.avail_out = 0; - var status2 = zlib_inflate.inflateInit2( - this.strm, - opt.windowBits - ); - if (status2 !== c.Z_OK) { - throw new Error(msg[status2]); - } - this.header = new GZheader(); - zlib_inflate.inflateGetHeader(this.strm, this.header); - if (opt.dictionary) { - if (typeof opt.dictionary === "string") { - opt.dictionary = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { - opt.dictionary = new Uint8Array(opt.dictionary); - } - if (opt.raw) { - status2 = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); - if (status2 !== c.Z_OK) { - throw new Error(msg[status2]); - } - } - } - } - Inflate.prototype.push = function(data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var dictionary = this.options.dictionary; - var status2, _mode; - var next_out_utf8, tail, utf8str; - var allowBufError = false; - if (this.ended) { - return false; - } - _mode = mode === ~~mode ? mode : mode === true ? c.Z_FINISH : c.Z_NO_FLUSH; - if (typeof data === "string") { - strm.input = strings.binstring2buf(data); - } else if (toString.call(data) === "[object ArrayBuffer]") { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - strm.next_in = 0; - strm.avail_in = strm.input.length; - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status2 = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); - if (status2 === c.Z_NEED_DICT && dictionary) { - status2 = zlib_inflate.inflateSetDictionary(this.strm, dictionary); - } - if (status2 === c.Z_BUF_ERROR && allowBufError === true) { - status2 = c.Z_OK; - allowBufError = false; - } - if (status2 !== c.Z_STREAM_END && status2 !== c.Z_OK) { - this.onEnd(status2); - this.ended = true; - return false; - } - if (strm.next_out) { - if (strm.avail_out === 0 || status2 === c.Z_STREAM_END || strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH)) { - if (this.options.to === "string") { - next_out_utf8 = strings.utf8border(strm.output, strm.next_out); - tail = strm.next_out - next_out_utf8; - utf8str = strings.buf2string(strm.output, next_out_utf8); - strm.next_out = tail; - strm.avail_out = chunkSize - tail; - if (tail) { - utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); - } - this.onData(utf8str); - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } - if (strm.avail_in === 0 && strm.avail_out === 0) { - allowBufError = true; - } - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status2 !== c.Z_STREAM_END); - if (status2 === c.Z_STREAM_END) { - _mode = c.Z_FINISH; - } - if (_mode === c.Z_FINISH) { - status2 = zlib_inflate.inflateEnd(this.strm); - this.onEnd(status2); - this.ended = true; - return status2 === c.Z_OK; - } - if (_mode === c.Z_SYNC_FLUSH) { - this.onEnd(c.Z_OK); - strm.avail_out = 0; - return true; - } - return true; - }; - Inflate.prototype.onData = function(chunk) { - this.chunks.push(chunk); - }; - Inflate.prototype.onEnd = function(status2) { - if (status2 === c.Z_OK) { - if (this.options.to === "string") { - this.result = this.chunks.join(""); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status2; - this.msg = this.strm.msg; - }; - function inflate2(input, options) { - var inflator = new Inflate(options); - inflator.push(input, true); - if (inflator.err) { - throw inflator.msg || msg[inflator.err]; - } - return inflator.result; - } - function inflateRaw(input, options) { - options = options || {}; - options.raw = true; - return inflate2(input, options); - } - exports2.Inflate = Inflate; - exports2.inflate = inflate2; - exports2.inflateRaw = inflateRaw; - exports2.ungzip = inflate2; - } -}); - -// node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js -var require_pako = __commonJS({ - "node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var assign2 = require_common().assign; - var deflate2 = require_deflate2(); - var inflate2 = require_inflate2(); - var constants = require_constants(); - var pako2 = {}; - assign2(pako2, deflate2, inflate2, constants); - module2.exports = pako2; - } -}); - -// node_modules/.pnpm/pify@4.0.1/node_modules/pify/index.js -var require_pify = __commonJS({ - "node_modules/.pnpm/pify@4.0.1/node_modules/pify/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var processFn = (fn, options) => function(...args) { - const P = options.promiseModule; - return new P((resolve2, reject) => { - if (options.multiArgs) { - args.push((...result) => { - if (options.errorFirst) { - if (result[0]) { - reject(result); - } else { - result.shift(); - resolve2(result); - } - } else { - resolve2(result); - } - }); - } else if (options.errorFirst) { - args.push((error, result) => { - if (error) { - reject(error); - } else { - resolve2(result); - } - }); - } else { - args.push(resolve2); - } - fn.apply(this, args); - }); - }; - module2.exports = (input, options) => { - options = Object.assign({ - exclude: [/.+(Sync|Stream)$/], - errorFirst: true, - promiseModule: Promise - }, options); - const objType = typeof input; - if (!(input !== null && (objType === "object" || objType === "function"))) { - throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${input === null ? "null" : objType}\``); - } - const filter = (key2) => { - const match = (pattern) => typeof pattern === "string" ? key2 === pattern : pattern.test(key2); - return options.include ? options.include.some(match) : !options.exclude.some(match); - }; - let ret; - if (objType === "function") { - ret = function(...args) { - return options.excludeMain ? input(...args) : processFn(input, options).apply(this, args); - }; - } else { - ret = Object.create(Object.getPrototypeOf(input)); - } - for (const key2 in input) { - const property = input[key2]; - ret[key2] = typeof property === "function" && filter(key2) ? processFn(property, options) : property; - } - return ret; - }; - } -}); - -// node_modules/.pnpm/ignore@5.3.1/node_modules/ignore/index.js -var require_ignore = __commonJS({ - "node_modules/.pnpm/ignore@5.3.1/node_modules/ignore/index.js"(exports2, module2) { - init_polyfill_buffer(); - function makeArray(subject) { - return Array.isArray(subject) ? subject : [subject]; - } - var EMPTY = ""; - var SPACE = " "; - var ESCAPE = "\\"; - var REGEX_TEST_BLANK_LINE = /^\s+$/; - var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/; - var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/; - var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/; - var REGEX_SPLITALL_CRLF = /\r?\n/g; - var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/; - var SLASH = "/"; - var TMP_KEY_IGNORE = "node-ignore"; - if (typeof Symbol !== "undefined") { - TMP_KEY_IGNORE = Symbol.for("node-ignore"); - } - var KEY_IGNORE = TMP_KEY_IGNORE; - var define2 = (object, key2, value) => Object.defineProperty(object, key2, { value }); - var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g; - var RETURN_FALSE = () => false; - var sanitizeRange = (range) => range.replace( - REGEX_REGEXP_RANGE, - (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY - ); - var cleanRangeBackSlash = (slashes) => { - const { length } = slashes; - return slashes.slice(0, length - length % 2); - }; - var REPLACERS = [ - [ - // remove BOM - // TODO: - // Other similar zero-width characters? - /^\uFEFF/, - () => EMPTY - ], - // > Trailing spaces are ignored unless they are quoted with backslash ("\") - [ - // (a\ ) -> (a ) - // (a ) -> (a) - // (a \ ) -> (a ) - /\\?\s+$/, - (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY - ], - // replace (\ ) with ' ' - [ - /\\\s/g, - () => SPACE - ], - // Escape metacharacters - // which is written down by users but means special for regular expressions. - // > There are 12 characters with special meanings: - // > - the backslash \, - // > - the caret ^, - // > - the dollar sign $, - // > - the period or dot ., - // > - the vertical bar or pipe symbol |, - // > - the question mark ?, - // > - the asterisk or star *, - // > - the plus sign +, - // > - the opening parenthesis (, - // > - the closing parenthesis ), - // > - and the opening square bracket [, - // > - the opening curly brace {, - // > These special characters are often called "metacharacters". - [ - /[\\$.|*+(){^]/g, - (match) => `\\${match}` - ], - [ - // > a question mark (?) matches a single character - /(?!\\)\?/g, - () => "[^/]" - ], - // leading slash - [ - // > A leading slash matches the beginning of the pathname. - // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". - // A leading slash matches the beginning of the pathname - /^\//, - () => "^" - ], - // replace special metacharacter slash after the leading slash - [ - /\//g, - () => "\\/" - ], - [ - // > A leading "**" followed by a slash means match in all directories. - // > For example, "**/foo" matches file or directory "foo" anywhere, - // > the same as pattern "foo". - // > "**/foo/bar" matches file or directory "bar" anywhere that is directly - // > under directory "foo". - // Notice that the '*'s have been replaced as '\\*' - /^\^*\\\*\\\*\\\//, - // '**/foo' <-> 'foo' - () => "^(?:.*\\/)?" - ], - // starting - [ - // there will be no leading '/' - // (which has been replaced by section "leading slash") - // If starts with '**', adding a '^' to the regular expression also works - /^(?=[^^])/, - function startingReplacer() { - return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^"; - } - ], - // two globstars - [ - // Use lookahead assertions so that we could match more than one `'/**'` - /\\\/\\\*\\\*(?=\\\/|$)/g, - // Zero, one or several directories - // should not use '*', or it will be replaced by the next replacer - // Check if it is not the last `'/**'` - (_, index2, str) => index2 + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+" - ], - // normal intermediate wildcards - [ - // Never replace escaped '*' - // ignore rule '\*' will match the path '*' - // 'abc.*/' -> go - // 'abc.*' -> skip this rule, - // coz trailing single wildcard will be handed by [trailing wildcard] - /(^|[^\\]+)(\\\*)+(?=.+)/g, - // '*.js' matches '.js' - // '*.js' doesn't match 'abc' - (_, p1, p2) => { - const unescaped = p2.replace(/\\\*/g, "[^\\/]*"); - return p1 + unescaped; - } - ], - [ - // unescape, revert step 3 except for back slash - // For example, if a user escape a '\\*', - // after step 3, the result will be '\\\\\\*' - /\\\\\\(?=[$.|*+(){^])/g, - () => ESCAPE - ], - [ - // '\\\\' -> '\\' - /\\\\/g, - () => ESCAPE - ], - [ - // > The range notation, e.g. [a-zA-Z], - // > can be used to match one of the characters in a range. - // `\` is escaped by step 3 - /(\\)?\[([^\]/]*?)(\\*)($|\])/g, - (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]" - ], - // ending - [ - // 'js' will not match 'js.' - // 'ab' will not match 'abc' - /(?:[^*])$/, - // WTF! - // https://git-scm.com/docs/gitignore - // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) - // which re-fixes #24, #38 - // > If there is a separator at the end of the pattern then the pattern - // > will only match directories, otherwise the pattern can match both - // > files and directories. - // 'js*' will not match 'a.js' - // 'js/' will not match 'a.js' - // 'js' will match 'a.js' and 'a.js/' - (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)` - ], - // trailing wildcard - [ - /(\^|\\\/)?\\\*$/, - (_, p1) => { - const prefix = p1 ? `${p1}[^/]+` : "[^/]*"; - return `${prefix}(?=$|\\/$)`; - } - ] - ]; - var regexCache = /* @__PURE__ */ Object.create(null); - var makeRegex = (pattern, ignoreCase) => { - let source = regexCache[pattern]; - if (!source) { - source = REPLACERS.reduce( - (prev, current) => prev.replace(current[0], current[1].bind(pattern)), - pattern - ); - regexCache[pattern] = source; - } - return ignoreCase ? new RegExp(source, "i") : new RegExp(source); - }; - var isString = (subject) => typeof subject === "string"; - var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0; - var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF); - var IgnoreRule = class { - constructor(origin, pattern, negative, regex2) { - this.origin = origin; - this.pattern = pattern; - this.negative = negative; - this.regex = regex2; - } - }; - var createRule = (pattern, ignoreCase) => { - const origin = pattern; - let negative = false; - if (pattern.indexOf("!") === 0) { - negative = true; - pattern = pattern.substr(1); - } - pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#"); - const regex2 = makeRegex(pattern, ignoreCase); - return new IgnoreRule( - origin, - pattern, - negative, - regex2 - ); - }; - var throwError = (message, Ctor) => { - throw new Ctor(message); - }; - var checkPath = (path2, originalPath, doThrow) => { - if (!isString(path2)) { - return doThrow( - `path must be a string, but got \`${originalPath}\``, - TypeError - ); - } - if (!path2) { - return doThrow(`path must not be empty`, TypeError); - } - if (checkPath.isNotRelative(path2)) { - const r = "`path.relative()`d"; - return doThrow( - `path should be a ${r} string, but got "${originalPath}"`, - RangeError - ); - } - return true; - }; - var isNotRelative = (path2) => REGEX_TEST_INVALID_PATH.test(path2); - checkPath.isNotRelative = isNotRelative; - checkPath.convert = (p) => p; - var Ignore = class { - constructor({ - ignorecase = true, - ignoreCase = ignorecase, - allowRelativePaths = false - } = {}) { - define2(this, KEY_IGNORE, true); - this._rules = []; - this._ignoreCase = ignoreCase; - this._allowRelativePaths = allowRelativePaths; - this._initCache(); - } - _initCache() { - this._ignoreCache = /* @__PURE__ */ Object.create(null); - this._testCache = /* @__PURE__ */ Object.create(null); - } - _addPattern(pattern) { - if (pattern && pattern[KEY_IGNORE]) { - this._rules = this._rules.concat(pattern._rules); - this._added = true; - return; - } - if (checkPattern(pattern)) { - const rule = createRule(pattern, this._ignoreCase); - this._added = true; - this._rules.push(rule); - } - } - // @param {Array | string | Ignore} pattern - add(pattern) { - this._added = false; - makeArray( - isString(pattern) ? splitPattern(pattern) : pattern - ).forEach(this._addPattern, this); - if (this._added) { - this._initCache(); - } - return this; - } - // legacy - addPattern(pattern) { - return this.add(pattern); - } - // | ignored : unignored - // negative | 0:0 | 0:1 | 1:0 | 1:1 - // -------- | ------- | ------- | ------- | -------- - // 0 | TEST | TEST | SKIP | X - // 1 | TESTIF | SKIP | TEST | X - // - SKIP: always skip - // - TEST: always test - // - TESTIF: only test if checkUnignored - // - X: that never happen - // @param {boolean} whether should check if the path is unignored, - // setting `checkUnignored` to `false` could reduce additional - // path matching. - // @returns {TestResult} true if a file is ignored - _testOne(path2, checkUnignored) { - let ignored = false; - let unignored = false; - this._rules.forEach((rule) => { - const { negative } = rule; - if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) { - return; - } - const matched = rule.regex.test(path2); - if (matched) { - ignored = !negative; - unignored = negative; - } - }); - return { - ignored, - unignored - }; - } - // @returns {TestResult} - _test(originalPath, cache, checkUnignored, slices) { - const path2 = originalPath && checkPath.convert(originalPath); - checkPath( - path2, - originalPath, - this._allowRelativePaths ? RETURN_FALSE : throwError - ); - return this._t(path2, cache, checkUnignored, slices); - } - _t(path2, cache, checkUnignored, slices) { - if (path2 in cache) { - return cache[path2]; - } - if (!slices) { - slices = path2.split(SLASH); - } - slices.pop(); - if (!slices.length) { - return cache[path2] = this._testOne(path2, checkUnignored); - } - const parent = this._t( - slices.join(SLASH) + SLASH, - cache, - checkUnignored, - slices - ); - return cache[path2] = parent.ignored ? parent : this._testOne(path2, checkUnignored); - } - ignores(path2) { - return this._test(path2, this._ignoreCache, false).ignored; - } - createFilter() { - return (path2) => !this.ignores(path2); - } - filter(paths) { - return makeArray(paths).filter(this.createFilter()); - } - // @returns {TestResult} - test(path2) { - return this._test(path2, this._testCache, true); - } - }; - var factory = (options) => new Ignore(options); - var isPathValid = (path2) => checkPath(path2 && checkPath.convert(path2), path2, RETURN_FALSE); - factory.isPathValid = isPathValid; - factory.default = factory; - module2.exports = factory; - if ( - // Detect `process` so that it can run in browsers. - typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32") - ) { - const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/"); - checkPath.convert = makePosix; - const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i; - checkPath.isNotRelative = (path2) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path2) || isNotRelative(path2); - } - } -}); - -// node_modules/.pnpm/clean-git-ref@2.0.1/node_modules/clean-git-ref/lib/index.js -var require_lib2 = __commonJS({ - "node_modules/.pnpm/clean-git-ref@2.0.1/node_modules/clean-git-ref/lib/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - function escapeRegExp(string) { - return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); - } - function replaceAll(str, search, replacement) { - search = search instanceof RegExp ? search : new RegExp(escapeRegExp(search), "g"); - return str.replace(search, replacement); - } - var CleanGitRef = { - clean: function clean(value) { - if (typeof value !== "string") { - throw new Error("Expected a string, received: " + value); - } - value = replaceAll(value, "./", "/"); - value = replaceAll(value, "..", "."); - value = replaceAll(value, " ", "-"); - value = replaceAll(value, /^[~^:?*\\\-]/g, ""); - value = replaceAll(value, /[~^:?*\\]/g, "-"); - value = replaceAll(value, /[~^:?*\\\-]$/g, ""); - value = replaceAll(value, "@{", "-"); - value = replaceAll(value, /\.$/g, ""); - value = replaceAll(value, /\/$/g, ""); - value = replaceAll(value, /\.lock$/g, ""); - return value; - } - }; - module2.exports = CleanGitRef; - } -}); - -// node_modules/.pnpm/diff3@0.0.3/node_modules/diff3/onp.js -var require_onp = __commonJS({ - "node_modules/.pnpm/diff3@0.0.3/node_modules/diff3/onp.js"(exports2, module2) { - init_polyfill_buffer(); - module2.exports = function(a_, b_) { - var a = a_, b = b_, m = a.length, n = b.length, reverse = false, ed = null, offset = m + 1, path2 = [], pathposi = [], ses = [], lcs = "", SES_DELETE = -1, SES_COMMON = 0, SES_ADD = 1; - var tmp1, tmp2; - var init3 = function() { - if (m >= n) { - tmp1 = a; - tmp2 = m; - a = b; - b = tmp1; - m = n; - n = tmp2; - reverse = true; - offset = m + 1; - } - }; - var P = function(x, y, k) { - return { - "x": x, - "y": y, - "k": k - }; - }; - var seselem = function(elem, t) { - return { - "elem": elem, - "t": t - }; - }; - var snake = function(k, p, pp) { - var r, x, y; - if (p > pp) { - r = path2[k - 1 + offset]; - } else { - r = path2[k + 1 + offset]; - } - y = Math.max(p, pp); - x = y - k; - while (x < m && y < n && a[x] === b[y]) { - ++x; - ++y; - } - path2[k + offset] = pathposi.length; - pathposi[pathposi.length] = new P(x, y, r); - return y; - }; - var recordseq = function(epc) { - var x_idx, y_idx, px_idx, py_idx, i; - x_idx = y_idx = 1; - px_idx = py_idx = 0; - for (i = epc.length - 1; i >= 0; --i) { - while (px_idx < epc[i].x || py_idx < epc[i].y) { - if (epc[i].y - epc[i].x > py_idx - px_idx) { - if (reverse) { - ses[ses.length] = new seselem(b[py_idx], SES_DELETE); - } else { - ses[ses.length] = new seselem(b[py_idx], SES_ADD); - } - ++y_idx; - ++py_idx; - } else if (epc[i].y - epc[i].x < py_idx - px_idx) { - if (reverse) { - ses[ses.length] = new seselem(a[px_idx], SES_ADD); - } else { - ses[ses.length] = new seselem(a[px_idx], SES_DELETE); - } - ++x_idx; - ++px_idx; - } else { - ses[ses.length] = new seselem(a[px_idx], SES_COMMON); - lcs += a[px_idx]; - ++x_idx; - ++y_idx; - ++px_idx; - ++py_idx; - } - } - } - }; - init3(); - return { - SES_DELETE: -1, - SES_COMMON: 0, - SES_ADD: 1, - editdistance: function() { - return ed; - }, - getlcs: function() { - return lcs; - }, - getses: function() { - return ses; - }, - compose: function() { - var delta, size, fp, p, r, epc, i, k; - delta = n - m; - size = m + n + 3; - fp = {}; - for (i = 0; i < size; ++i) { - fp[i] = -1; - path2[i] = -1; - } - p = -1; - do { - ++p; - for (k = -p; k <= delta - 1; ++k) { - fp[k + offset] = snake(k, fp[k - 1 + offset] + 1, fp[k + 1 + offset]); - } - for (k = delta + p; k >= delta + 1; --k) { - fp[k + offset] = snake(k, fp[k - 1 + offset] + 1, fp[k + 1 + offset]); - } - fp[delta + offset] = snake(delta, fp[delta - 1 + offset] + 1, fp[delta + 1 + offset]); - } while (fp[delta + offset] !== n); - ed = delta + 2 * p; - r = path2[delta + offset]; - epc = []; - while (r !== -1) { - epc[epc.length] = new P(pathposi[r].x, pathposi[r].y, null); - r = pathposi[r].k; - } - recordseq(epc); - } - }; - }; - } -}); - -// node_modules/.pnpm/diff3@0.0.3/node_modules/diff3/diff3.js -var require_diff3 = __commonJS({ - "node_modules/.pnpm/diff3@0.0.3/node_modules/diff3/diff3.js"(exports2, module2) { - init_polyfill_buffer(); - var onp = require_onp(); - function longestCommonSubsequence(file1, file2) { - var diff3 = new onp(file1, file2); - diff3.compose(); - var ses = diff3.getses(); - var root2; - var prev; - var file1RevIdx = file1.length - 1, file2RevIdx = file2.length - 1; - for (var i = ses.length - 1; i >= 0; --i) { - if (ses[i].t === diff3.SES_COMMON) { - if (prev) { - prev.chain = { - file1index: file1RevIdx, - file2index: file2RevIdx, - chain: null - }; - prev = prev.chain; - } else { - root2 = { - file1index: file1RevIdx, - file2index: file2RevIdx, - chain: null - }; - prev = root2; - } - file1RevIdx--; - file2RevIdx--; - } else if (ses[i].t === diff3.SES_DELETE) { - file1RevIdx--; - } else if (ses[i].t === diff3.SES_ADD) { - file2RevIdx--; - } - } - var tail = { - file1index: -1, - file2index: -1, - chain: null - }; - if (!prev) { - return tail; - } - prev.chain = tail; - return root2; - } - function diffIndices(file1, file2) { - var result = []; - var tail1 = file1.length; - var tail2 = file2.length; - for (var candidate = longestCommonSubsequence(file1, file2); candidate !== null; candidate = candidate.chain) { - var mismatchLength1 = tail1 - candidate.file1index - 1; - var mismatchLength2 = tail2 - candidate.file2index - 1; - tail1 = candidate.file1index; - tail2 = candidate.file2index; - if (mismatchLength1 || mismatchLength2) { - result.push({ - file1: [tail1 + 1, mismatchLength1], - file2: [tail2 + 1, mismatchLength2] - }); - } - } - result.reverse(); - return result; - } - function diff3MergeIndices(a, o, b) { - var i; - var m1 = diffIndices(o, a); - var m2 = diffIndices(o, b); - var hunks = []; - function addHunk(h, side2) { - hunks.push([h.file1[0], side2, h.file1[1], h.file2[0], h.file2[1]]); - } - for (i = 0; i < m1.length; i++) { - addHunk(m1[i], 0); - } - for (i = 0; i < m2.length; i++) { - addHunk(m2[i], 2); - } - hunks.sort(function(x, y) { - return x[0] - y[0]; - }); - var result = []; - var commonOffset = 0; - function copyCommon(targetOffset) { - if (targetOffset > commonOffset) { - result.push([1, commonOffset, targetOffset - commonOffset]); - commonOffset = targetOffset; - } - } - for (var hunkIndex = 0; hunkIndex < hunks.length; hunkIndex++) { - var firstHunkIndex = hunkIndex; - var hunk = hunks[hunkIndex]; - var regionLhs = hunk[0]; - var regionRhs = regionLhs + hunk[2]; - while (hunkIndex < hunks.length - 1) { - var maybeOverlapping = hunks[hunkIndex + 1]; - var maybeLhs = maybeOverlapping[0]; - if (maybeLhs > regionRhs) break; - regionRhs = Math.max(regionRhs, maybeLhs + maybeOverlapping[2]); - hunkIndex++; - } - copyCommon(regionLhs); - if (firstHunkIndex == hunkIndex) { - if (hunk[4] > 0) { - result.push([hunk[1], hunk[3], hunk[4]]); - } - } else { - var regions = { - 0: [a.length, -1, o.length, -1], - 2: [b.length, -1, o.length, -1] - }; - for (i = firstHunkIndex; i <= hunkIndex; i++) { - hunk = hunks[i]; - var side = hunk[1]; - var r = regions[side]; - var oLhs = hunk[0]; - var oRhs = oLhs + hunk[2]; - var abLhs = hunk[3]; - var abRhs = abLhs + hunk[4]; - r[0] = Math.min(abLhs, r[0]); - r[1] = Math.max(abRhs, r[1]); - r[2] = Math.min(oLhs, r[2]); - r[3] = Math.max(oRhs, r[3]); - } - var aLhs = regions[0][0] + (regionLhs - regions[0][2]); - var aRhs = regions[0][1] + (regionRhs - regions[0][3]); - var bLhs = regions[2][0] + (regionLhs - regions[2][2]); - var bRhs = regions[2][1] + (regionRhs - regions[2][3]); - result.push([ - -1, - aLhs, - aRhs - aLhs, - regionLhs, - regionRhs - regionLhs, - bLhs, - bRhs - bLhs - ]); - } - commonOffset = regionRhs; - } - copyCommon(o.length); - return result; - } - function diff3Merge2(a, o, b) { - var result = []; - var files = [a, o, b]; - var indices = diff3MergeIndices(a, o, b); - var okLines = []; - function flushOk() { - if (okLines.length) { - result.push({ - ok: okLines - }); - } - okLines = []; - } - function pushOk(xs) { - for (var j = 0; j < xs.length; j++) { - okLines.push(xs[j]); - } - } - function isTrueConflict(rec) { - if (rec[2] != rec[6]) return true; - var aoff = rec[1]; - var boff = rec[5]; - for (var j = 0; j < rec[2]; j++) { - if (a[j + aoff] != b[j + boff]) return true; - } - return false; - } - for (var i = 0; i < indices.length; i++) { - var x = indices[i]; - var side = x[0]; - if (side == -1) { - if (!isTrueConflict(x)) { - pushOk(files[0].slice(x[1], x[1] + x[2])); - } else { - flushOk(); - result.push({ - conflict: { - a: a.slice(x[1], x[1] + x[2]), - aIndex: x[1], - o: o.slice(x[3], x[3] + x[4]), - oIndex: x[3], - b: b.slice(x[5], x[5] + x[6]), - bIndex: x[5] - } - }); - } - } else { - pushOk(files[side].slice(x[1], x[1] + x[2])); - } - } - flushOk(); - return result; - } - module2.exports = diff3Merge2; - } -}); - -// node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js -var require_ms = __commonJS({ - "node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js"(exports2, module2) { - init_polyfill_buffer(); - var s = 1e3; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var w = d * 7; - var y = d * 365.25; - module2.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === "string" && val.length > 0) { - return parse2(val); - } else if (type === "number" && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) - ); - }; - function parse2(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || "ms").toLowerCase(); - switch (type) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return n * y; - case "weeks": - case "week": - case "w": - return n * w; - case "days": - case "day": - case "d": - return n * d; - case "hours": - case "hour": - case "hrs": - case "hr": - case "h": - return n * h; - case "minutes": - case "minute": - case "mins": - case "min": - case "m": - return n * m; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return n * s; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return n; - default: - return void 0; - } - } - function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + "d"; - } - if (msAbs >= h) { - return Math.round(ms / h) + "h"; - } - if (msAbs >= m) { - return Math.round(ms / m) + "m"; - } - if (msAbs >= s) { - return Math.round(ms / s) + "s"; - } - return ms + "ms"; - } - function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, "day"); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, "hour"); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, "minute"); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, "second"); - } - return ms + " ms"; - } - function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); - } - } -}); - -// node_modules/.pnpm/debug@4.3.5_supports-color@9.4.0/node_modules/debug/src/common.js -var require_common2 = __commonJS({ - "node_modules/.pnpm/debug@4.3.5_supports-color@9.4.0/node_modules/debug/src/common.js"(exports2, module2) { - init_polyfill_buffer(); - function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require_ms(); - createDebug.destroy = destroy; - Object.keys(env).forEach((key2) => { - createDebug[key2] = env[key2]; - }); - createDebug.names = []; - createDebug.skips = []; - createDebug.formatters = {}; - function selectColor(namespace) { - let hash2 = 0; - for (let i = 0; i < namespace.length; i++) { - hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i); - hash2 |= 0; - } - return createDebug.colors[Math.abs(hash2) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; - function createDebug(namespace) { - let prevTime; - let enableOverride = null; - let namespacesCache; - let enabledCache; - function debug3(...args) { - if (!debug3.enabled) { - return; - } - const self2 = debug3; - const curr = Number(/* @__PURE__ */ new Date()); - const ms = curr - (prevTime || curr); - self2.diff = ms; - self2.prev = prevTime; - self2.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - if (typeof args[0] !== "string") { - args.unshift("%O"); - } - let index2 = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { - if (match === "%%") { - return "%"; - } - index2++; - const formatter = createDebug.formatters[format]; - if (typeof formatter === "function") { - const val = args[index2]; - match = formatter.call(self2, val); - args.splice(index2, 1); - index2--; - } - return match; - }); - createDebug.formatArgs.call(self2, args); - const logFn = self2.log || createDebug.log; - logFn.apply(self2, args); - } - debug3.namespace = namespace; - debug3.useColors = createDebug.useColors(); - debug3.color = createDebug.selectColor(namespace); - debug3.extend = extend; - debug3.destroy = createDebug.destroy; - Object.defineProperty(debug3, "enabled", { - enumerable: true, - configurable: false, - get: () => { - if (enableOverride !== null) { - return enableOverride; - } - if (namespacesCache !== createDebug.namespaces) { - namespacesCache = createDebug.namespaces; - enabledCache = createDebug.enabled(namespace); - } - return enabledCache; - }, - set: (v) => { - enableOverride = v; - } - }); - if (typeof createDebug.init === "function") { - createDebug.init(debug3); - } - return debug3; - } - function extend(namespace, delimiter) { - const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.namespaces = namespaces; - createDebug.names = []; - createDebug.skips = []; - let i; - const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); - const len = split.length; - for (i = 0; i < len; i++) { - if (!split[i]) { - continue; - } - namespaces = split[i].replace(/\*/g, ".*?"); - if (namespaces[0] === "-") { - createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$")); - } else { - createDebug.names.push(new RegExp("^" + namespaces + "$")); - } - } - } - function disable() { - const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace) - ].join(","); - createDebug.enable(""); - return namespaces; - } - function enabled(name) { - if (name[name.length - 1] === "*") { - return true; - } - let i; - let len; - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - return false; - } - function toNamespace(regexp) { - return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*"); - } - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } - function destroy() { - console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); - } - createDebug.enable(createDebug.load()); - return createDebug; - } - module2.exports = setup; - } -}); - -// node_modules/.pnpm/debug@4.3.5_supports-color@9.4.0/node_modules/debug/src/browser.js -var require_browser = __commonJS({ - "node_modules/.pnpm/debug@4.3.5_supports-color@9.4.0/node_modules/debug/src/browser.js"(exports2, module2) { - init_polyfill_buffer(); - exports2.formatArgs = formatArgs; - exports2.save = save; - exports2.load = load; - exports2.useColors = useColors; - exports2.storage = localstorage(); - exports2.destroy = /* @__PURE__ */ (() => { - let warned = false; - return () => { - if (!warned) { - warned = true; - console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); - } - }; - })(); - exports2.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 useColors() { - if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { - return true; - } - if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker - typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); - } - function formatArgs(args) { - args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff); - if (!this.useColors) { - return; - } - const c = "color: " + this.color; - args.splice(1, 0, c, "color: inherit"); - let index2 = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, (match) => { - if (match === "%%") { - return; - } - index2++; - if (match === "%c") { - lastC = index2; - } - }); - args.splice(lastC, 0, c); - } - exports2.log = console.debug || console.log || (() => { - }); - function save(namespaces) { - try { - if (namespaces) { - exports2.storage.setItem("debug", namespaces); - } else { - exports2.storage.removeItem("debug"); - } - } catch (error) { - } - } - function load() { - let r; - try { - r = exports2.storage.getItem("debug"); - } catch (error) { - } - if (!r && typeof process !== "undefined" && "env" in process) { - r = process.env.DEBUG; - } - return r; - } - function localstorage() { - try { - return localStorage; - } catch (error) { - } - } - module2.exports = require_common2()(exports2); - var { formatters } = module2.exports; - formatters.j = function(v) { - try { - return JSON.stringify(v); - } catch (error) { - return "[UnexpectedJSONParseError]: " + error.message; - } - }; - } -}); - -// node_modules/.pnpm/@kwsites+file-exists@1.1.1_supports-color@9.4.0/node_modules/@kwsites/file-exists/dist/src/index.js -var require_src = __commonJS({ - "node_modules/.pnpm/@kwsites+file-exists@1.1.1_supports-color@9.4.0/node_modules/@kwsites/file-exists/dist/src/index.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - var __importDefault = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var fs_1 = require("fs"); - var debug_1 = __importDefault(require_browser()); - var log2 = debug_1.default("@kwsites/file-exists"); - function check(path2, isFile, isDirectory) { - log2(`checking %s`, path2); - try { - const stat = fs_1.statSync(path2); - if (stat.isFile() && isFile) { - log2(`[OK] path represents a file`); - return true; - } - if (stat.isDirectory() && isDirectory) { - log2(`[OK] path represents a directory`); - return true; - } - log2(`[FAIL] path represents something other than a file or directory`); - return false; - } catch (e) { - if (e.code === "ENOENT") { - log2(`[FAIL] path is not accessible: %o`, e); - return false; - } - log2(`[FATAL] %o`, e); - throw e; - } - } - function exists2(path2, type = exports2.READABLE) { - return check(path2, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0); - } - exports2.exists = exists2; - exports2.FILE = 1; - exports2.FOLDER = 2; - exports2.READABLE = exports2.FILE + exports2.FOLDER; - } -}); - -// node_modules/.pnpm/@kwsites+file-exists@1.1.1_supports-color@9.4.0/node_modules/@kwsites/file-exists/dist/index.js -var require_dist = __commonJS({ - "node_modules/.pnpm/@kwsites+file-exists@1.1.1_supports-color@9.4.0/node_modules/@kwsites/file-exists/dist/index.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - function __export3(m) { - for (var p in m) if (!exports2.hasOwnProperty(p)) exports2[p] = m[p]; - } - Object.defineProperty(exports2, "__esModule", { value: true }); - __export3(require_src()); - } -}); - -// node_modules/.pnpm/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js -var require_dist2 = __commonJS({ - "node_modules/.pnpm/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.createDeferred = exports2.deferred = void 0; - function deferred2() { - let done; - let fail; - let status2 = "pending"; - const promise2 = new Promise((_done, _fail) => { - done = _done; - fail = _fail; - }); - return { - promise: promise2, - done(result) { - if (status2 === "pending") { - status2 = "resolved"; - done(result); - } - }, - fail(error) { - if (status2 === "pending") { - status2 = "rejected"; - fail(error); - } - }, - get fulfilled() { - return status2 !== "pending"; - }, - get status() { - return status2; - } - }; - } - exports2.deferred = deferred2; - exports2.createDeferred = deferred2; - exports2.default = deferred2; - } -}); - -// node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js -var require_color_name = __commonJS({ - "node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.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] - }; - } -}); - -// node_modules/.pnpm/css-unit-converter@1.1.2/node_modules/css-unit-converter/index.js -var require_css_unit_converter = __commonJS({ - "node_modules/.pnpm/css-unit-converter@1.1.2/node_modules/css-unit-converter/index.js"(exports2, module2) { - init_polyfill_buffer(); - var conversions = { - // length - "px": { - "px": 1, - "cm": 96 / 2.54, - "mm": 96 / 25.4, - "in": 96, - "pt": 96 / 72, - "pc": 16 - }, - "cm": { - "px": 2.54 / 96, - "cm": 1, - "mm": 0.1, - "in": 2.54, - "pt": 2.54 / 72, - "pc": 2.54 / 6 - }, - "mm": { - "px": 25.4 / 96, - "cm": 10, - "mm": 1, - "in": 25.4, - "pt": 25.4 / 72, - "pc": 25.4 / 6 - }, - "in": { - "px": 1 / 96, - "cm": 1 / 2.54, - "mm": 1 / 25.4, - "in": 1, - "pt": 1 / 72, - "pc": 1 / 6 - }, - "pt": { - "px": 0.75, - "cm": 72 / 2.54, - "mm": 72 / 25.4, - "in": 72, - "pt": 1, - "pc": 12 - }, - "pc": { - "px": 6 / 96, - "cm": 6 / 2.54, - "mm": 6 / 25.4, - "in": 6, - "pt": 6 / 72, - "pc": 1 - }, - // angle - "deg": { - "deg": 1, - "grad": 0.9, - "rad": 180 / Math.PI, - "turn": 360 - }, - "grad": { - "deg": 400 / 360, - "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": 1 / 360, - "grad": 1 / 400, - "rad": 0.5 / Math.PI, - "turn": 1 - }, - // time - "s": { - "s": 1, - "ms": 1 / 1e3 - }, - "ms": { - "s": 1e3, - "ms": 1 - }, - // frequency - "Hz": { - "Hz": 1, - "kHz": 1e3 - }, - "kHz": { - "Hz": 1 / 1e3, - "kHz": 1 - }, - // resolution - "dpi": { - "dpi": 1, - "dpcm": 1 / 2.54, - "dppx": 1 / 96 - }, - "dpcm": { - "dpi": 2.54, - "dpcm": 1, - "dppx": 2.54 / 96 - }, - "dppx": { - "dpi": 96, - "dpcm": 96 / 2.54, - "dppx": 1 - } - }; - module2.exports = function(value, sourceUnit, targetUnit, precision) { - if (!conversions.hasOwnProperty(targetUnit)) - throw new Error("Cannot convert to " + targetUnit); - if (!conversions[targetUnit].hasOwnProperty(sourceUnit)) - throw new Error("Cannot convert from " + sourceUnit + " to " + targetUnit); - var converted = conversions[targetUnit][sourceUnit] * value; - if (precision !== false) { - precision = Math.pow(10, parseInt(precision) || 5); - return Math.round(converted * precision) / precision; - } - return converted; - }; - } -}); - -// node_modules/.pnpm/css-color-converter@2.0.0/node_modules/css-color-converter/lib/index.js -var require_lib3 = __commonJS({ - "node_modules/.pnpm/css-color-converter@2.0.0/node_modules/css-color-converter/lib/index.js"(exports2) { - "use strict"; - init_polyfill_buffer(); - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.fromRgba = fromRgba; - exports2.fromRgb = fromRgb; - exports2.fromHsla = fromHsla; - exports2.fromHsl = fromHsl; - exports2.fromString = fromString2; - exports2["default"] = void 0; - var _colorName = _interopRequireDefault(require_color_name()); - var _cssUnitConverter = _interopRequireDefault(require_css_unit_converter()); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { "default": obj }; - } - function _classCallCheck(instance10, Constructor) { - if (!(instance10 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray2(arr, i) || _nonIterableRest(); - } - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - function _unsupportedIterableToArray2(o, minLen) { - if (!o) return; - if (typeof o === "string") return _arrayLikeToArray2(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray2(o, minLen); - } - function _arrayLikeToArray2(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; - } - return arr2; - } - function _iterableToArrayLimit(arr, i) { - if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; - var _arr = []; - var _n = true; - var _d = false; - var _e = void 0; - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - return _arr; - } - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - var hex = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/; - var shortHex = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/; - var rgb = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/; - var rgbfn = /^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/; - var rgbperc = /^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/; - var rgbpercfn = /^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/; - var hsl = /^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/; - function contains2(haystack, needle) { - return haystack.indexOf(needle) > -1; - } - function rgbToHsl(r, g, b) { - var rprim = r / 255; - var gprim = g / 255; - var bprim = b / 255; - var cmax = Math.max(rprim, gprim, bprim); - var cmin = Math.min(rprim, gprim, bprim); - var delta = cmax - cmin; - var l = (cmax + cmin) / 2; - if (delta === 0) { - return [0, 0, l * 100]; - } - var s = delta / (1 - Math.abs(2 * l - 1)); - var h = function() { - switch (cmax) { - case rprim: { - return (gprim - bprim) / delta % 6; - } - case gprim: { - return (bprim - rprim) / delta + 2; - } - default: { - return (rprim - gprim) / delta + 4; - } - } - }(); - return [h * 60, s * 100, l * 100]; - } - function hslToRgb(h, s, l) { - var hprim = h / 60; - var sprim = s / 100; - var lprim = l / 100; - var c = (1 - Math.abs(2 * lprim - 1)) * sprim; - var x = c * (1 - Math.abs(hprim % 2 - 1)); - var m = lprim - c / 2; - var _ref = function() { - if (hprim < 1) return [c, x, 0]; - if (hprim < 2) return [x, c, 0]; - if (hprim < 3) return [0, c, x]; - if (hprim < 4) return [0, x, c]; - if (hprim < 5) return [x, 0, c]; - return [c, 0, x]; - }(), _ref2 = _slicedToArray(_ref, 3), rprim = _ref2[0], gprim = _ref2[1], bprim = _ref2[2]; - return [(rprim + m) * 255, (gprim + m) * 255, (bprim + m) * 255]; - } - var Color = /* @__PURE__ */ function() { - function Color2(_ref3) { - var _ref4 = _slicedToArray(_ref3, 4), r = _ref4[0], g = _ref4[1], b = _ref4[2], a = _ref4[3]; - _classCallCheck(this, Color2); - this.values = [Math.max(Math.min(parseInt(r, 10), 255), 0), Math.max(Math.min(parseInt(g, 10), 255), 0), Math.max(Math.min(parseInt(b, 10), 255), 0), a == null ? 1 : Math.max(Math.min(parseFloat(a), 255), 0)]; - } - _createClass(Color2, [{ - key: "toRgbString", - value: function toRgbString() { - var _this$values = _slicedToArray(this.values, 4), r = _this$values[0], g = _this$values[1], b = _this$values[2], a = _this$values[3]; - if (a === 1) { - return "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")"); - } - return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(a, ")"); - } - }, { - key: "toHslString", - value: function toHslString() { - var _this$toHslaArray = this.toHslaArray(), _this$toHslaArray2 = _slicedToArray(_this$toHslaArray, 4), h = _this$toHslaArray2[0], s = _this$toHslaArray2[1], l = _this$toHslaArray2[2], a = _this$toHslaArray2[3]; - if (a === 1) { - return "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)"); - } - return "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(a, ")"); - } - }, { - key: "toHexString", - value: function toHexString() { - var _this$values2 = _slicedToArray(this.values, 4), r = _this$values2[0], g = _this$values2[1], b = _this$values2[2], a = _this$values2[3]; - r = Number(r).toString(16).padStart(2, "0"); - g = Number(g).toString(16).padStart(2, "0"); - b = Number(b).toString(16).padStart(2, "0"); - a = a < 1 ? parseInt(a * 255, 10).toString(16).padStart(2, "0") : ""; - return "#".concat(r).concat(g).concat(b).concat(a); - } - }, { - key: "toRgbaArray", - value: function toRgbaArray() { - return this.values; - } - }, { - key: "toHslaArray", - value: function toHslaArray() { - var _this$values3 = _slicedToArray(this.values, 4), r = _this$values3[0], g = _this$values3[1], b = _this$values3[2], a = _this$values3[3]; - var _rgbToHsl = rgbToHsl(r, g, b), _rgbToHsl2 = _slicedToArray(_rgbToHsl, 3), h = _rgbToHsl2[0], s = _rgbToHsl2[1], l = _rgbToHsl2[2]; - return [h, s, l, a]; - } - }]); - return Color2; - }(); - function fromRgba(_ref5) { - var _ref6 = _slicedToArray(_ref5, 4), r = _ref6[0], g = _ref6[1], b = _ref6[2], a = _ref6[3]; - return new Color([r, g, b, a]); - } - function fromRgb(_ref7) { - var _ref8 = _slicedToArray(_ref7, 3), r = _ref8[0], g = _ref8[1], b = _ref8[2]; - return fromRgba([r, g, b, 1]); - } - function fromHsla(_ref9) { - var _ref10 = _slicedToArray(_ref9, 4), h = _ref10[0], s = _ref10[1], l = _ref10[2], a = _ref10[3]; - var _hslToRgb = hslToRgb(h, s, l), _hslToRgb2 = _slicedToArray(_hslToRgb, 3), r = _hslToRgb2[0], g = _hslToRgb2[1], b = _hslToRgb2[2]; - return fromRgba([r, g, b, a]); - } - function fromHsl(_ref11) { - var _ref12 = _slicedToArray(_ref11, 3), h = _ref12[0], s = _ref12[1], l = _ref12[2]; - return fromHsla([h, s, l, 1]); - } - function fromHexString(str) { - var _ref13 = hex.exec(str) || shortHex.exec(str), _ref14 = _slicedToArray(_ref13, 5), r = _ref14[1], g = _ref14[2], b = _ref14[3], a = _ref14[4]; - r = parseInt(r.length < 2 ? r.repeat(2) : r, 16); - g = parseInt(g.length < 2 ? g.repeat(2) : g, 16); - b = parseInt(b.length < 2 ? b.repeat(2) : b, 16); - a = a && (parseInt(a.length < 2 ? a.repeat(2) : a, 16) / 255).toPrecision(1) || 1; - return fromRgba([r, g, b, a]); - } - function fromRgbString(str) { - var _ref15 = rgb.exec(str) || rgbperc.exec(str) || rgbfn.exec(str) || rgbpercfn.exec(str), _ref16 = _slicedToArray(_ref15, 5), r = _ref16[1], g = _ref16[2], b = _ref16[3], a = _ref16[4]; - r = contains2(r, "%") ? parseInt(r, 10) * 255 / 100 : parseInt(r, 10); - g = contains2(g, "%") ? parseInt(g, 10) * 255 / 100 : parseInt(g, 10); - b = contains2(b, "%") > 0 ? parseInt(b, 10) * 255 / 100 : parseInt(b, 10); - a = a === void 0 ? 1 : parseFloat(a) / (contains2(a, "%") ? 100 : 1); - return fromRgba([r, g, b, a]); - } - function fromHslString(str) { - var _hsl$exec = hsl.exec(str), _hsl$exec2 = _slicedToArray(_hsl$exec, 6), h = _hsl$exec2[1], unit = _hsl$exec2[2], s = _hsl$exec2[3], l = _hsl$exec2[4], a = _hsl$exec2[5]; - unit = unit || "deg"; - h = (0, _cssUnitConverter["default"])(parseFloat(h), unit, "deg"); - s = parseFloat(s); - l = parseFloat(l); - a = a === void 0 ? 1 : parseFloat(a) / (contains2(a, "%") ? 100 : 1); - return fromHsla([h, s, l, a]); - } - function fromString2(str) { - if (_colorName["default"][str]) { - return fromRgb(_colorName["default"][str]); - } - if (hex.test(str) || shortHex.test(str)) { - return fromHexString(str); - } - if (rgb.test(str) || rgbperc.test(str) || rgbfn.test(str) || rgbpercfn.test(str)) { - return fromRgbString(str); - } - if (hsl.test(str)) { - return fromHslString(str); - } - return null; - } - var _default = { - fromString: fromString2, - fromRgb, - fromRgba, - fromHsl, - fromHsla - }; - exports2["default"] = _default; - } -}); - -// node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/isArguments.js -var require_isArguments = __commonJS({ - "node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/isArguments.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var toStr = Object.prototype.toString; - module2.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === "[object Arguments]"; - if (!isArgs) { - isArgs = str !== "[object Array]" && value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]"; - } - return isArgs; - }; - } -}); - -// node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/implementation.js -var require_implementation = __commonJS({ - "node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/implementation.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var keysShim; - if (!Object.keys) { - has = Object.prototype.hasOwnProperty; - toStr = Object.prototype.toString; - isArgs = require_isArguments(); - isEnumerable = Object.prototype.propertyIsEnumerable; - hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString"); - hasProtoEnumBug = isEnumerable.call(function() { - }, "prototype"); - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ]; - equalsConstructorPrototype = function(o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - excludedKeys = { - $applicationCache: true, - $console: true, - $external: true, - $frame: true, - $frameElement: true, - $frames: true, - $innerHeight: true, - $innerWidth: true, - $onmozfullscreenchange: true, - $onmozfullscreenerror: true, - $outerHeight: true, - $outerWidth: true, - $pageXOffset: true, - $pageYOffset: true, - $parent: true, - $scrollLeft: true, - $scrollTop: true, - $scrollX: true, - $scrollY: true, - $self: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $window: true - }; - hasAutomationEqualityBug = function() { - if (typeof window === "undefined") { - return false; - } - for (var k in window) { - try { - if (!excludedKeys["$" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === "object") { - try { - equalsConstructorPrototype(window[k]); - } catch (e) { - return true; - } - } - } catch (e) { - return true; - } - } - return false; - }(); - equalsConstructorPrototypeIfNotBuggy = function(o) { - if (typeof window === "undefined" || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(o); - } - try { - return equalsConstructorPrototype(o); - } catch (e) { - return false; - } - }; - keysShim = function keys(object) { - var isObject2 = object !== null && typeof object === "object"; - var isFunction2 = toStr.call(object) === "[object Function]"; - var isArguments = isArgs(object); - var isString = isObject2 && toStr.call(object) === "[object String]"; - var theKeys = []; - if (!isObject2 && !isFunction2 && !isArguments) { - throw new TypeError("Object.keys called on a non-object"); - } - var skipProto = hasProtoEnumBug && isFunction2; - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } - } else { - for (var name in object) { - if (!(skipProto && name === "prototype") && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - for (var k = 0; k < dontEnums.length; ++k) { - if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) { - theKeys.push(dontEnums[k]); - } - } - } - return theKeys; - }; - } - var has; - var toStr; - var isArgs; - var isEnumerable; - var hasDontEnumBug; - var hasProtoEnumBug; - var dontEnums; - var equalsConstructorPrototype; - var excludedKeys; - var hasAutomationEqualityBug; - var equalsConstructorPrototypeIfNotBuggy; - module2.exports = keysShim; - } -}); - -// node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/index.js -var require_object_keys = __commonJS({ - "node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var slice = Array.prototype.slice; - var isArgs = require_isArguments(); - var origKeys = Object.keys; - var keysShim = origKeys ? function keys(o) { - return origKeys(o); - } : require_implementation(); - var originalKeys = Object.keys; - keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = function() { - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2); - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - return originalKeys(object); - }; - } - } else { - Object.keys = keysShim; - } - return Object.keys || keysShim; - }; - module2.exports = keysShim; - } -}); - -// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js -var require_es_errors = __commonJS({ - "node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = Error; - } -}); - -// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js -var require_eval = __commonJS({ - "node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = EvalError; - } -}); - -// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js -var require_range = __commonJS({ - "node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = RangeError; - } -}); - -// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js -var require_ref = __commonJS({ - "node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = ReferenceError; - } -}); - -// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js -var require_syntax = __commonJS({ - "node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = SyntaxError; - } -}); - -// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js -var require_type = __commonJS({ - "node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = TypeError; - } -}); - -// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js -var require_uri = __commonJS({ - "node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = URIError; - } -}); - -// node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js -var require_shams = __commonJS({ - "node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = function hasSymbols() { - if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { - return false; - } - if (typeof Symbol.iterator === "symbol") { - return true; - } - var obj = {}; - var sym = Symbol("test"); - var symObj = Object(sym); - if (typeof sym === "string") { - return false; - } - if (Object.prototype.toString.call(sym) !== "[object Symbol]") { - return false; - } - if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { - return false; - } - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { - return false; - } - if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { - return false; - } - if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { - return false; - } - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { - return false; - } - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; - } - if (typeof Object.getOwnPropertyDescriptor === "function") { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } - } - return true; - }; - } -}); - -// node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.js -var require_has_symbols = __commonJS({ - "node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var origSymbol = typeof Symbol !== "undefined" && Symbol; - var hasSymbolSham = require_shams(); - module2.exports = function hasNativeSymbols() { - if (typeof origSymbol !== "function") { - return false; - } - if (typeof Symbol !== "function") { - return false; - } - if (typeof origSymbol("foo") !== "symbol") { - return false; - } - if (typeof Symbol("bar") !== "symbol") { - return false; - } - return hasSymbolSham(); - }; - } -}); - -// node_modules/.pnpm/has-proto@1.0.3/node_modules/has-proto/index.js -var require_has_proto = __commonJS({ - "node_modules/.pnpm/has-proto@1.0.3/node_modules/has-proto/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var test = { - __proto__: null, - foo: {} - }; - var $Object = Object; - module2.exports = function hasProto() { - return { __proto__: test }.foo === test.foo && !(test instanceof $Object); - }; - } -}); - -// node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js -var require_implementation2 = __commonJS({ - "node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; - var toStr = Object.prototype.toString; - var max = Math.max; - var funcType = "[object Function]"; - var concatty = function concatty2(a, b) { - var arr = []; - for (var i = 0; i < a.length; i += 1) { - arr[i] = a[i]; - } - for (var j = 0; j < b.length; j += 1) { - arr[j + a.length] = b[j]; - } - return arr; - }; - var slicy = function slicy2(arrLike, offset) { - var arr = []; - for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { - arr[j] = arrLike[i]; - } - return arr; - }; - var joiny = function(arr, joiner) { - var str = ""; - for (var i = 0; i < arr.length; i += 1) { - str += arr[i]; - if (i + 1 < arr.length) { - str += joiner; - } - } - return str; - }; - module2.exports = function bind(that) { - var target = this; - if (typeof target !== "function" || toStr.apply(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slicy(arguments, 1); - var bound; - var binder = function() { - if (this instanceof bound) { - var result = target.apply( - this, - concatty(args, arguments) - ); - if (Object(result) === result) { - return result; - } - return this; - } - return target.apply( - that, - concatty(args, arguments) - ); - }; - var boundLength = max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs[i] = "$" + i; - } - bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder); - if (target.prototype) { - var Empty = function Empty2() { - }; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; - } -}); - -// node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js -var require_function_bind = __commonJS({ - "node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var implementation = require_implementation2(); - module2.exports = Function.prototype.bind || implementation; - } -}); - -// node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js -var require_hasown = __commonJS({ - "node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var call = Function.prototype.call; - var $hasOwn = Object.prototype.hasOwnProperty; - var bind = require_function_bind(); - module2.exports = bind.call(call, $hasOwn); - } -}); - -// node_modules/.pnpm/get-intrinsic@1.2.4/node_modules/get-intrinsic/index.js -var require_get_intrinsic = __commonJS({ - "node_modules/.pnpm/get-intrinsic@1.2.4/node_modules/get-intrinsic/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var undefined2; - var $Error = require_es_errors(); - var $EvalError = require_eval(); - var $RangeError = require_range(); - var $ReferenceError = require_ref(); - var $SyntaxError = require_syntax(); - var $TypeError = require_type(); - var $URIError = require_uri(); - var $Function = Function; - var getEvalledConstructor = function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); - } catch (e) { - } - }; - var $gOPD = Object.getOwnPropertyDescriptor; - if ($gOPD) { - try { - $gOPD({}, ""); - } catch (e) { - $gOPD = null; - } - } - var throwTypeError = function() { - throw new $TypeError(); - }; - var ThrowTypeError = $gOPD ? function() { - try { - arguments.callee; - return throwTypeError; - } catch (calleeThrows) { - try { - return $gOPD(arguments, "callee").get; - } catch (gOPDthrows) { - return throwTypeError; - } - } - }() : throwTypeError; - var hasSymbols = require_has_symbols()(); - var hasProto = require_has_proto()(); - var getProto = Object.getPrototypeOf || (hasProto ? function(x) { - return x.__proto__; - } : null); - var needsEval = {}; - var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array); - var INTRINSICS = { - __proto__: null, - "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, - "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2, - "%AsyncFromSyncIteratorPrototype%": undefined2, - "%AsyncFunction%": needsEval, - "%AsyncGenerator%": needsEval, - "%AsyncGeneratorFunction%": needsEval, - "%AsyncIteratorPrototype%": needsEval, - "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, - "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, - "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array, - "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array, - "%Boolean%": Boolean, - "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": $Error, - "%eval%": eval, - // eslint-disable-line no-eval - "%EvalError%": $EvalError, - "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, - "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, - "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, - "%Function%": $Function, - "%GeneratorFunction%": needsEval, - "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, - "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, - "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2, - "%JSON%": typeof JSON === "object" ? JSON : undefined2, - "%Map%": typeof Map === "undefined" ? undefined2 : Map, - "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), - "%Math%": Math, - "%Number%": Number, - "%Object%": Object, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, - "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, - "%RangeError%": $RangeError, - "%ReferenceError%": $ReferenceError, - "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, - "%RegExp%": RegExp, - "%Set%": typeof Set === "undefined" ? undefined2 : Set, - "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), - "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined2, - "%Symbol%": hasSymbols ? Symbol : undefined2, - "%SyntaxError%": $SyntaxError, - "%ThrowTypeError%": ThrowTypeError, - "%TypedArray%": TypedArray, - "%TypeError%": $TypeError, - "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, - "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, - "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, - "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, - "%URIError%": $URIError, - "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, - "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, - "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet - }; - if (getProto) { - try { - null.error; - } catch (e) { - errorProto = getProto(getProto(e)); - INTRINSICS["%Error.prototype%"] = errorProto; - } - } - var errorProto; - var doEval = function doEval2(name) { - var value; - if (name === "%AsyncFunction%") { - value = getEvalledConstructor("async function () {}"); - } else if (name === "%GeneratorFunction%") { - value = getEvalledConstructor("function* () {}"); - } else if (name === "%AsyncGeneratorFunction%") { - value = getEvalledConstructor("async function* () {}"); - } else if (name === "%AsyncGenerator%") { - var fn = doEval2("%AsyncGeneratorFunction%"); - if (fn) { - value = fn.prototype; - } - } else if (name === "%AsyncIteratorPrototype%") { - var gen = doEval2("%AsyncGenerator%"); - if (gen && getProto) { - value = getProto(gen.prototype); - } - } - INTRINSICS[name] = value; - return value; - }; - var LEGACY_ALIASES = { - __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"] - }; - var bind = require_function_bind(); - var hasOwn = require_hasown(); - var $concat = bind.call(Function.call, Array.prototype.concat); - var $spliceApply = bind.call(Function.apply, Array.prototype.splice); - var $replace = bind.call(Function.call, String.prototype.replace); - var $strSlice = bind.call(Function.call, String.prototype.slice); - var $exec = bind.call(Function.call, RegExp.prototype.exec); - var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; - var stringToPath = function stringToPath2(string) { - var first2 = $strSlice(string, 0, 1); - var last2 = $strSlice(string, -1); - if (first2 === "%" && last2 !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last2 === "%" && first2 !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); - } - var result = []; - $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; - }); - return result; - }; - var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = "%" + alias[0] + "%"; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); - } - if (typeof value === "undefined" && !allowMissing) { - throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); - } - return { - alias, - name: intrinsicName, - value - }; - } - throw new $SyntaxError("intrinsic " + name + " does not exist!"); - }; - module2.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== "string" || name.length === 0) { - throw new $TypeError("intrinsic name must be a non-empty string"); - } - if (arguments.length > 1 && typeof allowMissing !== "boolean") { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - if ($exec(/^%?[^%]*%?$/, name) === null) { - throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; - var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first2 = $strSlice(part, 0, 1); - var last2 = $strSlice(part, -1); - if ((first2 === '"' || first2 === "'" || first2 === "`" || (last2 === '"' || last2 === "'" || last2 === "`")) && first2 !== last2) { - throw new $SyntaxError("property names with quotes must have matching quotes"); - } - if (part === "constructor" || !isOwn) { - skipFurtherCaching = true; - } - intrinsicBaseName += "." + part; - intrinsicRealName = "%" + intrinsicBaseName + "%"; - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); - } - return void 0; - } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - if (isOwn && "get" in desc && !("originalValue" in desc.get)) { - value = desc.get; - } else { - value = value[part]; - } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; - } - } - } - return value; - }; - } -}); - -// node_modules/.pnpm/es-define-property@1.0.0/node_modules/es-define-property/index.js -var require_es_define_property = __commonJS({ - "node_modules/.pnpm/es-define-property@1.0.0/node_modules/es-define-property/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var GetIntrinsic = require_get_intrinsic(); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true) || false; - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - } catch (e) { - $defineProperty = false; - } - } - module2.exports = $defineProperty; - } -}); - -// node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.js -var require_gopd = __commonJS({ - "node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var GetIntrinsic = require_get_intrinsic(); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - if ($gOPD) { - try { - $gOPD([], "length"); - } catch (e) { - $gOPD = null; - } - } - module2.exports = $gOPD; - } -}); - -// node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js -var require_define_data_property = __commonJS({ - "node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var $defineProperty = require_es_define_property(); - var $SyntaxError = require_syntax(); - var $TypeError = require_type(); - var gopd = require_gopd(); - module2.exports = function defineDataProperty(obj, property, value) { - if (!obj || typeof obj !== "object" && typeof obj !== "function") { - throw new $TypeError("`obj` must be an object or a function`"); - } - if (typeof property !== "string" && typeof property !== "symbol") { - throw new $TypeError("`property` must be a string or a symbol`"); - } - if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) { - throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null"); - } - if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) { - throw new $TypeError("`nonWritable`, if provided, must be a boolean or null"); - } - if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) { - throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null"); - } - if (arguments.length > 6 && typeof arguments[6] !== "boolean") { - throw new $TypeError("`loose`, if provided, must be a boolean"); - } - var nonEnumerable = arguments.length > 3 ? arguments[3] : null; - var nonWritable = arguments.length > 4 ? arguments[4] : null; - var nonConfigurable = arguments.length > 5 ? arguments[5] : null; - var loose = arguments.length > 6 ? arguments[6] : false; - var desc = !!gopd && gopd(obj, property); - if ($defineProperty) { - $defineProperty(obj, property, { - configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, - enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, - value, - writable: nonWritable === null && desc ? desc.writable : !nonWritable - }); - } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) { - obj[property] = value; - } else { - throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable."); - } - }; - } -}); - -// node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js -var require_has_property_descriptors = __commonJS({ - "node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var $defineProperty = require_es_define_property(); - var hasPropertyDescriptors = function hasPropertyDescriptors2() { - return !!$defineProperty; - }; - hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { - if (!$defineProperty) { - return null; - } - try { - return $defineProperty([], "length", { value: 1 }).length !== 1; - } catch (e) { - return true; - } - }; - module2.exports = hasPropertyDescriptors; - } -}); - -// node_modules/.pnpm/define-properties@1.2.1/node_modules/define-properties/index.js -var require_define_properties = __commonJS({ - "node_modules/.pnpm/define-properties@1.2.1/node_modules/define-properties/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var keys = require_object_keys(); - var hasSymbols = typeof Symbol === "function" && typeof Symbol("foo") === "symbol"; - var toStr = Object.prototype.toString; - var concat = Array.prototype.concat; - var defineDataProperty = require_define_data_property(); - var isFunction2 = function(fn) { - return typeof fn === "function" && toStr.call(fn) === "[object Function]"; - }; - var supportsDescriptors = require_has_property_descriptors()(); - var defineProperty = function(object, name, value, predicate) { - if (name in object) { - if (predicate === true) { - if (object[name] === value) { - return; - } - } else if (!isFunction2(predicate) || !predicate()) { - return; - } - } - if (supportsDescriptors) { - defineDataProperty(object, name, value, true); - } else { - defineDataProperty(object, name, value); - } - }; - var defineProperties = function(object, map) { - var predicates = arguments.length > 2 ? arguments[2] : {}; - var props = keys(map); - if (hasSymbols) { - props = concat.call(props, Object.getOwnPropertySymbols(map)); - } - for (var i = 0; i < props.length; i += 1) { - defineProperty(object, props[i], map[props[i]], predicates[props[i]]); - } - }; - defineProperties.supportsDescriptors = !!supportsDescriptors; - module2.exports = defineProperties; - } -}); - -// node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js -var require_set_function_length = __commonJS({ - "node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var GetIntrinsic = require_get_intrinsic(); - var define2 = require_define_data_property(); - var hasDescriptors = require_has_property_descriptors()(); - var gOPD = require_gopd(); - var $TypeError = require_type(); - var $floor = GetIntrinsic("%Math.floor%"); - module2.exports = function setFunctionLength(fn, length) { - if (typeof fn !== "function") { - throw new $TypeError("`fn` is not a function"); - } - if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) { - throw new $TypeError("`length` must be a positive 32-bit integer"); - } - var loose = arguments.length > 2 && !!arguments[2]; - var functionLengthIsConfigurable = true; - var functionLengthIsWritable = true; - if ("length" in fn && gOPD) { - var desc = gOPD(fn, "length"); - if (desc && !desc.configurable) { - functionLengthIsConfigurable = false; - } - if (desc && !desc.writable) { - functionLengthIsWritable = false; - } - } - if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { - if (hasDescriptors) { - define2( - /** @type {Parameters[0]} */ - fn, - "length", - length, - true, - true - ); - } else { - define2( - /** @type {Parameters[0]} */ - fn, - "length", - length - ); - } - } - return fn; - }; - } -}); - -// node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/index.js -var require_call_bind = __commonJS({ - "node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var bind = require_function_bind(); - var GetIntrinsic = require_get_intrinsic(); - var setFunctionLength = require_set_function_length(); - var $TypeError = require_type(); - var $apply = GetIntrinsic("%Function.prototype.apply%"); - var $call = GetIntrinsic("%Function.prototype.call%"); - var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); - var $defineProperty = require_es_define_property(); - var $max = GetIntrinsic("%Math.max%"); - module2.exports = function callBind(originalFunction) { - if (typeof originalFunction !== "function") { - throw new $TypeError("a function is required"); - } - var func = $reflectApply(bind, $call, arguments); - return setFunctionLength( - func, - 1 + $max(0, originalFunction.length - (arguments.length - 1)), - true - ); - }; - var applyBind = function applyBind2() { - return $reflectApply(bind, $apply, arguments); - }; - if ($defineProperty) { - $defineProperty(module2.exports, "apply", { value: applyBind }); - } else { - module2.exports.apply = applyBind; - } - } -}); - -// node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/callBound.js -var require_callBound = __commonJS({ - "node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/callBound.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var GetIntrinsic = require_get_intrinsic(); - var callBind = require_call_bind(); - var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); - module2.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { - return callBind(intrinsic); - } - return intrinsic; - }; - } -}); - -// node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/implementation.js -var require_implementation3 = __commonJS({ - "node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/implementation.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var objectKeys = require_object_keys(); - var hasSymbols = require_shams()(); - var callBound = require_callBound(); - var toObject = Object; - var $push = callBound("Array.prototype.push"); - var $propIsEnumerable = callBound("Object.prototype.propertyIsEnumerable"); - var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null; - module2.exports = function assign2(target, source1) { - if (target == null) { - throw new TypeError("target must be an object"); - } - var to = toObject(target); - if (arguments.length === 1) { - return to; - } - for (var s = 1; s < arguments.length; ++s) { - var from = toObject(arguments[s]); - var keys = objectKeys(from); - var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols); - if (getSymbols) { - var syms = getSymbols(from); - for (var j = 0; j < syms.length; ++j) { - var key2 = syms[j]; - if ($propIsEnumerable(from, key2)) { - $push(keys, key2); - } - } - } - for (var i = 0; i < keys.length; ++i) { - var nextKey = keys[i]; - if ($propIsEnumerable(from, nextKey)) { - var propValue = from[nextKey]; - to[nextKey] = propValue; - } - } - } - return to; - }; - } -}); - -// node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/polyfill.js -var require_polyfill = __commonJS({ - "node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/polyfill.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var implementation = require_implementation3(); - var lacksProperEnumerationOrder = function() { - if (!Object.assign) { - return false; - } - var str = "abcdefghijklmnopqrst"; - var letters = str.split(""); - var map = {}; - for (var i = 0; i < letters.length; ++i) { - map[letters[i]] = letters[i]; - } - var obj = Object.assign({}, map); - var actual = ""; - for (var k in obj) { - actual += k; - } - return str !== actual; - }; - var assignHasPendingExceptions = function() { - if (!Object.assign || !Object.preventExtensions) { - return false; - } - var thrower = Object.preventExtensions({ 1: 2 }); - try { - Object.assign(thrower, "xy"); - } catch (e) { - return thrower[1] === "y"; - } - return false; - }; - module2.exports = function getPolyfill() { - if (!Object.assign) { - return implementation; - } - if (lacksProperEnumerationOrder()) { - return implementation; - } - if (assignHasPendingExceptions()) { - return implementation; - } - return Object.assign; - }; - } -}); - -// node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/shim.js -var require_shim = __commonJS({ - "node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/shim.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var define2 = require_define_properties(); - var getPolyfill = require_polyfill(); - module2.exports = function shimAssign() { - var polyfill = getPolyfill(); - define2( - Object, - { assign: polyfill }, - { assign: function() { - return Object.assign !== polyfill; - } } - ); - return polyfill; - }; - } -}); - -// node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/index.js -var require_object = __commonJS({ - "node_modules/.pnpm/object.assign@4.1.5/node_modules/object.assign/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var defineProperties = require_define_properties(); - var callBind = require_call_bind(); - var implementation = require_implementation3(); - var getPolyfill = require_polyfill(); - var shim = require_shim(); - var polyfill = callBind.apply(getPolyfill()); - var bound = function assign2(target, source1) { - return polyfill(Object, arguments); - }; - defineProperties(bound, { - getPolyfill, - implementation, - shim - }); - module2.exports = bound; - } -}); - -// node_modules/.pnpm/functions-have-names@1.2.3/node_modules/functions-have-names/index.js -var require_functions_have_names = __commonJS({ - "node_modules/.pnpm/functions-have-names@1.2.3/node_modules/functions-have-names/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var functionsHaveNames = function functionsHaveNames2() { - return typeof function f() { - }.name === "string"; - }; - var gOPD = Object.getOwnPropertyDescriptor; - if (gOPD) { - try { - gOPD([], "length"); - } catch (e) { - gOPD = null; - } - } - functionsHaveNames.functionsHaveConfigurableNames = function functionsHaveConfigurableNames() { - if (!functionsHaveNames() || !gOPD) { - return false; - } - var desc = gOPD(function() { - }, "name"); - return !!desc && !!desc.configurable; - }; - var $bind = Function.prototype.bind; - functionsHaveNames.boundFunctionsHaveNames = function boundFunctionsHaveNames() { - return functionsHaveNames() && typeof $bind === "function" && function f() { - }.bind().name !== ""; - }; - module2.exports = functionsHaveNames; - } -}); - -// node_modules/.pnpm/set-function-name@2.0.2/node_modules/set-function-name/index.js -var require_set_function_name = __commonJS({ - "node_modules/.pnpm/set-function-name@2.0.2/node_modules/set-function-name/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var define2 = require_define_data_property(); - var hasDescriptors = require_has_property_descriptors()(); - var functionsHaveConfigurableNames = require_functions_have_names().functionsHaveConfigurableNames(); - var $TypeError = require_type(); - module2.exports = function setFunctionName(fn, name) { - if (typeof fn !== "function") { - throw new $TypeError("`fn` is not a function"); - } - var loose = arguments.length > 2 && !!arguments[2]; - if (!loose || functionsHaveConfigurableNames) { - if (hasDescriptors) { - define2( - /** @type {Parameters[0]} */ - fn, - "name", - name, - true, - true - ); - } else { - define2( - /** @type {Parameters[0]} */ - fn, - "name", - name - ); - } - } - return fn; - }; - } -}); - -// node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/implementation.js -var require_implementation4 = __commonJS({ - "node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/implementation.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var setFunctionName = require_set_function_name(); - var $TypeError = require_type(); - var $Object = Object; - module2.exports = setFunctionName(function flags() { - if (this == null || this !== $Object(this)) { - throw new $TypeError("RegExp.prototype.flags getter called on non-object"); - } - var result = ""; - if (this.hasIndices) { - result += "d"; - } - if (this.global) { - result += "g"; - } - if (this.ignoreCase) { - result += "i"; - } - if (this.multiline) { - result += "m"; - } - if (this.dotAll) { - result += "s"; - } - if (this.unicode) { - result += "u"; - } - if (this.unicodeSets) { - result += "v"; - } - if (this.sticky) { - result += "y"; - } - return result; - }, "get flags", true); - } -}); - -// node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/polyfill.js -var require_polyfill2 = __commonJS({ - "node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/polyfill.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var implementation = require_implementation4(); - var supportsDescriptors = require_define_properties().supportsDescriptors; - var $gOPD = Object.getOwnPropertyDescriptor; - module2.exports = function getPolyfill() { - if (supportsDescriptors && /a/mig.flags === "gim") { - var descriptor = $gOPD(RegExp.prototype, "flags"); - if (descriptor && typeof descriptor.get === "function" && typeof RegExp.prototype.dotAll === "boolean" && typeof RegExp.prototype.hasIndices === "boolean") { - var calls = ""; - var o = {}; - Object.defineProperty(o, "hasIndices", { - get: function() { - calls += "d"; - } - }); - Object.defineProperty(o, "sticky", { - get: function() { - calls += "y"; - } - }); - if (calls === "dy") { - return descriptor.get; - } - } - } - return implementation; - }; - } -}); - -// node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/shim.js -var require_shim2 = __commonJS({ - "node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/shim.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var supportsDescriptors = require_define_properties().supportsDescriptors; - var getPolyfill = require_polyfill2(); - var gOPD = Object.getOwnPropertyDescriptor; - var defineProperty = Object.defineProperty; - var TypeErr = TypeError; - var getProto = Object.getPrototypeOf; - var regex2 = /a/; - module2.exports = function shimFlags() { - if (!supportsDescriptors || !getProto) { - throw new TypeErr("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors"); - } - var polyfill = getPolyfill(); - var proto = getProto(regex2); - var descriptor = gOPD(proto, "flags"); - if (!descriptor || descriptor.get !== polyfill) { - defineProperty(proto, "flags", { - configurable: true, - enumerable: false, - get: polyfill - }); - } - return polyfill; - }; - } -}); - -// node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/index.js -var require_regexp_prototype = __commonJS({ - "node_modules/.pnpm/regexp.prototype.flags@1.5.2/node_modules/regexp.prototype.flags/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var define2 = require_define_properties(); - var callBind = require_call_bind(); - var implementation = require_implementation4(); - var getPolyfill = require_polyfill2(); - var shim = require_shim2(); - var flagsBound = callBind(getPolyfill()); - define2(flagsBound, { - getPolyfill, - implementation, - shim - }); - module2.exports = flagsBound; - } -}); - -// node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js -var require_shams2 = __commonJS({ - "node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var hasSymbols = require_shams(); - module2.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; - }; - } -}); - -// node_modules/.pnpm/is-arguments@1.1.1/node_modules/is-arguments/index.js -var require_is_arguments = __commonJS({ - "node_modules/.pnpm/is-arguments@1.1.1/node_modules/is-arguments/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var hasToStringTag = require_shams2()(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === "[object Arguments]"; - }; - var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]"; - }; - var supportsStandardArguments = function() { - return isStandardArguments(arguments); - }(); - isStandardArguments.isLegacyArguments = isLegacyArguments; - module2.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - } -}); - -// (disabled):node_modules/.pnpm/object-inspect@1.13.2/node_modules/object-inspect/util.inspect -var require_util = __commonJS({ - "(disabled):node_modules/.pnpm/object-inspect@1.13.2/node_modules/object-inspect/util.inspect"() { - init_polyfill_buffer(); - } -}); - -// node_modules/.pnpm/object-inspect@1.13.2/node_modules/object-inspect/index.js -var require_object_inspect = __commonJS({ - "node_modules/.pnpm/object-inspect@1.13.2/node_modules/object-inspect/index.js"(exports2, module2) { - init_polyfill_buffer(); - var hasMap = typeof Map === "function" && Map.prototype; - var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null; - var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === "function" ? mapSizeDescriptor.get : null; - var mapForEach = hasMap && Map.prototype.forEach; - var hasSet = typeof Set === "function" && Set.prototype; - var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null; - var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === "function" ? setSizeDescriptor.get : null; - var setForEach = hasSet && Set.prototype.forEach; - var hasWeakMap = typeof WeakMap === "function" && WeakMap.prototype; - var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; - var hasWeakSet = typeof WeakSet === "function" && WeakSet.prototype; - var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; - var hasWeakRef = typeof WeakRef === "function" && WeakRef.prototype; - var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; - var booleanValueOf = Boolean.prototype.valueOf; - var objectToString2 = Object.prototype.toString; - var functionToString = Function.prototype.toString; - var $match = String.prototype.match; - var $slice = String.prototype.slice; - var $replace = String.prototype.replace; - var $toUpperCase = String.prototype.toUpperCase; - var $toLowerCase = String.prototype.toLowerCase; - var $test = RegExp.prototype.test; - var $concat = Array.prototype.concat; - var $join = Array.prototype.join; - var $arrSlice = Array.prototype.slice; - var $floor = Math.floor; - var bigIntValueOf = typeof BigInt === "function" ? BigInt.prototype.valueOf : null; - var gOPS = Object.getOwnPropertySymbols; - var symToString = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? Symbol.prototype.toString : null; - var hasShammedSymbols = typeof Symbol === "function" && typeof Symbol.iterator === "object"; - var toStringTag = typeof Symbol === "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? "object" : "symbol") ? Symbol.toStringTag : null; - var isEnumerable = Object.prototype.propertyIsEnumerable; - var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O) { - return O.__proto__; - } : null); - function addNumericSeparator(num2, str) { - if (num2 === Infinity || num2 === -Infinity || num2 !== num2 || num2 && num2 > -1e3 && num2 < 1e3 || $test.call(/e/, str)) { - return str; - } - var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; - if (typeof num2 === "number") { - var int = num2 < 0 ? -$floor(-num2) : $floor(num2); - if (int !== num2) { - var intStr = String(int); - var dec = $slice.call(str, intStr.length + 1); - return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec, /([0-9]{3})/g, "$&_"), /_$/, ""); - } - } - return $replace.call(str, sepRegex, "$&_"); - } - var utilInspect = require_util(); - var inspectCustom = utilInspect.custom; - var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; - module2.exports = function inspect_(obj, options, depth, seen) { - var opts = options || {}; - if (has(opts, "quoteStyle") && (opts.quoteStyle !== "single" && opts.quoteStyle !== "double")) { - throw new TypeError('option "quoteStyle" must be "single" or "double"'); - } - if (has(opts, "maxStringLength") && (typeof opts.maxStringLength === "number" ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) { - throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); - } - var customInspect = has(opts, "customInspect") ? opts.customInspect : true; - if (typeof customInspect !== "boolean" && customInspect !== "symbol") { - throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`"); - } - if (has(opts, "indent") && opts.indent !== null && opts.indent !== " " && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) { - throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); - } - if (has(opts, "numericSeparator") && typeof opts.numericSeparator !== "boolean") { - throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); - } - var numericSeparator = opts.numericSeparator; - if (typeof obj === "undefined") { - return "undefined"; - } - if (obj === null) { - return "null"; - } - if (typeof obj === "boolean") { - return obj ? "true" : "false"; - } - if (typeof obj === "string") { - return inspectString(obj, opts); - } - if (typeof obj === "number") { - if (obj === 0) { - return Infinity / obj > 0 ? "0" : "-0"; - } - var str = String(obj); - return numericSeparator ? addNumericSeparator(obj, str) : str; - } - if (typeof obj === "bigint") { - var bigIntStr = String(obj) + "n"; - return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; - } - var maxDepth = typeof opts.depth === "undefined" ? 5 : opts.depth; - if (typeof depth === "undefined") { - depth = 0; - } - if (depth >= maxDepth && maxDepth > 0 && typeof obj === "object") { - return isArray(obj) ? "[Array]" : "[Object]"; - } - var indent2 = getIndent(opts, depth); - if (typeof seen === "undefined") { - seen = []; - } else if (indexOf(seen, obj) >= 0) { - return "[Circular]"; - } - function inspect(value, from, noIndent) { - if (from) { - seen = $arrSlice.call(seen); - seen.push(from); - } - if (noIndent) { - var newOpts = { - depth: opts.depth - }; - if (has(opts, "quoteStyle")) { - newOpts.quoteStyle = opts.quoteStyle; - } - return inspect_(value, newOpts, depth + 1, seen); - } - return inspect_(value, opts, depth + 1, seen); - } - if (typeof obj === "function" && !isRegExp(obj)) { - var name = nameOf(obj); - var keys = arrObjKeys(obj, inspect); - return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : ""); - } - if (isSymbol(obj)) { - var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, "$1") : symToString.call(obj); - return typeof obj === "object" && !hasShammedSymbols ? markBoxed(symString) : symString; - } - if (isElement(obj)) { - var s = "<" + $toLowerCase.call(String(obj.nodeName)); - var attrs = obj.attributes || []; - for (var i = 0; i < attrs.length; i++) { - s += " " + attrs[i].name + "=" + wrapQuotes(quote(attrs[i].value), "double", opts); - } - s += ">"; - if (obj.childNodes && obj.childNodes.length) { - s += "..."; - } - s += ""; - return s; - } - if (isArray(obj)) { - if (obj.length === 0) { - return "[]"; - } - var xs = arrObjKeys(obj, inspect); - if (indent2 && !singleLineValues(xs)) { - return "[" + indentedJoin(xs, indent2) + "]"; - } - return "[ " + $join.call(xs, ", ") + " ]"; - } - if (isError(obj)) { - var parts = arrObjKeys(obj, inspect); - if (!("cause" in Error.prototype) && "cause" in obj && !isEnumerable.call(obj, "cause")) { - return "{ [" + String(obj) + "] " + $join.call($concat.call("[cause]: " + inspect(obj.cause), parts), ", ") + " }"; - } - if (parts.length === 0) { - return "[" + String(obj) + "]"; - } - return "{ [" + String(obj) + "] " + $join.call(parts, ", ") + " }"; - } - if (typeof obj === "object" && customInspect) { - if (inspectSymbol && typeof obj[inspectSymbol] === "function" && utilInspect) { - return utilInspect(obj, { depth: maxDepth - depth }); - } else if (customInspect !== "symbol" && typeof obj.inspect === "function") { - return obj.inspect(); - } - } - if (isMap(obj)) { - var mapParts = []; - if (mapForEach) { - mapForEach.call(obj, function(value, key2) { - mapParts.push(inspect(key2, obj, true) + " => " + inspect(value, obj)); - }); - } - return collectionOf("Map", mapSize.call(obj), mapParts, indent2); - } - if (isSet(obj)) { - var setParts = []; - if (setForEach) { - setForEach.call(obj, function(value) { - setParts.push(inspect(value, obj)); - }); - } - return collectionOf("Set", setSize.call(obj), setParts, indent2); - } - if (isWeakMap(obj)) { - return weakCollectionOf("WeakMap"); - } - if (isWeakSet(obj)) { - return weakCollectionOf("WeakSet"); - } - if (isWeakRef(obj)) { - return weakCollectionOf("WeakRef"); - } - if (isNumber(obj)) { - return markBoxed(inspect(Number(obj))); - } - if (isBigInt(obj)) { - return markBoxed(inspect(bigIntValueOf.call(obj))); - } - if (isBoolean(obj)) { - return markBoxed(booleanValueOf.call(obj)); - } - if (isString(obj)) { - return markBoxed(inspect(String(obj))); - } - if (typeof window !== "undefined" && obj === window) { - return "{ [object Window] }"; - } - if (typeof globalThis !== "undefined" && obj === globalThis || typeof global !== "undefined" && obj === global) { - return "{ [object globalThis] }"; - } - if (!isDate(obj) && !isRegExp(obj)) { - var ys = arrObjKeys(obj, inspect); - var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; - var protoTag = obj instanceof Object ? "" : "null prototype"; - var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : ""; - var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : ""; - var tag2 = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : ""); - if (ys.length === 0) { - return tag2 + "{}"; - } - if (indent2) { - return tag2 + "{" + indentedJoin(ys, indent2) + "}"; - } - return tag2 + "{ " + $join.call(ys, ", ") + " }"; - } - return String(obj); - }; - function wrapQuotes(s, defaultStyle, opts) { - var quoteChar = (opts.quoteStyle || defaultStyle) === "double" ? '"' : "'"; - return quoteChar + s + quoteChar; - } - function quote(s) { - return $replace.call(String(s), /"/g, """); - } - function isArray(obj) { - return toStr(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); - } - function isDate(obj) { - return toStr(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); - } - function isRegExp(obj) { - return toStr(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); - } - function isError(obj) { - return toStr(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); - } - function isString(obj) { - return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); - } - function isNumber(obj) { - return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); - } - function isBoolean(obj) { - return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); - } - function isSymbol(obj) { - if (hasShammedSymbols) { - return obj && typeof obj === "object" && obj instanceof Symbol; - } - if (typeof obj === "symbol") { - return true; - } - if (!obj || typeof obj !== "object" || !symToString) { - return false; - } - try { - symToString.call(obj); - return true; - } catch (e) { - } - return false; - } - function isBigInt(obj) { - if (!obj || typeof obj !== "object" || !bigIntValueOf) { - return false; - } - try { - bigIntValueOf.call(obj); - return true; - } catch (e) { - } - return false; - } - var hasOwn = Object.prototype.hasOwnProperty || function(key2) { - return key2 in this; - }; - function has(obj, key2) { - return hasOwn.call(obj, key2); - } - function toStr(obj) { - return objectToString2.call(obj); - } - function nameOf(f) { - if (f.name) { - return f.name; - } - var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); - if (m) { - return m[1]; - } - return null; - } - function indexOf(xs, x) { - if (xs.indexOf) { - return xs.indexOf(x); - } - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) { - return i; - } - } - return -1; - } - function isMap(x) { - if (!mapSize || !x || typeof x !== "object") { - return false; - } - try { - mapSize.call(x); - try { - setSize.call(x); - } catch (s) { - return true; - } - return x instanceof Map; - } catch (e) { - } - return false; - } - function isWeakMap(x) { - if (!weakMapHas || !x || typeof x !== "object") { - return false; - } - try { - weakMapHas.call(x, weakMapHas); - try { - weakSetHas.call(x, weakSetHas); - } catch (s) { - return true; - } - return x instanceof WeakMap; - } catch (e) { - } - return false; - } - function isWeakRef(x) { - if (!weakRefDeref || !x || typeof x !== "object") { - return false; - } - try { - weakRefDeref.call(x); - return true; - } catch (e) { - } - return false; - } - function isSet(x) { - if (!setSize || !x || typeof x !== "object") { - return false; - } - try { - setSize.call(x); - try { - mapSize.call(x); - } catch (m) { - return true; - } - return x instanceof Set; - } catch (e) { - } - return false; - } - function isWeakSet(x) { - if (!weakSetHas || !x || typeof x !== "object") { - return false; - } - try { - weakSetHas.call(x, weakSetHas); - try { - weakMapHas.call(x, weakMapHas); - } catch (s) { - return true; - } - return x instanceof WeakSet; - } catch (e) { - } - return false; - } - function isElement(x) { - if (!x || typeof x !== "object") { - return false; - } - if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) { - return true; - } - return typeof x.nodeName === "string" && typeof x.getAttribute === "function"; - } - function inspectString(str, opts) { - if (str.length > opts.maxStringLength) { - var remaining = str.length - opts.maxStringLength; - var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : ""); - return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; - } - var s = $replace.call($replace.call(str, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, lowbyte); - return wrapQuotes(s, "single", opts); - } - function lowbyte(c) { - var n = c.charCodeAt(0); - var x = { - 8: "b", - 9: "t", - 10: "n", - 12: "f", - 13: "r" - }[n]; - if (x) { - return "\\" + x; - } - return "\\x" + (n < 16 ? "0" : "") + $toUpperCase.call(n.toString(16)); - } - function markBoxed(str) { - return "Object(" + str + ")"; - } - function weakCollectionOf(type) { - return type + " { ? }"; - } - function collectionOf(type, size, entries, indent2) { - var joinedEntries = indent2 ? indentedJoin(entries, indent2) : $join.call(entries, ", "); - return type + " (" + size + ") {" + joinedEntries + "}"; - } - function singleLineValues(xs) { - for (var i = 0; i < xs.length; i++) { - if (indexOf(xs[i], "\n") >= 0) { - return false; - } - } - return true; - } - function getIndent(opts, depth) { - var baseIndent; - if (opts.indent === " ") { - baseIndent = " "; - } else if (typeof opts.indent === "number" && opts.indent > 0) { - baseIndent = $join.call(Array(opts.indent + 1), " "); - } else { - return null; - } - return { - base: baseIndent, - prev: $join.call(Array(depth + 1), baseIndent) - }; - } - function indentedJoin(xs, indent2) { - if (xs.length === 0) { - return ""; - } - var lineJoiner = "\n" + indent2.prev + indent2.base; - return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" + indent2.prev; - } - function arrObjKeys(obj, inspect) { - var isArr = isArray(obj); - var xs = []; - if (isArr) { - xs.length = obj.length; - for (var i = 0; i < obj.length; i++) { - xs[i] = has(obj, i) ? inspect(obj[i], obj) : ""; - } - } - var syms = typeof gOPS === "function" ? gOPS(obj) : []; - var symMap; - if (hasShammedSymbols) { - symMap = {}; - for (var k = 0; k < syms.length; k++) { - symMap["$" + syms[k]] = syms[k]; - } - } - for (var key2 in obj) { - if (!has(obj, key2)) { - continue; - } - if (isArr && String(Number(key2)) === key2 && key2 < obj.length) { - continue; - } - if (hasShammedSymbols && symMap["$" + key2] instanceof Symbol) { - continue; - } else if ($test.call(/[^\w$]/, key2)) { - xs.push(inspect(key2, obj) + ": " + inspect(obj[key2], obj)); - } else { - xs.push(key2 + ": " + inspect(obj[key2], obj)); - } - } - if (typeof gOPS === "function") { - for (var j = 0; j < syms.length; j++) { - if (isEnumerable.call(obj, syms[j])) { - xs.push("[" + inspect(syms[j]) + "]: " + inspect(obj[syms[j]], obj)); - } - } - } - return xs; - } - } -}); - -// node_modules/.pnpm/side-channel@1.0.6/node_modules/side-channel/index.js -var require_side_channel = __commonJS({ - "node_modules/.pnpm/side-channel@1.0.6/node_modules/side-channel/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var GetIntrinsic = require_get_intrinsic(); - var callBound = require_callBound(); - var inspect = require_object_inspect(); - var $TypeError = require_type(); - var $WeakMap = GetIntrinsic("%WeakMap%", true); - var $Map = GetIntrinsic("%Map%", true); - var $weakMapGet = callBound("WeakMap.prototype.get", true); - var $weakMapSet = callBound("WeakMap.prototype.set", true); - var $weakMapHas = callBound("WeakMap.prototype.has", true); - var $mapGet = callBound("Map.prototype.get", true); - var $mapSet = callBound("Map.prototype.set", true); - var $mapHas = callBound("Map.prototype.has", true); - var listGetNode = function(list, key2) { - var prev = list; - var curr; - for (; (curr = prev.next) !== null; prev = curr) { - if (curr.key === key2) { - prev.next = curr.next; - curr.next = /** @type {NonNullable} */ - list.next; - list.next = curr; - return curr; - } - } - }; - var listGet = function(objects, key2) { - var node = listGetNode(objects, key2); - return node && node.value; - }; - var listSet = function(objects, key2, value) { - var node = listGetNode(objects, key2); - if (node) { - node.value = value; - } else { - objects.next = /** @type {import('.').ListNode} */ - { - // eslint-disable-line no-param-reassign, no-extra-parens - key: key2, - next: objects.next, - value - }; - } - }; - var listHas = function(objects, key2) { - return !!listGetNode(objects, key2); - }; - module2.exports = function getSideChannel() { - var $wm; - var $m; - var $o; - var channel = { - assert: function(key2) { - if (!channel.has(key2)) { - throw new $TypeError("Side channel does not contain " + inspect(key2)); - } - }, - get: function(key2) { - if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) { - if ($wm) { - return $weakMapGet($wm, key2); - } - } else if ($Map) { - if ($m) { - return $mapGet($m, key2); - } - } else { - if ($o) { - return listGet($o, key2); - } - } - }, - has: function(key2) { - if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) { - if ($wm) { - return $weakMapHas($wm, key2); - } - } else if ($Map) { - if ($m) { - return $mapHas($m, key2); - } - } else { - if ($o) { - return listHas($o, key2); - } - } - return false; - }, - set: function(key2, value) { - if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) { - if (!$wm) { - $wm = new $WeakMap(); - } - $weakMapSet($wm, key2, value); - } else if ($Map) { - if (!$m) { - $m = new $Map(); - } - $mapSet($m, key2, value); - } else { - if (!$o) { - $o = { key: {}, next: null }; - } - listSet($o, key2, value); - } - } - }; - return channel; - }; - } -}); - -// node_modules/.pnpm/internal-slot@1.0.7/node_modules/internal-slot/index.js -var require_internal_slot = __commonJS({ - "node_modules/.pnpm/internal-slot@1.0.7/node_modules/internal-slot/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var hasOwn = require_hasown(); - var channel = require_side_channel()(); - var $TypeError = require_type(); - var SLOT = { - assert: function(O, slot) { - if (!O || typeof O !== "object" && typeof O !== "function") { - throw new $TypeError("`O` is not an object"); - } - if (typeof slot !== "string") { - throw new $TypeError("`slot` must be a string"); - } - channel.assert(O); - if (!SLOT.has(O, slot)) { - throw new $TypeError("`" + slot + "` is not present on `O`"); - } - }, - get: function(O, slot) { - if (!O || typeof O !== "object" && typeof O !== "function") { - throw new $TypeError("`O` is not an object"); - } - if (typeof slot !== "string") { - throw new $TypeError("`slot` must be a string"); - } - var slots = channel.get(O); - return slots && slots["$" + slot]; - }, - has: function(O, slot) { - if (!O || typeof O !== "object" && typeof O !== "function") { - throw new $TypeError("`O` is not an object"); - } - if (typeof slot !== "string") { - throw new $TypeError("`slot` must be a string"); - } - var slots = channel.get(O); - return !!slots && hasOwn(slots, "$" + slot); - }, - set: function(O, slot, V) { - if (!O || typeof O !== "object" && typeof O !== "function") { - throw new $TypeError("`O` is not an object"); - } - if (typeof slot !== "string") { - throw new $TypeError("`slot` must be a string"); - } - var slots = channel.get(O); - if (!slots) { - slots = {}; - channel.set(O, slots); - } - slots["$" + slot] = V; - } - }; - if (Object.freeze) { - Object.freeze(SLOT); - } - module2.exports = SLOT; - } -}); - -// node_modules/.pnpm/stop-iteration-iterator@1.0.0/node_modules/stop-iteration-iterator/index.js -var require_stop_iteration_iterator = __commonJS({ - "node_modules/.pnpm/stop-iteration-iterator@1.0.0/node_modules/stop-iteration-iterator/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var SLOT = require_internal_slot(); - var $SyntaxError = SyntaxError; - var $StopIteration = typeof StopIteration === "object" ? StopIteration : null; - module2.exports = function getStopIterationIterator(origIterator) { - if (!$StopIteration) { - throw new $SyntaxError("this environment lacks StopIteration"); - } - SLOT.set(origIterator, "[[Done]]", false); - var siIterator = { - next: function next() { - var iterator = SLOT.get(this, "[[Iterator]]"); - var done = SLOT.get(iterator, "[[Done]]"); - try { - return { - done, - value: done ? void 0 : iterator.next() - }; - } catch (e) { - SLOT.set(iterator, "[[Done]]", true); - if (e !== $StopIteration) { - throw e; - } - return { - done: true, - value: void 0 - }; - } - } - }; - SLOT.set(siIterator, "[[Iterator]]", origIterator); - return siIterator; - }; - } -}); - -// node_modules/.pnpm/isarray@2.0.5/node_modules/isarray/index.js -var require_isarray = __commonJS({ - "node_modules/.pnpm/isarray@2.0.5/node_modules/isarray/index.js"(exports2, module2) { - init_polyfill_buffer(); - var toString = {}.toString; - module2.exports = Array.isArray || function(arr) { - return toString.call(arr) == "[object Array]"; - }; - } -}); - -// node_modules/.pnpm/is-string@1.0.7/node_modules/is-string/index.js -var require_is_string = __commonJS({ - "node_modules/.pnpm/is-string@1.0.7/node_modules/is-string/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var strValue = String.prototype.valueOf; - var tryStringObject = function tryStringObject2(value) { - try { - strValue.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var strClass = "[object String]"; - var hasToStringTag = require_shams2()(); - module2.exports = function isString(value) { - if (typeof value === "string") { - return true; - } - if (typeof value !== "object") { - return false; - } - return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; - }; - } -}); - -// node_modules/.pnpm/is-map@2.0.3/node_modules/is-map/index.js -var require_is_map = __commonJS({ - "node_modules/.pnpm/is-map@2.0.3/node_modules/is-map/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var $Map = typeof Map === "function" && Map.prototype ? Map : null; - var $Set = typeof Set === "function" && Set.prototype ? Set : null; - var exported; - if (!$Map) { - exported = function isMap(x) { - return false; - }; - } - var $mapHas = $Map ? Map.prototype.has : null; - var $setHas = $Set ? Set.prototype.has : null; - if (!exported && !$mapHas) { - exported = function isMap(x) { - return false; - }; - } - module2.exports = exported || function isMap(x) { - if (!x || typeof x !== "object") { - return false; - } - try { - $mapHas.call(x); - if ($setHas) { - try { - $setHas.call(x); - } catch (e) { - return true; - } - } - return x instanceof $Map; - } catch (e) { - } - return false; - }; - } -}); - -// node_modules/.pnpm/is-set@2.0.3/node_modules/is-set/index.js -var require_is_set = __commonJS({ - "node_modules/.pnpm/is-set@2.0.3/node_modules/is-set/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var $Map = typeof Map === "function" && Map.prototype ? Map : null; - var $Set = typeof Set === "function" && Set.prototype ? Set : null; - var exported; - if (!$Set) { - exported = function isSet(x) { - return false; - }; - } - var $mapHas = $Map ? Map.prototype.has : null; - var $setHas = $Set ? Set.prototype.has : null; - if (!exported && !$setHas) { - exported = function isSet(x) { - return false; - }; - } - module2.exports = exported || function isSet(x) { - if (!x || typeof x !== "object") { - return false; - } - try { - $setHas.call(x); - if ($mapHas) { - try { - $mapHas.call(x); - } catch (e) { - return true; - } - } - return x instanceof $Set; - } catch (e) { - } - return false; - }; - } -}); - -// node_modules/.pnpm/es-get-iterator@1.1.3/node_modules/es-get-iterator/index.js -var require_es_get_iterator = __commonJS({ - "node_modules/.pnpm/es-get-iterator@1.1.3/node_modules/es-get-iterator/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var isArguments = require_is_arguments(); - var getStopIterationIterator = require_stop_iteration_iterator(); - if (require_has_symbols()() || require_shams()()) { - $iterator = Symbol.iterator; - module2.exports = function getIterator3(iterable) { - if (iterable != null && typeof iterable[$iterator] !== "undefined") { - return iterable[$iterator](); - } - if (isArguments(iterable)) { - return Array.prototype[$iterator].call(iterable); - } - }; - } else { - isArray = require_isarray(); - isString = require_is_string(); - GetIntrinsic = require_get_intrinsic(); - $Map = GetIntrinsic("%Map%", true); - $Set = GetIntrinsic("%Set%", true); - callBound = require_callBound(); - $arrayPush = callBound("Array.prototype.push"); - $charCodeAt = callBound("String.prototype.charCodeAt"); - $stringSlice = callBound("String.prototype.slice"); - advanceStringIndex = function advanceStringIndex2(S, index2) { - var length = S.length; - if (index2 + 1 >= length) { - return index2 + 1; - } - var first2 = $charCodeAt(S, index2); - if (first2 < 55296 || first2 > 56319) { - return index2 + 1; - } - var second = $charCodeAt(S, index2 + 1); - if (second < 56320 || second > 57343) { - return index2 + 1; - } - return index2 + 2; - }; - getArrayIterator = function getArrayIterator2(arraylike) { - var i = 0; - return { - next: function next() { - var done = i >= arraylike.length; - var value; - if (!done) { - value = arraylike[i]; - i += 1; - } - return { - done, - value - }; - } - }; - }; - getNonCollectionIterator = function getNonCollectionIterator2(iterable, noPrimordialCollections) { - if (isArray(iterable) || isArguments(iterable)) { - return getArrayIterator(iterable); - } - if (isString(iterable)) { - var i = 0; - return { - next: function next() { - var nextIndex = advanceStringIndex(iterable, i); - var value = $stringSlice(iterable, i, nextIndex); - i = nextIndex; - return { - done: nextIndex > iterable.length, - value - }; - } - }; - } - if (noPrimordialCollections && typeof iterable["_es6-shim iterator_"] !== "undefined") { - return iterable["_es6-shim iterator_"](); - } - }; - if (!$Map && !$Set) { - module2.exports = function getIterator3(iterable) { - if (iterable != null) { - return getNonCollectionIterator(iterable, true); - } - }; - } else { - isMap = require_is_map(); - isSet = require_is_set(); - $mapForEach = callBound("Map.prototype.forEach", true); - $setForEach = callBound("Set.prototype.forEach", true); - if (typeof process === "undefined" || !process.versions || !process.versions.node) { - $mapIterator = callBound("Map.prototype.iterator", true); - $setIterator = callBound("Set.prototype.iterator", true); - } - $mapAtAtIterator = callBound("Map.prototype.@@iterator", true) || callBound("Map.prototype._es6-shim iterator_", true); - $setAtAtIterator = callBound("Set.prototype.@@iterator", true) || callBound("Set.prototype._es6-shim iterator_", true); - getCollectionIterator = function getCollectionIterator2(iterable) { - if (isMap(iterable)) { - if ($mapIterator) { - return getStopIterationIterator($mapIterator(iterable)); - } - if ($mapAtAtIterator) { - return $mapAtAtIterator(iterable); - } - if ($mapForEach) { - var entries = []; - $mapForEach(iterable, function(v, k) { - $arrayPush(entries, [k, v]); - }); - return getArrayIterator(entries); - } - } - if (isSet(iterable)) { - if ($setIterator) { - return getStopIterationIterator($setIterator(iterable)); - } - if ($setAtAtIterator) { - return $setAtAtIterator(iterable); - } - if ($setForEach) { - var values = []; - $setForEach(iterable, function(v) { - $arrayPush(values, v); - }); - return getArrayIterator(values); - } - } - }; - module2.exports = function getIterator3(iterable) { - return getCollectionIterator(iterable) || getNonCollectionIterator(iterable); - }; - } - } - var $iterator; - var isArray; - var isString; - var GetIntrinsic; - var $Map; - var $Set; - var callBound; - var $arrayPush; - var $charCodeAt; - var $stringSlice; - var advanceStringIndex; - var getArrayIterator; - var getNonCollectionIterator; - var isMap; - var isSet; - var $mapForEach; - var $setForEach; - var $mapIterator; - var $setIterator; - var $mapAtAtIterator; - var $setAtAtIterator; - var getCollectionIterator; - } -}); - -// node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/implementation.js -var require_implementation5 = __commonJS({ - "node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/implementation.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var numberIsNaN = function(value) { - return value !== value; - }; - module2.exports = function is(a, b) { - if (a === 0 && b === 0) { - return 1 / a === 1 / b; - } - if (a === b) { - return true; - } - if (numberIsNaN(a) && numberIsNaN(b)) { - return true; - } - return false; - }; - } -}); - -// node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/polyfill.js -var require_polyfill3 = __commonJS({ - "node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/polyfill.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var implementation = require_implementation5(); - module2.exports = function getPolyfill() { - return typeof Object.is === "function" ? Object.is : implementation; - }; - } -}); - -// node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/shim.js -var require_shim3 = __commonJS({ - "node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/shim.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var getPolyfill = require_polyfill3(); - var define2 = require_define_properties(); - module2.exports = function shimObjectIs() { - var polyfill = getPolyfill(); - define2(Object, { is: polyfill }, { - is: function testObjectIs() { - return Object.is !== polyfill; - } - }); - return polyfill; - }; - } -}); - -// node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/index.js -var require_object_is = __commonJS({ - "node_modules/.pnpm/object-is@1.1.6/node_modules/object-is/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var define2 = require_define_properties(); - var callBind = require_call_bind(); - var implementation = require_implementation5(); - var getPolyfill = require_polyfill3(); - var shim = require_shim3(); - var polyfill = callBind(getPolyfill(), Object); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module2.exports = polyfill; - } -}); - -// node_modules/.pnpm/is-array-buffer@3.0.4/node_modules/is-array-buffer/index.js -var require_is_array_buffer = __commonJS({ - "node_modules/.pnpm/is-array-buffer@3.0.4/node_modules/is-array-buffer/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var callBind = require_call_bind(); - var callBound = require_callBound(); - var GetIntrinsic = require_get_intrinsic(); - var $ArrayBuffer = GetIntrinsic("%ArrayBuffer%", true); - var $byteLength = callBound("ArrayBuffer.prototype.byteLength", true); - var $toString = callBound("Object.prototype.toString"); - var abSlice = !!$ArrayBuffer && !$byteLength && new $ArrayBuffer(0).slice; - var $abSlice = !!abSlice && callBind(abSlice); - module2.exports = $byteLength || $abSlice ? function isArrayBuffer(obj) { - if (!obj || typeof obj !== "object") { - return false; - } - try { - if ($byteLength) { - $byteLength(obj); - } else { - $abSlice(obj, 0); - } - return true; - } catch (e) { - return false; - } - } : $ArrayBuffer ? function isArrayBuffer(obj) { - return $toString(obj) === "[object ArrayBuffer]"; - } : function isArrayBuffer(obj) { - return false; - }; - } -}); - -// node_modules/.pnpm/is-date-object@1.0.5/node_modules/is-date-object/index.js -var require_is_date_object = __commonJS({ - "node_modules/.pnpm/is-date-object@1.0.5/node_modules/is-date-object/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var getDay = Date.prototype.getDay; - var tryDateObject = function tryDateGetDayCall(value) { - try { - getDay.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var dateClass = "[object Date]"; - var hasToStringTag = require_shams2()(); - module2.exports = function isDateObject(value) { - if (typeof value !== "object" || value === null) { - return false; - } - return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass; - }; - } -}); - -// node_modules/.pnpm/is-regex@1.1.4/node_modules/is-regex/index.js -var require_is_regex = __commonJS({ - "node_modules/.pnpm/is-regex@1.1.4/node_modules/is-regex/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var callBound = require_callBound(); - var hasToStringTag = require_shams2()(); - var has; - var $exec; - var isRegexMarker; - var badStringifier; - if (hasToStringTag) { - has = callBound("Object.prototype.hasOwnProperty"); - $exec = callBound("RegExp.prototype.exec"); - isRegexMarker = {}; - throwRegexMarker = function() { - throw isRegexMarker; - }; - badStringifier = { - toString: throwRegexMarker, - valueOf: throwRegexMarker - }; - if (typeof Symbol.toPrimitive === "symbol") { - badStringifier[Symbol.toPrimitive] = throwRegexMarker; - } - } - var throwRegexMarker; - var $toString = callBound("Object.prototype.toString"); - var gOPD = Object.getOwnPropertyDescriptor; - var regexClass = "[object RegExp]"; - module2.exports = hasToStringTag ? function isRegex(value) { - if (!value || typeof value !== "object") { - return false; - } - var descriptor = gOPD(value, "lastIndex"); - var hasLastIndexDataProperty = descriptor && has(descriptor, "value"); - if (!hasLastIndexDataProperty) { - return false; - } - try { - $exec(value, badStringifier); - } catch (e) { - return e === isRegexMarker; - } - } : function isRegex(value) { - if (!value || typeof value !== "object" && typeof value !== "function") { - return false; - } - return $toString(value) === regexClass; - }; - } -}); - -// node_modules/.pnpm/is-shared-array-buffer@1.0.3/node_modules/is-shared-array-buffer/index.js -var require_is_shared_array_buffer = __commonJS({ - "node_modules/.pnpm/is-shared-array-buffer@1.0.3/node_modules/is-shared-array-buffer/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var callBound = require_callBound(); - var $byteLength = callBound("SharedArrayBuffer.prototype.byteLength", true); - module2.exports = $byteLength ? function isSharedArrayBuffer(obj) { - if (!obj || typeof obj !== "object") { - return false; - } - try { - $byteLength(obj); - return true; - } catch (e) { - return false; - } - } : function isSharedArrayBuffer(obj) { - return false; - }; - } -}); - -// node_modules/.pnpm/is-number-object@1.0.7/node_modules/is-number-object/index.js -var require_is_number_object = __commonJS({ - "node_modules/.pnpm/is-number-object@1.0.7/node_modules/is-number-object/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var numToStr = Number.prototype.toString; - var tryNumberObject = function tryNumberObject2(value) { - try { - numToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var numClass = "[object Number]"; - var hasToStringTag = require_shams2()(); - module2.exports = function isNumberObject(value) { - if (typeof value === "number") { - return true; - } - if (typeof value !== "object") { - return false; - } - return hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass; - }; - } -}); - -// node_modules/.pnpm/is-boolean-object@1.1.2/node_modules/is-boolean-object/index.js -var require_is_boolean_object = __commonJS({ - "node_modules/.pnpm/is-boolean-object@1.1.2/node_modules/is-boolean-object/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var callBound = require_callBound(); - var $boolToStr = callBound("Boolean.prototype.toString"); - var $toString = callBound("Object.prototype.toString"); - var tryBooleanObject = function booleanBrandCheck(value) { - try { - $boolToStr(value); - return true; - } catch (e) { - return false; - } - }; - var boolClass = "[object Boolean]"; - var hasToStringTag = require_shams2()(); - module2.exports = function isBoolean(value) { - if (typeof value === "boolean") { - return true; - } - if (value === null || typeof value !== "object") { - return false; - } - return hasToStringTag && Symbol.toStringTag in value ? tryBooleanObject(value) : $toString(value) === boolClass; - }; - } -}); - -// node_modules/.pnpm/is-symbol@1.0.4/node_modules/is-symbol/index.js -var require_is_symbol = __commonJS({ - "node_modules/.pnpm/is-symbol@1.0.4/node_modules/is-symbol/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var toStr = Object.prototype.toString; - var hasSymbols = require_has_symbols()(); - if (hasSymbols) { - symToStr = Symbol.prototype.toString; - symStringRegex = /^Symbol\(.*\)$/; - isSymbolObject = function isRealSymbolObject(value) { - if (typeof value.valueOf() !== "symbol") { - return false; - } - return symStringRegex.test(symToStr.call(value)); - }; - module2.exports = function isSymbol(value) { - if (typeof value === "symbol") { - return true; - } - if (toStr.call(value) !== "[object Symbol]") { - return false; - } - try { - return isSymbolObject(value); - } catch (e) { - return false; - } - }; - } else { - module2.exports = function isSymbol(value) { - return false; - }; - } - var symToStr; - var symStringRegex; - var isSymbolObject; - } -}); - -// node_modules/.pnpm/has-bigints@1.0.2/node_modules/has-bigints/index.js -var require_has_bigints = __commonJS({ - "node_modules/.pnpm/has-bigints@1.0.2/node_modules/has-bigints/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var $BigInt = typeof BigInt !== "undefined" && BigInt; - module2.exports = function hasNativeBigInts() { - return typeof $BigInt === "function" && typeof BigInt === "function" && typeof $BigInt(42) === "bigint" && typeof BigInt(42) === "bigint"; - }; - } -}); - -// node_modules/.pnpm/is-bigint@1.0.4/node_modules/is-bigint/index.js -var require_is_bigint = __commonJS({ - "node_modules/.pnpm/is-bigint@1.0.4/node_modules/is-bigint/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var hasBigInts = require_has_bigints()(); - if (hasBigInts) { - bigIntValueOf = BigInt.prototype.valueOf; - tryBigInt = function tryBigIntObject(value) { - try { - bigIntValueOf.call(value); - return true; - } catch (e) { - } - return false; - }; - module2.exports = function isBigInt(value) { - if (value === null || typeof value === "undefined" || typeof value === "boolean" || typeof value === "string" || typeof value === "number" || typeof value === "symbol" || typeof value === "function") { - return false; - } - if (typeof value === "bigint") { - return true; - } - return tryBigInt(value); - }; - } else { - module2.exports = function isBigInt(value) { - return false; - }; - } - var bigIntValueOf; - var tryBigInt; - } -}); - -// node_modules/.pnpm/which-boxed-primitive@1.0.2/node_modules/which-boxed-primitive/index.js -var require_which_boxed_primitive = __commonJS({ - "node_modules/.pnpm/which-boxed-primitive@1.0.2/node_modules/which-boxed-primitive/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var isString = require_is_string(); - var isNumber = require_is_number_object(); - var isBoolean = require_is_boolean_object(); - var isSymbol = require_is_symbol(); - var isBigInt = require_is_bigint(); - module2.exports = function whichBoxedPrimitive(value) { - if (value == null || typeof value !== "object" && typeof value !== "function") { - return null; - } - if (isString(value)) { - return "String"; - } - if (isNumber(value)) { - return "Number"; - } - if (isBoolean(value)) { - return "Boolean"; - } - if (isSymbol(value)) { - return "Symbol"; - } - if (isBigInt(value)) { - return "BigInt"; - } - }; - } -}); - -// node_modules/.pnpm/is-weakmap@2.0.2/node_modules/is-weakmap/index.js -var require_is_weakmap = __commonJS({ - "node_modules/.pnpm/is-weakmap@2.0.2/node_modules/is-weakmap/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var $WeakMap = typeof WeakMap === "function" && WeakMap.prototype ? WeakMap : null; - var $WeakSet = typeof WeakSet === "function" && WeakSet.prototype ? WeakSet : null; - var exported; - if (!$WeakMap) { - exported = function isWeakMap(x) { - return false; - }; - } - var $mapHas = $WeakMap ? $WeakMap.prototype.has : null; - var $setHas = $WeakSet ? $WeakSet.prototype.has : null; - if (!exported && !$mapHas) { - exported = function isWeakMap(x) { - return false; - }; - } - module2.exports = exported || function isWeakMap(x) { - if (!x || typeof x !== "object") { - return false; - } - try { - $mapHas.call(x, $mapHas); - if ($setHas) { - try { - $setHas.call(x, $setHas); - } catch (e) { - return true; - } - } - return x instanceof $WeakMap; - } catch (e) { - } - return false; - }; - } -}); - -// node_modules/.pnpm/is-weakset@2.0.3/node_modules/is-weakset/index.js -var require_is_weakset = __commonJS({ - "node_modules/.pnpm/is-weakset@2.0.3/node_modules/is-weakset/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var GetIntrinsic = require_get_intrinsic(); - var callBound = require_callBound(); - var $WeakSet = GetIntrinsic("%WeakSet%", true); - var $setHas = callBound("WeakSet.prototype.has", true); - if ($setHas) { - $mapHas = callBound("WeakMap.prototype.has", true); - module2.exports = function isWeakSet(x) { - if (!x || typeof x !== "object") { - return false; - } - try { - $setHas(x, $setHas); - if ($mapHas) { - try { - $mapHas(x, $mapHas); - } catch (e) { - return true; - } - } - return x instanceof $WeakSet; - } catch (e) { - } - return false; - }; - } else { - module2.exports = function isWeakSet(x) { - return false; - }; - } - var $mapHas; - } -}); - -// node_modules/.pnpm/which-collection@1.0.2/node_modules/which-collection/index.js -var require_which_collection = __commonJS({ - "node_modules/.pnpm/which-collection@1.0.2/node_modules/which-collection/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var isMap = require_is_map(); - var isSet = require_is_set(); - var isWeakMap = require_is_weakmap(); - var isWeakSet = require_is_weakset(); - module2.exports = function whichCollection(value) { - if (value && typeof value === "object") { - if (isMap(value)) { - return "Map"; - } - if (isSet(value)) { - return "Set"; - } - if (isWeakMap(value)) { - return "WeakMap"; - } - if (isWeakSet(value)) { - return "WeakSet"; - } - } - return false; - }; - } -}); - -// node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js -var require_is_callable = __commonJS({ - "node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var fnToStr = Function.prototype.toString; - var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply; - var badArrayLike; - var isCallableMarker; - if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") { - try { - badArrayLike = Object.defineProperty({}, "length", { - get: function() { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - reflectApply(function() { - throw 42; - }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) { - reflectApply = null; - } - } - } else { - reflectApply = null; - } - var constructorRegex = /^\s*class\b/; - var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; - } - }; - var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { - return false; - } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var objectClass = "[object Object]"; - var fnClass = "[object Function]"; - var genClass = "[object GeneratorFunction]"; - var ddaClass = "[object HTMLAllCollection]"; - var ddaClass2 = "[object HTML document.all class]"; - var ddaClass3 = "[object HTMLCollection]"; - var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag; - var isIE68 = !(0 in [,]); - var isDDA = function isDocumentDotAll() { - return false; - }; - if (typeof document === "object") { - all = document.all; - if (toStr.call(all) === toStr.call(document.all)) { - isDDA = function isDocumentDotAll(value) { - if ((isIE68 || !value) && (typeof value === "undefined" || typeof value === "object")) { - try { - var str = toStr.call(value); - return (str === ddaClass || str === ddaClass2 || str === ddaClass3 || str === objectClass) && value("") == null; - } catch (e) { - } - } - return false; - }; - } - } - var all; - module2.exports = reflectApply ? function isCallable(value) { - if (isDDA(value)) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; - } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { - return false; - } - } - return !isES6ClassFn(value) && tryFunctionObject(value); - } : function isCallable(value) { - if (isDDA(value)) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; - } - if (hasToStringTag) { - return tryFunctionObject(value); - } - if (isES6ClassFn(value)) { - return false; - } - var strClass = toStr.call(value); - if (strClass !== fnClass && strClass !== genClass && !/^\[object HTML/.test(strClass)) { - return false; - } - return tryFunctionObject(value); - }; - } -}); - -// node_modules/.pnpm/for-each@0.3.3/node_modules/for-each/index.js -var require_for_each = __commonJS({ - "node_modules/.pnpm/for-each@0.3.3/node_modules/for-each/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var isCallable = require_is_callable(); - var toStr = Object.prototype.toString; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var forEachArray = function forEachArray2(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } - }; - var forEachString = function forEachString2(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } - }; - var forEachObject = function forEachObject2(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } - }; - var forEach2 = function forEach3(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError("iterator must be a function"); - } - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - if (toStr.call(list) === "[object Array]") { - forEachArray(list, iterator, receiver); - } else if (typeof list === "string") { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } - }; - module2.exports = forEach2; - } -}); - -// node_modules/.pnpm/possible-typed-array-names@1.0.0/node_modules/possible-typed-array-names/index.js -var require_possible_typed_array_names = __commonJS({ - "node_modules/.pnpm/possible-typed-array-names@1.0.0/node_modules/possible-typed-array-names/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - module2.exports = [ - "Float32Array", - "Float64Array", - "Int8Array", - "Int16Array", - "Int32Array", - "Uint8Array", - "Uint8ClampedArray", - "Uint16Array", - "Uint32Array", - "BigInt64Array", - "BigUint64Array" - ]; - } -}); - -// node_modules/.pnpm/available-typed-arrays@1.0.7/node_modules/available-typed-arrays/index.js -var require_available_typed_arrays = __commonJS({ - "node_modules/.pnpm/available-typed-arrays@1.0.7/node_modules/available-typed-arrays/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var possibleNames = require_possible_typed_array_names(); - var g = typeof globalThis === "undefined" ? global : globalThis; - module2.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === "function") { - out[out.length] = possibleNames[i]; - } - } - return out; - }; - } -}); - -// node_modules/.pnpm/which-typed-array@1.1.15/node_modules/which-typed-array/index.js -var require_which_typed_array = __commonJS({ - "node_modules/.pnpm/which-typed-array@1.1.15/node_modules/which-typed-array/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var forEach2 = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBind = require_call_bind(); - var callBound = require_callBound(); - var gOPD = require_gopd(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? global : globalThis; - var typedArrays = availableTypedArrays(); - var $slice = callBound("String.prototype.slice"); - var getPrototypeOf = Object.getPrototypeOf; - var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; - }; - var cache = { __proto__: null }; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach2(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - cache["$" + typedArray] = callBind(descriptor.get); - } - }); - } else { - forEach2(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - var fn = arr.slice || arr.set; - if (fn) { - cache["$" + typedArray] = callBind(fn); - } - }); - } - var tryTypedArrays = function tryAllTypedArrays(value) { - var found = false; - forEach2( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ - /** @type {any} */ - cache, - /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ - function(getter, typedArray) { - if (!found) { - try { - if ("$" + getter(value) === typedArray) { - found = $slice(typedArray, 1); - } - } catch (e) { - } - } - } - ); - return found; - }; - var trySlices = function tryAllSlices(value) { - var found = false; - forEach2( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ - /** @type {any} */ - cache, - /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ - function(getter, name) { - if (!found) { - try { - getter(value); - found = $slice(name, 1); - } catch (e) { - } - } - } - ); - return found; - }; - module2.exports = function whichTypedArray(value) { - if (!value || typeof value !== "object") { - return false; - } - if (!hasToStringTag) { - var tag2 = $slice($toString(value), 8, -1); - if ($indexOf(typedArrays, tag2) > -1) { - return tag2; - } - if (tag2 !== "Object") { - return false; - } - return trySlices(value); - } - if (!gOPD) { - return null; - } - return tryTypedArrays(value); - }; - } -}); - -// node_modules/.pnpm/array-buffer-byte-length@1.0.1/node_modules/array-buffer-byte-length/index.js -var require_array_buffer_byte_length = __commonJS({ - "node_modules/.pnpm/array-buffer-byte-length@1.0.1/node_modules/array-buffer-byte-length/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var callBound = require_callBound(); - var $byteLength = callBound("ArrayBuffer.prototype.byteLength", true); - var isArrayBuffer = require_is_array_buffer(); - module2.exports = function byteLength(ab) { - if (!isArrayBuffer(ab)) { - return NaN; - } - return $byteLength ? $byteLength(ab) : ab.byteLength; - }; - } -}); - -// node_modules/.pnpm/deep-equal@2.2.3/node_modules/deep-equal/index.js -var require_deep_equal = __commonJS({ - "node_modules/.pnpm/deep-equal@2.2.3/node_modules/deep-equal/index.js"(exports2, module2) { - "use strict"; - init_polyfill_buffer(); - var assign2 = require_object(); - var callBound = require_callBound(); - var flags = require_regexp_prototype(); - var GetIntrinsic = require_get_intrinsic(); - var getIterator3 = require_es_get_iterator(); - var getSideChannel = require_side_channel(); - var is = require_object_is(); - var isArguments = require_is_arguments(); - var isArray = require_isarray(); - var isArrayBuffer = require_is_array_buffer(); - var isDate = require_is_date_object(); - var isRegex = require_is_regex(); - var isSharedArrayBuffer = require_is_shared_array_buffer(); - var objectKeys = require_object_keys(); - var whichBoxedPrimitive = require_which_boxed_primitive(); - var whichCollection = require_which_collection(); - var whichTypedArray = require_which_typed_array(); - var byteLength = require_array_buffer_byte_length(); - var sabByteLength = callBound("SharedArrayBuffer.prototype.byteLength", true); - var $getTime = callBound("Date.prototype.getTime"); - var gPO = Object.getPrototypeOf; - var $objToString = callBound("Object.prototype.toString"); - var $Set = GetIntrinsic("%Set%", true); - var $mapHas = callBound("Map.prototype.has", true); - var $mapGet = callBound("Map.prototype.get", true); - var $mapSize = callBound("Map.prototype.size", true); - var $setAdd = callBound("Set.prototype.add", true); - var $setDelete = callBound("Set.prototype.delete", true); - var $setHas = callBound("Set.prototype.has", true); - var $setSize = callBound("Set.prototype.size", true); - function setHasEqualElement(set, val1, opts, channel) { - var i = getIterator3(set); - var result; - while ((result = i.next()) && !result.done) { - if (internalDeepEqual(val1, result.value, opts, channel)) { - $setDelete(set, result.value); - return true; - } - } - return false; - } - function findLooseMatchingPrimitives(prim) { - if (typeof prim === "undefined") { - return null; - } - if (typeof prim === "object") { - return void 0; - } - if (typeof prim === "symbol") { - return false; - } - if (typeof prim === "string" || typeof prim === "number") { - return +prim === +prim; - } - return true; - } - function mapMightHaveLoosePrim(a, b, prim, item, opts, channel) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) { - return altValue; - } - var curB = $mapGet(b, altValue); - var looseOpts = assign2({}, opts, { strict: false }); - if (typeof curB === "undefined" && !$mapHas(b, altValue) || !internalDeepEqual(item, curB, looseOpts, channel)) { - return false; - } - return !$mapHas(a, altValue) && internalDeepEqual(item, curB, looseOpts, channel); - } - function setMightHaveLoosePrim(a, b, prim) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) { - return altValue; - } - return $setHas(b, altValue) && !$setHas(a, altValue); - } - function mapHasEqualEntry(set, map, key1, item1, opts, channel) { - var i = getIterator3(set); - var result; - var key2; - while ((result = i.next()) && !result.done) { - key2 = result.value; - if ( - // eslint-disable-next-line no-use-before-define - internalDeepEqual(key1, key2, opts, channel) && internalDeepEqual(item1, $mapGet(map, key2), opts, channel) - ) { - $setDelete(set, key2); - return true; - } - } - return false; - } - function internalDeepEqual(actual, expected, options, channel) { - var opts = options || {}; - if (opts.strict ? is(actual, expected) : actual === expected) { - return true; - } - var actualBoxed = whichBoxedPrimitive(actual); - var expectedBoxed = whichBoxedPrimitive(expected); - if (actualBoxed !== expectedBoxed) { - return false; - } - if (!actual || !expected || typeof actual !== "object" && typeof expected !== "object") { - return opts.strict ? is(actual, expected) : actual == expected; - } - var hasActual = channel.has(actual); - var hasExpected = channel.has(expected); - var sentinel; - if (hasActual && hasExpected) { - if (channel.get(actual) === channel.get(expected)) { - return true; - } - } else { - sentinel = {}; - } - if (!hasActual) { - channel.set(actual, sentinel); - } - if (!hasExpected) { - channel.set(expected, sentinel); - } - return objEquiv(actual, expected, opts, channel); - } - function isBuffer(x) { - if (!x || typeof x !== "object" || typeof x.length !== "number") { - return false; - } - if (typeof x.copy !== "function" || typeof x.slice !== "function") { - return false; - } - if (x.length > 0 && typeof x[0] !== "number") { - return false; - } - return !!(x.constructor && x.constructor.isBuffer && x.constructor.isBuffer(x)); - } - function setEquiv(a, b, opts, channel) { - if ($setSize(a) !== $setSize(b)) { - return false; - } - var iA = getIterator3(a); - var iB = getIterator3(b); - var resultA; - var resultB; - var set; - while ((resultA = iA.next()) && !resultA.done) { - if (resultA.value && typeof resultA.value === "object") { - if (!set) { - set = new $Set(); - } - $setAdd(set, resultA.value); - } else if (!$setHas(b, resultA.value)) { - if (opts.strict) { - return false; - } - if (!setMightHaveLoosePrim(a, b, resultA.value)) { - return false; - } - if (!set) { - set = new $Set(); - } - $setAdd(set, resultA.value); - } - } - if (set) { - while ((resultB = iB.next()) && !resultB.done) { - if (resultB.value && typeof resultB.value === "object") { - if (!setHasEqualElement(set, resultB.value, opts.strict, channel)) { - return false; - } - } else if (!opts.strict && !$setHas(a, resultB.value) && !setHasEqualElement(set, resultB.value, opts.strict, channel)) { - return false; - } - } - return $setSize(set) === 0; - } - return true; - } - function mapEquiv(a, b, opts, channel) { - if ($mapSize(a) !== $mapSize(b)) { - return false; - } - var iA = getIterator3(a); - var iB = getIterator3(b); - var resultA; - var resultB; - var set; - var key2; - var item1; - var item2; - while ((resultA = iA.next()) && !resultA.done) { - key2 = resultA.value[0]; - item1 = resultA.value[1]; - if (key2 && typeof key2 === "object") { - if (!set) { - set = new $Set(); - } - $setAdd(set, key2); - } else { - item2 = $mapGet(b, key2); - if (typeof item2 === "undefined" && !$mapHas(b, key2) || !internalDeepEqual(item1, item2, opts, channel)) { - if (opts.strict) { - return false; - } - if (!mapMightHaveLoosePrim(a, b, key2, item1, opts, channel)) { - return false; - } - if (!set) { - set = new $Set(); - } - $setAdd(set, key2); - } - } - } - if (set) { - while ((resultB = iB.next()) && !resultB.done) { - key2 = resultB.value[0]; - item2 = resultB.value[1]; - if (key2 && typeof key2 === "object") { - if (!mapHasEqualEntry(set, a, key2, item2, opts, channel)) { - return false; - } - } else if (!opts.strict && (!a.has(key2) || !internalDeepEqual($mapGet(a, key2), item2, opts, channel)) && !mapHasEqualEntry(set, a, key2, item2, assign2({}, opts, { strict: false }), channel)) { - return false; - } - } - return $setSize(set) === 0; - } - return true; - } - function objEquiv(a, b, opts, channel) { - var i, key2; - if (typeof a !== typeof b) { - return false; - } - if (a == null || b == null) { - return false; - } - if ($objToString(a) !== $objToString(b)) { - return false; - } - if (isArguments(a) !== isArguments(b)) { - return false; - } - var aIsArray = isArray(a); - var bIsArray = isArray(b); - if (aIsArray !== bIsArray) { - return false; - } - var aIsError = a instanceof Error; - var bIsError = b instanceof Error; - if (aIsError !== bIsError) { - return false; - } - if (aIsError || bIsError) { - if (a.name !== b.name || a.message !== b.message) { - return false; - } - } - var aIsRegex = isRegex(a); - var bIsRegex = isRegex(b); - if (aIsRegex !== bIsRegex) { - return false; - } - if ((aIsRegex || bIsRegex) && (a.source !== b.source || flags(a) !== flags(b))) { - return false; - } - var aIsDate = isDate(a); - var bIsDate = isDate(b); - if (aIsDate !== bIsDate) { - return false; - } - if (aIsDate || bIsDate) { - if ($getTime(a) !== $getTime(b)) { - return false; - } - } - if (opts.strict && gPO && gPO(a) !== gPO(b)) { - return false; - } - var aWhich = whichTypedArray(a); - var bWhich = whichTypedArray(b); - if (aWhich !== bWhich) { - return false; - } - if (aWhich || bWhich) { - if (a.length !== b.length) { - return false; - } - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - return true; - } - var aIsBuffer = isBuffer(a); - var bIsBuffer = isBuffer(b); - if (aIsBuffer !== bIsBuffer) { - return false; - } - if (aIsBuffer || bIsBuffer) { - if (a.length !== b.length) { - return false; - } - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - return true; - } - var aIsArrayBuffer = isArrayBuffer(a); - var bIsArrayBuffer = isArrayBuffer(b); - if (aIsArrayBuffer !== bIsArrayBuffer) { - return false; - } - if (aIsArrayBuffer || bIsArrayBuffer) { - if (byteLength(a) !== byteLength(b)) { - return false; - } - return typeof Uint8Array === "function" && internalDeepEqual(new Uint8Array(a), new Uint8Array(b), opts, channel); - } - var aIsSAB = isSharedArrayBuffer(a); - var bIsSAB = isSharedArrayBuffer(b); - if (aIsSAB !== bIsSAB) { - return false; - } - if (aIsSAB || bIsSAB) { - if (sabByteLength(a) !== sabByteLength(b)) { - return false; - } - return typeof Uint8Array === "function" && internalDeepEqual(new Uint8Array(a), new Uint8Array(b), opts, channel); - } - if (typeof a !== typeof b) { - return false; - } - var ka = objectKeys(a); - var kb = objectKeys(b); - if (ka.length !== kb.length) { - return false; - } - ka.sort(); - kb.sort(); - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) { - return false; - } - } - for (i = ka.length - 1; i >= 0; i--) { - key2 = ka[i]; - if (!internalDeepEqual(a[key2], b[key2], opts, channel)) { - return false; - } - } - var aCollection = whichCollection(a); - var bCollection = whichCollection(b); - if (aCollection !== bCollection) { - return false; - } - if (aCollection === "Set" || bCollection === "Set") { - return setEquiv(a, b, opts, channel); - } - if (aCollection === "Map") { - return mapEquiv(a, b, opts, channel); - } - return true; - } - module2.exports = function deepEqual2(a, b, opts) { - return internalDeepEqual(a, b, opts, getSideChannel()); - }; - } -}); - -// node_modules/.pnpm/js-sha256@0.9.0/node_modules/js-sha256/src/sha256.js -var require_sha256 = __commonJS({ - "node_modules/.pnpm/js-sha256@0.9.0/node_modules/js-sha256/src/sha256.js"(exports, module) { - init_polyfill_buffer(); - (function() { - "use strict"; - var ERROR = "input is invalid type"; - var WINDOW = typeof window === "object"; - var root = WINDOW ? window : {}; - if (root.JS_SHA256_NO_WINDOW) { - WINDOW = false; - } - var WEB_WORKER = !WINDOW && typeof self === "object"; - var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node; - if (NODE_JS) { - root = global; - } else if (WEB_WORKER) { - root = self; - } - var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && typeof module === "object" && module.exports; - var AMD = typeof define === "function" && define.amd; - var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined"; - var HEX_CHARS = "0123456789abcdef".split(""); - var EXTRA = [-2147483648, 8388608, 32768, 128]; - var SHIFT = [24, 16, 8, 0]; - var K = [ - 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 - ]; - var OUTPUT_TYPES = ["hex", "array", "digest", "arrayBuffer"]; - var blocks = []; - if (root.JS_SHA256_NO_NODE_JS || !Array.isArray) { - Array.isArray = function(obj) { - return Object.prototype.toString.call(obj) === "[object Array]"; - }; - } - if (ARRAY_BUFFER && (root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { - ArrayBuffer.isView = function(obj) { - return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer; - }; - } - var createOutputMethod = function(outputType, is2242) { - return function(message) { - return new Sha256(is2242, true).update(message)[outputType](); - }; - }; - var createMethod = function(is2242) { - var method2 = createOutputMethod("hex", is2242); - if (NODE_JS) { - method2 = nodeWrap(method2, is2242); - } - method2.create = function() { - return new Sha256(is2242); - }; - method2.update = function(message) { - return method2.create().update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method2[type] = createOutputMethod(type, is2242); - } - return method2; - }; - var nodeWrap = function(method, is224) { - var crypto = eval("require('crypto')"); - var Buffer = eval("require('buffer').Buffer"); - var algorithm = is224 ? "sha224" : "sha256"; - var nodeMethod = function(message) { - if (typeof message === "string") { - return crypto.createHash(algorithm).update(message, "utf8").digest("hex"); - } else { - if (message === null || message === void 0) { - throw new Error(ERROR); - } else if (message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } - } - if (Array.isArray(message) || ArrayBuffer.isView(message) || message.constructor === Buffer) { - return crypto.createHash(algorithm).update(new Buffer(message)).digest("hex"); - } else { - return method(message); - } - }; - return nodeMethod; - }; - var createHmacOutputMethod = function(outputType, is2242) { - return function(key2, message) { - return new HmacSha256(key2, is2242, true).update(message)[outputType](); - }; - }; - var createHmacMethod = function(is2242) { - var method2 = createHmacOutputMethod("hex", is2242); - method2.create = function(key2) { - return new HmacSha256(key2, is2242); - }; - method2.update = function(key2, message) { - return method2.create(key2).update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method2[type] = createHmacOutputMethod(type, is2242); - } - return method2; - }; - function Sha256(is2242, sharedMemory) { - if (sharedMemory) { - blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; - this.blocks = blocks; - } else { - this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - } - if (is2242) { - this.h0 = 3238371032; - this.h1 = 914150663; - this.h2 = 812702999; - this.h3 = 4144912697; - this.h4 = 4290775857; - this.h5 = 1750603025; - this.h6 = 1694076839; - this.h7 = 3204075428; - } else { - this.h0 = 1779033703; - this.h1 = 3144134277; - this.h2 = 1013904242; - this.h3 = 2773480762; - this.h4 = 1359893119; - this.h5 = 2600822924; - this.h6 = 528734635; - this.h7 = 1541459225; - } - this.block = this.start = this.bytes = this.hBytes = 0; - this.finalized = this.hashed = false; - this.first = true; - this.is224 = is2242; - } - Sha256.prototype.update = function(message) { - if (this.finalized) { - return; - } - var notString, type = typeof message; - if (type !== "string") { - if (type === "object") { - if (message === null) { - throw new Error(ERROR); - } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } else if (!Array.isArray(message)) { - if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { - throw new Error(ERROR); - } - } - } else { - throw new Error(ERROR); - } - notString = true; - } - var code, index2 = 0, i, length = message.length, blocks2 = this.blocks; - while (index2 < length) { - if (this.hashed) { - this.hashed = false; - blocks2[0] = this.block; - blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0; - } - if (notString) { - for (i = this.start; index2 < length && i < 64; ++index2) { - blocks2[i >> 2] |= message[index2] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index2 < length && i < 64; ++index2) { - code = message.charCodeAt(index2); - if (code < 128) { - blocks2[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 2048) { - blocks2[i >> 2] |= (192 | code >> 6) << SHIFT[i++ & 3]; - blocks2[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3]; - } else if (code < 55296 || code >= 57344) { - blocks2[i >> 2] |= (224 | code >> 12) << SHIFT[i++ & 3]; - blocks2[i >> 2] |= (128 | code >> 6 & 63) << SHIFT[i++ & 3]; - blocks2[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3]; - } else { - code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index2) & 1023); - blocks2[i >> 2] |= (240 | code >> 18) << SHIFT[i++ & 3]; - blocks2[i >> 2] |= (128 | code >> 12 & 63) << SHIFT[i++ & 3]; - blocks2[i >> 2] |= (128 | code >> 6 & 63) << SHIFT[i++ & 3]; - blocks2[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - this.bytes += i - this.start; - if (i >= 64) { - this.block = blocks2[16]; - this.start = i - 64; - this.hash(); - this.hashed = true; - } else { - this.start = i; - } - } - if (this.bytes > 4294967295) { - this.hBytes += this.bytes / 4294967296 << 0; - this.bytes = this.bytes % 4294967296; - } - return this; - }; - Sha256.prototype.finalize = function() { - if (this.finalized) { - return; - } - this.finalized = true; - var blocks2 = this.blocks, i = this.lastByteIndex; - blocks2[16] = this.block; - blocks2[i >> 2] |= EXTRA[i & 3]; - this.block = blocks2[16]; - if (i >= 56) { - if (!this.hashed) { - this.hash(); - } - blocks2[0] = this.block; - blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0; - } - blocks2[14] = this.hBytes << 3 | this.bytes >>> 29; - blocks2[15] = this.bytes << 3; - this.hash(); - }; - Sha256.prototype.hash = function() { - var a = this.h0, b = this.h1, c = this.h2, d = this.h3, e = this.h4, f = this.h5, g = this.h6, h = this.h7, blocks2 = this.blocks, j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc; - for (j = 16; j < 64; ++j) { - t1 = blocks2[j - 15]; - s0 = (t1 >>> 7 | t1 << 25) ^ (t1 >>> 18 | t1 << 14) ^ t1 >>> 3; - t1 = blocks2[j - 2]; - s1 = (t1 >>> 17 | t1 << 15) ^ (t1 >>> 19 | t1 << 13) ^ t1 >>> 10; - blocks2[j] = blocks2[j - 16] + s0 + blocks2[j - 7] + s1 << 0; - } - bc = b & c; - for (j = 0; j < 64; j += 4) { - if (this.first) { - if (this.is224) { - ab = 300032; - t1 = blocks2[0] - 1413257819; - h = t1 - 150054599 << 0; - d = t1 + 24177077 << 0; - } else { - ab = 704751109; - t1 = blocks2[0] - 210244248; - h = t1 - 1521486534 << 0; - d = t1 + 143694565 << 0; - } - this.first = false; - } else { - s0 = (a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10); - s1 = (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7); - ab = a & b; - maj = ab ^ a & c ^ bc; - ch = e & f ^ ~e & g; - t1 = h + s1 + ch + K[j] + blocks2[j]; - t2 = s0 + maj; - h = d + t1 << 0; - d = t1 + t2 << 0; - } - s0 = (d >>> 2 | d << 30) ^ (d >>> 13 | d << 19) ^ (d >>> 22 | d << 10); - s1 = (h >>> 6 | h << 26) ^ (h >>> 11 | h << 21) ^ (h >>> 25 | h << 7); - da = d & a; - maj = da ^ d & b ^ ab; - ch = h & e ^ ~h & f; - t1 = g + s1 + ch + K[j + 1] + blocks2[j + 1]; - t2 = s0 + maj; - g = c + t1 << 0; - c = t1 + t2 << 0; - s0 = (c >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10); - s1 = (g >>> 6 | g << 26) ^ (g >>> 11 | g << 21) ^ (g >>> 25 | g << 7); - cd = c & d; - maj = cd ^ c & a ^ da; - ch = g & h ^ ~g & e; - t1 = f + s1 + ch + K[j + 2] + blocks2[j + 2]; - t2 = s0 + maj; - f = b + t1 << 0; - b = t1 + t2 << 0; - s0 = (b >>> 2 | b << 30) ^ (b >>> 13 | b << 19) ^ (b >>> 22 | b << 10); - s1 = (f >>> 6 | f << 26) ^ (f >>> 11 | f << 21) ^ (f >>> 25 | f << 7); - bc = b & c; - maj = bc ^ b & d ^ cd; - ch = f & g ^ ~f & h; - t1 = e + s1 + ch + K[j + 3] + blocks2[j + 3]; - t2 = s0 + maj; - e = a + t1 << 0; - a = t1 + t2 << 0; - } - this.h0 = this.h0 + a << 0; - this.h1 = this.h1 + b << 0; - this.h2 = this.h2 + c << 0; - this.h3 = this.h3 + d << 0; - this.h4 = this.h4 + e << 0; - this.h5 = this.h5 + f << 0; - this.h6 = this.h6 + g << 0; - this.h7 = this.h7 + h << 0; - }; - Sha256.prototype.hex = function() { - this.finalize(); - var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7; - var hex = HEX_CHARS[h0 >> 28 & 15] + HEX_CHARS[h0 >> 24 & 15] + HEX_CHARS[h0 >> 20 & 15] + HEX_CHARS[h0 >> 16 & 15] + HEX_CHARS[h0 >> 12 & 15] + HEX_CHARS[h0 >> 8 & 15] + HEX_CHARS[h0 >> 4 & 15] + HEX_CHARS[h0 & 15] + HEX_CHARS[h1 >> 28 & 15] + HEX_CHARS[h1 >> 24 & 15] + HEX_CHARS[h1 >> 20 & 15] + HEX_CHARS[h1 >> 16 & 15] + HEX_CHARS[h1 >> 12 & 15] + HEX_CHARS[h1 >> 8 & 15] + HEX_CHARS[h1 >> 4 & 15] + HEX_CHARS[h1 & 15] + HEX_CHARS[h2 >> 28 & 15] + HEX_CHARS[h2 >> 24 & 15] + HEX_CHARS[h2 >> 20 & 15] + HEX_CHARS[h2 >> 16 & 15] + HEX_CHARS[h2 >> 12 & 15] + HEX_CHARS[h2 >> 8 & 15] + HEX_CHARS[h2 >> 4 & 15] + HEX_CHARS[h2 & 15] + HEX_CHARS[h3 >> 28 & 15] + HEX_CHARS[h3 >> 24 & 15] + HEX_CHARS[h3 >> 20 & 15] + HEX_CHARS[h3 >> 16 & 15] + HEX_CHARS[h3 >> 12 & 15] + HEX_CHARS[h3 >> 8 & 15] + HEX_CHARS[h3 >> 4 & 15] + HEX_CHARS[h3 & 15] + HEX_CHARS[h4 >> 28 & 15] + HEX_CHARS[h4 >> 24 & 15] + HEX_CHARS[h4 >> 20 & 15] + HEX_CHARS[h4 >> 16 & 15] + HEX_CHARS[h4 >> 12 & 15] + HEX_CHARS[h4 >> 8 & 15] + HEX_CHARS[h4 >> 4 & 15] + HEX_CHARS[h4 & 15] + HEX_CHARS[h5 >> 28 & 15] + HEX_CHARS[h5 >> 24 & 15] + HEX_CHARS[h5 >> 20 & 15] + HEX_CHARS[h5 >> 16 & 15] + HEX_CHARS[h5 >> 12 & 15] + HEX_CHARS[h5 >> 8 & 15] + HEX_CHARS[h5 >> 4 & 15] + HEX_CHARS[h5 & 15] + HEX_CHARS[h6 >> 28 & 15] + HEX_CHARS[h6 >> 24 & 15] + HEX_CHARS[h6 >> 20 & 15] + HEX_CHARS[h6 >> 16 & 15] + HEX_CHARS[h6 >> 12 & 15] + HEX_CHARS[h6 >> 8 & 15] + HEX_CHARS[h6 >> 4 & 15] + HEX_CHARS[h6 & 15]; - if (!this.is224) { - hex += HEX_CHARS[h7 >> 28 & 15] + HEX_CHARS[h7 >> 24 & 15] + HEX_CHARS[h7 >> 20 & 15] + HEX_CHARS[h7 >> 16 & 15] + HEX_CHARS[h7 >> 12 & 15] + HEX_CHARS[h7 >> 8 & 15] + HEX_CHARS[h7 >> 4 & 15] + HEX_CHARS[h7 & 15]; - } - return hex; - }; - Sha256.prototype.toString = Sha256.prototype.hex; - Sha256.prototype.digest = function() { - this.finalize(); - var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7; - var arr = [ - h0 >> 24 & 255, - h0 >> 16 & 255, - h0 >> 8 & 255, - h0 & 255, - h1 >> 24 & 255, - h1 >> 16 & 255, - h1 >> 8 & 255, - h1 & 255, - h2 >> 24 & 255, - h2 >> 16 & 255, - h2 >> 8 & 255, - h2 & 255, - h3 >> 24 & 255, - h3 >> 16 & 255, - h3 >> 8 & 255, - h3 & 255, - h4 >> 24 & 255, - h4 >> 16 & 255, - h4 >> 8 & 255, - h4 & 255, - h5 >> 24 & 255, - h5 >> 16 & 255, - h5 >> 8 & 255, - h5 & 255, - h6 >> 24 & 255, - h6 >> 16 & 255, - h6 >> 8 & 255, - h6 & 255 - ]; - if (!this.is224) { - arr.push(h7 >> 24 & 255, h7 >> 16 & 255, h7 >> 8 & 255, h7 & 255); - } - return arr; - }; - Sha256.prototype.array = Sha256.prototype.digest; - Sha256.prototype.arrayBuffer = function() { - this.finalize(); - var buffer2 = new ArrayBuffer(this.is224 ? 28 : 32); - var dataView = new DataView(buffer2); - dataView.setUint32(0, this.h0); - dataView.setUint32(4, this.h1); - dataView.setUint32(8, this.h2); - dataView.setUint32(12, this.h3); - dataView.setUint32(16, this.h4); - dataView.setUint32(20, this.h5); - dataView.setUint32(24, this.h6); - if (!this.is224) { - dataView.setUint32(28, this.h7); - } - return buffer2; - }; - function HmacSha256(key2, is2242, sharedMemory) { - var i, type = typeof key2; - if (type === "string") { - var bytes = [], length = key2.length, index2 = 0, code; - for (i = 0; i < length; ++i) { - code = key2.charCodeAt(i); - if (code < 128) { - bytes[index2++] = code; - } else if (code < 2048) { - bytes[index2++] = 192 | code >> 6; - bytes[index2++] = 128 | code & 63; - } else if (code < 55296 || code >= 57344) { - bytes[index2++] = 224 | code >> 12; - bytes[index2++] = 128 | code >> 6 & 63; - bytes[index2++] = 128 | code & 63; - } else { - code = 65536 + ((code & 1023) << 10 | key2.charCodeAt(++i) & 1023); - bytes[index2++] = 240 | code >> 18; - bytes[index2++] = 128 | code >> 12 & 63; - bytes[index2++] = 128 | code >> 6 & 63; - bytes[index2++] = 128 | code & 63; - } - } - key2 = bytes; - } else { - if (type === "object") { - if (key2 === null) { - throw new Error(ERROR); - } else if (ARRAY_BUFFER && key2.constructor === ArrayBuffer) { - key2 = new Uint8Array(key2); - } else if (!Array.isArray(key2)) { - if (!ARRAY_BUFFER || !ArrayBuffer.isView(key2)) { - throw new Error(ERROR); - } - } - } else { - throw new Error(ERROR); - } - } - if (key2.length > 64) { - key2 = new Sha256(is2242, true).update(key2).array(); - } - var oKeyPad = [], iKeyPad = []; - for (i = 0; i < 64; ++i) { - var b = key2[i] || 0; - oKeyPad[i] = 92 ^ b; - iKeyPad[i] = 54 ^ b; - } - Sha256.call(this, is2242, sharedMemory); - this.update(iKeyPad); - this.oKeyPad = oKeyPad; - this.inner = true; - this.sharedMemory = sharedMemory; - } - HmacSha256.prototype = new Sha256(); - HmacSha256.prototype.finalize = function() { - Sha256.prototype.finalize.call(this); - if (this.inner) { - this.inner = false; - var innerHash = this.array(); - Sha256.call(this, this.is224, this.sharedMemory); - this.update(this.oKeyPad); - this.update(innerHash); - Sha256.prototype.finalize.call(this); - } - }; - var exports = createMethod(); - exports.sha256 = exports; - exports.sha224 = createMethod(true); - exports.sha256.hmac = createHmacMethod(); - exports.sha224.hmac = createHmacMethod(true); - if (COMMON_JS) { - module.exports = exports; - } else { - root.sha256 = exports.sha256; - root.sha224 = exports.sha224; - if (AMD) { - define(function() { - return exports; - }); - } - } - })(); - } -}); - -// node_modules/.pnpm/hogan.js@3.0.2/node_modules/hogan.js/lib/compiler.js -var require_compiler = __commonJS({ - "node_modules/.pnpm/hogan.js@3.0.2/node_modules/hogan.js/lib/compiler.js"(exports2) { - init_polyfill_buffer(); - (function(Hogan4) { - var rIsWhitespace = /\S/, rQuot = /\"/g, rNewline = /\n/g, rCr = /\r/g, rSlash = /\\/g, rLineSep = /\u2028/, rParagraphSep = /\u2029/; - Hogan4.tags = { - "#": 1, - "^": 2, - "<": 3, - "$": 4, - "/": 5, - "!": 6, - ">": 7, - "=": 8, - "_v": 9, - "{": 10, - "&": 11, - "_t": 12 - }; - Hogan4.scan = function scan(text2, delimiters) { - var len = text2.length, IN_TEXT = 0, IN_TAG_TYPE = 1, IN_TAG = 2, state = IN_TEXT, tagType = null, tag2 = null, buf = "", tokens = [], seenTag = false, i = 0, lineStart = 0, otag = "{{", ctag = "}}"; - function addBuf() { - if (buf.length > 0) { - tokens.push({ tag: "_t", text: new String(buf) }); - buf = ""; - } - } - function lineIsWhitespace() { - var isAllWhitespace = true; - for (var j = lineStart; j < tokens.length; j++) { - isAllWhitespace = Hogan4.tags[tokens[j].tag] < Hogan4.tags["_v"] || tokens[j].tag == "_t" && tokens[j].text.match(rIsWhitespace) === null; - if (!isAllWhitespace) { - return false; - } - } - return isAllWhitespace; - } - function filterLine(haveSeenTag, noNewLine) { - addBuf(); - if (haveSeenTag && lineIsWhitespace()) { - for (var j = lineStart, next; j < tokens.length; j++) { - if (tokens[j].text) { - if ((next = tokens[j + 1]) && next.tag == ">") { - next.indent = tokens[j].text.toString(); - } - tokens.splice(j, 1); - } - } - } else if (!noNewLine) { - tokens.push({ tag: "\n" }); - } - seenTag = false; - lineStart = tokens.length; - } - function changeDelimiters(text3, index2) { - var close = "=" + ctag, closeIndex = text3.indexOf(close, index2), delimiters2 = trim( - text3.substring(text3.indexOf("=", index2) + 1, closeIndex) - ).split(" "); - otag = delimiters2[0]; - ctag = delimiters2[delimiters2.length - 1]; - return closeIndex + close.length - 1; - } - if (delimiters) { - delimiters = delimiters.split(" "); - otag = delimiters[0]; - ctag = delimiters[1]; - } - for (i = 0; i < len; i++) { - if (state == IN_TEXT) { - if (tagChange(otag, text2, i)) { - --i; - addBuf(); - state = IN_TAG_TYPE; - } else { - if (text2.charAt(i) == "\n") { - filterLine(seenTag); - } else { - buf += text2.charAt(i); - } - } - } else if (state == IN_TAG_TYPE) { - i += otag.length - 1; - tag2 = Hogan4.tags[text2.charAt(i + 1)]; - tagType = tag2 ? text2.charAt(i + 1) : "_v"; - if (tagType == "=") { - i = changeDelimiters(text2, i); - state = IN_TEXT; - } else { - if (tag2) { - i++; - } - state = IN_TAG; - } - seenTag = i; - } else { - if (tagChange(ctag, text2, i)) { - tokens.push({ - tag: tagType, - n: trim(buf), - otag, - ctag, - i: tagType == "/" ? seenTag - otag.length : i + ctag.length - }); - buf = ""; - i += ctag.length - 1; - state = IN_TEXT; - if (tagType == "{") { - if (ctag == "}}") { - i++; - } else { - cleanTripleStache(tokens[tokens.length - 1]); - } - } - } else { - buf += text2.charAt(i); - } - } - } - filterLine(seenTag, true); - return tokens; - }; - function cleanTripleStache(token) { - if (token.n.substr(token.n.length - 1) === "}") { - token.n = token.n.substring(0, token.n.length - 1); - } - } - function trim(s) { - if (s.trim) { - return s.trim(); - } - return s.replace(/^\s*|\s*$/g, ""); - } - function tagChange(tag2, text2, index2) { - if (text2.charAt(index2) != tag2.charAt(0)) { - return false; - } - for (var i = 1, l = tag2.length; i < l; i++) { - if (text2.charAt(index2 + i) != tag2.charAt(i)) { - return false; - } - } - return true; - } - var allowedInSuper = { "_t": true, "\n": true, "$": true, "/": true }; - function buildTree(tokens, kind, stack, customTags) { - var instructions = [], opener = null, tail = null, token = null; - tail = stack[stack.length - 1]; - while (tokens.length > 0) { - token = tokens.shift(); - if (tail && tail.tag == "<" && !(token.tag in allowedInSuper)) { - throw new Error("Illegal content in < super tag."); - } - if (Hogan4.tags[token.tag] <= Hogan4.tags["$"] || isOpener(token, customTags)) { - stack.push(token); - token.nodes = buildTree(tokens, token.tag, stack, customTags); - } else if (token.tag == "/") { - if (stack.length === 0) { - throw new Error("Closing tag without opener: /" + token.n); - } - opener = stack.pop(); - if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) { - throw new Error("Nesting error: " + opener.n + " vs. " + token.n); - } - opener.end = token.i; - return instructions; - } else if (token.tag == "\n") { - token.last = tokens.length == 0 || tokens[0].tag == "\n"; - } - instructions.push(token); - } - if (stack.length > 0) { - throw new Error("missing closing tag: " + stack.pop().n); - } - return instructions; - } - function isOpener(token, tags) { - for (var i = 0, l = tags.length; i < l; i++) { - if (tags[i].o == token.n) { - token.tag = "#"; - return true; - } - } - } - function isCloser(close, open, tags) { - for (var i = 0, l = tags.length; i < l; i++) { - if (tags[i].c == close && tags[i].o == open) { - return true; - } - } - } - function stringifySubstitutions(obj) { - var items = []; - for (var key2 in obj) { - items.push('"' + esc(key2) + '": function(c,p,t,i) {' + obj[key2] + "}"); - } - return "{ " + items.join(",") + " }"; - } - function stringifyPartials(codeObj) { - var partials = []; - for (var key2 in codeObj.partials) { - partials.push('"' + esc(key2) + '":{name:"' + esc(codeObj.partials[key2].name) + '", ' + stringifyPartials(codeObj.partials[key2]) + "}"); - } - return "partials: {" + partials.join(",") + "}, subs: " + stringifySubstitutions(codeObj.subs); - } - Hogan4.stringify = function(codeObj, text2, options) { - return "{code: function (c,p,i) { " + Hogan4.wrapMain(codeObj.code) + " }," + stringifyPartials(codeObj) + "}"; - }; - var serialNo = 0; - Hogan4.generate = function(tree, text2, options) { - serialNo = 0; - var context = { code: "", subs: {}, partials: {} }; - Hogan4.walk(tree, context); - if (options.asString) { - return this.stringify(context, text2, options); - } - return this.makeTemplate(context, text2, options); - }; - Hogan4.wrapMain = function(code) { - return 'var t=this;t.b(i=i||"");' + code + "return t.fl();"; - }; - Hogan4.template = Hogan4.Template; - Hogan4.makeTemplate = function(codeObj, text2, options) { - var template = this.makePartials(codeObj); - template.code = new Function("c", "p", "i", this.wrapMain(codeObj.code)); - return new this.template(template, text2, this, options); - }; - Hogan4.makePartials = function(codeObj) { - var key2, template = { subs: {}, partials: codeObj.partials, name: codeObj.name }; - for (key2 in template.partials) { - template.partials[key2] = this.makePartials(template.partials[key2]); - } - for (key2 in codeObj.subs) { - template.subs[key2] = new Function("c", "p", "t", "i", codeObj.subs[key2]); - } - return template; - }; - function esc(s) { - return s.replace(rSlash, "\\\\").replace(rQuot, '\\"').replace(rNewline, "\\n").replace(rCr, "\\r").replace(rLineSep, "\\u2028").replace(rParagraphSep, "\\u2029"); - } - function chooseMethod(s) { - return ~s.indexOf(".") ? "d" : "f"; - } - function createPartial(node, context) { - var prefix = "<" + (context.prefix || ""); - var sym = prefix + node.n + serialNo++; - context.partials[sym] = { name: node.n, partials: {} }; - context.code += 't.b(t.rp("' + esc(sym) + '",c,p,"' + (node.indent || "") + '"));'; - return sym; - } - Hogan4.codegen = { - "#": function(node, context) { - context.code += "if(t.s(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),c,p,0,' + node.i + "," + node.end + ',"' + node.otag + " " + node.ctag + '")){t.rs(c,p,function(c,p,t){'; - Hogan4.walk(node.nodes, context); - context.code += "});c.pop();}"; - }, - "^": function(node, context) { - context.code += "if(!t.s(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),c,p,1,0,0,"")){'; - Hogan4.walk(node.nodes, context); - context.code += "};"; - }, - ">": createPartial, - "<": function(node, context) { - var ctx = { partials: {}, code: "", subs: {}, inPartial: true }; - Hogan4.walk(node.nodes, ctx); - var template = context.partials[createPartial(node, context)]; - template.subs = ctx.subs; - template.partials = ctx.partials; - }, - "$": function(node, context) { - var ctx = { subs: {}, code: "", partials: context.partials, prefix: node.n }; - Hogan4.walk(node.nodes, ctx); - context.subs[node.n] = ctx.code; - if (!context.inPartial) { - context.code += 't.sub("' + esc(node.n) + '",c,p,i);'; - } - }, - "\n": function(node, context) { - context.code += write('"\\n"' + (node.last ? "" : " + i")); - }, - "_v": function(node, context) { - context.code += "t.b(t.v(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));'; - }, - "_t": function(node, context) { - context.code += write('"' + esc(node.text) + '"'); - }, - "{": tripleStache, - "&": tripleStache - }; - function tripleStache(node, context) { - context.code += "t.b(t.t(t." + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));'; - } - function write(s) { - return "t.b(" + s + ");"; - } - Hogan4.walk = function(nodelist, context) { - var func; - for (var i = 0, l = nodelist.length; i < l; i++) { - func = Hogan4.codegen[nodelist[i].tag]; - func && func(nodelist[i], context); - } - return context; - }; - Hogan4.parse = function(tokens, text2, options) { - options = options || {}; - return buildTree(tokens, "", [], options.sectionTags || []); - }; - Hogan4.cache = {}; - Hogan4.cacheKey = function(text2, options) { - return [text2, !!options.asString, !!options.disableLambda, options.delimiters, !!options.modelGet].join("||"); - }; - Hogan4.compile = function(text2, options) { - options = options || {}; - var key2 = Hogan4.cacheKey(text2, options); - var template = this.cache[key2]; - if (template) { - var partials = template.partials; - for (var name in partials) { - delete partials[name].instance; - } - return template; - } - template = this.generate(this.parse(this.scan(text2, options.delimiters), text2, options), text2, options); - return this.cache[key2] = template; - }; - })(typeof exports2 !== "undefined" ? exports2 : Hogan); - } -}); - -// node_modules/.pnpm/hogan.js@3.0.2/node_modules/hogan.js/lib/template.js -var require_template = __commonJS({ - "node_modules/.pnpm/hogan.js@3.0.2/node_modules/hogan.js/lib/template.js"(exports2) { - init_polyfill_buffer(); - var Hogan4 = {}; - (function(Hogan5) { - Hogan5.Template = function(codeObj, text2, compiler, options) { - codeObj = codeObj || {}; - this.r = codeObj.code || this.r; - this.c = compiler; - this.options = options || {}; - this.text = text2 || ""; - this.partials = codeObj.partials || {}; - this.subs = codeObj.subs || {}; - this.buf = ""; - }; - Hogan5.Template.prototype = { - // render: replaced by generated code. - r: function(context, partials, indent2) { - return ""; - }, - // variable escaping - v: hoganEscape, - // triple stache - t: coerceToString, - render: function render(context, partials, indent2) { - return this.ri([context], partials || {}, indent2); - }, - // render internal -- a hook for overrides that catches partials too - ri: function(context, partials, indent2) { - return this.r(context, partials, indent2); - }, - // ensurePartial - ep: function(symbol, partials) { - var partial = this.partials[symbol]; - var template = partials[partial.name]; - if (partial.instance && partial.base == template) { - return partial.instance; - } - if (typeof template == "string") { - if (!this.c) { - throw new Error("No compiler available."); - } - template = this.c.compile(template, this.options); - } - if (!template) { - return null; - } - this.partials[symbol].base = template; - if (partial.subs) { - if (!partials.stackText) partials.stackText = {}; - for (key in partial.subs) { - if (!partials.stackText[key]) { - partials.stackText[key] = this.activeSub !== void 0 && partials.stackText[this.activeSub] ? partials.stackText[this.activeSub] : this.text; - } - } - template = createSpecializedPartial( - template, - partial.subs, - partial.partials, - this.stackSubs, - this.stackPartials, - partials.stackText - ); - } - this.partials[symbol].instance = template; - return template; - }, - // tries to find a partial in the current scope and render it - rp: function(symbol, context, partials, indent2) { - var partial = this.ep(symbol, partials); - if (!partial) { - return ""; - } - return partial.ri(context, partials, indent2); - }, - // render a section - rs: function(context, partials, section) { - var tail = context[context.length - 1]; - if (!isArray(tail)) { - section(context, partials, this); - return; - } - for (var i = 0; i < tail.length; i++) { - context.push(tail[i]); - section(context, partials, this); - context.pop(); - } - }, - // maybe start a section - s: function(val, ctx, partials, inverted, start, end, tags) { - var pass; - if (isArray(val) && val.length === 0) { - return false; - } - if (typeof val == "function") { - val = this.ms(val, ctx, partials, inverted, start, end, tags); - } - pass = !!val; - if (!inverted && pass && ctx) { - ctx.push(typeof val == "object" ? val : ctx[ctx.length - 1]); - } - return pass; - }, - // find values with dotted names - d: function(key2, ctx, partials, returnFound) { - var found, names = key2.split("."), val = this.f(names[0], ctx, partials, returnFound), doModelGet = this.options.modelGet, cx = null; - if (key2 === "." && isArray(ctx[ctx.length - 2])) { - val = ctx[ctx.length - 1]; - } else { - for (var i = 1; i < names.length; i++) { - found = findInScope(names[i], val, doModelGet); - if (found !== void 0) { - cx = val; - val = found; - } else { - val = ""; - } - } - } - if (returnFound && !val) { - return false; - } - if (!returnFound && typeof val == "function") { - ctx.push(cx); - val = this.mv(val, ctx, partials); - ctx.pop(); - } - return val; - }, - // find values with normal names - f: function(key2, ctx, partials, returnFound) { - var val = false, v = null, found = false, doModelGet = this.options.modelGet; - for (var i = ctx.length - 1; i >= 0; i--) { - v = ctx[i]; - val = findInScope(key2, v, doModelGet); - if (val !== void 0) { - found = true; - break; - } - } - if (!found) { - return returnFound ? false : ""; - } - if (!returnFound && typeof val == "function") { - val = this.mv(val, ctx, partials); - } - return val; - }, - // higher order templates - ls: function(func, cx, partials, text2, tags) { - var oldTags = this.options.delimiters; - this.options.delimiters = tags; - this.b(this.ct(coerceToString(func.call(cx, text2)), cx, partials)); - this.options.delimiters = oldTags; - return false; - }, - // compile text - ct: function(text2, cx, partials) { - if (this.options.disableLambda) { - throw new Error("Lambda features disabled."); - } - return this.c.compile(text2, this.options).render(cx, partials); - }, - // template result buffering - b: function(s) { - this.buf += s; - }, - fl: function() { - var r = this.buf; - this.buf = ""; - return r; - }, - // method replace section - ms: function(func, ctx, partials, inverted, start, end, tags) { - var textSource, cx = ctx[ctx.length - 1], result = func.call(cx); - if (typeof result == "function") { - if (inverted) { - return true; - } else { - textSource = this.activeSub && this.subsText && this.subsText[this.activeSub] ? this.subsText[this.activeSub] : this.text; - return this.ls(result, cx, partials, textSource.substring(start, end), tags); - } - } - return result; - }, - // method replace variable - mv: function(func, ctx, partials) { - var cx = ctx[ctx.length - 1]; - var result = func.call(cx); - if (typeof result == "function") { - return this.ct(coerceToString(result.call(cx)), cx, partials); - } - return result; - }, - sub: function(name, context, partials, indent2) { - var f = this.subs[name]; - if (f) { - this.activeSub = name; - f(context, partials, this, indent2); - this.activeSub = false; - } - } - }; - function findInScope(key2, scope, doModelGet) { - var val; - if (scope && typeof scope == "object") { - if (scope[key2] !== void 0) { - val = scope[key2]; - } else if (doModelGet && scope.get && typeof scope.get == "function") { - val = scope.get(key2); - } - } - return val; - } - function createSpecializedPartial(instance10, subs, partials, stackSubs, stackPartials, stackText) { - function PartialTemplate() { - } - ; - PartialTemplate.prototype = instance10; - function Substitutions() { - } - ; - Substitutions.prototype = instance10.subs; - var key2; - var partial = new PartialTemplate(); - partial.subs = new Substitutions(); - partial.subsText = {}; - partial.buf = ""; - stackSubs = stackSubs || {}; - partial.stackSubs = stackSubs; - partial.subsText = stackText; - for (key2 in subs) { - if (!stackSubs[key2]) stackSubs[key2] = subs[key2]; - } - for (key2 in stackSubs) { - partial.subs[key2] = stackSubs[key2]; - } - stackPartials = stackPartials || {}; - partial.stackPartials = stackPartials; - for (key2 in partials) { - if (!stackPartials[key2]) stackPartials[key2] = partials[key2]; - } - for (key2 in stackPartials) { - partial.partials[key2] = stackPartials[key2]; - } - return partial; - } - var rAmp = /&/g, rLt = //g, rApos = /\'/g, rQuot = /\"/g, hChars = /[&<>\"\']/; - function coerceToString(val) { - return String(val === null || val === void 0 ? "" : val); - } - function hoganEscape(str) { - str = coerceToString(str); - return hChars.test(str) ? str.replace(rAmp, "&").replace(rLt, "<").replace(rGt, ">").replace(rApos, "'").replace(rQuot, """) : str; - } - var isArray = Array.isArray || function(a) { - return Object.prototype.toString.call(a) === "[object Array]"; - }; - })(typeof exports2 !== "undefined" ? exports2 : Hogan4); - } -}); - -// node_modules/.pnpm/hogan.js@3.0.2/node_modules/hogan.js/lib/hogan.js -var require_hogan = __commonJS({ - "node_modules/.pnpm/hogan.js@3.0.2/node_modules/hogan.js/lib/hogan.js"(exports2, module2) { - init_polyfill_buffer(); - var Hogan4 = require_compiler(); - Hogan4.Template = require_template().Template; - Hogan4.template = Hogan4.Template; - module2.exports = Hogan4; - } -}); - -// node_modules/.pnpm/feather-icons@4.29.2/node_modules/feather-icons/dist/feather.js -var require_feather = __commonJS({ - "node_modules/.pnpm/feather-icons@4.29.2/node_modules/feather-icons/dist/feather.js"(exports2, module2) { - init_polyfill_buffer(); - (function webpackUniversalModuleDefinition(root2, factory) { - if (typeof exports2 === "object" && typeof module2 === "object") - module2.exports = factory(); - else if (typeof define === "function" && define.amd) - define([], factory); - else if (typeof exports2 === "object") - exports2["feather"] = factory(); - else - root2["feather"] = factory(); - })(typeof self !== "undefined" ? self : exports2, function() { - return ( - /******/ - function(modules) { - var installedModules = {}; - function __webpack_require__(moduleId) { - if (installedModules[moduleId]) { - return installedModules[moduleId].exports; - } - var module3 = installedModules[moduleId] = { - /******/ - i: moduleId, - /******/ - l: false, - /******/ - exports: {} - /******/ - }; - modules[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__); - module3.l = true; - return module3.exports; - } - __webpack_require__.m = modules; - __webpack_require__.c = installedModules; - __webpack_require__.d = function(exports3, name, getter) { - if (!__webpack_require__.o(exports3, name)) { - Object.defineProperty(exports3, name, { - /******/ - configurable: false, - /******/ - enumerable: true, - /******/ - get: getter - /******/ - }); - } - }; - __webpack_require__.r = function(exports3) { - Object.defineProperty(exports3, "__esModule", { value: true }); - }; - __webpack_require__.n = function(module3) { - var getter = module3 && module3.__esModule ? ( - /******/ - function getDefault() { - return module3["default"]; - } - ) : ( - /******/ - function getModuleExports() { - return module3; - } - ); - __webpack_require__.d(getter, "a", getter); - return getter; - }; - __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; - __webpack_require__.p = ""; - return __webpack_require__(__webpack_require__.s = 0); - }({ - /***/ - "./dist/icons.json": ( - /*!*************************!*\ - !*** ./dist/icons.json ***! - \*************************/ - /*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, align-center, align-justify, align-left, align-right, anchor, aperture, archive, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, award, bar-chart-2, bar-chart, battery-charging, battery, bell-off, bell, bluetooth, bold, book-open, book, bookmark, box, briefcase, calendar, camera-off, camera, cast, check-circle, check-square, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, chrome, circle, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-off, cloud-rain, cloud-snow, cloud, code, codepen, codesandbox, coffee, columns, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, cpu, credit-card, crop, crosshair, database, delete, disc, divide-circle, divide-square, divide, dollar-sign, download-cloud, download, dribbble, droplet, edit-2, edit-3, edit, external-link, eye-off, eye, facebook, fast-forward, feather, figma, file-minus, file-plus, file-text, file, film, filter, flag, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, globe, grid, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, info, instagram, italic, key, layers, layout, life-buoy, link-2, link, linkedin, list, loader, lock, log-in, log-out, mail, map-pin, map, maximize-2, maximize, meh, menu, message-circle, message-square, mic-off, mic, minimize-2, minimize, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, music, navigation-2, navigation, octagon, package, paperclip, pause-circle, pause, pen-tool, percent, phone-call, phone-forwarded, phone-incoming, phone-missed, phone-off, phone-outgoing, phone, pie-chart, play-circle, play, plus-circle, plus-square, plus, pocket, power, printer, radio, refresh-ccw, refresh-cw, repeat, rewind, rotate-ccw, rotate-cw, rss, save, scissors, search, send, server, settings, share-2, share, shield-off, shield, shopping-bag, shopping-cart, shuffle, sidebar, skip-back, skip-forward, slack, slash, sliders, smartphone, smile, speaker, square, star, stop-circle, sun, sunrise, sunset, table, tablet, tag, target, terminal, thermometer, thumbs-down, thumbs-up, toggle-left, toggle-right, tool, trash-2, trash, trello, trending-down, trending-up, triangle, truck, tv, twitch, twitter, type, umbrella, underline, unlock, upload-cloud, upload, user-check, user-minus, user-plus, user-x, user, users, video-off, video, voicemail, volume-1, volume-2, volume-x, volume, watch, wifi-off, wifi, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, zoom-in, zoom-out, default */ - /***/ - function(module3) { - module3.exports = { "activity": '', "airplay": '', "alert-circle": '', "alert-octagon": '', "alert-triangle": '', "align-center": '', "align-justify": '', "align-left": '', "align-right": '', "anchor": '', "aperture": '', "archive": '', "arrow-down-circle": '', "arrow-down-left": '', "arrow-down-right": '', "arrow-down": '', "arrow-left-circle": '', "arrow-left": '', "arrow-right-circle": '', "arrow-right": '', "arrow-up-circle": '', "arrow-up-left": '', "arrow-up-right": '', "arrow-up": '', "at-sign": '', "award": '', "bar-chart-2": '', "bar-chart": '', "battery-charging": '', "battery": '', "bell-off": '', "bell": '', "bluetooth": '', "bold": '', "book-open": '', "book": '', "bookmark": '', "box": '', "briefcase": '', "calendar": '', "camera-off": '', "camera": '', "cast": '', "check-circle": '', "check-square": '', "check": '', "chevron-down": '', "chevron-left": '', "chevron-right": '', "chevron-up": '', "chevrons-down": '', "chevrons-left": '', "chevrons-right": '', "chevrons-up": '', "chrome": '', "circle": '', "clipboard": '', "clock": '', "cloud-drizzle": '', "cloud-lightning": '', "cloud-off": '', "cloud-rain": '', "cloud-snow": '', "cloud": '', "code": '', "codepen": '', "codesandbox": '', "coffee": '', "columns": '', "command": '', "compass": '', "copy": '', "corner-down-left": '', "corner-down-right": '', "corner-left-down": '', "corner-left-up": '', "corner-right-down": '', "corner-right-up": '', "corner-up-left": '', "corner-up-right": '', "cpu": '', "credit-card": '', "crop": '', "crosshair": '', "database": '', "delete": '', "disc": '', "divide-circle": '', "divide-square": '', "divide": '', "dollar-sign": '', "download-cloud": '', "download": '', "dribbble": '', "droplet": '', "edit-2": '', "edit-3": '', "edit": '', "external-link": '', "eye-off": '', "eye": '', "facebook": '', "fast-forward": '', "feather": '', "figma": '', "file-minus": '', "file-plus": '', "file-text": '', "file": '', "film": '', "filter": '', "flag": '', "folder-minus": '', "folder-plus": '', "folder": '', "framer": '', "frown": '', "gift": '', "git-branch": '', "git-commit": '', "git-merge": '', "git-pull-request": '', "github": '', "gitlab": '', "globe": '', "grid": '', "hard-drive": '', "hash": '', "headphones": '', "heart": '', "help-circle": '', "hexagon": '', "home": '', "image": '', "inbox": '', "info": '', "instagram": '', "italic": '', "key": '', "layers": '', "layout": '', "life-buoy": '', "link-2": '', "link": '', "linkedin": '', "list": '', "loader": '', "lock": '', "log-in": '', "log-out": '', "mail": '', "map-pin": '', "map": '', "maximize-2": '', "maximize": '', "meh": '', "menu": '', "message-circle": '', "message-square": '', "mic-off": '', "mic": '', "minimize-2": '', "minimize": '', "minus-circle": '', "minus-square": '', "minus": '', "monitor": '', "moon": '', "more-horizontal": '', "more-vertical": '', "mouse-pointer": '', "move": '', "music": '', "navigation-2": '', "navigation": '', "octagon": '', "package": '', "paperclip": '', "pause-circle": '', "pause": '', "pen-tool": '', "percent": '', "phone-call": '', "phone-forwarded": '', "phone-incoming": '', "phone-missed": '', "phone-off": '', "phone-outgoing": '', "phone": '', "pie-chart": '', "play-circle": '', "play": '', "plus-circle": '', "plus-square": '', "plus": '', "pocket": '', "power": '', "printer": '', "radio": '', "refresh-ccw": '', "refresh-cw": '', "repeat": '', "rewind": '', "rotate-ccw": '', "rotate-cw": '', "rss": '', "save": '', "scissors": '', "search": '', "send": '', "server": '', "settings": '', "share-2": '', "share": '', "shield-off": '', "shield": '', "shopping-bag": '', "shopping-cart": '', "shuffle": '', "sidebar": '', "skip-back": '', "skip-forward": '', "slack": '', "slash": '', "sliders": '', "smartphone": '', "smile": '', "speaker": '', "square": '', "star": '', "stop-circle": '', "sun": '', "sunrise": '', "sunset": '', "table": '', "tablet": '', "tag": '', "target": '', "terminal": '', "thermometer": '', "thumbs-down": '', "thumbs-up": '', "toggle-left": '', "toggle-right": '', "tool": '', "trash-2": '', "trash": '', "trello": '', "trending-down": '', "trending-up": '', "triangle": '', "truck": '', "tv": '', "twitch": '', "twitter": '', "type": '', "umbrella": '', "underline": '', "unlock": '', "upload-cloud": '', "upload": '', "user-check": '', "user-minus": '', "user-plus": '', "user-x": '', "user": '', "users": '', "video-off": '', "video": '', "voicemail": '', "volume-1": '', "volume-2": '', "volume-x": '', "volume": '', "watch": '', "wifi-off": '', "wifi": '', "wind": '', "x-circle": '', "x-octagon": '', "x-square": '', "x": '', "youtube": '', "zap-off": '', "zap": '', "zoom-in": '', "zoom-out": '' }; - } - ), - /***/ - "./node_modules/classnames/dedupe.js": ( - /*!*******************************************!*\ - !*** ./node_modules/classnames/dedupe.js ***! - \*******************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; - (function() { - "use strict"; - var classNames = function() { - function StorageObject() { - } - StorageObject.prototype = /* @__PURE__ */ Object.create(null); - function _parseArray(resultSet, array) { - var length = array.length; - for (var i = 0; i < length; ++i) { - _parse(resultSet, array[i]); - } - } - var hasOwn = {}.hasOwnProperty; - function _parseNumber(resultSet, num2) { - resultSet[num2] = true; - } - function _parseObject(resultSet, object) { - for (var k in object) { - if (hasOwn.call(object, k)) { - resultSet[k] = !!object[k]; - } - } - } - var SPACE = /\s+/; - function _parseString(resultSet, str) { - var array = str.split(SPACE); - var length = array.length; - for (var i = 0; i < length; ++i) { - resultSet[array[i]] = true; - } - } - function _parse(resultSet, arg) { - if (!arg) return; - var argType = typeof arg; - if (argType === "string") { - _parseString(resultSet, arg); - } else if (Array.isArray(arg)) { - _parseArray(resultSet, arg); - } else if (argType === "object") { - _parseObject(resultSet, arg); - } else if (argType === "number") { - _parseNumber(resultSet, arg); - } - } - function _classNames() { - var len = arguments.length; - var args = Array(len); - for (var i = 0; i < len; i++) { - args[i] = arguments[i]; - } - var classSet = new StorageObject(); - _parseArray(classSet, args); - var list = []; - for (var k in classSet) { - if (classSet[k]) { - list.push(k); - } - } - return list.join(" "); - } - return _classNames; - }(); - if (typeof module3 !== "undefined" && module3.exports) { - module3.exports = classNames; - } else if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { - return classNames; - }.apply(exports3, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== void 0 && (module3.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else { - } - })(); - } - ), - /***/ - "./node_modules/core-js/es/array/from.js": ( - /*!***********************************************!*\ - !*** ./node_modules/core-js/es/array/from.js ***! - \***********************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - __webpack_require__( - /*! ../../modules/es.string.iterator */ - "./node_modules/core-js/modules/es.string.iterator.js" - ); - __webpack_require__( - /*! ../../modules/es.array.from */ - "./node_modules/core-js/modules/es.array.from.js" - ); - var path2 = __webpack_require__( - /*! ../../internals/path */ - "./node_modules/core-js/internals/path.js" - ); - module3.exports = path2.Array.from; - } - ), - /***/ - "./node_modules/core-js/internals/a-function.js": ( - /*!******************************************************!*\ - !*** ./node_modules/core-js/internals/a-function.js ***! - \******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = function(it) { - if (typeof it != "function") { - throw TypeError(String(it) + " is not a function"); - } - return it; - }; - } - ), - /***/ - "./node_modules/core-js/internals/an-object.js": ( - /*!*****************************************************!*\ - !*** ./node_modules/core-js/internals/an-object.js ***! - \*****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var isObject2 = __webpack_require__( - /*! ../internals/is-object */ - "./node_modules/core-js/internals/is-object.js" - ); - module3.exports = function(it) { - if (!isObject2(it)) { - throw TypeError(String(it) + " is not an object"); - } - return it; - }; - } - ), - /***/ - "./node_modules/core-js/internals/array-from.js": ( - /*!******************************************************!*\ - !*** ./node_modules/core-js/internals/array-from.js ***! - \******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var bind = __webpack_require__( - /*! ../internals/bind-context */ - "./node_modules/core-js/internals/bind-context.js" - ); - var toObject = __webpack_require__( - /*! ../internals/to-object */ - "./node_modules/core-js/internals/to-object.js" - ); - var callWithSafeIterationClosing = __webpack_require__( - /*! ../internals/call-with-safe-iteration-closing */ - "./node_modules/core-js/internals/call-with-safe-iteration-closing.js" - ); - var isArrayIteratorMethod = __webpack_require__( - /*! ../internals/is-array-iterator-method */ - "./node_modules/core-js/internals/is-array-iterator-method.js" - ); - var toLength = __webpack_require__( - /*! ../internals/to-length */ - "./node_modules/core-js/internals/to-length.js" - ); - var createProperty = __webpack_require__( - /*! ../internals/create-property */ - "./node_modules/core-js/internals/create-property.js" - ); - var getIteratorMethod = __webpack_require__( - /*! ../internals/get-iterator-method */ - "./node_modules/core-js/internals/get-iterator-method.js" - ); - module3.exports = function from(arrayLike) { - var O = toObject(arrayLike); - var C = typeof this == "function" ? this : Array; - var argumentsLength = arguments.length; - var mapfn = argumentsLength > 1 ? arguments[1] : void 0; - var mapping = mapfn !== void 0; - var index2 = 0; - var iteratorMethod = getIteratorMethod(O); - var length, result, step, iterator; - if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : void 0, 2); - if (iteratorMethod != void 0 && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { - iterator = iteratorMethod.call(O); - result = new C(); - for (; !(step = iterator.next()).done; index2++) { - createProperty( - result, - index2, - mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index2], true) : step.value - ); - } - } else { - length = toLength(O.length); - result = new C(length); - for (; length > index2; index2++) { - createProperty(result, index2, mapping ? mapfn(O[index2], index2) : O[index2]); - } - } - result.length = index2; - return result; - }; - } - ), - /***/ - "./node_modules/core-js/internals/array-includes.js": ( - /*!**********************************************************!*\ - !*** ./node_modules/core-js/internals/array-includes.js ***! - \**********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var toIndexedObject = __webpack_require__( - /*! ../internals/to-indexed-object */ - "./node_modules/core-js/internals/to-indexed-object.js" - ); - var toLength = __webpack_require__( - /*! ../internals/to-length */ - "./node_modules/core-js/internals/to-length.js" - ); - var toAbsoluteIndex = __webpack_require__( - /*! ../internals/to-absolute-index */ - "./node_modules/core-js/internals/to-absolute-index.js" - ); - module3.exports = function(IS_INCLUDES) { - return function($this, el, fromIndex) { - var O = toIndexedObject($this); - var length = toLength(O.length); - var index2 = toAbsoluteIndex(fromIndex, length); - var value; - if (IS_INCLUDES && el != el) while (length > index2) { - value = O[index2++]; - if (value != value) return true; - } - else for (; length > index2; index2++) if (IS_INCLUDES || index2 in O) { - if (O[index2] === el) return IS_INCLUDES || index2 || 0; - } - return !IS_INCLUDES && -1; - }; - }; - } - ), - /***/ - "./node_modules/core-js/internals/bind-context.js": ( - /*!********************************************************!*\ - !*** ./node_modules/core-js/internals/bind-context.js ***! - \********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var aFunction = __webpack_require__( - /*! ../internals/a-function */ - "./node_modules/core-js/internals/a-function.js" - ); - module3.exports = function(fn, that, length) { - aFunction(fn); - if (that === void 0) return fn; - switch (length) { - case 0: - return function() { - return fn.call(that); - }; - case 1: - return function(a) { - return fn.call(that, a); - }; - case 2: - return function(a, b) { - return fn.call(that, a, b); - }; - case 3: - return function(a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function() { - return fn.apply(that, arguments); - }; - }; - } - ), - /***/ - "./node_modules/core-js/internals/call-with-safe-iteration-closing.js": ( - /*!****************************************************************************!*\ - !*** ./node_modules/core-js/internals/call-with-safe-iteration-closing.js ***! - \****************************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var anObject = __webpack_require__( - /*! ../internals/an-object */ - "./node_modules/core-js/internals/an-object.js" - ); - module3.exports = function(iterator, fn, value, ENTRIES) { - try { - return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); - } catch (error) { - var returnMethod = iterator["return"]; - if (returnMethod !== void 0) anObject(returnMethod.call(iterator)); - throw error; - } - }; - } - ), - /***/ - "./node_modules/core-js/internals/check-correctness-of-iteration.js": ( - /*!**************************************************************************!*\ - !*** ./node_modules/core-js/internals/check-correctness-of-iteration.js ***! - \**************************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var wellKnownSymbol = __webpack_require__( - /*! ../internals/well-known-symbol */ - "./node_modules/core-js/internals/well-known-symbol.js" - ); - var ITERATOR = wellKnownSymbol("iterator"); - var SAFE_CLOSING = false; - try { - var called = 0; - var iteratorWithReturn = { - next: function() { - return { done: !!called++ }; - }, - "return": function() { - SAFE_CLOSING = true; - } - }; - iteratorWithReturn[ITERATOR] = function() { - return this; - }; - Array.from(iteratorWithReturn, function() { - throw 2; - }); - } catch (error) { - } - module3.exports = function(exec, SKIP_CLOSING) { - if (!SKIP_CLOSING && !SAFE_CLOSING) return false; - var ITERATION_SUPPORT = false; - try { - var object = {}; - object[ITERATOR] = function() { - return { - next: function() { - return { done: ITERATION_SUPPORT = true }; - } - }; - }; - exec(object); - } catch (error) { - } - return ITERATION_SUPPORT; - }; - } - ), - /***/ - "./node_modules/core-js/internals/classof-raw.js": ( - /*!*******************************************************!*\ - !*** ./node_modules/core-js/internals/classof-raw.js ***! - \*******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - var toString = {}.toString; - module3.exports = function(it) { - return toString.call(it).slice(8, -1); - }; - } - ), - /***/ - "./node_modules/core-js/internals/classof.js": ( - /*!***************************************************!*\ - !*** ./node_modules/core-js/internals/classof.js ***! - \***************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var classofRaw = __webpack_require__( - /*! ../internals/classof-raw */ - "./node_modules/core-js/internals/classof-raw.js" - ); - var wellKnownSymbol = __webpack_require__( - /*! ../internals/well-known-symbol */ - "./node_modules/core-js/internals/well-known-symbol.js" - ); - var TO_STRING_TAG = wellKnownSymbol("toStringTag"); - var CORRECT_ARGUMENTS = classofRaw(/* @__PURE__ */ function() { - return arguments; - }()) == "Arguments"; - var tryGet = function(it, key2) { - try { - return it[key2]; - } catch (error) { - } - }; - module3.exports = function(it) { - var O, tag2, result; - return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag2 = tryGet(O = Object(it), TO_STRING_TAG)) == "string" ? tag2 : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && typeof O.callee == "function" ? "Arguments" : result; - }; - } - ), - /***/ - "./node_modules/core-js/internals/copy-constructor-properties.js": ( - /*!***********************************************************************!*\ - !*** ./node_modules/core-js/internals/copy-constructor-properties.js ***! - \***********************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var has = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var ownKeys = __webpack_require__( - /*! ../internals/own-keys */ - "./node_modules/core-js/internals/own-keys.js" - ); - var getOwnPropertyDescriptorModule = __webpack_require__( - /*! ../internals/object-get-own-property-descriptor */ - "./node_modules/core-js/internals/object-get-own-property-descriptor.js" - ); - var definePropertyModule = __webpack_require__( - /*! ../internals/object-define-property */ - "./node_modules/core-js/internals/object-define-property.js" - ); - module3.exports = function(target, source) { - var keys = ownKeys(source); - var defineProperty = definePropertyModule.f; - var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; - for (var i = 0; i < keys.length; i++) { - var key2 = keys[i]; - if (!has(target, key2)) defineProperty(target, key2, getOwnPropertyDescriptor(source, key2)); - } - }; - } - ), - /***/ - "./node_modules/core-js/internals/correct-prototype-getter.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/core-js/internals/correct-prototype-getter.js ***! - \********************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var fails = __webpack_require__( - /*! ../internals/fails */ - "./node_modules/core-js/internals/fails.js" - ); - module3.exports = !fails(function() { - function F() { - } - F.prototype.constructor = null; - return Object.getPrototypeOf(new F()) !== F.prototype; - }); - } - ), - /***/ - "./node_modules/core-js/internals/create-iterator-constructor.js": ( - /*!***********************************************************************!*\ - !*** ./node_modules/core-js/internals/create-iterator-constructor.js ***! - \***********************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var IteratorPrototype = __webpack_require__( - /*! ../internals/iterators-core */ - "./node_modules/core-js/internals/iterators-core.js" - ).IteratorPrototype; - var create = __webpack_require__( - /*! ../internals/object-create */ - "./node_modules/core-js/internals/object-create.js" - ); - var createPropertyDescriptor = __webpack_require__( - /*! ../internals/create-property-descriptor */ - "./node_modules/core-js/internals/create-property-descriptor.js" - ); - var setToStringTag = __webpack_require__( - /*! ../internals/set-to-string-tag */ - "./node_modules/core-js/internals/set-to-string-tag.js" - ); - var Iterators = __webpack_require__( - /*! ../internals/iterators */ - "./node_modules/core-js/internals/iterators.js" - ); - var returnThis = function() { - return this; - }; - module3.exports = function(IteratorConstructor, NAME, next) { - var TO_STRING_TAG = NAME + " Iterator"; - IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) }); - setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); - Iterators[TO_STRING_TAG] = returnThis; - return IteratorConstructor; - }; - } - ), - /***/ - "./node_modules/core-js/internals/create-property-descriptor.js": ( - /*!**********************************************************************!*\ - !*** ./node_modules/core-js/internals/create-property-descriptor.js ***! - \**********************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = function(bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value - }; - }; - } - ), - /***/ - "./node_modules/core-js/internals/create-property.js": ( - /*!***********************************************************!*\ - !*** ./node_modules/core-js/internals/create-property.js ***! - \***********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var toPrimitive = __webpack_require__( - /*! ../internals/to-primitive */ - "./node_modules/core-js/internals/to-primitive.js" - ); - var definePropertyModule = __webpack_require__( - /*! ../internals/object-define-property */ - "./node_modules/core-js/internals/object-define-property.js" - ); - var createPropertyDescriptor = __webpack_require__( - /*! ../internals/create-property-descriptor */ - "./node_modules/core-js/internals/create-property-descriptor.js" - ); - module3.exports = function(object, key2, value) { - var propertyKey = toPrimitive(key2); - if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); - else object[propertyKey] = value; - }; - } - ), - /***/ - "./node_modules/core-js/internals/define-iterator.js": ( - /*!***********************************************************!*\ - !*** ./node_modules/core-js/internals/define-iterator.js ***! - \***********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var $ = __webpack_require__( - /*! ../internals/export */ - "./node_modules/core-js/internals/export.js" - ); - var createIteratorConstructor = __webpack_require__( - /*! ../internals/create-iterator-constructor */ - "./node_modules/core-js/internals/create-iterator-constructor.js" - ); - var getPrototypeOf = __webpack_require__( - /*! ../internals/object-get-prototype-of */ - "./node_modules/core-js/internals/object-get-prototype-of.js" - ); - var setPrototypeOf = __webpack_require__( - /*! ../internals/object-set-prototype-of */ - "./node_modules/core-js/internals/object-set-prototype-of.js" - ); - var setToStringTag = __webpack_require__( - /*! ../internals/set-to-string-tag */ - "./node_modules/core-js/internals/set-to-string-tag.js" - ); - var hide = __webpack_require__( - /*! ../internals/hide */ - "./node_modules/core-js/internals/hide.js" - ); - var redefine = __webpack_require__( - /*! ../internals/redefine */ - "./node_modules/core-js/internals/redefine.js" - ); - var wellKnownSymbol = __webpack_require__( - /*! ../internals/well-known-symbol */ - "./node_modules/core-js/internals/well-known-symbol.js" - ); - var IS_PURE = __webpack_require__( - /*! ../internals/is-pure */ - "./node_modules/core-js/internals/is-pure.js" - ); - var Iterators = __webpack_require__( - /*! ../internals/iterators */ - "./node_modules/core-js/internals/iterators.js" - ); - var IteratorsCore = __webpack_require__( - /*! ../internals/iterators-core */ - "./node_modules/core-js/internals/iterators-core.js" - ); - var IteratorPrototype = IteratorsCore.IteratorPrototype; - var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; - var ITERATOR = wellKnownSymbol("iterator"); - var KEYS = "keys"; - var VALUES = "values"; - var ENTRIES = "entries"; - var returnThis = function() { - return this; - }; - module3.exports = function(Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { - createIteratorConstructor(IteratorConstructor, NAME, next); - var getIterationMethod = function(KIND) { - if (KIND === DEFAULT && defaultIterator) return defaultIterator; - if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; - switch (KIND) { - case KEYS: - return function keys() { - return new IteratorConstructor(this, KIND); - }; - case VALUES: - return function values() { - return new IteratorConstructor(this, KIND); - }; - case ENTRIES: - return function entries() { - return new IteratorConstructor(this, KIND); - }; - } - return function() { - return new IteratorConstructor(this); - }; - }; - var TO_STRING_TAG = NAME + " Iterator"; - var INCORRECT_VALUES_NAME = false; - var IterablePrototype = Iterable.prototype; - var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype["@@iterator"] || DEFAULT && IterablePrototype[DEFAULT]; - var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); - var anyNativeIterator = NAME == "Array" ? IterablePrototype.entries || nativeIterator : nativeIterator; - var CurrentIteratorPrototype, methods, KEY; - if (anyNativeIterator) { - CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); - if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { - if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { - if (setPrototypeOf) { - setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); - } else if (typeof CurrentIteratorPrototype[ITERATOR] != "function") { - hide(CurrentIteratorPrototype, ITERATOR, returnThis); - } - } - setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); - if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; - } - } - if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { - INCORRECT_VALUES_NAME = true; - defaultIterator = function values() { - return nativeIterator.call(this); - }; - } - if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { - hide(IterablePrototype, ITERATOR, defaultIterator); - } - Iterators[NAME] = defaultIterator; - if (DEFAULT) { - methods = { - values: getIterationMethod(VALUES), - keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), - entries: getIterationMethod(ENTRIES) - }; - if (FORCED) for (KEY in methods) { - if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { - redefine(IterablePrototype, KEY, methods[KEY]); - } - } - else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); - } - return methods; - }; - } - ), - /***/ - "./node_modules/core-js/internals/descriptors.js": ( - /*!*******************************************************!*\ - !*** ./node_modules/core-js/internals/descriptors.js ***! - \*******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var fails = __webpack_require__( - /*! ../internals/fails */ - "./node_modules/core-js/internals/fails.js" - ); - module3.exports = !fails(function() { - return Object.defineProperty({}, "a", { get: function() { - return 7; - } }).a != 7; - }); - } - ), - /***/ - "./node_modules/core-js/internals/document-create-element.js": ( - /*!*******************************************************************!*\ - !*** ./node_modules/core-js/internals/document-create-element.js ***! - \*******************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var isObject2 = __webpack_require__( - /*! ../internals/is-object */ - "./node_modules/core-js/internals/is-object.js" - ); - var document2 = global2.document; - var exist = isObject2(document2) && isObject2(document2.createElement); - module3.exports = function(it) { - return exist ? document2.createElement(it) : {}; - }; - } - ), - /***/ - "./node_modules/core-js/internals/enum-bug-keys.js": ( - /*!*********************************************************!*\ - !*** ./node_modules/core-js/internals/enum-bug-keys.js ***! - \*********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = [ - "constructor", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "toLocaleString", - "toString", - "valueOf" - ]; - } - ), - /***/ - "./node_modules/core-js/internals/export.js": ( - /*!**************************************************!*\ - !*** ./node_modules/core-js/internals/export.js ***! - \**************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var getOwnPropertyDescriptor = __webpack_require__( - /*! ../internals/object-get-own-property-descriptor */ - "./node_modules/core-js/internals/object-get-own-property-descriptor.js" - ).f; - var hide = __webpack_require__( - /*! ../internals/hide */ - "./node_modules/core-js/internals/hide.js" - ); - var redefine = __webpack_require__( - /*! ../internals/redefine */ - "./node_modules/core-js/internals/redefine.js" - ); - var setGlobal = __webpack_require__( - /*! ../internals/set-global */ - "./node_modules/core-js/internals/set-global.js" - ); - var copyConstructorProperties = __webpack_require__( - /*! ../internals/copy-constructor-properties */ - "./node_modules/core-js/internals/copy-constructor-properties.js" - ); - var isForced = __webpack_require__( - /*! ../internals/is-forced */ - "./node_modules/core-js/internals/is-forced.js" - ); - module3.exports = function(options, source) { - var TARGET = options.target; - var GLOBAL = options.global; - var STATIC = options.stat; - var FORCED, target, key2, targetProperty, sourceProperty, descriptor; - if (GLOBAL) { - target = global2; - } else if (STATIC) { - target = global2[TARGET] || setGlobal(TARGET, {}); - } else { - target = (global2[TARGET] || {}).prototype; - } - if (target) for (key2 in source) { - sourceProperty = source[key2]; - if (options.noTargetGet) { - descriptor = getOwnPropertyDescriptor(target, key2); - targetProperty = descriptor && descriptor.value; - } else targetProperty = target[key2]; - FORCED = isForced(GLOBAL ? key2 : TARGET + (STATIC ? "." : "#") + key2, options.forced); - if (!FORCED && targetProperty !== void 0) { - if (typeof sourceProperty === typeof targetProperty) continue; - copyConstructorProperties(sourceProperty, targetProperty); - } - if (options.sham || targetProperty && targetProperty.sham) { - hide(sourceProperty, "sham", true); - } - redefine(target, key2, sourceProperty, options); - } - }; - } - ), - /***/ - "./node_modules/core-js/internals/fails.js": ( - /*!*************************************************!*\ - !*** ./node_modules/core-js/internals/fails.js ***! - \*************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = function(exec) { - try { - return !!exec(); - } catch (error) { - return true; - } - }; - } - ), - /***/ - "./node_modules/core-js/internals/function-to-string.js": ( - /*!**************************************************************!*\ - !*** ./node_modules/core-js/internals/function-to-string.js ***! - \**************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var shared = __webpack_require__( - /*! ../internals/shared */ - "./node_modules/core-js/internals/shared.js" - ); - module3.exports = shared("native-function-to-string", Function.toString); - } - ), - /***/ - "./node_modules/core-js/internals/get-iterator-method.js": ( - /*!***************************************************************!*\ - !*** ./node_modules/core-js/internals/get-iterator-method.js ***! - \***************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var classof = __webpack_require__( - /*! ../internals/classof */ - "./node_modules/core-js/internals/classof.js" - ); - var Iterators = __webpack_require__( - /*! ../internals/iterators */ - "./node_modules/core-js/internals/iterators.js" - ); - var wellKnownSymbol = __webpack_require__( - /*! ../internals/well-known-symbol */ - "./node_modules/core-js/internals/well-known-symbol.js" - ); - var ITERATOR = wellKnownSymbol("iterator"); - module3.exports = function(it) { - if (it != void 0) return it[ITERATOR] || it["@@iterator"] || Iterators[classof(it)]; - }; - } - ), - /***/ - "./node_modules/core-js/internals/global.js": ( - /*!**************************************************!*\ - !*** ./node_modules/core-js/internals/global.js ***! - \**************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - (function(global2) { - var O = "object"; - var check = function(it) { - return it && it.Math == Math && it; - }; - module3.exports = // eslint-disable-next-line no-undef - check(typeof globalThis == O && globalThis) || check(typeof window == O && window) || check(typeof self == O && self) || check(typeof global2 == O && global2) || // eslint-disable-next-line no-new-func - Function("return this")(); - }).call(this, __webpack_require__( - /*! ./../../webpack/buildin/global.js */ - "./node_modules/webpack/buildin/global.js" - )); - } - ), - /***/ - "./node_modules/core-js/internals/has.js": ( - /*!***********************************************!*\ - !*** ./node_modules/core-js/internals/has.js ***! - \***********************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - var hasOwnProperty = {}.hasOwnProperty; - module3.exports = function(it, key2) { - return hasOwnProperty.call(it, key2); - }; - } - ), - /***/ - "./node_modules/core-js/internals/hidden-keys.js": ( - /*!*******************************************************!*\ - !*** ./node_modules/core-js/internals/hidden-keys.js ***! - \*******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = {}; - } - ), - /***/ - "./node_modules/core-js/internals/hide.js": ( - /*!************************************************!*\ - !*** ./node_modules/core-js/internals/hide.js ***! - \************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var DESCRIPTORS = __webpack_require__( - /*! ../internals/descriptors */ - "./node_modules/core-js/internals/descriptors.js" - ); - var definePropertyModule = __webpack_require__( - /*! ../internals/object-define-property */ - "./node_modules/core-js/internals/object-define-property.js" - ); - var createPropertyDescriptor = __webpack_require__( - /*! ../internals/create-property-descriptor */ - "./node_modules/core-js/internals/create-property-descriptor.js" - ); - module3.exports = DESCRIPTORS ? function(object, key2, value) { - return definePropertyModule.f(object, key2, createPropertyDescriptor(1, value)); - } : function(object, key2, value) { - object[key2] = value; - return object; - }; - } - ), - /***/ - "./node_modules/core-js/internals/html.js": ( - /*!************************************************!*\ - !*** ./node_modules/core-js/internals/html.js ***! - \************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var document2 = global2.document; - module3.exports = document2 && document2.documentElement; - } - ), - /***/ - "./node_modules/core-js/internals/ie8-dom-define.js": ( - /*!**********************************************************!*\ - !*** ./node_modules/core-js/internals/ie8-dom-define.js ***! - \**********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var DESCRIPTORS = __webpack_require__( - /*! ../internals/descriptors */ - "./node_modules/core-js/internals/descriptors.js" - ); - var fails = __webpack_require__( - /*! ../internals/fails */ - "./node_modules/core-js/internals/fails.js" - ); - var createElement = __webpack_require__( - /*! ../internals/document-create-element */ - "./node_modules/core-js/internals/document-create-element.js" - ); - module3.exports = !DESCRIPTORS && !fails(function() { - return Object.defineProperty(createElement("div"), "a", { - get: function() { - return 7; - } - }).a != 7; - }); - } - ), - /***/ - "./node_modules/core-js/internals/indexed-object.js": ( - /*!**********************************************************!*\ - !*** ./node_modules/core-js/internals/indexed-object.js ***! - \**********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var fails = __webpack_require__( - /*! ../internals/fails */ - "./node_modules/core-js/internals/fails.js" - ); - var classof = __webpack_require__( - /*! ../internals/classof-raw */ - "./node_modules/core-js/internals/classof-raw.js" - ); - var split = "".split; - module3.exports = fails(function() { - return !Object("z").propertyIsEnumerable(0); - }) ? function(it) { - return classof(it) == "String" ? split.call(it, "") : Object(it); - } : Object; - } - ), - /***/ - "./node_modules/core-js/internals/internal-state.js": ( - /*!**********************************************************!*\ - !*** ./node_modules/core-js/internals/internal-state.js ***! - \**********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var NATIVE_WEAK_MAP = __webpack_require__( - /*! ../internals/native-weak-map */ - "./node_modules/core-js/internals/native-weak-map.js" - ); - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var isObject2 = __webpack_require__( - /*! ../internals/is-object */ - "./node_modules/core-js/internals/is-object.js" - ); - var hide = __webpack_require__( - /*! ../internals/hide */ - "./node_modules/core-js/internals/hide.js" - ); - var objectHas = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var sharedKey = __webpack_require__( - /*! ../internals/shared-key */ - "./node_modules/core-js/internals/shared-key.js" - ); - var hiddenKeys = __webpack_require__( - /*! ../internals/hidden-keys */ - "./node_modules/core-js/internals/hidden-keys.js" - ); - var WeakMap2 = global2.WeakMap; - var set, get, has; - var enforce = function(it) { - return has(it) ? get(it) : set(it, {}); - }; - var getterFor = function(TYPE) { - return function(it) { - var state; - if (!isObject2(it) || (state = get(it)).type !== TYPE) { - throw TypeError("Incompatible receiver, " + TYPE + " required"); - } - return state; - }; - }; - if (NATIVE_WEAK_MAP) { - var store = new WeakMap2(); - var wmget = store.get; - var wmhas = store.has; - var wmset = store.set; - set = function(it, metadata) { - wmset.call(store, it, metadata); - return metadata; - }; - get = function(it) { - return wmget.call(store, it) || {}; - }; - has = function(it) { - return wmhas.call(store, it); - }; - } else { - var STATE = sharedKey("state"); - hiddenKeys[STATE] = true; - set = function(it, metadata) { - hide(it, STATE, metadata); - return metadata; - }; - get = function(it) { - return objectHas(it, STATE) ? it[STATE] : {}; - }; - has = function(it) { - return objectHas(it, STATE); - }; - } - module3.exports = { - set, - get, - has, - enforce, - getterFor - }; - } - ), - /***/ - "./node_modules/core-js/internals/is-array-iterator-method.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/core-js/internals/is-array-iterator-method.js ***! - \********************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var wellKnownSymbol = __webpack_require__( - /*! ../internals/well-known-symbol */ - "./node_modules/core-js/internals/well-known-symbol.js" - ); - var Iterators = __webpack_require__( - /*! ../internals/iterators */ - "./node_modules/core-js/internals/iterators.js" - ); - var ITERATOR = wellKnownSymbol("iterator"); - var ArrayPrototype = Array.prototype; - module3.exports = function(it) { - return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); - }; - } - ), - /***/ - "./node_modules/core-js/internals/is-forced.js": ( - /*!*****************************************************!*\ - !*** ./node_modules/core-js/internals/is-forced.js ***! - \*****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var fails = __webpack_require__( - /*! ../internals/fails */ - "./node_modules/core-js/internals/fails.js" - ); - var replacement = /#|\.prototype\./; - var isForced = function(feature, detection) { - var value = data[normalize2(feature)]; - return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == "function" ? fails(detection) : !!detection; - }; - var normalize2 = isForced.normalize = function(string) { - return String(string).replace(replacement, ".").toLowerCase(); - }; - var data = isForced.data = {}; - var NATIVE = isForced.NATIVE = "N"; - var POLYFILL = isForced.POLYFILL = "P"; - module3.exports = isForced; - } - ), - /***/ - "./node_modules/core-js/internals/is-object.js": ( - /*!*****************************************************!*\ - !*** ./node_modules/core-js/internals/is-object.js ***! - \*****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = function(it) { - return typeof it === "object" ? it !== null : typeof it === "function"; - }; - } - ), - /***/ - "./node_modules/core-js/internals/is-pure.js": ( - /*!***************************************************!*\ - !*** ./node_modules/core-js/internals/is-pure.js ***! - \***************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = false; - } - ), - /***/ - "./node_modules/core-js/internals/iterators-core.js": ( - /*!**********************************************************!*\ - !*** ./node_modules/core-js/internals/iterators-core.js ***! - \**********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var getPrototypeOf = __webpack_require__( - /*! ../internals/object-get-prototype-of */ - "./node_modules/core-js/internals/object-get-prototype-of.js" - ); - var hide = __webpack_require__( - /*! ../internals/hide */ - "./node_modules/core-js/internals/hide.js" - ); - var has = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var wellKnownSymbol = __webpack_require__( - /*! ../internals/well-known-symbol */ - "./node_modules/core-js/internals/well-known-symbol.js" - ); - var IS_PURE = __webpack_require__( - /*! ../internals/is-pure */ - "./node_modules/core-js/internals/is-pure.js" - ); - var ITERATOR = wellKnownSymbol("iterator"); - var BUGGY_SAFARI_ITERATORS = false; - var returnThis = function() { - return this; - }; - var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; - if ([].keys) { - arrayIterator = [].keys(); - if (!("next" in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; - else { - PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); - if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; - } - } - if (IteratorPrototype == void 0) IteratorPrototype = {}; - if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); - module3.exports = { - IteratorPrototype, - BUGGY_SAFARI_ITERATORS - }; - } - ), - /***/ - "./node_modules/core-js/internals/iterators.js": ( - /*!*****************************************************!*\ - !*** ./node_modules/core-js/internals/iterators.js ***! - \*****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = {}; - } - ), - /***/ - "./node_modules/core-js/internals/native-symbol.js": ( - /*!*********************************************************!*\ - !*** ./node_modules/core-js/internals/native-symbol.js ***! - \*********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var fails = __webpack_require__( - /*! ../internals/fails */ - "./node_modules/core-js/internals/fails.js" - ); - module3.exports = !!Object.getOwnPropertySymbols && !fails(function() { - return !String(Symbol()); - }); - } - ), - /***/ - "./node_modules/core-js/internals/native-weak-map.js": ( - /*!***********************************************************!*\ - !*** ./node_modules/core-js/internals/native-weak-map.js ***! - \***********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var nativeFunctionToString = __webpack_require__( - /*! ../internals/function-to-string */ - "./node_modules/core-js/internals/function-to-string.js" - ); - var WeakMap2 = global2.WeakMap; - module3.exports = typeof WeakMap2 === "function" && /native code/.test(nativeFunctionToString.call(WeakMap2)); - } - ), - /***/ - "./node_modules/core-js/internals/object-create.js": ( - /*!*********************************************************!*\ - !*** ./node_modules/core-js/internals/object-create.js ***! - \*********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var anObject = __webpack_require__( - /*! ../internals/an-object */ - "./node_modules/core-js/internals/an-object.js" - ); - var defineProperties = __webpack_require__( - /*! ../internals/object-define-properties */ - "./node_modules/core-js/internals/object-define-properties.js" - ); - var enumBugKeys = __webpack_require__( - /*! ../internals/enum-bug-keys */ - "./node_modules/core-js/internals/enum-bug-keys.js" - ); - var hiddenKeys = __webpack_require__( - /*! ../internals/hidden-keys */ - "./node_modules/core-js/internals/hidden-keys.js" - ); - var html2 = __webpack_require__( - /*! ../internals/html */ - "./node_modules/core-js/internals/html.js" - ); - var documentCreateElement = __webpack_require__( - /*! ../internals/document-create-element */ - "./node_modules/core-js/internals/document-create-element.js" - ); - var sharedKey = __webpack_require__( - /*! ../internals/shared-key */ - "./node_modules/core-js/internals/shared-key.js" - ); - var IE_PROTO = sharedKey("IE_PROTO"); - var PROTOTYPE = "prototype"; - var Empty = function() { - }; - var createDict = function() { - var iframe = documentCreateElement("iframe"); - var length = enumBugKeys.length; - var lt = "<"; - var script = "script"; - var gt = ">"; - var js = "java" + script + ":"; - var iframeDocument; - iframe.style.display = "none"; - html2.appendChild(iframe); - iframe.src = String(js); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + script + gt + "document.F=Object" + lt + "/" + script + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]]; - return createDict(); - }; - module3.exports = Object.create || function create(O, Properties) { - var result; - if (O !== null) { - Empty[PROTOTYPE] = anObject(O); - result = new Empty(); - Empty[PROTOTYPE] = null; - result[IE_PROTO] = O; - } else result = createDict(); - return Properties === void 0 ? result : defineProperties(result, Properties); - }; - hiddenKeys[IE_PROTO] = true; - } - ), - /***/ - "./node_modules/core-js/internals/object-define-properties.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/core-js/internals/object-define-properties.js ***! - \********************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var DESCRIPTORS = __webpack_require__( - /*! ../internals/descriptors */ - "./node_modules/core-js/internals/descriptors.js" - ); - var definePropertyModule = __webpack_require__( - /*! ../internals/object-define-property */ - "./node_modules/core-js/internals/object-define-property.js" - ); - var anObject = __webpack_require__( - /*! ../internals/an-object */ - "./node_modules/core-js/internals/an-object.js" - ); - var objectKeys = __webpack_require__( - /*! ../internals/object-keys */ - "./node_modules/core-js/internals/object-keys.js" - ); - module3.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { - anObject(O); - var keys = objectKeys(Properties); - var length = keys.length; - var i = 0; - var key2; - while (length > i) definePropertyModule.f(O, key2 = keys[i++], Properties[key2]); - return O; - }; - } - ), - /***/ - "./node_modules/core-js/internals/object-define-property.js": ( - /*!******************************************************************!*\ - !*** ./node_modules/core-js/internals/object-define-property.js ***! - \******************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var DESCRIPTORS = __webpack_require__( - /*! ../internals/descriptors */ - "./node_modules/core-js/internals/descriptors.js" - ); - var IE8_DOM_DEFINE = __webpack_require__( - /*! ../internals/ie8-dom-define */ - "./node_modules/core-js/internals/ie8-dom-define.js" - ); - var anObject = __webpack_require__( - /*! ../internals/an-object */ - "./node_modules/core-js/internals/an-object.js" - ); - var toPrimitive = __webpack_require__( - /*! ../internals/to-primitive */ - "./node_modules/core-js/internals/to-primitive.js" - ); - var nativeDefineProperty = Object.defineProperty; - exports3.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if (IE8_DOM_DEFINE) try { - return nativeDefineProperty(O, P, Attributes); - } catch (error) { - } - if ("get" in Attributes || "set" in Attributes) throw TypeError("Accessors not supported"); - if ("value" in Attributes) O[P] = Attributes.value; - return O; - }; - } - ), - /***/ - "./node_modules/core-js/internals/object-get-own-property-descriptor.js": ( - /*!******************************************************************************!*\ - !*** ./node_modules/core-js/internals/object-get-own-property-descriptor.js ***! - \******************************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var DESCRIPTORS = __webpack_require__( - /*! ../internals/descriptors */ - "./node_modules/core-js/internals/descriptors.js" - ); - var propertyIsEnumerableModule = __webpack_require__( - /*! ../internals/object-property-is-enumerable */ - "./node_modules/core-js/internals/object-property-is-enumerable.js" - ); - var createPropertyDescriptor = __webpack_require__( - /*! ../internals/create-property-descriptor */ - "./node_modules/core-js/internals/create-property-descriptor.js" - ); - var toIndexedObject = __webpack_require__( - /*! ../internals/to-indexed-object */ - "./node_modules/core-js/internals/to-indexed-object.js" - ); - var toPrimitive = __webpack_require__( - /*! ../internals/to-primitive */ - "./node_modules/core-js/internals/to-primitive.js" - ); - var has = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var IE8_DOM_DEFINE = __webpack_require__( - /*! ../internals/ie8-dom-define */ - "./node_modules/core-js/internals/ie8-dom-define.js" - ); - var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - exports3.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { - O = toIndexedObject(O); - P = toPrimitive(P, true); - if (IE8_DOM_DEFINE) try { - return nativeGetOwnPropertyDescriptor(O, P); - } catch (error) { - } - if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); - }; - } - ), - /***/ - "./node_modules/core-js/internals/object-get-own-property-names.js": ( - /*!*************************************************************************!*\ - !*** ./node_modules/core-js/internals/object-get-own-property-names.js ***! - \*************************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var internalObjectKeys = __webpack_require__( - /*! ../internals/object-keys-internal */ - "./node_modules/core-js/internals/object-keys-internal.js" - ); - var enumBugKeys = __webpack_require__( - /*! ../internals/enum-bug-keys */ - "./node_modules/core-js/internals/enum-bug-keys.js" - ); - var hiddenKeys = enumBugKeys.concat("length", "prototype"); - exports3.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return internalObjectKeys(O, hiddenKeys); - }; - } - ), - /***/ - "./node_modules/core-js/internals/object-get-own-property-symbols.js": ( - /*!***************************************************************************!*\ - !*** ./node_modules/core-js/internals/object-get-own-property-symbols.js ***! - \***************************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - exports3.f = Object.getOwnPropertySymbols; - } - ), - /***/ - "./node_modules/core-js/internals/object-get-prototype-of.js": ( - /*!*******************************************************************!*\ - !*** ./node_modules/core-js/internals/object-get-prototype-of.js ***! - \*******************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var has = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var toObject = __webpack_require__( - /*! ../internals/to-object */ - "./node_modules/core-js/internals/to-object.js" - ); - var sharedKey = __webpack_require__( - /*! ../internals/shared-key */ - "./node_modules/core-js/internals/shared-key.js" - ); - var CORRECT_PROTOTYPE_GETTER = __webpack_require__( - /*! ../internals/correct-prototype-getter */ - "./node_modules/core-js/internals/correct-prototype-getter.js" - ); - var IE_PROTO = sharedKey("IE_PROTO"); - var ObjectPrototype = Object.prototype; - module3.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function(O) { - O = toObject(O); - if (has(O, IE_PROTO)) return O[IE_PROTO]; - if (typeof O.constructor == "function" && O instanceof O.constructor) { - return O.constructor.prototype; - } - return O instanceof Object ? ObjectPrototype : null; - }; - } - ), - /***/ - "./node_modules/core-js/internals/object-keys-internal.js": ( - /*!****************************************************************!*\ - !*** ./node_modules/core-js/internals/object-keys-internal.js ***! - \****************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var has = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var toIndexedObject = __webpack_require__( - /*! ../internals/to-indexed-object */ - "./node_modules/core-js/internals/to-indexed-object.js" - ); - var arrayIncludes = __webpack_require__( - /*! ../internals/array-includes */ - "./node_modules/core-js/internals/array-includes.js" - ); - var hiddenKeys = __webpack_require__( - /*! ../internals/hidden-keys */ - "./node_modules/core-js/internals/hidden-keys.js" - ); - var arrayIndexOf = arrayIncludes(false); - module3.exports = function(object, names) { - var O = toIndexedObject(object); - var i = 0; - var result = []; - var key2; - for (key2 in O) !has(hiddenKeys, key2) && has(O, key2) && result.push(key2); - while (names.length > i) if (has(O, key2 = names[i++])) { - ~arrayIndexOf(result, key2) || result.push(key2); - } - return result; - }; - } - ), - /***/ - "./node_modules/core-js/internals/object-keys.js": ( - /*!*******************************************************!*\ - !*** ./node_modules/core-js/internals/object-keys.js ***! - \*******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var internalObjectKeys = __webpack_require__( - /*! ../internals/object-keys-internal */ - "./node_modules/core-js/internals/object-keys-internal.js" - ); - var enumBugKeys = __webpack_require__( - /*! ../internals/enum-bug-keys */ - "./node_modules/core-js/internals/enum-bug-keys.js" - ); - module3.exports = Object.keys || function keys(O) { - return internalObjectKeys(O, enumBugKeys); - }; - } - ), - /***/ - "./node_modules/core-js/internals/object-property-is-enumerable.js": ( - /*!*************************************************************************!*\ - !*** ./node_modules/core-js/internals/object-property-is-enumerable.js ***! - \*************************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var nativePropertyIsEnumerable = {}.propertyIsEnumerable; - var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); - exports3.f = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = getOwnPropertyDescriptor(this, V); - return !!descriptor && descriptor.enumerable; - } : nativePropertyIsEnumerable; - } - ), - /***/ - "./node_modules/core-js/internals/object-set-prototype-of.js": ( - /*!*******************************************************************!*\ - !*** ./node_modules/core-js/internals/object-set-prototype-of.js ***! - \*******************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var validateSetPrototypeOfArguments = __webpack_require__( - /*! ../internals/validate-set-prototype-of-arguments */ - "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js" - ); - module3.exports = Object.setPrototypeOf || ("__proto__" in {} ? function() { - var correctSetter = false; - var test = {}; - var setter; - try { - setter = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set; - setter.call(test, []); - correctSetter = test instanceof Array; - } catch (error) { - } - return function setPrototypeOf(O, proto) { - validateSetPrototypeOfArguments(O, proto); - if (correctSetter) setter.call(O, proto); - else O.__proto__ = proto; - return O; - }; - }() : void 0); - } - ), - /***/ - "./node_modules/core-js/internals/own-keys.js": ( - /*!****************************************************!*\ - !*** ./node_modules/core-js/internals/own-keys.js ***! - \****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var getOwnPropertyNamesModule = __webpack_require__( - /*! ../internals/object-get-own-property-names */ - "./node_modules/core-js/internals/object-get-own-property-names.js" - ); - var getOwnPropertySymbolsModule = __webpack_require__( - /*! ../internals/object-get-own-property-symbols */ - "./node_modules/core-js/internals/object-get-own-property-symbols.js" - ); - var anObject = __webpack_require__( - /*! ../internals/an-object */ - "./node_modules/core-js/internals/an-object.js" - ); - var Reflect2 = global2.Reflect; - module3.exports = Reflect2 && Reflect2.ownKeys || function ownKeys(it) { - var keys = getOwnPropertyNamesModule.f(anObject(it)); - var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; - return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; - }; - } - ), - /***/ - "./node_modules/core-js/internals/path.js": ( - /*!************************************************!*\ - !*** ./node_modules/core-js/internals/path.js ***! - \************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - module3.exports = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - } - ), - /***/ - "./node_modules/core-js/internals/redefine.js": ( - /*!****************************************************!*\ - !*** ./node_modules/core-js/internals/redefine.js ***! - \****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var shared = __webpack_require__( - /*! ../internals/shared */ - "./node_modules/core-js/internals/shared.js" - ); - var hide = __webpack_require__( - /*! ../internals/hide */ - "./node_modules/core-js/internals/hide.js" - ); - var has = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var setGlobal = __webpack_require__( - /*! ../internals/set-global */ - "./node_modules/core-js/internals/set-global.js" - ); - var nativeFunctionToString = __webpack_require__( - /*! ../internals/function-to-string */ - "./node_modules/core-js/internals/function-to-string.js" - ); - var InternalStateModule = __webpack_require__( - /*! ../internals/internal-state */ - "./node_modules/core-js/internals/internal-state.js" - ); - var getInternalState = InternalStateModule.get; - var enforceInternalState = InternalStateModule.enforce; - var TEMPLATE = String(nativeFunctionToString).split("toString"); - shared("inspectSource", function(it) { - return nativeFunctionToString.call(it); - }); - (module3.exports = function(O, key2, value, options) { - var unsafe = options ? !!options.unsafe : false; - var simple = options ? !!options.enumerable : false; - var noTargetGet = options ? !!options.noTargetGet : false; - if (typeof value == "function") { - if (typeof key2 == "string" && !has(value, "name")) hide(value, "name", key2); - enforceInternalState(value).source = TEMPLATE.join(typeof key2 == "string" ? key2 : ""); - } - if (O === global2) { - if (simple) O[key2] = value; - else setGlobal(key2, value); - return; - } else if (!unsafe) { - delete O[key2]; - } else if (!noTargetGet && O[key2]) { - simple = true; - } - if (simple) O[key2] = value; - else hide(O, key2, value); - })(Function.prototype, "toString", function toString() { - return typeof this == "function" && getInternalState(this).source || nativeFunctionToString.call(this); - }); - } - ), - /***/ - "./node_modules/core-js/internals/require-object-coercible.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/core-js/internals/require-object-coercible.js ***! - \********************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - module3.exports = function(it) { - if (it == void 0) throw TypeError("Can't call method on " + it); - return it; - }; - } - ), - /***/ - "./node_modules/core-js/internals/set-global.js": ( - /*!******************************************************!*\ - !*** ./node_modules/core-js/internals/set-global.js ***! - \******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var hide = __webpack_require__( - /*! ../internals/hide */ - "./node_modules/core-js/internals/hide.js" - ); - module3.exports = function(key2, value) { - try { - hide(global2, key2, value); - } catch (error) { - global2[key2] = value; - } - return value; - }; - } - ), - /***/ - "./node_modules/core-js/internals/set-to-string-tag.js": ( - /*!*************************************************************!*\ - !*** ./node_modules/core-js/internals/set-to-string-tag.js ***! - \*************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var defineProperty = __webpack_require__( - /*! ../internals/object-define-property */ - "./node_modules/core-js/internals/object-define-property.js" - ).f; - var has = __webpack_require__( - /*! ../internals/has */ - "./node_modules/core-js/internals/has.js" - ); - var wellKnownSymbol = __webpack_require__( - /*! ../internals/well-known-symbol */ - "./node_modules/core-js/internals/well-known-symbol.js" - ); - var TO_STRING_TAG = wellKnownSymbol("toStringTag"); - module3.exports = function(it, TAG, STATIC) { - if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { - defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); - } - }; - } - ), - /***/ - "./node_modules/core-js/internals/shared-key.js": ( - /*!******************************************************!*\ - !*** ./node_modules/core-js/internals/shared-key.js ***! - \******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var shared = __webpack_require__( - /*! ../internals/shared */ - "./node_modules/core-js/internals/shared.js" - ); - var uid = __webpack_require__( - /*! ../internals/uid */ - "./node_modules/core-js/internals/uid.js" - ); - var keys = shared("keys"); - module3.exports = function(key2) { - return keys[key2] || (keys[key2] = uid(key2)); - }; - } - ), - /***/ - "./node_modules/core-js/internals/shared.js": ( - /*!**************************************************!*\ - !*** ./node_modules/core-js/internals/shared.js ***! - \**************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var setGlobal = __webpack_require__( - /*! ../internals/set-global */ - "./node_modules/core-js/internals/set-global.js" - ); - var IS_PURE = __webpack_require__( - /*! ../internals/is-pure */ - "./node_modules/core-js/internals/is-pure.js" - ); - var SHARED = "__core-js_shared__"; - var store = global2[SHARED] || setGlobal(SHARED, {}); - (module3.exports = function(key2, value) { - return store[key2] || (store[key2] = value !== void 0 ? value : {}); - })("versions", []).push({ - version: "3.1.3", - mode: IS_PURE ? "pure" : "global", - copyright: "\xA9 2019 Denis Pushkarev (zloirock.ru)" - }); - } - ), - /***/ - "./node_modules/core-js/internals/string-at.js": ( - /*!*****************************************************!*\ - !*** ./node_modules/core-js/internals/string-at.js ***! - \*****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var toInteger = __webpack_require__( - /*! ../internals/to-integer */ - "./node_modules/core-js/internals/to-integer.js" - ); - var requireObjectCoercible = __webpack_require__( - /*! ../internals/require-object-coercible */ - "./node_modules/core-js/internals/require-object-coercible.js" - ); - module3.exports = function(that, pos, CONVERT_TO_STRING) { - var S = String(requireObjectCoercible(that)); - var position = toInteger(pos); - var size = S.length; - var first2, second; - if (position < 0 || position >= size) return CONVERT_TO_STRING ? "" : void 0; - first2 = S.charCodeAt(position); - return first2 < 55296 || first2 > 56319 || position + 1 === size || (second = S.charCodeAt(position + 1)) < 56320 || second > 57343 ? CONVERT_TO_STRING ? S.charAt(position) : first2 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first2 - 55296 << 10) + (second - 56320) + 65536; - }; - } - ), - /***/ - "./node_modules/core-js/internals/to-absolute-index.js": ( - /*!*************************************************************!*\ - !*** ./node_modules/core-js/internals/to-absolute-index.js ***! - \*************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var toInteger = __webpack_require__( - /*! ../internals/to-integer */ - "./node_modules/core-js/internals/to-integer.js" - ); - var max = Math.max; - var min = Math.min; - module3.exports = function(index2, length) { - var integer = toInteger(index2); - return integer < 0 ? max(integer + length, 0) : min(integer, length); - }; - } - ), - /***/ - "./node_modules/core-js/internals/to-indexed-object.js": ( - /*!*************************************************************!*\ - !*** ./node_modules/core-js/internals/to-indexed-object.js ***! - \*************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var IndexedObject = __webpack_require__( - /*! ../internals/indexed-object */ - "./node_modules/core-js/internals/indexed-object.js" - ); - var requireObjectCoercible = __webpack_require__( - /*! ../internals/require-object-coercible */ - "./node_modules/core-js/internals/require-object-coercible.js" - ); - module3.exports = function(it) { - return IndexedObject(requireObjectCoercible(it)); - }; - } - ), - /***/ - "./node_modules/core-js/internals/to-integer.js": ( - /*!******************************************************!*\ - !*** ./node_modules/core-js/internals/to-integer.js ***! - \******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - var ceil = Math.ceil; - var floor = Math.floor; - module3.exports = function(argument) { - return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); - }; - } - ), - /***/ - "./node_modules/core-js/internals/to-length.js": ( - /*!*****************************************************!*\ - !*** ./node_modules/core-js/internals/to-length.js ***! - \*****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var toInteger = __webpack_require__( - /*! ../internals/to-integer */ - "./node_modules/core-js/internals/to-integer.js" - ); - var min = Math.min; - module3.exports = function(argument) { - return argument > 0 ? min(toInteger(argument), 9007199254740991) : 0; - }; - } - ), - /***/ - "./node_modules/core-js/internals/to-object.js": ( - /*!*****************************************************!*\ - !*** ./node_modules/core-js/internals/to-object.js ***! - \*****************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var requireObjectCoercible = __webpack_require__( - /*! ../internals/require-object-coercible */ - "./node_modules/core-js/internals/require-object-coercible.js" - ); - module3.exports = function(argument) { - return Object(requireObjectCoercible(argument)); - }; - } - ), - /***/ - "./node_modules/core-js/internals/to-primitive.js": ( - /*!********************************************************!*\ - !*** ./node_modules/core-js/internals/to-primitive.js ***! - \********************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var isObject2 = __webpack_require__( - /*! ../internals/is-object */ - "./node_modules/core-js/internals/is-object.js" - ); - module3.exports = function(it, S) { - if (!isObject2(it)) return it; - var fn, val; - if (S && typeof (fn = it.toString) == "function" && !isObject2(val = fn.call(it))) return val; - if (typeof (fn = it.valueOf) == "function" && !isObject2(val = fn.call(it))) return val; - if (!S && typeof (fn = it.toString) == "function" && !isObject2(val = fn.call(it))) return val; - throw TypeError("Can't convert object to primitive value"); - }; - } - ), - /***/ - "./node_modules/core-js/internals/uid.js": ( - /*!***********************************************!*\ - !*** ./node_modules/core-js/internals/uid.js ***! - \***********************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - var id = 0; - var postfix = Math.random(); - module3.exports = function(key2) { - return "Symbol(".concat(key2 === void 0 ? "" : key2, ")_", (++id + postfix).toString(36)); - }; - } - ), - /***/ - "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js": ( - /*!*******************************************************************************!*\ - !*** ./node_modules/core-js/internals/validate-set-prototype-of-arguments.js ***! - \*******************************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var isObject2 = __webpack_require__( - /*! ../internals/is-object */ - "./node_modules/core-js/internals/is-object.js" - ); - var anObject = __webpack_require__( - /*! ../internals/an-object */ - "./node_modules/core-js/internals/an-object.js" - ); - module3.exports = function(O, proto) { - anObject(O); - if (!isObject2(proto) && proto !== null) { - throw TypeError("Can't set " + String(proto) + " as a prototype"); - } - }; - } - ), - /***/ - "./node_modules/core-js/internals/well-known-symbol.js": ( - /*!*************************************************************!*\ - !*** ./node_modules/core-js/internals/well-known-symbol.js ***! - \*************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var global2 = __webpack_require__( - /*! ../internals/global */ - "./node_modules/core-js/internals/global.js" - ); - var shared = __webpack_require__( - /*! ../internals/shared */ - "./node_modules/core-js/internals/shared.js" - ); - var uid = __webpack_require__( - /*! ../internals/uid */ - "./node_modules/core-js/internals/uid.js" - ); - var NATIVE_SYMBOL = __webpack_require__( - /*! ../internals/native-symbol */ - "./node_modules/core-js/internals/native-symbol.js" - ); - var Symbol2 = global2.Symbol; - var store = shared("wks"); - module3.exports = function(name) { - return store[name] || (store[name] = NATIVE_SYMBOL && Symbol2[name] || (NATIVE_SYMBOL ? Symbol2 : uid)("Symbol." + name)); - }; - } - ), - /***/ - "./node_modules/core-js/modules/es.array.from.js": ( - /*!*******************************************************!*\ - !*** ./node_modules/core-js/modules/es.array.from.js ***! - \*******************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - var $ = __webpack_require__( - /*! ../internals/export */ - "./node_modules/core-js/internals/export.js" - ); - var from = __webpack_require__( - /*! ../internals/array-from */ - "./node_modules/core-js/internals/array-from.js" - ); - var checkCorrectnessOfIteration = __webpack_require__( - /*! ../internals/check-correctness-of-iteration */ - "./node_modules/core-js/internals/check-correctness-of-iteration.js" - ); - var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function(iterable) { - Array.from(iterable); - }); - $({ target: "Array", stat: true, forced: INCORRECT_ITERATION }, { - from - }); - } - ), - /***/ - "./node_modules/core-js/modules/es.string.iterator.js": ( - /*!************************************************************!*\ - !*** ./node_modules/core-js/modules/es.string.iterator.js ***! - \************************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var codePointAt = __webpack_require__( - /*! ../internals/string-at */ - "./node_modules/core-js/internals/string-at.js" - ); - var InternalStateModule = __webpack_require__( - /*! ../internals/internal-state */ - "./node_modules/core-js/internals/internal-state.js" - ); - var defineIterator = __webpack_require__( - /*! ../internals/define-iterator */ - "./node_modules/core-js/internals/define-iterator.js" - ); - var STRING_ITERATOR = "String Iterator"; - var setInternalState = InternalStateModule.set; - var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); - defineIterator(String, "String", function(iterated) { - setInternalState(this, { - type: STRING_ITERATOR, - string: String(iterated), - index: 0 - }); - }, function next() { - var state = getInternalState(this); - var string = state.string; - var index2 = state.index; - var point; - if (index2 >= string.length) return { value: void 0, done: true }; - point = codePointAt(string, index2, true); - state.index += point.length; - return { value: point, done: false }; - }); - } - ), - /***/ - "./node_modules/webpack/buildin/global.js": ( - /*!***********************************!*\ - !*** (webpack)/buildin/global.js ***! - \***********************************/ - /*! no static exports found */ - /***/ - function(module3, exports3) { - var g; - g = /* @__PURE__ */ function() { - return this; - }(); - try { - g = g || Function("return this")() || (1, eval)("this"); - } catch (e) { - if (typeof window === "object") g = window; - } - module3.exports = g; - } - ), - /***/ - "./src/default-attrs.json": ( - /*!********************************!*\ - !*** ./src/default-attrs.json ***! - \********************************/ - /*! exports provided: xmlns, width, height, viewBox, fill, stroke, stroke-width, stroke-linecap, stroke-linejoin, default */ - /***/ - function(module3) { - module3.exports = { "xmlns": "http://www.w3.org/2000/svg", "width": 24, "height": 24, "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round" }; - } - ), - /***/ - "./src/icon.js": ( - /*!*********************!*\ - !*** ./src/icon.js ***! - \*********************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - Object.defineProperty(exports3, "__esModule", { - value: true - }); - var _extends = Object.assign || function(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - target[key2] = source[key2]; - } - } - } - return target; - }; - var _createClass = /* @__PURE__ */ function() { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - return function(Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; - }; - }(); - var _dedupe = __webpack_require__( - /*! classnames/dedupe */ - "./node_modules/classnames/dedupe.js" - ); - var _dedupe2 = _interopRequireDefault(_dedupe); - var _defaultAttrs = __webpack_require__( - /*! ./default-attrs.json */ - "./src/default-attrs.json" - ); - var _defaultAttrs2 = _interopRequireDefault(_defaultAttrs); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } - function _classCallCheck(instance10, Constructor) { - if (!(instance10 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - var Icon = function() { - function Icon2(name, contents) { - var tags = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : []; - _classCallCheck(this, Icon2); - this.name = name; - this.contents = contents; - this.tags = tags; - this.attrs = _extends({}, _defaultAttrs2.default, { class: "feather feather-" + name }); - } - _createClass(Icon2, [{ - key: "toSvg", - value: function toSvg() { - var attrs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - var combinedAttrs = _extends({}, this.attrs, attrs, { class: (0, _dedupe2.default)(this.attrs.class, attrs.class) }); - return "" + this.contents + ""; - } - /** - * Return string representation of an `Icon`. - * - * Added for backward compatibility. If old code expects `feather.icons.` - * to be a string, `toString()` will get implicitly called. - * - * @returns {string} - */ - }, { - key: "toString", - value: function toString() { - return this.contents; - } - }]); - return Icon2; - }(); - function attrsToString(attrs) { - return Object.keys(attrs).map(function(key2) { - return key2 + '="' + attrs[key2] + '"'; - }).join(" "); - } - exports3.default = Icon; - } - ), - /***/ - "./src/icons.js": ( - /*!**********************!*\ - !*** ./src/icons.js ***! - \**********************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - Object.defineProperty(exports3, "__esModule", { - value: true - }); - var _icon = __webpack_require__( - /*! ./icon */ - "./src/icon.js" - ); - var _icon2 = _interopRequireDefault(_icon); - var _icons = __webpack_require__( - /*! ../dist/icons.json */ - "./dist/icons.json" - ); - var _icons2 = _interopRequireDefault(_icons); - var _tags = __webpack_require__( - /*! ./tags.json */ - "./src/tags.json" - ); - var _tags2 = _interopRequireDefault(_tags); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } - exports3.default = Object.keys(_icons2.default).map(function(key2) { - return new _icon2.default(key2, _icons2.default[key2], _tags2.default[key2]); - }).reduce(function(object, icon) { - object[icon.name] = icon; - return object; - }, {}); - } - ), - /***/ - "./src/index.js": ( - /*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - var _icons = __webpack_require__( - /*! ./icons */ - "./src/icons.js" - ); - var _icons2 = _interopRequireDefault(_icons); - var _toSvg = __webpack_require__( - /*! ./to-svg */ - "./src/to-svg.js" - ); - var _toSvg2 = _interopRequireDefault(_toSvg); - var _replace = __webpack_require__( - /*! ./replace */ - "./src/replace.js" - ); - var _replace2 = _interopRequireDefault(_replace); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } - module3.exports = { icons: _icons2.default, toSvg: _toSvg2.default, replace: _replace2.default }; - } - ), - /***/ - "./src/replace.js": ( - /*!************************!*\ - !*** ./src/replace.js ***! - \************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - Object.defineProperty(exports3, "__esModule", { - value: true - }); - var _extends = Object.assign || function(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - target[key2] = source[key2]; - } - } - } - return target; - }; - var _dedupe = __webpack_require__( - /*! classnames/dedupe */ - "./node_modules/classnames/dedupe.js" - ); - var _dedupe2 = _interopRequireDefault(_dedupe); - var _icons = __webpack_require__( - /*! ./icons */ - "./src/icons.js" - ); - var _icons2 = _interopRequireDefault(_icons); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } - function replace() { - var attrs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - if (typeof document === "undefined") { - throw new Error("`feather.replace()` only works in a browser environment."); - } - var elementsToReplace = document.querySelectorAll("[data-feather]"); - Array.from(elementsToReplace).forEach(function(element2) { - return replaceElement(element2, attrs); - }); - } - function replaceElement(element2) { - var attrs = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var elementAttrs = getAttrs(element2); - var name = elementAttrs["data-feather"]; - delete elementAttrs["data-feather"]; - if (_icons2.default[name] === void 0) { - console.warn("feather: '" + name + "' is not a valid icon"); - return; - } - var svgString = _icons2.default[name].toSvg(_extends({}, attrs, elementAttrs, { class: (0, _dedupe2.default)(attrs.class, elementAttrs.class) })); - var svgDocument = new DOMParser().parseFromString(svgString, "image/svg+xml"); - var svgElement = svgDocument.querySelector("svg"); - element2.parentNode.replaceChild(svgElement, element2); - } - function getAttrs(element2) { - return Array.from(element2.attributes).reduce(function(attrs, attr2) { - attrs[attr2.name] = attr2.value; - return attrs; - }, {}); - } - exports3.default = replace; - } - ), - /***/ - "./src/tags.json": ( - /*!***********************!*\ - !*** ./src/tags.json ***! - \***********************/ - /*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, align-center, align-justify, align-left, align-right, anchor, archive, at-sign, award, aperture, bar-chart, bar-chart-2, battery, battery-charging, bell, bell-off, bluetooth, book-open, book, bookmark, box, briefcase, calendar, camera, cast, chevron-down, chevron-up, circle, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-rain, cloud-snow, cloud, codepen, codesandbox, code, coffee, columns, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, cpu, credit-card, crop, crosshair, database, delete, disc, dollar-sign, droplet, edit, edit-2, edit-3, eye, eye-off, external-link, facebook, fast-forward, figma, file-minus, file-plus, file-text, film, filter, flag, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, globe, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, instagram, key, layers, layout, life-buoy, link, link-2, linkedin, list, lock, log-in, log-out, mail, map-pin, map, maximize, maximize-2, meh, menu, message-circle, message-square, mic-off, mic, minimize, minimize-2, minus, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, music, navigation, navigation-2, octagon, package, paperclip, pause, pause-circle, pen-tool, percent, phone-call, phone-forwarded, phone-incoming, phone-missed, phone-off, phone-outgoing, phone, play, pie-chart, play-circle, plus, plus-circle, plus-square, pocket, power, printer, radio, refresh-cw, refresh-ccw, repeat, rewind, rotate-ccw, rotate-cw, rss, save, scissors, search, send, settings, share-2, shield, shield-off, shopping-bag, shopping-cart, shuffle, skip-back, skip-forward, slack, slash, sliders, smartphone, smile, speaker, star, stop-circle, sun, sunrise, sunset, tablet, tag, target, terminal, thermometer, thumbs-down, thumbs-up, toggle-left, toggle-right, tool, trash, trash-2, triangle, truck, tv, twitch, twitter, type, umbrella, unlock, user-check, user-minus, user-plus, user-x, user, users, video-off, video, voicemail, volume, volume-1, volume-2, volume-x, watch, wifi-off, wifi, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, zoom-in, zoom-out, default */ - /***/ - function(module3) { - module3.exports = { "activity": ["pulse", "health", "action", "motion"], "airplay": ["stream", "cast", "mirroring"], "alert-circle": ["warning", "alert", "danger"], "alert-octagon": ["warning", "alert", "danger"], "alert-triangle": ["warning", "alert", "danger"], "align-center": ["text alignment", "center"], "align-justify": ["text alignment", "justified"], "align-left": ["text alignment", "left"], "align-right": ["text alignment", "right"], "anchor": [], "archive": ["index", "box"], "at-sign": ["mention", "at", "email", "message"], "award": ["achievement", "badge"], "aperture": ["camera", "photo"], "bar-chart": ["statistics", "diagram", "graph"], "bar-chart-2": ["statistics", "diagram", "graph"], "battery": ["power", "electricity"], "battery-charging": ["power", "electricity"], "bell": ["alarm", "notification", "sound"], "bell-off": ["alarm", "notification", "silent"], "bluetooth": ["wireless"], "book-open": ["read", "library"], "book": ["read", "dictionary", "booklet", "magazine", "library"], "bookmark": ["read", "clip", "marker", "tag"], "box": ["cube"], "briefcase": ["work", "bag", "baggage", "folder"], "calendar": ["date"], "camera": ["photo"], "cast": ["chromecast", "airplay"], "chevron-down": ["expand"], "chevron-up": ["collapse"], "circle": ["off", "zero", "record"], "clipboard": ["copy"], "clock": ["time", "watch", "alarm"], "cloud-drizzle": ["weather", "shower"], "cloud-lightning": ["weather", "bolt"], "cloud-rain": ["weather"], "cloud-snow": ["weather", "blizzard"], "cloud": ["weather"], "codepen": ["logo"], "codesandbox": ["logo"], "code": ["source", "programming"], "coffee": ["drink", "cup", "mug", "tea", "cafe", "hot", "beverage"], "columns": ["layout"], "command": ["keyboard", "cmd", "terminal", "prompt"], "compass": ["navigation", "safari", "travel", "direction"], "copy": ["clone", "duplicate"], "corner-down-left": ["arrow", "return"], "corner-down-right": ["arrow"], "corner-left-down": ["arrow"], "corner-left-up": ["arrow"], "corner-right-down": ["arrow"], "corner-right-up": ["arrow"], "corner-up-left": ["arrow"], "corner-up-right": ["arrow"], "cpu": ["processor", "technology"], "credit-card": ["purchase", "payment", "cc"], "crop": ["photo", "image"], "crosshair": ["aim", "target"], "database": ["storage", "memory"], "delete": ["remove"], "disc": ["album", "cd", "dvd", "music"], "dollar-sign": ["currency", "money", "payment"], "droplet": ["water"], "edit": ["pencil", "change"], "edit-2": ["pencil", "change"], "edit-3": ["pencil", "change"], "eye": ["view", "watch"], "eye-off": ["view", "watch", "hide", "hidden"], "external-link": ["outbound"], "facebook": ["logo", "social"], "fast-forward": ["music"], "figma": ["logo", "design", "tool"], "file-minus": ["delete", "remove", "erase"], "file-plus": ["add", "create", "new"], "file-text": ["data", "txt", "pdf"], "film": ["movie", "video"], "filter": ["funnel", "hopper"], "flag": ["report"], "folder-minus": ["directory"], "folder-plus": ["directory"], "folder": ["directory"], "framer": ["logo", "design", "tool"], "frown": ["emoji", "face", "bad", "sad", "emotion"], "gift": ["present", "box", "birthday", "party"], "git-branch": ["code", "version control"], "git-commit": ["code", "version control"], "git-merge": ["code", "version control"], "git-pull-request": ["code", "version control"], "github": ["logo", "version control"], "gitlab": ["logo", "version control"], "globe": ["world", "browser", "language", "translate"], "hard-drive": ["computer", "server", "memory", "data"], "hash": ["hashtag", "number", "pound"], "headphones": ["music", "audio", "sound"], "heart": ["like", "love", "emotion"], "help-circle": ["question mark"], "hexagon": ["shape", "node.js", "logo"], "home": ["house", "living"], "image": ["picture"], "inbox": ["email"], "instagram": ["logo", "camera"], "key": ["password", "login", "authentication", "secure"], "layers": ["stack"], "layout": ["window", "webpage"], "life-buoy": ["help", "life ring", "support"], "link": ["chain", "url"], "link-2": ["chain", "url"], "linkedin": ["logo", "social media"], "list": ["options"], "lock": ["security", "password", "secure"], "log-in": ["sign in", "arrow", "enter"], "log-out": ["sign out", "arrow", "exit"], "mail": ["email", "message"], "map-pin": ["location", "navigation", "travel", "marker"], "map": ["location", "navigation", "travel"], "maximize": ["fullscreen"], "maximize-2": ["fullscreen", "arrows", "expand"], "meh": ["emoji", "face", "neutral", "emotion"], "menu": ["bars", "navigation", "hamburger"], "message-circle": ["comment", "chat"], "message-square": ["comment", "chat"], "mic-off": ["record", "sound", "mute"], "mic": ["record", "sound", "listen"], "minimize": ["exit fullscreen", "close"], "minimize-2": ["exit fullscreen", "arrows", "close"], "minus": ["subtract"], "monitor": ["tv", "screen", "display"], "moon": ["dark", "night"], "more-horizontal": ["ellipsis"], "more-vertical": ["ellipsis"], "mouse-pointer": ["arrow", "cursor"], "move": ["arrows"], "music": ["note"], "navigation": ["location", "travel"], "navigation-2": ["location", "travel"], "octagon": ["stop"], "package": ["box", "container"], "paperclip": ["attachment"], "pause": ["music", "stop"], "pause-circle": ["music", "audio", "stop"], "pen-tool": ["vector", "drawing"], "percent": ["discount"], "phone-call": ["ring"], "phone-forwarded": ["call"], "phone-incoming": ["call"], "phone-missed": ["call"], "phone-off": ["call", "mute"], "phone-outgoing": ["call"], "phone": ["call"], "play": ["music", "start"], "pie-chart": ["statistics", "diagram"], "play-circle": ["music", "start"], "plus": ["add", "new"], "plus-circle": ["add", "new"], "plus-square": ["add", "new"], "pocket": ["logo", "save"], "power": ["on", "off"], "printer": ["fax", "office", "device"], "radio": ["signal"], "refresh-cw": ["synchronise", "arrows"], "refresh-ccw": ["arrows"], "repeat": ["loop", "arrows"], "rewind": ["music"], "rotate-ccw": ["arrow"], "rotate-cw": ["arrow"], "rss": ["feed", "subscribe"], "save": ["floppy disk"], "scissors": ["cut"], "search": ["find", "magnifier", "magnifying glass"], "send": ["message", "mail", "email", "paper airplane", "paper aeroplane"], "settings": ["cog", "edit", "gear", "preferences"], "share-2": ["network", "connections"], "shield": ["security", "secure"], "shield-off": ["security", "insecure"], "shopping-bag": ["ecommerce", "cart", "purchase", "store"], "shopping-cart": ["ecommerce", "cart", "purchase", "store"], "shuffle": ["music"], "skip-back": ["music"], "skip-forward": ["music"], "slack": ["logo"], "slash": ["ban", "no"], "sliders": ["settings", "controls"], "smartphone": ["cellphone", "device"], "smile": ["emoji", "face", "happy", "good", "emotion"], "speaker": ["audio", "music"], "star": ["bookmark", "favorite", "like"], "stop-circle": ["media", "music"], "sun": ["brightness", "weather", "light"], "sunrise": ["weather", "time", "morning", "day"], "sunset": ["weather", "time", "evening", "night"], "tablet": ["device"], "tag": ["label"], "target": ["logo", "bullseye"], "terminal": ["code", "command line", "prompt"], "thermometer": ["temperature", "celsius", "fahrenheit", "weather"], "thumbs-down": ["dislike", "bad", "emotion"], "thumbs-up": ["like", "good", "emotion"], "toggle-left": ["on", "off", "switch"], "toggle-right": ["on", "off", "switch"], "tool": ["settings", "spanner"], "trash": ["garbage", "delete", "remove", "bin"], "trash-2": ["garbage", "delete", "remove", "bin"], "triangle": ["delta"], "truck": ["delivery", "van", "shipping", "transport", "lorry"], "tv": ["television", "stream"], "twitch": ["logo"], "twitter": ["logo", "social"], "type": ["text"], "umbrella": ["rain", "weather"], "unlock": ["security"], "user-check": ["followed", "subscribed"], "user-minus": ["delete", "remove", "unfollow", "unsubscribe"], "user-plus": ["new", "add", "create", "follow", "subscribe"], "user-x": ["delete", "remove", "unfollow", "unsubscribe", "unavailable"], "user": ["person", "account"], "users": ["group"], "video-off": ["camera", "movie", "film"], "video": ["camera", "movie", "film"], "voicemail": ["phone"], "volume": ["music", "sound", "mute"], "volume-1": ["music", "sound"], "volume-2": ["music", "sound"], "volume-x": ["music", "sound", "mute"], "watch": ["clock", "time"], "wifi-off": ["disabled"], "wifi": ["connection", "signal", "wireless"], "wind": ["weather", "air"], "x-circle": ["cancel", "close", "delete", "remove", "times", "clear"], "x-octagon": ["delete", "stop", "alert", "warning", "times", "clear"], "x-square": ["cancel", "close", "delete", "remove", "times", "clear"], "x": ["cancel", "close", "delete", "remove", "times", "clear"], "youtube": ["logo", "video", "play"], "zap-off": ["flash", "camera", "lightning"], "zap": ["flash", "camera", "lightning"], "zoom-in": ["magnifying glass"], "zoom-out": ["magnifying glass"] }; - } - ), - /***/ - "./src/to-svg.js": ( - /*!***********************!*\ - !*** ./src/to-svg.js ***! - \***********************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - "use strict"; - Object.defineProperty(exports3, "__esModule", { - value: true - }); - var _icons = __webpack_require__( - /*! ./icons */ - "./src/icons.js" - ); - var _icons2 = _interopRequireDefault(_icons); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } - function toSvg(name) { - var attrs = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead."); - if (!name) { - throw new Error("The required `key` (icon name) parameter is missing."); - } - if (!_icons2.default[name]) { - throw new Error("No icon matching '" + name + "'. See the complete list of icons at https://feathericons.com"); - } - return _icons2.default[name].toSvg(attrs); - } - exports3.default = toSvg; - } - ), - /***/ - 0: ( - /*!**************************************************!*\ - !*** multi core-js/es/array/from ./src/index.js ***! - \**************************************************/ - /*! no static exports found */ - /***/ - function(module3, exports3, __webpack_require__) { - __webpack_require__( - /*! core-js/es/array/from */ - "./node_modules/core-js/es/array/from.js" - ); - module3.exports = __webpack_require__( - /*! /home/runner/work/feather/feather/src/index.js */ - "./src/index.js" - ); - } - ) - /******/ - }) - ); - }); - } -}); - -// src/main.ts -var main_exports = {}; -__export(main_exports, { - default: () => ObsidianGit -}); -module.exports = __toCommonJS(main_exports); -init_polyfill_buffer(); - -// node_modules/.pnpm/isomorphic-git@1.27.1/node_modules/isomorphic-git/index.js -init_polyfill_buffer(); -var import_async_lock = __toESM(require_async_lock(), 1); -var import_sha1 = __toESM(require_sha1(), 1); -var import_crc_32 = __toESM(require_crc32(), 1); -var import_pako = __toESM(require_pako(), 1); -var import_pify = __toESM(require_pify(), 1); -var import_ignore = __toESM(require_ignore(), 1); -var import_clean_git_ref = __toESM(require_lib2(), 1); -var import_diff3 = __toESM(require_diff3(), 1); -var BaseError = class _BaseError extends Error { - constructor(message) { - super(message); - this.caller = ""; - } - toJSON() { - return { - code: this.code, - data: this.data, - caller: this.caller, - message: this.message, - stack: this.stack - }; - } - fromJSON(json) { - const e = new _BaseError(json.message); - e.code = json.code; - e.data = json.data; - e.caller = json.caller; - e.stack = json.stack; - return e; - } - get isIsomorphicGitError() { - return true; - } -}; -var UnmergedPathsError = class _UnmergedPathsError extends BaseError { - /** - * @param {Array} filepaths - */ - constructor(filepaths) { - super( - `Modifying the index is not possible because you have unmerged files: ${filepaths.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 = _UnmergedPathsError.code; - this.data = { filepaths }; - } -}; -UnmergedPathsError.code = "UnmergedPathsError"; -var InternalError = class _InternalError extends BaseError { - /** - * @param {string} message - */ - constructor(message) { - super( - `An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${message}` - ); - this.code = this.name = _InternalError.code; - this.data = { message }; - } -}; -InternalError.code = "InternalError"; -var UnsafeFilepathError = class _UnsafeFilepathError extends BaseError { - /** - * @param {string} filepath - */ - constructor(filepath) { - super(`The filepath "${filepath}" contains unsafe character sequences`); - this.code = this.name = _UnsafeFilepathError.code; - this.data = { filepath }; - } -}; -UnsafeFilepathError.code = "UnsafeFilepathError"; -var BufferCursor = class { - constructor(buffer2) { - this.buffer = buffer2; - this._start = 0; - } - eof() { - return this._start >= this.buffer.length; - } - tell() { - return this._start; - } - seek(n) { - this._start = n; - } - slice(n) { - const r = this.buffer.slice(this._start, this._start + n); - this._start += n; - return r; - } - toString(enc, length) { - const r = this.buffer.toString(enc, this._start, this._start + length); - this._start += length; - return r; - } - write(value, length, enc) { - const r = this.buffer.write(value, this._start, length, enc); - this._start += length; - return r; - } - copy(source, start, end) { - const r = source.copy(this.buffer, this._start, start, end); - this._start += r; - return r; - } - readUInt8() { - const r = this.buffer.readUInt8(this._start); - this._start += 1; - return r; - } - writeUInt8(value) { - const r = this.buffer.writeUInt8(value, this._start); - this._start += 1; - return r; - } - readUInt16BE() { - const r = this.buffer.readUInt16BE(this._start); - this._start += 2; - return r; - } - writeUInt16BE(value) { - const r = this.buffer.writeUInt16BE(value, this._start); - this._start += 2; - return r; - } - readUInt32BE() { - const r = this.buffer.readUInt32BE(this._start); - this._start += 4; - return r; - } - writeUInt32BE(value) { - const r = this.buffer.writeUInt32BE(value, this._start); - this._start += 4; - return r; - } -}; -function compareStrings(a, b) { - return -(a < b) || +(a > b); -} -function comparePath(a, b) { - return compareStrings(a.path, b.path); -} -function normalizeMode(mode) { - let type = mode > 0 ? mode >> 12 : 0; - if (type !== 4 && type !== 8 && type !== 10 && type !== 14) { - type = 8; - } - let permissions = mode & 511; - if (permissions & 73) { - permissions = 493; - } else { - permissions = 420; - } - if (type !== 8) permissions = 0; - return (type << 12) + permissions; -} -var MAX_UINT32 = 2 ** 32; -function SecondsNanoseconds(givenSeconds, givenNanoseconds, milliseconds, date) { - if (givenSeconds !== void 0 && givenNanoseconds !== void 0) { - return [givenSeconds, givenNanoseconds]; - } - if (milliseconds === void 0) { - milliseconds = date.valueOf(); - } - const seconds = Math.floor(milliseconds / 1e3); - const nanoseconds = (milliseconds - seconds * 1e3) * 1e6; - return [seconds, nanoseconds]; -} -function normalizeStats(e) { - const [ctimeSeconds, ctimeNanoseconds] = SecondsNanoseconds( - e.ctimeSeconds, - e.ctimeNanoseconds, - e.ctimeMs, - e.ctime - ); - const [mtimeSeconds, mtimeNanoseconds] = SecondsNanoseconds( - e.mtimeSeconds, - e.mtimeNanoseconds, - e.mtimeMs, - e.mtime - ); - return { - ctimeSeconds: ctimeSeconds % MAX_UINT32, - ctimeNanoseconds: ctimeNanoseconds % MAX_UINT32, - mtimeSeconds: mtimeSeconds % MAX_UINT32, - mtimeNanoseconds: mtimeNanoseconds % MAX_UINT32, - dev: e.dev % MAX_UINT32, - ino: e.ino % MAX_UINT32, - mode: normalizeMode(e.mode % MAX_UINT32), - uid: e.uid % MAX_UINT32, - gid: e.gid % MAX_UINT32, - // size of -1 happens over a BrowserFS HTTP Backend that doesn't serve Content-Length headers - // (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat - size: e.size > -1 ? e.size % MAX_UINT32 : 0 - }; -} -function toHex(buffer2) { - let hex = ""; - for (const byte of new Uint8Array(buffer2)) { - if (byte < 16) hex += "0"; - hex += byte.toString(16); - } - return hex; -} -var supportsSubtleSHA1 = null; -async function shasum(buffer2) { - if (supportsSubtleSHA1 === null) { - supportsSubtleSHA1 = await testSubtleSHA1(); - } - return supportsSubtleSHA1 ? subtleSHA1(buffer2) : shasumSync(buffer2); -} -function shasumSync(buffer2) { - return new import_sha1.default().update(buffer2).digest("hex"); -} -async function subtleSHA1(buffer2) { - const hash2 = await crypto.subtle.digest("SHA-1", buffer2); - return toHex(hash2); -} -async function testSubtleSHA1() { - try { - const hash2 = await subtleSHA1(new Uint8Array([])); - if (hash2 === "da39a3ee5e6b4b0d3255bfef95601890afd80709") return true; - } catch (_) { - } - return false; -} -function parseCacheEntryFlags(bits) { - return { - assumeValid: Boolean(bits & 32768), - extended: Boolean(bits & 16384), - stage: (bits & 12288) >> 12, - nameLength: bits & 4095 - }; -} -function renderCacheEntryFlags(entry) { - const flags = entry.flags; - flags.extended = false; - flags.nameLength = Math.min(Buffer.from(entry.path).length, 4095); - return (flags.assumeValid ? 32768 : 0) + (flags.extended ? 16384 : 0) + ((flags.stage & 3) << 12) + (flags.nameLength & 4095); -} -var GitIndex = class _GitIndex { - /*:: - _entries: Map - _dirty: boolean // Used to determine if index needs to be saved to filesystem - */ - constructor(entries, unmergedPaths) { - this._dirty = false; - this._unmergedPaths = unmergedPaths || /* @__PURE__ */ new Set(); - this._entries = entries || /* @__PURE__ */ new Map(); - } - _addEntry(entry) { - if (entry.flags.stage === 0) { - entry.stages = [entry]; - this._entries.set(entry.path, entry); - this._unmergedPaths.delete(entry.path); - } else { - let existingEntry = this._entries.get(entry.path); - if (!existingEntry) { - this._entries.set(entry.path, entry); - existingEntry = entry; - } - existingEntry.stages[entry.flags.stage] = entry; - this._unmergedPaths.add(entry.path); - } - } - static async from(buffer2) { - if (Buffer.isBuffer(buffer2)) { - return _GitIndex.fromBuffer(buffer2); - } else if (buffer2 === null) { - return new _GitIndex(null); - } else { - throw new InternalError("invalid type passed to GitIndex.from"); - } - } - static async fromBuffer(buffer2) { - if (buffer2.length === 0) { - throw new InternalError("Index file is empty (.git/index)"); - } - const index2 = new _GitIndex(); - const reader = new BufferCursor(buffer2); - const magic = reader.toString("utf8", 4); - if (magic !== "DIRC") { - throw new InternalError(`Invalid dircache magic file number: ${magic}`); - } - const shaComputed = await shasum(buffer2.slice(0, -20)); - const shaClaimed = buffer2.slice(-20).toString("hex"); - if (shaClaimed !== shaComputed) { - throw new InternalError( - `Invalid checksum in GitIndex buffer: expected ${shaClaimed} but saw ${shaComputed}` - ); - } - const version2 = reader.readUInt32BE(); - if (version2 !== 2) { - throw new InternalError(`Unsupported dircache version: ${version2}`); - } - const numEntries = reader.readUInt32BE(); - let i = 0; - while (!reader.eof() && i < numEntries) { - const entry = {}; - entry.ctimeSeconds = reader.readUInt32BE(); - entry.ctimeNanoseconds = reader.readUInt32BE(); - entry.mtimeSeconds = reader.readUInt32BE(); - entry.mtimeNanoseconds = reader.readUInt32BE(); - entry.dev = reader.readUInt32BE(); - entry.ino = reader.readUInt32BE(); - entry.mode = reader.readUInt32BE(); - entry.uid = reader.readUInt32BE(); - entry.gid = reader.readUInt32BE(); - entry.size = reader.readUInt32BE(); - entry.oid = reader.slice(20).toString("hex"); - const flags = reader.readUInt16BE(); - entry.flags = parseCacheEntryFlags(flags); - const pathlength = buffer2.indexOf(0, reader.tell() + 1) - reader.tell(); - if (pathlength < 1) { - throw new InternalError(`Got a path length of: ${pathlength}`); - } - entry.path = reader.toString("utf8", pathlength); - if (entry.path.includes("..\\") || entry.path.includes("../")) { - throw new UnsafeFilepathError(entry.path); - } - let padding = 8 - (reader.tell() - 12) % 8; - if (padding === 0) padding = 8; - while (padding--) { - const tmp = reader.readUInt8(); - if (tmp !== 0) { - throw new InternalError( - `Expected 1-8 null characters but got '${tmp}' after ${entry.path}` - ); - } else if (reader.eof()) { - throw new InternalError("Unexpected end of file"); - } - } - entry.stages = []; - index2._addEntry(entry); - i++; - } - return index2; - } - get unmergedPaths() { - return [...this._unmergedPaths]; - } - get entries() { - return [...this._entries.values()].sort(comparePath); - } - get entriesMap() { - return this._entries; - } - get entriesFlat() { - return [...this.entries].flatMap((entry) => { - return entry.stages.length > 1 ? entry.stages.filter((x) => x) : entry; - }); - } - *[Symbol.iterator]() { - for (const entry of this.entries) { - yield entry; - } - } - insert({ filepath, stats, oid, stage = 0 }) { - if (!stats) { - stats = { - ctimeSeconds: 0, - ctimeNanoseconds: 0, - mtimeSeconds: 0, - mtimeNanoseconds: 0, - dev: 0, - ino: 0, - mode: 0, - uid: 0, - gid: 0, - size: 0 - }; - } - stats = normalizeStats(stats); - const bfilepath = Buffer.from(filepath); - const entry = { - ctimeSeconds: stats.ctimeSeconds, - ctimeNanoseconds: stats.ctimeNanoseconds, - mtimeSeconds: stats.mtimeSeconds, - mtimeNanoseconds: stats.mtimeNanoseconds, - dev: stats.dev, - ino: stats.ino, - // We provide a fallback value for `mode` here because not all fs - // implementations assign it, but we use it in GitTree. - // '100644' is for a "regular non-executable file" - mode: stats.mode || 33188, - uid: stats.uid, - gid: stats.gid, - size: stats.size, - path: filepath, - oid, - flags: { - assumeValid: false, - extended: false, - stage, - nameLength: bfilepath.length < 4095 ? bfilepath.length : 4095 - }, - stages: [] - }; - this._addEntry(entry); - this._dirty = true; - } - delete({ filepath }) { - if (this._entries.has(filepath)) { - this._entries.delete(filepath); - } else { - for (const key2 of this._entries.keys()) { - if (key2.startsWith(filepath + "/")) { - this._entries.delete(key2); - } - } - } - if (this._unmergedPaths.has(filepath)) { - this._unmergedPaths.delete(filepath); - } - this._dirty = true; - } - clear() { - this._entries.clear(); - this._dirty = true; - } - has({ filepath }) { - return this._entries.has(filepath); - } - render() { - return this.entries.map((entry) => `${entry.mode.toString(8)} ${entry.oid} ${entry.path}`).join("\n"); - } - static async _entryToBuffer(entry) { - const bpath = Buffer.from(entry.path); - const length = Math.ceil((62 + bpath.length + 1) / 8) * 8; - const written = Buffer.alloc(length); - const writer = new BufferCursor(written); - const stat = normalizeStats(entry); - writer.writeUInt32BE(stat.ctimeSeconds); - writer.writeUInt32BE(stat.ctimeNanoseconds); - writer.writeUInt32BE(stat.mtimeSeconds); - writer.writeUInt32BE(stat.mtimeNanoseconds); - writer.writeUInt32BE(stat.dev); - writer.writeUInt32BE(stat.ino); - writer.writeUInt32BE(stat.mode); - writer.writeUInt32BE(stat.uid); - writer.writeUInt32BE(stat.gid); - writer.writeUInt32BE(stat.size); - writer.write(entry.oid, 20, "hex"); - writer.writeUInt16BE(renderCacheEntryFlags(entry)); - writer.write(entry.path, bpath.length, "utf8"); - return written; - } - async toObject() { - const header = Buffer.alloc(12); - const writer = new BufferCursor(header); - writer.write("DIRC", 4, "utf8"); - writer.writeUInt32BE(2); - writer.writeUInt32BE(this.entriesFlat.length); - let entryBuffers = []; - for (const entry of this.entries) { - entryBuffers.push(_GitIndex._entryToBuffer(entry)); - if (entry.stages.length > 1) { - for (const stage of entry.stages) { - if (stage && stage !== entry) { - entryBuffers.push(_GitIndex._entryToBuffer(stage)); - } - } - } - } - entryBuffers = await Promise.all(entryBuffers); - const body = Buffer.concat(entryBuffers); - const main = Buffer.concat([header, body]); - const sum = await shasum(main); - return Buffer.concat([main, Buffer.from(sum, "hex")]); - } -}; -function compareStats(entry, stats, filemode = true, trustino = true) { - const e = normalizeStats(entry); - const s = normalizeStats(stats); - const staleness = filemode && e.mode !== s.mode || e.mtimeSeconds !== s.mtimeSeconds || e.ctimeSeconds !== s.ctimeSeconds || e.uid !== s.uid || e.gid !== s.gid || trustino && e.ino !== s.ino || e.size !== s.size; - return staleness; -} -var lock = null; -var IndexCache = Symbol("IndexCache"); -function createCache() { - return { - map: /* @__PURE__ */ new Map(), - stats: /* @__PURE__ */ new Map() - }; -} -async function updateCachedIndexFile(fs, filepath, cache) { - const stat = await fs.lstat(filepath); - const rawIndexFile = await fs.read(filepath); - const index2 = await GitIndex.from(rawIndexFile); - cache.map.set(filepath, index2); - cache.stats.set(filepath, stat); -} -async function isIndexStale(fs, filepath, cache) { - const savedStats = cache.stats.get(filepath); - if (savedStats === void 0) return true; - const currStats = await fs.lstat(filepath); - if (savedStats === null) return false; - if (currStats === null) return false; - return compareStats(savedStats, currStats); -} -var GitIndexManager = class { - /** - * - * @param {object} opts - * @param {import('../models/FileSystem.js').FileSystem} opts.fs - * @param {string} opts.gitdir - * @param {object} opts.cache - * @param {bool} opts.allowUnmerged - * @param {function(GitIndex): any} closure - */ - static async acquire({ fs, gitdir, cache, allowUnmerged = true }, closure) { - if (!cache[IndexCache]) cache[IndexCache] = createCache(); - const filepath = `${gitdir}/index`; - if (lock === null) lock = new import_async_lock.default({ maxPending: Infinity }); - let result; - let unmergedPaths = []; - await lock.acquire(filepath, async () => { - if (await isIndexStale(fs, filepath, cache[IndexCache])) { - await updateCachedIndexFile(fs, filepath, cache[IndexCache]); - } - const index2 = cache[IndexCache].map.get(filepath); - unmergedPaths = index2.unmergedPaths; - if (unmergedPaths.length && !allowUnmerged) - throw new UnmergedPathsError(unmergedPaths); - result = await closure(index2); - if (index2._dirty) { - const buffer2 = await index2.toObject(); - await fs.write(filepath, buffer2); - cache[IndexCache].stats.set(filepath, await fs.lstat(filepath)); - index2._dirty = false; - } - }); - return result; - } -}; -function basename(path2) { - const last2 = Math.max(path2.lastIndexOf("/"), path2.lastIndexOf("\\")); - if (last2 > -1) { - path2 = path2.slice(last2 + 1); - } - return path2; -} -function dirname(path2) { - const last2 = Math.max(path2.lastIndexOf("/"), path2.lastIndexOf("\\")); - if (last2 === -1) return "."; - if (last2 === 0) return "/"; - return path2.slice(0, last2); -} -function flatFileListToDirectoryStructure(files) { - const inodes = /* @__PURE__ */ new Map(); - const mkdir = function(name) { - if (!inodes.has(name)) { - const dir = { - type: "tree", - fullpath: name, - basename: basename(name), - metadata: {}, - children: [] - }; - inodes.set(name, dir); - dir.parent = mkdir(dirname(name)); - if (dir.parent && dir.parent !== dir) dir.parent.children.push(dir); - } - return inodes.get(name); - }; - const mkfile = function(name, metadata) { - if (!inodes.has(name)) { - const file = { - type: "blob", - fullpath: name, - basename: basename(name), - metadata, - // This recursively generates any missing parent folders. - parent: mkdir(dirname(name)), - children: [] - }; - if (file.parent) file.parent.children.push(file); - inodes.set(name, file); - } - return inodes.get(name); - }; - mkdir("."); - for (const file of files) { - mkfile(file.path, file); - } - return inodes; -} -function mode2type(mode) { - switch (mode) { - case 16384: - return "tree"; - case 33188: - return "blob"; - case 33261: - return "blob"; - case 40960: - return "blob"; - case 57344: - return "commit"; - } - throw new InternalError(`Unexpected GitTree entry mode: ${mode.toString(8)}`); -} -var GitWalkerIndex = class { - constructor({ fs, gitdir, cache }) { - this.treePromise = GitIndexManager.acquire( - { fs, gitdir, cache }, - async function(index2) { - return flatFileListToDirectoryStructure(index2.entries); - } - ); - const walker = this; - this.ConstructEntry = class StageEntry { - constructor(fullpath) { - this._fullpath = fullpath; - this._type = false; - this._mode = false; - this._stat = false; - this._oid = false; - } - async type() { - return walker.type(this); - } - async mode() { - return walker.mode(this); - } - async stat() { - return walker.stat(this); - } - async content() { - return walker.content(this); - } - async oid() { - return walker.oid(this); - } - }; - } - async readdir(entry) { - const filepath = entry._fullpath; - const tree = await this.treePromise; - const inode = tree.get(filepath); - if (!inode) return null; - if (inode.type === "blob") return null; - if (inode.type !== "tree") { - throw new Error(`ENOTDIR: not a directory, scandir '${filepath}'`); - } - const names = inode.children.map((inode2) => inode2.fullpath); - names.sort(compareStrings); - return names; - } - async type(entry) { - if (entry._type === false) { - await entry.stat(); - } - return entry._type; - } - async mode(entry) { - if (entry._mode === false) { - await entry.stat(); - } - return entry._mode; - } - async stat(entry) { - if (entry._stat === false) { - const tree = await this.treePromise; - const inode = tree.get(entry._fullpath); - if (!inode) { - throw new Error( - `ENOENT: no such file or directory, lstat '${entry._fullpath}'` - ); - } - const stats = inode.type === "tree" ? {} : normalizeStats(inode.metadata); - entry._type = inode.type === "tree" ? "tree" : mode2type(stats.mode); - entry._mode = stats.mode; - if (inode.type === "tree") { - entry._stat = void 0; - } else { - entry._stat = stats; - } - } - return entry._stat; - } - async content(_entry) { - } - async oid(entry) { - if (entry._oid === false) { - const tree = await this.treePromise; - const inode = tree.get(entry._fullpath); - entry._oid = inode.metadata.oid; - } - return entry._oid; - } -}; -var GitWalkSymbol = Symbol("GitWalkSymbol"); -function STAGE() { - const o = /* @__PURE__ */ Object.create(null); - Object.defineProperty(o, GitWalkSymbol, { - value: function({ fs, gitdir, cache }) { - return new GitWalkerIndex({ fs, gitdir, cache }); - } - }); - Object.freeze(o); - return o; -} -var NotFoundError = class _NotFoundError extends BaseError { - /** - * @param {string} what - */ - constructor(what) { - super(`Could not find ${what}.`); - this.code = this.name = _NotFoundError.code; - this.data = { what }; - } -}; -NotFoundError.code = "NotFoundError"; -var ObjectTypeError = class _ObjectTypeError extends BaseError { - /** - * @param {string} oid - * @param {'blob'|'commit'|'tag'|'tree'} actual - * @param {'blob'|'commit'|'tag'|'tree'} expected - * @param {string} [filepath] - */ - constructor(oid, actual, expected, filepath) { - super( - `Object ${oid} ${filepath ? `at ${filepath}` : ""}was anticipated to be a ${expected} but it is a ${actual}.` - ); - this.code = this.name = _ObjectTypeError.code; - this.data = { oid, actual, expected, filepath }; - } -}; -ObjectTypeError.code = "ObjectTypeError"; -var InvalidOidError = class _InvalidOidError extends BaseError { - /** - * @param {string} value - */ - constructor(value) { - super(`Expected a 40-char hex object id but saw "${value}".`); - this.code = this.name = _InvalidOidError.code; - this.data = { value }; - } -}; -InvalidOidError.code = "InvalidOidError"; -var NoRefspecError = class _NoRefspecError extends BaseError { - /** - * @param {string} remote - */ - constructor(remote) { - super(`Could not find a fetch refspec for remote "${remote}". Make sure the config file has an entry like the following: -[remote "${remote}"] +var Jk=Object.create;var Ca=Object.defineProperty;var Qk=Object.getOwnPropertyDescriptor;var eA=Object.getOwnPropertyNames;var tA=Object.getPrototypeOf,nA=Object.prototype.hasOwnProperty;var rA=(t,e,n)=>e in t?Ca(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var iA=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),aA=(t,e)=>{for(var n in e)Ca(t,n,{get:e[n],enumerable:!0})},om=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eA(e))!nA.call(t,i)&&i!==n&&Ca(t,i,{get:()=>e[i],enumerable:!(r=Qk(e,i))||r.enumerable});return t};var Ze=(t,e,n)=>(n=t!=null?Jk(tA(t)):{},om(e||!t||!t.__esModule?Ca(n,"default",{value:t,enumerable:!0}):n,t)),sA=t=>om(Ca({},"__esModule",{value:!0}),t);var ct=(t,e,n)=>rA(t,typeof e!="symbol"?e+"":e,n);var um=R(co=>{"use strict";v();co.byteLength=lA;co.toByteArray=uA;co.fromByteArray=dA;var vn=[],Zt=[],oA=typeof Uint8Array!="undefined"?Uint8Array:Array,pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tr=0,lm=pu.length;Tr0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function lA(t){var e=cm(t),n=e[0],r=e[1];return(n+r)*3/4-r}function cA(t,e,n){return(e+n)*3/4-n}function uA(t){var e,n=cm(t),r=n[0],i=n[1],a=new oA(cA(t,r,i)),s=0,o=i>0?r-4:r,l;for(l=0;l>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Zt[t.charCodeAt(l)]<<2|Zt[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Zt[t.charCodeAt(l)]<<10|Zt[t.charCodeAt(l+1)]<<4|Zt[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function fA(t){return vn[t>>18&63]+vn[t>>12&63]+vn[t>>6&63]+vn[t&63]}function hA(t,e,n){for(var r,i=[],a=e;ao?o:s+a));return r===1?(e=t[n-1],i.push(vn[e>>2]+vn[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(vn[e>>10]+vn[e>>4&63]+vn[e<<2&63]+"=")),i.join("")}});var fm=R(mu=>{v();mu.read=function(t,e,n,r,i){var a,s,o=i*8-r-1,l=(1<>1,u=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-u)-1,d>>=-u,u+=o;u>0;a=a*256+t[e+f],f+=h,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=r;u>0;s=s*256+t[e+f],f+=h,u-=8);if(a===0)a=1-c;else{if(a===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-c}return(d?-1:1)*s*Math.pow(2,a-r)};mu.write=function(t,e,n,r,i,a){var s,o,l,c=a*8-i-1,u=(1<>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?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,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=o&255,d+=p,o/=256,i-=8);for(s=s<0;t[n+d]=s&255,d+=p,s/=256,c-=8);t[n+d-p]|=g*128}});var Eu=R(ui=>{"use strict";v();var gu=um(),li=fm(),hm=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ui.Buffer=P;ui.SlowBuffer=wA;ui.INSPECT_MAX_BYTES=50;var uo=2147483647;ui.kMaxLength=uo;P.TYPED_ARRAY_SUPPORT=pA();!P.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 pA(){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(P.prototype,"parent",{enumerable:!0,get:function(){if(P.isBuffer(this))return this.buffer}});Object.defineProperty(P.prototype,"offset",{enumerable:!0,get:function(){if(P.isBuffer(this))return this.byteOffset}});function Ln(t){if(t>uo)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,P.prototype),e}function P(t,e,n){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bu(t)}return gm(t,e,n)}P.poolSize=8192;function gm(t,e,n){if(typeof t=="string")return gA(t,e);if(ArrayBuffer.isView(t))return yA(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(wn(t,ArrayBuffer)||t&&wn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(wn(t,SharedArrayBuffer)||t&&wn(t.buffer,SharedArrayBuffer)))return vu(t,e,n);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return P.from(r,e,n);let i=vA(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return P.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}P.from=function(t,e,n){return gm(t,e,n)};Object.setPrototypeOf(P.prototype,Uint8Array.prototype);Object.setPrototypeOf(P,Uint8Array);function ym(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 mA(t,e,n){return ym(t),t<=0?Ln(t):e!==void 0?typeof n=="string"?Ln(t).fill(e,n):Ln(t).fill(e):Ln(t)}P.alloc=function(t,e,n){return mA(t,e,n)};function bu(t){return ym(t),Ln(t<0?0:xu(t)|0)}P.allocUnsafe=function(t){return bu(t)};P.allocUnsafeSlow=function(t){return bu(t)};function gA(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!P.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=vm(t,e)|0,r=Ln(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function yu(t){let e=t.length<0?0:xu(t.length)|0,n=Ln(e);for(let r=0;r=uo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+uo.toString(16)+" bytes");return t|0}function wA(t){return+t!=t&&(t=0),P.alloc(+t)}P.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==P.prototype};P.compare=function(e,n){if(wn(e,Uint8Array)&&(e=P.from(e,e.offset,e.byteLength)),wn(n,Uint8Array)&&(n=P.from(n,n.offset,n.byteLength)),!P.isBuffer(e)||!P.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===n)return 0;let r=e.length,i=n.length;for(let a=0,s=Math.min(r,i);ai.length?(P.isBuffer(s)||(s=P.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(P.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function vm(t,e){if(P.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||wn(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 n=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return wu(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Tm(t).length;default:if(i)return r?-1:wu(t).length;e=(""+e).toLowerCase(),i=!0}}P.byteLength=vm;function bA(t,e,n){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return MA(this,e,n);case"utf8":case"utf-8":return bm(this,e,n);case"ascii":return CA(this,e,n);case"latin1":case"binary":return FA(this,e,n);case"base64":return AA(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return OA(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}P.prototype._isBuffer=!0;function Cr(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}P.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 n=0;nn&&(e+=" ... "),""};hm&&(P.prototype[hm]=P.prototype.inspect);P.prototype.compare=function(e,n,r,i,a){if(wn(e,Uint8Array)&&(e=P.from(e,e.offset,e.byteLength)),!P.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(n===void 0&&(n=0),r===void 0&&(r=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),n<0||r>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&n>=r)return 0;if(i>=a)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,a>>>=0,this===e)return 0;let s=a-i,o=r-n,l=Math.min(s,o),c=this.slice(i,a),u=e.slice(n,r);for(let f=0;f2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Su(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof e=="string"&&(e=P.from(e,r)),P.isBuffer(e))return e.length===0?-1:dm(t,e,n,r,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):dm(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function dm(t,e,n,r,i){let a=1,s=t.length,o=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;a=2,s/=2,o/=2,n/=2}function l(u,f){return a===1?u[f]:u.readUInt16BE(f*a)}let c;if(i){let u=-1;for(c=n;cs&&(n=s-o),c=n;c>=0;c--){let u=!0;for(let f=0;fi&&(r=i)):r=i;let a=e.length;r>a/2&&(r=a/2);let s;for(s=0;s>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-n;if((r===void 0||r>a)&&(r=a),e.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return xA(this,e,n,r);case"utf8":case"utf-8":return _A(this,e,n,r);case"ascii":case"latin1":case"binary":return SA(this,e,n,r);case"base64":return EA(this,e,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kA(this,e,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};P.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function AA(t,e,n){return e===0&&n===t.length?gu.fromByteArray(t):gu.fromByteArray(t.slice(e,n))}function bm(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i239?4:a>223?3:a>191?2:1;if(i+o<=n){let l,c,u,f;switch(o){case 1:a<128&&(s=a);break;case 2:l=t[i+1],(l&192)===128&&(f=(a&31)<<6|l&63,f>127&&(s=f));break;case 3:l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(f=(a&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(a&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=o}return TA(r)}var pm=4096;function TA(t){let e=t.length;if(e<=pm)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr)&&(n=r);let i="";for(let a=e;ar&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),nn)throw new RangeError("Trying to access beyond buffer length")}P.prototype.readUintLE=P.prototype.readUIntLE=function(e,n,r){e=e>>>0,n=n>>>0,r||ut(e,n,this.length);let i=this[e],a=1,s=0;for(;++s>>0,n=n>>>0,r||ut(e,n,this.length);let i=this[e+--n],a=1;for(;n>0&&(a*=256);)i+=this[e+--n]*a;return i};P.prototype.readUint8=P.prototype.readUInt8=function(e,n){return e=e>>>0,n||ut(e,1,this.length),this[e]};P.prototype.readUint16LE=P.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||ut(e,2,this.length),this[e]|this[e+1]<<8};P.prototype.readUint16BE=P.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||ut(e,2,this.length),this[e]<<8|this[e+1]};P.prototype.readUint32LE=P.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};P.prototype.readUint32BE=P.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};P.prototype.readBigUInt64LE=Kn(function(e){e=e>>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=n+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(i)+(BigInt(a)<>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=n*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(i)<>>0,n=n>>>0,r||ut(e,n,this.length);let i=this[e],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*n)),i};P.prototype.readIntBE=function(e,n,r){e=e>>>0,n=n>>>0,r||ut(e,n,this.length);let i=n,a=1,s=this[e+--i];for(;i>0&&(a*=256);)s+=this[e+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*n)),s};P.prototype.readInt8=function(e,n){return e=e>>>0,n||ut(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};P.prototype.readInt16LE=function(e,n){e=e>>>0,n||ut(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};P.prototype.readInt16BE=function(e,n){e=e>>>0,n||ut(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};P.prototype.readInt32LE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};P.prototype.readInt32BE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};P.prototype.readBigInt64LE=Kn(function(e){e=e>>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(i)<>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=(n<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,n||ut(e,4,this.length),li.read(this,e,!0,23,4)};P.prototype.readFloatBE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),li.read(this,e,!1,23,4)};P.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||ut(e,8,this.length),li.read(this,e,!0,52,8)};P.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||ut(e,8,this.length),li.read(this,e,!1,52,8)};function Mt(t,e,n,r,i,a){if(!P.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}P.prototype.writeUintLE=P.prototype.writeUIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Mt(this,e,n,r,o,0)}let a=1,s=0;for(this[n]=e&255;++s>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Mt(this,e,n,r,o,0)}let a=r-1,s=1;for(this[n+a]=e&255;--a>=0&&(s*=256);)this[n+a]=e/s&255;return n+r};P.prototype.writeUint8=P.prototype.writeUInt8=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,1,255,0),this[n]=e&255,n+1};P.prototype.writeUint16LE=P.prototype.writeUInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2};P.prototype.writeUint16BE=P.prototype.writeUInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2};P.prototype.writeUint32LE=P.prototype.writeUInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4};P.prototype.writeUint32BE=P.prototype.writeUInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function xm(t,e,n,r,i){Am(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,n}function _m(t,e,n,r,i){Am(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n+7]=a,a=a>>8,t[n+6]=a,a=a>>8,t[n+5]=a,a=a>>8,t[n+4]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s=s>>8,t[n+2]=s,s=s>>8,t[n+1]=s,s=s>>8,t[n]=s,n+8}P.prototype.writeBigUInt64LE=Kn(function(e,n=0){return xm(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});P.prototype.writeBigUInt64BE=Kn(function(e,n=0){return _m(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});P.prototype.writeIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Mt(this,e,n,r,l-1,-l)}let a=0,s=1,o=0;for(this[n]=e&255;++a>0)-o&255;return n+r};P.prototype.writeIntBE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Mt(this,e,n,r,l-1,-l)}let a=r-1,s=1,o=0;for(this[n+a]=e&255;--a>=0&&(s*=256);)e<0&&o===0&&this[n+a+1]!==0&&(o=1),this[n+a]=(e/s>>0)-o&255;return n+r};P.prototype.writeInt8=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1};P.prototype.writeInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2};P.prototype.writeInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2};P.prototype.writeInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4};P.prototype.writeInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};P.prototype.writeBigInt64LE=Kn(function(e,n=0){return xm(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});P.prototype.writeBigInt64BE=Kn(function(e,n=0){return _m(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Sm(t,e,n,r,i,a){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Em(t,e,n,r,i){return e=+e,n=n>>>0,i||Sm(t,e,n,4,34028234663852886e22,-34028234663852886e22),li.write(t,e,n,r,23,4),n+4}P.prototype.writeFloatLE=function(e,n,r){return Em(this,e,n,!0,r)};P.prototype.writeFloatBE=function(e,n,r){return Em(this,e,n,!1,r)};function km(t,e,n,r,i){return e=+e,n=n>>>0,i||Sm(t,e,n,8,17976931348623157e292,-17976931348623157e292),li.write(t,e,n,r,52,8),n+8}P.prototype.writeDoubleLE=function(e,n,r){return km(this,e,n,!0,r)};P.prototype.writeDoubleBE=function(e,n,r){return km(this,e,n,!1,r)};P.prototype.copy=function(e,n,r,i){if(!P.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),n>=e.length&&(n=e.length),n||(n=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-n>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let a;if(typeof e=="number")for(a=n;a2**32?i=mm(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=mm(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);function mm(t){let e="",n=t.length,r=t[0]==="-"?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function PA(t,e,n){ci(e,"offset"),(t[e]===void 0||t[e+n]===void 0)&&Fa(e,t.length-(n+1))}function Am(t,e,n,r,i,a){if(t>n||t3?e===0||e===BigInt(0)?o=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:o=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:o=`>= ${e}${s} and <= ${n}${s}`,new oi.ERR_OUT_OF_RANGE("value",o,t)}PA(r,i,a)}function ci(t,e){if(typeof t!="number")throw new oi.ERR_INVALID_ARG_TYPE(e,"number",t)}function Fa(t,e,n){throw Math.floor(t)!==t?(ci(t,n),new oi.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new oi.ERR_BUFFER_OUT_OF_BOUNDS:new oi.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}var IA=/[^+/0-9A-Za-z-_]/g;function RA(t){if(t=t.split("=")[0],t=t.trim().replace(IA,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function wu(t,e){e=e||1/0;let n,r=t.length,i=null,a=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(s+1===r){(e-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return a}function LA(t){let e=[];for(let n=0;n>8,i=n%256,a.push(i),a.push(r);return a}function Tm(t){return gu.toByteArray(RA(t))}function fo(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function wn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Su(t){return t!==t}var DA=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Kn(t){return typeof BigInt=="undefined"?BA:t}function BA(){throw new Error("BigInt not supported")}});var Cm,ku,Buffer,v=iA(()=>{Cm=require("obsidian");Cm.Platform.isMobileApp?ku=Eu().Buffer:ku=global.Buffer;Buffer=ku});var Mm=R((p7,Fm)=>{"use strict";v();var $t=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||$t.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||$t.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||$t.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=$t.DEFAULT_MAX_PENDING};$t.DEFAULT_TIMEOUT=0;$t.DEFAULT_MAX_OCCUPATION_TIME=0;$t.DEFAULT_MAX_EXECUTION_TIME=0;$t.DEFAULT_MAX_PENDING=1e3;$t.prototype.acquire=function(t,e,n,r){if(Array.isArray(t))return this._acquireBatch(t,e,n,r);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof n!="function"&&(r=n,n=null,s=new this.Promise(function(b,S){i=b,a=S})),r=r||{};var o=!1,l=null,c=null,u=null,f=this,h=function(b,S,k){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||(s?S?a(S):i(k):typeof n=="function"&&n(S,k),o=!0),b&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},d=function(b){if(o)return h(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[t]=process.domain);var S=r.maxExecutionTime||f.maxExecutionTime;if(S&&(u=setTimeout(function(){f.queues[t]&&h(b,new Error("Maximum execution time is exceeded "+t))},S)),e.length===1){var k=!1;try{e(function(x,A){k||(k=!0,h(b,x,A))})}catch(x){k||(k=!0,h(b,x))}}else f._promiseTry(function(){return e()}).then(function(x){h(b,void 0,x)},function(x){h(b,x)})};f.domainReentrant&&process.domain&&(d=process.domain.bind(d));var p=r.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],d(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])d(!1);else if(f.queues[t].length>=p)h(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){d(!0)};r.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var m=r.timeout||f.timeout;m&&(l=setTimeout(function(){l=null,h(!1,new Error("async-lock timed out in queue "+t))},m))}var w=r.maxOccupationTime||f.maxOccupationTime;if(w&&(c=setTimeout(function(){f.queues[t]&&h(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),s)return s};$t.prototype._acquireBatch=function(t,e,n,r){typeof n!="function"&&(r=n,n=null);var i=this,a=function(o,l){return function(c){i.acquire(o,l,c,r)}},s=t.reduceRight(function(o,l){return a(l,o)},e);if(typeof n=="function")s(n);else return new this.Promise(function(o,l){s.length===1?s(function(c,u){c?l(c):o(u)}):o(s())})};$t.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};$t.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};Fm.exports=$t});var Pm=R((g7,Om)=>{"use strict";v();Om.exports=Mm()});var Im=R((v7,Au)=>{v();typeof Object.create=="function"?Au.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Au.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}});var Cu=R((Tu,Lm)=>{v();var ho=Eu(),bn=ho.Buffer;function Rm(t,e){for(var n in t)e[n]=t[n]}bn.from&&bn.alloc&&bn.allocUnsafe&&bn.allocUnsafeSlow?Lm.exports=ho:(Rm(ho,Tu),Tu.Buffer=Fr);function Fr(t,e,n){return bn(t,e,n)}Fr.prototype=Object.create(bn.prototype);Rm(bn,Fr);Fr.from=function(t,e,n){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bn(t,e,n)};Fr.alloc=function(t,e,n){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=bn(t);return e!==void 0?typeof n=="string"?r.fill(e,n):r.fill(e):r.fill(0),r};Fr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bn(t)};Fr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ho.SlowBuffer(t)}});var Bm=R((x7,Dm)=>{v();var jm=Cu().Buffer;function po(t,e){this._block=jm.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}po.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=jm.from(t,e));for(var n=this._block,r=this._blockSize,i=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=this._len*8;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(n&4294967295)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a};po.prototype._update=function(){throw new Error("_update must be implemented by subclass")};Dm.exports=po});var Hm=R((S7,$m)=>{v();var NA=Im(),Nm=Bm(),$A=Cu().Buffer,HA=[1518500249,1859775393,-1894007588,-899497514],UA=new Array(80);function Ma(){this.init(),this._w=UA,Nm.call(this,64,56)}NA(Ma,Nm);Ma.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zA(t){return t<<1|t>>>31}function GA(t){return t<<5|t>>>27}function VA(t){return t<<30|t>>>2}function WA(t,e,n,r){return t===0?e&n|~e&r:t===2?e&n|e&r|n&r:e^n^r}Ma.prototype._update=function(t){for(var e=this._w,n=this._a|0,r=this._b|0,i=this._c|0,a=this._d|0,s=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=zA(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=GA(n)+WA(c,r,i,a)+s+e[l]+HA[c]|0;s=a,a=i,i=VA(r),r=n,n=u}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Ma.prototype._hash=function(){var t=$A.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};$m.exports=Ma});var zm=R(Fu=>{v();var Um;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof Fu=="object"?t(Fu):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(Um={}):t(Um={})})(function(t){t.version="1.2.2";function e(){for(var y=0,E=new Array(256),_=0;_!=256;++_)y=_,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,E[_]=y;return typeof Int32Array!="undefined"?new Int32Array(E):E}var n=e();function r(y){var E=0,_=0,C=0,M=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(C=0;C!=256;++C)M[C]=y[C];for(C=0;C!=256;++C)for(_=y[C],E=256+C;E<4096;E+=256)_=M[E]=_>>>8^y[_&255];var L=[];for(C=1;C!=16;++C)L[C-1]=typeof Int32Array!="undefined"?M.subarray(C*256,C*256+256):M.slice(C*256,C*256+256);return L}var i=r(n),a=i[0],s=i[1],o=i[2],l=i[3],c=i[4],u=i[5],f=i[6],h=i[7],d=i[8],p=i[9],g=i[10],m=i[11],w=i[12],b=i[13],S=i[14];function k(y,E){for(var _=E^-1,C=0,M=y.length;C>>8^n[(_^y.charCodeAt(C++))&255];return~_}function x(y,E){for(var _=E^-1,C=y.length-15,M=0;M>8&255]^w[y[M++]^_>>16&255]^m[y[M++]^_>>>24]^g[y[M++]]^p[y[M++]]^d[y[M++]]^h[y[M++]]^f[y[M++]]^u[y[M++]]^c[y[M++]]^l[y[M++]]^o[y[M++]]^s[y[M++]]^a[y[M++]]^n[y[M++]];for(C+=15;M>>8^n[(_^y[M++])&255];return~_}function A(y,E){for(var _=E^-1,C=0,M=y.length,L=0,N=0;C>>8^n[(_^L)&255]:L<2048?(_=_>>>8^n[(_^(192|L>>6&31))&255],_=_>>>8^n[(_^(128|L&63))&255]):L>=55296&&L<57344?(L=(L&1023)+64,N=y.charCodeAt(C++)&1023,_=_>>>8^n[(_^(240|L>>8&7))&255],_=_>>>8^n[(_^(128|L>>2&63))&255],_=_>>>8^n[(_^(128|N>>6&15|(L&3)<<4))&255],_=_>>>8^n[(_^(128|N&63))&255]):(_=_>>>8^n[(_^(224|L>>12&15))&255],_=_>>>8^n[(_^(128|L>>6&63))&255],_=_>>>8^n[(_^(128|L&63))&255]);return~_}t.table=n,t.bstr=k,t.buf=x,t.str=A})});var jn=R(St=>{"use strict";v();var qA=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function XA(t,e){return Object.prototype.hasOwnProperty.call(t,e)}St.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)XA(n,r)&&(t[r]=n[r])}}return t};St.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var YA={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray){t.set(e.subarray(n,n+r),i);return}for(var a=0;a{"use strict";v();var KA=jn(),JA=4,Gm=0,Vm=1,QA=2;function hi(t){for(var e=t.length;--e>=0;)t[e]=0}var e3=0,Km=1,t3=2,n3=3,r3=258,ju=29,ja=256,Pa=ja+1+ju,fi=30,Du=19,Jm=2*Pa+1,Mr=15,Mu=16,i3=7,Bu=256,Qm=16,eg=17,tg=18,Ru=[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],mo=[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],a3=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ng=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],s3=512,Dn=new Array((Pa+2)*2);hi(Dn);var Oa=new Array(fi*2);hi(Oa);var Ia=new Array(s3);hi(Ia);var Ra=new Array(r3-n3+1);hi(Ra);var Nu=new Array(ju);hi(Nu);var go=new Array(fi);hi(go);function Ou(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}var rg,ig,ag;function Pu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function sg(t){return t<256?Ia[t]:Ia[256+(t>>>7)]}function La(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Ot(t,e,n){t.bi_valid>Mu-n?(t.bi_buf|=e<>Mu-t.bi_valid,t.bi_valid+=n-Mu):(t.bi_buf|=e<>>=1,n<<=1;while(--e>0);return n>>>1}function o3(t){t.bi_valid===16?(La(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 l3(t,e){var n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,h,d,p,g=0;for(h=0;h<=Mr;h++)t.bl_count[h]=0;for(n[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(h=l,g++),n[u*2+1]=h,!(u>r)&&(t.bl_count[h]++,d=0,u>=o&&(d=s[u-o]),p=n[u*2],t.opt_len+=p*(h+d),a&&(t.static_len+=p*(i[u*2+1]+d)));if(g!==0){do{for(h=l-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(h=l;h!==0;h--)for(u=t.bl_count[h];u!==0;)f=t.heap[--c],!(f>r)&&(n[f*2+1]!==h&&(t.opt_len+=(h-n[f*2+1])*n[f*2],n[f*2+1]=h),u--)}}function lg(t,e,n){var r=new Array(Mr+1),i=0,a,s;for(a=1;a<=Mr;a++)r[a]=i=i+n[a-1]<<1;for(s=0;s<=e;s++){var o=t[s*2+1];o!==0&&(t[s*2]=og(r[o]++,o))}}function c3(){var t,e,n,r,i,a=new Array(Mr+1);for(n=0,r=0;r>=7;r8?La(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 u3(t,e,n,r){ug(t),r&&(La(t,n),La(t,~n)),KA.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function Wm(t,e,n,r){var i=e*2,a=n*2;return t[i]>1;s>=1;s--)Iu(t,n,s);c=a;do s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Iu(t,n,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,n[c*2]=n[s*2]+n[o*2],t.depth[c]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,n[s*2+1]=n[o*2+1]=c,t.heap[1]=c++,Iu(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],l3(t,e),lg(n,l,t.bl_count)}function Xm(t,e,n){var r,i=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=s,s=e[(r+1)*2+1],!(++o=3&&t.bl_tree[ng[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function h3(t,e,n,r){var i;for(Ot(t,e-257,5),Ot(t,n-1,5),Ot(t,r-4,4),i=0;i>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return Gm;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Vm;for(n=32;n0?(t.strm.data_type===QA&&(t.strm.data_type=d3(t)),Lu(t,t.l_desc),Lu(t,t.d_desc),s=f3(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&e!==-1?fg(t,e,n,r):t.strategy===JA||a===i?(Ot(t,(Km<<1)+(r?1:0),3),qm(t,Dn,Oa)):(Ot(t,(t3<<1)+(r?1:0),3),h3(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),qm(t,t.dyn_ltree,t.dyn_dtree)),cg(t),r&&ug(t)}function y3(t,e,n){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]=n&255,t.last_lit++,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(Ra[n]+ja+1)*2]++,t.dyn_dtree[sg(e)*2]++),t.last_lit===t.lit_bufsize-1}di._tr_init=p3;di._tr_stored_block=fg;di._tr_flush_block=g3;di._tr_tally=y3;di._tr_align=m3});var $u=R((O7,dg)=>{"use strict";v();function v3(t,e,n,r){for(var i=t&65535|0,a=t>>>16&65535|0,s=0;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+e[r++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}dg.exports=v3});var Hu=R((I7,pg)=>{"use strict";v();function w3(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e}var b3=w3();function x3(t,e,n,r){var i=b3,a=r+n;t^=-1;for(var s=r;s>>8^i[(t^e[s])&255];return t^-1}pg.exports=x3});var yo=R((L7,mg)=>{"use strict";v();mg.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 Eg=R(En=>{"use strict";v();var Et=jn(),Kt=hg(),wg=$u(),Jn=Hu(),_3=yo(),Rr=0,S3=1,E3=3,rr=4,gg=5,Sn=0,yg=1,Jt=-2,k3=-3,Uu=-5,A3=-1,T3=1,vo=2,C3=3,F3=4,M3=0,O3=2,_o=8,P3=9,I3=15,R3=8,L3=29,j3=256,Gu=j3+1+L3,D3=30,B3=19,N3=2*Gu+1,$3=15,me=3,tr=258,cn=tr+me+1,H3=32,So=42,Vu=69,wo=73,bo=91,xo=103,Or=113,Ba=666,ot=1,Na=2,Pr=3,gi=4,U3=3;function nr(t,e){return t.msg=_3[e],e}function vg(t){return(t<<1)-(t>4?9:0)}function er(t){for(var e=t.length;--e>=0;)t[e]=0}function Qn(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(Et.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))}function ht(t,e){Kt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Qn(t.strm)}function ve(t,e){t.pending_buf[t.pending++]=e}function Da(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function z3(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,Et.arraySet(e,t.input,t.next_in,i,n),t.state.wrap===1?t.adler=wg(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Jn(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function bg(t,e){var n=t.max_chain_length,r=t.strstart,i,a,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-cn?t.strstart-(t.w_size-cn):0,c=t.window,u=t.w_mask,f=t.prev,h=t.strstart+tr,d=c[r+s-1],p=c[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(c[i+s]!==p||c[i+s-1]!==d||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&rs){if(t.match_start=e,s=a,a>=o)break;d=c[r+s-1],p=c[r+s]}}while((e=f[e&u])>l&&--n!==0);return s<=t.lookahead?s:t.lookahead}function Ir(t){var e=t.w_size,n,r,i,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-cn)){Et.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,r=t.hash_size,n=r;do i=t.head[--n],t.head[n]=i>=e?i-e:0;while(--r);r=e,n=r;do i=t.prev[--n],t.prev[n]=i>=e?i-e:0;while(--r);a+=e}if(t.strm.avail_in===0)break;if(r=z3(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=r,t.lookahead+t.insert>=me)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Ir(t),t.lookahead===0&&e===Rr)return ot;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((t.strstart===0||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,ht(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-cn&&(ht(t,!1),t.strm.avail_out===0))return ot}return t.insert=0,e===rr?(ht(t,!0),t.strm.avail_out===0?Pr:gi):(t.strstart>t.block_start&&(ht(t,!1),t.strm.avail_out===0),ot)}function zu(t,e){for(var n,r;;){if(t.lookahead=me&&(t.ins_h=(t.ins_h<=me)if(r=Kt._tr_tally(t,t.strstart-t.match_start,t.match_length-me),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=me){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=me&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=me-1)),t.prev_length>=me&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-me,r=Kt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-me),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<=me&&t.strstart>0&&(i=t.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){a=t.strstart+tr;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=me?(n=Kt._tr_tally(t,1,t.match_length-me),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Kt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(ht(t,!1),t.strm.avail_out===0))return ot}return t.insert=0,e===rr?(ht(t,!0),t.strm.avail_out===0?Pr:gi):t.last_lit&&(ht(t,!1),t.strm.avail_out===0)?ot:Na}function W3(t,e){for(var n;;){if(t.lookahead===0&&(Ir(t),t.lookahead===0)){if(e===Rr)return ot;break}if(t.match_length=0,n=Kt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(ht(t,!1),t.strm.avail_out===0))return ot}return t.insert=0,e===rr?(ht(t,!0),t.strm.avail_out===0?Pr:gi):t.last_lit&&(ht(t,!1),t.strm.avail_out===0)?ot:Na}function _n(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}var mi;mi=[new _n(0,0,0,0,G3),new _n(4,4,8,4,zu),new _n(4,5,16,8,zu),new _n(4,6,32,32,zu),new _n(4,4,16,16,pi),new _n(8,16,32,32,pi),new _n(8,16,128,128,pi),new _n(8,32,128,256,pi),new _n(32,128,258,1024,pi),new _n(32,258,258,4096,pi)];function q3(t){t.window_size=2*t.w_size,er(t.head),t.max_lazy_match=mi[t.level].max_lazy,t.good_match=mi[t.level].good_length,t.nice_match=mi[t.level].nice_length,t.max_chain_length=mi[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=me-1,t.match_available=0,t.ins_h=0}function X3(){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=_o,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 Et.Buf16(N3*2),this.dyn_dtree=new Et.Buf16((2*D3+1)*2),this.bl_tree=new Et.Buf16((2*B3+1)*2),er(this.dyn_ltree),er(this.dyn_dtree),er(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Et.Buf16($3+1),this.heap=new Et.Buf16(2*Gu+1),er(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Et.Buf16(2*Gu+1),er(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 xg(t){var e;return!t||!t.state?nr(t,Jt):(t.total_in=t.total_out=0,t.data_type=O3,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?So:Or,t.adler=e.wrap===2?0:1,e.last_flush=Rr,Kt._tr_init(e),Sn)}function _g(t){var e=xg(t);return e===Sn&&q3(t.state),e}function Y3(t,e){return!t||!t.state||t.state.wrap!==2?Jt:(t.state.gzhead=e,Sn)}function Sg(t,e,n,r,i,a){if(!t)return Jt;var s=1;if(e===A3&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>P3||n!==_o||r<8||r>15||e<0||e>9||a<0||a>F3)return nr(t,Jt);r===8&&(r=9);var o=new X3;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<gg||e<0)return t?nr(t,Jt):Jt;if(r=t.state,!t.output||!t.input&&t.avail_in!==0||r.status===Ba&&e!==rr)return nr(t,t.avail_out===0?Uu:Jt);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===So)if(r.wrap===2)t.adler=0,ve(r,31),ve(r,139),ve(r,8),r.gzhead?(ve(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ve(r,r.gzhead.time&255),ve(r,r.gzhead.time>>8&255),ve(r,r.gzhead.time>>16&255),ve(r,r.gzhead.time>>24&255),ve(r,r.level===9?2:r.strategy>=vo||r.level<2?4:0),ve(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ve(r,r.gzhead.extra.length&255),ve(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Jn(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Vu):(ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,r.level===9?2:r.strategy>=vo||r.level<2?4:0),ve(r,U3),r.status=Or);else{var s=_o+(r.w_bits-8<<4)<<8,o=-1;r.strategy>=vo||r.level<2?o=0:r.level<6?o=1:r.level===6?o=2:o=3,s|=o<<6,r.strstart!==0&&(s|=H3),s+=31-s%31,r.status=Or,Da(r,s),r.strstart!==0&&(Da(r,t.adler>>>16),Da(r,t.adler&65535)),t.adler=1}if(r.status===Vu)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),Qn(t),i=r.pending,r.pending===r.pending_buf_size));)ve(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=wo)}else r.status=wo;if(r.status===wo)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),Qn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.gzindex=0,r.status=bo)}else r.status=bo;if(r.status===bo)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),Qn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.status=xo)}else r.status=xo;if(r.status===xo&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Qn(t),r.pending+2<=r.pending_buf_size&&(ve(r,t.adler&255),ve(r,t.adler>>8&255),t.adler=0,r.status=Or)):r.status=Or),r.pending!==0){if(Qn(t),t.avail_out===0)return r.last_flush=-1,Sn}else if(t.avail_in===0&&vg(e)<=vg(n)&&e!==rr)return nr(t,Uu);if(r.status===Ba&&t.avail_in!==0)return nr(t,Uu);if(t.avail_in!==0||r.lookahead!==0||e!==Rr&&r.status!==Ba){var l=r.strategy===vo?W3(r,e):r.strategy===C3?V3(r,e):mi[r.level].func(r,e);if((l===Pr||l===gi)&&(r.status=Ba),l===ot||l===Pr)return t.avail_out===0&&(r.last_flush=-1),Sn;if(l===Na&&(e===S3?Kt._tr_align(r):e!==gg&&(Kt._tr_stored_block(r,0,0,!1),e===E3&&(er(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Qn(t),t.avail_out===0))return r.last_flush=-1,Sn}return e!==rr?Sn:r.wrap<=0?yg:(r.wrap===2?(ve(r,t.adler&255),ve(r,t.adler>>8&255),ve(r,t.adler>>16&255),ve(r,t.adler>>24&255),ve(r,t.total_in&255),ve(r,t.total_in>>8&255),ve(r,t.total_in>>16&255),ve(r,t.total_in>>24&255)):(Da(r,t.adler>>>16),Da(r,t.adler&65535)),Qn(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Sn:yg)}function J3(t){var e;return!t||!t.state?Jt:(e=t.state.status,e!==So&&e!==Vu&&e!==wo&&e!==bo&&e!==xo&&e!==Or&&e!==Ba?nr(t,Jt):(t.state=null,e===Or?nr(t,k3):Sn))}function Q3(t,e){var n=e.length,r,i,a,s,o,l,c,u;if(!t||!t.state||(r=t.state,s=r.wrap,s===2||s===1&&r.status!==So||r.lookahead))return Jt;for(s===1&&(t.adler=wg(t.adler,e,n,0)),r.wrap=0,n>=r.w_size&&(s===0&&(er(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new Et.Buf8(r.w_size),Et.arraySet(u,e,n-r.w_size,r.w_size,0),e=u,n=r.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=n,t.next_in=0,t.input=e,Ir(r);r.lookahead>=me;){i=r.strstart,a=r.lookahead-(me-1);do r.ins_h=(r.ins_h<{"use strict";v();var Eo=jn(),kg=!0,Ag=!0;try{String.fromCharCode.apply(null,[0])}catch(t){kg=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Ag=!1}var $a=new Eo.Buf8(256);for(Bn=0;Bn<256;Bn++)$a[Bn]=Bn>=252?6:Bn>=248?5:Bn>=240?4:Bn>=224?3:Bn>=192?2:1;var Bn;$a[254]=$a[254]=1;yi.string2buf=function(t){var e,n,r,i,a,s=t.length,o=0;for(i=0;i>>6,e[a++]=128|n&63):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|n&63):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|n&63);return e};function Tg(t,e){if(e<65534&&(t.subarray&&Ag||!t.subarray&&kg))return String.fromCharCode.apply(null,Eo.shrinkBuf(t,e));for(var n="",r=0;r4){o[r++]=65533,n+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&n1){o[r++]=65533;continue}i<65536?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|i&1023)}return Tg(o,r)};yi.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+$a[t[n]]>e?n:e}});var qu=R((H7,Cg)=>{"use strict";v();function eT(){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}Cg.exports=eT});var Pg=R(za=>{"use strict";v();var Ha=Eg(),Ua=jn(),Yu=Wu(),Zu=yo(),tT=qu(),Og=Object.prototype.toString,nT=0,Xu=4,vi=0,Fg=1,Mg=2,rT=-1,iT=0,aT=8;function Lr(t){if(!(this instanceof Lr))return new Lr(t);this.options=Ua.assign({level:rT,method:aT,chunkSize:16384,windowBits:15,memLevel:8,strategy:iT,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 tT,this.strm.avail_out=0;var n=Ha.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==vi)throw new Error(Zu[n]);if(e.header&&Ha.deflateSetHeader(this.strm,e.header),e.dictionary){var r;if(typeof e.dictionary=="string"?r=Yu.string2buf(e.dictionary):Og.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=Ha.deflateSetDictionary(this.strm,r),n!==vi)throw new Error(Zu[n]);this._dict_set=!0}}Lr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;a=e===~~e?e:e===!0?Xu:nT,typeof t=="string"?n.input=Yu.string2buf(t):Og.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Ua.Buf8(r),n.next_out=0,n.avail_out=r),i=Ha.deflate(n,a),i!==Fg&&i!==vi)return this.onEnd(i),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===Xu||a===Mg))&&(this.options.to==="string"?this.onData(Yu.buf2binstring(Ua.shrinkBuf(n.output,n.next_out))):this.onData(Ua.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&i!==Fg);return a===Xu?(i=Ha.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===vi):(a===Mg&&(this.onEnd(vi),n.avail_out=0),!0)};Lr.prototype.onData=function(t){this.chunks.push(t)};Lr.prototype.onEnd=function(t){t===vi&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ua.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Ku(t,e){var n=new Lr(e);if(n.push(t,!0),n.err)throw n.msg||Zu[n.err];return n.result}function sT(t,e){return e=e||{},e.raw=!0,Ku(t,e)}function oT(t,e){return e=e||{},e.gzip=!0,Ku(t,e)}za.Deflate=Lr;za.deflate=Ku;za.deflateRaw=sT;za.gzip=oT});var Rg=R((V7,Ig)=>{"use strict";v();var ko=30,lT=12;Ig.exports=function(e,n){var r,i,a,s,o,l,c,u,f,h,d,p,g,m,w,b,S,k,x,A,y,E,_,C,M;r=e.state,i=e.next_in,C=e.input,a=i+(e.avail_in-5),s=e.next_out,M=e.output,o=s-(n-e.avail_out),l=s+(e.avail_out-257),c=r.dmax,u=r.wsize,f=r.whave,h=r.wnext,d=r.window,p=r.hold,g=r.bits,m=r.lencode,w=r.distcode,b=(1<>>24,p>>>=x,g-=x,x=k>>>16&255,x===0)M[s++]=k&65535;else if(x&16){A=k&65535,x&=15,x&&(g>>=x,g-=x),g<15&&(p+=C[i++]<>>24,p>>>=x,g-=x,x=k>>>16&255,x&16){if(y=k&65535,x&=15,gc){e.msg="invalid distance too far back",r.mode=ko;break e}if(p>>>=x,g-=x,x=s-o,y>x){if(x=y-x,x>f&&r.sane){e.msg="invalid distance too far back",r.mode=ko;break e}if(E=0,_=d,h===0){if(E+=u-x,x2;)M[s++]=_[E++],M[s++]=_[E++],M[s++]=_[E++],A-=3;A&&(M[s++]=_[E++],A>1&&(M[s++]=_[E++]))}else{E=s-y;do M[s++]=M[E++],M[s++]=M[E++],M[s++]=M[E++],A-=3;while(A>2);A&&(M[s++]=M[E++],A>1&&(M[s++]=M[E++]))}}else if(x&64){e.msg="invalid distance code",r.mode=ko;break e}else{k=w[(k&65535)+(p&(1<>3,i-=A,g-=A<<3,p&=(1<{"use strict";v();var Lg=jn(),wi=15,jg=852,Dg=592,Bg=0,Ju=1,Ng=2,cT=[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],uT=[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],fT=[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],hT=[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];$g.exports=function(e,n,r,i,a,s,o,l){var c=l.bits,u=0,f=0,h=0,d=0,p=0,g=0,m=0,w=0,b=0,S=0,k,x,A,y,E,_=null,C=0,M,L=new Lg.Buf16(wi+1),N=new Lg.Buf16(wi+1),j=null,Y=0,le,he,ie;for(u=0;u<=wi;u++)L[u]=0;for(f=0;f=1&&L[d]===0;d--);if(p>d&&(p=d),d===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h0&&(e===Bg||d!==1))return-1;for(N[1]=0,u=1;ujg||e===Ng&&b>Dg)return 1;for(;;){le=u-m,o[f]M?(he=j[Y+o[f]],ie=_[C+o[f]]):(he=96,ie=0),k=1<>m)+x]=le<<24|he<<16|ie|0;while(x!==0);for(k=1<>=1;if(k!==0?(S&=k-1,S+=k):S=0,f++,--L[u]===0){if(u===d)break;u=n[r+o[f]]}if(u>p&&(S&y)!==A){for(m===0&&(m=p),E+=h,g=u-m,w=1<jg||e===Ng&&b>Dg)return 1;A=S&y,a[A]=p<<24|g<<16|E-s|0}}return S!==0&&(a[E+S]=u-m<<24|64<<16|0),l.bits=p,0}});var _0=R(un=>{"use strict";v();var Ht=jn(),af=$u(),kn=Hu(),dT=Rg(),Ga=Hg(),pT=0,d0=1,p0=2,Ug=4,mT=5,Ao=6,jr=0,gT=1,yT=2,Qt=-2,m0=-3,sf=-4,vT=-5,zg=8,g0=1,Gg=2,Vg=3,Wg=4,qg=5,Xg=6,Yg=7,Zg=8,Kg=9,Jg=10,Fo=11,Nn=12,Qu=13,Qg=14,ef=15,e0=16,t0=17,n0=18,r0=19,To=20,Co=21,i0=22,a0=23,s0=24,o0=25,l0=26,tf=27,c0=28,u0=29,Ne=30,of=31,wT=32,bT=852,xT=592,_T=15,ST=_T;function f0(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function ET(){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 Ht.Buf16(320),this.work=new Ht.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y0(t){var e;return!t||!t.state?Qt:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=g0,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Ht.Buf32(bT),e.distcode=e.distdyn=new Ht.Buf32(xT),e.sane=1,e.back=-1,jr)}function v0(t){var e;return!t||!t.state?Qt:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,y0(t))}function w0(t,e){var n,r;return!t||!t.state||(r=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Qt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,v0(t))}function b0(t,e){var n,r;return t?(r=new ET,t.state=r,r.window=null,n=w0(t,e),n!==jr&&(t.state=null),n):Qt}function kT(t){return b0(t,ST)}var h0=!0,nf,rf;function AT(t){if(h0){var e;for(nf=new Ht.Buf32(512),rf=new Ht.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(Ga(d0,t.lens,0,288,nf,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ga(p0,t.lens,0,32,rf,0,t.work,{bits:5}),h0=!1}t.lencode=nf,t.lenbits=9,t.distcode=rf,t.distbits=5}function x0(t,e,n,r){var i,a=t.state;return a.window===null&&(a.wsize=1<=a.wsize?(Ht.arraySet(a.window,e,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),Ht.arraySet(a.window,e,n-r,i,a.wnext),r-=i,r?(Ht.arraySet(a.window,e,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=kn(n.check,_,2,0),c=0,u=0,n.mode=Gg;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=Ne;break}if((c&15)!==zg){t.msg="unknown compression method",n.mode=Ne;break}if(c>>>=4,u-=4,y=(c&15)+8,n.wbits===0)n.wbits=y;else if(y>n.wbits){t.msg="invalid window size",n.mode=Ne;break}n.dmax=1<>8&1),n.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,n.check=kn(n.check,_,2,0)),c=0,u=0,n.mode=Vg;case Vg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>8&255,_[2]=c>>>16&255,_[3]=c>>>24&255,n.check=kn(n.check,_,4,0)),c=0,u=0,n.mode=Wg;case Wg:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>8),n.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,n.check=kn(n.check,_,2,0)),c=0,u=0,n.mode=qg;case qg:if(n.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>>8&255,n.check=kn(n.check,_,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=Xg;case Xg:if(n.flags&1024&&(d=n.length,d>o&&(d=o),d&&(n.head&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Ht.arraySet(n.head.extra,r,a,d,y)),n.flags&512&&(n.check=kn(n.check,r,d,a)),o-=d,a+=d,n.length-=d),n.length))break e;n.length=0,n.mode=Yg;case Yg:if(n.flags&2048){if(o===0)break e;d=0;do y=r[a+d++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y));while(y&&d>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Nn;break;case Jg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>=u&7,u-=u&7,n.mode=tf;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<>>=1,u-=1,c&3){case 0:n.mode=Qg;break;case 1:if(AT(n),n.mode=To,e===Ao){c>>>=2,u-=2;break e}break;case 2:n.mode=t0;break;case 3:t.msg="invalid block type",n.mode=Ne}c>>>=2,u-=2;break;case Qg:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=Ne;break}if(n.length=c&65535,c=0,u=0,n.mode=ef,e===Ao)break e;case ef:n.mode=e0;case e0:if(d=n.length,d){if(d>o&&(d=o),d>l&&(d=l),d===0)break e;Ht.arraySet(i,r,a,d,s),o-=d,a+=d,l-=d,s+=d,n.length-=d;break}n.mode=Nn;break;case t0:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Ne;break}n.have=0,n.mode=n0;case n0:for(;n.have>>=3,u-=3}for(;n.have<19;)n.lens[L[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,C={bits:n.lenbits},E=Ga(pT,n.lens,0,19,n.lencode,0,n.work,C),n.lenbits=C.bits,E){t.msg="invalid code lengths set",n.mode=Ne;break}n.have=0,n.mode=r0;case r0:for(;n.have>>24,b=m>>>16&255,S=m&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=w,u-=w,n.lens[n.have++]=S;else{if(S===16){for(M=w+2;u>>=w,u-=w,n.have===0){t.msg="invalid bit length repeat",n.mode=Ne;break}y=n.lens[n.have-1],d=3+(c&3),c>>>=2,u-=2}else if(S===17){for(M=w+3;u>>=w,u-=w,y=0,d=3+(c&7),c>>>=3,u-=3}else{for(M=w+7;u>>=w,u-=w,y=0,d=11+(c&127),c>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Ne;break}for(;d--;)n.lens[n.have++]=y}}if(n.mode===Ne)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Ne;break}if(n.lenbits=9,C={bits:n.lenbits},E=Ga(d0,n.lens,0,n.nlen,n.lencode,0,n.work,C),n.lenbits=C.bits,E){t.msg="invalid literal/lengths set",n.mode=Ne;break}if(n.distbits=6,n.distcode=n.distdyn,C={bits:n.distbits},E=Ga(p0,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,C),n.distbits=C.bits,E){t.msg="invalid distances set",n.mode=Ne;break}if(n.mode=To,e===Ao)break e;case To:n.mode=Co;case Co:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=a,t.avail_in=o,n.hold=c,n.bits=u,dT(t,h),s=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,o=t.avail_in,c=n.hold,u=n.bits,n.mode===Nn&&(n.back=-1);break}for(n.back=0;m=n.lencode[c&(1<>>24,b=m>>>16&255,S=m&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>k)],w=m>>>24,b=m>>>16&255,S=m&65535,!(k+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=k,u-=k,n.back+=k}if(c>>>=w,u-=w,n.back+=w,n.length=S,b===0){n.mode=l0;break}if(b&32){n.back=-1,n.mode=Nn;break}if(b&64){t.msg="invalid literal/length code",n.mode=Ne;break}n.extra=b&15,n.mode=i0;case i0:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=a0;case a0:for(;m=n.distcode[c&(1<>>24,b=m>>>16&255,S=m&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>k)],w=m>>>24,b=m>>>16&255,S=m&65535,!(k+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=k,u-=k,n.back+=k}if(c>>>=w,u-=w,n.back+=w,b&64){t.msg="invalid distance code",n.mode=Ne;break}n.offset=S,n.extra=b&15,n.mode=s0;case s0:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Ne;break}n.mode=o0;case o0:if(l===0)break e;if(d=h-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Ne;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=s-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[s++]=g[p++];while(--d);n.length===0&&(n.mode=Co);break;case l0:if(l===0)break e;i[s++]=n.length,l--,n.mode=Co;break;case tf:if(n.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<{"use strict";v();S0.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 k0=R((Q7,E0)=>{"use strict";v();function OT(){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}E0.exports=OT});var T0=R(Wa=>{"use strict";v();var bi=_0(),Va=jn(),Mo=Wu(),Ke=lf(),cf=yo(),PT=qu(),IT=k0(),A0=Object.prototype.toString;function Dr(t){if(!(this instanceof Dr))return new Dr(t);this.options=Va.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||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new PT,this.strm.avail_out=0;var n=bi.inflateInit2(this.strm,e.windowBits);if(n!==Ke.Z_OK)throw new Error(cf[n]);if(this.header=new IT,bi.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Mo.string2buf(e.dictionary):A0.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=bi.inflateSetDictionary(this.strm,e.dictionary),n!==Ke.Z_OK)))throw new Error(cf[n])}Dr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,s,o,l,c,u=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?Ke.Z_FINISH:Ke.Z_NO_FLUSH,typeof t=="string"?n.input=Mo.binstring2buf(t):A0.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Va.Buf8(r),n.next_out=0,n.avail_out=r),a=bi.inflate(n,Ke.Z_NO_FLUSH),a===Ke.Z_NEED_DICT&&i&&(a=bi.inflateSetDictionary(this.strm,i)),a===Ke.Z_BUF_ERROR&&u===!0&&(a=Ke.Z_OK,u=!1),a!==Ke.Z_STREAM_END&&a!==Ke.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===Ke.Z_STREAM_END||n.avail_in===0&&(s===Ke.Z_FINISH||s===Ke.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Mo.utf8border(n.output,n.next_out),l=n.next_out-o,c=Mo.buf2string(n.output,o),n.next_out=l,n.avail_out=r-l,l&&Va.arraySet(n.output,n.output,o,l,0),this.onData(c)):this.onData(Va.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(u=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==Ke.Z_STREAM_END);return a===Ke.Z_STREAM_END&&(s=Ke.Z_FINISH),s===Ke.Z_FINISH?(a=bi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ke.Z_OK):(s===Ke.Z_SYNC_FLUSH&&(this.onEnd(Ke.Z_OK),n.avail_out=0),!0)};Dr.prototype.onData=function(t){this.chunks.push(t)};Dr.prototype.onEnd=function(t){t===Ke.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Va.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function uf(t,e){var n=new Dr(e);if(n.push(t,!0),n.err)throw n.msg||cf[n.err];return n.result}function RT(t,e){return e=e||{},e.raw=!0,uf(t,e)}Wa.Inflate=Dr;Wa.inflate=uf;Wa.inflateRaw=RT;Wa.ungzip=uf});var M0=R((rD,F0)=>{"use strict";v();var LT=jn().assign,jT=Pg(),DT=T0(),BT=lf(),C0={};LT(C0,jT,DT,BT);F0.exports=C0});var I0=R((aD,P0)=>{"use strict";v();var O0=(t,e)=>function(...n){let r=e.promiseModule;return new r((i,a)=>{e.multiArgs?n.push((...s)=>{e.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):e.errorFirst?n.push((s,o)=>{s?a(s):i(o)}):n.push(i),t.apply(this,n)})};P0.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let n=typeof t;if(!(t!==null&&(n==="object"||n==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":n}\``);let r=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return e.include?e.include.some(s):!e.exclude.some(s)},i;n==="function"?i=function(...a){return e.excludeMain?t(...a):O0(t,e).apply(this,a)}:i=Object.create(Object.getPrototypeOf(t));for(let a in t){let s=t[a];i[a]=typeof s=="function"&&r(a)?O0(s,e):s}return i}});var U0=R((oD,H0)=>{v();function R0(t){return Array.isArray(t)?t:[t]}var df="",L0=" ",ff="\\",NT=/^\s+$/,$T=/(?:[^\\]|^)\\$/,HT=/^\\!/,UT=/^\\#/,zT=/\r?\n/g,GT=/^\.*\/|^\.+$/,hf="/",B0="node-ignore";typeof Symbol!="undefined"&&(B0=Symbol.for("node-ignore"));var j0=B0,VT=(t,e,n)=>Object.defineProperty(t,e,{value:n}),WT=/([0-z])-([0-z])/g,N0=()=>!1,qT=t=>t.replace(WT,(e,n,r)=>n.charCodeAt(0)<=r.charCodeAt(0)?e:df),XT=t=>{let{length:e}=t;return t.slice(0,e-e%2)},YT=[[/^\uFEFF/,()=>df],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,n)=>e+(n.indexOf("\\")===0?L0:df)],[/(\\+?)\s/g,(t,e)=>{let{length:n}=e;return e.slice(0,n-n%2)+L0}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,n)=>e+6{let r=n.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>ff],[/\\\\/g,()=>ff],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,n,r,i)=>e===ff?`\\[${n}${XT(r)}${i}`:i==="]"&&r.length%2===0?`[${qT(n)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],D0=Object.create(null),ZT=(t,e)=>{let n=D0[t];return n||(n=YT.reduce((r,[i,a])=>r.replace(i,a.bind(t)),t),D0[t]=n),e?new RegExp(n,"i"):new RegExp(n)},gf=t=>typeof t=="string",KT=t=>t&&gf(t)&&!NT.test(t)&&!$T.test(t)&&t.indexOf("#")!==0,JT=t=>t.split(zT),pf=class{constructor(e,n,r,i){this.origin=e,this.pattern=n,this.negative=r,this.regex=i}},QT=(t,e)=>{let n=t,r=!1;t.indexOf("!")===0&&(r=!0,t=t.substr(1)),t=t.replace(HT,"!").replace(UT,"#");let i=ZT(t,e);return new pf(n,t,r,i)},e5=(t,e)=>{throw new e(t)},$n=(t,e,n)=>gf(t)?t?$n.isNotRelative(t)?n(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${e}\``,TypeError),$0=t=>GT.test(t);$n.isNotRelative=$0;$n.convert=t=>t;var mf=class{constructor({ignorecase:e=!0,ignoreCase:n=e,allowRelativePaths:r=!1}={}){VT(this,j0,!0),this._rules=[],this._ignoreCase=n,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[j0]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(KT(e)){let n=QT(e,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(e){return this._added=!1,R0(gf(e)?JT(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,n){let r=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&r!==i||s&&!r&&!i&&!n)return;a.regex.test(e)&&(r=!s,i=s)}),{ignored:r,unignored:i}}_test(e,n,r,i){let a=e&&$n.convert(e);return $n(a,e,this._allowRelativePaths?N0:e5),this._t(a,n,r,i)}_t(e,n,r,i){if(e in n)return n[e];if(i||(i=e.split(hf)),i.pop(),!i.length)return n[e]=this._testOne(e,r);let a=this._t(i.join(hf)+hf,n,r,i);return n[e]=a.ignored?a:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return R0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Oo=t=>new mf(t),t5=t=>$n(t&&$n.convert(t),t,N0);Oo.isPathValid=t5;Oo.default=Oo;H0.exports=Oo;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");$n.convert=t;let e=/^[a-z]:\//i;$n.isNotRelative=n=>e.test(n)||$0(n)}});var G0=R((cD,z0)=>{"use strict";v();function n5(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function An(t,e,n){return e=e instanceof RegExp?e:new RegExp(n5(e),"g"),t.replace(e,n)}var r5={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=An(e,"./","/"),e=An(e,"..","."),e=An(e," ","-"),e=An(e,/^[~^:?*\\\-]/g,""),e=An(e,/[~^:?*\\]/g,"-"),e=An(e,/[~^:?*\\\-]$/g,""),e=An(e,"@{","-"),e=An(e,/\.$/g,""),e=An(e,/\/$/g,""),e=An(e,/\.lock$/g,""),e}};z0.exports=r5});var W0=R((fD,V0)=>{v();V0.exports=function(t,e){var n=t,r=e,i=n.length,a=r.length,s=!1,o=null,l=i+1,c=[],u=[],f=[],h="",d=-1,p=0,g=1,m,w,b=function(){i>=a&&(m=n,w=i,n=r,r=m,i=a,a=w,s=!0,l=i+1)},S=function(y,E,_){return{x:y,y:E,k:_}},k=function(y,E){return{elem:y,t:E}},x=function(y,E,_){var C,M,L;for(E>_?C=c[y-1+l]:C=c[y+1+l],L=Math.max(E,_),M=L-y;M=0;--L)for(;CM-C?(s?f[f.length]=new k(r[M],d):f[f.length]=new k(r[M],g),++_,++M):y[L].y-y[L].x=y+1;--j)_[j+l]=x(j,_[j-1+l]+1,_[j+1+l]);_[y+l]=x(y,_[y-1+l]+1,_[y+1+l])}while(_[y+l]!==a);for(o=y+2*C,M=c[y+l],L=[];M!==-1;)L[L.length]=new S(u[M].x,u[M].y,null),M=u[M].k;A(L)}}}});var Y0=R((dD,X0)=>{v();var i5=W0();function a5(t,e){var n=new i5(t,e);n.compose();for(var r=n.getses(),i,a,s=t.length-1,o=e.length-1,l=r.length-1;l>=0;--l)r[l].t===n.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):(i={file1index:s,file2index:o,chain:null},a=i),s--,o--):r[l].t===n.SES_DELETE?s--:r[l].t===n.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return a?(a.chain=c,i):c}function q0(t,e){for(var n=[],r=t.length,i=e.length,a=a5(t,e);a!==null;a=a.chain){var s=r-a.file1index-1,o=i-a.file2index-1;r=a.file1index,i=a.file2index,(s||o)&&n.push({file1:[r+1,s],file2:[i+1,o]})}return n.reverse(),n}function s5(t,e,n){var r,i=q0(e,t),a=q0(e,n),s=[];function o(N,j){s.push([N.file1[0],j,N.file1[1],N.file2[0],N.file2[1]])}for(r=0;rc&&(l.push([1,c,N-c]),c=N)}for(var f=0;fg)break;g=Math.max(g,w+m[2]),f++}if(u(p),h==f)d[4]>0&&l.push([d[1],d[3],d[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[n.length,-1,e.length,-1]};for(r=h;r<=f;r++){d=s[r];var S=d[1],k=b[S],x=d[0],A=x+d[2],y=d[3],E=y+d[4];k[0]=Math.min(y,k[0]),k[1]=Math.max(E,k[1]),k[2]=Math.min(x,k[2]),k[3]=Math.max(A,k[3])}var _=b[0][0]+(p-b[0][2]),C=b[0][1]+(g-b[0][3]),M=b[2][0]+(p-b[2][2]),L=b[2][1]+(g-b[2][3]);l.push([-1,_,C-_,p,g-p,M,L-M])}c=g}return u(e.length),l}function o5(t,e,n){var r=[],i=[t,e,n],a=s5(t,e,n),s=[];function o(){s.length&&r.push({ok:s}),s=[]}function l(d){for(var p=0;p{v();var Bi=1e3,Ni=Bi*60,$i=Ni*60,Gr=$i*24,u6=Gr*7,f6=Gr*365.25;J1.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return h6(t);if(n==="number"&&isFinite(t))return e.long?p6(t):d6(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function h6(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 n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*f6;case"weeks":case"week":case"w":return n*u6;case"days":case"day":case"d":return n*Gr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*$i;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ni;case"seconds":case"second":case"secs":case"sec":case"s":return n*Bi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function d6(t){var e=Math.abs(t);return e>=Gr?Math.round(t/Gr)+"d":e>=$i?Math.round(t/$i)+"h":e>=Ni?Math.round(t/Ni)+"m":e>=Bi?Math.round(t/Bi)+"s":t+"ms"}function p6(t){var e=Math.abs(t);return e>=Gr?Jo(t,e,Gr,"day"):e>=$i?Jo(t,e,$i,"hour"):e>=Ni?Jo(t,e,Ni,"minute"):e>=Bi?Jo(t,e,Bi,"second"):t+" ms"}function Jo(t,e,n,r){var i=e>=n*1.5;return Math.round(t/n)+" "+r+(i?"s":"")}});var ty=R((_D,ey)=>{v();function m6(t){n.debug=n,n.default=n,n.coerce=l,n.disable=a,n.enable=i,n.enabled=s,n.humanize=Q1(),n.destroy=c,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let h=0;h{if(A==="%%")return"%";k++;let E=n.formatters[y];if(typeof E=="function"){let _=m[k];A=E.call(w,_),m.splice(k,1),k--}return A}),n.formatArgs.call(w,m),(w.log||n.log).apply(w,m)}return g.namespace=u,g.useColors=n.useColors(),g.color=n.selectColor(u),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(d!==n.namespaces&&(d=n.namespaces,p=n.enabled(u)),p),set:m=>{h=m}}),typeof n.init=="function"&&n.init(g),g}function r(u,f){let h=n(this.namespace+(typeof f=="undefined"?":":f)+u);return h.log=this.log,h}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f,h=(typeof u=="string"?u:"").split(/[\s,]+/),d=h.length;for(f=0;f"-"+f)].join(",");return n.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let f,h;for(f=0,h=n.skips.length;f{v();Gt.formatArgs=y6;Gt.save=v6;Gt.load=w6;Gt.useColors=g6;Gt.storage=b6();Gt.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`."))}})();Gt.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 g6(){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 y6(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Qo.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(n++,i==="%c"&&(r=n))}),t.splice(r,0,e)}Gt.log=console.debug||console.log||(()=>{});function v6(t){try{t?Gt.storage.setItem("debug",t):Gt.storage.removeItem("debug")}catch(e){}}function w6(){let t;try{t=Gt.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function b6(){try{return localStorage}catch(t){}}Qo.exports=ty()(Gt);var{formatters:x6}=Qo.exports;x6.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ny=R(Vt=>{"use strict";v();var _6=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vt,"__esModule",{value:!0});var S6=require("fs"),E6=_6(el()),Hi=E6.default("@kwsites/file-exists");function k6(t,e,n){Hi("checking %s",t);try{let r=S6.statSync(t);return r.isFile()&&e?(Hi("[OK] path represents a file"),!0):r.isDirectory()&&n?(Hi("[OK] path represents a directory"),!0):(Hi("[FAIL] path represents something other than a file or directory"),!1)}catch(r){if(r.code==="ENOENT")return Hi("[FAIL] path is not accessible: %o",r),!1;throw Hi("[FATAL] %o",r),r}}function A6(t,e=Vt.READABLE){return k6(t,(e&Vt.FILE)>0,(e&Vt.FOLDER)>0)}Vt.exists=A6;Vt.FILE=1;Vt.FOLDER=2;Vt.READABLE=Vt.FILE+Vt.FOLDER});var ry=R(tl=>{"use strict";v();function T6(t){for(var e in t)tl.hasOwnProperty(e)||(tl[e]=t[e])}Object.defineProperty(tl,"__esModule",{value:!0});T6(ny())});var Wf=R(Vr=>{"use strict";v();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.createDeferred=Vr.deferred=void 0;function Vf(){let t,e,n="pending";return{promise:new Promise((i,a)=>{t=i,e=a}),done(i){n==="pending"&&(n="resolved",t(i))},fail(i){n==="pending"&&(n="rejected",e(i))},get fulfilled(){return n!=="pending"},get status(){return n}}}Vr.deferred=Vf;Vr.createDeferred=Vf;Vr.default=Vf});var zw=R((h9,Uw)=>{"use strict";v();Uw.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 Vw=R((p9,Gw)=>{v();var Bh={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}};Gw.exports=function(t,e,n,r){if(!Bh.hasOwnProperty(n))throw new Error("Cannot convert to "+n);if(!Bh[n].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+n);var i=Bh[n][e]*t;return r!==!1?(r=Math.pow(10,parseInt(r)||5),Math.round(i*r)/r):i}});var a2=R(Vn=>{"use strict";v();Object.defineProperty(Vn,"__esModule",{value:!0});Vn.fromRgba=qi;Vn.fromRgb=Nh;Vn.fromHsla=El;Vn.fromHsl=r2;Vn.fromString=i2;Vn.default=void 0;var Ww=Yw(zw()),BM=Yw(Vw());function Yw(t){return t&&t.__esModule?t:{default:t}}function NM(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n-1}function VM(t,e,n){var r=t/255,i=e/255,a=n/255,s=Math.max(r,i,a),o=Math.min(r,i,a),l=s-o,c=(s+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(s){case r:return(i-a)/l%6;case i:return(a-r)/l+2;default:return(r-i)/l+4}}();return[f*60,u*100,c*100]}function WM(t,e,n){var r=t/60,i=e/100,a=n/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(r%2-1)),l=a-s/2,c=function(){return r<1?[s,o,0]:r<2?[o,s,0]:r<3?[0,s,o]:r<4?[0,o,s]:r<5?[o,0,s]:[s,0,o]}(),u=Ft(c,3),f=u[0],h=u[1],d=u[2];return[(f+l)*255,(h+l)*255,(d+l)*255]}var qM=function(){function t(e){var n=Ft(e,4),r=n[0],i=n[1],a=n[2],s=n[3];NM(this,t),this.values=[Math.max(Math.min(parseInt(r,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return $M(t,[{key:"toRgbString",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return s===1?"rgb(".concat(r,", ").concat(i,", ").concat(a,")"):"rgba(".concat(r,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var n=this.toHslaArray(),r=Ft(n,4),i=r[0],a=r[1],s=r[2],o=r[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return r=Number(r).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(r).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3],o=VM(r,i,a),l=Ft(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,s]}}]),t}();function qi(t){var e=Ft(t,4),n=e[0],r=e[1],i=e[2],a=e[3];return new qM([n,r,i,a])}function Nh(t){var e=Ft(t,3),n=e[0],r=e[1],i=e[2];return qi([n,r,i,1])}function El(t){var e=Ft(t,4),n=e[0],r=e[1],i=e[2],a=e[3],s=WM(n,r,i),o=Ft(s,3),l=o[0],c=o[1],u=o[2];return qi([l,c,u,a])}function r2(t){var e=Ft(t,3),n=e[0],r=e[1],i=e[2];return El([n,r,i,1])}function XM(t){var e=Zw.exec(t)||Kw.exec(t),n=Ft(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=parseInt(r.length<2?r.repeat(2):r,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,qi([r,i,a,s])}function YM(t){var e=Jw.exec(t)||e2.exec(t)||Qw.exec(t)||t2.exec(t),n=Ft(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=Cs(r,"%")?parseInt(r,10)*255/100:parseInt(r,10),i=Cs(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=Cs(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Cs(s,"%")?100:1),qi([r,i,a,s])}function ZM(t){var e=n2.exec(t),n=Ft(e,6),r=n[1],i=n[2],a=n[3],s=n[4],o=n[5];return i=i||"deg",r=(0,BM.default)(parseFloat(r),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Cs(o,"%")?100:1),El([r,a,s,o])}function i2(t){return Ww.default[t]?Nh(Ww.default[t]):Zw.test(t)||Kw.test(t)?XM(t):Jw.test(t)||e2.test(t)||Qw.test(t)||t2.test(t)?YM(t):n2.test(t)?ZM(t):null}var KM={fromString:i2,fromRgb:Nh,fromRgba:qi,fromHsl:r2,fromHsla:El};Vn.default=KM});var $h=R((v9,o2)=>{"use strict";v();var s2=Object.prototype.toString;o2.exports=function(e){var n=s2.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&s2.call(e.callee)==="[object Function]"),r}});var g2=R((b9,m2)=>{"use strict";v();var p2;Object.keys||(Fs=Object.prototype.hasOwnProperty,Hh=Object.prototype.toString,l2=$h(),Uh=Object.prototype.propertyIsEnumerable,c2=!Uh.call({toString:null},"toString"),u2=Uh.call(function(){},"prototype"),Ms=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],kl=function(t){var e=t.constructor;return e&&e.prototype===t},f2={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h2=function(){if(typeof window=="undefined")return!1;for(var t in window)try{if(!f2["$"+t]&&Fs.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{kl(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),d2=function(t){if(typeof window=="undefined"||!h2)return kl(t);try{return kl(t)}catch(e){return!1}},p2=function(e){var n=e!==null&&typeof e=="object",r=Hh.call(e)==="[object Function]",i=l2(e),a=n&&Hh.call(e)==="[object String]",s=[];if(!n&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var o=u2&&r;if(a&&e.length>0&&!Fs.call(e,0))for(var l=0;l0)for(var c=0;c{"use strict";v();var JM=Array.prototype.slice,QM=$h(),y2=Object.keys,Al=y2?function(e){return y2(e)}:g2(),v2=Object.keys;Al.shim=function(){if(Object.keys){var e=function(){var n=Object.keys(arguments);return n&&n.length===arguments.length}(1,2);e||(Object.keys=function(r){return QM(r)?v2(JM.call(r)):v2(r)})}else Object.keys=Al;return Object.keys||Al};w2.exports=Al});var x2=R((E9,b2)=>{"use strict";v();b2.exports=Error});var S2=R((A9,_2)=>{"use strict";v();_2.exports=EvalError});var k2=R((C9,E2)=>{"use strict";v();E2.exports=RangeError});var T2=R((M9,A2)=>{"use strict";v();A2.exports=ReferenceError});var zh=R((P9,C2)=>{"use strict";v();C2.exports=SyntaxError});var Wn=R((R9,F2)=>{"use strict";v();F2.exports=TypeError});var O2=R((j9,M2)=>{"use strict";v();M2.exports=URIError});var Os=R((B9,P2)=>{"use strict";v();P2.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[n]=i;for(n 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]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,n);if(s.value!==i||s.enumerable!==!0)return!1}return!0}});var Cl=R(($9,R2)=>{"use strict";v();var I2=typeof Symbol!="undefined"&&Symbol,eO=Os();R2.exports=function(){return typeof I2!="function"||typeof Symbol!="function"||typeof I2("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:eO()}});var j2=R((U9,L2)=>{"use strict";v();var Gh={__proto__:null,foo:{}},tO=Object;L2.exports=function(){return{__proto__:Gh}.foo===Gh.foo&&!(Gh instanceof tO)}});var N2=R((G9,B2)=>{"use strict";v();var nO="Function.prototype.bind called on incompatible ",rO=Object.prototype.toString,iO=Math.max,aO="[object Function]",D2=function(e,n){for(var r=[],i=0;i{"use strict";v();var lO=N2();$2.exports=Function.prototype.bind||lO});var Vh=R((X9,H2)=>{"use strict";v();var cO=Function.prototype.call,uO=Object.prototype.hasOwnProperty,fO=Fl();H2.exports=fO.call(cO,uO)});var pn=R((Z9,W2)=>{"use strict";v();var pe,hO=x2(),dO=S2(),pO=k2(),mO=T2(),Ki=zh(),Zi=Wn(),gO=O2(),V2=Function,Wh=function(t){try{return V2('"use strict"; return ('+t+").constructor;")()}catch(e){}},Yr=Object.getOwnPropertyDescriptor;if(Yr)try{Yr({},"")}catch(t){Yr=null}var qh=function(){throw new Zi},yO=Yr?function(){try{return arguments.callee,qh}catch(t){try{return Yr(arguments,"callee").get}catch(e){return qh}}}():qh,Xi=Cl()(),vO=j2()(),ft=Object.getPrototypeOf||(vO?function(t){return t.__proto__}:null),Yi={},wO=typeof Uint8Array=="undefined"||!ft?pe:ft(Uint8Array),Zr={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?pe:ArrayBuffer,"%ArrayIteratorPrototype%":Xi&&ft?ft([][Symbol.iterator]()):pe,"%AsyncFromSyncIteratorPrototype%":pe,"%AsyncFunction%":Yi,"%AsyncGenerator%":Yi,"%AsyncGeneratorFunction%":Yi,"%AsyncIteratorPrototype%":Yi,"%Atomics%":typeof Atomics=="undefined"?pe:Atomics,"%BigInt%":typeof BigInt=="undefined"?pe:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":hO,"%eval%":eval,"%EvalError%":dO,"%Float32Array%":typeof Float32Array=="undefined"?pe:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?pe:FinalizationRegistry,"%Function%":V2,"%GeneratorFunction%":Yi,"%Int8Array%":typeof Int8Array=="undefined"?pe:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?pe:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Xi&&ft?ft(ft([][Symbol.iterator]())):pe,"%JSON%":typeof JSON=="object"?JSON:pe,"%Map%":typeof Map=="undefined"?pe:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Xi||!ft?pe:ft(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?pe:Promise,"%Proxy%":typeof Proxy=="undefined"?pe:Proxy,"%RangeError%":pO,"%ReferenceError%":mO,"%Reflect%":typeof Reflect=="undefined"?pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?pe:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Xi||!ft?pe:ft(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Xi&&ft?ft(""[Symbol.iterator]()):pe,"%Symbol%":Xi?Symbol:pe,"%SyntaxError%":Ki,"%ThrowTypeError%":yO,"%TypedArray%":wO,"%TypeError%":Zi,"%Uint8Array%":typeof Uint8Array=="undefined"?pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?pe:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?pe:Uint32Array,"%URIError%":gO,"%WeakMap%":typeof WeakMap=="undefined"?pe:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?pe:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?pe:WeakSet};if(ft)try{null.error}catch(t){U2=ft(ft(t)),Zr["%Error.prototype%"]=U2}var U2,bO=function t(e){var n;if(e==="%AsyncFunction%")n=Wh("async function () {}");else if(e==="%GeneratorFunction%")n=Wh("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=Wh("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&ft&&(n=ft(i.prototype))}return Zr[e]=n,n},z2={__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"]},Ps=Fl(),Ml=Vh(),xO=Ps.call(Function.call,Array.prototype.concat),_O=Ps.call(Function.apply,Array.prototype.splice),G2=Ps.call(Function.call,String.prototype.replace),Ol=Ps.call(Function.call,String.prototype.slice),SO=Ps.call(Function.call,RegExp.prototype.exec),EO=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,kO=/\\(\\)?/g,AO=function(e){var n=Ol(e,0,1),r=Ol(e,-1);if(n==="%"&&r!=="%")throw new Ki("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Ki("invalid intrinsic syntax, expected opening `%`");var i=[];return G2(e,EO,function(a,s,o,l){i[i.length]=o?G2(l,kO,"$1"):s||a}),i},TO=function(e,n){var r=e,i;if(Ml(z2,r)&&(i=z2[r],r="%"+i[0]+"%"),Ml(Zr,r)){var a=Zr[r];if(a===Yi&&(a=bO(r)),typeof a=="undefined"&&!n)throw new Zi("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new Ki("intrinsic "+e+" does not exist!")};W2.exports=function(e,n){if(typeof e!="string"||e.length===0)throw new Zi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Zi('"allowMissing" argument must be a boolean');if(SO(/^%?[^%]*%?$/,e)===null)throw new Ki("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=AO(e),i=r.length>0?r[0]:"",a=TO("%"+i+"%",n),s=a.name,o=a.value,l=!1,c=a.alias;c&&(i=c[0],_O(r,xO([0,1],c)));for(var u=1,f=!0;u=r.length){var g=Yr(o,h);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[h]}else f=Ml(o,h),o=o[h];f&&!l&&(Zr[s]=o)}}return o}});var Il=R((J9,q2)=>{"use strict";v();var CO=pn(),Pl=CO("%Object.defineProperty%",!0)||!1;if(Pl)try{Pl({},"a",{value:1})}catch(t){Pl=!1}q2.exports=Pl});var Ll=R((eB,X2)=>{"use strict";v();var FO=pn(),Rl=FO("%Object.getOwnPropertyDescriptor%",!0);if(Rl)try{Rl([],"length")}catch(t){Rl=null}X2.exports=Rl});var jl=R((nB,K2)=>{"use strict";v();var Y2=Il(),MO=zh(),Ji=Wn(),Z2=Ll();K2.exports=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Ji("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Ji("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ji("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ji("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ji("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ji("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!Z2&&Z2(e,n);if(Y2)Y2(e,n,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:a===null&&l?l.writable:!a});else if(o||!i&&!a&&!s)e[n]=r;else throw new MO("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Dl=R((iB,Q2)=>{"use strict";v();var Xh=Il(),J2=function(){return!!Xh};J2.hasArrayLengthDefineBug=function(){if(!Xh)return null;try{return Xh([],"length",{value:1}).length!==1}catch(e){return!0}};Q2.exports=J2});var hr=R((sB,rb)=>{"use strict";v();var OO=Tl(),PO=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",IO=Object.prototype.toString,RO=Array.prototype.concat,eb=jl(),LO=function(t){return typeof t=="function"&&IO.call(t)==="[object Function]"},tb=Dl()(),jO=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!LO(r)||!r())return}tb?eb(t,e,n,!0):eb(t,e,n)},nb=function(t,e){var n=arguments.length>2?arguments[2]:{},r=OO(e);PO&&(r=RO.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i{"use strict";v();var DO=pn(),ib=jl(),BO=Dl()(),ab=Ll(),sb=Wn(),NO=DO("%Math.floor%");ob.exports=function(e,n){if(typeof e!="function")throw new sb("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||NO(n)!==n)throw new sb("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&ab){var s=ab(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!r)&&(BO?ib(e,"length",n,!0,!0):ib(e,"length",n)),e}});var Kr=R((uB,Bl)=>{"use strict";v();var Yh=Fl(),Nl=pn(),$O=lb(),HO=Wn(),fb=Nl("%Function.prototype.apply%"),hb=Nl("%Function.prototype.call%"),db=Nl("%Reflect.apply%",!0)||Yh.call(hb,fb),cb=Il(),UO=Nl("%Math.max%");Bl.exports=function(e){if(typeof e!="function")throw new HO("a function is required");var n=db(Yh,hb,arguments);return $O(n,1+UO(0,e.length-(arguments.length-1)),!0)};var ub=function(){return db(Yh,fb,arguments)};cb?cb(Bl.exports,"apply",{value:ub}):Bl.exports.apply=ub});var qt=R((hB,gb)=>{"use strict";v();var pb=pn(),mb=Kr(),zO=mb(pb("String.prototype.indexOf"));gb.exports=function(e,n){var r=pb(e,!!n);return typeof r=="function"&&zO(e,".prototype.")>-1?mb(r):r}});var Zh=R((pB,xb)=>{"use strict";v();var GO=Tl(),wb=Os()(),bb=qt(),yb=Object,VO=bb("Array.prototype.push"),vb=bb("Object.prototype.propertyIsEnumerable"),WO=wb?Object.getOwnPropertySymbols:null;xb.exports=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=yb(e);if(arguments.length===1)return r;for(var i=1;i{"use strict";v();var Kh=Zh(),qO=function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),n={},r=0;r{"use strict";v();var YO=hr(),ZO=Jh();Sb.exports=function(){var e=ZO();return YO(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var Cb=R((bB,Tb)=>{"use strict";v();var KO=hr(),JO=Kr(),QO=Zh(),kb=Jh(),eP=Eb(),tP=JO.apply(kb()),Ab=function(e,n){return tP(Object,arguments)};KO(Ab,{getPolyfill:kb,implementation:QO,shim:eP});Tb.exports=Ab});var Mb=R((_B,Fb)=>{"use strict";v();var Rs=function(){return typeof function(){}.name=="string"},Is=Object.getOwnPropertyDescriptor;if(Is)try{Is([],"length")}catch(t){Is=null}Rs.functionsHaveConfigurableNames=function(){if(!Rs()||!Is)return!1;var e=Is(function(){},"name");return!!e&&!!e.configurable};var nP=Function.prototype.bind;Rs.boundFunctionsHaveNames=function(){return Rs()&&typeof nP=="function"&&function(){}.bind().name!==""};Fb.exports=Rs});var Ib=R((EB,Pb)=>{"use strict";v();var Ob=jl(),rP=Dl()(),iP=Mb().functionsHaveConfigurableNames(),aP=Wn();Pb.exports=function(e,n){if(typeof e!="function")throw new aP("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||iP)&&(rP?Ob(e,"name",n,!0,!0):Ob(e,"name",n)),e}});var Qh=R((AB,Rb)=>{"use strict";v();var sP=Ib(),oP=Wn(),lP=Object;Rb.exports=sP(function(){if(this==null||this!==lP(this))throw new oP("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var ed=R((CB,Lb)=>{"use strict";v();var cP=Qh(),uP=hr().supportsDescriptors,fP=Object.getOwnPropertyDescriptor;Lb.exports=function(){if(uP&&/a/mig.flags==="gim"){var e=fP(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),e.get.call(r),n==="dy")return e.get}}return cP}});var Bb=R((MB,Db)=>{"use strict";v();var hP=hr().supportsDescriptors,dP=ed(),pP=Object.getOwnPropertyDescriptor,mP=Object.defineProperty,gP=TypeError,jb=Object.getPrototypeOf,yP=/a/;Db.exports=function(){if(!hP||!jb)throw new gP("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=dP(),n=jb(yP),r=pP(n,"flags");return(!r||r.get!==e)&&mP(n,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var Ub=R((PB,Hb)=>{"use strict";v();var vP=hr(),wP=Kr(),bP=Qh(),Nb=ed(),xP=Bb(),$b=wP(Nb());vP($b,{getPolyfill:Nb,implementation:bP,shim:xP});Hb.exports=$b});var dr=R((RB,zb)=>{"use strict";v();var _P=Os();zb.exports=function(){return _P()&&!!Symbol.toStringTag}});var nd=R((jB,Vb)=>{"use strict";v();var SP=dr()(),EP=qt(),td=EP("Object.prototype.toString"),$l=function(e){return SP&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:td(e)==="[object Arguments]"},Gb=function(e){return $l(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&td(e)!=="[object Array]"&&td(e.callee)==="[object Function]"},kP=function(){return $l(arguments)}();$l.isLegacyArguments=Gb;Vb.exports=kP?$l:Gb});var Wb=R(()=>{v()});var hx=R((HB,fx)=>{v();var hd=typeof Map=="function"&&Map.prototype,rd=Object.getOwnPropertyDescriptor&&hd?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ul=hd&&rd&&typeof rd.get=="function"?rd.get:null,qb=hd&&Map.prototype.forEach,dd=typeof Set=="function"&&Set.prototype,id=Object.getOwnPropertyDescriptor&&dd?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,zl=dd&&id&&typeof id.get=="function"?id.get:null,Xb=dd&&Set.prototype.forEach,AP=typeof WeakMap=="function"&&WeakMap.prototype,js=AP?WeakMap.prototype.has:null,TP=typeof WeakSet=="function"&&WeakSet.prototype,Ds=TP?WeakSet.prototype.has:null,CP=typeof WeakRef=="function"&&WeakRef.prototype,Yb=CP?WeakRef.prototype.deref:null,FP=Boolean.prototype.valueOf,MP=Object.prototype.toString,OP=Function.prototype.toString,PP=String.prototype.match,pd=String.prototype.slice,mr=String.prototype.replace,IP=String.prototype.toUpperCase,Zb=String.prototype.toLowerCase,ax=RegExp.prototype.test,Kb=Array.prototype.concat,On=Array.prototype.join,RP=Array.prototype.slice,Jb=Math.floor,od=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ad=Object.getOwnPropertySymbols,ld=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",yt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qi||!0)?Symbol.toStringTag:null,sx=Object.prototype.propertyIsEnumerable,Qb=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function ex(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||ax.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Jb(-t):Jb(t);if(r!==t){var i=String(r),a=pd.call(e,i.length+1);return mr.call(i,n,"$&_")+"."+mr.call(mr.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return mr.call(e,n,"$&_")}var cd=Wb(),tx=cd.custom,nx=lx(tx)?tx:null;fx.exports=function t(e,n,r,i){var a=n||{};if(pr(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pr(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=pr(a,"customInspect")?a.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(pr(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(pr(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=a.numericSeparator;if(typeof e=="undefined")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return ux(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?ex(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return o?ex(e,c):c}var u=typeof a.depth=="undefined"?5:a.depth;if(typeof r=="undefined"&&(r=0),r>=u&&u>0&&typeof e=="object")return ud(e)?"[Array]":"[Object]";var f=JP(a,r);if(typeof i=="undefined")i=[];else if(cx(i,e)>=0)return"[Circular]";function h(N,j,Y){if(j&&(i=RP.call(i),i.push(j)),Y){var le={depth:a.depth};return pr(a,"quoteStyle")&&(le.quoteStyle=a.quoteStyle),t(N,le,r+1,i)}return t(N,a,r+1,i)}if(typeof e=="function"&&!rx(e)){var d=zP(e),p=Hl(e,h);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(p.length>0?" { "+On.call(p,", ")+" }":"")}if(lx(e)){var g=Qi?mr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):ld.call(e);return typeof e=="object"&&!Qi?Ls(g):g}if(YP(e)){for(var m="<"+Zb.call(String(e.nodeName)),w=e.attributes||[],b=0;b",m}if(ud(e)){if(e.length===0)return"[]";var S=Hl(e,h);return f&&!KP(S)?"["+fd(S,f)+"]":"[ "+On.call(S,", ")+" ]"}if(DP(e)){var k=Hl(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!sx.call(e,"cause")?"{ ["+String(e)+"] "+On.call(Kb.call("[cause]: "+h(e.cause),k),", ")+" }":k.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+On.call(k,", ")+" }"}if(typeof e=="object"&&s){if(nx&&typeof e[nx]=="function"&&cd)return cd(e,{depth:u-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(GP(e)){var x=[];return qb&&qb.call(e,function(N,j){x.push(h(j,e,!0)+" => "+h(N,e))}),ix("Map",Ul.call(e),x,f)}if(qP(e)){var A=[];return Xb&&Xb.call(e,function(N){A.push(h(N,e))}),ix("Set",zl.call(e),A,f)}if(VP(e))return sd("WeakMap");if(XP(e))return sd("WeakSet");if(WP(e))return sd("WeakRef");if(NP(e))return Ls(h(Number(e)));if(HP(e))return Ls(h(od.call(e)));if($P(e))return Ls(FP.call(e));if(BP(e))return Ls(h(String(e)));if(typeof window!="undefined"&&e===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&e===globalThis||typeof global!="undefined"&&e===global)return"{ [object globalThis] }";if(!jP(e)&&!rx(e)){var y=Hl(e,h),E=Qb?Qb(e)===Object.prototype:e instanceof Object||e.constructor===Object,_=e instanceof Object?"":"null prototype",C=!E&&yt&&Object(e)===e&&yt in e?pd.call(gr(e),8,-1):_?"Object":"",M=E||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",L=M+(C||_?"["+On.call(Kb.call([],C||[],_||[]),": ")+"] ":"");return y.length===0?L+"{}":f?L+"{"+fd(y,f)+"}":L+"{ "+On.call(y,", ")+" }"}return String(e)};function ox(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function LP(t){return mr.call(String(t),/"/g,""")}function ud(t){return gr(t)==="[object Array]"&&(!yt||!(typeof t=="object"&&yt in t))}function jP(t){return gr(t)==="[object Date]"&&(!yt||!(typeof t=="object"&&yt in t))}function rx(t){return gr(t)==="[object RegExp]"&&(!yt||!(typeof t=="object"&&yt in t))}function DP(t){return gr(t)==="[object Error]"&&(!yt||!(typeof t=="object"&&yt in t))}function BP(t){return gr(t)==="[object String]"&&(!yt||!(typeof t=="object"&&yt in t))}function NP(t){return gr(t)==="[object Number]"&&(!yt||!(typeof t=="object"&&yt in t))}function $P(t){return gr(t)==="[object Boolean]"&&(!yt||!(typeof t=="object"&&yt in t))}function lx(t){if(Qi)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!ld)return!1;try{return ld.call(t),!0}catch(e){}return!1}function HP(t){if(!t||typeof t!="object"||!od)return!1;try{return od.call(t),!0}catch(e){}return!1}var UP=Object.prototype.hasOwnProperty||function(t){return t in this};function pr(t,e){return UP.call(t,e)}function gr(t){return MP.call(t)}function zP(t){if(t.name)return t.name;var e=PP.call(OP.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function cx(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return ux(pd.call(t,0,e.maxStringLength),e)+r}var i=mr.call(mr.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ZP);return ox(i,"single",e)}function ZP(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+IP.call(e.toString(16))}function Ls(t){return"Object("+t+")"}function sd(t){return t+" { ? }"}function ix(t,e,n,r){var i=r?fd(n,r):On.call(n,", ");return t+" ("+e+") {"+i+"}"}function KP(t){for(var e=0;e=0)return!1;return!0}function JP(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=On.call(Array(t.indent+1)," ");else return null;return{base:n,prev:On.call(Array(e+1),n)}}function fd(t,e){if(t.length===0)return"";var n=` +`+e.prev+e.base;return n+On.call(t,","+n)+` +`+e.prev}function Hl(t,e){var n=ud(t),r=[];if(n){r.length=t.length;for(var i=0;i{"use strict";v();var dx=pn(),ea=qt(),QP=hx(),eI=Wn(),Gl=dx("%WeakMap%",!0),Vl=dx("%Map%",!0),tI=ea("WeakMap.prototype.get",!0),nI=ea("WeakMap.prototype.set",!0),rI=ea("WeakMap.prototype.has",!0),iI=ea("Map.prototype.get",!0),aI=ea("Map.prototype.set",!0),sI=ea("Map.prototype.has",!0),md=function(t,e){for(var n=t,r;(r=n.next)!==null;n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r},oI=function(t,e){var n=md(t,e);return n&&n.value},lI=function(t,e,n){var r=md(t,e);r?r.value=n:t.next={key:e,next:t.next,value:n}},cI=function(t,e){return!!md(t,e)};px.exports=function(){var e,n,r,i={assert:function(a){if(!i.has(a))throw new eI("Side channel does not contain "+QP(a))},get:function(a){if(Gl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return tI(e,a)}else if(Vl){if(n)return iI(n,a)}else if(r)return oI(r,a)},has:function(a){if(Gl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return rI(e,a)}else if(Vl){if(n)return sI(n,a)}else if(r)return cI(r,a);return!1},set:function(a,s){Gl&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new Gl),nI(e,a,s)):Vl?(n||(n=new Vl),aI(n,a,s)):(r||(r={key:{},next:null}),lI(r,a,s))}};return i}});var gx=R((VB,mx)=>{"use strict";v();var uI=Vh(),Bs=gd()(),qn=Wn(),yd={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");if(Bs.assert(t),!yd.has(t,e))throw new qn("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var n=Bs.get(t);return n&&n["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var n=Bs.get(t);return!!n&&uI(n,"$"+e)},set:function(t,e,n){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var r=Bs.get(t);r||(r={},Bs.set(t,r)),r["$"+e]=n}};Object.freeze&&Object.freeze(yd);mx.exports=yd});var wx=R((qB,vx)=>{"use strict";v();var Ns=gx(),fI=SyntaxError,yx=typeof StopIteration=="object"?StopIteration:null;vx.exports=function(e){if(!yx)throw new fI("this environment lacks StopIteration");Ns.set(e,"[[Done]]",!1);var n={next:function(){var i=Ns.get(this,"[[Iterator]]"),a=Ns.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Ns.set(i,"[[Done]]",!0),s!==yx)throw s;return{done:!0,value:void 0}}}};return Ns.set(n,"[[Iterator]]",e),n}});var vd=R((YB,bx)=>{v();var hI={}.toString;bx.exports=Array.isArray||function(t){return hI.call(t)=="[object Array]"}});var wd=R((KB,xx)=>{"use strict";v();var dI=String.prototype.valueOf,pI=function(e){try{return dI.call(e),!0}catch(n){return!1}},mI=Object.prototype.toString,gI="[object String]",yI=dr()();xx.exports=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:yI?pI(e):mI.call(e)===gI}});var xd=R((QB,Ex)=>{"use strict";v();var bd=typeof Map=="function"&&Map.prototype?Map:null,vI=typeof Set=="function"&&Set.prototype?Set:null,Wl;bd||(Wl=function(e){return!1});var Sx=bd?Map.prototype.has:null,_x=vI?Set.prototype.has:null;!Wl&&!Sx&&(Wl=function(e){return!1});Ex.exports=Wl||function(e){if(!e||typeof e!="object")return!1;try{if(Sx.call(e),_x)try{_x.call(e)}catch(n){return!0}return e instanceof bd}catch(n){}return!1}});var Sd=R((tN,Tx)=>{"use strict";v();var wI=typeof Map=="function"&&Map.prototype?Map:null,_d=typeof Set=="function"&&Set.prototype?Set:null,ql;_d||(ql=function(e){return!1});var kx=wI?Map.prototype.has:null,Ax=_d?Set.prototype.has:null;!ql&&!Ax&&(ql=function(e){return!1});Tx.exports=ql||function(e){if(!e||typeof e!="object")return!1;try{if(Ax.call(e),kx)try{kx.call(e)}catch(n){return!0}return e instanceof _d}catch(n){}return!1}});var Nx=R((rN,Zl)=>{"use strict";v();var Cx=nd(),Fx=wx();Cl()()||Os()()?(Xl=Symbol.iterator,Zl.exports=function(e){if(e!=null&&typeof e[Xl]!="undefined")return e[Xl]();if(Cx(e))return Array.prototype[Xl].call(e)}):(Mx=vd(),Ox=wd(),Ed=pn(),Px=Ed("%Map%",!0),Ix=Ed("%Set%",!0),rn=qt(),kd=rn("Array.prototype.push"),Ad=rn("String.prototype.charCodeAt"),Rx=rn("String.prototype.slice"),Lx=function(e,n){var r=e.length;if(n+1>=r)return n+1;var i=Ad(e,n);if(i<55296||i>56319)return n+1;var a=Ad(e,n+1);return a<56320||a>57343?n+1:n+2},Yl=function(e){var n=0;return{next:function(){var i=n>=e.length,a;return i||(a=e[n],n+=1),{done:i,value:a}}}},Td=function(e,n){if(Mx(e)||Cx(e))return Yl(e);if(Ox(e)){var r=0;return{next:function(){var a=Lx(e,r),s=Rx(e,r,a);return r=a,{done:a>e.length,value:s}}}}if(n&&typeof e["_es6-shim iterator_"]!="undefined")return e["_es6-shim iterator_"]()},!Px&&!Ix?Zl.exports=function(e){if(e!=null)return Td(e,!0)}:(jx=xd(),Dx=Sd(),Cd=rn("Map.prototype.forEach",!0),Fd=rn("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(Md=rn("Map.prototype.iterator",!0),Od=rn("Set.prototype.iterator",!0)),Pd=rn("Map.prototype.@@iterator",!0)||rn("Map.prototype._es6-shim iterator_",!0),Id=rn("Set.prototype.@@iterator",!0)||rn("Set.prototype._es6-shim iterator_",!0),Bx=function(e){if(jx(e)){if(Md)return Fx(Md(e));if(Pd)return Pd(e);if(Cd){var n=[];return Cd(e,function(i,a){kd(n,[a,i])}),Yl(n)}}if(Dx(e)){if(Od)return Fx(Od(e));if(Id)return Id(e);if(Fd){var r=[];return Fd(e,function(i){kd(r,i)}),Yl(r)}}},Zl.exports=function(e){return Bx(e)||Td(e)}));var Xl,Mx,Ox,Ed,Px,Ix,rn,kd,Ad,Rx,Lx,Yl,Td,jx,Dx,Cd,Fd,Md,Od,Pd,Id,Bx});var Rd=R((aN,Hx)=>{"use strict";v();var $x=function(t){return t!==t};Hx.exports=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||$x(e)&&$x(n))}});var Ld=R((oN,Ux)=>{"use strict";v();var bI=Rd();Ux.exports=function(){return typeof Object.is=="function"?Object.is:bI}});var Gx=R((cN,zx)=>{"use strict";v();var xI=Ld(),_I=hr();zx.exports=function(){var e=xI();return _I(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var Xx=R((fN,qx)=>{"use strict";v();var SI=hr(),EI=Kr(),kI=Rd(),Vx=Ld(),AI=Gx(),Wx=EI(Vx(),Object);SI(Wx,{getPolyfill:Vx,implementation:kI,shim:AI});qx.exports=Wx});var Dd=R((dN,Jx)=>{"use strict";v();var TI=Kr(),Kx=qt(),CI=pn(),jd=CI("%ArrayBuffer%",!0),Kl=Kx("ArrayBuffer.prototype.byteLength",!0),FI=Kx("Object.prototype.toString"),Yx=!!jd&&!Kl&&new jd(0).slice,Zx=!!Yx&&TI(Yx);Jx.exports=Kl||Zx?function(e){if(!e||typeof e!="object")return!1;try{return Kl?Kl(e):Zx(e,0),!0}catch(n){return!1}}:jd?function(e){return FI(e)==="[object ArrayBuffer]"}:function(e){return!1}});var e_=R((mN,Qx)=>{"use strict";v();var MI=Date.prototype.getDay,OI=function(e){try{return MI.call(e),!0}catch(n){return!1}},PI=Object.prototype.toString,II="[object Date]",RI=dr()();Qx.exports=function(e){return typeof e!="object"||e===null?!1:RI?OI(e):PI.call(e)===II}});var a_=R((yN,i_)=>{"use strict";v();var Bd=qt(),t_=dr()(),n_,r_,Nd,$d;t_&&(n_=Bd("Object.prototype.hasOwnProperty"),r_=Bd("RegExp.prototype.exec"),Nd={},Jl=function(){throw Nd},$d={toString:Jl,valueOf:Jl},typeof Symbol.toPrimitive=="symbol"&&($d[Symbol.toPrimitive]=Jl));var Jl,LI=Bd("Object.prototype.toString"),jI=Object.getOwnPropertyDescriptor,DI="[object RegExp]";i_.exports=t_?function(e){if(!e||typeof e!="object")return!1;var n=jI(e,"lastIndex"),r=n&&n_(n,"value");if(!r)return!1;try{r_(e,$d)}catch(i){return i===Nd}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:LI(e)===DI}});var l_=R((wN,o_)=>{"use strict";v();var BI=qt(),s_=BI("SharedArrayBuffer.prototype.byteLength",!0);o_.exports=s_?function(e){if(!e||typeof e!="object")return!1;try{return s_(e),!0}catch(n){return!1}}:function(e){return!1}});var u_=R((xN,c_)=>{"use strict";v();var NI=Number.prototype.toString,$I=function(e){try{return NI.call(e),!0}catch(n){return!1}},HI=Object.prototype.toString,UI="[object Number]",zI=dr()();c_.exports=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:zI?$I(e):HI.call(e)===UI}});var d_=R((SN,h_)=>{"use strict";v();var f_=qt(),GI=f_("Boolean.prototype.toString"),VI=f_("Object.prototype.toString"),WI=function(e){try{return GI(e),!0}catch(n){return!1}},qI="[object Boolean]",XI=dr()();h_.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:XI&&Symbol.toStringTag in e?WI(e):VI(e)===qI}});var y_=R((kN,Hd)=>{"use strict";v();var YI=Object.prototype.toString,ZI=Cl()();ZI?(p_=Symbol.prototype.toString,m_=/^Symbol\(.*\)$/,g_=function(e){return typeof e.valueOf()!="symbol"?!1:m_.test(p_.call(e))},Hd.exports=function(e){if(typeof e=="symbol")return!0;if(YI.call(e)!=="[object Symbol]")return!1;try{return g_(e)}catch(n){return!1}}):Hd.exports=function(e){return!1};var p_,m_,g_});var b_=R((TN,w_)=>{"use strict";v();var v_=typeof BigInt!="undefined"&&BigInt;w_.exports=function(){return typeof v_=="function"&&typeof BigInt=="function"&&typeof v_(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var S_=R((FN,Ud)=>{"use strict";v();var KI=b_()();KI?(x_=BigInt.prototype.valueOf,__=function(e){try{return x_.call(e),!0}catch(n){}return!1},Ud.exports=function(e){return e===null||typeof e=="undefined"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:__(e)}):Ud.exports=function(e){return!1};var x_,__});var k_=R((ON,E_)=>{"use strict";v();var JI=wd(),QI=u_(),eR=d_(),tR=y_(),nR=S_();E_.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(JI(e))return"String";if(QI(e))return"Number";if(eR(e))return"Boolean";if(tR(e))return"Symbol";if(nR(e))return"BigInt"}});var C_=R((IN,T_)=>{"use strict";v();var Ql=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,A_=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,ec;Ql||(ec=function(e){return!1});var Gd=Ql?Ql.prototype.has:null,zd=A_?A_.prototype.has:null;!ec&&!Gd&&(ec=function(e){return!1});T_.exports=ec||function(e){if(!e||typeof e!="object")return!1;try{if(Gd.call(e,Gd),zd)try{zd.call(e,zd)}catch(n){return!0}return e instanceof Ql}catch(n){}return!1}});var M_=R((LN,Wd)=>{"use strict";v();var rR=pn(),F_=qt(),iR=rR("%WeakSet%",!0),Vd=F_("WeakSet.prototype.has",!0);Vd?(tc=F_("WeakMap.prototype.has",!0),Wd.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Vd(e,Vd),tc)try{tc(e,tc)}catch(n){return!0}return e instanceof iR}catch(n){}return!1}):Wd.exports=function(e){return!1};var tc});var P_=R((DN,O_)=>{"use strict";v();var aR=xd(),sR=Sd(),oR=C_(),lR=M_();O_.exports=function(e){if(e&&typeof e=="object"){if(aR(e))return"Map";if(sR(e))return"Set";if(oR(e))return"WeakMap";if(lR(e))return"WeakSet"}return!1}});var j_=R((NN,L_)=>{"use strict";v();var R_=Function.prototype.toString,ta=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Xd,nc;if(typeof ta=="function"&&typeof Object.defineProperty=="function")try{Xd=Object.defineProperty({},"length",{get:function(){throw nc}}),nc={},ta(function(){throw 42},null,Xd)}catch(t){t!==nc&&(ta=null)}else ta=null;var cR=/^\s*class\b/,Yd=function(e){try{var n=R_.call(e);return cR.test(n)}catch(r){return!1}},qd=function(e){try{return Yd(e)?!1:(R_.call(e),!0)}catch(n){return!1}},rc=Object.prototype.toString,uR="[object Object]",fR="[object Function]",hR="[object GeneratorFunction]",dR="[object HTMLAllCollection]",pR="[object HTML document.all class]",mR="[object HTMLCollection]",gR=typeof Symbol=="function"&&!!Symbol.toStringTag,yR=!(0 in[,]),Zd=function(){return!1};typeof document=="object"&&(I_=document.all,rc.call(I_)===rc.call(document.all)&&(Zd=function(e){if((yR||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var n=rc.call(e);return(n===dR||n===pR||n===mR||n===uR)&&e("")==null}catch(r){}return!1}));var I_;L_.exports=ta?function(e){if(Zd(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ta(e,null,Xd)}catch(n){if(n!==nc)return!1}return!Yd(e)&&qd(e)}:function(e){if(Zd(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(gR)return qd(e);if(Yd(e))return!1;var n=rc.call(e);return n!==fR&&n!==hR&&!/^\[object HTML/.test(n)?!1:qd(e)}});var N_=R((HN,B_)=>{"use strict";v();var vR=j_(),wR=Object.prototype.toString,D_=Object.prototype.hasOwnProperty,bR=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),wR.call(e)==="[object Array]"?bR(e,n,i):typeof e=="string"?xR(e,n,i):_R(e,n,i)};B_.exports=SR});var H_=R((zN,$_)=>{"use strict";v();$_.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var z_=R((VN,U_)=>{"use strict";v();var Kd=H_(),ER=typeof globalThis=="undefined"?global:globalThis;U_.exports=function(){for(var e=[],n=0;n{"use strict";v();var ac=N_(),kR=z_(),G_=Kr(),ep=qt(),ic=Ll(),AR=ep("Object.prototype.toString"),W_=dr()(),V_=typeof globalThis=="undefined"?global:globalThis,Qd=kR(),tp=ep("String.prototype.slice"),Jd=Object.getPrototypeOf,TR=ep("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:FR(e)}return ic?CR(e):null}});var K_=R((YN,Z_)=>{"use strict";v();var MR=qt(),Y_=MR("ArrayBuffer.prototype.byteLength",!0),OR=Dd();Z_.exports=function(e){return OR(e)?Y_?Y_(e):e.byteLength:NaN}});var _S=R((KN,xS)=>{"use strict";v();var vS=Cb(),Pn=qt(),J_=Ub(),PR=pn(),na=Nx(),IR=gd(),Q_=Xx(),eS=nd(),tS=vd(),nS=Dd(),rS=e_(),iS=a_(),aS=l_(),sS=Tl(),oS=k_(),lS=P_(),cS=X_(),uS=K_(),fS=Pn("SharedArrayBuffer.prototype.byteLength",!0),hS=Pn("Date.prototype.getTime"),np=Object.getPrototypeOf,dS=Pn("Object.prototype.toString"),lc=PR("%Set%",!0),rp=Pn("Map.prototype.has",!0),cc=Pn("Map.prototype.get",!0),pS=Pn("Map.prototype.size",!0),uc=Pn("Set.prototype.add",!0),wS=Pn("Set.prototype.delete",!0),fc=Pn("Set.prototype.has",!0),oc=Pn("Set.prototype.size",!0);function mS(t,e,n,r){for(var i=na(t),a;(a=i.next())&&!a.done;)if(mn(e,a.value,n,r))return wS(t,a.value),!0;return!1}function bS(t){if(typeof t=="undefined")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function RR(t,e,n,r,i,a){var s=bS(n);if(s!=null)return s;var o=cc(e,s),l=vS({},i,{strict:!1});return typeof o=="undefined"&&!rp(e,s)||!mn(r,o,l,a)?!1:!rp(t,s)&&mn(r,o,l,a)}function LR(t,e,n){var r=bS(n);return r!=null?r:fc(e,r)&&!fc(t,r)}function gS(t,e,n,r,i,a){for(var s=na(t),o,l;(o=s.next())&&!o.done;)if(l=o.value,mn(n,l,i,a)&&mn(r,cc(e,l),i,a))return wS(t,l),!0;return!1}function mn(t,e,n,r){var i=n||{};if(i.strict?Q_(t,e):t===e)return!0;var a=oS(t),s=oS(e);if(a!==s)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Q_(t,e):t==e;var o=r.has(t),l=r.has(e),c;if(o&&l){if(r.get(t)===r.get(e))return!0}else c={};return o||r.set(t,c),l||r.set(e,c),BR(t,e,i,r)}function yS(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function jR(t,e,n,r){if(oc(t)!==oc(e))return!1;for(var i=na(t),a=na(e),s,o,l;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")l||(l=new lc),uc(l,s.value);else if(!fc(e,s.value)){if(n.strict||!LR(t,e,s.value))return!1;l||(l=new lc),uc(l,s.value)}if(l){for(;(o=a.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!mS(l,o.value,n.strict,r))return!1}else if(!n.strict&&!fc(t,o.value)&&!mS(l,o.value,n.strict,r))return!1;return oc(l)===0}return!0}function DR(t,e,n,r){if(pS(t)!==pS(e))return!1;for(var i=na(t),a=na(e),s,o,l,c,u,f;(s=i.next())&&!s.done;)if(c=s.value[0],u=s.value[1],c&&typeof c=="object")l||(l=new lc),uc(l,c);else if(f=cc(e,c),typeof f=="undefined"&&!rp(e,c)||!mn(u,f,n,r)){if(n.strict||!RR(t,e,c,u,n,r))return!1;l||(l=new lc),uc(l,c)}if(l){for(;(o=a.next())&&!o.done;)if(c=o.value[0],f=o.value[1],c&&typeof c=="object"){if(!gS(l,t,c,f,n,r))return!1}else if(!n.strict&&(!t.has(c)||!mn(cc(t,c),f,n,r))&&!gS(l,t,c,f,vS({},n,{strict:!1}),r))return!1;return oc(l)===0}return!0}function BR(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||dS(t)!==dS(e)||eS(t)!==eS(e))return!1;var s=tS(t),o=tS(e);if(s!==o)return!1;var l=t instanceof Error,c=e instanceof Error;if(l!==c||(l||c)&&(t.name!==e.name||t.message!==e.message))return!1;var u=iS(t),f=iS(e);if(u!==f||(u||f)&&(t.source!==e.source||J_(t)!==J_(e)))return!1;var h=rS(t),d=rS(e);if(h!==d||(h||d)&&hS(t)!==hS(e)||n.strict&&np&&np(t)!==np(e))return!1;var p=cS(t),g=cS(e);if(p!==g)return!1;if(p||g){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(A[i]!=y[i])return!1;for(i=A.length-1;i>=0;i--)if(a=A[i],!mn(t[a],e[a],n,r))return!1;var E=lS(t),_=lS(e);return E!==_?!1:E==="Set"||_==="Set"?jR(t,e,n,r):E==="Map"?DR(t,e,n,r):!0}xS.exports=function(e,n,r){return mn(e,n,r,IR())}});var cp=R((exports,module)=>{v();(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(n){return new Sha256(e,!0).update(n)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(i){return e.create().update(i)};for(var n=0;n>2]|=t[i]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|r&63)<=57344?(o[a>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<=64?(this.block=o[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=this.blocks,c,u,f,h,d,p,g,m,w,b,S;for(c=16;c<64;++c)d=l[c-15],u=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,d=l[c-2],f=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,l[c]=l[c-16]+u+l[c-7]+f<<0;for(S=e&n,c=0;c<64;c+=4)this.first?(this.is224?(m=300032,d=l[0]-1413257819,o=d-150054599<<0,r=d+24177077<<0):(m=704751109,d=l[0]-210244248,o=d-1521486534<<0,r=d+143694565<<0),this.first=!1):(u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),m=t&e,h=m^t&n^S,g=i&a^~i&s,d=o+f+g+K[c]+l[c],p=u+h,o=r+d<<0,r=d+p<<0),u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=r&t,h=w^r&e^m,g=o&i^~o&a,d=s+f+g+K[c+1]+l[c+1],p=u+h,s=n+d<<0,n=d+p<<0,u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=n&r,h=b^n&t^w,g=s&o^~s&i,d=a+f+g+K[c+2]+l[c+2],p=u+h,a=e+d<<0,e=d+p<<0,u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),S=e&n,h=S^e&r^b,g=a&s^~a&o,d=i+f+g+K[c+3]+l[c+3],p=u+h,i=t+d<<0,t=d+p<<0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+s<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15];return this.is224||(l+=HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,r>>24&255,r>>16&255,r>>8&255,r&255,i>>24&255,i>>16&255,i>>8&255,i&255,a>>24&255,a>>16&255,a>>8&255,a&255,s>>24&255,s>>16&255,s>>8&255,s&255];return this.is224||l.push(o>>24&255,o>>16&255,o>>8&255,o&255),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};function HmacSha256(t,e,n){var r,i=typeof t;if(i==="string"){var a=[],s=t.length,o=0,l;for(r=0;r>6,a[o++]=128|l&63):l<55296||l>=57344?(a[o++]=224|l>>12,a[o++]=128|l>>6&63,a[o++]=128|l&63):(l=65536+((l&1023)<<10|t.charCodeAt(++r)&1023),a[o++]=240|l>>18,a[o++]=128|l>>12&63,a[o++]=128|l>>6&63,a[o++]=128|l&63);t=a}else if(i==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);t.length>64&&(t=new Sha256(e,!0).update(t).array());var c=[],u=[];for(r=0;r<64;++r){var f=t[r]||0;c[r]=92^f,u[r]=54^f}Sha256.call(this,e,n),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=n}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var GE=R(Bp=>{v();(function(t){var e=/\S/,n=/\"/g,r=/\n/g,i=/\r/g,a=/\\/g,s=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(E,_){var C=E.length,M=0,L=1,N=2,j=M,Y=null,le=null,he="",ie=[],Me=!1,de=0,$=0,G="{{",D="}}";function se(){he.length>0&&(ie.push({tag:"_t",text:new String(he)}),he="")}function Se(){for(var st=!0,ee=$;ee"&&(Ee.indent=ie[Ie].text.toString()),ie.splice(Ie,1));else ee||ie.push({tag:` +`});Me=!1,$=ie.length}function be(st,ee){var Ie="="+D,Ee=st.indexOf(Ie,ee),z=c(st.substring(st.indexOf("=",ee)+1,Ee)).split(" ");return G=z[0],D=z[z.length-1],Ee+Ie.length-1}for(_&&(_=_.split(" "),G=_[0],D=_[1]),de=0;de0;){if(j=y.shift(),N&&N.tag=="<"&&!(j.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[j.tag]<=t.tags.$||d(j,C))_.push(j),j.nodes=h(y,j.tag,_,C);else if(j.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+j.n);if(L=_.pop(),j.n!=L.n&&!p(j.n,L.n,C))throw new Error("Nesting error: "+L.n+" vs. "+j.n);return L.end=j.i,M}else j.tag==` +`&&(j.last=y.length==0||y[0].tag==` +`);M.push(j)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return M}function d(y,E){for(var _=0,C=E.length;_":k,"<":function(y,E){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,_);var C=E.partials[k(y,E)];C.subs=_.subs,C.partials=_.partials},$:function(y,E){var _={subs:{},code:"",partials:E.partials,prefix:y.n};t.walk(y.nodes,_),E.subs[y.n]=_.code,E.inPartial||(E.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,E){E.code+=A('"\\n"'+(y.last?"":" + i"))},_v:function(y,E){E.code+="t.b(t.v(t."+S(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,E){E.code+=A('"'+b(y.text)+'"')},"{":x,"&":x};function x(y,E){E.code+="t.b(t.t(t."+S(y.n)+'("'+b(y.n)+'",c,p,0)));'}function A(y){return"t.b("+y+");"}t.walk=function(y,E){for(var _,C=0,M=y.length;C{v();var KL={};(function(t){t.Template=function(h,d,p,g){h=h||{},this.r=h.code||this.r,this.c=p,this.options=g||{},this.text=d||"",this.partials=h.partials||{},this.subs=h.subs||{},this.buf=""},t.Template.prototype={r:function(h,d,p){return""},v:u,t:c,render:function(d,p,g){return this.ri([d],p||{},g)},ri:function(h,d,p){return this.r(h,d,p)},ep:function(h,d){var p=this.partials[h],g=d[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[h].base=g,p.subs){d.stackText||(d.stackText={});for(key in p.subs)d.stackText[key]||(d.stackText[key]=this.activeSub!==void 0&&d.stackText[this.activeSub]?d.stackText[this.activeSub]:this.text);g=n(g,p.subs,p.partials,this.stackSubs,this.stackPartials,d.stackText)}return this.partials[h].instance=g,g},rp:function(h,d,p,g){var m=this.ep(h,p);return m?m.ri(d,p,g):""},rs:function(h,d,p){var g=h[h.length-1];if(!f(g)){p(h,d,this);return}for(var m=0;m=0;k--)if(w=d[k],m=e(h,w,S),m!==void 0){b=!0;break}return b?(!g&&typeof m=="function"&&(m=this.mv(m,d,p)),m):g?!1:""},ls:function(h,d,p,g,m){var w=this.options.delimiters;return this.options.delimiters=m,this.b(this.ct(c(h.call(d,g)),d,p)),this.options.delimiters=w,!1},ct:function(h,d,p){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(h,this.options).render(d,p)},b:function(h){this.buf+=h},fl:function(){var h=this.buf;return this.buf="",h},ms:function(h,d,p,g,m,w,b){var S,k=d[d.length-1],x=h.call(k);return typeof x=="function"?g?!0:(S=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(x,k,p,S.substring(m,w),b)):x},mv:function(h,d,p){var g=d[d.length-1],m=h.call(g);return typeof m=="function"?this.ct(c(m.call(g)),g,p):m},sub:function(h,d,p,g){var m=this.subs[h];m&&(this.activeSub=h,m(d,p,this,g),this.activeSub=!1)}};function e(h,d,p){var g;return d&&typeof d=="object"&&(d[h]!==void 0?g=d[h]:p&&d.get&&typeof d.get=="function"&&(g=d.get(h))),g}function n(h,d,p,g,m,w){function b(){}b.prototype=h;function S(){}S.prototype=h.subs;var k,x=new b;x.subs=new S,x.subsText={},x.buf="",g=g||{},x.stackSubs=g,x.subsText=w;for(k in d)g[k]||(g[k]=d[k]);for(k in g)x.subs[k]=g[k];m=m||{},x.stackPartials=m;for(k in p)m[k]||(m[k]=p[k]);for(k in m)x.partials[k]=m[k];return x}var r=/&/g,i=//g,s=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(h){return String(h==null?"":h)}function u(h){return h=c(h),l.test(h)?h.replace(r,"&").replace(i,"<").replace(a,">").replace(s,"'").replace(o,"""):h}var f=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"}})(typeof Np!="undefined"?Np:KL)});var $p=R((QU,WE)=>{v();var Vc=GE();Vc.Template=VE().Template;Vc.template=Vc.Template;WE.exports=Vc});var Fk=R((so,tm)=>{v();(function(e,n){typeof so=="object"&&typeof tm=="object"?tm.exports=n():typeof define=="function"&&define.amd?define([],n):typeof so=="object"?so.feather=n():e.feather=n()})(typeof self!="undefined"?self:so,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,a){n.o(r,i)||Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:a})},n.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=0)}({"./dist/icons.json":function(t){t.exports={activity:'',airplay:'',"alert-circle":'',"alert-octagon":'',"alert-triangle":'',"align-center":'',"align-justify":'',"align-left":'',"align-right":'',anchor:'',aperture:'',archive:'',"arrow-down-circle":'',"arrow-down-left":'',"arrow-down-right":'',"arrow-down":'',"arrow-left-circle":'',"arrow-left":'',"arrow-right-circle":'',"arrow-right":'',"arrow-up-circle":'',"arrow-up-left":'',"arrow-up-right":'',"arrow-up":'',"at-sign":'',award:'',"bar-chart-2":'',"bar-chart":'',"battery-charging":'',battery:'',"bell-off":'',bell:'',bluetooth:'',bold:'',"book-open":'',book:'',bookmark:'',box:'',briefcase:'',calendar:'',"camera-off":'',camera:'',cast:'',"check-circle":'',"check-square":'',check:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"chevrons-down":'',"chevrons-left":'',"chevrons-right":'',"chevrons-up":'',chrome:'',circle:'',clipboard:'',clock:'',"cloud-drizzle":'',"cloud-lightning":'',"cloud-off":'',"cloud-rain":'',"cloud-snow":'',cloud:'',code:'',codepen:'',codesandbox:'',coffee:'',columns:'',command:'',compass:'',copy:'',"corner-down-left":'',"corner-down-right":'',"corner-left-down":'',"corner-left-up":'',"corner-right-down":'',"corner-right-up":'',"corner-up-left":'',"corner-up-right":'',cpu:'',"credit-card":'',crop:'',crosshair:'',database:'',delete:'',disc:'',"divide-circle":'',"divide-square":'',divide:'',"dollar-sign":'',"download-cloud":'',download:'',dribbble:'',droplet:'',"edit-2":'',"edit-3":'',edit:'',"external-link":'',"eye-off":'',eye:'',facebook:'',"fast-forward":'',feather:'',figma:'',"file-minus":'',"file-plus":'',"file-text":'',file:'',film:'',filter:'',flag:'',"folder-minus":'',"folder-plus":'',folder:'',framer:'',frown:'',gift:'',"git-branch":'',"git-commit":'',"git-merge":'',"git-pull-request":'',github:'',gitlab:'',globe:'',grid:'',"hard-drive":'',hash:'',headphones:'',heart:'',"help-circle":'',hexagon:'',home:'',image:'',inbox:'',info:'',instagram:'',italic:'',key:'',layers:'',layout:'',"life-buoy":'',"link-2":'',link:'',linkedin:'',list:'',loader:'',lock:'',"log-in":'',"log-out":'',mail:'',"map-pin":'',map:'',"maximize-2":'',maximize:'',meh:'',menu:'',"message-circle":'',"message-square":'',"mic-off":'',mic:'',"minimize-2":'',minimize:'',"minus-circle":'',"minus-square":'',minus:'',monitor:'',moon:'',"more-horizontal":'',"more-vertical":'',"mouse-pointer":'',move:'',music:'',"navigation-2":'',navigation:'',octagon:'',package:'',paperclip:'',"pause-circle":'',pause:'',"pen-tool":'',percent:'',"phone-call":'',"phone-forwarded":'',"phone-incoming":'',"phone-missed":'',"phone-off":'',"phone-outgoing":'',phone:'',"pie-chart":'',"play-circle":'',play:'',"plus-circle":'',"plus-square":'',plus:'',pocket:'',power:'',printer:'',radio:'',"refresh-ccw":'',"refresh-cw":'',repeat:'',rewind:'',"rotate-ccw":'',"rotate-cw":'',rss:'',save:'',scissors:'',search:'',send:'',server:'',settings:'',"share-2":'',share:'',"shield-off":'',shield:'',"shopping-bag":'',"shopping-cart":'',shuffle:'',sidebar:'',"skip-back":'',"skip-forward":'',slack:'',slash:'',sliders:'',smartphone:'',smile:'',speaker:'',square:'',star:'',"stop-circle":'',sun:'',sunrise:'',sunset:'',table:'',tablet:'',tag:'',target:'',terminal:'',thermometer:'',"thumbs-down":'',"thumbs-up":'',"toggle-left":'',"toggle-right":'',tool:'',"trash-2":'',trash:'',trello:'',"trending-down":'',"trending-up":'',triangle:'',truck:'',tv:'',twitch:'',twitter:'',type:'',umbrella:'',underline:'',unlock:'',"upload-cloud":'',upload:'',"user-check":'',"user-minus":'',"user-plus":'',"user-x":'',user:'',users:'',"video-off":'',video:'',voicemail:'',"volume-1":'',"volume-2":'',"volume-x":'',volume:'',watch:'',"wifi-off":'',wifi:'',wind:'',"x-circle":'',"x-octagon":'',"x-square":'',x:'',youtube:'',"zap-off":'',zap:'',"zoom-in":'',"zoom-out":''}},"./node_modules/classnames/dedupe.js":function(t,e,n){var r,i;(function(){"use strict";var a=function(){function s(){}s.prototype=Object.create(null);function o(g,m){for(var w=m.length,b=0;b1?arguments[1]:void 0,m=g!==void 0,w=0,b=c(h),S,k,x,A;if(m&&(g=r(g,p>2?arguments[2]:void 0,2)),b!=null&&!(d==Array&&s(b)))for(A=b.call(h),k=new d;!(x=A.next()).done;w++)l(k,w,m?a(A,g,[x.value,w],!0):x.value);else for(S=o(h.length),k=new d(S);S>w;w++)l(k,w,m?g(h[w],w):h[w]);return k.length=w,k}},"./node_modules/core-js/internals/array-includes.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-indexed-object.js"),i=n("./node_modules/core-js/internals/to-length.js"),a=n("./node_modules/core-js/internals/to-absolute-index.js");t.exports=function(s){return function(o,l,c){var u=r(o),f=i(u.length),h=a(c,f),d;if(s&&l!=l){for(;f>h;)if(d=u[h++],d!=d)return!0}else for(;f>h;h++)if((s||h in u)&&u[h]===l)return s||h||0;return!s&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(t,e,n){var r=n("./node_modules/core-js/internals/a-function.js");t.exports=function(i,a,s){if(r(i),a===void 0)return i;switch(s){case 0:return function(){return i.call(a)};case 1:return function(o){return i.call(a,o)};case 2:return function(o,l){return i.call(a,o,l)};case 3:return function(o,l,c){return i.call(a,o,l,c)}}return function(){return i.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(t,e,n){var r=n("./node_modules/core-js/internals/an-object.js");t.exports=function(i,a,s,o){try{return o?a(r(s)[0],s[1]):a(s)}catch(c){var l=i.return;throw l!==void 0&&r(l.call(i)),c}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(t,e,n){var r=n("./node_modules/core-js/internals/well-known-symbol.js"),i=r("iterator"),a=!1;try{var s=0,o={next:function(){return{done:!!s++}},return:function(){a=!0}};o[i]=function(){return this},Array.from(o,function(){throw 2})}catch(l){}t.exports=function(l,c){if(!c&&!a)return!1;var u=!1;try{var f={};f[i]=function(){return{next:function(){return{done:u=!0}}}},l(f)}catch(h){}return u}},"./node_modules/core-js/internals/classof-raw.js":function(t,e){var n={}.toString;t.exports=function(r){return n.call(r).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(t,e,n){var r=n("./node_modules/core-js/internals/classof-raw.js"),i=n("./node_modules/core-js/internals/well-known-symbol.js"),a=i("toStringTag"),s=r(function(){return arguments}())=="Arguments",o=function(l,c){try{return l[c]}catch(u){}};t.exports=function(l){var c,u,f;return l===void 0?"Undefined":l===null?"Null":typeof(u=o(c=Object(l),a))=="string"?u:s?r(c):(f=r(c))=="Object"&&typeof c.callee=="function"?"Arguments":f}},"./node_modules/core-js/internals/copy-constructor-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/own-keys.js"),a=n("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),s=n("./node_modules/core-js/internals/object-define-property.js");t.exports=function(o,l){for(var c=i(l),u=s.f,f=a.f,h=0;h",S="java"+w+":",k;for(p.style.display="none",o.appendChild(p),p.src=String(S),k=p.contentWindow.document,k.open(),k.write(m+w+b+"document.F=Object"+m+"/"+w+b),k.close(),d=k.F;g--;)delete d[f][a[g]];return d()};t.exports=Object.create||function(g,m){var w;return g!==null?(h[f]=r(g),w=new h,h[f]=null,w[u]=g):w=d(),m===void 0?w:i(w,m)},s[u]=!0},"./node_modules/core-js/internals/object-define-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-define-property.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/object-keys.js");t.exports=r?Object.defineProperties:function(l,c){a(l);for(var u=s(c),f=u.length,h=0,d;f>h;)i.f(l,d=u[h++],c[d]);return l}},"./node_modules/core-js/internals/object-define-property.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/ie8-dom-define.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/to-primitive.js"),o=Object.defineProperty;e.f=r?o:function(c,u,f){if(a(c),u=s(u,!0),a(f),i)try{return o(c,u,f)}catch(h){}if("get"in f||"set"in f)throw TypeError("Accessors not supported");return"value"in f&&(c[u]=f.value),c}},"./node_modules/core-js/internals/object-get-own-property-descriptor.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-property-is-enumerable.js"),a=n("./node_modules/core-js/internals/create-property-descriptor.js"),s=n("./node_modules/core-js/internals/to-indexed-object.js"),o=n("./node_modules/core-js/internals/to-primitive.js"),l=n("./node_modules/core-js/internals/has.js"),c=n("./node_modules/core-js/internals/ie8-dom-define.js"),u=Object.getOwnPropertyDescriptor;e.f=r?u:function(h,d){if(h=s(h),d=o(d,!0),c)try{return u(h,d)}catch(p){}if(l(h,d))return a(!i.f.call(h,d),h[d])}},"./node_modules/core-js/internals/object-get-own-property-names.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js"),a=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return r(o,a)}},"./node_modules/core-js/internals/object-get-own-property-symbols.js":function(t,e){e.f=Object.getOwnPropertySymbols},"./node_modules/core-js/internals/object-get-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-object.js"),a=n("./node_modules/core-js/internals/shared-key.js"),s=n("./node_modules/core-js/internals/correct-prototype-getter.js"),o=a("IE_PROTO"),l=Object.prototype;t.exports=s?Object.getPrototypeOf:function(c){return c=i(c),r(c,o)?c[o]:typeof c.constructor=="function"&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?l:null}},"./node_modules/core-js/internals/object-keys-internal.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-indexed-object.js"),a=n("./node_modules/core-js/internals/array-includes.js"),s=n("./node_modules/core-js/internals/hidden-keys.js"),o=a(!1);t.exports=function(l,c){var u=i(l),f=0,h=[],d;for(d in u)!r(s,d)&&r(u,d)&&h.push(d);for(;c.length>f;)r(u,d=c[f++])&&(~o(h,d)||h.push(d));return h}},"./node_modules/core-js/internals/object-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js");t.exports=Object.keys||function(s){return r(s,i)}},"./node_modules/core-js/internals/object-property-is-enumerable.js":function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!r.call({1:2},1);e.f=a?function(o){var l=i(this,o);return!!l&&l.enumerable}:r},"./node_modules/core-js/internals/object-set-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,a={},s;try{s=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,s.call(a,[]),i=a instanceof Array}catch(o){}return function(l,c){return r(l,c),i?s.call(l,c):l.__proto__=c,l}}():void 0)},"./node_modules/core-js/internals/own-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/object-get-own-property-names.js"),a=n("./node_modules/core-js/internals/object-get-own-property-symbols.js"),s=n("./node_modules/core-js/internals/an-object.js"),o=r.Reflect;t.exports=o&&o.ownKeys||function(c){var u=i.f(s(c)),f=a.f;return f?u.concat(f(c)):u}},"./node_modules/core-js/internals/path.js":function(t,e,n){t.exports=n("./node_modules/core-js/internals/global.js")},"./node_modules/core-js/internals/redefine.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/hide.js"),s=n("./node_modules/core-js/internals/has.js"),o=n("./node_modules/core-js/internals/set-global.js"),l=n("./node_modules/core-js/internals/function-to-string.js"),c=n("./node_modules/core-js/internals/internal-state.js"),u=c.get,f=c.enforce,h=String(l).split("toString");i("inspectSource",function(d){return l.call(d)}),(t.exports=function(d,p,g,m){var w=m?!!m.unsafe:!1,b=m?!!m.enumerable:!1,S=m?!!m.noTargetGet:!1;if(typeof g=="function"&&(typeof p=="string"&&!s(g,"name")&&a(g,"name",p),f(g).source=h.join(typeof p=="string"?p:"")),d===r){b?d[p]=g:o(p,g);return}else w?!S&&d[p]&&(b=!0):delete d[p];b?d[p]=g:a(d,p,g)})(Function.prototype,"toString",function(){return typeof this=="function"&&u(this).source||l.call(this)})},"./node_modules/core-js/internals/require-object-coercible.js":function(t,e){t.exports=function(n){if(n==null)throw TypeError("Can't call method on "+n);return n}},"./node_modules/core-js/internals/set-global.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/hide.js");t.exports=function(a,s){try{i(r,a,s)}catch(o){r[a]=s}return s}},"./node_modules/core-js/internals/set-to-string-tag.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-define-property.js").f,i=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/well-known-symbol.js"),s=a("toStringTag");t.exports=function(o,l,c){o&&!i(o=c?o:o.prototype,s)&&r(o,s,{configurable:!0,value:l})}},"./node_modules/core-js/internals/shared-key.js":function(t,e,n){var r=n("./node_modules/core-js/internals/shared.js"),i=n("./node_modules/core-js/internals/uid.js"),a=r("keys");t.exports=function(s){return a[s]||(a[s]=i(s))}},"./node_modules/core-js/internals/shared.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/set-global.js"),a=n("./node_modules/core-js/internals/is-pure.js"),s="__core-js_shared__",o=r[s]||i(s,{});(t.exports=function(l,c){return o[l]||(o[l]=c!==void 0?c:{})})("versions",[]).push({version:"3.1.3",mode:a?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},"./node_modules/core-js/internals/string-at.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a,s,o){var l=String(i(a)),c=r(s),u=l.length,f,h;return c<0||c>=u?o?"":void 0:(f=l.charCodeAt(c),f<55296||f>56319||c+1===u||(h=l.charCodeAt(c+1))<56320||h>57343?o?l.charAt(c):f:o?l.slice(c,c+2):(f-55296<<10)+(h-56320)+65536)}},"./node_modules/core-js/internals/to-absolute-index.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.max,a=Math.min;t.exports=function(s,o){var l=r(s);return l<0?i(l+o,0):a(l,o)}},"./node_modules/core-js/internals/to-indexed-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/indexed-object.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a){return r(i(a))}},"./node_modules/core-js/internals/to-integer.js":function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(i){return isNaN(i=+i)?0:(i>0?r:n)(i)}},"./node_modules/core-js/internals/to-length.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.min;t.exports=function(a){return a>0?i(r(a),9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(i){return Object(r(i))}},"./node_modules/core-js/internals/to-primitive.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js");t.exports=function(i,a){if(!r(i))return i;var s,o;if(a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i))||typeof(s=i.valueOf)=="function"&&!r(o=s.call(i))||!a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i)))return o;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/internals/uid.js":function(t,e){var n=0,r=Math.random();t.exports=function(i){return"Symbol(".concat(i===void 0?"":i,")_",(++n+r).toString(36))}},"./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js"),i=n("./node_modules/core-js/internals/an-object.js");t.exports=function(a,s){if(i(a),!r(s)&&s!==null)throw TypeError("Can't set "+String(s)+" as a prototype")}},"./node_modules/core-js/internals/well-known-symbol.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/uid.js"),s=n("./node_modules/core-js/internals/native-symbol.js"),o=r.Symbol,l=i("wks");t.exports=function(c){return l[c]||(l[c]=s&&o[c]||(s?o:a)("Symbol."+c))}},"./node_modules/core-js/modules/es.array.from.js":function(t,e,n){var r=n("./node_modules/core-js/internals/export.js"),i=n("./node_modules/core-js/internals/array-from.js"),a=n("./node_modules/core-js/internals/check-correctness-of-iteration.js"),s=!a(function(o){Array.from(o)});r({target:"Array",stat:!0,forced:s},{from:i})},"./node_modules/core-js/modules/es.string.iterator.js":function(t,e,n){"use strict";var r=n("./node_modules/core-js/internals/string-at.js"),i=n("./node_modules/core-js/internals/internal-state.js"),a=n("./node_modules/core-js/internals/define-iterator.js"),s="String Iterator",o=i.set,l=i.getterFor(s);a(String,"String",function(c){o(this,{type:s,string:String(c),index:0})},function(){var u=l(this),f=u.string,h=u.index,d;return h>=f.length?{value:void 0,done:!0}:(d=r(f,h,!0),u.index+=d.length,{value:d,done:!1})})},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(r){typeof window=="object"&&(n=window)}t.exports=n},"./src/default-attrs.json":function(t){t.exports={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"}},"./src/icon.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(d){for(var p=1;p2&&arguments[2]!==void 0?arguments[2]:[];u(this,d),this.name=p,this.contents=g,this.tags=m,this.attrs=r({},l.default,{class:"feather feather-"+p})}return i(d,[{key:"toSvg",value:function(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},m=r({},this.attrs,g,{class:(0,s.default)(this.attrs.class,g.class)});return""+this.contents+""}},{key:"toString",value:function(){return this.contents}}]),d}();function h(d){return Object.keys(d).map(function(p){return p+'="'+d[p]+'"'}).join(" ")}e.default=f},"./src/icons.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icon.js"),i=c(r),a=n("./dist/icons.json"),s=c(a),o=n("./src/tags.json"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}e.default=Object.keys(s.default).map(function(u){return new i.default(u,s.default[u],l.default[u])}).reduce(function(u,f){return u[f.name]=f,u},{})},"./src/index.js":function(t,e,n){"use strict";var r=n("./src/icons.js"),i=c(r),a=n("./src/to-svg.js"),s=c(a),o=n("./src/replace.js"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}t.exports={icons:i.default,toSvg:s.default,replace:l.default}},"./src/replace.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(h){for(var d=1;d0&&arguments[0]!==void 0?arguments[0]:{};if(typeof document=="undefined")throw new Error("`feather.replace()` only works in a browser environment.");var d=document.querySelectorAll("[data-feather]");Array.from(d).forEach(function(p){return u(p,h)})}function u(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=f(h),g=p["data-feather"];if(delete p["data-feather"],o.default[g]===void 0){console.warn("feather: '"+g+"' is not a valid icon");return}var m=o.default[g].toSvg(r({},d,p,{class:(0,a.default)(d.class,p.class)})),w=new DOMParser().parseFromString(m,"image/svg+xml"),b=w.querySelector("svg");h.parentNode.replaceChild(b,h)}function f(h){return Array.from(h.attributes).reduce(function(d,p){return d[p.name]=p.value,d},{})}e.default=c},"./src/tags.json":function(t){t.exports={activity:["pulse","health","action","motion"],airplay:["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],anchor:[],archive:["index","box"],"at-sign":["mention","at","email","message"],award:["achievement","badge"],aperture:["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],battery:["power","electricity"],"battery-charging":["power","electricity"],bell:["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],bluetooth:["wireless"],"book-open":["read","library"],book:["read","dictionary","booklet","magazine","library"],bookmark:["read","clip","marker","tag"],box:["cube"],briefcase:["work","bag","baggage","folder"],calendar:["date"],camera:["photo"],cast:["chromecast","airplay"],"chevron-down":["expand"],"chevron-up":["collapse"],circle:["off","zero","record"],clipboard:["copy"],clock:["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],cloud:["weather"],codepen:["logo"],codesandbox:["logo"],code:["source","programming"],coffee:["drink","cup","mug","tea","cafe","hot","beverage"],columns:["layout"],command:["keyboard","cmd","terminal","prompt"],compass:["navigation","safari","travel","direction"],copy:["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],cpu:["processor","technology"],"credit-card":["purchase","payment","cc"],crop:["photo","image"],crosshair:["aim","target"],database:["storage","memory"],delete:["remove"],disc:["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],droplet:["water"],edit:["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],eye:["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],facebook:["logo","social"],"fast-forward":["music"],figma:["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],film:["movie","video"],filter:["funnel","hopper"],flag:["report"],"folder-minus":["directory"],"folder-plus":["directory"],folder:["directory"],framer:["logo","design","tool"],frown:["emoji","face","bad","sad","emotion"],gift:["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],github:["logo","version control"],gitlab:["logo","version control"],globe:["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],hash:["hashtag","number","pound"],headphones:["music","audio","sound"],heart:["like","love","emotion"],"help-circle":["question mark"],hexagon:["shape","node.js","logo"],home:["house","living"],image:["picture"],inbox:["email"],instagram:["logo","camera"],key:["password","login","authentication","secure"],layers:["stack"],layout:["window","webpage"],"life-buoy":["help","life ring","support"],link:["chain","url"],"link-2":["chain","url"],linkedin:["logo","social media"],list:["options"],lock:["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],mail:["email","message"],"map-pin":["location","navigation","travel","marker"],map:["location","navigation","travel"],maximize:["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],meh:["emoji","face","neutral","emotion"],menu:["bars","navigation","hamburger"],"message-circle":["comment","chat"],"message-square":["comment","chat"],"mic-off":["record","sound","mute"],mic:["record","sound","listen"],minimize:["exit fullscreen","close"],"minimize-2":["exit fullscreen","arrows","close"],minus:["subtract"],monitor:["tv","screen","display"],moon:["dark","night"],"more-horizontal":["ellipsis"],"more-vertical":["ellipsis"],"mouse-pointer":["arrow","cursor"],move:["arrows"],music:["note"],navigation:["location","travel"],"navigation-2":["location","travel"],octagon:["stop"],package:["box","container"],paperclip:["attachment"],pause:["music","stop"],"pause-circle":["music","audio","stop"],"pen-tool":["vector","drawing"],percent:["discount"],"phone-call":["ring"],"phone-forwarded":["call"],"phone-incoming":["call"],"phone-missed":["call"],"phone-off":["call","mute"],"phone-outgoing":["call"],phone:["call"],play:["music","start"],"pie-chart":["statistics","diagram"],"play-circle":["music","start"],plus:["add","new"],"plus-circle":["add","new"],"plus-square":["add","new"],pocket:["logo","save"],power:["on","off"],printer:["fax","office","device"],radio:["signal"],"refresh-cw":["synchronise","arrows"],"refresh-ccw":["arrows"],repeat:["loop","arrows"],rewind:["music"],"rotate-ccw":["arrow"],"rotate-cw":["arrow"],rss:["feed","subscribe"],save:["floppy disk"],scissors:["cut"],search:["find","magnifier","magnifying glass"],send:["message","mail","email","paper airplane","paper aeroplane"],settings:["cog","edit","gear","preferences"],"share-2":["network","connections"],shield:["security","secure"],"shield-off":["security","insecure"],"shopping-bag":["ecommerce","cart","purchase","store"],"shopping-cart":["ecommerce","cart","purchase","store"],shuffle:["music"],"skip-back":["music"],"skip-forward":["music"],slack:["logo"],slash:["ban","no"],sliders:["settings","controls"],smartphone:["cellphone","device"],smile:["emoji","face","happy","good","emotion"],speaker:["audio","music"],star:["bookmark","favorite","like"],"stop-circle":["media","music"],sun:["brightness","weather","light"],sunrise:["weather","time","morning","day"],sunset:["weather","time","evening","night"],tablet:["device"],tag:["label"],target:["logo","bullseye"],terminal:["code","command line","prompt"],thermometer:["temperature","celsius","fahrenheit","weather"],"thumbs-down":["dislike","bad","emotion"],"thumbs-up":["like","good","emotion"],"toggle-left":["on","off","switch"],"toggle-right":["on","off","switch"],tool:["settings","spanner"],trash:["garbage","delete","remove","bin"],"trash-2":["garbage","delete","remove","bin"],triangle:["delta"],truck:["delivery","van","shipping","transport","lorry"],tv:["television","stream"],twitch:["logo"],twitter:["logo","social"],type:["text"],umbrella:["rain","weather"],unlock:["security"],"user-check":["followed","subscribed"],"user-minus":["delete","remove","unfollow","unsubscribe"],"user-plus":["new","add","create","follow","subscribe"],"user-x":["delete","remove","unfollow","unsubscribe","unavailable"],user:["person","account"],users:["group"],"video-off":["camera","movie","film"],video:["camera","movie","film"],voicemail:["phone"],volume:["music","sound","mute"],"volume-1":["music","sound"],"volume-2":["music","sound"],"volume-x":["music","sound","mute"],watch:["clock","time"],"wifi-off":["disabled"],wifi:["connection","signal","wireless"],wind:["weather","air"],"x-circle":["cancel","close","delete","remove","times","clear"],"x-octagon":["delete","stop","alert","warning","times","clear"],"x-square":["cancel","close","delete","remove","times","clear"],x:["cancel","close","delete","remove","times","clear"],youtube:["logo","video","play"],"zap-off":["flash","camera","lightning"],zap:["flash","camera","lightning"],"zoom-in":["magnifying glass"],"zoom-out":["magnifying glass"]}},"./src/to-svg.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icons.js"),i=a(r);function a(o){return o&&o.__esModule?o:{default:o}}function s(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead."),!o)throw new Error("The required `key` (icon name) parameter is missing.");if(!i.default[o])throw new Error("No icon matching '"+o+"'. See the complete list of icons at https://feathericons.com");return i.default[o].toSvg(l)}e.default=s},0:function(t,e,n){n("./node_modules/core-js/es/array/from.js"),t.exports=n("./src/index.js")}})})});var i7={};aA(i7,{default:()=>hu});module.exports=sA(i7);v();v();var Xa=Ze(Pm(),1),Nf=Ze(Hm(),1),v1=Ze(zm(),1),Vo=Ze(M0(),1),Ro=Ze(I0(),1),w1=Ze(U0(),1),fn=Ze(G0(),1),b1=Ze(Y0(),1),ge=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 n=new t(e.message);return n.code=e.code,n.data=e.data,n.caller=e.caller,n.stack=e.stack,n}get isIsomorphicGitError(){return!0}},Ya=class t extends ge{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}}};Ya.code="UnmergedPathsError";var ue=class t extends ge{constructor(e){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};ue.code="InternalError";var Si=class t extends ge{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};Si.code="UnsafeFilepathError";var en=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 n=this.buffer.slice(this._start,this._start+e);return this._start+=e,n}toString(e,n){let r=this.buffer.toString(e,this._start,this._start+n);return this._start+=n,r}write(e,n,r){let i=this.buffer.write(e,this._start,n,r);return this._start+=n,i}copy(e,n,r){let i=e.copy(this.buffer,this._start,n,r);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let n=this.buffer.writeUInt8(e,this._start);return this._start+=1,n}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let n=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,n}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let n=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,n}};function Wo(t,e){return-(te)}function x1(t,e){return Wo(t.path,e.path)}function _1(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let n=t&511;return n&73?n=493:n=420,e!==8&&(n=0),(e<<12)+n}var Tn=2**32;function Z0(t,e,n,r){if(t!==void 0&&e!==void 0)return[t,e];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3),a=(n-i*1e3)*1e6;return[i,a]}function Ei(t){let[e,n]=Z0(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[r,i]=Z0(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%Tn,ctimeNanoseconds:n%Tn,mtimeSeconds:r%Tn,mtimeNanoseconds:i%Tn,dev:t.dev%Tn,ino:t.ino%Tn,mode:_1(t.mode%Tn),uid:t.uid%Tn,gid:t.gid%Tn,size:t.size>-1?t.size%Tn:0}}function l5(t){let e="";for(let n of new Uint8Array(t))n<16&&(e+="0"),e+=n.toString(16);return e}var yf=null;async function Un(t){return yf===null&&(yf=await u5()),yf?S1(t):c5(t)}function c5(t){return new Nf.default().update(t).digest("hex")}async function S1(t){let e=await crypto.subtle.digest("SHA-1",t);return l5(e)}async function u5(){try{if(await S1(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch(t){}return!1}function f5(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function h5(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Tf=class t{constructor(e,n){this._dirty=!1,this._unmergedPaths=n||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 n=this._entries.get(e.path);n||(this._entries.set(e.path,e),n=e),n.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new ue("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ue("Index file is empty (.git/index)");let n=new t,r=new en(e),i=r.toString("utf8",4);if(i!=="DIRC")throw new ue(`Invalid dircache magic file number: ${i}`);let a=await Un(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new ue(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=r.readUInt32BE();if(o!==2)throw new ue(`Unsupported dircache version: ${o}`);let l=r.readUInt32BE(),c=0;for(;!r.eof()&&ce.stages.length>1?e.stages.filter(n=>n):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:n,oid:r,stage:i=0}){n||(n={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),n=Ei(n);let a=Buffer.from(e),s={ctimeSeconds:n.ctimeSeconds,ctimeNanoseconds:n.ctimeNanoseconds,mtimeSeconds:n.mtimeSeconds,mtimeNanoseconds:n.mtimeNanoseconds,dev:n.dev,ino:n.ino,mode:n.mode||33188,uid:n.uid,gid:n.gid,size:n.size,path:e,oid:r,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let n of this._entries.keys())n.startsWith(e+"/")&&this._entries.delete(n);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 n=Buffer.from(e.path),r=Math.ceil((62+n.length+1)/8)*8,i=Buffer.alloc(r),a=new en(i),s=Ei(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(h5(e)),a.write(e.path,n.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),n=new en(e);n.write("DIRC",4,"utf8"),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let r=[];for(let o of this.entries)if(r.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&r.push(t._entryToBuffer(l));r=await Promise.all(r);let i=Buffer.concat(r),a=Buffer.concat([e,i]),s=await Un(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Lo(t,e,n=!0,r=!0){let i=Ei(t),a=Ei(e);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}var vf=null,xi=Symbol("IndexCache");function d5(){return{map:new Map,stats:new Map}}async function p5(t,e,n){let r=await t.lstat(e),i=await t.read(e),a=await Tf.from(i);n.map.set(e,a),n.stats.set(e,r)}async function m5(t,e,n){let r=n.stats.get(e);if(r===void 0)return!0;let i=await t.lstat(e);return r===null||i===null?!1:Lo(r,i)}var lt=class{static async acquire({fs:e,gitdir:n,cache:r,allowUnmerged:i=!0},a){r[xi]||(r[xi]=d5());let s=`${n}/index`;vf===null&&(vf=new Xa.default({maxPending:1/0}));let o,l=[];return await vf.acquire(s,async()=>{await m5(e,s,r[xi])&&await p5(e,s,r[xi]);let c=r[xi].map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new Ya(l);if(o=await a(c),c._dirty){let u=await c.toObject();await e.write(s,u),r[xi].stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function jo(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function ki(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function E1(t){let e=new Map,n=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:jo(i),metadata:{},children:[]};e.set(i,a),a.parent=n(ki(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},r=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:jo(i),metadata:a,parent:n(ki(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};n(".");for(let i of t)r(i.path,i);return e}function g5(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Cf=class{constructor({fs:e,gitdir:n,cache:r}){this.treePromise=lt.acquire({fs:e,gitdir:n,cache:r},async function(a){return E1(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let n=e._fullpath,i=(await this.treePromise).get(n);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${n}'`);let a=i.children.map(s=>s.fullpath);return a.sort(Wo),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 r=(await this.treePromise).get(e._fullpath);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.type==="tree"?{}:Ei(r.metadata);e._type=r.type==="tree"?"tree":g5(i.mode),e._mode=i.mode,r.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let r=(await this.treePromise).get(e._fullpath);e._oid=r.metadata.oid}return e._oid}},qo=Symbol("GitWalkSymbol");function Xo(){let t=Object.create(null);return Object.defineProperty(t,qo,{value:function({fs:e,gitdir:n,cache:r}){return new Cf({fs:e,gitdir:n,cache:r})}}),Object.freeze(t),t}var Re=class t extends ge{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Re.code="NotFoundError";var kt=class t extends ge{constructor(e,n,r,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=t.code,this.data={oid:e,actual:n,expected:r,filepath:i}}};kt.code="ObjectTypeError";var or=class t extends ge{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};or.code="InvalidOidError";var Za=class t extends ge{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 = _NoRefspecError.code; - this.data = { remote }; - } -}; -NoRefspecError.code = "NoRefspecError"; -var GitPackedRefs = class _GitPackedRefs { - constructor(text2) { - this.refs = /* @__PURE__ */ new Map(); - this.parsedConfig = []; - if (text2) { - let key2 = null; - this.parsedConfig = text2.trim().split("\n").map((line) => { - if (/^\s*#/.test(line)) { - return { line, comment: true }; - } - const i = line.indexOf(" "); - if (line.startsWith("^")) { - const value = line.slice(1); - this.refs.set(key2 + "^{}", value); - return { line, ref: key2, peeled: value }; - } else { - const value = line.slice(0, i); - key2 = line.slice(i + 1); - this.refs.set(key2, value); - return { line, ref: key2, oid: value }; - } - }); - } - return this; - } - static from(text2) { - return new _GitPackedRefs(text2); - } - delete(ref) { - this.parsedConfig = this.parsedConfig.filter((entry) => entry.ref !== ref); - this.refs.delete(ref); - } - toString() { - return this.parsedConfig.map(({ line }) => line).join("\n") + "\n"; - } -}; -var GitRefSpec = class _GitRefSpec { - constructor({ remotePath, localPath, force, matchPrefix }) { - Object.assign(this, { - remotePath, - localPath, - force, - matchPrefix - }); - } - static from(refspec) { - const [ - forceMatch, - remotePath, - remoteGlobMatch, - localPath, - localGlobMatch - ] = refspec.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1); - const force = forceMatch === "+"; - const remoteIsGlob = remoteGlobMatch === "*"; - const localIsGlob = localGlobMatch === "*"; - if (remoteIsGlob !== localIsGlob) { - throw new InternalError("Invalid refspec"); - } - return new _GitRefSpec({ - remotePath, - localPath, - force, - matchPrefix: remoteIsGlob - }); - } - translate(remoteBranch) { - if (this.matchPrefix) { - if (remoteBranch.startsWith(this.remotePath)) { - return this.localPath + remoteBranch.replace(this.remotePath, ""); - } - } else { - if (remoteBranch === this.remotePath) return this.localPath; - } - return null; - } - reverseTranslate(localBranch) { - if (this.matchPrefix) { - if (localBranch.startsWith(this.localPath)) { - return this.remotePath + localBranch.replace(this.localPath, ""); - } - } else { - if (localBranch === this.localPath) return this.remotePath; - } - return null; - } -}; -var GitRefSpecSet = class _GitRefSpecSet { - constructor(rules = []) { - this.rules = rules; - } - static from(refspecs) { - const rules = []; - for (const refspec of refspecs) { - rules.push(GitRefSpec.from(refspec)); - } - return new _GitRefSpecSet(rules); - } - add(refspec) { - const rule = GitRefSpec.from(refspec); - this.rules.push(rule); - } - translate(remoteRefs) { - const result = []; - for (const rule of this.rules) { - for (const remoteRef of remoteRefs) { - const localRef = rule.translate(remoteRef); - if (localRef) { - result.push([remoteRef, localRef]); - } - } - } - return result; - } - translateOne(remoteRef) { - let result = null; - for (const rule of this.rules) { - const localRef = rule.translate(remoteRef); - if (localRef) { - result = localRef; - } - } - return result; - } - localNamespaces() { - return this.rules.filter((rule) => rule.matchPrefix).map((rule) => rule.localPath.replace(/\/$/, "")); - } -}; -function compareRefNames(a, b) { - const _a2 = a.replace(/\^\{\}$/, ""); - const _b = b.replace(/\^\{\}$/, ""); - const tmp = -(_a2 < _b) || +(_a2 > _b); - if (tmp === 0) { - return a.endsWith("^{}") ? 1 : -1; - } - return tmp; -} -var memo = /* @__PURE__ */ new Map(); -function normalizePath(path2) { - let normalizedPath = memo.get(path2); - if (!normalizedPath) { - normalizedPath = normalizePathInternal(path2); - memo.set(path2, normalizedPath); - } - return normalizedPath; -} -function normalizePathInternal(path2) { - path2 = path2.split("/./").join("/").replace(/\/{2,}/g, "/"); - if (path2 === "/.") return "/"; - if (path2 === "./") return "."; - if (path2.startsWith("./")) path2 = path2.slice(2); - if (path2.endsWith("/.")) path2 = path2.slice(0, -2); - if (path2.length > 1 && path2.endsWith("/")) path2 = path2.slice(0, -1); - if (path2 === "") return "."; - return path2; -} -function join(...parts) { - return normalizePath(parts.map(normalizePath).join("/")); -} -var num = (val) => { - val = val.toLowerCase(); - let n = parseInt(val); - if (val.endsWith("k")) n *= 1024; - if (val.endsWith("m")) n *= 1024 * 1024; - if (val.endsWith("g")) n *= 1024 * 1024 * 1024; - return n; -}; -var bool = (val) => { - val = val.trim().toLowerCase(); - if (val === "true" || val === "yes" || val === "on") return true; - if (val === "false" || val === "no" || val === "off") return false; - throw Error( - `Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${val}` - ); -}; -var schema = { - core: { - filemode: bool, - bare: bool, - logallrefupdates: bool, - symlinks: bool, - ignorecase: bool, - bigFileThreshold: num - } -}; -var SECTION_LINE_REGEX = /^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/; -var SECTION_REGEX = /^[A-Za-z0-9-.]+$/; -var VARIABLE_LINE_REGEX = /^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/; -var VARIABLE_NAME_REGEX = /^[A-Za-z][A-Za-z-]*$/; -var VARIABLE_VALUE_COMMENT_REGEX = /^(.*?)( *[#;].*)$/; -var extractSectionLine = (line) => { - const matches = SECTION_LINE_REGEX.exec(line); - if (matches != null) { - const [section, subsection] = matches.slice(1); - return [section, subsection]; - } - return null; -}; -var extractVariableLine = (line) => { - const matches = VARIABLE_LINE_REGEX.exec(line); - if (matches != null) { - const [name, rawValue = "true"] = matches.slice(1); - const valueWithoutComments = removeComments(rawValue); - const valueWithoutQuotes = removeQuotes(valueWithoutComments); - return [name, valueWithoutQuotes]; - } - return null; -}; -var removeComments = (rawValue) => { - const commentMatches = VARIABLE_VALUE_COMMENT_REGEX.exec(rawValue); - if (commentMatches == null) { - return rawValue; - } - const [valueWithoutComment, comment] = commentMatches.slice(1); - if (hasOddNumberOfQuotes(valueWithoutComment) && hasOddNumberOfQuotes(comment)) { - return `${valueWithoutComment}${comment}`; - } - return valueWithoutComment; -}; -var hasOddNumberOfQuotes = (text2) => { - const numberOfQuotes = (text2.match(/(?:^|[^\\])"/g) || []).length; - return numberOfQuotes % 2 !== 0; -}; -var removeQuotes = (text2) => { - return text2.split("").reduce((newText, c, idx, text3) => { - const isQuote = c === '"' && text3[idx - 1] !== "\\"; - const isEscapeForQuote = c === "\\" && text3[idx + 1] === '"'; - if (isQuote || isEscapeForQuote) { - return newText; - } - return newText + c; - }, ""); -}; -var lower = (text2) => { - return text2 != null ? text2.toLowerCase() : null; -}; -var getPath = (section, subsection, name) => { - return [lower(section), subsection, lower(name)].filter((a) => a != null).join("."); -}; -var normalizePath$1 = (path2) => { - const pathSegments = path2.split("."); - const section = pathSegments.shift(); - const name = pathSegments.pop(); - const subsection = pathSegments.length ? pathSegments.join(".") : void 0; - return { - section, - subsection, - name, - path: getPath(section, subsection, name), - sectionPath: getPath(section, subsection, null) - }; -}; -var findLastIndex = (array, callback) => { - return array.reduce((lastIndex, item, index2) => { - return callback(item) ? index2 : lastIndex; - }, -1); -}; -var GitConfig = class _GitConfig { - constructor(text2) { - let section = null; - let subsection = null; - this.parsedConfig = text2 ? text2.split("\n").map((line) => { - let name = null; - let value = null; - const trimmedLine = line.trim(); - const extractedSection = extractSectionLine(trimmedLine); - const isSection = extractedSection != null; - if (isSection) { - ; - [section, subsection] = extractedSection; - } else { - const extractedVariable = extractVariableLine(trimmedLine); - const isVariable = extractedVariable != null; - if (isVariable) { - ; - [name, value] = extractedVariable; - } - } - const path2 = getPath(section, subsection, name); - return { line, isSection, section, subsection, name, value, path: path2 }; - }) : []; - } - static from(text2) { - return new _GitConfig(text2); - } - async get(path2, getall = false) { - const normalizedPath = normalizePath$1(path2).path; - const allValues = this.parsedConfig.filter((config) => config.path === normalizedPath).map(({ section, name, value }) => { - const fn = schema[section] && schema[section][name]; - return fn ? fn(value) : value; - }); - return getall ? allValues : allValues.pop(); - } - async getall(path2) { - return this.get(path2, true); - } - async getSubsections(section) { - return this.parsedConfig.filter((config) => config.section === section && config.isSection).map((config) => config.subsection); - } - async deleteSection(section, subsection) { - this.parsedConfig = this.parsedConfig.filter( - (config) => !(config.section === section && config.subsection === subsection) - ); - } - async append(path2, value) { - return this.set(path2, value, true); - } - async set(path2, value, append3 = false) { - const { - section, - subsection, - name, - path: normalizedPath, - sectionPath - } = normalizePath$1(path2); - const configIndex = findLastIndex( - this.parsedConfig, - (config) => config.path === normalizedPath - ); - if (value == null) { - if (configIndex !== -1) { - this.parsedConfig.splice(configIndex, 1); - } - } else { - if (configIndex !== -1) { - const config = this.parsedConfig[configIndex]; - const modifiedConfig = Object.assign({}, config, { - name, - value, - modified: true - }); - if (append3) { - this.parsedConfig.splice(configIndex + 1, 0, modifiedConfig); - } else { - this.parsedConfig[configIndex] = modifiedConfig; - } - } else { - const sectionIndex = this.parsedConfig.findIndex( - (config) => config.path === sectionPath - ); - const newConfig = { - section, - subsection, - name, - value, - modified: true, - path: normalizedPath - }; - if (SECTION_REGEX.test(section) && VARIABLE_NAME_REGEX.test(name)) { - if (sectionIndex >= 0) { - this.parsedConfig.splice(sectionIndex + 1, 0, newConfig); - } else { - const newSection = { - section, - subsection, - modified: true, - path: sectionPath - }; - this.parsedConfig.push(newSection, newConfig); - } - } - } - } - } - toString() { - return this.parsedConfig.map(({ line, section, subsection, name, value, modified: modified2 = false }) => { - if (!modified2) { - return line; - } - if (name != null && value != null) { - if (typeof value === "string" && /[#;]/.test(value)) { - return ` ${name} = "${value}"`; - } - return ` ${name} = ${value}`; - } - if (subsection != null) { - return `[${section} "${subsection}"]`; - } - return `[${section}]`; - }).join("\n"); - } -}; -var GitConfigManager = class { - static async get({ fs, gitdir }) { - const text2 = await fs.read(`${gitdir}/config`, { encoding: "utf8" }); - return GitConfig.from(text2); - } - static async save({ fs, gitdir, config }) { - await fs.write(`${gitdir}/config`, config.toString(), { - encoding: "utf8" - }); - } -}; -var refpaths = (ref) => [ - `${ref}`, - `refs/${ref}`, - `refs/tags/${ref}`, - `refs/heads/${ref}`, - `refs/remotes/${ref}`, - `refs/remotes/${ref}/HEAD` -]; -var GIT_FILES = ["config", "description", "index", "shallow", "commondir"]; -var lock$1; -async function acquireLock(ref, callback) { - if (lock$1 === void 0) lock$1 = new import_async_lock.default(); - return lock$1.acquire(ref, callback); -} -var GitRefManager = class _GitRefManager { - static async updateRemoteRefs({ - fs, - gitdir, - remote, - refs, - symrefs, - tags, - refspecs = void 0, - prune = false, - pruneTags = false - }) { - for (const value of refs.values()) { - if (!value.match(/[0-9a-f]{40}/)) { - throw new InvalidOidError(value); - } - } - const config = await GitConfigManager.get({ fs, gitdir }); - if (!refspecs) { - refspecs = await config.getall(`remote.${remote}.fetch`); - if (refspecs.length === 0) { - throw new NoRefspecError(remote); - } - refspecs.unshift(`+HEAD:refs/remotes/${remote}/HEAD`); - } - const refspec = GitRefSpecSet.from(refspecs); - const actualRefsToWrite = /* @__PURE__ */ new Map(); - if (pruneTags) { - const tags2 = await _GitRefManager.listRefs({ - fs, - gitdir, - filepath: "refs/tags" - }); - await _GitRefManager.deleteRefs({ - fs, - gitdir, - refs: tags2.map((tag2) => `refs/tags/${tag2}`) - }); - } - if (tags) { - for (const serverRef of refs.keys()) { - if (serverRef.startsWith("refs/tags") && !serverRef.endsWith("^{}")) { - if (!await _GitRefManager.exists({ fs, gitdir, ref: serverRef })) { - const oid = refs.get(serverRef); - actualRefsToWrite.set(serverRef, oid); - } - } - } - } - const refTranslations = refspec.translate([...refs.keys()]); - for (const [serverRef, translatedRef] of refTranslations) { - const value = refs.get(serverRef); - actualRefsToWrite.set(translatedRef, value); - } - const symrefTranslations = refspec.translate([...symrefs.keys()]); - for (const [serverRef, translatedRef] of symrefTranslations) { - const value = symrefs.get(serverRef); - const symtarget = refspec.translateOne(value); - if (symtarget) { - actualRefsToWrite.set(translatedRef, `ref: ${symtarget}`); - } - } - const pruned = []; - if (prune) { - for (const filepath of refspec.localNamespaces()) { - const refs2 = (await _GitRefManager.listRefs({ - fs, - gitdir, - filepath - })).map((file) => `${filepath}/${file}`); - for (const ref of refs2) { - if (!actualRefsToWrite.has(ref)) { - pruned.push(ref); - } - } - } - if (pruned.length > 0) { - await _GitRefManager.deleteRefs({ fs, gitdir, refs: pruned }); - } - } - for (const [key2, value] of actualRefsToWrite) { - await acquireLock( - key2, - async () => fs.write(join(gitdir, key2), `${value.trim()} -`, "utf8") - ); - } - return { pruned }; - } - // TODO: make this less crude? - static async writeRef({ fs, gitdir, ref, value }) { - if (!value.match(/[0-9a-f]{40}/)) { - throw new InvalidOidError(value); - } - await acquireLock( - ref, - async () => fs.write(join(gitdir, ref), `${value.trim()} -`, "utf8") - ); - } - static async writeSymbolicRef({ fs, gitdir, ref, value }) { - await acquireLock( - ref, - async () => fs.write(join(gitdir, ref), `ref: ${value.trim()} -`, "utf8") - ); - } - static async deleteRef({ fs, gitdir, ref }) { - return _GitRefManager.deleteRefs({ fs, gitdir, refs: [ref] }); - } - static async deleteRefs({ fs, gitdir, refs }) { - await Promise.all(refs.map((ref) => fs.rm(join(gitdir, ref)))); - let text2 = await acquireLock( - "packed-refs", - async () => fs.read(`${gitdir}/packed-refs`, { encoding: "utf8" }) - ); - const packed = GitPackedRefs.from(text2); - const beforeSize = packed.refs.size; - for (const ref of refs) { - if (packed.refs.has(ref)) { - packed.delete(ref); - } - } - if (packed.refs.size < beforeSize) { - text2 = packed.toString(); - await acquireLock( - "packed-refs", - async () => fs.write(`${gitdir}/packed-refs`, text2, { encoding: "utf8" }) - ); - } - } - /** - * @param {object} args - * @param {import('../models/FileSystem.js').FileSystem} args.fs - * @param {string} args.gitdir - * @param {string} args.ref - * @param {number} [args.depth] - * @returns {Promise} - */ - static async resolve({ fs, gitdir, ref, depth = void 0 }) { - if (depth !== void 0) { - depth--; - if (depth === -1) { - return ref; - } - } - if (ref.startsWith("ref: ")) { - ref = ref.slice("ref: ".length); - return _GitRefManager.resolve({ fs, gitdir, ref, depth }); - } - if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) { - return ref; - } - const packedMap = await _GitRefManager.packedRefs({ fs, gitdir }); - const allpaths = refpaths(ref).filter((p) => !GIT_FILES.includes(p)); - for (const ref2 of allpaths) { - const sha = await acquireLock( - ref2, - async () => await fs.read(`${gitdir}/${ref2}`, { encoding: "utf8" }) || packedMap.get(ref2) - ); - if (sha) { - return _GitRefManager.resolve({ fs, gitdir, ref: sha.trim(), depth }); - } - } - throw new NotFoundError(ref); - } - static async exists({ fs, gitdir, ref }) { - try { - await _GitRefManager.expand({ fs, gitdir, ref }); - return true; - } catch (err) { - return false; - } - } - static async expand({ fs, gitdir, ref }) { - if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) { - return ref; - } - const packedMap = await _GitRefManager.packedRefs({ fs, gitdir }); - const allpaths = refpaths(ref); - for (const ref2 of allpaths) { - const refExists = await acquireLock( - ref2, - async () => fs.exists(`${gitdir}/${ref2}`) - ); - if (refExists) return ref2; - if (packedMap.has(ref2)) return ref2; - } - throw new NotFoundError(ref); - } - static async expandAgainstMap({ ref, map }) { - const allpaths = refpaths(ref); - for (const ref2 of allpaths) { - if (await map.has(ref2)) return ref2; - } - throw new NotFoundError(ref); - } - static resolveAgainstMap({ ref, fullref = ref, depth = void 0, map }) { - if (depth !== void 0) { - depth--; - if (depth === -1) { - return { fullref, oid: ref }; - } - } - if (ref.startsWith("ref: ")) { - ref = ref.slice("ref: ".length); - return _GitRefManager.resolveAgainstMap({ ref, fullref, depth, map }); - } - if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) { - return { fullref, oid: ref }; - } - const allpaths = refpaths(ref); - for (const ref2 of allpaths) { - const sha = map.get(ref2); - if (sha) { - return _GitRefManager.resolveAgainstMap({ - ref: sha.trim(), - fullref: ref2, - depth, - map - }); - } - } - throw new NotFoundError(ref); - } - static async packedRefs({ fs, gitdir }) { - const text2 = await acquireLock( - "packed-refs", - async () => fs.read(`${gitdir}/packed-refs`, { encoding: "utf8" }) - ); - const packed = GitPackedRefs.from(text2); - return packed.refs; - } - // List all the refs that match the `filepath` prefix - static async listRefs({ fs, gitdir, filepath }) { - const packedMap = _GitRefManager.packedRefs({ fs, gitdir }); - let files = null; - try { - files = await fs.readdirDeep(`${gitdir}/${filepath}`); - files = files.map((x) => x.replace(`${gitdir}/${filepath}/`, "")); - } catch (err) { - files = []; - } - for (let key2 of (await packedMap).keys()) { - if (key2.startsWith(filepath)) { - key2 = key2.replace(filepath + "/", ""); - if (!files.includes(key2)) { - files.push(key2); - } - } - } - files.sort(compareRefNames); - return files; - } - static async listBranches({ fs, gitdir, remote }) { - if (remote) { - return _GitRefManager.listRefs({ - fs, - gitdir, - filepath: `refs/remotes/${remote}` - }); - } else { - return _GitRefManager.listRefs({ fs, gitdir, filepath: `refs/heads` }); - } - } - static async listTags({ fs, gitdir }) { - const tags = await _GitRefManager.listRefs({ - fs, - gitdir, - filepath: `refs/tags` - }); - return tags.filter((x) => !x.endsWith("^{}")); - } -}; -function compareTreeEntryPath(a, b) { - return compareStrings(appendSlashIfDir(a), appendSlashIfDir(b)); -} -function appendSlashIfDir(entry) { - return entry.mode === "040000" ? entry.path + "/" : entry.path; -} -function mode2type$1(mode) { - switch (mode) { - case "040000": - return "tree"; - case "100644": - return "blob"; - case "100755": - return "blob"; - case "120000": - return "blob"; - case "160000": - return "commit"; - } - throw new InternalError(`Unexpected GitTree entry mode: ${mode}`); -} -function parseBuffer(buffer2) { - const _entries = []; - let cursor = 0; - while (cursor < buffer2.length) { - const space2 = buffer2.indexOf(32, cursor); - if (space2 === -1) { - throw new InternalError( - `GitTree: Error parsing buffer at byte location ${cursor}: Could not find the next space character.` - ); - } - const nullchar = buffer2.indexOf(0, cursor); - if (nullchar === -1) { - throw new InternalError( - `GitTree: Error parsing buffer at byte location ${cursor}: Could not find the next null character.` - ); - } - let mode = buffer2.slice(cursor, space2).toString("utf8"); - if (mode === "40000") mode = "040000"; - const type = mode2type$1(mode); - const path2 = buffer2.slice(space2 + 1, nullchar).toString("utf8"); - if (path2.includes("\\") || path2.includes("/")) { - throw new UnsafeFilepathError(path2); - } - const oid = buffer2.slice(nullchar + 1, nullchar + 21).toString("hex"); - cursor = nullchar + 21; - _entries.push({ mode, path: path2, oid, type }); - } - return _entries; -} -function limitModeToAllowed(mode) { - if (typeof mode === "number") { - mode = mode.toString(8); - } - if (mode.match(/^0?4.*/)) return "040000"; - if (mode.match(/^1006.*/)) return "100644"; - if (mode.match(/^1007.*/)) return "100755"; - if (mode.match(/^120.*/)) return "120000"; - if (mode.match(/^160.*/)) return "160000"; - throw new InternalError(`Could not understand file mode: ${mode}`); -} -function nudgeIntoShape(entry) { - if (!entry.oid && entry.sha) { - entry.oid = entry.sha; - } - entry.mode = limitModeToAllowed(entry.mode); - if (!entry.type) { - entry.type = mode2type$1(entry.mode); - } - return entry; -} -var GitTree = class _GitTree { - constructor(entries) { - if (Buffer.isBuffer(entries)) { - this._entries = parseBuffer(entries); - } else if (Array.isArray(entries)) { - this._entries = entries.map(nudgeIntoShape); - } else { - throw new InternalError("invalid type passed to GitTree constructor"); - } - this._entries.sort(comparePath); - } - static from(tree) { - return new _GitTree(tree); - } - render() { - return this._entries.map((entry) => `${entry.mode} ${entry.type} ${entry.oid} ${entry.path}`).join("\n"); - } - toObject() { - const entries = [...this._entries]; - entries.sort(compareTreeEntryPath); - return Buffer.concat( - entries.map((entry) => { - const mode = Buffer.from(entry.mode.replace(/^0/, "")); - const space2 = Buffer.from(" "); - const path2 = Buffer.from(entry.path, "utf8"); - const nullchar = Buffer.from([0]); - const oid = Buffer.from(entry.oid, "hex"); - return Buffer.concat([mode, space2, path2, nullchar, oid]); - }) - ); - } - /** - * @returns {TreeEntry[]} - */ - entries() { - return this._entries; - } - *[Symbol.iterator]() { - for (const entry of this._entries) { - yield entry; - } - } -}; -var GitObject = class { - static wrap({ type, object }) { - return Buffer.concat([ - Buffer.from(`${type} ${object.byteLength.toString()}\0`), - Buffer.from(object) - ]); - } - static unwrap(buffer2) { - const s = buffer2.indexOf(32); - const i = buffer2.indexOf(0); - const type = buffer2.slice(0, s).toString("utf8"); - const length = buffer2.slice(s + 1, i).toString("utf8"); - const actualLength = buffer2.length - (i + 1); - if (parseInt(length) !== actualLength) { - throw new InternalError( - `Length mismatch: expected ${length} bytes but got ${actualLength} instead.` - ); - } - return { - type, - object: Buffer.from(buffer2.slice(i + 1)) - }; - } -}; -async function readObjectLoose({ fs, gitdir, oid }) { - const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`; - const file = await fs.read(`${gitdir}/${source}`); - if (!file) { - return null; - } - return { object: file, format: "deflated", source }; -} -function applyDelta(delta, source) { - const reader = new BufferCursor(delta); - const sourceSize = readVarIntLE(reader); - if (sourceSize !== source.byteLength) { - throw new InternalError( - `applyDelta expected source buffer to be ${sourceSize} bytes but the provided buffer was ${source.length} bytes` - ); - } - const targetSize = readVarIntLE(reader); - let target; - const firstOp = readOp(reader, source); - if (firstOp.byteLength === targetSize) { - target = firstOp; - } else { - target = Buffer.alloc(targetSize); - const writer = new BufferCursor(target); - writer.copy(firstOp); - while (!reader.eof()) { - writer.copy(readOp(reader, source)); - } - const tell = writer.tell(); - if (targetSize !== tell) { - throw new InternalError( - `applyDelta expected target buffer to be ${targetSize} bytes but the resulting buffer was ${tell} bytes` - ); - } - } - return target; -} -function readVarIntLE(reader) { - let result = 0; - let shift = 0; - let byte = null; - do { - byte = reader.readUInt8(); - result |= (byte & 127) << shift; - shift += 7; - } while (byte & 128); - return result; -} -function readCompactLE(reader, flags, size) { - let result = 0; - let shift = 0; - while (size--) { - if (flags & 1) { - result |= reader.readUInt8() << shift; - } - flags >>= 1; - shift += 8; - } - return result; -} -function readOp(reader, source) { - const byte = reader.readUInt8(); - const COPY = 128; - const OFFS = 15; - const SIZE = 112; - if (byte & COPY) { - const offset = readCompactLE(reader, byte & OFFS, 4); - let size = readCompactLE(reader, (byte & SIZE) >> 4, 3); - if (size === 0) size = 65536; - return source.slice(offset, offset + size); - } else { - return reader.slice(byte); - } -} -function fromValue(value) { - let queue = [value]; - return { - next() { - return Promise.resolve({ done: queue.length === 0, value: queue.pop() }); - }, - return() { - queue = []; - return {}; - }, - [Symbol.asyncIterator]() { - return this; - } - }; -} -function getIterator(iterable) { - if (iterable[Symbol.asyncIterator]) { - return iterable[Symbol.asyncIterator](); - } - if (iterable[Symbol.iterator]) { - return iterable[Symbol.iterator](); - } - if (iterable.next) { - return iterable; - } - return fromValue(iterable); -} -var StreamReader = class { - constructor(stream) { - if (typeof Buffer === "undefined") { - throw new Error("Missing Buffer dependency"); - } - this.stream = getIterator(stream); - this.buffer = null; - this.cursor = 0; - this.undoCursor = 0; - this.started = false; - this._ended = false; - this._discardedBytes = 0; - } - eof() { - return this._ended && this.cursor === this.buffer.length; - } - tell() { - return this._discardedBytes + this.cursor; - } - async byte() { - if (this.eof()) return; - if (!this.started) await this._init(); - if (this.cursor === this.buffer.length) { - await this._loadnext(); - if (this._ended) return; - } - this._moveCursor(1); - return this.buffer[this.undoCursor]; - } - async chunk() { - if (this.eof()) return; - if (!this.started) await this._init(); - if (this.cursor === this.buffer.length) { - await this._loadnext(); - if (this._ended) return; - } - this._moveCursor(this.buffer.length); - return this.buffer.slice(this.undoCursor, this.cursor); - } - async read(n) { - if (this.eof()) return; - if (!this.started) await this._init(); - if (this.cursor + n > this.buffer.length) { - this._trim(); - await this._accumulate(n); - } - this._moveCursor(n); - return this.buffer.slice(this.undoCursor, this.cursor); - } - async skip(n) { - if (this.eof()) return; - if (!this.started) await this._init(); - if (this.cursor + n > this.buffer.length) { - this._trim(); - await this._accumulate(n); - } - this._moveCursor(n); - } - async undo() { - this.cursor = this.undoCursor; - } - async _next() { - this.started = true; - let { done, value } = await this.stream.next(); - if (done) { - this._ended = true; - if (!value) return Buffer.alloc(0); - } - if (value) { - value = Buffer.from(value); - } - return value; - } - _trim() { - this.buffer = this.buffer.slice(this.undoCursor); - this.cursor -= this.undoCursor; - this._discardedBytes += this.undoCursor; - this.undoCursor = 0; - } - _moveCursor(n) { - this.undoCursor = this.cursor; - this.cursor += n; - if (this.cursor > this.buffer.length) { - this.cursor = this.buffer.length; - } - } - async _accumulate(n) { - if (this._ended) return; - const buffers = [this.buffer]; - while (this.cursor + n > lengthBuffers(buffers)) { - const nextbuffer = await this._next(); - if (this._ended) break; - buffers.push(nextbuffer); - } - this.buffer = Buffer.concat(buffers); - } - 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 lengthBuffers(buffers) { - return buffers.reduce((acc, buffer2) => acc + buffer2.length, 0); -} -async function listpack(stream, onData) { - const reader = new StreamReader(stream); - let PACK = await reader.read(4); - PACK = PACK.toString("utf8"); - if (PACK !== "PACK") { - throw new InternalError(`Invalid PACK header '${PACK}'`); - } - let version2 = await reader.read(4); - version2 = version2.readUInt32BE(0); - if (version2 !== 2) { - throw new InternalError(`Invalid packfile version: ${version2}`); - } - let numObjects = await reader.read(4); - numObjects = numObjects.readUInt32BE(0); - if (numObjects < 1) return; - while (!reader.eof() && numObjects--) { - const offset = reader.tell(); - const { type, length, ofs, reference } = await parseHeader(reader); - const inflator = new import_pako.default.Inflate(); - while (!inflator.result) { - const chunk = await reader.chunk(); - if (!chunk) break; - inflator.push(chunk, false); - if (inflator.err) { - throw new InternalError(`Pako error: ${inflator.msg}`); - } - if (inflator.result) { - if (inflator.result.length !== length) { - throw new InternalError( - `Inflated object size is different from that stated in packfile.` - ); - } - await reader.undo(); - await reader.read(chunk.length - inflator.strm.avail_in); - const end = reader.tell(); - await onData({ - data: inflator.result, - type, - num: numObjects, - offset, - end, - reference, - ofs - }); - } - } - } -} -async function parseHeader(reader) { - let byte = await reader.byte(); - const type = byte >> 4 & 7; - let length = byte & 15; - if (byte & 128) { - let shift = 4; - do { - byte = await reader.byte(); - length |= (byte & 127) << shift; - shift += 7; - } while (byte & 128); - } - let ofs; - let reference; - if (type === 6) { - let shift = 0; - ofs = 0; - const bytes = []; - do { - byte = await reader.byte(); - ofs |= (byte & 127) << shift; - shift += 7; - bytes.push(byte); - } while (byte & 128); - reference = Buffer.from(bytes); - } - if (type === 7) { - const buf = await reader.read(20); - reference = buf; - } - return { type, length, ofs, reference }; -} -var supportsDecompressionStream = false; -async function inflate(buffer2) { - if (supportsDecompressionStream === null) { - supportsDecompressionStream = testDecompressionStream(); - } - return supportsDecompressionStream ? browserInflate(buffer2) : import_pako.default.inflate(buffer2); -} -async function browserInflate(buffer2) { - const ds = new DecompressionStream("deflate"); - const d = new Blob([buffer2]).stream().pipeThrough(ds); - return new Uint8Array(await new Response(d).arrayBuffer()); -} -function testDecompressionStream() { - try { - const ds = new DecompressionStream("deflate"); - if (ds) return true; - } catch (_) { - } - return false; -} -function decodeVarInt(reader) { - const bytes = []; - let byte = 0; - let multibyte = 0; - do { - byte = reader.readUInt8(); - const lastSeven = byte & 127; - bytes.push(lastSeven); - multibyte = byte & 128; - } while (multibyte); - return bytes.reduce((a, b) => a + 1 << 7 | b, -1); -} -function otherVarIntDecode(reader, startWith) { - let result = startWith; - let shift = 4; - let byte = null; - do { - byte = reader.readUInt8(); - result |= (byte & 127) << shift; - shift += 7; - } while (byte & 128); - return result; -} -var GitPackIndex = class _GitPackIndex { - constructor(stuff) { - Object.assign(this, stuff); - this.offsetCache = {}; - } - static async fromIdx({ idx, getExternalRefDelta }) { - const reader = new BufferCursor(idx); - const magic = reader.slice(4).toString("hex"); - if (magic !== "ff744f63") { - return; - } - const version2 = reader.readUInt32BE(); - if (version2 !== 2) { - throw new InternalError( - `Unable to read version ${version2} packfile IDX. (Only version 2 supported)` - ); - } - if (idx.byteLength > 2048 * 1024 * 1024) { - throw new InternalError( - `To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.` - ); - } - reader.seek(reader.tell() + 4 * 255); - const size = reader.readUInt32BE(); - const hashes = []; - for (let i = 0; i < size; i++) { - const hash2 = reader.slice(20).toString("hex"); - hashes[i] = hash2; - } - reader.seek(reader.tell() + 4 * size); - const offsets = /* @__PURE__ */ new Map(); - for (let i = 0; i < size; i++) { - offsets.set(hashes[i], reader.readUInt32BE()); - } - const packfileSha = reader.slice(20).toString("hex"); - return new _GitPackIndex({ - hashes, - crcs: {}, - offsets, - packfileSha, - getExternalRefDelta - }); - } - static async fromPack({ pack, getExternalRefDelta, onProgress }) { - const listpackTypes = { - 1: "commit", - 2: "tree", - 3: "blob", - 4: "tag", - 6: "ofs-delta", - 7: "ref-delta" - }; - const offsetToObject = {}; - const packfileSha = pack.slice(-20).toString("hex"); - const hashes = []; - const crcs = {}; - const offsets = /* @__PURE__ */ new Map(); - let totalObjectCount = null; - let lastPercent = null; - await listpack([pack], async ({ data, type, reference, offset, num: num2 }) => { - if (totalObjectCount === null) totalObjectCount = num2; - const percent = Math.floor( - (totalObjectCount - num2) * 100 / totalObjectCount - ); - if (percent !== lastPercent) { - if (onProgress) { - await onProgress({ - phase: "Receiving objects", - loaded: totalObjectCount - num2, - total: totalObjectCount - }); - } - } - lastPercent = percent; - type = listpackTypes[type]; - if (["commit", "tree", "blob", "tag"].includes(type)) { - offsetToObject[offset] = { - type, - offset - }; - } else if (type === "ofs-delta") { - offsetToObject[offset] = { - type, - offset - }; - } else if (type === "ref-delta") { - offsetToObject[offset] = { - type, - offset - }; - } - }); - const offsetArray = Object.keys(offsetToObject).map(Number); - for (const [i, start] of offsetArray.entries()) { - const end = i + 1 === offsetArray.length ? pack.byteLength - 20 : offsetArray[i + 1]; - const o = offsetToObject[start]; - const crc = import_crc_32.default.buf(pack.slice(start, end)) >>> 0; - o.end = end; - o.crc = crc; - } - const p = new _GitPackIndex({ - pack: Promise.resolve(pack), - packfileSha, - crcs, - hashes, - offsets, - getExternalRefDelta - }); - lastPercent = null; - let count = 0; - const objectsByDepth = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - for (let offset in offsetToObject) { - offset = Number(offset); - const percent = Math.floor(count * 100 / totalObjectCount); - if (percent !== lastPercent) { - if (onProgress) { - await onProgress({ - phase: "Resolving deltas", - loaded: count, - total: totalObjectCount - }); - } - } - count++; - lastPercent = percent; - const o = offsetToObject[offset]; - if (o.oid) continue; - try { - p.readDepth = 0; - p.externalReadDepth = 0; - const { type, object } = await p.readSlice({ start: offset }); - objectsByDepth[p.readDepth] += 1; - const oid = await shasum(GitObject.wrap({ type, object })); - o.oid = oid; - hashes.push(oid); - offsets.set(oid, offset); - crcs[oid] = o.crc; - } catch (err) { - continue; - } - } - hashes.sort(); - return p; - } - async toBuffer() { - const buffers = []; - const write = (str, encoding) => { - buffers.push(Buffer.from(str, encoding)); - }; - write("ff744f63", "hex"); - write("00000002", "hex"); - const fanoutBuffer = new BufferCursor(Buffer.alloc(256 * 4)); - for (let i = 0; i < 256; i++) { - let count = 0; - for (const hash2 of this.hashes) { - if (parseInt(hash2.slice(0, 2), 16) <= i) count++; - } - fanoutBuffer.writeUInt32BE(count); - } - buffers.push(fanoutBuffer.buffer); - for (const hash2 of this.hashes) { - write(hash2, "hex"); - } - const crcsBuffer = new BufferCursor(Buffer.alloc(this.hashes.length * 4)); - for (const hash2 of this.hashes) { - crcsBuffer.writeUInt32BE(this.crcs[hash2]); - } - buffers.push(crcsBuffer.buffer); - const offsetsBuffer = new BufferCursor(Buffer.alloc(this.hashes.length * 4)); - for (const hash2 of this.hashes) { - offsetsBuffer.writeUInt32BE(this.offsets.get(hash2)); - } - buffers.push(offsetsBuffer.buffer); - write(this.packfileSha, "hex"); - const totalBuffer = Buffer.concat(buffers); - const sha = await shasum(totalBuffer); - const shaBuffer = Buffer.alloc(20); - shaBuffer.write(sha, "hex"); - return Buffer.concat([totalBuffer, shaBuffer]); - } - async load({ pack }) { - this.pack = pack; - } - async unload() { - this.pack = null; - } - async read({ oid }) { - if (!this.offsets.get(oid)) { - if (this.getExternalRefDelta) { - this.externalReadDepth++; - return this.getExternalRefDelta(oid); - } else { - throw new InternalError(`Could not read object ${oid} from packfile`); - } - } - const start = this.offsets.get(oid); - return this.readSlice({ start }); - } - async readSlice({ start }) { - if (this.offsetCache[start]) { - return Object.assign({}, this.offsetCache[start]); - } - this.readDepth++; - const types2 = { - 16: "commit", - 32: "tree", - 48: "blob", - 64: "tag", - 96: "ofs_delta", - 112: "ref_delta" - }; - if (!this.pack) { - throw new InternalError( - "Tried to read from a GitPackIndex with no packfile loaded into memory" - ); - } - const raw = (await this.pack).slice(start); - const reader = new BufferCursor(raw); - const byte = reader.readUInt8(); - const btype = byte & 112; - let type = types2[btype]; - if (type === void 0) { - throw new InternalError("Unrecognized type: 0b" + btype.toString(2)); - } - const lastFour = byte & 15; - let length = lastFour; - const multibyte = byte & 128; - if (multibyte) { - length = otherVarIntDecode(reader, lastFour); - } - let base = null; - let object = null; - if (type === "ofs_delta") { - const offset = decodeVarInt(reader); - const baseOffset = start - offset; - ({ object: base, type } = await this.readSlice({ start: baseOffset })); - } - if (type === "ref_delta") { - const oid = reader.slice(20).toString("hex"); - ({ object: base, type } = await this.read({ oid })); - } - const buffer2 = raw.slice(reader.tell()); - object = Buffer.from(await inflate(buffer2)); - if (object.byteLength !== length) { - throw new InternalError( - `Packfile told us object would have length ${length} but it had length ${object.byteLength}` - ); - } - if (base) { - object = Buffer.from(applyDelta(object, base)); - } - if (this.readDepth > 3) { - this.offsetCache[start] = { type, object }; - } - return { type, format: "content", object }; - } -}; -var PackfileCache = Symbol("PackfileCache"); -async function loadPackIndex({ - fs, - filename, - getExternalRefDelta, - emitter, - emitterPrefix -}) { - const idx = await fs.read(filename); - return GitPackIndex.fromIdx({ idx, getExternalRefDelta }); -} -function readPackIndex({ - fs, - cache, - filename, - getExternalRefDelta, - emitter, - emitterPrefix -}) { - if (!cache[PackfileCache]) cache[PackfileCache] = /* @__PURE__ */ new Map(); - let p = cache[PackfileCache].get(filename); - if (!p) { - p = loadPackIndex({ - fs, - filename, - getExternalRefDelta, - emitter, - emitterPrefix - }); - cache[PackfileCache].set(filename, p); - } - return p; -} -async function readObjectPacked({ - fs, - cache, - gitdir, - oid, - format = "content", - getExternalRefDelta -}) { - let list = await fs.readdir(join(gitdir, "objects/pack")); - list = list.filter((x) => x.endsWith(".idx")); - for (const filename of list) { - const indexFile = `${gitdir}/objects/pack/${filename}`; - const p = await readPackIndex({ - fs, - cache, - filename: indexFile, - getExternalRefDelta - }); - if (p.error) throw new InternalError(p.error); - if (p.offsets.has(oid)) { - if (!p.pack) { - const packFile = indexFile.replace(/idx$/, "pack"); - p.pack = fs.read(packFile); - } - const result = await p.read({ oid, getExternalRefDelta }); - result.format = "content"; - result.source = `objects/pack/${filename.replace(/idx$/, "pack")}`; - return result; - } - } - return null; -} -async function _readObject({ - fs, - cache, - gitdir, - oid, - format = "content" -}) { - const getExternalRefDelta = (oid2) => _readObject({ fs, cache, gitdir, oid: oid2 }); - let result; - if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") { - result = { format: "wrapped", object: Buffer.from(`tree 0\0`) }; - } - if (!result) { - result = await readObjectLoose({ fs, gitdir, oid }); - } - if (!result) { - result = await readObjectPacked({ - fs, - cache, - gitdir, - oid, - getExternalRefDelta - }); - if (!result) { - throw new NotFoundError(oid); - } - return result; - } - if (format === "deflated") { - return result; - } - if (result.format === "deflated") { - result.object = Buffer.from(await inflate(result.object)); - result.format = "wrapped"; - } - if (format === "wrapped") { - return result; - } - const sha = await shasum(result.object); - if (sha !== oid) { - throw new InternalError( - `SHA check failed! Expected ${oid}, computed ${sha}` - ); - } - const { object, type } = GitObject.unwrap(result.object); - result.type = type; - result.object = object; - result.format = "content"; - if (format === "content") { - return result; - } - throw new InternalError(`invalid requested format "${format}"`); -} -var AlreadyExistsError = class _AlreadyExistsError extends BaseError { - /** - * @param {'note'|'remote'|'tag'|'branch'} noun - * @param {string} where - * @param {boolean} canForce - */ - constructor(noun, where, canForce = true) { - super( - `Failed to create ${noun} at ${where} because it already exists.${canForce ? ` (Hint: use 'force: true' parameter to overwrite existing ${noun}.)` : ""}` - ); - this.code = this.name = _AlreadyExistsError.code; - this.data = { noun, where, canForce }; - } -}; -AlreadyExistsError.code = "AlreadyExistsError"; -var AmbiguousError = class _AmbiguousError extends BaseError { - /** - * @param {'oids'|'refs'} nouns - * @param {string} short - * @param {string[]} matches - */ - constructor(nouns, short, matches) { - super( - `Found multiple ${nouns} matching "${short}" (${matches.join( - ", " - )}). Use a longer abbreviation length to disambiguate them.` - ); - this.code = this.name = _AmbiguousError.code; - this.data = { nouns, short, matches }; - } -}; -AmbiguousError.code = "AmbiguousError"; -var CheckoutConflictError = class _CheckoutConflictError extends BaseError { - /** - * @param {string[]} filepaths - */ - constructor(filepaths) { - super( - `Your local changes to the following files would be overwritten by checkout: ${filepaths.join( - ", " - )}` - ); - this.code = this.name = _CheckoutConflictError.code; - this.data = { filepaths }; - } -}; -CheckoutConflictError.code = "CheckoutConflictError"; -var CommitNotFetchedError = class _CommitNotFetchedError extends BaseError { - /** - * @param {string} ref - * @param {string} oid - */ - constructor(ref, oid) { - super( - `Failed to checkout "${ref}" because commit ${oid} is not available locally. Do a git fetch to make the branch available locally.` - ); - this.code = this.name = _CommitNotFetchedError.code; - this.data = { ref, oid }; - } -}; -CommitNotFetchedError.code = "CommitNotFetchedError"; -var EmptyServerResponseError = class _EmptyServerResponseError extends BaseError { - constructor() { - super(`Empty response from git server.`); - this.code = this.name = _EmptyServerResponseError.code; - this.data = {}; - } -}; -EmptyServerResponseError.code = "EmptyServerResponseError"; -var FastForwardError = class _FastForwardError extends BaseError { - constructor() { - super(`A simple fast-forward merge was not possible.`); - this.code = this.name = _FastForwardError.code; - this.data = {}; - } -}; -FastForwardError.code = "FastForwardError"; -var GitPushError = class _GitPushError extends BaseError { - /** - * @param {string} prettyDetails - * @param {PushResult} result - */ - constructor(prettyDetails, result) { - super(`One or more branches were not updated: ${prettyDetails}`); - this.code = this.name = _GitPushError.code; - this.data = { prettyDetails, result }; - } -}; -GitPushError.code = "GitPushError"; -var HttpError = class _HttpError extends BaseError { - /** - * @param {number} statusCode - * @param {string} statusMessage - * @param {string} response - */ - constructor(statusCode, statusMessage, response) { - super(`HTTP Error: ${statusCode} ${statusMessage}`); - this.code = this.name = _HttpError.code; - this.data = { statusCode, statusMessage, response }; - } -}; -HttpError.code = "HttpError"; -var InvalidFilepathError = class _InvalidFilepathError extends BaseError { - /** - * @param {'leading-slash'|'trailing-slash'|'directory'} [reason] - */ - constructor(reason) { - let message = "invalid filepath"; - if (reason === "leading-slash" || reason === "trailing-slash") { - message = `"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.`; - } else if (reason === "directory") { - message = `"filepath" should not be a directory.`; - } - super(message); - this.code = this.name = _InvalidFilepathError.code; - this.data = { reason }; - } -}; -InvalidFilepathError.code = "InvalidFilepathError"; -var InvalidRefNameError = class _InvalidRefNameError extends BaseError { - /** - * @param {string} ref - * @param {string} suggestion - * @param {boolean} canForce - */ - constructor(ref, suggestion) { - super( - `"${ref}" would be an invalid git reference. (Hint: a valid alternative would be "${suggestion}".)` - ); - this.code = this.name = _InvalidRefNameError.code; - this.data = { ref, suggestion }; - } -}; -InvalidRefNameError.code = "InvalidRefNameError"; -var MaxDepthError = class _MaxDepthError extends BaseError { - /** - * @param {number} depth - */ - constructor(depth) { - super(`Maximum search depth of ${depth} exceeded.`); - this.code = this.name = _MaxDepthError.code; - this.data = { depth }; - } -}; -MaxDepthError.code = "MaxDepthError"; -var MergeNotSupportedError = class _MergeNotSupportedError extends BaseError { - constructor() { - super(`Merges with conflicts are not supported yet.`); - this.code = this.name = _MergeNotSupportedError.code; - this.data = {}; - } -}; -MergeNotSupportedError.code = "MergeNotSupportedError"; -var MergeConflictError = class _MergeConflictError extends BaseError { - /** - * @param {Array} filepaths - * @param {Array} bothModified - * @param {Array} deleteByUs - * @param {Array} deleteByTheirs - */ - constructor(filepaths, bothModified, deleteByUs, deleteByTheirs) { - super( - `Automatic merge failed with one or more merge conflicts in the following files: ${filepaths.toString()}. Fix conflicts then commit the result.` - ); - this.code = this.name = _MergeConflictError.code; - this.data = { filepaths, bothModified, deleteByUs, deleteByTheirs }; - } -}; -MergeConflictError.code = "MergeConflictError"; -var MissingNameError = class _MissingNameError extends BaseError { - /** - * @param {'author'|'committer'|'tagger'} role - */ - constructor(role) { - super( - `No name was provided for ${role} in the argument or in the .git/config file.` - ); - this.code = this.name = _MissingNameError.code; - this.data = { role }; - } -}; -MissingNameError.code = "MissingNameError"; -var MissingParameterError = class _MissingParameterError extends BaseError { - /** - * @param {string} parameter - */ - constructor(parameter) { - super( - `The function requires a "${parameter}" parameter but none was provided.` - ); - this.code = this.name = _MissingParameterError.code; - this.data = { parameter }; - } -}; -MissingParameterError.code = "MissingParameterError"; -var MultipleGitError = class _MultipleGitError extends BaseError { - /** - * @param {Error[]} errors - * @param {string} message - */ - constructor(errors) { - super( - `There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more` - ); - this.code = this.name = _MultipleGitError.code; - this.data = { errors }; - this.errors = errors; - } -}; -MultipleGitError.code = "MultipleGitError"; -var ParseError = class _ParseError extends BaseError { - /** - * @param {string} expected - * @param {string} actual - */ - constructor(expected, actual) { - super(`Expected "${expected}" but received "${actual}".`); - this.code = this.name = _ParseError.code; - this.data = { expected, actual }; - } -}; -ParseError.code = "ParseError"; -var PushRejectedError = class _PushRejectedError extends BaseError { - /** - * @param {'not-fast-forward'|'tag-exists'} reason - */ - constructor(reason) { - let message = ""; - if (reason === "not-fast-forward") { - message = " because it was not a simple fast-forward"; - } else if (reason === "tag-exists") { - message = " because tag already exists"; - } - super(`Push rejected${message}. Use "force: true" to override.`); - this.code = this.name = _PushRejectedError.code; - this.data = { reason }; - } -}; -PushRejectedError.code = "PushRejectedError"; -var RemoteCapabilityError = class _RemoteCapabilityError extends BaseError { - /** - * @param {'shallow'|'deepen-since'|'deepen-not'|'deepen-relative'} capability - * @param {'depth'|'since'|'exclude'|'relative'} parameter - */ - constructor(capability, parameter) { - super( - `Remote does not support the "${capability}" so the "${parameter}" parameter cannot be used.` - ); - this.code = this.name = _RemoteCapabilityError.code; - this.data = { capability, parameter }; - } -}; -RemoteCapabilityError.code = "RemoteCapabilityError"; -var SmartHttpError = class _SmartHttpError extends BaseError { - /** - * @param {string} preview - * @param {string} response - */ - constructor(preview, response) { - super( - `Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${preview}` - ); - this.code = this.name = _SmartHttpError.code; - this.data = { preview, response }; - } -}; -SmartHttpError.code = "SmartHttpError"; -var UnknownTransportError = class _UnknownTransportError extends BaseError { - /** - * @param {string} url - * @param {string} transport - * @param {string} [suggestion] - */ - constructor(url, transport, suggestion) { - super( - `Git remote "${url}" uses an unrecognized transport protocol: "${transport}"` - ); - this.code = this.name = _UnknownTransportError.code; - this.data = { url, transport, suggestion }; - } -}; -UnknownTransportError.code = "UnknownTransportError"; -var UrlParseError = class _UrlParseError extends BaseError { - /** - * @param {string} url - */ - constructor(url) { - super(`Cannot parse remote URL: "${url}"`); - this.code = this.name = _UrlParseError.code; - this.data = { url }; - } -}; -UrlParseError.code = "UrlParseError"; -var UserCanceledError = class _UserCanceledError extends BaseError { - constructor() { - super(`The operation was canceled.`); - this.code = this.name = _UserCanceledError.code; - this.data = {}; - } -}; -UserCanceledError.code = "UserCanceledError"; -var IndexResetError = class _IndexResetError extends BaseError { - /** - * @param {Array} filepaths - */ - constructor(filepath) { - super( - `Could not merge index: Entry for '${filepath}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.` - ); - this.code = this.name = _IndexResetError.code; - this.data = { filepath }; - } -}; -IndexResetError.code = "IndexResetError"; -var NoCommitError = class _NoCommitError extends BaseError { - /** - * @param {string} ref - */ - constructor(ref) { - super( - `"${ref}" does not point to any commit. You're maybe working on a repository with no commits yet. ` - ); - this.code = this.name = _NoCommitError.code; - this.data = { ref }; - } -}; -NoCommitError.code = "NoCommitError"; -var Errors = /* @__PURE__ */ Object.freeze({ - __proto__: null, - AlreadyExistsError, - AmbiguousError, - CheckoutConflictError, - CommitNotFetchedError, - EmptyServerResponseError, - FastForwardError, - GitPushError, - HttpError, - InternalError, - InvalidFilepathError, - InvalidOidError, - InvalidRefNameError, - MaxDepthError, - MergeNotSupportedError, - MergeConflictError, - MissingNameError, - MissingParameterError, - MultipleGitError, - NoRefspecError, - NotFoundError, - ObjectTypeError, - ParseError, - PushRejectedError, - RemoteCapabilityError, - SmartHttpError, - UnknownTransportError, - UnsafeFilepathError, - UrlParseError, - UserCanceledError, - UnmergedPathsError, - IndexResetError, - NoCommitError -}); -function formatAuthor({ name, email, timestamp, timezoneOffset }) { - timezoneOffset = formatTimezoneOffset(timezoneOffset); - return `${name} <${email}> ${timestamp} ${timezoneOffset}`; -} -function formatTimezoneOffset(minutes) { - const sign = simpleSign(negateExceptForZero(minutes)); - minutes = Math.abs(minutes); - const hours = Math.floor(minutes / 60); - minutes -= hours * 60; - let strHours = String(hours); - let strMinutes = String(minutes); - if (strHours.length < 2) strHours = "0" + strHours; - if (strMinutes.length < 2) strMinutes = "0" + strMinutes; - return (sign === -1 ? "-" : "+") + strHours + strMinutes; -} -function simpleSign(n) { - return Math.sign(n) || (Object.is(n, -0) ? -1 : 1); -} -function negateExceptForZero(n) { - return n === 0 ? n : -n; -} -function normalizeNewlines(str) { - str = str.replace(/\r/g, ""); - str = str.replace(/^\n+/, ""); - str = str.replace(/\n+$/, "") + "\n"; - return str; -} -function parseAuthor(author) { - const [, name, email, timestamp, offset] = author.match( - /^(.*) <(.*)> (.*) (.*)$/ - ); - return { - name, - email, - timestamp: Number(timestamp), - timezoneOffset: parseTimezoneOffset(offset) - }; -} -function parseTimezoneOffset(offset) { - let [, sign, hours, minutes] = offset.match(/(\+|-)(\d\d)(\d\d)/); - minutes = (sign === "+" ? 1 : -1) * (Number(hours) * 60 + Number(minutes)); - return negateExceptForZero$1(minutes); -} -function negateExceptForZero$1(n) { - return n === 0 ? n : -n; -} -var GitAnnotatedTag = class _GitAnnotatedTag { - constructor(tag2) { - if (typeof tag2 === "string") { - this._tag = tag2; - } else if (Buffer.isBuffer(tag2)) { - this._tag = tag2.toString("utf8"); - } else if (typeof tag2 === "object") { - this._tag = _GitAnnotatedTag.render(tag2); - } else { - throw new InternalError( - "invalid type passed to GitAnnotatedTag constructor" - ); - } - } - static from(tag2) { - return new _GitAnnotatedTag(tag2); - } - static render(obj) { - return `object ${obj.object} -type ${obj.type} -tag ${obj.tag} -tagger ${formatAuthor(obj.tagger)} +`),this.code=this.name=t.code,this.data={remote:e}}};Za.code="NoRefspecError";var Do=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let n=null;this.parsedConfig=e.trim().split(` +`).map(r=>{if(/^\s*#/.test(r))return{line:r,comment:!0};let i=r.indexOf(" ");if(r.startsWith("^")){let a=r.slice(1);return this.refs.set(n+"^{}",a),{line:r,ref:n,peeled:a}}else{let a=r.slice(0,i);return n=r.slice(i+1),this.refs.set(n,a),{line:r,ref:n,oid:a}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(n=>n.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` +`)+` +`}},Bo=class t{constructor({remotePath:e,localPath:n,force:r,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:n,force:r,matchPrefix:i})}static from(e){let[n,r,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=n==="+",l=i==="*";if(l!==(s==="*"))throw new ue("Invalid refspec");return new t({remotePath:r,localPath:a,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}},Ff=class t{constructor(e=[]){this.rules=e}static from(e){let n=[];for(let r of e)n.push(Bo.from(r));return new t(n)}add(e){let n=Bo.from(e);this.rules.push(n)}translate(e){let n=[];for(let r of this.rules)for(let i of e){let a=r.translate(i);a&&n.push([i,a])}return n}translateOne(e){let n=null;for(let r of this.rules){let i=r.translate(e);i&&(n=i)}return n}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function y5(t,e){let n=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),i=-(nr);return i===0?t.endsWith("^{}")?1:-1:i}var K0=new Map;function J0(t){let e=K0.get(t);return e||(e=v5(t),K0.set(t,e)),e}function v5(t){return t=t.split("/./").join("/").replace(/\/{2,}/g,"/"),t==="/."?"/":t==="./"||(t.startsWith("./")&&(t=t.slice(2)),t.endsWith("/.")&&(t=t.slice(0,-2)),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t==="")?".":t}function B(...t){return J0(t.map(J0).join("/"))}var w5=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},qa=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}`)},Q0={core:{filemode:qa,bare:qa,logallrefupdates:qa,symlinks:qa,ignorecase:qa,bigFileThreshold:w5}},b5=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,x5=/^[A-Za-z0-9-.]+$/,_5=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,S5=/^[A-Za-z][A-Za-z-]*$/,E5=/^(.*?)( *[#;].*)$/,k5=t=>{let e=b5.exec(t);if(e!=null){let[n,r]=e.slice(1);return[n,r]}return null},A5=t=>{let e=_5.exec(t);if(e!=null){let[n,r="true"]=e.slice(1),i=T5(r),a=C5(i);return[n,a]}return null},T5=t=>{let e=E5.exec(t);if(e==null)return t;let[n,r]=e.slice(1);return e1(n)&&e1(r)?`${n}${r}`:n},e1=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,C5=t=>t.split("").reduce((e,n,r,i)=>{let a=n==='"'&&i[r-1]!=="\\",s=n==="\\"&&i[r+1]==='"';return a||s?e:e+n},""),t1=t=>t!=null?t.toLowerCase():null,Mf=(t,e,n)=>[t1(t),e,t1(n)].filter(r=>r!=null).join("."),n1=t=>{let e=t.split("."),n=e.shift(),r=e.pop(),i=e.length?e.join("."):void 0;return{section:n,subsection:i,name:r,path:Mf(n,i,r),sectionPath:Mf(n,i,null)}},F5=(t,e)=>t.reduce((n,r,i)=>e(r)?i:n,-1),Of=class t{constructor(e){let n=null,r=null;this.parsedConfig=e?e.split(` +`).map(i=>{let a=null,s=null,o=i.trim(),l=k5(o),c=l!=null;if(c)[n,r]=l;else{let f=A5(o);f!=null&&([a,s]=f)}let u=Mf(n,r,a);return{line:i,isSection:c,section:n,subsection:r,name:a,value:s,path:u}}):[]}static from(e){return new t(e)}async get(e,n=!1){let r=n1(e).path,i=this.parsedConfig.filter(a=>a.path===r).map(({section:a,name:s,value:o})=>{let l=Q0[a]&&Q0[a][s];return l?l(o):o});return n?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(n=>n.section===e&&n.isSection).map(n=>n.subsection)}async deleteSection(e,n){this.parsedConfig=this.parsedConfig.filter(r=>!(r.section===e&&r.subsection===n))}async append(e,n){return this.set(e,n,!0)}async set(e,n,r=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l}=n1(e),c=F5(this.parsedConfig,u=>u.path===o);if(n==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let u=this.parsedConfig[c],f=Object.assign({},u,{name:s,value:n,modified:!0});r?this.parsedConfig.splice(c+1,0,f):this.parsedConfig[c]=f}else{let u=this.parsedConfig.findIndex(h=>h.path===l),f={section:i,subsection:a,name:s,value:n,modified:!0,path:o};if(x5.test(i)&&S5.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,f);else{let h={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(h,f)}}}toString(){return this.parsedConfig.map(({line:e,section:n,subsection:r,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:r!=null?`[${n} "${r}"]`:`[${n}]`:e).join(` +`)}},ze=class{static async get({fs:e,gitdir:n}){let r=await e.read(`${n}/config`,{encoding:"utf8"});return Of.from(r)}static async save({fs:e,gitdir:n,config:r}){await e.write(`${n}/config`,r.toString(),{encoding:"utf8"})}},Po=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],M5=["config","description","index","shallow","commondir"],wf;async function ir(t,e){return wf===void 0&&(wf=new Xa.default),wf.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:n,remote:r,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let m of i.values())if(!m.match(/[0-9a-f]{40}/))throw new or(m);let u=await ze.get({fs:e,gitdir:n});if(!o){if(o=await u.getall(`remote.${r}.fetch`),o.length===0)throw new Za(r);o.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let f=Ff.from(o),h=new Map;if(c){let m=await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:n,refs:m.map(w=>`refs/tags/${w}`)})}if(s){for(let m of i.keys())if(m.startsWith("refs/tags")&&!m.endsWith("^{}")&&!await t.exists({fs:e,gitdir:n,ref:m})){let w=i.get(m);h.set(m,w)}}let d=f.translate([...i.keys()]);for(let[m,w]of d){let b=i.get(m);h.set(w,b)}let p=f.translate([...a.keys()]);for(let[m,w]of p){let b=a.get(m),S=f.translateOne(b);S&&h.set(w,`ref: ${S}`)}let g=[];if(l){for(let m of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:n,filepath:m})).map(b=>`${m}/${b}`);for(let b of w)h.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:n,refs:g})}for(let[m,w]of h)await ir(m,async()=>e.write(B(n,m),`${w.trim()} +`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:n,ref:r,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new or(i);await ir(r,async()=>e.write(B(n,r),`${i.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:n,ref:r,value:i}){await ir(r,async()=>e.write(B(n,r),`ref: ${i.trim()} +`,"utf8"))}static async deleteRef({fs:e,gitdir:n,ref:r}){return t.deleteRefs({fs:e,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:n,refs:r}){await Promise.all(r.map(o=>e.rm(B(n,o))));let i=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"})),a=Do.from(i),s=a.refs.size;for(let o of r)a.refs.has(o)&&a.delete(o);a.refs.sizee.write(`${n}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith("ref: "))return r=r.slice(5),t.resolve({fs:e,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let a=await t.packedRefs({fs:e,gitdir:n}),s=Po(r).filter(o=>!M5.includes(o));for(let o of s){let l=await ir(o,async()=>await e.read(`${n}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:n,ref:l.trim(),depth:i})}throw new Re(r)}static async exists({fs:e,gitdir:n,ref:r}){try{return await t.expand({fs:e,gitdir:n,ref:r}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await t.packedRefs({fs:e,gitdir:n}),a=Po(r);for(let s of a)if(await ir(s,async()=>e.exists(`${n}/${s}`))||i.has(s))return s;throw new Re(r)}static async expandAgainstMap({ref:e,map:n}){let r=Po(e);for(let i of r)if(await n.has(i))return i;throw new Re(e)}static resolveAgainstMap({ref:e,fullref:n=e,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:n,depth:r,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:n,oid:e};let a=Po(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:r,map:i})}throw new Re(e)}static async packedRefs({fs:e,gitdir:n}){let r=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"}));return Do.from(r).refs}static async listRefs({fs:e,gitdir:n,filepath:r}){let i=t.packedRefs({fs:e,gitdir:n}),a=null;try{a=await e.readdirDeep(`${n}/${r}`),a=a.map(s=>s.replace(`${n}/${r}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(r)&&(s=s.replace(r+"/",""),a.includes(s)||a.push(s));return a.sort(y5),a}static async listBranches({fs:e,gitdir:n,remote:r}){return r?t.listRefs({fs:e,gitdir:n,filepath:`refs/remotes/${r}`}):t.listRefs({fs:e,gitdir:n,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:n}){return(await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function O5(t,e){return Wo(r1(t),r1(e))}function r1(t){return t.mode==="040000"?t.path+"/":t.path}function k1(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t}`)}function P5(t){let e=[],n=0;for(;n`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(O5),Buffer.concat(e.map(n=>{let r=Buffer.from(n.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(n.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(n.oid,"hex");return Buffer.concat([r,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},lr=class{static wrap({type:e,object:n}){return Buffer.concat([Buffer.from(`${e} ${n.byteLength.toString()}\0`),Buffer.from(n)])}static unwrap(e){let n=e.indexOf(32),r=e.indexOf(0),i=e.slice(0,n).toString("utf8"),a=e.slice(n+1,r).toString("utf8"),s=e.length-(r+1);if(parseInt(a)!==s)throw new ue(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(r+1))}}};async function L5({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await t.read(`${e}/${r}`);return i?{object:i,format:"deflated",source:r}:null}function j5(t,e){let n=new en(t),r=i1(n);if(r!==e.byteLength)throw new ue(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);let i=i1(n),a,s=s1(n,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new en(a);for(o.copy(s);!n.eof();)o.copy(s1(n,e));let l=o.tell();if(i!==l)throw new ue(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function i1(t){let e=0,n=0,r=null;do r=t.readUInt8(),e|=(r&127)<>=1,i+=8;return r}function s1(t,e){let n=t.readUInt8(),r=128,i=15,a=112;if(n&r){let s=a1(t,n&i,4),o=a1(t,(n&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(n)}function D5(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function A1(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:D5(t)}var No=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=A1(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:n}=await this.stream.next();return e&&(this._ended=!0,!n)?Buffer.alloc(0):(n&&(n=Buffer.from(n)),n)}_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 n=[this.buffer];for(;this.cursor+e>B5(n);){let r=await this._next();if(this._ended)break;n.push(r)}this.buffer=Buffer.concat(n)}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 B5(t){return t.reduce((e,n)=>e+n.length,0)}async function N5(t,e){let n=new No(t),r=await n.read(4);if(r=r.toString("utf8"),r!=="PACK")throw new ue(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new ue(`Invalid packfile version: ${i}`);let a=await n.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!n.eof()&&a--;){let s=n.tell(),{type:o,length:l,ofs:c,reference:u}=await $5(n),f=new Vo.default.Inflate;for(;!f.result;){let h=await n.chunk();if(!h)break;if(f.push(h,!1),f.err)throw new ue(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new ue("Inflated object size is different from that stated in packfile.");await n.undo(),await n.read(h.length-f.strm.avail_in);let d=n.tell();await e({data:f.result,type:o,num:a,offset:s,end:d,reference:u,ofs:c})}}}}async function $5(t){let e=await t.byte(),n=e>>4&7,r=e&15;if(e&128){let s=4;do e=await t.byte(),r|=(e&127)<i+1<<7|a,-1)}function G5(t,e){let n=e,r=4,i=null;do i=t.readUInt8(),n|=(i&127)<2048*1024*1024)throw new ue("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");r.seek(r.tell()+4*255);let s=r.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=k);let x=Math.floor((u-k)*100/u);x!==f&&r&&await r({phase:"Receiving objects",loaded:u-k,total:u}),f=x,w=i[w],["commit","tree","blob","tag"].includes(w)?a[S]={type:w,offset:S}:w==="ofs-delta"?a[S]={type:w,offset:S}:w==="ref-delta"&&(a[S]={type:w,offset:S})});let h=Object.keys(a).map(Number);for(let[m,w]of h.entries()){let b=m+1===h.length?e.byteLength-20:h[m+1],S=a[w],k=v1.default.buf(e.slice(w,b))>>>0;S.end=b,S.crc=k}let d=new t({pack:Promise.resolve(e),packfileSha:s,crcs:l,hashes:o,offsets:c,getExternalRefDelta:n});f=null;let p=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let m in a){m=Number(m);let w=Math.floor(p*100/u);w!==f&&r&&await r({phase:"Resolving deltas",loaded:p,total:u}),p++,f=w;let b=a[m];if(!b.oid)try{d.readDepth=0,d.externalReadDepth=0;let{type:S,object:k}=await d.readSlice({start:m});g[d.readDepth]+=1;let x=await Un(lr.wrap({type:S,object:k}));b.oid=x,o.push(x),c.set(x,m),l[x]=b.crc}catch(S){continue}}return o.sort(),d}async toBuffer(){let e=[],n=(c,u)=>{e.push(Buffer.from(c,u))};n("ff744f63","hex"),n("00000002","hex");let r=new en(Buffer.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++;r.writeUInt32BE(u)}e.push(r.buffer);for(let c of this.hashes)n(c,"hex");let i=new en(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);e.push(i.buffer);let a=new en(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)a.writeUInt32BE(this.offsets.get(c));e.push(a.buffer),n(this.packfileSha,"hex");let s=Buffer.concat(e),o=await Un(s),l=Buffer.alloc(20);return l.write(o,"hex"),Buffer.concat([s,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 ue(`Could not read object ${e} from packfile`)}let n=this.offsets.get(e);return this.readSlice({start:n})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let n={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new ue("Tried to read from a GitPackIndex with no packfile loaded into memory");let r=(await this.pack).slice(e),i=new en(r),a=i.readUInt8(),s=a&112,o=n[s];if(o===void 0)throw new ue("Unrecognized type: 0b"+s.toString(2));let l=a&15,c=l;a&128&&(c=G5(i,l));let f=null,h=null;if(o==="ofs_delta"){let p=z5(i),g=e-p;({object:f,type:o}=await this.readSlice({start:g}))}if(o==="ref_delta"){let p=i.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:p}))}let d=r.slice(i.tell());if(h=Buffer.from(await T1(d)),h.byteLength!==c)throw new ue(`Packfile told us object would have length ${c} but it had length ${h.byteLength}`);return f&&(h=Buffer.from(j5(h,f))),this.readDepth>3&&(this.offsetCache[e]={type:o,object:h}),{type:o,format:"content",object:h}}},Io=Symbol("PackfileCache");async function V5({fs:t,filename:e,getExternalRefDelta:n,emitter:r,emitterPrefix:i}){let a=await t.read(e);return Ka.fromIdx({idx:a,getExternalRefDelta:n})}function $f({fs:t,cache:e,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}){e[Io]||(e[Io]=new Map);let s=e[Io].get(n);return s||(s=V5({fs:t,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}),e[Io].set(n,s)),s}async function W5({fs:t,cache:e,gitdir:n,oid:r,format:i="content",getExternalRefDelta:a}){let s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await $f({fs:t,cache:e,filename:l,getExternalRefDelta:a});if(c.error)throw new ue(c.error);if(c.offsets.has(r)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=t.read(f)}let u=await c.read({oid:r,getExternalRefDelta:a});return u.format="content",u.source=`objects/pack/${o.replace(/idx$/,"pack")}`,u}}return null}async function Ge({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=u=>Ge({fs:t,cache:e,gitdir:n,oid:u}),s;if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await L5({fs:t,gitdir:n,oid:r})),!s){if(s=await W5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a}),!s)throw new Re(r);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await T1(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await Un(s.object);if(o!==r)throw new ue(`SHA check failed! Expected ${r}, computed ${o}`);let{object:l,type:c}=lr.unwrap(s.object);if(s.type=c,s.object=l,s.format="content",i==="content")return s;throw new ue(`invalid requested format "${i}"`)}var hn=class t extends ge{constructor(e,n,r=!0){super(`Failed to create ${e} at ${n} because it already exists.${r?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:n,canForce:r}}};hn.code="AlreadyExistsError";var Ja=class t extends ge{constructor(e,n,r){super(`Found multiple ${e} matching "${n}" (${r.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:n,matches:r}}};Ja.code="AmbiguousError";var Qa=class t extends ge{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}}};Qa.code="CheckoutConflictError";var es=class t extends ge{constructor(e,n){super(`Failed to checkout "${e}" because commit ${n} 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:n}}};es.code="CommitNotFetchedError";var ts=class t extends ge{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};ts.code="EmptyServerResponseError";var ns=class t extends ge{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};ns.code="FastForwardError";var rs=class t extends ge{constructor(e,n){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:n}}};rs.code="GitPushError";var Ai=class t extends ge{constructor(e,n,r){super(`HTTP Error: ${e} ${n}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:n,response:r}}};Ai.code="HttpError";var cr=class t extends ge{constructor(e){let n="invalid filepath";e==="leading-slash"||e==="trailing-slash"?n='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(n='"filepath" should not be a directory.'),super(n),this.code=this.name=t.code,this.data={reason:e}}};cr.code="InvalidFilepathError";var zn=class t extends ge{constructor(e,n){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:n}}};zn.code="InvalidRefNameError";var is=class t extends ge{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};is.code="MaxDepthError";var Ti=class t extends ge{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Ti.code="MergeNotSupportedError";var Ci=class t extends ge{constructor(e,n,r,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:n,deleteByUs:r,deleteByTheirs:i}}};Ci.code="MergeConflictError";var At=class t extends ge{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}}};At.code="MissingNameError";var Pt=class t extends ge{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Pt.code="MissingParameterError";var as=class t extends ge{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}};as.code="MultipleGitError";var $r=class t extends ge{constructor(e,n){super(`Expected "${e}" but received "${n}".`),this.code=this.name=t.code,this.data={expected:e,actual:n}}};$r.code="ParseError";var Fi=class t extends ge{constructor(e){let n="";e==="not-fast-forward"?n=" because it was not a simple fast-forward":e==="tag-exists"&&(n=" because tag already exists"),super(`Push rejected${n}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Fi.code="PushRejectedError";var ar=class t extends ge{constructor(e,n){super(`Remote does not support the "${e}" so the "${n}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:n}}};ar.code="RemoteCapabilityError";var ss=class t extends ge{constructor(e,n){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:n}}};ss.code="SmartHttpError";var os=class t extends ge{constructor(e,n,r){super(`Git remote "${e}" uses an unrecognized transport protocol: "${n}"`),this.code=this.name=t.code,this.data={url:e,transport:n,suggestion:r}}};os.code="UnknownTransportError";var ls=class t extends ge{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};ls.code="UrlParseError";var Mi=class t extends ge{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Mi.code="UserCanceledError";var cs=class t extends ge{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}}};cs.code="IndexResetError";var us=class t extends ge{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}}};us.code="NoCommitError";var hs=Object.freeze({__proto__:null,AlreadyExistsError:hn,AmbiguousError:Ja,CheckoutConflictError:Qa,CommitNotFetchedError:es,EmptyServerResponseError:ts,FastForwardError:ns,GitPushError:rs,HttpError:Ai,InternalError:ue,InvalidFilepathError:cr,InvalidOidError:or,InvalidRefNameError:zn,MaxDepthError:is,MergeNotSupportedError:Ti,MergeConflictError:Ci,MissingNameError:At,MissingParameterError:Pt,MultipleGitError:as,NoRefspecError:Za,NotFoundError:Re,ObjectTypeError:kt,ParseError:$r,PushRejectedError:Fi,RemoteCapabilityError:ar,SmartHttpError:ss,UnknownTransportError:os,UnsafeFilepathError:Si,UrlParseError:ls,UserCanceledError:Mi,UnmergedPathsError:Ya,IndexResetError:cs,NoCommitError:us});function Pf({name:t,email:e,timestamp:n,timezoneOffset:r}){return r=q5(r),`${t} <${e}> ${n} ${r}`}function q5(t){let e=X5(Y5(t));t=Math.abs(t);let n=Math.floor(t/60);t-=n*60;let r=String(n),i=String(t);return r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),(e===-1?"-":"+")+r+i}function X5(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function Y5(t){return t===0?t:-t}function Hn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function $o(t){let[,e,n,r,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:n,timestamp:Number(r),timezoneOffset:Z5(i)}}function Z5(t){let[,e,n,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=(e==="+"?1:-1)*(Number(n)*60+Number(r)),K5(r)}function K5(t){return t===0?t:-t}var Ut=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ue("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object} +type ${e.type} +tag ${e.tag} +tagger ${Pf(e.tagger)} -${obj.message} -${obj.gpgsig ? obj.gpgsig : ""}`; - } - justHeaders() { - return this._tag.slice(0, this._tag.indexOf("\n\n")); - } - message() { - const tag2 = this.withoutSignature(); - return tag2.slice(tag2.indexOf("\n\n") + 2); - } - parse() { - return Object.assign(this.headers(), { - message: this.message(), - gpgsig: this.gpgsig() - }); - } - render() { - return this._tag; - } - headers() { - const headers = this.justHeaders().split("\n"); - const hs = []; - for (const h of headers) { - if (h[0] === " ") { - hs[hs.length - 1] += "\n" + h.slice(1); - } else { - hs.push(h); - } - } - const obj = {}; - for (const h of hs) { - const key2 = h.slice(0, h.indexOf(" ")); - const value = h.slice(h.indexOf(" ") + 1); - if (Array.isArray(obj[key2])) { - obj[key2].push(value); - } else { - obj[key2] = value; - } - } - if (obj.tagger) { - obj.tagger = parseAuthor(obj.tagger); - } - if (obj.committer) { - obj.committer = parseAuthor(obj.committer); - } - return obj; - } - withoutSignature() { - const tag2 = normalizeNewlines(this._tag); - if (tag2.indexOf("\n-----BEGIN PGP SIGNATURE-----") === -1) return tag2; - return tag2.slice(0, tag2.lastIndexOf("\n-----BEGIN PGP SIGNATURE-----")); - } - gpgsig() { - if (this._tag.indexOf("\n-----BEGIN PGP SIGNATURE-----") === -1) return; - const signature = this._tag.slice( - this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"), - this._tag.indexOf("-----END PGP SIGNATURE-----") + "-----END PGP SIGNATURE-----".length - ); - return normalizeNewlines(signature); - } - payload() { - return this.withoutSignature() + "\n"; - } - toObject() { - return Buffer.from(this._tag, "utf8"); - } - static async sign(tag2, sign, secretKey) { - const payload = tag2.payload(); - let { signature } = await sign({ payload, secretKey }); - signature = normalizeNewlines(signature); - const signedTag = payload + signature; - return _GitAnnotatedTag.from(signedTag); - } -}; -function indent(str) { - return str.trim().split("\n").map((x) => " " + x).join("\n") + "\n"; -} -function outdent(str) { - return str.split("\n").map((x) => x.replace(/^ /, "")).join("\n"); -} -var GitCommit = class _GitCommit { - constructor(commit2) { - if (typeof commit2 === "string") { - this._commit = commit2; - } else if (Buffer.isBuffer(commit2)) { - this._commit = commit2.toString("utf8"); - } else if (typeof commit2 === "object") { - this._commit = _GitCommit.render(commit2); - } else { - throw new InternalError("invalid type passed to GitCommit constructor"); - } - } - static fromPayloadSignature({ payload, signature }) { - const headers = _GitCommit.justHeaders(payload); - const message = _GitCommit.justMessage(payload); - const commit2 = normalizeNewlines( - headers + "\ngpgsig" + indent(signature) + "\n" + message - ); - return new _GitCommit(commit2); - } - static from(commit2) { - return new _GitCommit(commit2); - } - toObject() { - return Buffer.from(this._commit, "utf8"); - } - // Todo: allow setting the headers and message - headers() { - return this.parseHeaders(); - } - // Todo: allow setting the headers and message - message() { - return _GitCommit.justMessage(this._commit); - } - parse() { - return Object.assign({ message: this.message() }, this.headers()); - } - static justMessage(commit2) { - return normalizeNewlines(commit2.slice(commit2.indexOf("\n\n") + 2)); - } - static justHeaders(commit2) { - return commit2.slice(0, commit2.indexOf("\n\n")); - } - parseHeaders() { - const headers = _GitCommit.justHeaders(this._commit).split("\n"); - const hs = []; - for (const h of headers) { - if (h[0] === " ") { - hs[hs.length - 1] += "\n" + h.slice(1); - } else { - hs.push(h); - } - } - const obj = { - parent: [] - }; - for (const h of hs) { - const key2 = h.slice(0, h.indexOf(" ")); - const value = h.slice(h.indexOf(" ") + 1); - if (Array.isArray(obj[key2])) { - obj[key2].push(value); - } else { - obj[key2] = value; - } - } - if (obj.author) { - obj.author = parseAuthor(obj.author); - } - if (obj.committer) { - obj.committer = parseAuthor(obj.committer); - } - return obj; - } - static renderHeaders(obj) { - let headers = ""; - if (obj.tree) { - headers += `tree ${obj.tree} -`; - } else { - headers += `tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 -`; - } - if (obj.parent) { - if (obj.parent.length === void 0) { - throw new InternalError(`commit 'parent' property should be an array`); - } - for (const p of obj.parent) { - headers += `parent ${p} -`; - } - } - const author = obj.author; - headers += `author ${formatAuthor(author)} -`; - const committer = obj.committer || obj.author; - headers += `committer ${formatAuthor(committer)} -`; - if (obj.gpgsig) { - headers += "gpgsig" + indent(obj.gpgsig); - } - return headers; - } - static render(obj) { - return _GitCommit.renderHeaders(obj) + "\n" + normalizeNewlines(obj.message); - } - render() { - return this._commit; - } - withoutSignature() { - const commit2 = normalizeNewlines(this._commit); - if (commit2.indexOf("\ngpgsig") === -1) return commit2; - const headers = commit2.slice(0, commit2.indexOf("\ngpgsig")); - const message = commit2.slice( - commit2.indexOf("-----END PGP SIGNATURE-----\n") + "-----END PGP SIGNATURE-----\n".length - ); - return normalizeNewlines(headers + "\n" + message); - } - isolateSignature() { - const signature = this._commit.slice( - this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"), - this._commit.indexOf("-----END PGP SIGNATURE-----") + "-----END PGP SIGNATURE-----".length - ); - return outdent(signature); - } - static async sign(commit2, sign, secretKey) { - const payload = commit2.withoutSignature(); - const message = _GitCommit.justMessage(commit2._commit); - let { signature } = await sign({ payload, secretKey }); - signature = normalizeNewlines(signature); - const headers = _GitCommit.justHeaders(commit2._commit); - const signedCommit = headers + "\ngpgsig" + indent(signature) + "\n" + message; - return _GitCommit.from(signedCommit); - } -}; -async function resolveTree({ fs, cache, gitdir, oid }) { - if (oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904") { - return { tree: GitTree.from([]), oid }; - } - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - if (type === "tag") { - oid = GitAnnotatedTag.from(object).parse().object; - return resolveTree({ fs, cache, gitdir, oid }); - } - if (type === "commit") { - oid = GitCommit.from(object).parse().tree; - return resolveTree({ fs, cache, gitdir, oid }); - } - if (type !== "tree") { - throw new ObjectTypeError(oid, type, "tree"); - } - return { tree: GitTree.from(object), oid }; -} -var GitWalkerRepo = class { - constructor({ fs, gitdir, ref, cache }) { - this.fs = fs; - this.cache = cache; - this.gitdir = gitdir; - this.mapPromise = (async () => { - const map = /* @__PURE__ */ new Map(); - let oid; - try { - oid = await GitRefManager.resolve({ fs, gitdir, ref }); - } catch (e) { - if (e instanceof NotFoundError) { - oid = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"; - } - } - const tree = await resolveTree({ fs, cache: this.cache, gitdir, oid }); - tree.type = "tree"; - tree.mode = "40000"; - map.set(".", tree); - return map; - })(); - const walker = this; - this.ConstructEntry = class TreeEntry { - constructor(fullpath) { - this._fullpath = fullpath; - this._type = false; - this._mode = false; - this._stat = false; - this._content = false; - this._oid = false; - } - async type() { - return walker.type(this); - } - async mode() { - return walker.mode(this); - } - async stat() { - return walker.stat(this); - } - async content() { - return walker.content(this); - } - async oid() { - return walker.oid(this); - } - }; - } - async readdir(entry) { - const filepath = entry._fullpath; - const { fs, cache, gitdir } = this; - const map = await this.mapPromise; - const obj = map.get(filepath); - if (!obj) throw new Error(`No obj for ${filepath}`); - const oid = obj.oid; - if (!oid) throw new Error(`No oid for obj ${JSON.stringify(obj)}`); - if (obj.type !== "tree") { - return null; - } - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - if (type !== obj.type) { - throw new ObjectTypeError(oid, type, obj.type); - } - const tree = GitTree.from(object); - for (const entry2 of tree) { - map.set(join(filepath, entry2.path), entry2); - } - return tree.entries().map((entry2) => join(filepath, entry2.path)); - } - async type(entry) { - if (entry._type === false) { - const map = await this.mapPromise; - const { type } = map.get(entry._fullpath); - entry._type = type; - } - return entry._type; - } - async mode(entry) { - if (entry._mode === false) { - const map = await this.mapPromise; - const { mode } = map.get(entry._fullpath); - entry._mode = normalizeMode(parseInt(mode, 8)); - } - return entry._mode; - } - async stat(_entry) { - } - async content(entry) { - if (entry._content === false) { - const map = await this.mapPromise; - const { fs, cache, gitdir } = this; - const obj = map.get(entry._fullpath); - const oid = obj.oid; - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - if (type !== "blob") { - entry._content = void 0; - } else { - entry._content = new Uint8Array(object); - } - } - return entry._content; - } - async oid(entry) { - if (entry._oid === false) { - const map = await this.mapPromise; - const obj = map.get(entry._fullpath); - entry._oid = obj.oid; - } - return entry._oid; - } -}; -function TREE({ ref = "HEAD" } = {}) { - const o = /* @__PURE__ */ Object.create(null); - Object.defineProperty(o, GitWalkSymbol, { - value: function({ fs, gitdir, cache }) { - return new GitWalkerRepo({ fs, gitdir, ref, cache }); - } - }); - Object.freeze(o); - return o; -} -var GitWalkerFs = class { - constructor({ fs, dir, gitdir, cache }) { - this.fs = fs; - this.cache = cache; - this.dir = dir; - this.gitdir = gitdir; - const walker = this; - this.ConstructEntry = class WorkdirEntry { - constructor(fullpath) { - this._fullpath = fullpath; - this._type = false; - this._mode = false; - this._stat = false; - this._content = false; - this._oid = false; - } - async type() { - return walker.type(this); - } - async mode() { - return walker.mode(this); - } - async stat() { - return walker.stat(this); - } - async content() { - return walker.content(this); - } - async oid() { - return walker.oid(this); - } - }; - } - async readdir(entry) { - const filepath = entry._fullpath; - const { fs, dir } = this; - const names = await fs.readdir(join(dir, filepath)); - if (names === null) return null; - return names.map((name) => join(filepath, name)); - } - async type(entry) { - if (entry._type === false) { - await entry.stat(); - } - return entry._type; - } - async mode(entry) { - if (entry._mode === false) { - await entry.stat(); - } - return entry._mode; - } - async stat(entry) { - if (entry._stat === false) { - const { fs, dir } = this; - let stat = await fs.lstat(`${dir}/${entry._fullpath}`); - if (!stat) { - throw new Error( - `ENOENT: no such file or directory, lstat '${entry._fullpath}'` - ); - } - let type = stat.isDirectory() ? "tree" : "blob"; - if (type === "blob" && !stat.isFile() && !stat.isSymbolicLink()) { - type = "special"; - } - entry._type = type; - stat = normalizeStats(stat); - entry._mode = stat.mode; - if (stat.size === -1 && entry._actualSize) { - stat.size = entry._actualSize; - } - entry._stat = stat; - } - return entry._stat; - } - async content(entry) { - if (entry._content === false) { - const { fs, dir, gitdir } = this; - if (await entry.type() === "tree") { - entry._content = void 0; - } else { - const config = await GitConfigManager.get({ fs, gitdir }); - const autocrlf = await config.get("core.autocrlf"); - const content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf }); - entry._actualSize = content.length; - if (entry._stat && entry._stat.size === -1) { - entry._stat.size = entry._actualSize; - } - entry._content = new Uint8Array(content); - } - } - return entry._content; - } - async oid(entry) { - if (entry._oid === false) { - const { fs, gitdir, cache } = this; - let oid; - await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - const stage = index2.entriesMap.get(entry._fullpath); - const stats = await entry.stat(); - const config = await GitConfigManager.get({ fs, gitdir }); - const filemode = await config.get("core.filemode"); - const trustino = typeof process !== "undefined" ? !(process.platform === "win32") : true; - if (!stage || compareStats(stats, stage, filemode, trustino)) { - const content = await entry.content(); - if (content === void 0) { - oid = void 0; - } else { - oid = await shasum( - GitObject.wrap({ type: "blob", object: await entry.content() }) - ); - if (stage && oid === stage.oid && (!filemode || stats.mode === stage.mode) && compareStats(stats, stage, filemode, trustino)) { - index2.insert({ - filepath: entry._fullpath, - stats, - oid - }); - } - } - } else { - oid = stage.oid; - } - }); - entry._oid = oid; - } - return entry._oid; - } -}; -function WORKDIR() { - const o = /* @__PURE__ */ Object.create(null); - Object.defineProperty(o, GitWalkSymbol, { - value: function({ fs, dir, gitdir, cache }) { - return new GitWalkerFs({ fs, dir, gitdir, cache }); - } - }); - Object.freeze(o); - return o; -} -function arrayRange(start, end) { - const length = end - start; - return Array.from({ length }, (_, i) => start + i); -} -var flat = typeof Array.prototype.flat === "undefined" ? (entries) => entries.reduce((acc, x) => acc.concat(x), []) : (entries) => entries.flat(); -var RunningMinimum = class { - constructor() { - this.value = null; - } - consider(value) { - if (value === null || value === void 0) return; - if (this.value === null) { - this.value = value; - } else if (value < this.value) { - this.value = value; - } - } - reset() { - this.value = null; - } -}; -function* unionOfIterators(sets) { - const min = new RunningMinimum(); - let minimum; - const heads = []; - const numsets = sets.length; - for (let i = 0; i < numsets; i++) { - heads[i] = sets[i].next().value; - if (heads[i] !== void 0) { - min.consider(heads[i]); - } - } - if (min.value === null) return; - while (true) { - const result = []; - minimum = min.value; - min.reset(); - for (let i = 0; i < numsets; i++) { - if (heads[i] !== void 0 && heads[i] === minimum) { - result[i] = heads[i]; - heads[i] = sets[i].next().value; - } else { - result[i] = null; - } - if (heads[i] !== void 0) { - min.consider(heads[i]); - } - } - yield result; - if (min.value === null) return; - } -} -async function _walk({ - fs, - cache, - dir, - gitdir, - trees, - // @ts-ignore - map = async (_, entry) => entry, - // The default reducer is a flatmap that filters out undefineds. - reduce = async (parent, children2) => { - const flatten = flat(children2); - if (parent !== void 0) flatten.unshift(parent); - return flatten; - }, - // The default iterate function walks all children concurrently - iterate = (walk2, children2) => Promise.all([...children2].map(walk2)) -}) { - const walkers = trees.map( - (proxy) => proxy[GitWalkSymbol]({ fs, dir, gitdir, cache }) - ); - const root2 = new Array(walkers.length).fill("."); - const range = arrayRange(0, walkers.length); - const unionWalkerFromReaddir = async (entries) => { - range.map((i) => { - entries[i] = entries[i] && new walkers[i].ConstructEntry(entries[i]); - }); - const subdirs = await Promise.all( - range.map((i) => entries[i] ? walkers[i].readdir(entries[i]) : []) - ); - const iterators = subdirs.map((array) => array === null ? [] : array).map((array) => array[Symbol.iterator]()); - return { - entries, - children: unionOfIterators(iterators) - }; - }; - const walk2 = async (root3) => { - const { entries, children: children2 } = await unionWalkerFromReaddir(root3); - const fullpath = entries.find((entry) => entry && entry._fullpath)._fullpath; - const parent = await map(fullpath, entries); - if (parent !== null) { - let walkedChildren = await iterate(walk2, children2); - walkedChildren = walkedChildren.filter((x) => x !== void 0); - return reduce(parent, walkedChildren); - } - }; - return walk2(root2); -} -async function rmRecursive(fs, filepath) { - const entries = await fs.readdir(filepath); - if (entries == null) { - await fs.rm(filepath); - } else if (entries.length) { - await Promise.all( - entries.map((entry) => { - const subpath = join(filepath, entry); - return fs.lstat(subpath).then((stat) => { - if (!stat) return; - return stat.isDirectory() ? rmRecursive(fs, subpath) : fs.rm(subpath); - }); - }) - ).then(() => fs.rmdir(filepath)); - } else { - await fs.rmdir(filepath); - } -} -function isPromiseLike(obj) { - return isObject(obj) && isFunction(obj.then) && isFunction(obj.catch); -} -function isObject(obj) { - return obj && typeof obj === "object"; -} -function isFunction(obj) { - return typeof obj === "function"; -} -function isPromiseFs(fs) { - const test = (targetFs) => { - try { - return targetFs.readFile().catch((e) => e); - } catch (e) { - return e; - } - }; - return isPromiseLike(test(fs)); -} -var commands = [ - "readFile", - "writeFile", - "mkdir", - "rmdir", - "unlink", - "stat", - "lstat", - "readdir", - "readlink", - "symlink" -]; -function bindFs(target, fs) { - if (isPromiseFs(fs)) { - for (const command of commands) { - target[`_${command}`] = fs[command].bind(fs); - } - } else { - for (const command of commands) { - target[`_${command}`] = (0, import_pify.default)(fs[command].bind(fs)); - } - } - if (isPromiseFs(fs)) { - if (fs.rm) target._rm = fs.rm.bind(fs); - else if (fs.rmdir.length > 1) target._rm = fs.rmdir.bind(fs); - else target._rm = rmRecursive.bind(null, target); - } else { - if (fs.rm) target._rm = (0, import_pify.default)(fs.rm.bind(fs)); - else if (fs.rmdir.length > 2) target._rm = (0, import_pify.default)(fs.rmdir.bind(fs)); - else target._rm = rmRecursive.bind(null, target); - } -} -var FileSystem = class { - constructor(fs) { - if (typeof fs._original_unwrapped_fs !== "undefined") return fs; - const promises = Object.getOwnPropertyDescriptor(fs, "promises"); - if (promises && promises.enumerable) { - bindFs(this, fs.promises); - } else { - bindFs(this, fs); - } - this._original_unwrapped_fs = fs; - } - /** - * Return true if a file exists, false if it doesn't exist. - * Rethrows errors that aren't related to file existence. - */ - async exists(filepath, options = {}) { - try { - await this._stat(filepath); - return true; - } catch (err) { - if (err.code === "ENOENT" || err.code === "ENOTDIR") { - return false; - } else { - console.log('Unhandled error in "FileSystem.exists()" function', err); - throw err; - } - } - } - /** - * Return the contents of a file if it exists, otherwise returns null. - * - * @param {string} filepath - * @param {object} [options] - * - * @returns {Promise} - */ - async read(filepath, options = {}) { - try { - let buffer2 = await this._readFile(filepath, options); - if (options.autocrlf === "true") { - try { - buffer2 = new TextDecoder("utf8", { fatal: true }).decode(buffer2); - buffer2 = buffer2.replace(/\r\n/g, "\n"); - buffer2 = new TextEncoder().encode(buffer2); - } catch (error) { - } - } - if (typeof buffer2 !== "string") { - buffer2 = Buffer.from(buffer2); - } - return buffer2; - } catch (err) { - return null; - } - } - /** - * Write a file (creating missing directories if need be) without throwing errors. - * - * @param {string} filepath - * @param {Buffer|Uint8Array|string} contents - * @param {object|string} [options] - */ - async write(filepath, contents, options = {}) { - try { - await this._writeFile(filepath, contents, options); - return; - } catch (err) { - await this.mkdir(dirname(filepath)); - await this._writeFile(filepath, contents, options); - } - } - /** - * Make a directory (or series of nested directories) without throwing an error if it already exists. - */ - async mkdir(filepath, _selfCall = false) { - try { - await this._mkdir(filepath); - return; - } catch (err) { - if (err === null) return; - if (err.code === "EEXIST") return; - if (_selfCall) throw err; - if (err.code === "ENOENT") { - const parent = dirname(filepath); - if (parent === "." || parent === "/" || parent === filepath) throw err; - await this.mkdir(parent); - await this.mkdir(filepath, true); - } - } - } - /** - * Delete a file without throwing an error if it is already deleted. - */ - async rm(filepath) { - try { - await this._unlink(filepath); - } catch (err) { - if (err.code !== "ENOENT") throw err; - } - } - /** - * Delete a directory without throwing an error if it is already deleted. - */ - async rmdir(filepath, opts) { - try { - if (opts && opts.recursive) { - await this._rm(filepath, opts); - } else { - await this._rmdir(filepath); - } - } catch (err) { - if (err.code !== "ENOENT") throw err; - } - } - /** - * Read a directory without throwing an error is the directory doesn't exist - */ - async readdir(filepath) { - try { - const names = await this._readdir(filepath); - names.sort(compareStrings); - return names; - } catch (err) { - if (err.code === "ENOTDIR") return null; - return []; - } - } - /** - * Return a flast list of all the files nested inside a directory - * - * Based on an elegant concurrent recursive solution from SO - * https://stackoverflow.com/a/45130990/2168416 - */ - async readdirDeep(dir) { - const subdirs = await this._readdir(dir); - const files = await Promise.all( - subdirs.map(async (subdir) => { - const res = dir + "/" + subdir; - return (await this._stat(res)).isDirectory() ? this.readdirDeep(res) : res; - }) - ); - return files.reduce((a, f) => a.concat(f), []); - } - /** - * Return the Stats of a file/symlink if it exists, otherwise returns null. - * Rethrows errors that aren't related to file existence. - */ - async lstat(filename) { - try { - const stats = await this._lstat(filename); - return stats; - } catch (err) { - if (err.code === "ENOENT") { - return null; - } - throw err; - } - } - /** - * Reads the contents of a symlink if it exists, otherwise returns null. - * Rethrows errors that aren't related to file existence. - */ - async readlink(filename, opts = { encoding: "buffer" }) { - try { - const link = await this._readlink(filename, opts); - return Buffer.isBuffer(link) ? link : Buffer.from(link); - } catch (err) { - if (err.code === "ENOENT") { - return null; - } - throw err; - } - } - /** - * Write the contents of buffer to a symlink. - */ - async writelink(filename, buffer2) { - return this._symlink(buffer2.toString("utf8"), filename); - } -}; -function assertParameter(name, value) { - if (value === void 0) { - throw new MissingParameterError(name); - } -} -async function modified(entry, base) { - if (!entry && !base) return false; - if (entry && !base) return true; - if (!entry && base) return true; - if (await entry.type() === "tree" && await base.type() === "tree") { - return false; - } - if (await entry.type() === await base.type() && await entry.mode() === await base.mode() && await entry.oid() === await base.oid()) { - return false; - } - return true; -} -async function abortMerge({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - commit: commit2 = "HEAD", - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("dir", dir); - assertParameter("gitdir", gitdir); - const fs = new FileSystem(_fs); - const trees = [TREE({ ref: commit2 }), WORKDIR(), STAGE()]; - let unmergedPaths = []; - await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - unmergedPaths = index2.unmergedPaths; - }); - const results = await _walk({ - fs, - cache, - dir, - gitdir, - trees, - map: async function(path2, [head, workdir, index2]) { - const staged = !await modified(workdir, index2); - const unmerged = unmergedPaths.includes(path2); - const unmodified = !await modified(index2, head); - if (staged || unmerged) { - return head ? { - path: path2, - mode: await head.mode(), - oid: await head.oid(), - type: await head.type(), - content: await head.content() - } : void 0; - } - if (unmodified) return false; - else throw new IndexResetError(path2); - } - }); - await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - for (const entry of results) { - if (entry === false) continue; - if (!entry) { - await fs.rmdir(`${dir}/${entry.path}`, { recursive: true }); - index2.delete({ filepath: entry.path }); - continue; - } - if (entry.type === "blob") { - const content = new TextDecoder().decode(entry.content); - await fs.write(`${dir}/${entry.path}`, content, { mode: entry.mode }); - index2.insert({ - filepath: entry.path, - oid: entry.oid, - stage: 0 - }); - } - } - }); - } catch (err) { - err.caller = "git.abortMerge"; - throw err; - } -} -var GitIgnoreManager = class { - static async isIgnored({ fs, dir, gitdir = join(dir, ".git"), filepath }) { - if (basename(filepath) === ".git") return true; - if (filepath === ".") return false; - let excludes = ""; - const excludesFile = join(gitdir, "info", "exclude"); - if (await fs.exists(excludesFile)) { - excludes = await fs.read(excludesFile, "utf8"); - } - const pairs = [ - { - gitignore: join(dir, ".gitignore"), - filepath - } - ]; - const pieces = filepath.split("/").filter(Boolean); - for (let i = 1; i < pieces.length; i++) { - const folder = pieces.slice(0, i).join("/"); - const file = pieces.slice(i).join("/"); - pairs.push({ - gitignore: join(dir, folder, ".gitignore"), - filepath: file - }); - } - let ignoredStatus = false; - for (const p of pairs) { - let file; - try { - file = await fs.read(p.gitignore, "utf8"); - } catch (err) { - if (err.code === "NOENT") continue; - } - const ign = (0, import_ignore.default)().add(excludes); - ign.add(file); - const parentdir = dirname(p.filepath); - if (parentdir !== "." && ign.ignores(parentdir)) return true; - if (ignoredStatus) { - ignoredStatus = !ign.test(p.filepath).unignored; - } else { - ignoredStatus = ign.test(p.filepath).ignored; - } - } - return ignoredStatus; - } -}; -async function writeObjectLoose({ fs, gitdir, object, format, oid }) { - if (format !== "deflated") { - throw new InternalError( - "GitObjectStoreLoose expects objects to write to be in deflated format" - ); - } - const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`; - const filepath = `${gitdir}/${source}`; - if (!await fs.exists(filepath)) await fs.write(filepath, object); -} -var supportsCompressionStream = null; -async function deflate(buffer2) { - if (supportsCompressionStream === null) { - supportsCompressionStream = testCompressionStream(); - } - return supportsCompressionStream ? browserDeflate(buffer2) : import_pako.default.deflate(buffer2); -} -async function browserDeflate(buffer2) { - const cs = new CompressionStream("deflate"); - const c = new Blob([buffer2]).stream().pipeThrough(cs); - return new Uint8Array(await new Response(c).arrayBuffer()); -} -function testCompressionStream() { - try { - const cs = new CompressionStream("deflate"); - cs.writable.close(); - const stream = new Blob([]).stream(); - stream.cancel(); - return true; - } catch (_) { - return false; - } -} -async function _writeObject({ - fs, - gitdir, - type, - object, - format = "content", - oid = void 0, - dryRun = false -}) { - if (format !== "deflated") { - if (format !== "wrapped") { - object = GitObject.wrap({ type, object }); - } - oid = await shasum(object); - object = Buffer.from(await deflate(object)); - } - if (!dryRun) { - await writeObjectLoose({ fs, gitdir, object, format: "deflated", oid }); - } - return oid; -} -function posixifyPathBuffer(buffer2) { - let idx; - while (~(idx = buffer2.indexOf(92))) buffer2[idx] = 47; - return buffer2; -} -async function add({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - filepath, - cache = {}, - force = false, - parallel = true -}) { - try { - assertParameter("fs", _fs); - assertParameter("dir", dir); - assertParameter("gitdir", gitdir); - assertParameter("filepath", filepath); - const fs = new FileSystem(_fs); - await GitIndexManager.acquire({ fs, gitdir, cache }, async (index2) => { - return addToIndex({ - dir, - gitdir, - fs, - filepath, - index: index2, - force, - parallel - }); - }); - } catch (err) { - err.caller = "git.add"; - throw err; - } -} -async function addToIndex({ - dir, - gitdir, - fs, - filepath, - index: index2, - force, - parallel -}) { - filepath = Array.isArray(filepath) ? filepath : [filepath]; - const promises = filepath.map(async (currentFilepath) => { - if (!force) { - const ignored = await GitIgnoreManager.isIgnored({ - fs, - dir, - gitdir, - filepath: currentFilepath - }); - if (ignored) return; - } - const stats = await fs.lstat(join(dir, currentFilepath)); - if (!stats) throw new NotFoundError(currentFilepath); - if (stats.isDirectory()) { - const children2 = await fs.readdir(join(dir, currentFilepath)); - if (parallel) { - const promises2 = children2.map( - (child) => addToIndex({ - dir, - gitdir, - fs, - filepath: [join(currentFilepath, child)], - index: index2, - force, - parallel - }) - ); - await Promise.all(promises2); - } else { - for (const child of children2) { - await addToIndex({ - dir, - gitdir, - fs, - filepath: [join(currentFilepath, child)], - index: index2, - force, - parallel - }); - } - } - } else { - const config = await GitConfigManager.get({ fs, gitdir }); - const autocrlf = await config.get("core.autocrlf"); - const object = stats.isSymbolicLink() ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer) : await fs.read(join(dir, currentFilepath), { autocrlf }); - if (object === null) throw new NotFoundError(currentFilepath); - const oid = await _writeObject({ fs, gitdir, type: "blob", object }); - index2.insert({ filepath: currentFilepath, stats, oid }); - } - }); - const settledPromises = await Promise.allSettled(promises); - const rejectedPromises = settledPromises.filter((settle) => settle.status === "rejected").map((settle) => settle.reason); - if (rejectedPromises.length > 1) { - throw new MultipleGitError(rejectedPromises); - } - if (rejectedPromises.length === 1) { - throw rejectedPromises[0]; - } - const fulfilledPromises = settledPromises.filter((settle) => settle.status === "fulfilled" && settle.value).map((settle) => settle.value); - return fulfilledPromises; -} -async function _getConfig({ fs, gitdir, path: path2 }) { - const config = await GitConfigManager.get({ fs, gitdir }); - return config.get(path2); -} -function assignDefined(target, ...sources) { - for (const source of sources) { - if (source) { - for (const key2 of Object.keys(source)) { - const val = source[key2]; - if (val !== void 0) { - target[key2] = val; - } - } - } - } - return target; -} -async function normalizeAuthorObject({ fs, gitdir, author, commit: commit2 }) { - const timestamp = Math.floor(Date.now() / 1e3); - const defaultAuthor = { - name: await _getConfig({ fs, gitdir, path: "user.name" }), - email: await _getConfig({ fs, gitdir, path: "user.email" }) || "", - // author.email is allowed to be empty string - timestamp, - timezoneOffset: new Date(timestamp * 1e3).getTimezoneOffset() - }; - const normalizedAuthor = assignDefined( - {}, - defaultAuthor, - commit2 ? commit2.author : void 0, - author - ); - if (normalizedAuthor.name === void 0) { - return void 0; - } - return normalizedAuthor; -} -async function normalizeCommitterObject({ - fs, - gitdir, - author, - committer, - commit: commit2 -}) { - const timestamp = Math.floor(Date.now() / 1e3); - const defaultCommitter = { - name: await _getConfig({ fs, gitdir, path: "user.name" }), - email: await _getConfig({ fs, gitdir, path: "user.email" }) || "", - // committer.email is allowed to be empty string - timestamp, - timezoneOffset: new Date(timestamp * 1e3).getTimezoneOffset() - }; - const normalizedCommitter = assignDefined( - {}, - defaultCommitter, - commit2 ? commit2.committer : void 0, - author, - committer - ); - if (normalizedCommitter.name === void 0) { - return void 0; - } - return normalizedCommitter; -} -async function resolveCommit({ fs, cache, gitdir, oid }) { - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - if (type === "tag") { - oid = GitAnnotatedTag.from(object).parse().object; - return resolveCommit({ fs, cache, gitdir, oid }); - } - if (type !== "commit") { - throw new ObjectTypeError(oid, type, "commit"); - } - return { commit: GitCommit.from(object), oid }; -} -async function _readCommit({ fs, cache, gitdir, oid }) { - const { commit: commit2, oid: commitOid } = await resolveCommit({ - fs, - cache, - gitdir, - oid - }); - const result = { - oid: commitOid, - commit: commit2.parse(), - payload: commit2.withoutSignature() - }; - return result; -} -async function _commit({ - fs, - cache, - onSign, - gitdir, - message, - author: _author, - committer: _committer, - signingKey, - amend = false, - dryRun = false, - noUpdateBranch = false, - ref, - parent, - tree -}) { - let initialCommit = false; - if (!ref) { - ref = await GitRefManager.resolve({ - fs, - gitdir, - ref: "HEAD", - depth: 2 - }); - } - let refOid, refCommit; - try { - refOid = await GitRefManager.resolve({ - fs, - gitdir, - ref - }); - refCommit = await _readCommit({ fs, gitdir, oid: refOid, cache: {} }); - } catch (e) { - initialCommit = true; - } - if (amend && initialCommit) { - throw new NoCommitError(ref); - } - const author = !amend ? await normalizeAuthorObject({ fs, gitdir, author: _author }) : await normalizeAuthorObject({ - fs, - gitdir, - author: _author, - commit: refCommit.commit - }); - if (!author) throw new MissingNameError("author"); - const committer = !amend ? await normalizeCommitterObject({ - fs, - gitdir, - author, - committer: _committer - }) : await normalizeCommitterObject({ - fs, - gitdir, - author, - committer: _committer, - commit: refCommit.commit - }); - if (!committer) throw new MissingNameError("committer"); - return GitIndexManager.acquire( - { fs, gitdir, cache, allowUnmerged: false }, - async function(index2) { - const inodes = flatFileListToDirectoryStructure(index2.entries); - const inode = inodes.get("."); - if (!tree) { - tree = await constructTree({ fs, gitdir, inode, dryRun }); - } - if (!parent) { - if (!amend) { - parent = refOid ? [refOid] : []; - } else { - parent = refCommit.commit.parent; - } - } else { - parent = await Promise.all( - parent.map((p) => { - return GitRefManager.resolve({ fs, gitdir, ref: p }); - }) - ); - } - if (!message) { - if (!amend) { - throw new MissingParameterError("message"); - } else { - message = refCommit.commit.message; - } - } - let comm = GitCommit.from({ - tree, - parent, - author, - committer, - message - }); - if (signingKey) { - comm = await GitCommit.sign(comm, onSign, signingKey); - } - const oid = await _writeObject({ - fs, - gitdir, - type: "commit", - object: comm.toObject(), - dryRun - }); - if (!noUpdateBranch && !dryRun) { - await GitRefManager.writeRef({ - fs, - gitdir, - ref, - value: oid - }); - } - return oid; - } - ); -} -async function constructTree({ fs, gitdir, inode, dryRun }) { - const children2 = inode.children; - for (const inode2 of children2) { - if (inode2.type === "tree") { - inode2.metadata.mode = "040000"; - inode2.metadata.oid = await constructTree({ fs, gitdir, inode: inode2, dryRun }); - } - } - const entries = children2.map((inode2) => ({ - mode: inode2.metadata.mode, - path: inode2.basename, - oid: inode2.metadata.oid, - type: inode2.type - })); - const tree = GitTree.from(entries); - const oid = await _writeObject({ - fs, - gitdir, - type: "tree", - object: tree.toObject(), - dryRun - }); - return oid; -} -async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) { - if (filepath.startsWith("/")) { - throw new InvalidFilepathError("leading-slash"); - } else if (filepath.endsWith("/")) { - throw new InvalidFilepathError("trailing-slash"); - } - const _oid = oid; - const result = await resolveTree({ fs, cache, gitdir, oid }); - const tree = result.tree; - if (filepath === "") { - oid = result.oid; - } else { - const pathArray = filepath.split("/"); - oid = await _resolveFilepath({ - fs, - cache, - gitdir, - tree, - pathArray, - oid: _oid, - filepath - }); - } - return oid; -} -async function _resolveFilepath({ - fs, - cache, - gitdir, - tree, - pathArray, - oid, - filepath -}) { - const name = pathArray.shift(); - for (const entry of tree) { - if (entry.path === name) { - if (pathArray.length === 0) { - return entry.oid; - } else { - const { type, object } = await _readObject({ - fs, - cache, - gitdir, - oid: entry.oid - }); - if (type !== "tree") { - throw new ObjectTypeError(oid, type, "tree", filepath); - } - tree = GitTree.from(object); - return _resolveFilepath({ - fs, - cache, - gitdir, - tree, - pathArray, - oid, - filepath - }); - } - } - } - throw new NotFoundError(`file or directory found at "${oid}:${filepath}"`); -} -async function _readTree({ - fs, - cache, - gitdir, - oid, - filepath = void 0 -}) { - if (filepath !== void 0) { - oid = await resolveFilepath({ fs, cache, gitdir, oid, filepath }); - } - const { tree, oid: treeOid } = await resolveTree({ fs, cache, gitdir, oid }); - const result = { - oid: treeOid, - tree: tree.entries() - }; - return result; -} -async function _writeTree({ fs, gitdir, tree }) { - const object = GitTree.from(tree).toObject(); - const oid = await _writeObject({ - fs, - gitdir, - type: "tree", - object, - format: "content" - }); - return oid; -} -async function _addNote({ - fs, - cache, - onSign, - gitdir, - ref, - oid, - note, - force, - author, - committer, - signingKey -}) { - let parent; - try { - parent = await GitRefManager.resolve({ gitdir, fs, ref }); - } catch (err) { - if (!(err instanceof NotFoundError)) { - throw err; - } - } - const result = await _readTree({ - fs, - cache, - gitdir, - oid: parent || "4b825dc642cb6eb9a060e54bf8d69288fbee4904" - }); - let tree = result.tree; - if (force) { - tree = tree.filter((entry) => entry.path !== oid); - } else { - for (const entry of tree) { - if (entry.path === oid) { - throw new AlreadyExistsError("note", oid); - } - } - } - if (typeof note === "string") { - note = Buffer.from(note, "utf8"); - } - const noteOid = await _writeObject({ - fs, - gitdir, - type: "blob", - object: note, - format: "content" - }); - tree.push({ mode: "100644", path: oid, oid: noteOid, type: "blob" }); - const treeOid = await _writeTree({ - fs, - gitdir, - tree - }); - const commitOid = await _commit({ - fs, - cache, - onSign, - gitdir, - ref, - tree: treeOid, - parent: parent && [parent], - message: `Note added by 'isomorphic-git addNote' -`, - author, - committer, - signingKey - }); - return commitOid; -} -async function addNote({ - fs: _fs, - onSign, - dir, - gitdir = join(dir, ".git"), - ref = "refs/notes/commits", - oid, - note, - force, - author: _author, - committer: _committer, - signingKey, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - assertParameter("note", note); - if (signingKey) { - assertParameter("onSign", onSign); - } - const fs = new FileSystem(_fs); - const author = await normalizeAuthorObject({ fs, gitdir, author: _author }); - if (!author) throw new MissingNameError("author"); - const committer = await normalizeCommitterObject({ - fs, - gitdir, - author, - committer: _committer - }); - if (!committer) throw new MissingNameError("committer"); - return await _addNote({ - fs: new FileSystem(fs), - cache, - onSign, - gitdir, - ref, - oid, - note, - force, - author, - committer, - signingKey - }); - } catch (err) { - err.caller = "git.addNote"; - throw err; - } -} -async function _addRemote({ fs, gitdir, remote, url, force }) { - if (remote !== import_clean_git_ref.default.clean(remote)) { - throw new InvalidRefNameError(remote, import_clean_git_ref.default.clean(remote)); - } - const config = await GitConfigManager.get({ fs, gitdir }); - if (!force) { - const remoteNames = await config.getSubsections("remote"); - if (remoteNames.includes(remote)) { - if (url !== await config.get(`remote.${remote}.url`)) { - throw new AlreadyExistsError("remote", remote); - } - } - } - await config.set(`remote.${remote}.url`, url); - await config.set( - `remote.${remote}.fetch`, - `+refs/heads/*:refs/remotes/${remote}/*` - ); - await GitConfigManager.save({ fs, gitdir, config }); -} -async function addRemote({ - fs, - dir, - gitdir = join(dir, ".git"), - remote, - url, - force = false -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("remote", remote); - assertParameter("url", url); - return await _addRemote({ - fs: new FileSystem(fs), - gitdir, - remote, - url, - force - }); - } catch (err) { - err.caller = "git.addRemote"; - throw err; - } -} -async function _annotatedTag({ - fs, - cache, - onSign, - gitdir, - ref, - tagger, - message = ref, - gpgsig, - object, - signingKey, - force = false -}) { - ref = ref.startsWith("refs/tags/") ? ref : `refs/tags/${ref}`; - if (!force && await GitRefManager.exists({ fs, gitdir, ref })) { - throw new AlreadyExistsError("tag", ref); - } - const oid = await GitRefManager.resolve({ - fs, - gitdir, - ref: object || "HEAD" - }); - const { type } = await _readObject({ fs, cache, gitdir, oid }); - let tagObject = GitAnnotatedTag.from({ - object: oid, - type, - tag: ref.replace("refs/tags/", ""), - tagger, - message, - gpgsig - }); - if (signingKey) { - tagObject = await GitAnnotatedTag.sign(tagObject, onSign, signingKey); - } - const value = await _writeObject({ - fs, - gitdir, - type: "tag", - object: tagObject.toObject() - }); - await GitRefManager.writeRef({ fs, gitdir, ref, value }); -} -async function annotatedTag({ - fs: _fs, - onSign, - dir, - gitdir = join(dir, ".git"), - ref, - tagger: _tagger, - message = ref, - gpgsig, - object, - signingKey, - force = false, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - if (signingKey) { - assertParameter("onSign", onSign); - } - const fs = new FileSystem(_fs); - const tagger = await normalizeAuthorObject({ fs, gitdir, author: _tagger }); - if (!tagger) throw new MissingNameError("tagger"); - return await _annotatedTag({ - fs, - cache, - onSign, - gitdir, - ref, - tagger, - message, - gpgsig, - object, - signingKey, - force - }); - } catch (err) { - err.caller = "git.annotatedTag"; - throw err; - } -} -async function _branch({ - fs, - gitdir, - ref, - object, - checkout: checkout2 = false, - force = false -}) { - if (ref !== import_clean_git_ref.default.clean(ref)) { - throw new InvalidRefNameError(ref, import_clean_git_ref.default.clean(ref)); - } - const fullref = `refs/heads/${ref}`; - if (!force) { - const exist = await GitRefManager.exists({ fs, gitdir, ref: fullref }); - if (exist) { - throw new AlreadyExistsError("branch", ref, false); - } - } - let oid; - try { - oid = await GitRefManager.resolve({ fs, gitdir, ref: object || "HEAD" }); - } catch (e) { - } - if (oid) { - await GitRefManager.writeRef({ fs, gitdir, ref: fullref, value: oid }); - } - if (checkout2) { - await GitRefManager.writeSymbolicRef({ - fs, - gitdir, - ref: "HEAD", - value: fullref - }); - } -} -async function branch({ - fs, - dir, - gitdir = join(dir, ".git"), - ref, - object, - checkout: checkout2 = false, - force = false -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - return await _branch({ - fs: new FileSystem(fs), - gitdir, - ref, - object, - checkout: checkout2, - force - }); - } catch (err) { - err.caller = "git.branch"; - throw err; - } -} -var worthWalking = (filepath, root2) => { - if (filepath === "." || root2 == null || root2.length === 0 || root2 === ".") { - return true; - } - if (root2.length >= filepath.length) { - return root2.startsWith(filepath); - } else { - return filepath.startsWith(root2); - } -}; -async function _checkout({ - fs, - cache, - onProgress, - onPostCheckout, - dir, - gitdir, - remote, - ref, - filepaths, - noCheckout, - noUpdateHead, - dryRun, - force, - track = true -}) { - let oldOid; - if (onPostCheckout) { - try { - oldOid = await GitRefManager.resolve({ fs, gitdir, ref: "HEAD" }); - } catch (err) { - oldOid = "0000000000000000000000000000000000000000"; - } - } - let oid; - try { - oid = await GitRefManager.resolve({ fs, gitdir, ref }); - } catch (err) { - if (ref === "HEAD") throw err; - const remoteRef = `${remote}/${ref}`; - oid = await GitRefManager.resolve({ - fs, - gitdir, - ref: remoteRef - }); - if (track) { - const config = await GitConfigManager.get({ fs, gitdir }); - await config.set(`branch.${ref}.remote`, remote); - await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`); - await GitConfigManager.save({ fs, gitdir, config }); - } - await GitRefManager.writeRef({ - fs, - gitdir, - ref: `refs/heads/${ref}`, - value: oid - }); - } - if (!noCheckout) { - let ops; - try { - ops = await analyze({ - fs, - cache, - onProgress, - dir, - gitdir, - ref, - force, - filepaths - }); - } catch (err) { - if (err instanceof NotFoundError && err.data.what === oid) { - throw new CommitNotFetchedError(ref, oid); - } else { - throw err; - } - } - const conflicts2 = ops.filter(([method2]) => method2 === "conflict").map(([method2, fullpath]) => fullpath); - if (conflicts2.length > 0) { - throw new CheckoutConflictError(conflicts2); - } - const errors = ops.filter(([method2]) => method2 === "error").map(([method2, fullpath]) => fullpath); - if (errors.length > 0) { - throw new InternalError(errors.join(", ")); - } - if (dryRun) { - if (onPostCheckout) { - await onPostCheckout({ - previousHead: oldOid, - newHead: oid, - type: filepaths != null && filepaths.length > 0 ? "file" : "branch" - }); - } - return; - } - let count = 0; - const total = ops.length; - await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - await Promise.all( - ops.filter( - ([method2]) => method2 === "delete" || method2 === "delete-index" - ).map(async function([method2, fullpath]) { - const filepath = `${dir}/${fullpath}`; - if (method2 === "delete") { - await fs.rm(filepath); - } - index2.delete({ filepath: fullpath }); - if (onProgress) { - await onProgress({ - phase: "Updating workdir", - loaded: ++count, - total - }); - } - }) - ); - }); - await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - for (const [method2, fullpath] of ops) { - if (method2 === "rmdir" || method2 === "rmdir-index") { - const filepath = `${dir}/${fullpath}`; - try { - if (method2 === "rmdir-index") { - index2.delete({ filepath: fullpath }); - } - await fs.rmdir(filepath); - if (onProgress) { - await onProgress({ - phase: "Updating workdir", - loaded: ++count, - total - }); - } - } catch (e) { - if (e.code === "ENOTEMPTY") { - console.log( - `Did not delete ${fullpath} because directory is not empty` - ); - } else { - throw e; - } - } - } - } - }); - await Promise.all( - ops.filter(([method2]) => method2 === "mkdir" || method2 === "mkdir-index").map(async function([_, fullpath]) { - const filepath = `${dir}/${fullpath}`; - await fs.mkdir(filepath); - if (onProgress) { - await onProgress({ - phase: "Updating workdir", - loaded: ++count, - total - }); - } - }) - ); - await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - await Promise.all( - ops.filter( - ([method2]) => method2 === "create" || method2 === "create-index" || method2 === "update" || method2 === "mkdir-index" - ).map(async function([method2, fullpath, oid2, mode, chmod]) { - const filepath = `${dir}/${fullpath}`; - try { - if (method2 !== "create-index" && method2 !== "mkdir-index") { - const { object } = await _readObject({ fs, cache, gitdir, oid: oid2 }); - if (chmod) { - await fs.rm(filepath); - } - if (mode === 33188) { - await fs.write(filepath, object); - } else if (mode === 33261) { - await fs.write(filepath, object, { mode: 511 }); - } else if (mode === 40960) { - await fs.writelink(filepath, object); - } else { - throw new InternalError( - `Invalid mode 0o${mode.toString(8)} detected in blob ${oid2}` - ); - } - } - const stats = await fs.lstat(filepath); - if (mode === 33261) { - stats.mode = 493; - } - if (method2 === "mkdir-index") { - stats.mode = 57344; - } - index2.insert({ - filepath: fullpath, - stats, - oid: oid2 - }); - if (onProgress) { - await onProgress({ - phase: "Updating workdir", - loaded: ++count, - total - }); - } - } catch (e) { - console.log(e); - } - }) - ); - }); - if (onPostCheckout) { - await onPostCheckout({ - previousHead: oldOid, - newHead: oid, - type: filepaths != null && filepaths.length > 0 ? "file" : "branch" - }); - } - } - if (!noUpdateHead) { - const fullRef = await GitRefManager.expand({ fs, gitdir, ref }); - if (fullRef.startsWith("refs/heads")) { - await GitRefManager.writeSymbolicRef({ - fs, - gitdir, - ref: "HEAD", - value: fullRef - }); - } else { - await GitRefManager.writeRef({ fs, gitdir, ref: "HEAD", value: oid }); - } - } -} -async function analyze({ - fs, - cache, - onProgress, - dir, - gitdir, - ref, - force, - filepaths -}) { - let count = 0; - return _walk({ - fs, - cache, - dir, - gitdir, - trees: [TREE({ ref }), WORKDIR(), STAGE()], - map: async function(fullpath, [commit2, workdir, stage]) { - if (fullpath === ".") return; - if (filepaths && !filepaths.some((base) => worthWalking(fullpath, base))) { - return null; - } - if (onProgress) { - await onProgress({ phase: "Analyzing workdir", loaded: ++count }); - } - const key2 = [!!stage, !!commit2, !!workdir].map(Number).join(""); - switch (key2) { - case "000": - return; - case "001": - if (force && filepaths && filepaths.includes(fullpath)) { - return ["delete", fullpath]; - } - return; - case "010": { - switch (await commit2.type()) { - case "tree": { - return ["mkdir", fullpath]; - } - case "blob": { - return [ - "create", - fullpath, - await commit2.oid(), - await commit2.mode() - ]; - } - case "commit": { - return [ - "mkdir-index", - fullpath, - await commit2.oid(), - await commit2.mode() - ]; - } - default: { - return [ - "error", - `new entry Unhandled type ${await commit2.type()}` - ]; - } - } - } - case "011": { - switch (`${await commit2.type()}-${await workdir.type()}`) { - case "tree-tree": { - return; - } - case "tree-blob": - case "blob-tree": { - return ["conflict", fullpath]; - } - case "blob-blob": { - if (await commit2.oid() !== await workdir.oid()) { - if (force) { - return [ - "update", - fullpath, - await commit2.oid(), - await commit2.mode(), - await commit2.mode() !== await workdir.mode() - ]; - } else { - return ["conflict", fullpath]; - } - } else { - if (await commit2.mode() !== await workdir.mode()) { - if (force) { - return [ - "update", - fullpath, - await commit2.oid(), - await commit2.mode(), - true - ]; - } else { - return ["conflict", fullpath]; - } - } else { - return [ - "create-index", - fullpath, - await commit2.oid(), - await commit2.mode() - ]; - } - } - } - case "commit-tree": { - return; - } - case "commit-blob": { - return ["conflict", fullpath]; - } - default: { - return ["error", `new entry Unhandled type ${commit2.type}`]; - } - } - } - case "100": { - return ["delete-index", fullpath]; - } - case "101": { - switch (await stage.type()) { - case "tree": { - return ["rmdir", fullpath]; - } - case "blob": { - if (await stage.oid() !== await workdir.oid()) { - if (force) { - return ["delete", fullpath]; - } else { - return ["conflict", fullpath]; - } - } else { - return ["delete", fullpath]; - } - } - case "commit": { - return ["rmdir-index", fullpath]; - } - default: { - return [ - "error", - `delete entry Unhandled type ${await stage.type()}` - ]; - } - } - } - case "110": - case "111": { - switch (`${await stage.type()}-${await commit2.type()}`) { - case "tree-tree": { - return; - } - case "blob-blob": { - if (await stage.oid() === await commit2.oid() && await stage.mode() === await commit2.mode() && !force) { - return; - } - if (workdir) { - if (await workdir.oid() !== await stage.oid() && await workdir.oid() !== await commit2.oid()) { - if (force) { - return [ - "update", - fullpath, - await commit2.oid(), - await commit2.mode(), - await commit2.mode() !== await workdir.mode() - ]; - } else { - return ["conflict", fullpath]; - } - } - } else if (force) { - return [ - "update", - fullpath, - await commit2.oid(), - await commit2.mode(), - await commit2.mode() !== await stage.mode() - ]; - } - if (await commit2.mode() !== await stage.mode()) { - return [ - "update", - fullpath, - await commit2.oid(), - await commit2.mode(), - true - ]; - } - if (await commit2.oid() !== await stage.oid()) { - return [ - "update", - fullpath, - await commit2.oid(), - await commit2.mode(), - false - ]; - } else { - return; - } - } - case "tree-blob": { - return ["update-dir-to-blob", fullpath, await commit2.oid()]; - } - case "blob-tree": { - return ["update-blob-to-tree", fullpath]; - } - case "commit-commit": { - return [ - "mkdir-index", - fullpath, - await commit2.oid(), - await commit2.mode() - ]; - } - default: { - return [ - "error", - `update entry Unhandled type ${await stage.type()}-${await commit2.type()}` - ]; - } - } - } - } - }, - // Modify the default flat mapping - reduce: async function(parent, children2) { - children2 = flat(children2); - if (!parent) { - return children2; - } else if (parent && parent[0] === "rmdir") { - children2.push(parent); - return children2; - } else { - children2.unshift(parent); - return children2; - } - } - }); -} -async function checkout({ - fs, - onProgress, - onPostCheckout, - dir, - gitdir = join(dir, ".git"), - remote = "origin", - ref: _ref, - filepaths, - noCheckout = false, - noUpdateHead = _ref === void 0, - dryRun = false, - force = false, - track = true, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("dir", dir); - assertParameter("gitdir", gitdir); - const ref = _ref || "HEAD"; - return await _checkout({ - fs: new FileSystem(fs), - cache, - onProgress, - onPostCheckout, - dir, - gitdir, - remote, - ref, - filepaths, - noCheckout, - noUpdateHead, - dryRun, - force, - track - }); - } catch (err) { - err.caller = "git.checkout"; - throw err; - } -} -var abbreviateRx = new RegExp("^refs/(heads/|tags/|remotes/)?(.*)"); -function abbreviateRef(ref) { - const match = abbreviateRx.exec(ref); - if (match) { - if (match[1] === "remotes/" && ref.endsWith("/HEAD")) { - return match[2].slice(0, -5); - } else { - return match[2]; - } - } - return ref; -} -async function _currentBranch({ - fs, - gitdir, - fullname = false, - test = false -}) { - const ref = await GitRefManager.resolve({ - fs, - gitdir, - ref: "HEAD", - depth: 2 - }); - if (test) { - try { - await GitRefManager.resolve({ fs, gitdir, ref }); - } catch (_) { - return; - } - } - if (!ref.startsWith("refs/")) return; - return fullname ? ref : abbreviateRef(ref); -} -function translateSSHtoHTTP(url) { - url = url.replace(/^git@([^:]+):/, "https://$1/"); - url = url.replace(/^ssh:\/\//, "https://"); - return url; -} -function calculateBasicAuthHeader({ username = "", password = "" }) { - return `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`; -} -async function forAwait(iterable, cb) { - const iter = getIterator(iterable); - while (true) { - const { value, done } = await iter.next(); - if (value) await cb(value); - if (done) break; - } - if (iter.return) iter.return(); -} -async function collect(iterable) { - let size = 0; - const buffers = []; - await forAwait(iterable, (value) => { - buffers.push(value); - size += value.byteLength; - }); - const result = new Uint8Array(size); - let nextIndex = 0; - for (const buffer2 of buffers) { - result.set(buffer2, nextIndex); - nextIndex += buffer2.byteLength; - } - return result; -} -function extractAuthFromUrl(url) { - let userpass = url.match(/^https?:\/\/([^/]+)@/); - if (userpass == null) return { url, auth: {} }; - userpass = userpass[1]; - const [username, password] = userpass.split(":"); - url = url.replace(`${userpass}@`, ""); - return { url, auth: { username, password } }; -} -function padHex(b, n) { - const s = n.toString(16); - return "0".repeat(b - s.length) + s; -} -var GitPktLine = class { - static flush() { - return Buffer.from("0000", "utf8"); - } - static delim() { - return Buffer.from("0001", "utf8"); - } - static encode(line) { - if (typeof line === "string") { - line = Buffer.from(line); - } - const length = line.length + 4; - const hexlength = padHex(4, length); - return Buffer.concat([Buffer.from(hexlength, "utf8"), line]); - } - static streamReader(stream) { - const reader = new StreamReader(stream); - return async function read() { - try { - let length = await reader.read(4); - if (length == null) return true; - length = parseInt(length.toString("utf8"), 16); - if (length === 0) return null; - if (length === 1) return null; - const buffer2 = await reader.read(length - 4); - if (buffer2 == null) return true; - return buffer2; - } catch (err) { - stream.error = err; - return true; - } - }; - } -}; -async function parseCapabilitiesV2(read) { - const capabilities2 = {}; - let line; - while (true) { - line = await read(); - if (line === true) break; - if (line === null) continue; - line = line.toString("utf8").replace(/\n$/, ""); - const i = line.indexOf("="); - if (i > -1) { - const key2 = line.slice(0, i); - const value = line.slice(i + 1); - capabilities2[key2] = value; - } else { - capabilities2[line] = true; - } - } - return { protocolVersion: 2, capabilities2 }; -} -async function parseRefsAdResponse(stream, { service }) { - const capabilities = /* @__PURE__ */ new Set(); - const refs = /* @__PURE__ */ new Map(); - const symrefs = /* @__PURE__ */ new Map(); - const read = GitPktLine.streamReader(stream); - let lineOne = await read(); - while (lineOne === null) lineOne = await read(); - if (lineOne === true) throw new EmptyServerResponseError(); - if (lineOne.includes("version 2")) { - return parseCapabilitiesV2(read); - } - if (lineOne.toString("utf8").replace(/\n$/, "") !== `# service=${service}`) { - throw new ParseError(`# service=${service}\\n`, lineOne.toString("utf8")); - } - let lineTwo = await read(); - while (lineTwo === null) lineTwo = await read(); - if (lineTwo === true) return { capabilities, refs, symrefs }; - lineTwo = lineTwo.toString("utf8"); - if (lineTwo.includes("version 2")) { - return parseCapabilitiesV2(read); - } - const [firstRef, capabilitiesLine] = splitAndAssert(lineTwo, "\0", "\\x00"); - capabilitiesLine.split(" ").map((x) => capabilities.add(x)); - if (firstRef !== "0000000000000000000000000000000000000000 capabilities^{}") { - const [ref, name] = splitAndAssert(firstRef, " ", " "); - refs.set(name, ref); - while (true) { - const line = await read(); - if (line === true) break; - if (line !== null) { - const [ref2, name2] = splitAndAssert(line.toString("utf8"), " ", " "); - refs.set(name2, ref2); - } - } - } - for (const cap of capabilities) { - if (cap.startsWith("symref=")) { - const m = cap.match(/symref=([^:]+):(.*)/); - if (m.length === 3) { - symrefs.set(m[1], m[2]); - } - } - } - return { protocolVersion: 1, capabilities, refs, symrefs }; -} -function splitAndAssert(line, sep2, expected) { - const split = line.trim().split(sep2); - if (split.length !== 2) { - throw new ParseError( - `Two strings separated by '${expected}'`, - line.toString("utf8") - ); - } - return split; -} -var corsProxify = (corsProxy, url) => corsProxy.endsWith("?") ? `${corsProxy}${url}` : `${corsProxy}/${url.replace(/^https?:\/\//, "")}`; -var updateHeaders = (headers, auth) => { - if (auth.username || auth.password) { - headers.Authorization = calculateBasicAuthHeader(auth); - } - if (auth.headers) { - Object.assign(headers, auth.headers); - } -}; -var stringifyBody = async (res) => { - try { - const data = Buffer.from(await collect(res.body)); - const response = data.toString("utf8"); - const preview = response.length < 256 ? response : response.slice(0, 256) + "..."; - return { preview, response, data }; - } catch (e) { - return {}; - } -}; -var GitRemoteHTTP = class { - static async capabilities() { - return ["discover", "connect"]; - } - /** - * @param {Object} args - * @param {HttpClient} args.http - * @param {ProgressCallback} [args.onProgress] - * @param {AuthCallback} [args.onAuth] - * @param {AuthFailureCallback} [args.onAuthFailure] - * @param {AuthSuccessCallback} [args.onAuthSuccess] - * @param {string} [args.corsProxy] - * @param {string} args.service - * @param {string} args.url - * @param {Object} args.headers - * @param {1 | 2} args.protocolVersion - Git Protocol Version - */ - static async discover({ - http, - onProgress, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - service, - url: _origUrl, - headers, - protocolVersion - }) { - let { url, auth } = extractAuthFromUrl(_origUrl); - const proxifiedURL = corsProxy ? corsProxify(corsProxy, url) : url; - if (auth.username || auth.password) { - headers.Authorization = calculateBasicAuthHeader(auth); - } - if (protocolVersion === 2) { - headers["Git-Protocol"] = "version=2"; - } - let res; - let tryAgain; - let providedAuthBefore = false; - do { - res = await http.request({ - onProgress, - method: "GET", - url: `${proxifiedURL}/info/refs?service=${service}`, - headers - }); - tryAgain = false; - if (res.statusCode === 401 || res.statusCode === 203) { - const getAuth = providedAuthBefore ? onAuthFailure : onAuth; - if (getAuth) { - auth = await getAuth(url, { - ...auth, - headers: { ...headers } - }); - if (auth && auth.cancel) { - throw new UserCanceledError(); - } else if (auth) { - updateHeaders(headers, auth); - providedAuthBefore = true; - tryAgain = true; - } - } - } else if (res.statusCode === 200 && providedAuthBefore && onAuthSuccess) { - await onAuthSuccess(url, auth); - } - } while (tryAgain); - if (res.statusCode !== 200) { - const { response } = await stringifyBody(res); - throw new HttpError(res.statusCode, res.statusMessage, response); - } - if (res.headers["content-type"] === `application/x-${service}-advertisement`) { - const remoteHTTP = await parseRefsAdResponse(res.body, { service }); - remoteHTTP.auth = auth; - return remoteHTTP; - } else { - const { preview, response, data } = await stringifyBody(res); - try { - const remoteHTTP = await parseRefsAdResponse([data], { service }); - remoteHTTP.auth = auth; - return remoteHTTP; - } catch (e) { - throw new SmartHttpError(preview, response); - } - } - } - /** - * @param {Object} args - * @param {HttpClient} args.http - * @param {ProgressCallback} [args.onProgress] - * @param {string} [args.corsProxy] - * @param {string} args.service - * @param {string} args.url - * @param {Object} [args.headers] - * @param {any} args.body - * @param {any} args.auth - */ - static async connect({ - http, - onProgress, - corsProxy, - service, - url, - auth, - body, - headers - }) { - const urlAuth = extractAuthFromUrl(url); - if (urlAuth) url = urlAuth.url; - if (corsProxy) url = corsProxify(corsProxy, url); - headers["content-type"] = `application/x-${service}-request`; - headers.accept = `application/x-${service}-result`; - updateHeaders(headers, auth); - const res = await http.request({ - onProgress, - method: "POST", - url: `${url}/${service}`, - body, - headers - }); - if (res.statusCode !== 200) { - const { response } = stringifyBody(res); - throw new HttpError(res.statusCode, res.statusMessage, response); - } - return res; - } -}; -function parseRemoteUrl({ url }) { - if (url.startsWith("git@")) { - return { - transport: "ssh", - address: url - }; - } - const matches = url.match(/(\w+)(:\/\/|::)(.*)/); - if (matches === null) return; - if (matches[2] === "://") { - return { - transport: matches[1], - address: matches[0] - }; - } - if (matches[2] === "::") { - return { - transport: matches[1], - address: matches[3] - }; - } -} -var GitRemoteManager = class { - static getRemoteHelperFor({ url }) { - const remoteHelpers = /* @__PURE__ */ new Map(); - remoteHelpers.set("http", GitRemoteHTTP); - remoteHelpers.set("https", GitRemoteHTTP); - const parts = parseRemoteUrl({ url }); - if (!parts) { - throw new UrlParseError(url); - } - if (remoteHelpers.has(parts.transport)) { - return remoteHelpers.get(parts.transport); - } - throw new UnknownTransportError( - url, - parts.transport, - parts.transport === "ssh" ? translateSSHtoHTTP(url) : void 0 - ); - } -}; -var lock$2 = null; -var GitShallowManager = class { - static async read({ fs, gitdir }) { - if (lock$2 === null) lock$2 = new import_async_lock.default(); - const filepath = join(gitdir, "shallow"); - const oids = /* @__PURE__ */ new Set(); - await lock$2.acquire(filepath, async function() { - const text2 = await fs.read(filepath, { encoding: "utf8" }); - if (text2 === null) return oids; - if (text2.trim() === "") return oids; - text2.trim().split("\n").map((oid) => oids.add(oid)); - }); - return oids; - } - static async write({ fs, gitdir, oids }) { - if (lock$2 === null) lock$2 = new import_async_lock.default(); - const filepath = join(gitdir, "shallow"); - if (oids.size > 0) { - const text2 = [...oids].join("\n") + "\n"; - await lock$2.acquire(filepath, async function() { - await fs.write(filepath, text2, { - encoding: "utf8" - }); - }); - } else { - await lock$2.acquire(filepath, async function() { - await fs.rm(filepath); - }); - } - } -}; -async function hasObjectLoose({ fs, gitdir, oid }) { - const source = `objects/${oid.slice(0, 2)}/${oid.slice(2)}`; - return fs.exists(`${gitdir}/${source}`); -} -async function hasObjectPacked({ - fs, - cache, - gitdir, - oid, - getExternalRefDelta -}) { - let list = await fs.readdir(join(gitdir, "objects/pack")); - list = list.filter((x) => x.endsWith(".idx")); - for (const filename of list) { - const indexFile = `${gitdir}/objects/pack/${filename}`; - const p = await readPackIndex({ - fs, - cache, - filename: indexFile, - getExternalRefDelta - }); - if (p.error) throw new InternalError(p.error); - if (p.offsets.has(oid)) { - return true; - } - } - return false; -} -async function hasObject({ - fs, - cache, - gitdir, - oid, - format = "content" -}) { - const getExternalRefDelta = (oid2) => _readObject({ fs, cache, gitdir, oid: oid2 }); - let result = await hasObjectLoose({ fs, gitdir, oid }); - if (!result) { - result = await hasObjectPacked({ - fs, - cache, - gitdir, - oid, - getExternalRefDelta - }); - } - return result; -} -function emptyPackfile(pack) { - const pheader = "5041434b"; - const version2 = "00000002"; - const obCount = "00000000"; - const header = pheader + version2 + obCount; - return pack.slice(0, 12).toString("hex") === header; -} -function filterCapabilities(server, client) { - const serverNames = server.map((cap) => cap.split("=", 1)[0]); - return client.filter((cap) => { - const name = cap.split("=", 1)[0]; - return serverNames.includes(name); - }); -} -var pkg = { - name: "isomorphic-git", - version: "1.27.1", - agent: "git/isomorphic-git@1.27.1" -}; -var FIFO = class { - constructor() { - this._queue = []; - } - write(chunk) { - if (this._ended) { - throw Error("You cannot write to a FIFO that has already been ended!"); - } - if (this._waiting) { - const resolve2 = this._waiting; - this._waiting = null; - resolve2({ value: chunk }); - } else { - this._queue.push(chunk); - } - } - end() { - this._ended = true; - if (this._waiting) { - const resolve2 = this._waiting; - this._waiting = null; - resolve2({ done: true }); - } - } - destroy(err) { - this.error = err; - this.end(); - } - async next() { - if (this._queue.length > 0) { - return { value: this._queue.shift() }; - } - if (this._ended) { - return { done: true }; - } - if (this._waiting) { - throw Error( - "You cannot call read until the previous call to read has returned!" - ); - } - return new Promise((resolve2) => { - this._waiting = resolve2; - }); - } -}; -function findSplit(str) { - const r = str.indexOf("\r"); - const n = str.indexOf("\n"); - if (r === -1 && n === -1) return -1; - if (r === -1) return n + 1; - if (n === -1) return r + 1; - if (n === r + 1) return n + 1; - return Math.min(r, n) + 1; -} -function splitLines(input) { - const output = new FIFO(); - let tmp = ""; - (async () => { - await forAwait(input, (chunk) => { - chunk = chunk.toString("utf8"); - tmp += chunk; - while (true) { - const i = findSplit(tmp); - if (i === -1) break; - output.write(tmp.slice(0, i)); - tmp = tmp.slice(i); - } - }); - if (tmp.length > 0) { - output.write(tmp); - } - output.end(); - })(); - return output; -} -var GitSideBand = class { - static demux(input) { - const read = GitPktLine.streamReader(input); - const packetlines = new FIFO(); - const packfile = new FIFO(); - const progress = new FIFO(); - const nextBit = async function() { - const line = await read(); - if (line === null) return nextBit(); - if (line === true) { - packetlines.end(); - progress.end(); - input.error ? packfile.destroy(input.error) : packfile.end(); - return; - } - switch (line[0]) { - case 1: { - packfile.write(line.slice(1)); - break; - } - case 2: { - progress.write(line.slice(1)); - break; - } - case 3: { - const error = line.slice(1); - progress.write(error); - packetlines.end(); - progress.end(); - packfile.destroy(new Error(error.toString("utf8"))); - return; - } - default: { - packetlines.write(line); - } - } - nextBit(); - }; - nextBit(); - return { - packetlines, - packfile, - progress - }; - } - // static mux ({ - // protocol, // 'side-band' or 'side-band-64k' - // packetlines, - // packfile, - // progress, - // error - // }) { - // const MAX_PACKET_LENGTH = protocol === 'side-band-64k' ? 999 : 65519 - // let output = new PassThrough() - // packetlines.on('data', data => { - // if (data === null) { - // output.write(GitPktLine.flush()) - // } else { - // output.write(GitPktLine.encode(data)) - // } - // }) - // let packfileWasEmpty = true - // let packfileEnded = false - // let progressEnded = false - // let errorEnded = false - // let goodbye = Buffer.concat([ - // GitPktLine.encode(Buffer.from('010A', 'hex')), - // GitPktLine.flush() - // ]) - // packfile - // .on('data', data => { - // packfileWasEmpty = false - // const buffers = splitBuffer(data, MAX_PACKET_LENGTH) - // for (const buffer of buffers) { - // output.write( - // GitPktLine.encode(Buffer.concat([Buffer.from('01', 'hex'), buffer])) - // ) - // } - // }) - // .on('end', () => { - // packfileEnded = true - // if (!packfileWasEmpty) output.write(goodbye) - // if (progressEnded && errorEnded) output.end() - // }) - // progress - // .on('data', data => { - // const buffers = splitBuffer(data, MAX_PACKET_LENGTH) - // for (const buffer of buffers) { - // output.write( - // GitPktLine.encode(Buffer.concat([Buffer.from('02', 'hex'), buffer])) - // ) - // } - // }) - // .on('end', () => { - // progressEnded = true - // if (packfileEnded && errorEnded) output.end() - // }) - // error - // .on('data', data => { - // const buffers = splitBuffer(data, MAX_PACKET_LENGTH) - // for (const buffer of buffers) { - // output.write( - // GitPktLine.encode(Buffer.concat([Buffer.from('03', 'hex'), buffer])) - // ) - // } - // }) - // .on('end', () => { - // errorEnded = true - // if (progressEnded && packfileEnded) output.end() - // }) - // return output - // } -}; -async function parseUploadPackResponse(stream) { - const { packetlines, packfile, progress } = GitSideBand.demux(stream); - const shallows = []; - const unshallows = []; - const acks = []; - let nak = false; - let done = false; - return new Promise((resolve2, reject) => { - forAwait(packetlines, (data) => { - const line = data.toString("utf8").trim(); - if (line.startsWith("shallow")) { - const oid = line.slice(-41).trim(); - if (oid.length !== 40) { - reject(new InvalidOidError(oid)); - } - shallows.push(oid); - } else if (line.startsWith("unshallow")) { - const oid = line.slice(-41).trim(); - if (oid.length !== 40) { - reject(new InvalidOidError(oid)); - } - unshallows.push(oid); - } else if (line.startsWith("ACK")) { - const [, oid, status2] = line.split(" "); - acks.push({ oid, status: status2 }); - if (!status2) done = true; - } else if (line.startsWith("NAK")) { - nak = true; - done = true; - } else { - done = true; - nak = true; - } - if (done) { - stream.error ? reject(stream.error) : resolve2({ shallows, unshallows, acks, nak, packfile, progress }); - } - }).finally(() => { - if (!done) { - stream.error ? reject(stream.error) : resolve2({ shallows, unshallows, acks, nak, packfile, progress }); - } - }); - }); -} -function writeUploadPackRequest({ - capabilities = [], - wants = [], - haves = [], - shallows = [], - depth = null, - since = null, - exclude = [] -}) { - const packstream = []; - wants = [...new Set(wants)]; - let firstLineCapabilities = ` ${capabilities.join(" ")}`; - for (const oid of wants) { - packstream.push(GitPktLine.encode(`want ${oid}${firstLineCapabilities} -`)); - firstLineCapabilities = ""; - } - for (const oid of shallows) { - packstream.push(GitPktLine.encode(`shallow ${oid} -`)); - } - if (depth !== null) { - packstream.push(GitPktLine.encode(`deepen ${depth} -`)); - } - if (since !== null) { - packstream.push( - GitPktLine.encode(`deepen-since ${Math.floor(since.valueOf() / 1e3)} -`) - ); - } - for (const oid of exclude) { - packstream.push(GitPktLine.encode(`deepen-not ${oid} -`)); - } - packstream.push(GitPktLine.flush()); - for (const oid of haves) { - packstream.push(GitPktLine.encode(`have ${oid} -`)); - } - packstream.push(GitPktLine.encode(`done -`)); - return packstream; -} -async function _fetch({ - fs, - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - gitdir, - ref: _ref, - remoteRef: _remoteRef, - remote: _remote, - url: _url, - corsProxy, - depth = null, - since = null, - exclude = [], - relative: relative2 = false, - tags = false, - singleBranch = false, - headers = {}, - prune = false, - pruneTags = false -}) { - const ref = _ref || await _currentBranch({ fs, gitdir, test: true }); - const config = await GitConfigManager.get({ fs, gitdir }); - const remote = _remote || ref && await config.get(`branch.${ref}.remote`) || "origin"; - const url = _url || await config.get(`remote.${remote}.url`); - if (typeof url === "undefined") { - throw new MissingParameterError("remote OR url"); - } - const remoteRef = _remoteRef || ref && await config.get(`branch.${ref}.merge`) || _ref || "HEAD"; - if (corsProxy === void 0) { - corsProxy = await config.get("http.corsProxy"); - } - const GitRemoteHTTP2 = GitRemoteManager.getRemoteHelperFor({ url }); - const remoteHTTP = await GitRemoteHTTP2.discover({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - service: "git-upload-pack", - url, - headers, - protocolVersion: 1 - }); - const auth = remoteHTTP.auth; - const remoteRefs = remoteHTTP.refs; - if (remoteRefs.size === 0) { - return { - defaultBranch: null, - fetchHead: null, - fetchHeadDescription: null - }; - } - if (depth !== null && !remoteHTTP.capabilities.has("shallow")) { - throw new RemoteCapabilityError("shallow", "depth"); - } - if (since !== null && !remoteHTTP.capabilities.has("deepen-since")) { - throw new RemoteCapabilityError("deepen-since", "since"); - } - if (exclude.length > 0 && !remoteHTTP.capabilities.has("deepen-not")) { - throw new RemoteCapabilityError("deepen-not", "exclude"); - } - if (relative2 === true && !remoteHTTP.capabilities.has("deepen-relative")) { - throw new RemoteCapabilityError("deepen-relative", "relative"); - } - const { oid, fullref } = GitRefManager.resolveAgainstMap({ - ref: remoteRef, - map: remoteRefs - }); - for (const remoteRef2 of remoteRefs.keys()) { - if (remoteRef2 === fullref || remoteRef2 === "HEAD" || remoteRef2.startsWith("refs/heads/") || tags && remoteRef2.startsWith("refs/tags/")) { - continue; - } - remoteRefs.delete(remoteRef2); - } - const capabilities = filterCapabilities( - [...remoteHTTP.capabilities], - [ - "multi_ack_detailed", - "no-done", - "side-band-64k", - // Note: I removed 'thin-pack' option since our code doesn't "fatten" packfiles, - // which is necessary for compatibility with git. It was the cause of mysterious - // 'fatal: pack has [x] unresolved deltas' errors that plagued us for some time. - // isomorphic-git is perfectly happy with thin packfiles in .git/objects/pack but - // canonical git it turns out is NOT. - "ofs-delta", - `agent=${pkg.agent}` - ] - ); - if (relative2) capabilities.push("deepen-relative"); - const wants = singleBranch ? [oid] : remoteRefs.values(); - const haveRefs = singleBranch ? [ref] : await GitRefManager.listRefs({ - fs, - gitdir, - filepath: `refs` - }); - let haves = []; - for (let ref2 of haveRefs) { - try { - ref2 = await GitRefManager.expand({ fs, gitdir, ref: ref2 }); - const oid2 = await GitRefManager.resolve({ fs, gitdir, ref: ref2 }); - if (await hasObject({ fs, cache, gitdir, oid: oid2 })) { - haves.push(oid2); - } - } catch (err) { - } - } - haves = [...new Set(haves)]; - const oids = await GitShallowManager.read({ fs, gitdir }); - const shallows = remoteHTTP.capabilities.has("shallow") ? [...oids] : []; - const packstream = writeUploadPackRequest({ - capabilities, - wants, - haves, - shallows, - depth, - since, - exclude - }); - const packbuffer = Buffer.from(await collect(packstream)); - const raw = await GitRemoteHTTP2.connect({ - http, - onProgress, - corsProxy, - service: "git-upload-pack", - url, - auth, - body: [packbuffer], - headers - }); - const response = await parseUploadPackResponse(raw.body); - if (raw.headers) { - response.headers = raw.headers; - } - for (const oid2 of response.shallows) { - if (!oids.has(oid2)) { - try { - const { object } = await _readObject({ fs, cache, gitdir, oid: oid2 }); - const commit2 = new GitCommit(object); - const hasParents = await Promise.all( - commit2.headers().parent.map((oid3) => hasObject({ fs, cache, gitdir, oid: oid3 })) - ); - const haveAllParents = hasParents.length === 0 || hasParents.every((has) => has); - if (!haveAllParents) { - oids.add(oid2); - } - } catch (err) { - oids.add(oid2); - } - } - } - for (const oid2 of response.unshallows) { - oids.delete(oid2); - } - await GitShallowManager.write({ fs, gitdir, oids }); - if (singleBranch) { - const refs = /* @__PURE__ */ new Map([[fullref, oid]]); - const symrefs = /* @__PURE__ */ new Map(); - let bail = 10; - let key2 = fullref; - while (bail--) { - const value = remoteHTTP.symrefs.get(key2); - if (value === void 0) break; - symrefs.set(key2, value); - key2 = value; - } - const realRef = remoteRefs.get(key2); - if (realRef) { - refs.set(key2, realRef); - } - const { pruned } = await GitRefManager.updateRemoteRefs({ - fs, - gitdir, - remote, - refs, - symrefs, - tags, - prune - }); - if (prune) { - response.pruned = pruned; - } - } else { - const { pruned } = await GitRefManager.updateRemoteRefs({ - fs, - gitdir, - remote, - refs: remoteRefs, - symrefs: remoteHTTP.symrefs, - tags, - prune, - pruneTags - }); - if (prune) { - response.pruned = pruned; - } - } - response.HEAD = remoteHTTP.symrefs.get("HEAD"); - if (response.HEAD === void 0) { - const { oid: oid2 } = GitRefManager.resolveAgainstMap({ - ref: "HEAD", - map: remoteRefs - }); - for (const [key2, value] of remoteRefs.entries()) { - if (key2 !== "HEAD" && value === oid2) { - response.HEAD = key2; - break; - } - } - } - const noun = fullref.startsWith("refs/tags") ? "tag" : "branch"; - response.FETCH_HEAD = { - oid, - description: `${noun} '${abbreviateRef(fullref)}' of ${url}` - }; - if (onProgress || onMessage) { - const lines = splitLines(response.progress); - forAwait(lines, async (line) => { - if (onMessage) await onMessage(line); - if (onProgress) { - const matches = line.match(/([^:]*).*\((\d+?)\/(\d+?)\)/); - if (matches) { - await onProgress({ - phase: matches[1].trim(), - loaded: parseInt(matches[2], 10), - total: parseInt(matches[3], 10) - }); - } - } - }); - } - const packfile = Buffer.from(await collect(response.packfile)); - if (raw.body.error) throw raw.body.error; - const packfileSha = packfile.slice(-20).toString("hex"); - const res = { - defaultBranch: response.HEAD, - fetchHead: response.FETCH_HEAD.oid, - fetchHeadDescription: response.FETCH_HEAD.description - }; - if (response.headers) { - res.headers = response.headers; - } - if (prune) { - res.pruned = response.pruned; - } - if (packfileSha !== "" && !emptyPackfile(packfile)) { - res.packfile = `objects/pack/pack-${packfileSha}.pack`; - const fullpath = join(gitdir, res.packfile); - await fs.write(fullpath, packfile); - const getExternalRefDelta = (oid2) => _readObject({ fs, cache, gitdir, oid: oid2 }); - const idx = await GitPackIndex.fromPack({ - pack: packfile, - getExternalRefDelta, - onProgress - }); - await fs.write(fullpath.replace(/\.pack$/, ".idx"), await idx.toBuffer()); - } - return res; -} -async function _init({ - fs, - bare = false, - dir, - gitdir = bare ? dir : join(dir, ".git"), - defaultBranch = "master" -}) { - if (await fs.exists(gitdir + "/config")) return; - let folders = [ - "hooks", - "info", - "objects/info", - "objects/pack", - "refs/heads", - "refs/tags" - ]; - folders = folders.map((dir2) => gitdir + "/" + dir2); - for (const folder of folders) { - await fs.mkdir(folder); - } - await fs.write( - gitdir + "/config", - `[core] +${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(` +`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` +`+i.slice(1):n.push(i);let r={};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.tagger&&(r.tagger=$o(r.tagger)),r.committer&&(r.committer=$o(r.committer)),r}withoutSignature(){let e=Hn(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 Hn(e)}payload(){return this.withoutSignature()+` +`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,n,r){let i=e.payload(),{signature:a}=await n({payload:i,secretKey:r});a=Hn(a);let s=i+a;return t.from(s)}};function xf(t){return t.trim().split(` +`).map(e=>" "+e).join(` +`)+` +`}function J5(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var Rt=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ue("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:n}){let r=t.justHeaders(e),i=t.justMessage(e),a=Hn(r+` +gpgsig`+xf(n)+` +`+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Hn(e.slice(e.indexOf(` + +`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` + +`))}parseHeaders(){let e=t.justHeaders(this._commit).split(` +`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` +`+i.slice(1):n.push(i);let r={parent:[]};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.author&&(r.author=$o(r.author)),r.committer&&(r.committer=$o(r.committer)),r}static renderHeaders(e){let n="";if(e.tree?n+=`tree ${e.tree} +`:n+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 +`,e.parent){if(e.parent.length===void 0)throw new ue("commit 'parent' property should be an array");for(let a of e.parent)n+=`parent ${a} +`}let r=e.author;n+=`author ${Pf(r)} +`;let i=e.committer||e.author;return n+=`committer ${Pf(i)} +`,e.gpgsig&&(n+="gpgsig"+xf(e.gpgsig)),n}static render(e){return t.renderHeaders(e)+` +`+Hn(e.message)}render(){return this._commit}withoutSignature(){let e=Hn(this._commit);if(e.indexOf(` +gpgsig`)===-1)return e;let n=e.slice(0,e.indexOf(` +gpgsig`)),r=e.slice(e.indexOf(`-----END PGP SIGNATURE----- +`)+28);return Hn(n+` +`+r)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return J5(e)}static async sign(e,n,r){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await n({payload:i,secretKey:r});s=Hn(s);let l=t.justHeaders(e._commit)+` +gpgsig`+xf(s)+` +`+a;return t.from(l)}};async function Oi({fs:t,cache:e,gitdir:n,oid:r}){if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:It.from([]),oid:r};let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,Oi({fs:t,cache:e,gitdir:n,oid:r});if(i==="commit")return r=Rt.from(a).parse().tree,Oi({fs:t,cache:e,gitdir:n,oid:r});if(i!=="tree")throw new kt(r,i,"tree");return{tree:It.from(a),oid:r}}var If=class{constructor({fs:e,gitdir:n,ref:r,cache:i}){this.fs=e,this.cache=i,this.gitdir=n,this.mapPromise=(async()=>{let s=new Map,o;try{o=await q.resolve({fs:e,gitdir:n,ref:r})}catch(c){c instanceof Re&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Oi({fs:e,cache:this.cache,gitdir:n,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),s})();let a=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 a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(n);if(!o)throw new Error(`No obj for ${n}`);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 Ge({fs:r,cache:i,gitdir:a,oid:l});if(c!==o.type)throw new kt(l,c,o.type);let f=It.from(u);for(let h of f)s.set(B(n,h.path),h);return f.entries().map(h=>B(n,h.path))}async type(e){if(e._type===!1){let n=await this.mapPromise,{type:r}=n.get(e._fullpath);e._type=r}return e._type}async mode(e){if(e._mode===!1){let n=await this.mapPromise,{mode:r}=n.get(e._fullpath);e._mode=_1(parseInt(r,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let n=await this.mapPromise,{fs:r,cache:i,gitdir:a}=this,o=n.get(e._fullpath).oid,{type:l,object:c}=await Ge({fs:r,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let r=(await this.mapPromise).get(e._fullpath);e._oid=r.oid}return e._oid}};function sr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,qo,{value:function({fs:n,gitdir:r,cache:i}){return new If({fs:n,gitdir:r,ref:t,cache:i})}}),Object.freeze(e),e}var Rf=class{constructor({fs:e,dir:n,gitdir:r,cache:i}){this.fs=e,this.cache=i,this.dir=n,this.gitdir=r;let a=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 a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,dir:i}=this,a=await r.readdir(B(i,n));return a===null?null:a.map(s=>B(n,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{fs:n,dir:r}=this,i=await n.lstat(`${r}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=Ei(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:n,dir:r,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await ze.get({fs:n,gitdir:i})).get("core.autocrlf"),o=await n.read(`${r}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let{fs:n,gitdir:r,cache:i}=this,a;await lt.acquire({fs:n,gitdir:r,cache:i},async function(s){let o=s.entriesMap.get(e._fullpath),l=await e.stat(),u=await(await ze.get({fs:n,gitdir:r})).get("core.filemode"),f=typeof process!="undefined"?process.platform!=="win32":!0;!o||Lo(l,o,u,f)?await e.content()===void 0?a=void 0:(a=await Un(lr.wrap({type:"blob",object:await e.content()})),o&&a===o.oid&&(!u||l.mode===o.mode)&&Lo(l,o,u,f)&&s.insert({filepath:e._fullpath,stats:l,oid:a})):a=o.oid}),e._oid=a}return e._oid}};function Yo(){let t=Object.create(null);return Object.defineProperty(t,qo,{value:function({fs:e,dir:n,gitdir:r,cache:i}){return new Rf({fs:e,dir:n,gitdir:r,cache:i})}}),Object.freeze(t),t}function Q5(t,e){let n=e-t;return Array.from({length:n},(r,i)=>t+i)}var C1=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,n)=>e.concat(n),[]):t=>t.flat(),Lf=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:s=async(l,c)=>{let u=C1(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(d=>d[qo]({fs:t,dir:n,gitdir:r,cache:e})),c=new Array(l.length).fill("."),u=Q5(0,l.length),f=async d=>{u.map(m=>{d[m]=d[m]&&new l[m].ConstructEntry(d[m])});let g=(await Promise.all(u.map(m=>d[m]?l[m].readdir(d[m]):[]))).map(m=>m===null?[]:m).map(m=>m[Symbol.iterator]());return{entries:d,children:eC(g)}},h=async d=>{let{entries:p,children:g}=await f(d),m=p.find(b=>b&&b._fullpath)._fullpath,w=await a(m,p);if(w!==null){let b=await o(h,g);return b=b.filter(S=>S!==void 0),s(w,b)}};return h(c)}async function jf(t,e){let n=await t.readdir(e);n==null?await t.rm(e):n.length?await Promise.all(n.map(r=>{let i=B(e,r);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?jf(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function tC(t){return nC(t)&&o1(t.then)&&o1(t.catch)}function nC(t){return t&&typeof t=="object"}function o1(t){return typeof t=="function"}function l1(t){return tC((n=>{try{return n.readFile().catch(r=>r)}catch(r){return r}})(t))}var c1=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function u1(t,e){if(l1(e))for(let n of c1)t[`_${n}`]=e[n].bind(e);else for(let n of c1)t[`_${n}`]=(0,Ro.default)(e[n].bind(e));l1(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=jf.bind(null,t):e.rm?t._rm=(0,Ro.default)(e.rm.bind(e)):e.rmdir.length>2?t._rm=(0,Ro.default)(e.rmdir.bind(e)):t._rm=jf.bind(null,t)}var Q=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let n=Object.getOwnPropertyDescriptor(e,"promises");n&&n.enumerable?u1(this,e.promises):u1(this,e),this._original_unwrapped_fs=e}async exists(e,n={}){try{return await this._stat(e),!0}catch(r){if(r.code==="ENOENT"||r.code==="ENOTDIR")return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',r),r}}async read(e,n={}){try{let r=await this._readFile(e,n);if(n.autocrlf==="true")try{r=new TextDecoder("utf8",{fatal:!0}).decode(r),r=r.replace(/\r\n/g,` +`),r=new TextEncoder().encode(r)}catch(i){}return typeof r!="string"&&(r=Buffer.from(r)),r}catch(r){return null}}async write(e,n,r={}){try{await this._writeFile(e,n,r);return}catch(i){await this.mkdir(ki(e)),await this._writeFile(e,n,r)}}async mkdir(e,n=!1){try{await this._mkdir(e);return}catch(r){if(r===null||r.code==="EEXIST")return;if(n)throw r;if(r.code==="ENOENT"){let i=ki(e);if(i==="."||i==="/"||i===e)throw r;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(n){if(n.code!=="ENOENT")throw n}}async rmdir(e,n){try{n&&n.recursive?await this._rm(e,n):await this._rmdir(e)}catch(r){if(r.code!=="ENOENT")throw r}}async readdir(e){try{let n=await this._readdir(e);return n.sort(Wo),n}catch(n){return n.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let n=await this._readdir(e);return(await Promise.all(n.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(n){if(n.code==="ENOENT")return null;throw n}}async readlink(e,n={encoding:"buffer"}){try{let r=await this._readlink(e,n);return Buffer.isBuffer(r)?r:Buffer.from(r)}catch(r){if(r.code==="ENOENT")return null;throw r}}async writelink(e,n){return this._symlink(n.toString("utf8"),e)}};function F(t,e){if(e===void 0)throw new Pt(t)}async function Ho(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 rC({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r="HEAD",cache:i={}}){try{F("fs",t),F("dir",e),F("gitdir",n);let a=new Q(t),s=[sr({ref:r}),Yo(),Xo()],o=[];await lt.acquire({fs:a,gitdir:n,cache:i},async function(c){o=c.unmergedPaths});let l=await Pi({fs:a,cache:i,dir:e,gitdir:n,trees:s,map:async function(c,[u,f,h]){let d=!await Ho(f,h),p=o.includes(c),g=!await Ho(h,u);if(d||p)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(g)return!1;throw new cs(c)}});await lt.acquire({fs:a,gitdir:n,cache:i},async function(c){for(let u of l)if(u!==!1){if(!u){await a.rmdir(`${e}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${e}/${u.path}`,f,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var Ii=class{static async isIgnored({fs:e,dir:n,gitdir:r=B(n,".git"),filepath:i}){if(jo(i)===".git")return!0;if(i===".")return!1;let a="",s=B(r,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:B(n,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;uDf({dir:e,gitdir:n,fs:o,filepath:r,index:l,force:a,parallel:s}))}catch(o){throw o.caller="git.add",o}}async function Df({dir:t,gitdir:e,fs:n,filepath:r,index:i,force:a,parallel:s}){r=Array.isArray(r)?r:[r];let o=r.map(async f=>{if(!a&&await Ii.isIgnored({fs:n,dir:t,gitdir:e,filepath:f}))return;let h=await n.lstat(B(t,f));if(!h)throw new Re(f);if(h.isDirectory()){let d=await n.readdir(B(t,f));if(s){let p=d.map(g=>Df({dir:t,gitdir:e,fs:n,filepath:[B(f,g)],index:i,force:a,parallel:s}));await Promise.all(p)}else for(let p of d)await Df({dir:t,gitdir:e,fs:n,filepath:[B(f,p)],index:i,force:a,parallel:s})}else{let p=await(await ze.get({fs:n,gitdir:e})).get("core.autocrlf"),g=h.isSymbolicLink()?await n.readlink(B(t,f)).then(oC):await n.read(B(t,f),{autocrlf:p});if(g===null)throw new Re(f);let m=await zt({fs:n,gitdir:e,type:"blob",object:g});i.insert({filepath:f,stats:h,oid:m})}}),l=await Promise.allSettled(o),c=l.filter(f=>f.status==="rejected").map(f=>f.reason);if(c.length>1)throw new as(c);if(c.length===1)throw c[0];return l.filter(f=>f.status==="fulfilled"&&f.value).map(f=>f.value)}async function fs({fs:t,gitdir:e,path:n}){return(await ze.get({fs:t,gitdir:e})).get(n)}function M1(t,...e){for(let n of e)if(n)for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(t[r]=i)}return t}async function Hr({fs:t,gitdir:e,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),a={name:await fs({fs:t,gitdir:e,path:"user.name"}),email:await fs({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=M1({},a,r?r.author:void 0,n);if(s.name!==void 0)return s}async function Ri({fs:t,gitdir:e,author:n,committer:r,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await fs({fs:t,gitdir:e,path:"user.name"}),email:await fs({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=M1({},s,i?i.committer:void 0,n,r);if(o.name!==void 0)return o}async function O1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,O1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="commit")throw new kt(r,i,"commit");return{commit:Rt.from(a),oid:r}}async function Uo({fs:t,cache:e,gitdir:n,oid:r}){let{commit:i,oid:a}=await O1({fs:t,cache:e,gitdir:n,oid:r});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function Zo({fs:t,cache:e,onSign:n,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:h,tree:d}){let p=!1;f||(f=await q.resolve({fs:t,gitdir:r,ref:"HEAD",depth:2}));let g,m;try{g=await q.resolve({fs:t,gitdir:r,ref:f}),m=await Uo({fs:t,gitdir:r,oid:g,cache:{}})}catch(S){p=!0}if(l&&p)throw new us(f);let w=l?await Hr({fs:t,gitdir:r,author:a,commit:m.commit}):await Hr({fs:t,gitdir:r,author:a});if(!w)throw new At("author");let b=l?await Ri({fs:t,gitdir:r,author:w,committer:s,commit:m.commit}):await Ri({fs:t,gitdir:r,author:w,committer:s});if(!b)throw new At("committer");return lt.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async function(S){let x=E1(S.entries).get(".");if(d||(d=await P1({fs:t,gitdir:r,inode:x,dryRun:c})),h?h=await Promise.all(h.map(E=>q.resolve({fs:t,gitdir:r,ref:E}))):l?h=m.commit.parent:h=g?[g]:[],!i)if(l)i=m.commit.message;else throw new Pt("message");let A=Rt.from({tree:d,parent:h,author:w,committer:b,message:i});o&&(A=await Rt.sign(A,n,o));let y=await zt({fs:t,gitdir:r,type:"commit",object:A.toObject(),dryRun:c});return!u&&!c&&await q.writeRef({fs:t,gitdir:r,ref:f,value:y}),y})}async function P1({fs:t,gitdir:e,inode:n,dryRun:r}){let i=n.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await P1({fs:t,gitdir:e,inode:l,dryRun:r}));let a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),s=It.from(a);return await zt({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:r})}async function ds({fs:t,cache:e,gitdir:n,oid:r,filepath:i}){if(i.startsWith("/"))throw new cr("leading-slash");if(i.endsWith("/"))throw new cr("trailing-slash");let a=r,s=await Oi({fs:t,cache:e,gitdir:n,oid:r}),o=s.tree;if(i==="")r=s.oid;else{let l=i.split("/");r=await I1({fs:t,cache:e,gitdir:n,tree:o,pathArray:l,oid:a,filepath:i})}return r}async function I1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let l of r)if(l.path===o){if(i.length===0)return l.oid;{let{type:c,object:u}=await Ge({fs:t,cache:e,gitdir:n,oid:l.oid});if(c!=="tree")throw new kt(a,c,"tree",s);return r=It.from(u),I1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s})}}throw new Re(`file or directory found at "${a}:${s}"`)}async function Di({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){i!==void 0&&(r=await ds({fs:t,cache:e,gitdir:n,oid:r,filepath:i}));let{tree:a,oid:s}=await Oi({fs:t,cache:e,gitdir:n,oid:r});return{oid:s,tree:a.entries()}}async function Hf({fs:t,gitdir:e,tree:n}){let r=It.from(n).toObject();return await zt({fs:t,gitdir:e,type:"tree",object:r,format:"content"})}async function cC({fs:t,cache:e,onSign:n,gitdir:r,ref:i,oid:a,note:s,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await q.resolve({gitdir:r,fs:t,ref:i})}catch(w){if(!(w instanceof Re))throw w}let d=(await Di({fs:t,cache:e,gitdir:r,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)d=d.filter(w=>w.path!==a);else for(let w of d)if(w.path===a)throw new hn("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let p=await zt({fs:t,gitdir:r,type:"blob",object:s,format:"content"});d.push({mode:"100644",path:a,oid:p,type:"blob"});let g=await Hf({fs:t,gitdir:r,tree:d});return await Zo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:c,signingKey:u})}async function uC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{F("fs",t),F("gitdir",r),F("oid",a),F("note",s),u&&F("onSign",e);let h=new Q(t),d=await Hr({fs:h,gitdir:r,author:l});if(!d)throw new At("author");let p=await Ri({fs:h,gitdir:r,author:d,committer:c});if(!p)throw new At("committer");return await cC({fs:new Q(h),cache:f,onSign:e,gitdir:r,ref:i,oid:a,note:s,force:o,author:d,committer:p,signingKey:u})}catch(h){throw h.caller="git.addNote",h}}async function R1({fs:t,gitdir:e,remote:n,url:r,force:i}){if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let a=await ze.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(n)&&r!==await a.get(`remote.${n}.url`))throw new hn("remote",n);await a.set(`remote.${n}.url`,r),await a.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await ze.save({fs:t,gitdir:e,config:a})}async function fC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r,url:i,force:a=!1}){try{return F("fs",t),F("gitdir",n),F("remote",r),F("url",i),await R1({fs:new Q(t),gitdir:n,remote:r,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function hC({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await q.exists({fs:t,gitdir:r,ref:i}))throw new hn("tag",i);let f=await q.resolve({fs:t,gitdir:r,ref:l||"HEAD"}),{type:h}=await Ge({fs:t,cache:e,gitdir:r,oid:f}),d=Ut.from({object:f,type:h,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});c&&(d=await Ut.sign(d,n,c));let p=await zt({fs:t,gitdir:r,type:"tag",object:d.toObject()});await q.writeRef({fs:t,gitdir:r,ref:i,value:p})}async function dC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{F("fs",t),F("gitdir",r),F("ref",i),c&&F("onSign",e);let h=new Q(t),d=await Hr({fs:h,gitdir:r,author:a});if(!d)throw new At("tagger");return await hC({fs:h,cache:f,onSign:e,gitdir:r,ref:i,tagger:d,message:s,gpgsig:o,object:l,signingKey:c,force:u})}catch(h){throw h.caller="git.annotatedTag",h}}async function pC({fs:t,gitdir:e,ref:n,object:r,checkout:i=!1,force:a=!1}){if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let s=`refs/heads/${n}`;if(!a&&await q.exists({fs:t,gitdir:e,ref:s}))throw new hn("branch",n,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function mC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,checkout:a=!1,force:s=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),await pC({fs:new Q(t),gitdir:n,ref:r,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var L1=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Uf({fs:t,cache:e,onProgress:n,onPostCheckout:r,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:h,track:d=!0}){let p;if(r)try{p=await q.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(m){p="0000000000000000000000000000000000000000"}let g;try{g=await q.resolve({fs:t,gitdir:a,ref:o})}catch(m){if(o==="HEAD")throw m;let w=`${s}/${o}`;if(g=await q.resolve({fs:t,gitdir:a,ref:w}),d){let b=await ze.get({fs:t,gitdir:a});await b.set(`branch.${o}.remote`,s),await b.set(`branch.${o}.merge`,`refs/heads/${o}`),await ze.save({fs:t,gitdir:a,config:b})}await q.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:g})}if(!c){let m;try{m=await gC({fs:t,cache:e,onProgress:n,dir:i,gitdir:a,ref:o,force:h,filepaths:l})}catch(x){throw x instanceof Re&&x.data.what===g?new es(o,g):x}let w=m.filter(([x])=>x==="conflict").map(([x,A])=>A);if(w.length>0)throw new Qa(w);let b=m.filter(([x])=>x==="error").map(([x,A])=>A);if(b.length>0)throw new ue(b.join(", "));if(f){r&&await r({previousHead:p,newHead:g,type:l!=null&&l.length>0?"file":"branch"});return}let S=0,k=m.length;await lt.acquire({fs:t,gitdir:a,cache:e},async function(x){await Promise.all(m.filter(([A])=>A==="delete"||A==="delete-index").map(async function([A,y]){let E=`${i}/${y}`;A==="delete"&&await t.rm(E),x.delete({filepath:y}),n&&await n({phase:"Updating workdir",loaded:++S,total:k})}))}),await lt.acquire({fs:t,gitdir:a,cache:e},async function(x){for(let[A,y]of m)if(A==="rmdir"||A==="rmdir-index"){let E=`${i}/${y}`;try{A==="rmdir-index"&&x.delete({filepath:y}),await t.rmdir(E),n&&await n({phase:"Updating workdir",loaded:++S,total:k})}catch(_){if(_.code==="ENOTEMPTY")console.log(`Did not delete ${y} because directory is not empty`);else throw _}}}),await Promise.all(m.filter(([x])=>x==="mkdir"||x==="mkdir-index").map(async function([x,A]){let y=`${i}/${A}`;await t.mkdir(y),n&&await n({phase:"Updating workdir",loaded:++S,total:k})})),await lt.acquire({fs:t,gitdir:a,cache:e},async function(x){await Promise.all(m.filter(([A])=>A==="create"||A==="create-index"||A==="update"||A==="mkdir-index").map(async function([A,y,E,_,C]){let M=`${i}/${y}`;try{if(A!=="create-index"&&A!=="mkdir-index"){let{object:N}=await Ge({fs:t,cache:e,gitdir:a,oid:E});if(C&&await t.rm(M),_===33188)await t.write(M,N);else if(_===33261)await t.write(M,N,{mode:511});else if(_===40960)await t.writelink(M,N);else throw new ue(`Invalid mode 0o${_.toString(8)} detected in blob ${E}`)}let L=await t.lstat(M);_===33261&&(L.mode=493),A==="mkdir-index"&&(L.mode=57344),x.insert({filepath:y,stats:L,oid:E}),n&&await n({phase:"Updating workdir",loaded:++S,total:k})}catch(L){console.log(L)}}))}),r&&await r({previousHead:p,newHead:g,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let m=await q.expand({fs:t,gitdir:a,ref:o});m.startsWith("refs/heads")?await q.writeSymbolicRef({fs:t,gitdir:a,ref:"HEAD",value:m}):await q.writeRef({fs:t,gitdir:a,ref:"HEAD",value:g})}}async function gC({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,ref:a,force:s,filepaths:o}){let l=0;return Pi({fs:t,cache:e,dir:r,gitdir:i,trees:[sr({ref:a}),Yo(),Xo()],map:async function(c,[u,f,h]){if(c===".")return;if(o&&!o.some(p=>L1(c,p)))return null;switch(n&&await n({phase:"Analyzing workdir",loaded:++l}),[!!h,!!u,!!f].map(Number).join("")){case"000":return;case"001":return s&&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()?s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?s?["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 h.type()){case"tree":return["rmdir",c];case"blob":return await h.oid()!==await f.oid()?s?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await h.type()}`]}case"110":case"111":switch(`${await h.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await h.oid()===await u.oid()&&await h.mode()===await u.mode()&&!s)return;if(f){if(await f.oid()!==await h.oid()&&await f.oid()!==await u.oid())return s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(s)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()];return await u.mode()!==await h.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await h.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 h.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=C1(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function yC({fs:t,onProgress:e,onPostCheckout:n,dir:r,gitdir:i=B(r,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:l=!1,noUpdateHead:c=s===void 0,dryRun:u=!1,force:f=!1,track:h=!0,cache:d={}}){try{F("fs",t),F("dir",r),F("gitdir",i);let p=s||"HEAD";return await Uf({fs:new Q(t),cache:d,onProgress:e,onPostCheckout:n,dir:r,gitdir:i,remote:a,ref:p,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:h})}catch(p){throw p.caller="git.checkout",p}}var vC=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Nr(t){let e=vC.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function zr({fs:t,gitdir:e,fullname:n=!1,test:r=!1}){let i=await q.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(r)try{await q.resolve({fs:t,gitdir:e,ref:i})}catch(a){return}if(i.startsWith("refs/"))return n?i:Nr(i)}function wC(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function j1({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function ps(t,e){let n=A1(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function zo(t){let e=0,n=[];await ps(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}function f1(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[n,r]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:n,password:r}}}function Bf(t,e){let n=e.toString(16);return"0".repeat(t-n.length)+n}var Ue=class{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let n=e.length+4,r=Bf(4,n);return Buffer.concat([Buffer.from(r,"utf8"),e])}static streamReader(e){let n=new No(e);return async function(){try{let i=await n.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await n.read(i-4);return a==null?!0:a}catch(i){return e.error=i,!0}}}};async function h1(t){let e={},n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let r=n.indexOf("=");if(r>-1){let i=n.slice(0,r),a=n.slice(r+1);e[i]=a}else e[n]=!0}return{protocolVersion:2,capabilities2:e}}async function d1(t,{service:e}){let n=new Set,r=new Map,i=new Map,a=Ue.streamReader(t),s=await a();for(;s===null;)s=await a();if(s===!0)throw new ts;if(s.includes("version 2"))return h1(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new $r(`# service=${e}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:n,refs:r,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return h1(a);let[l,c]=Sf(o,"\0","\\x00");if(c.split(" ").map(u=>n.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Sf(l," "," ");for(r.set(f,u);;){let h=await a();if(h===!0)break;if(h!==null){let[d,p]=Sf(h.toString("utf8")," "," ");r.set(p,d)}}}for(let u of n)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:n,refs:r,symrefs:i}}function Sf(t,e,n){let r=t.trim().split(e);if(r.length!==2)throw new $r(`Two strings separated by '${n}'`,t.toString("utf8"));return r}var p1=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,m1=(t,e)=>{(e.username||e.password)&&(t.Authorization=j1(e)),e.headers&&Object.assign(t,e.headers)},Ef=async t=>{try{let e=Buffer.from(await zo(t.body)),n=e.toString("utf8");return{preview:n.length<256?n:n.slice(0,256)+"...",response:n,data:e}}catch(e){return{}}},Li=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:n,onAuth:r,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:h}=f1(l),d=s?p1(s,f):f;(h.username||h.password)&&(c.Authorization=j1(h)),u===2&&(c["Git-Protocol"]="version=2");let p,g,m=!1;do if(p=await e.request({onProgress:n,method:"GET",url:`${d}/info/refs?service=${o}`,headers:c}),g=!1,p.statusCode===401||p.statusCode===203){let w=m?a:r;if(w){if(h=await w(f,{...h,headers:{...c}}),h&&h.cancel)throw new Mi;h&&(m1(c,h),m=!0,g=!0)}}else p.statusCode===200&&m&&i&&await i(f,h);while(g);if(p.statusCode!==200){let{response:w}=await Ef(p);throw new Ai(p.statusCode,p.statusMessage,w)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let w=await d1(p.body,{service:o});return w.auth=h,w}else{let{preview:w,response:b,data:S}=await Ef(p);try{let k=await d1([S],{service:o});return k.auth=h,k}catch(k){throw new ss(w,b)}}}static async connect({http:e,onProgress:n,corsProxy:r,service:i,url:a,auth:s,body:o,headers:l}){let c=f1(a);c&&(a=c.url),r&&(a=p1(r,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,m1(l,s);let u=await e.request({onProgress:n,method:"POST",url:`${a}/${i}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=Ef(u);throw new Ai(u.statusCode,u.statusMessage,f)}return u}};function bC({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 ji=class{static getRemoteHelperFor({url:e}){let n=new Map;n.set("http",Li),n.set("https",Li);let r=bC({url:e});if(!r)throw new ls(e);if(n.has(r.transport))return n.get(r.transport);throw new os(e,r.transport,r.transport==="ssh"?wC(e):void 0)}},Br=null,Ur=class{static async read({fs:e,gitdir:n}){Br===null&&(Br=new Xa.default);let r=B(n,"shallow"),i=new Set;return await Br.acquire(r,async function(){let a=await e.read(r,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(` +`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:n,oids:r}){Br===null&&(Br=new Xa.default);let i=B(n,"shallow");if(r.size>0){let a=[...r].join(` +`)+` +`;await Br.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Br.acquire(i,async function(){await e.rm(i)})}};async function xC({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return t.exists(`${e}/${r}`)}async function _C({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await t.readdir(B(n,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${n}/objects/pack/${s}`,l=await $f({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new ue(l.error);if(l.offsets.has(r))return!0}return!1}async function g1({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=o=>Ge({fs:t,cache:e,gitdir:n,oid:o}),s=await xC({fs:t,gitdir:n,oid:r});return s||(s=await _C({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a})),s}function SC(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function D1(t,e){let n=t.map(r=>r.split("=",1)[0]);return e.filter(r=>{let i=r.split("=",1)[0];return n.includes(i)})}var Ko={name:"isomorphic-git",version:"1.27.1",agent:"git/isomorphic-git@1.27.1"},_i=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 n=this._waiting;this._waiting=null,n({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 EC(t){let e=t.indexOf("\r"),n=t.indexOf(` +`);return e===-1&&n===-1?-1:e===-1?n+1:n===-1?e+1:n===e+1?n+1:Math.min(e,n)+1}function B1(t){let e=new _i,n="";return(async()=>(await ps(t,r=>{for(r=r.toString("utf8"),n+=r;;){let i=EC(n);if(i===-1)break;e.write(n.slice(0,i)),n=n.slice(i)}}),n.length>0&&e.write(n),e.end()))(),e}var Go=class{static demux(e){let n=Ue.streamReader(e),r=new _i,i=new _i,a=new _i,s=async function(){let o=await n();if(o===null)return s();if(o===!0){r.end(),a.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let l=o.slice(1);a.write(l),r.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:r.write(o)}s()};return s(),{packetlines:r,packfile:i,progress:a}}};async function kC(t){let{packetlines:e,packfile:n,progress:r}=Go.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((c,u)=>{ps(e,f=>{let h=f.toString("utf8").trim();if(h.startsWith("shallow")){let d=h.slice(-41).trim();d.length!==40&&u(new or(d)),i.push(d)}else if(h.startsWith("unshallow")){let d=h.slice(-41).trim();d.length!==40&&u(new or(d)),a.push(d)}else if(h.startsWith("ACK")){let[,d,p]=h.split(" ");s.push({oid:d,status:p}),p||(l=!0)}else h.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))})})}function AC({capabilities:t=[],wants:e=[],haves:n=[],shallows:r=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(Ue.encode(`want ${c}${l} +`)),l="";for(let c of r)o.push(Ue.encode(`shallow ${c} +`));i!==null&&o.push(Ue.encode(`deepen ${i} +`)),a!==null&&o.push(Ue.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)} +`));for(let c of s)o.push(Ue.encode(`deepen-not ${c} +`));o.push(Ue.flush());for(let c of n)o.push(Ue.encode(`have ${c} +`));return o.push(Ue.encode(`done +`)),o}async function zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:h,corsProxy:d,depth:p=null,since:g=null,exclude:m=[],relative:w=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:x=!1,pruneTags:A=!1}){let y=c||await zr({fs:t,gitdir:l,test:!0}),E=await ze.get({fs:t,gitdir:l}),_=f||y&&await E.get(`branch.${y}.remote`)||"origin",C=h||await E.get(`remote.${_}.url`);if(typeof C=="undefined")throw new Pt("remote OR url");let M=u||y&&await E.get(`branch.${y}.merge`)||c||"HEAD";d===void 0&&(d=await E.get("http.corsProxy"));let L=ji.getRemoteHelperFor({url:C}),N=await L.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:d,service:"git-upload-pack",url:C,headers:k,protocolVersion:1}),j=N.auth,Y=N.refs;if(Y.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!N.capabilities.has("shallow"))throw new ar("shallow","depth");if(g!==null&&!N.capabilities.has("deepen-since"))throw new ar("deepen-since","since");if(m.length>0&&!N.capabilities.has("deepen-not"))throw new ar("deepen-not","exclude");if(w===!0&&!N.capabilities.has("deepen-relative"))throw new ar("deepen-relative","relative");let{oid:le,fullref:he}=q.resolveAgainstMap({ref:M,map:Y});for(let z of Y.keys())z===he||z==="HEAD"||z.startsWith("refs/heads/")||b&&z.startsWith("refs/tags/")||Y.delete(z);let ie=D1([...N.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ko.agent}`]);w&&ie.push("deepen-relative");let Me=S?[le]:Y.values(),de=S?[y]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),$=[];for(let z of de)try{z=await q.expand({fs:t,gitdir:l,ref:z});let nt=await q.resolve({fs:t,gitdir:l,ref:z});await g1({fs:t,cache:e,gitdir:l,oid:nt})&&$.push(nt)}catch(nt){}$=[...new Set($)];let G=await Ur.read({fs:t,gitdir:l}),D=N.capabilities.has("shallow")?[...G]:[],se=AC({capabilities:ie,wants:Me,haves:$,shallows:D,depth:p,since:g,exclude:m}),Se=Buffer.from(await zo(se)),mt=await L.connect({http:n,onProgress:r,corsProxy:d,service:"git-upload-pack",url:C,auth:j,body:[Se],headers:k}),be=await kC(mt.body);mt.headers&&(be.headers=mt.headers);for(let z of be.shallows)if(!G.has(z))try{let{object:nt}=await Ge({fs:t,cache:e,gitdir:l,oid:z}),H=new Rt(nt),Z=await Promise.all(H.headers().parent.map(Ye=>g1({fs:t,cache:e,gitdir:l,oid:Ye})));Z.length===0||Z.every(Ye=>Ye)||G.add(z)}catch(nt){G.add(z)}for(let z of be.unshallows)G.delete(z);if(await Ur.write({fs:t,gitdir:l,oids:G}),S){let z=new Map([[he,le]]),nt=new Map,H=10,Z=he;for(;H--;){let _t=N.symrefs.get(Z);if(_t===void 0)break;nt.set(Z,_t),Z=_t}let ye=Y.get(Z);ye&&z.set(Z,ye);let{pruned:Ye}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:z,symrefs:nt,tags:b,prune:x});x&&(be.pruned=Ye)}else{let{pruned:z}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:Y,symrefs:N.symrefs,tags:b,prune:x,pruneTags:A});x&&(be.pruned=z)}if(be.HEAD=N.symrefs.get("HEAD"),be.HEAD===void 0){let{oid:z}=q.resolveAgainstMap({ref:"HEAD",map:Y});for(let[nt,H]of Y.entries())if(nt!=="HEAD"&&H===z){be.HEAD=nt;break}}let st=he.startsWith("refs/tags")?"tag":"branch";if(be.FETCH_HEAD={oid:le,description:`${st} '${Nr(he)}' of ${C}`},r||i){let z=B1(be.progress);ps(z,async nt=>{if(i&&await i(nt),r){let H=nt.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);H&&await r({phase:H[1].trim(),loaded:parseInt(H[2],10),total:parseInt(H[3],10)})}})}let ee=Buffer.from(await zo(be.packfile));if(mt.body.error)throw mt.body.error;let Ie=ee.slice(-20).toString("hex"),Ee={defaultBranch:be.HEAD,fetchHead:be.FETCH_HEAD.oid,fetchHeadDescription:be.FETCH_HEAD.description};if(be.headers&&(Ee.headers=be.headers),x&&(Ee.pruned=be.pruned),Ie!==""&&!SC(ee)){Ee.packfile=`objects/pack/pack-${Ie}.pack`;let z=B(l,Ee.packfile);await t.write(z,ee);let nt=Z=>Ge({fs:t,cache:e,gitdir:l,oid:Z}),H=await Ka.fromPack({pack:ee,getExternalRefDelta:nt,onProgress:r});await t.write(z.replace(/\.pack$/,".idx"),await H.toBuffer())}return Ee}async function N1({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){if(await t.exists(r+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>r+"/"+s);for(let s of a)await t.mkdir(s);await t.write(r+"/config",`[core] repositoryformatversion = 0 filemode = false - bare = ${bare} -` + (bare ? "" : " logallrefupdates = true\n") + " symlinks = false\n ignorecase = true\n" - ); - await fs.write(gitdir + "/HEAD", `ref: refs/heads/${defaultBranch} -`); -} -async function _clone({ - fs, - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - onPostCheckout, - dir, - gitdir, - url, - corsProxy, - ref, - remote, - depth, - since, - exclude, - relative: relative2, - singleBranch, - noCheckout, - noTags, - headers -}) { - try { - await _init({ fs, gitdir }); - await _addRemote({ fs, gitdir, remote, url, force: false }); - if (corsProxy) { - const config = await GitConfigManager.get({ fs, gitdir }); - await config.set(`http.corsProxy`, corsProxy); - await GitConfigManager.save({ fs, gitdir, config }); - } - const { defaultBranch, fetchHead } = await _fetch({ - fs, - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - gitdir, - ref, - remote, - corsProxy, - depth, - since, - exclude, - relative: relative2, - singleBranch, - headers, - tags: !noTags - }); - if (fetchHead === null) return; - ref = ref || defaultBranch; - ref = ref.replace("refs/heads/", ""); - await _checkout({ - fs, - cache, - onProgress, - onPostCheckout, - dir, - gitdir, - ref, - remote, - noCheckout - }); - } catch (err) { - await fs.rmdir(gitdir, { recursive: true, maxRetries: 10 }).catch(() => void 0); - throw err; - } -} -async function clone({ - fs, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - onPostCheckout, - dir, - gitdir = join(dir, ".git"), - url, - corsProxy = void 0, - ref = void 0, - remote = "origin", - depth = void 0, - since = void 0, - exclude = [], - relative: relative2 = false, - singleBranch = false, - noCheckout = false, - noTags = false, - headers = {}, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("http", http); - assertParameter("gitdir", gitdir); - if (!noCheckout) { - assertParameter("dir", dir); - } - assertParameter("url", url); - return await _clone({ - fs: new FileSystem(fs), - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - onPostCheckout, - dir, - gitdir, - url, - corsProxy, - ref, - remote, - depth, - since, - exclude, - relative: relative2, - singleBranch, - noCheckout, - noTags, - headers - }); - } catch (err) { - err.caller = "git.clone"; - throw err; - } -} -async function commit({ - fs: _fs, - onSign, - dir, - gitdir = join(dir, ".git"), - message, - author, - committer, - signingKey, - amend = false, - dryRun = false, - noUpdateBranch = false, - ref, - parent, - tree, - cache = {} -}) { - try { - assertParameter("fs", _fs); - if (!amend) { - assertParameter("message", message); - } - if (signingKey) { - assertParameter("onSign", onSign); - } - const fs = new FileSystem(_fs); - return await _commit({ - fs, - cache, - onSign, - gitdir, - message, - author, - committer, - signingKey, - amend, - dryRun, - noUpdateBranch, - ref, - parent, - tree - }); - } catch (err) { - err.caller = "git.commit"; - throw err; - } -} -async function currentBranch({ - fs, - dir, - gitdir = join(dir, ".git"), - fullname = false, - test = false -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - return await _currentBranch({ - fs: new FileSystem(fs), - gitdir, - fullname, - test - }); - } catch (err) { - err.caller = "git.currentBranch"; - throw err; - } -} -async function _deleteBranch({ fs, gitdir, ref }) { - ref = ref.startsWith("refs/heads/") ? ref : `refs/heads/${ref}`; - const exist = await GitRefManager.exists({ fs, gitdir, ref }); - if (!exist) { - throw new NotFoundError(ref); - } - const fullRef = await GitRefManager.expand({ fs, gitdir, ref }); - const currentRef = await _currentBranch({ fs, gitdir, fullname: true }); - if (fullRef === currentRef) { - const value = await GitRefManager.resolve({ fs, gitdir, ref: fullRef }); - await GitRefManager.writeRef({ fs, gitdir, ref: "HEAD", value }); - } - await GitRefManager.deleteRef({ fs, gitdir, ref: fullRef }); - const abbrevRef = abbreviateRef(ref); - const config = await GitConfigManager.get({ fs, gitdir }); - await config.deleteSection("branch", abbrevRef); - await GitConfigManager.save({ fs, gitdir, config }); -} -async function deleteBranch({ - fs, - dir, - gitdir = join(dir, ".git"), - ref -}) { - try { - assertParameter("fs", fs); - assertParameter("ref", ref); - return await _deleteBranch({ - fs: new FileSystem(fs), - gitdir, - ref - }); - } catch (err) { - err.caller = "git.deleteBranch"; - throw err; - } -} -async function deleteRef({ fs, dir, gitdir = join(dir, ".git"), ref }) { - try { - assertParameter("fs", fs); - assertParameter("ref", ref); - await GitRefManager.deleteRef({ fs: new FileSystem(fs), gitdir, ref }); - } catch (err) { - err.caller = "git.deleteRef"; - throw err; - } -} -async function _deleteRemote({ fs, gitdir, remote }) { - const config = await GitConfigManager.get({ fs, gitdir }); - await config.deleteSection("remote", remote); - await GitConfigManager.save({ fs, gitdir, config }); -} -async function deleteRemote({ - fs, - dir, - gitdir = join(dir, ".git"), - remote -}) { - try { - assertParameter("fs", fs); - assertParameter("remote", remote); - return await _deleteRemote({ - fs: new FileSystem(fs), - gitdir, - remote - }); - } catch (err) { - err.caller = "git.deleteRemote"; - throw err; - } -} -async function _deleteTag({ fs, gitdir, ref }) { - ref = ref.startsWith("refs/tags/") ? ref : `refs/tags/${ref}`; - await GitRefManager.deleteRef({ fs, gitdir, ref }); -} -async function deleteTag({ fs, dir, gitdir = join(dir, ".git"), ref }) { - try { - assertParameter("fs", fs); - assertParameter("ref", ref); - return await _deleteTag({ - fs: new FileSystem(fs), - gitdir, - ref - }); - } catch (err) { - err.caller = "git.deleteTag"; - throw err; - } -} -async function expandOidLoose({ fs, gitdir, oid: short }) { - const prefix = short.slice(0, 2); - const objectsSuffixes = await fs.readdir(`${gitdir}/objects/${prefix}`); - return objectsSuffixes.map((suffix) => `${prefix}${suffix}`).filter((_oid) => _oid.startsWith(short)); -} -async function expandOidPacked({ - fs, - cache, - gitdir, - oid: short, - getExternalRefDelta -}) { - const results = []; - let list = await fs.readdir(join(gitdir, "objects/pack")); - list = list.filter((x) => x.endsWith(".idx")); - for (const filename of list) { - const indexFile = `${gitdir}/objects/pack/${filename}`; - const p = await readPackIndex({ - fs, - cache, - filename: indexFile, - getExternalRefDelta - }); - if (p.error) throw new InternalError(p.error); - for (const oid of p.offsets.keys()) { - if (oid.startsWith(short)) results.push(oid); - } - } - return results; -} -async function _expandOid({ fs, cache, gitdir, oid: short }) { - const getExternalRefDelta = (oid) => _readObject({ fs, cache, gitdir, oid }); - const results = await expandOidLoose({ fs, gitdir, oid: short }); - const packedOids = await expandOidPacked({ - fs, - cache, - gitdir, - oid: short, - getExternalRefDelta - }); - for (const packedOid of packedOids) { - if (results.indexOf(packedOid) === -1) { - results.push(packedOid); - } - } - if (results.length === 1) { - return results[0]; - } - if (results.length > 1) { - throw new AmbiguousError("oids", short, results); - } - throw new NotFoundError(`an object matching "${short}"`); -} -async function expandOid({ - fs, - dir, - gitdir = join(dir, ".git"), - oid, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - return await _expandOid({ - fs: new FileSystem(fs), - cache, - gitdir, - oid - }); - } catch (err) { - err.caller = "git.expandOid"; - throw err; - } -} -async function expandRef({ fs, dir, gitdir = join(dir, ".git"), ref }) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - return await GitRefManager.expand({ - fs: new FileSystem(fs), - gitdir, - ref - }); - } catch (err) { - err.caller = "git.expandRef"; - throw err; - } -} -async function _findMergeBase({ fs, cache, gitdir, oids }) { - const visits = {}; - const passes = oids.length; - let heads = oids.map((oid, index2) => ({ index: index2, oid })); - while (heads.length) { - const result = /* @__PURE__ */ new Set(); - for (const { oid, index: index2 } of heads) { - if (!visits[oid]) visits[oid] = /* @__PURE__ */ new Set(); - visits[oid].add(index2); - if (visits[oid].size === passes) { - result.add(oid); - } - } - if (result.size > 0) { - return [...result]; - } - const newheads = /* @__PURE__ */ new Map(); - for (const { oid, index: index2 } of heads) { - try { - const { object } = await _readObject({ fs, cache, gitdir, oid }); - const commit2 = GitCommit.from(object); - const { parent } = commit2.parseHeaders(); - for (const oid2 of parent) { - if (!visits[oid2] || !visits[oid2].has(index2)) { - newheads.set(oid2 + ":" + index2, { oid: oid2, index: index2 }); - } - } - } catch (err) { - } - } - heads = Array.from(newheads.values()); - } - return []; -} -var LINEBREAKS = /^.*(\r?\n|$)/gm; -function mergeFile({ branches, contents }) { - const ourName = branches[1]; - const theirName = branches[2]; - const baseContent = contents[0]; - const ourContent = contents[1]; - const theirContent = contents[2]; - const ours = ourContent.match(LINEBREAKS); - const base = baseContent.match(LINEBREAKS); - const theirs = theirContent.match(LINEBREAKS); - const result = (0, import_diff3.default)(ours, base, theirs); - const markerSize = 7; - let mergedText = ""; - let cleanMerge = true; - for (const item of result) { - if (item.ok) { - mergedText += item.ok.join(""); - } - if (item.conflict) { - cleanMerge = false; - mergedText += `${"<".repeat(markerSize)} ${ourName} -`; - mergedText += item.conflict.a.join(""); - mergedText += `${"=".repeat(markerSize)} -`; - mergedText += item.conflict.b.join(""); - mergedText += `${">".repeat(markerSize)} ${theirName} -`; - } - } - return { cleanMerge, mergedText }; -} -async function mergeTree({ - fs, - cache, - dir, - gitdir = join(dir, ".git"), - index: index2, - ourOid, - baseOid, - theirOid, - ourName = "ours", - baseName = "base", - theirName = "theirs", - dryRun = false, - abortOnConflict = true, - mergeDriver -}) { - const ourTree = TREE({ ref: ourOid }); - const baseTree = TREE({ ref: baseOid }); - const theirTree = TREE({ ref: theirOid }); - const unmergedFiles = []; - const bothModified = []; - const deleteByUs = []; - const deleteByTheirs = []; - const results = await _walk({ - fs, - cache, - dir, - gitdir, - trees: [ourTree, baseTree, theirTree], - map: async function(filepath, [ours, base, theirs]) { - const path2 = basename(filepath); - const ourChange = await modified(ours, base); - const theirChange = await modified(theirs, base); - switch (`${ourChange}-${theirChange}`) { - case "false-false": { - return { - mode: await base.mode(), - path: path2, - oid: await base.oid(), - type: await base.type() - }; - } - case "false-true": { - return theirs ? { - mode: await theirs.mode(), - path: path2, - oid: await theirs.oid(), - type: await theirs.type() - } : void 0; - } - case "true-false": { - return ours ? { - mode: await ours.mode(), - path: path2, - oid: await ours.oid(), - type: await ours.type() - } : void 0; - } - case "true-true": { - if (ours && base && theirs && await ours.type() === "blob" && await base.type() === "blob" && await theirs.type() === "blob") { - return mergeBlobs({ - fs, - gitdir, - path: path2, - ours, - base, - theirs, - ourName, - baseName, - theirName, - mergeDriver - }).then(async (r) => { - if (!r.cleanMerge) { - unmergedFiles.push(filepath); - bothModified.push(filepath); - if (!abortOnConflict) { - const baseOid2 = await base.oid(); - const ourOid2 = await ours.oid(); - const theirOid2 = await theirs.oid(); - index2.delete({ filepath }); - index2.insert({ filepath, oid: baseOid2, stage: 1 }); - index2.insert({ filepath, oid: ourOid2, stage: 2 }); - index2.insert({ filepath, oid: theirOid2, stage: 3 }); - } - } else if (!abortOnConflict) { - index2.insert({ filepath, oid: r.mergeResult.oid, stage: 0 }); - } - return r.mergeResult; - }); - } - if (base && !ours && theirs && await base.type() === "blob" && await theirs.type() === "blob") { - unmergedFiles.push(filepath); - deleteByUs.push(filepath); - if (!abortOnConflict) { - const baseOid2 = await base.oid(); - const theirOid2 = await theirs.oid(); - index2.delete({ filepath }); - index2.insert({ filepath, oid: baseOid2, stage: 1 }); - index2.insert({ filepath, oid: theirOid2, stage: 3 }); - } - return { - mode: await theirs.mode(), - oid: await theirs.oid(), - type: "blob", - path: path2 - }; - } - if (base && ours && !theirs && await base.type() === "blob" && await ours.type() === "blob") { - unmergedFiles.push(filepath); - deleteByTheirs.push(filepath); - if (!abortOnConflict) { - const baseOid2 = await base.oid(); - const ourOid2 = await ours.oid(); - index2.delete({ filepath }); - index2.insert({ filepath, oid: baseOid2, stage: 1 }); - index2.insert({ filepath, oid: ourOid2, stage: 2 }); - } - return { - mode: await ours.mode(), - oid: await ours.oid(), - type: "blob", - path: path2 - }; - } - if (base && !ours && !theirs && await base.type() === "blob") { - return void 0; - } - throw new MergeNotSupportedError(); - } - } - }, - /** - * @param {TreeEntry} [parent] - * @param {Array} children - */ - reduce: unmergedFiles.length !== 0 && (!dir || abortOnConflict) ? void 0 : async (parent, children2) => { - const entries = children2.filter(Boolean); - if (!parent) return; - if (parent && parent.type === "tree" && entries.length === 0) return; - if (entries.length > 0) { - const tree = new GitTree(entries); - const object = tree.toObject(); - const oid = await _writeObject({ - fs, - gitdir, - type: "tree", - object, - dryRun - }); - parent.oid = oid; - } - return parent; - } - }); - if (unmergedFiles.length !== 0) { - if (dir && !abortOnConflict) { - await _walk({ - fs, - cache, - dir, - gitdir, - trees: [TREE({ ref: results.oid })], - map: async function(filepath, [entry]) { - const path2 = `${dir}/${filepath}`; - if (await entry.type() === "blob") { - const mode = await entry.mode(); - const content = new TextDecoder().decode(await entry.content()); - await fs.write(path2, content, { mode }); - } - return true; - } - }); - } - return new MergeConflictError( - unmergedFiles, - bothModified, - deleteByUs, - deleteByTheirs - ); - } - return results.oid; -} -async function mergeBlobs({ - fs, - gitdir, - path: path2, - ours, - base, - theirs, - ourName, - theirName, - baseName, - dryRun, - mergeDriver = mergeFile -}) { - const type = "blob"; - const mode = await base.mode() === await ours.mode() ? await theirs.mode() : await ours.mode(); - if (await ours.oid() === await theirs.oid()) { - return { - cleanMerge: true, - mergeResult: { mode, path: path2, oid: await ours.oid(), type } - }; - } - if (await ours.oid() === await base.oid()) { - return { - cleanMerge: true, - mergeResult: { mode, path: path2, oid: await theirs.oid(), type } - }; - } - if (await theirs.oid() === await base.oid()) { - return { - cleanMerge: true, - mergeResult: { mode, path: path2, oid: await ours.oid(), type } - }; - } - const ourContent = Buffer.from(await ours.content()).toString("utf8"); - const baseContent = Buffer.from(await base.content()).toString("utf8"); - const theirContent = Buffer.from(await theirs.content()).toString("utf8"); - const { mergedText, cleanMerge } = await mergeDriver({ - branches: [baseName, ourName, theirName], - contents: [baseContent, ourContent, theirContent], - path: path2 - }); - const oid = await _writeObject({ - fs, - gitdir, - type: "blob", - object: Buffer.from(mergedText, "utf8"), - dryRun - }); - return { cleanMerge, mergeResult: { mode, path: path2, oid, type } }; -} -async function _merge({ - fs, - cache, - dir, - gitdir, - ours, - theirs, - fastForward: fastForward2 = true, - fastForwardOnly = false, - dryRun = false, - noUpdateBranch = false, - abortOnConflict = true, - message, - author, - committer, - signingKey, - onSign, - mergeDriver -}) { - if (ours === void 0) { - ours = await _currentBranch({ fs, gitdir, fullname: true }); - } - ours = await GitRefManager.expand({ - fs, - gitdir, - ref: ours - }); - theirs = await GitRefManager.expand({ - fs, - gitdir, - ref: theirs - }); - const ourOid = await GitRefManager.resolve({ - fs, - gitdir, - ref: ours - }); - const theirOid = await GitRefManager.resolve({ - fs, - gitdir, - ref: theirs - }); - const baseOids = await _findMergeBase({ - fs, - cache, - gitdir, - oids: [ourOid, theirOid] - }); - if (baseOids.length !== 1) { - throw new MergeNotSupportedError(); - } - const baseOid = baseOids[0]; - if (baseOid === theirOid) { - return { - oid: ourOid, - alreadyMerged: true - }; - } - if (fastForward2 && baseOid === ourOid) { - if (!dryRun && !noUpdateBranch) { - await GitRefManager.writeRef({ fs, gitdir, ref: ours, value: theirOid }); - } - return { - oid: theirOid, - fastForward: true - }; - } else { - if (fastForwardOnly) { - throw new FastForwardError(); - } - const tree = await GitIndexManager.acquire( - { fs, gitdir, cache, allowUnmerged: false }, - async (index2) => { - return mergeTree({ - fs, - cache, - dir, - gitdir, - index: index2, - ourOid, - theirOid, - baseOid, - ourName: abbreviateRef(ours), - baseName: "base", - theirName: abbreviateRef(theirs), - dryRun, - abortOnConflict, - mergeDriver - }); - } - ); - if (tree instanceof MergeConflictError) throw tree; - if (!message) { - message = `Merge branch '${abbreviateRef(theirs)}' into ${abbreviateRef( - ours - )}`; - } - const oid = await _commit({ - fs, - cache, - gitdir, - message, - ref: ours, - tree, - parent: [ourOid, theirOid], - author, - committer, - signingKey, - onSign, - dryRun, - noUpdateBranch - }); - return { - oid, - tree, - mergeCommit: true - }; - } -} -async function _pull({ - fs, - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - dir, - gitdir, - ref, - url, - remote, - remoteRef, - prune, - pruneTags, - fastForward: fastForward2, - fastForwardOnly, - corsProxy, - singleBranch, - headers, - author, - committer, - signingKey -}) { - try { - if (!ref) { - const head = await _currentBranch({ fs, gitdir }); - if (!head) { - throw new MissingParameterError("ref"); - } - ref = head; - } - const { fetchHead, fetchHeadDescription } = await _fetch({ - fs, - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - gitdir, - corsProxy, - ref, - url, - remote, - remoteRef, - singleBranch, - headers, - prune, - pruneTags - }); - await _merge({ - fs, - cache, - gitdir, - ours: ref, - theirs: fetchHead, - fastForward: fastForward2, - fastForwardOnly, - message: `Merge ${fetchHeadDescription}`, - author, - committer, - signingKey, - dryRun: false, - noUpdateBranch: false - }); - await _checkout({ - fs, - cache, - onProgress, - dir, - gitdir, - ref, - remote, - noCheckout: false - }); - } catch (err) { - err.caller = "git.pull"; - throw err; - } -} -async function fastForward({ - fs, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - dir, - gitdir = join(dir, ".git"), - ref, - url, - remote, - remoteRef, - corsProxy, - singleBranch, - headers = {}, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("http", http); - assertParameter("gitdir", gitdir); - const thisWillNotBeUsed = { - name: "", - email: "", - timestamp: Date.now(), - timezoneOffset: 0 - }; - return await _pull({ - fs: new FileSystem(fs), - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - dir, - gitdir, - ref, - url, - remote, - remoteRef, - fastForwardOnly: true, - corsProxy, - singleBranch, - headers, - author: thisWillNotBeUsed, - committer: thisWillNotBeUsed - }); - } catch (err) { - err.caller = "git.fastForward"; - throw err; - } -} -async function fetch({ - fs, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - dir, - gitdir = join(dir, ".git"), - ref, - remote, - remoteRef, - url, - corsProxy, - depth = null, - since = null, - exclude = [], - relative: relative2 = false, - tags = false, - singleBranch = false, - headers = {}, - prune = false, - pruneTags = false, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("http", http); - assertParameter("gitdir", gitdir); - return await _fetch({ - fs: new FileSystem(fs), - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - gitdir, - ref, - remote, - remoteRef, - url, - corsProxy, - depth, - since, - exclude, - relative: relative2, - tags, - singleBranch, - headers, - prune, - pruneTags - }); - } catch (err) { - err.caller = "git.fetch"; - throw err; - } -} -async function findMergeBase({ - fs, - dir, - gitdir = join(dir, ".git"), - oids, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oids", oids); - return await _findMergeBase({ - fs: new FileSystem(fs), - cache, - gitdir, - oids - }); - } catch (err) { - err.caller = "git.findMergeBase"; - throw err; - } -} -async function _findRoot({ fs, filepath }) { - if (await fs.exists(join(filepath, ".git"))) { - return filepath; - } else { - const parent = dirname(filepath); - if (parent === filepath) { - throw new NotFoundError(`git root for ${filepath}`); - } - return _findRoot({ fs, filepath: parent }); - } -} -async function findRoot({ fs, filepath }) { - try { - assertParameter("fs", fs); - assertParameter("filepath", filepath); - return await _findRoot({ fs: new FileSystem(fs), filepath }); - } catch (err) { - err.caller = "git.findRoot"; - throw err; - } -} -async function getConfig({ fs, dir, gitdir = join(dir, ".git"), path: path2 }) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("path", path2); - return await _getConfig({ - fs: new FileSystem(fs), - gitdir, - path: path2 - }); - } catch (err) { - err.caller = "git.getConfig"; - throw err; - } -} -async function _getConfigAll({ fs, gitdir, path: path2 }) { - const config = await GitConfigManager.get({ fs, gitdir }); - return config.getall(path2); -} -async function getConfigAll({ - fs, - dir, - gitdir = join(dir, ".git"), - path: path2 -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("path", path2); - return await _getConfigAll({ - fs: new FileSystem(fs), - gitdir, - path: path2 - }); - } catch (err) { - err.caller = "git.getConfigAll"; - throw err; - } -} -async function getRemoteInfo({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - url, - headers = {}, - forPush = false -}) { - try { - assertParameter("http", http); - assertParameter("url", url); - const GitRemoteHTTP2 = GitRemoteManager.getRemoteHelperFor({ url }); - const remote = await GitRemoteHTTP2.discover({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - service: forPush ? "git-receive-pack" : "git-upload-pack", - url, - headers, - protocolVersion: 1 - }); - const result = { - capabilities: [...remote.capabilities] - }; - for (const [ref, oid] of remote.refs) { - const parts = ref.split("/"); - const last2 = parts.pop(); - let o = result; - for (const part of parts) { - o[part] = o[part] || {}; - o = o[part]; - } - o[last2] = oid; - } - for (const [symref, ref] of remote.symrefs) { - const parts = symref.split("/"); - const last2 = parts.pop(); - let o = result; - for (const part of parts) { - o[part] = o[part] || {}; - o = o[part]; - } - o[last2] = ref; - } - return result; - } catch (err) { - err.caller = "git.getRemoteInfo"; - throw err; - } -} -function formatInfoRefs(remote, prefix, symrefs, peelTags) { - const refs = []; - for (const [key2, value] of remote.refs) { - if (prefix && !key2.startsWith(prefix)) continue; - if (key2.endsWith("^{}")) { - if (peelTags) { - const _key = key2.replace("^{}", ""); - const last2 = refs[refs.length - 1]; - const r = last2.ref === _key ? last2 : refs.find((x) => x.ref === _key); - if (r === void 0) { - throw new Error("I did not expect this to happen"); - } - r.peeled = value; - } - continue; - } - const ref = { ref: key2, oid: value }; - if (symrefs) { - if (remote.symrefs.has(key2)) { - ref.target = remote.symrefs.get(key2); - } - } - refs.push(ref); - } - return refs; -} -async function getRemoteInfo2({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - url, - headers = {}, - forPush = false, - protocolVersion = 2 -}) { - try { - assertParameter("http", http); - assertParameter("url", url); - const GitRemoteHTTP2 = GitRemoteManager.getRemoteHelperFor({ url }); - const remote = await GitRemoteHTTP2.discover({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - service: forPush ? "git-receive-pack" : "git-upload-pack", - url, - headers, - protocolVersion - }); - if (remote.protocolVersion === 2) { - return { - protocolVersion: remote.protocolVersion, - capabilities: remote.capabilities2 - }; - } - const capabilities = {}; - for (const cap of remote.capabilities) { - const [key2, value] = cap.split("="); - if (value) { - capabilities[key2] = value; - } else { - capabilities[key2] = true; - } - } - return { - protocolVersion: 1, - capabilities, - refs: formatInfoRefs(remote, void 0, true, true) - }; - } catch (err) { - err.caller = "git.getRemoteInfo2"; - throw err; - } -} -async function hashObject({ - type, - object, - format = "content", - oid = void 0 -}) { - if (format !== "deflated") { - if (format !== "wrapped") { - object = GitObject.wrap({ type, object }); - } - oid = await shasum(object); - } - return { oid, object }; -} -async function hashBlob({ object }) { - try { - assertParameter("object", object); - if (typeof object === "string") { - object = Buffer.from(object, "utf8"); - } else { - object = Buffer.from(object); - } - const type = "blob"; - const { oid, object: _object } = await hashObject({ - type: "blob", - format: "content", - object - }); - return { oid, type, object: new Uint8Array(_object), format: "wrapped" }; - } catch (err) { - err.caller = "git.hashBlob"; - throw err; - } -} -async function _indexPack({ - fs, - cache, - onProgress, - dir, - gitdir, - filepath -}) { - try { - filepath = join(dir, filepath); - const pack = await fs.read(filepath); - const getExternalRefDelta = (oid) => _readObject({ fs, cache, gitdir, oid }); - const idx = await GitPackIndex.fromPack({ - pack, - getExternalRefDelta, - onProgress - }); - await fs.write(filepath.replace(/\.pack$/, ".idx"), await idx.toBuffer()); - return { - oids: [...idx.hashes] - }; - } catch (err) { - err.caller = "git.indexPack"; - throw err; - } -} -async function indexPack({ - fs, - onProgress, - dir, - gitdir = join(dir, ".git"), - filepath, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("dir", dir); - assertParameter("gitdir", dir); - assertParameter("filepath", filepath); - return await _indexPack({ - fs: new FileSystem(fs), - cache, - onProgress, - dir, - gitdir, - filepath - }); - } catch (err) { - err.caller = "git.indexPack"; - throw err; - } -} -async function init({ - fs, - bare = false, - dir, - gitdir = bare ? dir : join(dir, ".git"), - defaultBranch = "master" -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - if (!bare) { - assertParameter("dir", dir); - } - return await _init({ - fs: new FileSystem(fs), - bare, - dir, - gitdir, - defaultBranch - }); - } catch (err) { - err.caller = "git.init"; - throw err; - } -} -async function _isDescendent({ - fs, - cache, - gitdir, - oid, - ancestor, - depth -}) { - const shallows = await GitShallowManager.read({ fs, gitdir }); - if (!oid) { - throw new MissingParameterError("oid"); - } - if (!ancestor) { - throw new MissingParameterError("ancestor"); - } - if (oid === ancestor) return false; - const queue = [oid]; - const visited = /* @__PURE__ */ new Set(); - let searchdepth = 0; - while (queue.length) { - if (searchdepth++ === depth) { - throw new MaxDepthError(depth); - } - const oid2 = queue.shift(); - const { type, object } = await _readObject({ - fs, - cache, - gitdir, - oid: oid2 - }); - if (type !== "commit") { - throw new ObjectTypeError(oid2, type, "commit"); - } - const commit2 = GitCommit.from(object).parse(); - for (const parent of commit2.parent) { - if (parent === ancestor) return true; - } - if (!shallows.has(oid2)) { - for (const parent of commit2.parent) { - if (!visited.has(parent)) { - queue.push(parent); - visited.add(parent); - } - } - } - } - return false; -} -async function isDescendent({ - fs, - dir, - gitdir = join(dir, ".git"), - oid, - ancestor, - depth = -1, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - assertParameter("ancestor", ancestor); - return await _isDescendent({ - fs: new FileSystem(fs), - cache, - gitdir, - oid, - ancestor, - depth - }); - } catch (err) { - err.caller = "git.isDescendent"; - throw err; - } -} -async function isIgnored({ - fs, - dir, - gitdir = join(dir, ".git"), - filepath -}) { - try { - assertParameter("fs", fs); - assertParameter("dir", dir); - assertParameter("gitdir", gitdir); - assertParameter("filepath", filepath); - return GitIgnoreManager.isIgnored({ - fs: new FileSystem(fs), - dir, - gitdir, - filepath - }); - } catch (err) { - err.caller = "git.isIgnored"; - throw err; - } -} -async function listBranches({ - fs, - dir, - gitdir = join(dir, ".git"), - remote -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - return GitRefManager.listBranches({ - fs: new FileSystem(fs), - gitdir, - remote - }); - } catch (err) { - err.caller = "git.listBranches"; - throw err; - } -} -async function _listFiles({ fs, gitdir, ref, cache }) { - if (ref) { - const oid = await GitRefManager.resolve({ gitdir, fs, ref }); - const filenames = []; - await accumulateFilesFromOid({ - fs, - cache, - gitdir, - oid, - filenames, - prefix: "" - }); - return filenames; - } else { - return GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - return index2.entries.map((x) => x.path); - }); - } -} -async function accumulateFilesFromOid({ - fs, - cache, - gitdir, - oid, - filenames, - prefix -}) { - const { tree } = await _readTree({ fs, cache, gitdir, oid }); - for (const entry of tree) { - if (entry.type === "tree") { - await accumulateFilesFromOid({ - fs, - cache, - gitdir, - oid: entry.oid, - filenames, - prefix: join(prefix, entry.path) - }); - } else { - filenames.push(join(prefix, entry.path)); - } - } -} -async function listFiles({ - fs, - dir, - gitdir = join(dir, ".git"), - ref, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - return await _listFiles({ - fs: new FileSystem(fs), - cache, - gitdir, - ref - }); - } catch (err) { - err.caller = "git.listFiles"; - throw err; - } -} -async function _listNotes({ fs, cache, gitdir, ref }) { - let parent; - try { - parent = await GitRefManager.resolve({ gitdir, fs, ref }); - } catch (err) { - if (err instanceof NotFoundError) { - return []; - } - } - const result = await _readTree({ - fs, - cache, - gitdir, - oid: parent - }); - const notes = result.tree.map((entry) => ({ - target: entry.path, - note: entry.oid - })); - return notes; -} -async function listNotes({ - fs, - dir, - gitdir = join(dir, ".git"), - ref = "refs/notes/commits", - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - return await _listNotes({ - fs: new FileSystem(fs), - cache, - gitdir, - ref - }); - } catch (err) { - err.caller = "git.listNotes"; - throw err; - } -} -async function _listRemotes({ fs, gitdir }) { - const config = await GitConfigManager.get({ fs, gitdir }); - const remoteNames = await config.getSubsections("remote"); - const remotes = Promise.all( - remoteNames.map(async (remote) => { - const url = await config.get(`remote.${remote}.url`); - return { remote, url }; - }) - ); - return remotes; -} -async function listRemotes({ fs, dir, gitdir = join(dir, ".git") }) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - return await _listRemotes({ - fs: new FileSystem(fs), - gitdir - }); - } catch (err) { - err.caller = "git.listRemotes"; - throw err; - } -} -async function parseListRefsResponse(stream) { - const read = GitPktLine.streamReader(stream); - const refs = []; - let line; - while (true) { - line = await read(); - if (line === true) break; - if (line === null) continue; - line = line.toString("utf8").replace(/\n$/, ""); - const [oid, ref, ...attrs] = line.split(" "); - const r = { ref, oid }; - for (const attr2 of attrs) { - const [name, value] = attr2.split(":"); - if (name === "symref-target") { - r.target = value; - } else if (name === "peeled") { - r.peeled = value; - } - } - refs.push(r); - } - return refs; -} -async function writeListRefsRequest({ prefix, symrefs, peelTags }) { - const packstream = []; - packstream.push(GitPktLine.encode("command=ls-refs\n")); - packstream.push(GitPktLine.encode(`agent=${pkg.agent} -`)); - if (peelTags || symrefs || prefix) { - packstream.push(GitPktLine.delim()); - } - if (peelTags) packstream.push(GitPktLine.encode("peel")); - if (symrefs) packstream.push(GitPktLine.encode("symrefs")); - if (prefix) packstream.push(GitPktLine.encode(`ref-prefix ${prefix}`)); - packstream.push(GitPktLine.flush()); - return packstream; -} -async function listServerRefs({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - url, - headers = {}, - forPush = false, - protocolVersion = 2, - prefix, - symrefs, - peelTags -}) { - try { - assertParameter("http", http); - assertParameter("url", url); - const remote = await GitRemoteHTTP.discover({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - service: forPush ? "git-receive-pack" : "git-upload-pack", - url, - headers, - protocolVersion - }); - if (remote.protocolVersion === 1) { - return formatInfoRefs(remote, prefix, symrefs, peelTags); - } - const body = await writeListRefsRequest({ prefix, symrefs, peelTags }); - const res = await GitRemoteHTTP.connect({ - http, - auth: remote.auth, - headers, - corsProxy, - service: forPush ? "git-receive-pack" : "git-upload-pack", - url, - body - }); - return parseListRefsResponse(res.body); - } catch (err) { - err.caller = "git.listServerRefs"; - throw err; - } -} -async function listTags({ fs, dir, gitdir = join(dir, ".git") }) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - return GitRefManager.listTags({ fs: new FileSystem(fs), gitdir }); - } catch (err) { - err.caller = "git.listTags"; - throw err; - } -} -function compareAge(a, b) { - return a.committer.timestamp - b.committer.timestamp; -} -var EMPTY_OID = "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"; -async function resolveFileIdInTree({ fs, cache, gitdir, oid, fileId }) { - if (fileId === EMPTY_OID) return; - const _oid = oid; - let filepath; - const result = await resolveTree({ fs, cache, gitdir, oid }); - const tree = result.tree; - if (fileId === result.oid) { - filepath = result.path; - } else { - filepath = await _resolveFileId({ - fs, - cache, - gitdir, - tree, - fileId, - oid: _oid - }); - if (Array.isArray(filepath)) { - if (filepath.length === 0) filepath = void 0; - else if (filepath.length === 1) filepath = filepath[0]; - } - } - return filepath; -} -async function _resolveFileId({ - fs, - cache, - gitdir, - tree, - fileId, - oid, - filepaths = [], - parentPath = "" -}) { - const walks = tree.entries().map(function(entry) { - let result; - if (entry.oid === fileId) { - result = join(parentPath, entry.path); - filepaths.push(result); - } else if (entry.type === "tree") { - result = _readObject({ - fs, - cache, - gitdir, - oid: entry.oid - }).then(function({ object }) { - return _resolveFileId({ - fs, - cache, - gitdir, - tree: GitTree.from(object), - fileId, - oid, - filepaths, - parentPath: join(parentPath, entry.path) - }); - }); - } - return result; - }); - await Promise.all(walks); - return filepaths; -} -async function _log({ - fs, - cache, - gitdir, - filepath, - ref, - depth, - since, - force, - follow -}) { - const sinceTimestamp = typeof since === "undefined" ? void 0 : Math.floor(since.valueOf() / 1e3); - const commits = []; - const shallowCommits = await GitShallowManager.read({ fs, gitdir }); - const oid = await GitRefManager.resolve({ fs, gitdir, ref }); - const tips = [await _readCommit({ fs, cache, gitdir, oid })]; - let lastFileOid; - let lastCommit; - let isOk; - function endCommit(commit2) { - if (isOk && filepath) commits.push(commit2); - } - while (tips.length > 0) { - const commit2 = tips.pop(); - if (sinceTimestamp !== void 0 && commit2.commit.committer.timestamp <= sinceTimestamp) { - break; - } - if (filepath) { - let vFileOid; - try { - vFileOid = await resolveFilepath({ - fs, - cache, - gitdir, - oid: commit2.commit.tree, - filepath - }); - if (lastCommit && lastFileOid !== vFileOid) { - commits.push(lastCommit); - } - lastFileOid = vFileOid; - lastCommit = commit2; - isOk = true; - } catch (e) { - if (e instanceof NotFoundError) { - let found = follow && lastFileOid; - if (found) { - found = await resolveFileIdInTree({ - fs, - cache, - gitdir, - oid: commit2.commit.tree, - fileId: lastFileOid - }); - if (found) { - if (Array.isArray(found)) { - if (lastCommit) { - const lastFound = await resolveFileIdInTree({ - fs, - cache, - gitdir, - oid: lastCommit.commit.tree, - fileId: lastFileOid - }); - if (Array.isArray(lastFound)) { - found = found.filter((p) => lastFound.indexOf(p) === -1); - if (found.length === 1) { - found = found[0]; - filepath = found; - if (lastCommit) commits.push(lastCommit); - } else { - found = false; - if (lastCommit) commits.push(lastCommit); - break; - } - } - } - } else { - filepath = found; - if (lastCommit) commits.push(lastCommit); - } - } - } - if (!found) { - if (isOk && lastFileOid) { - commits.push(lastCommit); - if (!force) break; - } - if (!force && !follow) throw e; - } - lastCommit = commit2; - isOk = false; - } else throw e; - } - } else { - commits.push(commit2); - } - if (depth !== void 0 && commits.length === depth) { - endCommit(commit2); - break; - } - if (!shallowCommits.has(commit2.oid)) { - for (const oid2 of commit2.commit.parent) { - const commit3 = await _readCommit({ fs, cache, gitdir, oid: oid2 }); - if (!tips.map((commit4) => commit4.oid).includes(commit3.oid)) { - tips.push(commit3); - } - } - } - if (tips.length === 0) { - endCommit(commit2); - } - tips.sort((a, b) => compareAge(a.commit, b.commit)); - } - return commits; -} -async function log({ - fs, - dir, - gitdir = join(dir, ".git"), - filepath, - ref = "HEAD", - depth, - since, - // Date - force, - follow, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - return await _log({ - fs: new FileSystem(fs), - cache, - gitdir, - filepath, - ref, - depth, - since, - force, - follow - }); - } catch (err) { - err.caller = "git.log"; - throw err; - } -} -async function merge({ - fs: _fs, - onSign, - dir, - gitdir = join(dir, ".git"), - ours, - theirs, - fastForward: fastForward2 = true, - fastForwardOnly = false, - dryRun = false, - noUpdateBranch = false, - abortOnConflict = true, - message, - author: _author, - committer: _committer, - signingKey, - cache = {}, - mergeDriver -}) { - try { - assertParameter("fs", _fs); - if (signingKey) { - assertParameter("onSign", onSign); - } - const fs = new FileSystem(_fs); - const author = await normalizeAuthorObject({ fs, gitdir, author: _author }); - if (!author && (!fastForwardOnly || !fastForward2)) { - throw new MissingNameError("author"); - } - const committer = await normalizeCommitterObject({ - fs, - gitdir, - author, - committer: _committer - }); - if (!committer && (!fastForwardOnly || !fastForward2)) { - throw new MissingNameError("committer"); - } - return await _merge({ - fs, - cache, - dir, - gitdir, - ours, - theirs, - fastForward: fastForward2, - fastForwardOnly, - dryRun, - noUpdateBranch, - abortOnConflict, - message, - author, - committer, - signingKey, - onSign, - mergeDriver - }); - } catch (err) { - err.caller = "git.merge"; - throw err; - } -} -var types = { - commit: 16, - tree: 32, - blob: 48, - tag: 64, - ofs_delta: 96, - ref_delta: 112 -}; -async function _pack({ - fs, - cache, - dir, - gitdir = join(dir, ".git"), - oids -}) { - const hash2 = new import_sha1.default(); - const outputStream = []; - function write(chunk, enc) { - const buff = Buffer.from(chunk, enc); - outputStream.push(buff); - hash2.update(buff); - } - async function writeObject2({ stype, object }) { - const type = types[stype]; - let length = object.length; - let multibyte = length > 15 ? 128 : 0; - const lastFour = length & 15; - length = length >>> 4; - let byte = (multibyte | type | lastFour).toString(16); - write(byte, "hex"); - while (multibyte) { - multibyte = length > 127 ? 128 : 0; - byte = multibyte | length & 127; - write(padHex(2, byte), "hex"); - length = length >>> 7; - } - write(Buffer.from(await deflate(object))); - } - write("PACK"); - write("00000002", "hex"); - write(padHex(8, oids.length), "hex"); - for (const oid of oids) { - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - await writeObject2({ write, object, stype: type }); - } - const digest = hash2.digest(); - outputStream.push(digest); - return outputStream; -} -async function _packObjects({ fs, cache, gitdir, oids, write }) { - const buffers = await _pack({ fs, cache, gitdir, oids }); - const packfile = Buffer.from(await collect(buffers)); - const packfileSha = packfile.slice(-20).toString("hex"); - const filename = `pack-${packfileSha}.pack`; - if (write) { - await fs.write(join(gitdir, `objects/pack/${filename}`), packfile); - return { filename }; - } - return { - filename, - packfile: new Uint8Array(packfile) - }; -} -async function packObjects({ - fs, - dir, - gitdir = join(dir, ".git"), - oids, - write = false, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oids", oids); - return await _packObjects({ - fs: new FileSystem(fs), - cache, - gitdir, - oids, - write - }); - } catch (err) { - err.caller = "git.packObjects"; - throw err; - } -} -async function pull({ - fs: _fs, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - dir, - gitdir = join(dir, ".git"), - ref, - url, - remote, - remoteRef, - prune = false, - pruneTags = false, - fastForward: fastForward2 = true, - fastForwardOnly = false, - corsProxy, - singleBranch, - headers = {}, - author: _author, - committer: _committer, - signingKey, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - const fs = new FileSystem(_fs); - const author = await normalizeAuthorObject({ fs, gitdir, author: _author }); - if (!author) throw new MissingNameError("author"); - const committer = await normalizeCommitterObject({ - fs, - gitdir, - author, - committer: _committer - }); - if (!committer) throw new MissingNameError("committer"); - return await _pull({ - fs, - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - dir, - gitdir, - ref, - url, - remote, - remoteRef, - fastForward: fastForward2, - fastForwardOnly, - corsProxy, - singleBranch, - headers, - author, - committer, - signingKey, - prune, - pruneTags - }); - } catch (err) { - err.caller = "git.pull"; - throw err; - } -} -async function listCommitsAndTags({ - fs, - cache, - dir, - gitdir = join(dir, ".git"), - start, - finish -}) { - const shallows = await GitShallowManager.read({ fs, gitdir }); - const startingSet = /* @__PURE__ */ new Set(); - const finishingSet = /* @__PURE__ */ new Set(); - for (const ref of start) { - startingSet.add(await GitRefManager.resolve({ fs, gitdir, ref })); - } - for (const ref of finish) { - try { - const oid = await GitRefManager.resolve({ fs, gitdir, ref }); - finishingSet.add(oid); - } catch (err) { - } - } - const visited = /* @__PURE__ */ new Set(); - async function walk2(oid) { - visited.add(oid); - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - if (type === "tag") { - const tag2 = GitAnnotatedTag.from(object); - const commit2 = tag2.headers().object; - return walk2(commit2); - } - if (type !== "commit") { - throw new ObjectTypeError(oid, type, "commit"); - } - if (!shallows.has(oid)) { - const commit2 = GitCommit.from(object); - const parents = commit2.headers().parent; - for (oid of parents) { - if (!finishingSet.has(oid) && !visited.has(oid)) { - await walk2(oid); - } - } - } - } - for (const oid of startingSet) { - await walk2(oid); - } - return visited; -} -async function listObjects({ - fs, - cache, - dir, - gitdir = join(dir, ".git"), - oids -}) { - const visited = /* @__PURE__ */ new Set(); - async function walk2(oid) { - if (visited.has(oid)) return; - visited.add(oid); - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - if (type === "tag") { - const tag2 = GitAnnotatedTag.from(object); - const obj = tag2.headers().object; - await walk2(obj); - } else if (type === "commit") { - const commit2 = GitCommit.from(object); - const tree = commit2.headers().tree; - await walk2(tree); - } else if (type === "tree") { - const tree = GitTree.from(object); - for (const entry of tree) { - if (entry.type === "blob") { - visited.add(entry.oid); - } - if (entry.type === "tree") { - await walk2(entry.oid); - } - } - } - } - for (const oid of oids) { - await walk2(oid); - } - return visited; -} -async function parseReceivePackResponse(packfile) { - const result = {}; - let response = ""; - const read = GitPktLine.streamReader(packfile); - let line = await read(); - while (line !== true) { - if (line !== null) response += line.toString("utf8") + "\n"; - line = await read(); - } - const lines = response.toString("utf8").split("\n"); - line = lines.shift(); - if (!line.startsWith("unpack ")) { - throw new ParseError('unpack ok" or "unpack [error message]', line); - } - result.ok = line === "unpack ok"; - if (!result.ok) { - result.error = line.slice("unpack ".length); - } - result.refs = {}; - for (const line2 of lines) { - if (line2.trim() === "") continue; - const status2 = line2.slice(0, 2); - const refAndMessage = line2.slice(3); - let space2 = refAndMessage.indexOf(" "); - if (space2 === -1) space2 = refAndMessage.length; - const ref = refAndMessage.slice(0, space2); - const error = refAndMessage.slice(space2 + 1); - result.refs[ref] = { - ok: status2 === "ok", - error - }; - } - return result; -} -async function writeReceivePackRequest({ - capabilities = [], - triplets = [] -}) { - const packstream = []; - let capsFirstLine = `\0 ${capabilities.join(" ")}`; - for (const trip of triplets) { - packstream.push( - GitPktLine.encode( - `${trip.oldoid} ${trip.oid} ${trip.fullRef}${capsFirstLine} -` - ) - ); - capsFirstLine = ""; - } - packstream.push(GitPktLine.flush()); - return packstream; -} -async function _push({ - fs, - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - onPrePush, - gitdir, - ref: _ref, - remoteRef: _remoteRef, - remote, - url: _url, - force = false, - delete: _delete = false, - corsProxy, - headers = {} -}) { - const ref = _ref || await _currentBranch({ fs, gitdir }); - if (typeof ref === "undefined") { - throw new MissingParameterError("ref"); - } - const config = await GitConfigManager.get({ fs, gitdir }); - remote = remote || await config.get(`branch.${ref}.pushRemote`) || await config.get("remote.pushDefault") || await config.get(`branch.${ref}.remote`) || "origin"; - const url = _url || await config.get(`remote.${remote}.pushurl`) || await config.get(`remote.${remote}.url`); - if (typeof url === "undefined") { - throw new MissingParameterError("remote OR url"); - } - const remoteRef = _remoteRef || await config.get(`branch.${ref}.merge`); - if (typeof url === "undefined") { - throw new MissingParameterError("remoteRef"); - } - if (corsProxy === void 0) { - corsProxy = await config.get("http.corsProxy"); - } - const fullRef = await GitRefManager.expand({ fs, gitdir, ref }); - const oid = _delete ? "0000000000000000000000000000000000000000" : await GitRefManager.resolve({ fs, gitdir, ref: fullRef }); - const GitRemoteHTTP2 = GitRemoteManager.getRemoteHelperFor({ url }); - const httpRemote = await GitRemoteHTTP2.discover({ - http, - onAuth, - onAuthSuccess, - onAuthFailure, - corsProxy, - service: "git-receive-pack", - url, - headers, - protocolVersion: 1 - }); - const auth = httpRemote.auth; - let fullRemoteRef; - if (!remoteRef) { - fullRemoteRef = fullRef; - } else { - try { - fullRemoteRef = await GitRefManager.expandAgainstMap({ - ref: remoteRef, - map: httpRemote.refs - }); - } catch (err) { - if (err instanceof NotFoundError) { - fullRemoteRef = remoteRef.startsWith("refs/") ? remoteRef : `refs/heads/${remoteRef}`; - } else { - throw err; - } - } - } - const oldoid = httpRemote.refs.get(fullRemoteRef) || "0000000000000000000000000000000000000000"; - if (onPrePush) { - const hookCancel = await onPrePush({ - remote, - url, - localRef: { ref: _delete ? "(delete)" : fullRef, oid }, - remoteRef: { ref: fullRemoteRef, oid: oldoid } - }); - if (!hookCancel) throw new UserCanceledError(); - } - const thinPack = !httpRemote.capabilities.has("no-thin"); - let objects = /* @__PURE__ */ new Set(); - if (!_delete) { - const finish = [...httpRemote.refs.values()]; - let skipObjects = /* @__PURE__ */ new Set(); - if (oldoid !== "0000000000000000000000000000000000000000") { - const mergebase = await _findMergeBase({ - fs, - cache, - gitdir, - oids: [oid, oldoid] - }); - for (const oid2 of mergebase) finish.push(oid2); - if (thinPack) { - skipObjects = await listObjects({ fs, cache, gitdir, oids: mergebase }); - } - } - if (!finish.includes(oid)) { - const commits = await listCommitsAndTags({ - fs, - cache, - gitdir, - start: [oid], - finish - }); - objects = await listObjects({ fs, cache, gitdir, oids: commits }); - } - if (thinPack) { - try { - const ref2 = await GitRefManager.resolve({ - fs, - gitdir, - ref: `refs/remotes/${remote}/HEAD`, - depth: 2 - }); - const { oid: oid2 } = await GitRefManager.resolveAgainstMap({ - ref: ref2.replace(`refs/remotes/${remote}/`, ""), - fullref: ref2, - map: httpRemote.refs - }); - const oids = [oid2]; - for (const oid3 of await listObjects({ fs, cache, gitdir, oids })) { - skipObjects.add(oid3); - } - } catch (e) { - } - for (const oid2 of skipObjects) { - objects.delete(oid2); - } - } - if (oid === oldoid) force = true; - if (!force) { - if (fullRef.startsWith("refs/tags") && oldoid !== "0000000000000000000000000000000000000000") { - throw new PushRejectedError("tag-exists"); - } - if (oid !== "0000000000000000000000000000000000000000" && oldoid !== "0000000000000000000000000000000000000000" && !await _isDescendent({ - fs, - cache, - gitdir, - oid, - ancestor: oldoid, - depth: -1 - })) { - throw new PushRejectedError("not-fast-forward"); - } - } - } - const capabilities = filterCapabilities( - [...httpRemote.capabilities], - ["report-status", "side-band-64k", `agent=${pkg.agent}`] - ); - const packstream1 = await writeReceivePackRequest({ - capabilities, - triplets: [{ oldoid, oid, fullRef: fullRemoteRef }] - }); - const packstream2 = _delete ? [] : await _pack({ - fs, - cache, - gitdir, - oids: [...objects] - }); - const res = await GitRemoteHTTP2.connect({ - http, - onProgress, - corsProxy, - service: "git-receive-pack", - url, - auth, - headers, - body: [...packstream1, ...packstream2] - }); - const { packfile, progress } = await GitSideBand.demux(res.body); - if (onMessage) { - const lines = splitLines(progress); - forAwait(lines, async (line) => { - await onMessage(line); - }); - } - const result = await parseReceivePackResponse(packfile); - if (res.headers) { - result.headers = res.headers; - } - if (remote && result.ok && result.refs[fullRemoteRef].ok && !fullRef.startsWith("refs/tags")) { - const ref2 = `refs/remotes/${remote}/${fullRemoteRef.replace( - "refs/heads", - "" - )}`; - if (_delete) { - await GitRefManager.deleteRef({ fs, gitdir, ref: ref2 }); - } else { - await GitRefManager.writeRef({ fs, gitdir, ref: ref2, value: oid }); - } - } - if (result.ok && Object.values(result.refs).every((result2) => result2.ok)) { - return result; - } else { - const prettyDetails = Object.entries(result.refs).filter(([k, v]) => !v.ok).map(([k, v]) => ` - - ${k}: ${v.error}`).join(""); - throw new GitPushError(prettyDetails, result); - } -} -async function push({ - fs, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - onPrePush, - dir, - gitdir = join(dir, ".git"), - ref, - remoteRef, - remote = "origin", - url, - force = false, - delete: _delete = false, - corsProxy, - headers = {}, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("http", http); - assertParameter("gitdir", gitdir); - return await _push({ - fs: new FileSystem(fs), - cache, - http, - onProgress, - onMessage, - onAuth, - onAuthSuccess, - onAuthFailure, - onPrePush, - gitdir, - ref, - remoteRef, - remote, - url, - force, - delete: _delete, - corsProxy, - headers - }); - } catch (err) { - err.caller = "git.push"; - throw err; - } -} -async function resolveBlob({ fs, cache, gitdir, oid }) { - const { type, object } = await _readObject({ fs, cache, gitdir, oid }); - if (type === "tag") { - oid = GitAnnotatedTag.from(object).parse().object; - return resolveBlob({ fs, cache, gitdir, oid }); - } - if (type !== "blob") { - throw new ObjectTypeError(oid, type, "blob"); - } - return { oid, blob: new Uint8Array(object) }; -} -async function _readBlob({ - fs, - cache, - gitdir, - oid, - filepath = void 0 -}) { - if (filepath !== void 0) { - oid = await resolveFilepath({ fs, cache, gitdir, oid, filepath }); - } - const blob = await resolveBlob({ - fs, - cache, - gitdir, - oid - }); - return blob; -} -async function readBlob({ - fs, - dir, - gitdir = join(dir, ".git"), - oid, - filepath, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - return await _readBlob({ - fs: new FileSystem(fs), - cache, - gitdir, - oid, - filepath - }); - } catch (err) { - err.caller = "git.readBlob"; - throw err; - } -} -async function readCommit({ - fs, - dir, - gitdir = join(dir, ".git"), - oid, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - return await _readCommit({ - fs: new FileSystem(fs), - cache, - gitdir, - oid - }); - } catch (err) { - err.caller = "git.readCommit"; - throw err; - } -} -async function _readNote({ - fs, - cache, - gitdir, - ref = "refs/notes/commits", - oid -}) { - const parent = await GitRefManager.resolve({ gitdir, fs, ref }); - const { blob } = await _readBlob({ - fs, - cache, - gitdir, - oid: parent, - filepath: oid - }); - return blob; -} -async function readNote({ - fs, - dir, - gitdir = join(dir, ".git"), - ref = "refs/notes/commits", - oid, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - assertParameter("oid", oid); - return await _readNote({ - fs: new FileSystem(fs), - cache, - gitdir, - ref, - oid - }); - } catch (err) { - err.caller = "git.readNote"; - throw err; - } -} -async function readObject({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - oid, - format = "parsed", - filepath = void 0, - encoding = void 0, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - const fs = new FileSystem(_fs); - if (filepath !== void 0) { - oid = await resolveFilepath({ - fs, - cache, - gitdir, - oid, - filepath - }); - } - const _format = format === "parsed" ? "content" : format; - const result = await _readObject({ - fs, - cache, - gitdir, - oid, - format: _format - }); - result.oid = oid; - if (format === "parsed") { - result.format = "parsed"; - switch (result.type) { - case "commit": - result.object = GitCommit.from(result.object).parse(); - break; - case "tree": - result.object = GitTree.from(result.object).entries(); - break; - case "blob": - if (encoding) { - result.object = result.object.toString(encoding); - } else { - result.object = new Uint8Array(result.object); - result.format = "content"; - } - break; - case "tag": - result.object = GitAnnotatedTag.from(result.object).parse(); - break; - default: - throw new ObjectTypeError( - result.oid, - result.type, - "blob|commit|tag|tree" - ); - } - } else if (result.format === "deflated" || result.format === "wrapped") { - result.type = result.format; - } - return result; - } catch (err) { - err.caller = "git.readObject"; - throw err; - } -} -async function _readTag({ fs, cache, gitdir, oid }) { - const { type, object } = await _readObject({ - fs, - cache, - gitdir, - oid, - format: "content" - }); - if (type !== "tag") { - throw new ObjectTypeError(oid, type, "tag"); - } - const tag2 = GitAnnotatedTag.from(object); - const result = { - oid, - tag: tag2.parse(), - payload: tag2.payload() - }; - return result; -} -async function readTag({ - fs, - dir, - gitdir = join(dir, ".git"), - oid, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - return await _readTag({ - fs: new FileSystem(fs), - cache, - gitdir, - oid - }); - } catch (err) { - err.caller = "git.readTag"; - throw err; - } -} -async function readTree({ - fs, - dir, - gitdir = join(dir, ".git"), - oid, - filepath = void 0, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - return await _readTree({ - fs: new FileSystem(fs), - cache, - gitdir, - oid, - filepath - }); - } catch (err) { - err.caller = "git.readTree"; - throw err; - } -} -async function remove({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - filepath, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("filepath", filepath); - await GitIndexManager.acquire( - { fs: new FileSystem(_fs), gitdir, cache }, - async function(index2) { - index2.delete({ filepath }); - } - ); - } catch (err) { - err.caller = "git.remove"; - throw err; - } -} -async function _removeNote({ - fs, - cache, - onSign, - gitdir, - ref = "refs/notes/commits", - oid, - author, - committer, - signingKey -}) { - let parent; - try { - parent = await GitRefManager.resolve({ gitdir, fs, ref }); - } catch (err) { - if (!(err instanceof NotFoundError)) { - throw err; - } - } - const result = await _readTree({ - fs, - gitdir, - oid: parent || "4b825dc642cb6eb9a060e54bf8d69288fbee4904" - }); - let tree = result.tree; - tree = tree.filter((entry) => entry.path !== oid); - const treeOid = await _writeTree({ - fs, - gitdir, - tree - }); - const commitOid = await _commit({ - fs, - cache, - onSign, - gitdir, - ref, - tree: treeOid, - parent: parent && [parent], - message: `Note removed by 'isomorphic-git removeNote' -`, - author, - committer, - signingKey - }); - return commitOid; -} -async function removeNote({ - fs: _fs, - onSign, - dir, - gitdir = join(dir, ".git"), - ref = "refs/notes/commits", - oid, - author: _author, - committer: _committer, - signingKey, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("oid", oid); - const fs = new FileSystem(_fs); - const author = await normalizeAuthorObject({ fs, gitdir, author: _author }); - if (!author) throw new MissingNameError("author"); - const committer = await normalizeCommitterObject({ - fs, - gitdir, - author, - committer: _committer - }); - if (!committer) throw new MissingNameError("committer"); - return await _removeNote({ - fs, - cache, - onSign, - gitdir, - ref, - oid, - author, - committer, - signingKey - }); - } catch (err) { - err.caller = "git.removeNote"; - throw err; - } -} -async function _renameBranch({ - fs, - gitdir, - oldref, - ref, - checkout: checkout2 = false -}) { - if (ref !== import_clean_git_ref.default.clean(ref)) { - throw new InvalidRefNameError(ref, import_clean_git_ref.default.clean(ref)); - } - if (oldref !== import_clean_git_ref.default.clean(oldref)) { - throw new InvalidRefNameError(oldref, import_clean_git_ref.default.clean(oldref)); - } - const fulloldref = `refs/heads/${oldref}`; - const fullnewref = `refs/heads/${ref}`; - const newexist = await GitRefManager.exists({ fs, gitdir, ref: fullnewref }); - if (newexist) { - throw new AlreadyExistsError("branch", ref, false); - } - const value = await GitRefManager.resolve({ - fs, - gitdir, - ref: fulloldref, - depth: 1 - }); - await GitRefManager.writeRef({ fs, gitdir, ref: fullnewref, value }); - await GitRefManager.deleteRef({ fs, gitdir, ref: fulloldref }); - const fullCurrentBranchRef = await _currentBranch({ - fs, - gitdir, - fullname: true - }); - const isCurrentBranch = fullCurrentBranchRef === fulloldref; - if (checkout2 || isCurrentBranch) { - await GitRefManager.writeSymbolicRef({ - fs, - gitdir, - ref: "HEAD", - value: fullnewref - }); - } -} -async function renameBranch({ - fs, - dir, - gitdir = join(dir, ".git"), - ref, - oldref, - checkout: checkout2 = false -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - assertParameter("oldref", oldref); - return await _renameBranch({ - fs: new FileSystem(fs), - gitdir, - ref, - oldref, - checkout: checkout2 - }); - } catch (err) { - err.caller = "git.renameBranch"; - throw err; - } -} -async function hashObject$1({ gitdir, type, object }) { - return shasum(GitObject.wrap({ type, object })); -} -async function resetIndex({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - filepath, - ref, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("filepath", filepath); - const fs = new FileSystem(_fs); - let oid; - let workdirOid; - try { - oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || "HEAD" }); - } catch (e) { - if (ref) { - throw e; - } - } - if (oid) { - try { - oid = await resolveFilepath({ - fs, - cache, - gitdir, - oid, - filepath - }); - } catch (e) { - oid = null; - } - } - let stats = { - ctime: /* @__PURE__ */ new Date(0), - mtime: /* @__PURE__ */ new Date(0), - dev: 0, - ino: 0, - mode: 0, - uid: 0, - gid: 0, - size: 0 - }; - const object = dir && await fs.read(join(dir, filepath)); - if (object) { - workdirOid = await hashObject$1({ - gitdir, - type: "blob", - object - }); - if (oid === workdirOid) { - stats = await fs.lstat(join(dir, filepath)); - } - } - await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - index2.delete({ filepath }); - if (oid) { - index2.insert({ filepath, stats, oid }); - } - }); - } catch (err) { - err.caller = "git.reset"; - throw err; - } -} -async function resolveRef({ - fs, - dir, - gitdir = join(dir, ".git"), - ref, - depth -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - const oid = await GitRefManager.resolve({ - fs: new FileSystem(fs), - gitdir, - ref, - depth - }); - return oid; - } catch (err) { - err.caller = "git.resolveRef"; - throw err; - } -} -async function setConfig({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - path: path2, - value, - append: append3 = false -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("path", path2); - const fs = new FileSystem(_fs); - const config = await GitConfigManager.get({ fs, gitdir }); - if (append3) { - await config.append(path2, value); - } else { - await config.set(path2, value); - } - await GitConfigManager.save({ fs, gitdir, config }); - } catch (err) { - err.caller = "git.setConfig"; - throw err; - } -} -async function status({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - filepath, - cache = {} -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("filepath", filepath); - const fs = new FileSystem(_fs); - const ignored = await GitIgnoreManager.isIgnored({ - fs, - gitdir, - dir, - filepath - }); - if (ignored) { - return "ignored"; - } - const headTree = await getHeadTree({ fs, cache, gitdir }); - const treeOid = await getOidAtPath({ - fs, - cache, - gitdir, - tree: headTree, - path: filepath - }); - const indexEntry = await GitIndexManager.acquire( - { fs, gitdir, cache }, - async function(index2) { - for (const entry of index2) { - if (entry.path === filepath) return entry; - } - return null; - } - ); - const stats = await fs.lstat(join(dir, filepath)); - const H = treeOid !== null; - const I = indexEntry !== null; - const W = stats !== null; - const getWorkdirOid = async () => { - if (I && !compareStats(indexEntry, stats)) { - return indexEntry.oid; - } else { - const object = await fs.read(join(dir, filepath)); - const workdirOid = await hashObject$1({ - gitdir, - type: "blob", - object - }); - if (I && indexEntry.oid === workdirOid) { - if (stats.size !== -1) { - GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - index2.insert({ filepath, stats, oid: workdirOid }); - }); - } - } - return workdirOid; - } - }; - if (!H && !W && !I) return "absent"; - if (!H && !W && I) return "*absent"; - if (!H && W && !I) return "*added"; - if (!H && W && I) { - const workdirOid = await getWorkdirOid(); - return workdirOid === indexEntry.oid ? "added" : "*added"; - } - if (H && !W && !I) return "deleted"; - if (H && !W && I) { - return treeOid === indexEntry.oid ? "*deleted" : "*deleted"; - } - if (H && W && !I) { - const workdirOid = await getWorkdirOid(); - return workdirOid === treeOid ? "*undeleted" : "*undeletemodified"; - } - if (H && W && I) { - const workdirOid = await getWorkdirOid(); - if (workdirOid === treeOid) { - return workdirOid === indexEntry.oid ? "unmodified" : "*unmodified"; - } else { - return workdirOid === indexEntry.oid ? "modified" : "*modified"; - } - } - } catch (err) { - err.caller = "git.status"; - throw err; - } -} -async function getOidAtPath({ fs, cache, gitdir, tree, path: path2 }) { - if (typeof path2 === "string") path2 = path2.split("/"); - const dirname3 = path2.shift(); - for (const entry of tree) { - if (entry.path === dirname3) { - if (path2.length === 0) { - return entry.oid; - } - const { type, object } = await _readObject({ - fs, - cache, - gitdir, - oid: entry.oid - }); - if (type === "tree") { - const tree2 = GitTree.from(object); - return getOidAtPath({ fs, cache, gitdir, tree: tree2, path: path2 }); - } - if (type === "blob") { - throw new ObjectTypeError(entry.oid, type, "blob", path2.join("/")); - } - } - } - return null; -} -async function getHeadTree({ fs, cache, gitdir }) { - let oid; - try { - oid = await GitRefManager.resolve({ fs, gitdir, ref: "HEAD" }); - } catch (e) { - if (e instanceof NotFoundError) { - return []; - } - } - const { tree } = await _readTree({ fs, cache, gitdir, oid }); - return tree; -} -async function statusMatrix({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - ref = "HEAD", - filepaths = ["."], - filter, - cache = {}, - ignored: shouldIgnore = false -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - const fs = new FileSystem(_fs); - return await _walk({ - fs, - cache, - dir, - gitdir, - trees: [TREE({ ref }), WORKDIR(), STAGE()], - map: async function(filepath, [head, workdir, stage]) { - if (!head && !stage && workdir) { - if (!shouldIgnore) { - const isIgnored2 = await GitIgnoreManager.isIgnored({ - fs, - dir, - filepath - }); - if (isIgnored2) { - return null; - } - } - } - if (!filepaths.some((base) => worthWalking(filepath, base))) { - return null; - } - if (filter) { - if (!filter(filepath)) return; - } - const [headType, workdirType, stageType] = await Promise.all([ - head && head.type(), - workdir && workdir.type(), - stage && stage.type() - ]); - const isBlob = [headType, workdirType, stageType].includes("blob"); - if ((headType === "tree" || headType === "special") && !isBlob) return; - if (headType === "commit") return null; - if ((workdirType === "tree" || workdirType === "special") && !isBlob) - return; - if (stageType === "commit") return null; - if ((stageType === "tree" || stageType === "special") && !isBlob) return; - const headOid = headType === "blob" ? await head.oid() : void 0; - const stageOid = stageType === "blob" ? await stage.oid() : void 0; - let workdirOid; - if (headType !== "blob" && workdirType === "blob" && stageType !== "blob") { - workdirOid = "42"; - } else if (workdirType === "blob") { - workdirOid = await workdir.oid(); - } - const entry = [void 0, headOid, workdirOid, stageOid]; - const result = entry.map((value) => entry.indexOf(value)); - result.shift(); - return [filepath, ...result]; - } - }); - } catch (err) { - err.caller = "git.statusMatrix"; - throw err; - } -} -async function tag({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - ref, - object, - force = false -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - const fs = new FileSystem(_fs); - if (ref === void 0) { - throw new MissingParameterError("ref"); - } - ref = ref.startsWith("refs/tags/") ? ref : `refs/tags/${ref}`; - const value = await GitRefManager.resolve({ - fs, - gitdir, - ref: object || "HEAD" - }); - if (!force && await GitRefManager.exists({ fs, gitdir, ref })) { - throw new AlreadyExistsError("tag", ref); - } - await GitRefManager.writeRef({ fs, gitdir, ref, value }); - } catch (err) { - err.caller = "git.tag"; - throw err; - } -} -async function updateIndex({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - cache = {}, - filepath, - oid, - mode, - add: add2, - remove: remove3, - force -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("filepath", filepath); - const fs = new FileSystem(_fs); - if (remove3) { - return await GitIndexManager.acquire( - { fs, gitdir, cache }, - async function(index2) { - let fileStats2; - if (!force) { - fileStats2 = await fs.lstat(join(dir, filepath)); - if (fileStats2) { - if (fileStats2.isDirectory()) { - throw new InvalidFilepathError("directory"); - } - return; - } - } - if (index2.has({ filepath })) { - index2.delete({ - filepath - }); - } - } - ); - } - let fileStats; - if (!oid) { - fileStats = await fs.lstat(join(dir, filepath)); - if (!fileStats) { - throw new NotFoundError( - `file at "${filepath}" on disk and "remove" not set` - ); - } - if (fileStats.isDirectory()) { - throw new InvalidFilepathError("directory"); - } - } - return await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index2) { - if (!add2 && !index2.has({ filepath })) { - throw new NotFoundError( - `file at "${filepath}" in index and "add" not set` - ); - } - let stats = { - ctime: /* @__PURE__ */ new Date(0), - mtime: /* @__PURE__ */ new Date(0), - dev: 0, - ino: 0, - mode, - uid: 0, - gid: 0, - size: 0 - }; - if (!oid) { - stats = fileStats; - const object = stats.isSymbolicLink() ? await fs.readlink(join(dir, filepath)) : await fs.read(join(dir, filepath)); - oid = await _writeObject({ - fs, - gitdir, - type: "blob", - format: "content", - object - }); - } - index2.insert({ - filepath, - oid, - stats - }); - return oid; - }); - } catch (err) { - err.caller = "git.updateIndex"; - throw err; - } -} -function version() { - try { - return pkg.version; - } catch (err) { - err.caller = "git.version"; - throw err; - } -} -async function walk({ - fs, - dir, - gitdir = join(dir, ".git"), - trees, - map, - reduce, - iterate, - cache = {} -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("trees", trees); - return await _walk({ - fs: new FileSystem(fs), - cache, - dir, - gitdir, - trees, - map, - reduce, - iterate - }); - } catch (err) { - err.caller = "git.walk"; - throw err; - } -} -async function writeBlob({ fs, dir, gitdir = join(dir, ".git"), blob }) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("blob", blob); - return await _writeObject({ - fs: new FileSystem(fs), - gitdir, - type: "blob", - object: blob, - format: "content" - }); - } catch (err) { - err.caller = "git.writeBlob"; - throw err; - } -} -async function _writeCommit({ fs, gitdir, commit: commit2 }) { - const object = GitCommit.from(commit2).toObject(); - const oid = await _writeObject({ - fs, - gitdir, - type: "commit", - object, - format: "content" - }); - return oid; -} -async function writeCommit({ - fs, - dir, - gitdir = join(dir, ".git"), - commit: commit2 -}) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("commit", commit2); - return await _writeCommit({ - fs: new FileSystem(fs), - gitdir, - commit: commit2 - }); - } catch (err) { - err.caller = "git.writeCommit"; - throw err; - } -} -async function writeObject({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - type, - object, - format = "parsed", - oid, - encoding = void 0 -}) { - try { - const fs = new FileSystem(_fs); - if (format === "parsed") { - switch (type) { - case "commit": - object = GitCommit.from(object).toObject(); - break; - case "tree": - object = GitTree.from(object).toObject(); - break; - case "blob": - object = Buffer.from(object, encoding); - break; - case "tag": - object = GitAnnotatedTag.from(object).toObject(); - break; - default: - throw new ObjectTypeError(oid || "", type, "blob|commit|tag|tree"); - } - format = "content"; - } - oid = await _writeObject({ - fs, - gitdir, - type, - object, - oid, - format - }); - return oid; - } catch (err) { - err.caller = "git.writeObject"; - throw err; - } -} -async function writeRef({ - fs: _fs, - dir, - gitdir = join(dir, ".git"), - ref, - value, - force = false, - symbolic = false -}) { - try { - assertParameter("fs", _fs); - assertParameter("gitdir", gitdir); - assertParameter("ref", ref); - assertParameter("value", value); - const fs = new FileSystem(_fs); - if (ref !== import_clean_git_ref.default.clean(ref)) { - throw new InvalidRefNameError(ref, import_clean_git_ref.default.clean(ref)); - } - if (!force && await GitRefManager.exists({ fs, gitdir, ref })) { - throw new AlreadyExistsError("ref", ref); - } - if (symbolic) { - await GitRefManager.writeSymbolicRef({ - fs, - gitdir, - ref, - value - }); - } else { - value = await GitRefManager.resolve({ - fs, - gitdir, - ref: value - }); - await GitRefManager.writeRef({ - fs, - gitdir, - ref, - value - }); - } - } catch (err) { - err.caller = "git.writeRef"; - throw err; - } -} -async function _writeTag({ fs, gitdir, tag: tag2 }) { - const object = GitAnnotatedTag.from(tag2).toObject(); - const oid = await _writeObject({ - fs, - gitdir, - type: "tag", - object, - format: "content" - }); - return oid; -} -async function writeTag({ fs, dir, gitdir = join(dir, ".git"), tag: tag2 }) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("tag", tag2); - return await _writeTag({ - fs: new FileSystem(fs), - gitdir, - tag: tag2 - }); - } catch (err) { - err.caller = "git.writeTag"; - throw err; - } -} -async function writeTree({ fs, dir, gitdir = join(dir, ".git"), tree }) { - try { - assertParameter("fs", fs); - assertParameter("gitdir", gitdir); - assertParameter("tree", tree); - return await _writeTree({ - fs: new FileSystem(fs), - gitdir, - tree - }); - } catch (err) { - err.caller = "git.writeTree"; - throw err; - } -} -var index = { - Errors, - STAGE, - TREE, - WORKDIR, - add, - abortMerge, - addNote, - addRemote, - annotatedTag, - branch, - checkout, - clone, - commit, - getConfig, - getConfigAll, - setConfig, - currentBranch, - deleteBranch, - deleteRef, - deleteRemote, - deleteTag, - expandOid, - expandRef, - fastForward, - fetch, - findMergeBase, - findRoot, - getRemoteInfo, - getRemoteInfo2, - hashBlob, - indexPack, - init, - isDescendent, - isIgnored, - listBranches, - listFiles, - listNotes, - listRemotes, - listServerRefs, - listTags, - log, - merge, - packObjects, - pull, - push, - readBlob, - readCommit, - readNote, - readObject, - readTag, - readTree, - remove, - removeNote, - renameBranch, - resetIndex, - updateIndex, - resolveRef, - status, - statusMatrix, - tag, - version, - walk, - writeBlob, - writeCommit, - writeObject, - writeRef, - writeTag, - writeTree -}; -var isomorphic_git_default = index; + bare = ${e} +`+(e?"":` logallrefupdates = true +`)+` symlinks = false + ignorecase = true +`),await t.write(r+"/HEAD",`ref: refs/heads/${i} +`)}async function TC({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:h,ref:d,remote:p,depth:g,since:m,exclude:w,relative:b,singleBranch:S,noCheckout:k,noTags:x,headers:A}){try{if(await N1({fs:t,gitdir:u}),await R1({fs:t,gitdir:u,remote:p,url:f,force:!1}),h){let _=await ze.get({fs:t,gitdir:u});await _.set("http.corsProxy",h),await ze.save({fs:t,gitdir:u,config:_})}let{defaultBranch:y,fetchHead:E}=await zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:d,remote:p,corsProxy:h,depth:g,since:m,exclude:w,relative:b,singleBranch:S,headers:A,tags:!x});if(E===null)return;d=d||y,d=d.replace("refs/heads/",""),await Uf({fs:t,cache:e,onProgress:r,onPostCheckout:l,dir:c,gitdir:u,ref:d,remote:p,noCheckout:k})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function CC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:h=void 0,remote:d="origin",depth:p=void 0,since:g=void 0,exclude:m=[],relative:w=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:k=!1,headers:x={},cache:A={}}){try{return F("fs",t),F("http",e),F("gitdir",c),S||F("dir",l),F("url",u),await TC({fs:new Q(t),cache:A,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c,url:u,corsProxy:f,ref:h,remote:d,depth:p,since:g,exclude:m,relative:w,singleBranch:b,noCheckout:S,noTags:k,headers:x})}catch(y){throw y.caller="git.clone",y}}async function FC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:h,tree:d,cache:p={}}){try{F("fs",t),l||F("message",i),o&&F("onSign",e);let g=new Q(t);return await Zo({fs:g,cache:p,onSign:e,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:h,tree:d})}catch(g){throw g.caller="git.commit",g}}async function MC({fs:t,dir:e,gitdir:n=B(e,".git"),fullname:r=!1,test:i=!1}){try{return F("fs",t),F("gitdir",n),await zr({fs:new Q(t),gitdir:n,fullname:r,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function OC({fs:t,gitdir:e,ref:n}){if(n=n.startsWith("refs/heads/")?n:`refs/heads/${n}`,!await q.exists({fs:t,gitdir:e,ref:n}))throw new Re(n);let i=await q.expand({fs:t,gitdir:e,ref:n}),a=await zr({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await q.resolve({fs:t,gitdir:e,ref:i});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:i});let s=Nr(n),o=await ze.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await ze.save({fs:t,gitdir:e,config:o})}async function PC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await OC({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteBranch",i}}async function IC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{F("fs",t),F("ref",r),await q.deleteRef({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteRef",i}}async function RC({fs:t,gitdir:e,remote:n}){let r=await ze.get({fs:t,gitdir:e});await r.deleteSection("remote",n),await ze.save({fs:t,gitdir:e,config:r})}async function LC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("remote",r),await RC({fs:new Q(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.deleteRemote",i}}async function jC({fs:t,gitdir:e,ref:n}){n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,await q.deleteRef({fs:t,gitdir:e,ref:n})}async function DC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await jC({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteTag",i}}async function BC({fs:t,gitdir:e,oid:n}){let r=n.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map(a=>`${r}${a}`).filter(a=>a.startsWith(n))}async function NC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=[],s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await $f({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new ue(c.error);for(let u of c.offsets.keys())u.startsWith(r)&&a.push(u)}return a}async function $C({fs:t,cache:e,gitdir:n,oid:r}){let i=o=>Ge({fs:t,cache:e,gitdir:n,oid:o}),a=await BC({fs:t,gitdir:n,oid:r}),s=await NC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new Ja("oids",r,a):new Re(`an object matching "${r}"`)}async function HC({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await $C({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.expandOid",a}}async function UC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("gitdir",n),F("ref",r),await q.expand({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.expandRef",i}}async function Gf({fs:t,cache:e,gitdir:n,oids:r}){let i={},a=r.length,s=r.map((o,l)=>({index:l,oid:o}));for(;s.length;){let o=new Set;for(let{oid:c,index:u}of s)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===a&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of s)try{let{object:f}=await Ge({fs:t,cache:e,gitdir:n,oid:c}),h=Rt.from(f),{parent:d}=h.parseHeaders();for(let p of d)(!i[p]||!i[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}s=Array.from(l.values())}return[]}var kf=/^.*(\r?\n|$)/gm;function zC({branches:t,contents:e}){let n=t[1],r=t[2],i=e[0],a=e[1],s=e[2],o=a.match(kf),l=i.match(kf),c=s.match(kf),u=(0,b1.default)(o,l,c),f=7,h="",d=!0;for(let p of u)p.ok&&(h+=p.ok.join("")),p.conflict&&(d=!1,h+=`${"<".repeat(f)} ${n} +`,h+=p.conflict.a.join(""),h+=`${"=".repeat(f)} +`,h+=p.conflict.b.join(""),h+=`${">".repeat(f)} ${r} +`);return{cleanMerge:d,mergedText:h}}async function GC({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:h=!0,mergeDriver:d}){let p=sr({ref:a}),g=sr({ref:s}),m=sr({ref:o}),w=[],b=[],S=[],k=[],x=await Pi({fs:t,cache:e,dir:n,gitdir:r,trees:[p,g,m],map:async function(A,[y,E,_]){let C=jo(A),M=await Ho(y,E),L=await Ho(_,E);switch(`${M}-${L}`){case"false-false":return{mode:await E.mode(),path:C,oid:await E.oid(),type:await E.type()};case"false-true":return _?{mode:await _.mode(),path:C,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&E&&_&&await y.type()==="blob"&&await E.type()==="blob"&&await _.type()==="blob")return VC({fs:t,gitdir:r,path:C,ours:y,base:E,theirs:_,ourName:l,baseName:c,theirName:u,mergeDriver:d}).then(async N=>{if(N.cleanMerge)h||i.insert({filepath:A,oid:N.mergeResult.oid,stage:0});else if(w.push(A),b.push(A),!h){let j=await E.oid(),Y=await y.oid(),le=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:j,stage:1}),i.insert({filepath:A,oid:Y,stage:2}),i.insert({filepath:A,oid:le,stage:3})}return N.mergeResult});if(E&&!y&&_&&await E.type()==="blob"&&await _.type()==="blob"){if(w.push(A),S.push(A),!h){let N=await E.oid(),j=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:N,stage:1}),i.insert({filepath:A,oid:j,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:C}}if(E&&y&&!_&&await E.type()==="blob"&&await y.type()==="blob"){if(w.push(A),k.push(A),!h){let N=await E.oid(),j=await y.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:N,stage:1}),i.insert({filepath:A,oid:j,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(E&&!y&&!_&&await E.type()==="blob")return;throw new Ti}}},reduce:w.length!==0&&(!n||h)?void 0:async(A,y)=>{let E=y.filter(Boolean);if(A&&!(A&&A.type==="tree"&&E.length===0)){if(E.length>0){let C=new It(E).toObject(),M=await zt({fs:t,gitdir:r,type:"tree",object:C,dryRun:f});A.oid=M}return A}}});return w.length!==0?(n&&!h&&await Pi({fs:t,cache:e,dir:n,gitdir:r,trees:[sr({ref:x.oid})],map:async function(A,[y]){let E=`${n}/${A}`;if(await y.type()==="blob"){let _=await y.mode(),C=new TextDecoder().decode(await y.content());await t.write(E,C,{mode:_})}return!0}}),new Ci(w,b,S,k)):x.oid}async function VC({fs:t,gitdir:e,path:n,ours:r,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:c,mergeDriver:u=zC}){let f="blob",h=await i.mode()===await r.mode()?await a.mode():await r.mode();if(await r.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await r.oid(),type:f}};if(await r.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await a.oid(),type:f}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await r.oid(),type:f}};let d=Buffer.from(await r.content()).toString("utf8"),p=Buffer.from(await i.content()).toString("utf8"),g=Buffer.from(await a.content()).toString("utf8"),{mergedText:m,cleanMerge:w}=await u({branches:[l,s,o],contents:[p,d,g],path:n}),b=await zt({fs:t,gitdir:e,type:"blob",object:Buffer.from(m,"utf8"),dryRun:c});return{cleanMerge:w,mergeResult:{mode:h,path:n,oid:b,type:f}}}async function $1({fs:t,cache:e,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,onSign:g,mergeDriver:m}){i===void 0&&(i=await zr({fs:t,gitdir:r,fullname:!0})),i=await q.expand({fs:t,gitdir:r,ref:i}),a=await q.expand({fs:t,gitdir:r,ref:a});let w=await q.resolve({fs:t,gitdir:r,ref:i}),b=await q.resolve({fs:t,gitdir:r,ref:a}),S=await Gf({fs:t,cache:e,gitdir:r,oids:[w,b]});if(S.length!==1)throw new Ti;let k=S[0];if(k===b)return{oid:w,alreadyMerged:!0};if(s&&k===w)return!l&&!c&&await q.writeRef({fs:t,gitdir:r,ref:i,value:b}),{oid:b,fastForward:!0};{if(o)throw new ns;let x=await lt.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async y=>GC({fs:t,cache:e,dir:n,gitdir:r,index:y,ourOid:w,theirOid:b,baseOid:k,ourName:Nr(i),baseName:"base",theirName:Nr(a),dryRun:l,abortOnConflict:u,mergeDriver:m}));if(x instanceof Ci)throw x;return f||(f=`Merge branch '${Nr(a)}' into ${Nr(i)}`),{oid:await Zo({fs:t,cache:e,gitdir:r,message:f,ref:i,tree:x,parent:[w,b],author:h,committer:d,signingKey:p,onSign:g,dryRun:l,noUpdateBranch:c}),tree:x,mergeCommit:!0}}}async function H1({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:h,remoteRef:d,prune:p,pruneTags:g,fastForward:m,fastForwardOnly:w,corsProxy:b,singleBranch:S,headers:k,author:x,committer:A,signingKey:y}){try{if(!u){let C=await zr({fs:t,gitdir:c});if(!C)throw new Pt("ref");u=C}let{fetchHead:E,fetchHeadDescription:_}=await zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:h,remoteRef:d,singleBranch:S,headers:k,prune:p,pruneTags:g});await $1({fs:t,cache:e,gitdir:c,ours:u,theirs:E,fastForward:m,fastForwardOnly:w,message:`Merge ${_}`,author:x,committer:A,signingKey:y,dryRun:!1,noUpdateBranch:!1}),await Uf({fs:t,cache:e,onProgress:r,dir:l,gitdir:c,ref:u,remote:h,noCheckout:!1})}catch(E){throw E.caller="git.pull",E}}async function WC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:h,corsProxy:d,singleBranch:p,headers:g={},cache:m={}}){try{F("fs",t),F("http",e),F("gitdir",l);let w={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await H1({fs:new Q(t),cache:m,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:h,fastForwardOnly:!0,corsProxy:d,singleBranch:p,headers:g,author:w,committer:w})}catch(w){throw w.caller="git.fastForward",w}}async function qC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,remote:u,remoteRef:f,url:h,corsProxy:d,depth:p=null,since:g=null,exclude:m=[],relative:w=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:x=!1,pruneTags:A=!1,cache:y={}}){try{return F("fs",t),F("http",e),F("gitdir",l),await zf({fs:new Q(t),cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:l,ref:c,remote:u,remoteRef:f,url:h,corsProxy:d,depth:p,since:g,exclude:m,relative:w,tags:b,singleBranch:S,headers:k,prune:x,pruneTags:A})}catch(E){throw E.caller="git.fetch",E}}async function XC({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await Gf({fs:new Q(t),cache:i,gitdir:n,oids:r})}catch(a){throw a.caller="git.findMergeBase",a}}async function U1({fs:t,filepath:e}){if(await t.exists(B(e,".git")))return e;{let n=ki(e);if(n===e)throw new Re(`git root for ${e}`);return U1({fs:t,filepath:n})}}async function YC({fs:t,filepath:e}){try{return F("fs",t),F("filepath",e),await U1({fs:new Q(t),filepath:e})}catch(n){throw n.caller="git.findRoot",n}}async function ZC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await fs({fs:new Q(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfig",i}}async function KC({fs:t,gitdir:e,path:n}){return(await ze.get({fs:t,gitdir:e})).getall(n)}async function JC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await KC({fs:new Q(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfigAll",i}}async function QC({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{F("http",t),F("url",a);let c=await ji.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,h]of c.refs){let d=f.split("/"),p=d.pop(),g=u;for(let m of d)g[m]=g[m]||{},g=g[m];g[p]=h}for(let[f,h]of c.symrefs){let d=f.split("/"),p=d.pop(),g=u;for(let m of d)g[m]=g[m]||{},g=g[m];g[p]=h}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function z1(t,e,n,r){let i=[];for(let[a,s]of t.refs){if(e&&!a.startsWith(e))continue;if(a.endsWith("^{}")){if(r){let l=a.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=s}continue}let o={ref:a,oid:s};n&&t.symrefs.has(a)&&(o.target=t.symrefs.get(a)),i.push(o)}return i}async function e8({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2}){try{F("http",t),F("url",a);let u=await ji.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let h of u.capabilities){let[d,p]=h.split("=");p?f[d]=p:f[d]=!0}return{protocolVersion:1,capabilities:f,refs:z1(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function t8({type:t,object:e,format:n="content",oid:r=void 0}){return n!=="deflated"&&(n!=="wrapped"&&(e=lr.wrap({type:t,object:e})),r=await Un(e)),{oid:r,object:e}}async function n8({object:t}){try{F("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t=Buffer.from(t);let e="blob",{oid:n,object:r}=await t8({type:"blob",format:"content",object:t});return{oid:n,type:e,object:new Uint8Array(r),format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function r8({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,filepath:a}){try{a=B(r,a);let s=await t.read(a),o=c=>Ge({fs:t,cache:e,gitdir:i,oid:c}),l=await Ka.fromPack({pack:s,getExternalRefDelta:o,onProgress:n});return await t.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function i8({fs:t,onProgress:e,dir:n,gitdir:r=B(n,".git"),filepath:i,cache:a={}}){try{return F("fs",t),F("dir",n),F("gitdir",n),F("filepath",i),await r8({fs:new Q(t),cache:a,onProgress:e,dir:n,gitdir:r,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function a8({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){try{return F("fs",t),F("gitdir",r),e||F("dir",n),await N1({fs:new Q(t),bare:e,dir:n,gitdir:r,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function G1({fs:t,cache:e,gitdir:n,oid:r,ancestor:i,depth:a}){let s=await Ur.read({fs:t,gitdir:n});if(!r)throw new Pt("oid");if(!i)throw new Pt("ancestor");if(r===i)return!1;let o=[r],l=new Set,c=0;for(;o.length;){if(c++===a)throw new is(a);let u=o.shift(),{type:f,object:h}=await Ge({fs:t,cache:e,gitdir:n,oid:u});if(f!=="commit")throw new kt(u,f,"commit");let d=Rt.from(h).parse();for(let p of d.parent)if(p===i)return!0;if(!s.has(u))for(let p of d.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function s8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,ancestor:i,depth:a=-1,cache:s={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),F("ancestor",i),await G1({fs:new Q(t),cache:s,gitdir:n,oid:r,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function o8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r}){try{return F("fs",t),F("dir",e),F("gitdir",n),F("filepath",r),Ii.isIgnored({fs:new Q(t),dir:e,gitdir:n,filepath:r})}catch(i){throw i.caller="git.isIgnored",i}}async function l8({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("gitdir",n),q.listBranches({fs:new Q(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.listBranches",i}}async function c8({fs:t,gitdir:e,ref:n,cache:r}){if(n){let i=await q.resolve({gitdir:e,fs:t,ref:n}),a=[];return await V1({fs:t,cache:r,gitdir:e,oid:i,filenames:a,prefix:""}),a}else return lt.acquire({fs:t,gitdir:e,cache:r},async function(i){return i.entries.map(a=>a.path)})}async function V1({fs:t,cache:e,gitdir:n,oid:r,filenames:i,prefix:a}){let{tree:s}=await Di({fs:t,cache:e,gitdir:n,oid:r});for(let o of s)o.type==="tree"?await V1({fs:t,cache:e,gitdir:n,oid:o.oid,filenames:i,prefix:B(a,o.path)}):i.push(B(a,o.path))}async function u8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),await c8({fs:new Q(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listFiles",a}}async function f8({fs:t,cache:e,gitdir:n,ref:r}){let i;try{i=await q.resolve({gitdir:n,fs:t,ref:r})}catch(o){if(o instanceof Re)return[]}return(await Di({fs:t,cache:e,gitdir:n,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function h8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",cache:i={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),await f8({fs:new Q(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listNotes",a}}async function d8({fs:t,gitdir:e}){let n=await ze.get({fs:t,gitdir:e}),r=await n.getSubsections("remote");return Promise.all(r.map(async a=>{let s=await n.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function p8({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),await d8({fs:new Q(t),gitdir:n})}catch(r){throw r.caller="git.listRemotes",r}}async function m8(t){let e=Ue.streamReader(t),n=[],r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let[i,a,...s]=r.split(" "),o={ref:a,oid:i};for(let l of s){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}n.push(o)}return n}async function g8({prefix:t,symrefs:e,peelTags:n}){let r=[];return r.push(Ue.encode(`command=ls-refs +`)),r.push(Ue.encode(`agent=${Ko.agent} +`)),(n||e||t)&&r.push(Ue.delim()),n&&r.push(Ue.encode("peel")),e&&r.push(Ue.encode("symrefs")),t&&r.push(Ue.encode(`ref-prefix ${t}`)),r.push(Ue.flush()),r}async function y8({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{F("http",t),F("url",a);let h=await Li.discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(h.protocolVersion===1)return z1(h,c,u,f);let d=await g8({prefix:c,symrefs:u,peelTags:f}),p=await Li.connect({http:t,auth:h.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:d});return m8(p.body)}catch(h){throw h.caller="git.listServerRefs",h}}async function v8({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),q.listTags({fs:new Q(t),gitdir:n})}catch(r){throw r.caller="git.listTags",r}}function w8(t,e){return t.committer.timestamp-e.committer.timestamp}var b8="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function y1({fs:t,cache:e,gitdir:n,oid:r,fileId:i}){if(i===b8)return;let a=r,s,o=await Oi({fs:t,cache:e,gitdir:n,oid:r}),l=o.tree;return i===o.oid?s=o.path:(s=await W1({fs:t,cache:e,gitdir:n,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function W1({fs:t,cache:e,gitdir:n,tree:r,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=r.entries().map(function(c){let u;return c.oid===i?(u=B(o,c.path),s.push(u)):c.type==="tree"&&(u=Ge({fs:t,cache:e,gitdir:n,oid:c.oid}).then(function({object:f}){return W1({fs:t,cache:e,gitdir:n,tree:It.from(f),fileId:i,oid:a,filepaths:s,parentPath:B(o,c.path)})})),u});return await Promise.all(l),s}async function x8({fs:t,cache:e,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l}){let c=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await Ur.read({fs:t,gitdir:n}),h=await q.resolve({fs:t,gitdir:n,ref:i}),d=[await Uo({fs:t,cache:e,gitdir:n,oid:h})],p,g,m;function w(b){m&&r&&u.push(b)}for(;d.length>0;){let b=d.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(r){let S;try{S=await ds({fs:t,cache:e,gitdir:n,oid:b.commit.tree,filepath:r}),g&&p!==S&&u.push(g),p=S,g=b,m=!0}catch(k){if(k instanceof Re){let x=l&&p;if(x&&(x=await y1({fs:t,cache:e,gitdir:n,oid:b.commit.tree,fileId:p}),x))if(Array.isArray(x)){if(g){let A=await y1({fs:t,cache:e,gitdir:n,oid:g.commit.tree,fileId:p});if(Array.isArray(A))if(x=x.filter(y=>A.indexOf(y)===-1),x.length===1)x=x[0],r=x,g&&u.push(g);else{x=!1,g&&u.push(g);break}}}else r=x,g&&u.push(g);if(!x){if(m&&p&&(u.push(g),!o))break;if(!o&&!l)throw k}g=b,m=!1}else throw k}}else u.push(b);if(a!==void 0&&u.length===a){w(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let k=await Uo({fs:t,cache:e,gitdir:n,oid:S});d.map(x=>x.oid).includes(k.oid)||d.push(k)}d.length===0&&w(b),d.sort((S,k)=>w8(S.commit,k.commit))}return u}async function _8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:c={}}){try{return F("fs",t),F("gitdir",n),F("ref",i),await x8({fs:new Q(t),cache:c,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function S8({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,cache:g={},mergeDriver:m}){try{F("fs",t),p&&F("onSign",e);let w=new Q(t),b=await Hr({fs:w,gitdir:r,author:h});if(!b&&(!o||!s))throw new At("author");let S=await Ri({fs:w,gitdir:r,author:b,committer:d});if(!S&&(!o||!s))throw new At("committer");return await $1({fs:w,cache:g,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:b,committer:S,signingKey:p,onSign:e,mergeDriver:m})}catch(w){throw w.caller="git.merge",w}}var E8={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function q1({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Nf.default,s=[];function o(u,f){let h=Buffer.from(u,f);s.push(h),a.update(h)}async function l({stype:u,object:f}){let h=E8[u],d=f.length,p=d>15?128:0,g=d&15;d=d>>>4;let m=(p|h|g).toString(16);for(o(m,"hex");p;)p=d>127?128:0,m=p|d&127,o(Bf(2,m),"hex"),d=d>>>7;o(Buffer.from(await F1(f)))}o("PACK"),o("00000002","hex"),o(Bf(8,i.length),"hex");for(let u of i){let{type:f,object:h}=await Ge({fs:t,cache:e,gitdir:r,oid:u});await l({write:o,object:h,stype:f})}let c=a.digest();return s.push(c),s}async function k8({fs:t,cache:e,gitdir:n,oids:r,write:i}){let a=await q1({fs:t,cache:e,gitdir:n,oids:r}),s=Buffer.from(await zo(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(B(n,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function A8({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,write:i=!1,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await k8({fs:new Q(t),cache:a,gitdir:n,oids:r,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function T8({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:h,prune:d=!1,pruneTags:p=!1,fastForward:g=!0,fastForwardOnly:m=!1,corsProxy:w,singleBranch:b,headers:S={},author:k,committer:x,signingKey:A,cache:y={}}){try{F("fs",t),F("gitdir",l);let E=new Q(t),_=await Hr({fs:E,gitdir:l,author:k});if(!_)throw new At("author");let C=await Ri({fs:E,gitdir:l,author:_,committer:x});if(!C)throw new At("committer");return await H1({fs:E,cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:h,fastForward:g,fastForwardOnly:m,corsProxy:w,singleBranch:b,headers:S,author:_,committer:C,signingKey:A,prune:d,pruneTags:p})}catch(E){throw E.caller="git.pull",E}}async function C8({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),start:i,finish:a}){let s=await Ur.read({fs:t,gitdir:r}),o=new Set,l=new Set;for(let f of i)o.add(await q.resolve({fs:t,gitdir:r,ref:f}));for(let f of a)try{let h=await q.resolve({fs:t,gitdir:r,ref:f});l.add(h)}catch(h){}let c=new Set;async function u(f){c.add(f);let{type:h,object:d}=await Ge({fs:t,cache:e,gitdir:r,oid:f});if(h==="tag"){let g=Ut.from(d).headers().object;return u(g)}if(h!=="commit")throw new kt(f,h,"commit");if(!s.has(f)){let g=Rt.from(d).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 Af({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:l,object:c}=await Ge({fs:t,cache:e,gitdir:r,oid:o});if(l==="tag"){let f=Ut.from(c).headers().object;await s(f)}else if(l==="commit"){let f=Rt.from(c).headers().tree;await s(f)}else if(l==="tree"){let u=It.from(c);for(let f of u)f.type==="blob"&&a.add(f.oid),f.type==="tree"&&await s(f.oid)}}for(let o of i)await s(o);return a}async function F8(t){let e={},n="",r=Ue.streamReader(t),i=await r();for(;i!==!0;)i!==null&&(n+=i.toString("utf8")+` +`),i=await r();let a=n.toString("utf8").split(` +`);if(i=a.shift(),!i.startsWith("unpack "))throw new $r('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.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 M8({capabilities:t=[],triplets:e=[]}){let n=[],r=`\0 ${t.join(" ")}`;for(let i of e)n.push(Ue.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${r} +`)),r="";return n.push(Ue.flush()),n}async function O8({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:h,url:d,force:p=!1,delete:g=!1,corsProxy:m,headers:w={}}){let b=u||await zr({fs:t,gitdir:c});if(typeof b=="undefined")throw new Pt("ref");let S=await ze.get({fs:t,gitdir:c});h=h||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let k=d||await S.get(`remote.${h}.pushurl`)||await S.get(`remote.${h}.url`);if(typeof k=="undefined")throw new Pt("remote OR url");let x=f||await S.get(`branch.${b}.merge`);if(typeof k=="undefined")throw new Pt("remoteRef");m===void 0&&(m=await S.get("http.corsProxy"));let A=await q.expand({fs:t,gitdir:c,ref:b}),y=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:A}),E=ji.getRemoteHelperFor({url:k}),_=await E.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:m,service:"git-receive-pack",url:k,headers:w,protocolVersion:1}),C=_.auth,M;if(!x)M=A;else try{M=await q.expandAgainstMap({ref:x,map:_.refs})}catch(G){if(G instanceof Re)M=x.startsWith("refs/")?x:`refs/heads/${x}`;else throw G}let L=_.refs.get(M)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:h,url:k,localRef:{ref:g?"(delete)":A,oid:y},remoteRef:{ref:M,oid:L}}))throw new Mi;let N=!_.capabilities.has("no-thin"),j=new Set;if(!g){let G=[..._.refs.values()],D=new Set;if(L!=="0000000000000000000000000000000000000000"){let se=await Gf({fs:t,cache:e,gitdir:c,oids:[y,L]});for(let Se of se)G.push(Se);N&&(D=await Af({fs:t,cache:e,gitdir:c,oids:se}))}if(!G.includes(y)){let se=await C8({fs:t,cache:e,gitdir:c,start:[y],finish:G});j=await Af({fs:t,cache:e,gitdir:c,oids:se})}if(N){try{let se=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${h}/HEAD`,depth:2}),{oid:Se}=await q.resolveAgainstMap({ref:se.replace(`refs/remotes/${h}/`,""),fullref:se,map:_.refs}),mt=[Se];for(let be of await Af({fs:t,cache:e,gitdir:c,oids:mt}))D.add(be)}catch(se){}for(let se of D)j.delete(se)}if(y===L&&(p=!0),!p){if(A.startsWith("refs/tags")&&L!=="0000000000000000000000000000000000000000")throw new Fi("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&L!=="0000000000000000000000000000000000000000"&&!await G1({fs:t,cache:e,gitdir:c,oid:y,ancestor:L,depth:-1}))throw new Fi("not-fast-forward")}}let Y=D1([..._.capabilities],["report-status","side-band-64k",`agent=${Ko.agent}`]),le=await M8({capabilities:Y,triplets:[{oldoid:L,oid:y,fullRef:M}]}),he=g?[]:await q1({fs:t,cache:e,gitdir:c,oids:[...j]}),ie=await E.connect({http:n,onProgress:r,corsProxy:m,service:"git-receive-pack",url:k,auth:C,headers:w,body:[...le,...he]}),{packfile:Me,progress:de}=await Go.demux(ie.body);if(i){let G=B1(de);ps(G,async D=>{await i(D)})}let $=await F8(Me);if(ie.headers&&($.headers=ie.headers),h&&$.ok&&$.refs[M].ok&&!A.startsWith("refs/tags")){let G=`refs/remotes/${h}/${M.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:G}):await q.writeRef({fs:t,gitdir:c,ref:G,value:y})}if($.ok&&Object.values($.refs).every(G=>G.ok))return $;{let G=Object.entries($.refs).filter(([D,se])=>!se.ok).map(([D,se])=>` + - ${D}: ${se.error}`).join("");throw new rs(G,$)}}async function P8({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:h="origin",url:d,force:p=!1,delete:g=!1,corsProxy:m,headers:w={},cache:b={}}){try{return F("fs",t),F("http",e),F("gitdir",c),await O8({fs:new Q(t),cache:b,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:c,ref:u,remoteRef:f,remote:h,url:d,force:p,delete:g,corsProxy:m,headers:w})}catch(S){throw S.caller="git.push",S}}async function X1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,X1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="blob")throw new kt(r,i,"blob");return{oid:r,blob:new Uint8Array(a)}}async function Y1({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){return i!==void 0&&(r=await ds({fs:t,cache:e,gitdir:n,oid:r,filepath:i})),await X1({fs:t,cache:e,gitdir:n,oid:r})}async function ms({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Y1({fs:new Q(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function I8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Uo({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readCommit",a}}async function R8({fs:t,cache:e,gitdir:n,ref:r="refs/notes/commits",oid:i}){let a=await q.resolve({gitdir:n,fs:t,ref:r}),{blob:s}=await Y1({fs:t,cache:e,gitdir:n,oid:a,filepath:i});return s}async function L8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",oid:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oid",i),await R8({fs:new Q(t),cache:a,gitdir:n,ref:r,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function j8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{F("fs",t),F("gitdir",n),F("oid",r);let l=new Q(t);a!==void 0&&(r=await ds({fs:l,cache:o,gitdir:n,oid:r,filepath:a}));let u=await Ge({fs:l,cache:o,gitdir:n,oid:r,format:i==="parsed"?"content":i});if(u.oid=r,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=Rt.from(u.object).parse();break;case"tree":u.object=It.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Ut.from(u.object).parse();break;default:throw new kt(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(l){throw l.caller="git.readObject",l}}async function D8({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r,format:"content"});if(i!=="tag")throw new kt(r,i,"tag");let s=Ut.from(a);return{oid:r,tag:s.parse(),payload:s.payload()}}async function B8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await D8({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readTag",a}}async function N8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i=void 0,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Di({fs:new Q(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function $8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r),await lt.acquire({fs:new Q(t),gitdir:n,cache:i},async function(a){a.delete({filepath:r})})}catch(a){throw a.caller="git.remove",a}}async function H8({fs:t,cache:e,onSign:n,gitdir:r,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:r,fs:t,ref:i})}catch(p){if(!(p instanceof Re))throw p}let f=(await Di({fs:t,gitdir:r,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let h=await Hf({fs:t,gitdir:r,tree:f});return await Zo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:h,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' +`,author:s,committer:o,signingKey:l})}async function U8({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:c={}}){try{F("fs",t),F("gitdir",r),F("oid",a);let u=new Q(t),f=await Hr({fs:u,gitdir:r,author:s});if(!f)throw new At("author");let h=await Ri({fs:u,gitdir:r,author:f,committer:o});if(!h)throw new At("committer");return await H8({fs:u,cache:c,onSign:e,gitdir:r,ref:i,oid:a,author:f,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function z8({fs:t,gitdir:e,oldref:n,ref:r,checkout:i=!1}){if(r!==fn.default.clean(r))throw new zn(r,fn.default.clean(r));if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let a=`refs/heads/${n}`,s=`refs/heads/${r}`;if(await q.exists({fs:t,gitdir:e,ref:s}))throw new hn("branch",r,!1);let l=await q.resolve({fs:t,gitdir:e,ref:a,depth:1});await q.writeRef({fs:t,gitdir:e,ref:s,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:a});let u=await zr({fs:t,gitdir:e,fullname:!0})===a;(i||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function G8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,oldref:i,checkout:a=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oldref",i),await z8({fs:new Q(t),gitdir:n,ref:r,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function Z1({gitdir:t,type:e,object:n}){return Un(lr.wrap({type:e,object:n}))}async function V8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i,cache:a={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let s=new Q(t),o,l;try{o=await q.resolve({fs:s,gitdir:n,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await ds({fs:s,cache:a,gitdir:n,oid:o,filepath:r})}catch(f){o=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await s.read(B(e,r));u&&(l=await Z1({gitdir:n,type:"blob",object:u}),o===l&&(c=await s.lstat(B(e,r)))),await lt.acquire({fs:s,gitdir:n,cache:a},async function(f){f.delete({filepath:r}),o&&f.insert({filepath:r,stats:c,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function W8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,depth:i}){try{return F("fs",t),F("gitdir",n),F("ref",r),await q.resolve({fs:new Q(t),gitdir:n,ref:r,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function q8({fs:t,dir:e,gitdir:n=B(e,".git"),path:r,value:i,append:a=!1}){try{F("fs",t),F("gitdir",n),F("path",r);let s=new Q(t),o=await ze.get({fs:s,gitdir:n});a?await o.append(r,i):await o.set(r,i),await ze.save({fs:s,gitdir:n,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function X8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let a=new Q(t);if(await Ii.isIgnored({fs:a,gitdir:n,dir:e,filepath:r}))return"ignored";let o=await Y8({fs:a,cache:i,gitdir:n}),l=await K1({fs:a,cache:i,gitdir:n,tree:o,path:r}),c=await lt.acquire({fs:a,gitdir:n,cache:i},async function(g){for(let m of g)if(m.path===r)return m;return null}),u=await a.lstat(B(e,r)),f=l!==null,h=c!==null,d=u!==null,p=async()=>{if(h&&!Lo(c,u))return c.oid;{let g=await a.read(B(e,r)),m=await Z1({gitdir:n,type:"blob",object:g});return h&&c.oid===m&&u.size!==-1&<.acquire({fs:a,gitdir:n,cache:i},async function(w){w.insert({filepath:r,stats:u,oid:m})}),m}};if(!f&&!d&&!h)return"absent";if(!f&&!d&&h)return"*absent";if(!f&&d&&!h)return"*added";if(!f&&d&&h)return await p()===c.oid?"added":"*added";if(f&&!d&&!h)return"deleted";if(f&&!d&&h)return l===c.oid,"*deleted";if(f&&d&&!h)return await p()===l?"*undeleted":"*undeletemodified";if(f&&d&&h){let g=await p();return g===l?g===c.oid?"unmodified":"*unmodified":g===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function K1({fs:t,cache:e,gitdir:n,tree:r,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of r)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await Ge({fs:t,cache:e,gitdir:n,oid:s.oid});if(o==="tree"){let c=It.from(l);return K1({fs:t,cache:e,gitdir:n,tree:c,path:i})}if(o==="blob")throw new kt(s.oid,o,"blob",i.join("/"))}return null}async function Y8({fs:t,cache:e,gitdir:n}){let r;try{r=await q.resolve({fs:t,gitdir:n,ref:"HEAD"})}catch(a){if(a instanceof Re)return[]}let{tree:i}=await Di({fs:t,cache:e,gitdir:n,oid:r});return i}async function Z8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let l=new Q(t);return await Pi({fs:l,cache:s,dir:e,gitdir:n,trees:[sr({ref:r}),Yo(),Xo()],map:async function(c,[u,f,h]){if(!u&&!h&&f&&!o&&await Ii.isIgnored({fs:l,dir:e,filepath:c})||!i.some(A=>L1(c,A)))return null;if(a&&!a(c))return;let[d,p,g]=await Promise.all([u&&u.type(),f&&f.type(),h&&h.type()]),m=[d,p,g].includes("blob");if((d==="tree"||d==="special")&&!m)return;if(d==="commit")return null;if((p==="tree"||p==="special")&&!m)return;if(g==="commit")return null;if((g==="tree"||g==="special")&&!m)return;let w=d==="blob"?await u.oid():void 0,b=g==="blob"?await h.oid():void 0,S;d!=="blob"&&p==="blob"&&g!=="blob"?S="42":p==="blob"&&(S=await f.oid());let k=[void 0,w,S,b],x=k.map(A=>k.indexOf(A));return x.shift(),[c,...x]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function K8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,force:a=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let s=new Q(t);if(r===void 0)throw new Pt("ref");r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`;let o=await q.resolve({fs:s,gitdir:n,ref:i||"HEAD"});if(!a&&await q.exists({fs:s,gitdir:n,ref:r}))throw new hn("tag",r);await q.writeRef({fs:s,gitdir:n,ref:r,value:o})}catch(s){throw s.caller="git.tag",s}}async function J8({fs:t,dir:e,gitdir:n=B(e,".git"),cache:r={},filepath:i,oid:a,mode:s,add:o,remove:l,force:c}){try{F("fs",t),F("gitdir",n),F("filepath",i);let u=new Q(t);if(l)return await lt.acquire({fs:u,gitdir:n,cache:r},async function(h){let d;if(!c&&(d=await u.lstat(B(e,i)),d)){if(d.isDirectory())throw new cr("directory");return}h.has({filepath:i})&&h.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(B(e,i)),!f)throw new Re(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new cr("directory")}return await lt.acquire({fs:u,gitdir:n,cache:r},async function(h){if(!o&&!h.has({filepath:i}))throw new Re(`file at "${i}" in index and "add" not set`);let d={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};if(!a){d=f;let p=d.isSymbolicLink()?await u.readlink(B(e,i)):await u.read(B(e,i));a=await zt({fs:u,gitdir:n,type:"blob",format:"content",object:p})}return h.insert({filepath:i,oid:a,stats:d}),a})}catch(u){throw u.caller="git.updateIndex",u}}function Q8(){try{return Ko.version}catch(t){throw t.caller="git.version",t}}async function e6({fs:t,dir:e,gitdir:n=B(e,".git"),trees:r,map:i,reduce:a,iterate:s,cache:o={}}){try{return F("fs",t),F("gitdir",n),F("trees",r),await Pi({fs:new Q(t),cache:o,dir:e,gitdir:n,trees:r,map:i,reduce:a,iterate:s})}catch(l){throw l.caller="git.walk",l}}async function t6({fs:t,dir:e,gitdir:n=B(e,".git"),blob:r}){try{return F("fs",t),F("gitdir",n),F("blob",r),await zt({fs:new Q(t),gitdir:n,type:"blob",object:r,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function n6({fs:t,gitdir:e,commit:n}){let r=Rt.from(n).toObject();return await zt({fs:t,gitdir:e,type:"commit",object:r,format:"content"})}async function r6({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r}){try{return F("fs",t),F("gitdir",n),F("commit",r),await n6({fs:new Q(t),gitdir:n,commit:r})}catch(i){throw i.caller="git.writeCommit",i}}async function i6({fs:t,dir:e,gitdir:n=B(e,".git"),type:r,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let l=new Q(t);if(a==="parsed"){switch(r){case"commit":i=Rt.from(i).toObject();break;case"tree":i=It.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=Ut.from(i).toObject();break;default:throw new kt(s||"",r,"blob|commit|tag|tree")}a="content"}return s=await zt({fs:l,gitdir:n,type:r,object:i,oid:s,format:a}),s}catch(l){throw l.caller="git.writeObject",l}}async function a6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,value:i,force:a=!1,symbolic:s=!1}){try{F("fs",t),F("gitdir",n),F("ref",r),F("value",i);let o=new Q(t);if(r!==fn.default.clean(r))throw new zn(r,fn.default.clean(r));if(!a&&await q.exists({fs:o,gitdir:n,ref:r}))throw new hn("ref",r);s?await q.writeSymbolicRef({fs:o,gitdir:n,ref:r,value:i}):(i=await q.resolve({fs:o,gitdir:n,ref:i}),await q.writeRef({fs:o,gitdir:n,ref:r,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function s6({fs:t,gitdir:e,tag:n}){let r=Ut.from(n).toObject();return await zt({fs:t,gitdir:e,type:"tag",object:r,format:"content"})}async function o6({fs:t,dir:e,gitdir:n=B(e,".git"),tag:r}){try{return F("fs",t),F("gitdir",n),F("tag",r),await s6({fs:new Q(t),gitdir:n,tag:r})}catch(i){throw i.caller="git.writeTag",i}}async function l6({fs:t,dir:e,gitdir:n=B(e,".git"),tree:r}){try{return F("fs",t),F("gitdir",n),F("tree",r),await Hf({fs:new Q(t),gitdir:n,tree:r})}catch(i){throw i.caller="git.writeTree",i}}var c6={Errors:hs,STAGE:Xo,TREE:sr,WORKDIR:Yo,add:lC,abortMerge:rC,addNote:uC,addRemote:fC,annotatedTag:dC,branch:mC,checkout:yC,clone:CC,commit:FC,getConfig:ZC,getConfigAll:JC,setConfig:q8,currentBranch:MC,deleteBranch:PC,deleteRef:IC,deleteRemote:LC,deleteTag:DC,expandOid:HC,expandRef:UC,fastForward:WC,fetch:qC,findMergeBase:XC,findRoot:YC,getRemoteInfo:QC,getRemoteInfo2:e8,hashBlob:n8,indexPack:i8,init:a8,isDescendent:s8,isIgnored:o8,listBranches:l8,listFiles:u8,listNotes:h8,listRemotes:p8,listServerRefs:y8,listTags:v8,log:_8,merge:S8,packObjects:A8,pull:T8,push:P8,readBlob:ms,readCommit:I8,readNote:L8,readObject:j8,readTag:B8,readTree:N8,remove:$8,removeNote:U8,renameBranch:G8,resetIndex:V8,updateIndex:J8,resolveRef:W8,status:X8,statusMatrix:Z8,tag:K8,version:Q8,walk:e6,writeBlob:t6,writeCommit:r6,writeObject:i6,writeRef:a6,writeTag:o6,writeTree:l6},ae=c6;var _e=require("obsidian");v();var ti=require("obsidian");v();var RS=require("child_process"),LS=Ze(el()),Jr=require("obsidian"),vt=Ze(require("path")),Hs=require("path");v();var pl=Ze(ry(),1),ul=Ze(el(),1),Fv=require("child_process"),hw=Ze(Wf(),1),Ui=Ze(Wf(),1),Bw=require("node:events"),hl=Object.defineProperty,C6=Object.defineProperties,F6=Object.getOwnPropertyDescriptor,M6=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertyNames,iy=Object.getOwnPropertySymbols,Dy=Object.prototype.hasOwnProperty,O6=Object.prototype.propertyIsEnumerable,ay=(t,e,n)=>e in t?hl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,tn=(t,e)=>{for(var n in e||(e={}))Dy.call(e,n)&&ay(t,n,e[n]);if(iy)for(var n of iy(e))O6.call(e,n)&&ay(t,n,e[n]);return t},vs=(t,e)=>C6(t,M6(e)),W=(t,e)=>function(){return t&&(e=(0,t[hh(t)[0]])(t=0)),e},P6=(t,e)=>function(){return e||(0,t[hh(t)[0]])((e={exports:{}}).exports,e),e.exports},Qe=(t,e)=>{for(var n in e)hl(t,n,{get:e[n],enumerable:!0})},I6=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hh(e))!Dy.call(t,i)&&i!==n&&hl(t,i,{get:()=>e[i],enumerable:!(r=F6(e,i))||r.enumerable});return t},We=t=>I6(hl({},"__esModule",{value:!0}),t),ys=(t,e,n)=>new Promise((r,i)=>{var a=l=>{try{o(n.next(l))}catch(c){i(c)}},s=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((n=n.apply(t,e)).next())});function R6(...t){let e=new String(t);return dl.set(e,t),e}function ll(t){return t instanceof String&&dl.has(t)}function sy(t){return dl.get(t)||[]}var dl,_s=W({"src/lib/args/pathspec.ts"(){"use strict";dl=new WeakMap}}),dn,fr=W({"src/lib/errors/git-error.ts"(){"use strict";dn=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),Ss,Gi=W({"src/lib/errors/git-response-error.ts"(){"use strict";fr(),Ss=class extends dn{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),By,Ny=W({"src/lib/errors/task-configuration-error.ts"(){"use strict";fr(),By=class extends dn{constructor(t){super(void 0,t)}}}});function $y(t){return typeof t=="function"?t:Xr}function Hy(t){return typeof t=="function"&&t!==Xr}function Uy(t,e){let n=t.indexOf(e);return n<=0?[t,""]:[t.substr(0,n),t.substr(n+1)]}function zy(t,e=0){return Gy(t)&&t.length>e?t[e]:void 0}function qr(t,e=0){if(Gy(t)&&t.length>e)return t[t.length-1-e]}function Gy(t){return!!(t&&typeof t.length=="number")}function Es(t="",e=!0,n=` +`){return t.split(n).reduce((r,i)=>{let a=e?i.trim():i;return a&&r.push(a),r},[])}function dh(t,e){return Es(t,!0).map(n=>e(n))}function ph(t){return(0,pl.exists)(t,pl.FOLDER)}function we(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function Vy(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ml(t,e){if(Array.isArray(t)){let n=t.indexOf(e);n>=0&&t.splice(n,1)}else t.delete(e);return e}function Cn(t){return Array.isArray(t)?t:[t]}function Wy(t){return t.replace(/[\s-]+(.)/g,(e,n)=>n.toUpperCase())}function qy(t){return Cn(t).map(String)}function Pe(t,e=0){if(t==null)return e;let n=parseInt(t,10);return isNaN(n)?e:n}function ws(t,e){let n=[];for(let r=0,i=t.length;rn in t?{[n]:t[n]}:{}))}function Qf(t=0){return new Promise(e=>setTimeout(e,t))}function eh(t){if(t!==!1)return t}var zi,Xr,ks,gl=W({"src/lib/utils/util.ts"(){"use strict";zi="\0",Xr=()=>{},ks=Object.prototype.toString.call.bind(Object.prototype.toString)}});function Fn(t,e,n){return e(t)?t:arguments.length>2?n:void 0}function mh(t,e){let n=ll(t)?"string":typeof t;return/number|string|boolean/.test(n)&&(!e||!e.includes(n))}function gh(t){return!!t&&ks(t)==="[object Object]"}function Yy(t){return typeof t=="function"}var As,gt,Zy,cl,yh,Ky=W({"src/lib/utils/argument-filters.ts"(){"use strict";gl(),_s(),As=t=>Array.isArray(t),gt=t=>typeof t=="string",Zy=t=>Array.isArray(t)&&t.every(gt),cl=t=>gt(t)||Array.isArray(t)&&t.every(gt),yh=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),th,L6=W({"src/lib/utils/exit-codes.ts"(){"use strict";th=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(th||{})}}),xs,j6=W({"src/lib/utils/git-output-streams.ts"(){"use strict";xs=class{constructor(t,e){this.stdOut=t,this.stdErr=e}asStrings(){return new xs(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),fe,ur,D6=W({"src/lib/utils/line-parser.ts"(){"use strict";fe=class{constructor(t,e){this.matches=[],this.parse=(n,r)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,n(a)))?this.useMatches(r,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,n){let r=n&&t.exec(n);return r&&this.pushMatch(e,r),!!r}pushMatch(t,e){this.matches.push(...e.slice(1))}},ur=class extends fe{addMatch(t,e,n){return/^remote:\s/.test(String(n))&&super.addMatch(t,e,n)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function Jy(...t){let e=process.cwd(),n=Object.assign(tn({baseDir:e},Qy),...t.filter(r=>typeof r=="object"&&r));return n.baseDir=n.baseDir||e,n.trimmed=n.trimmed===!0,n}var Qy,B6=W({"src/lib/utils/simple-git-options.ts"(){"use strict";Qy={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function vh(t,e=[]){return gh(t)?Object.keys(t).reduce((n,r)=>{let i=t[r];return ll(i)?n.push(i):mh(i,["boolean"])?n.push(r+"="+i):n.push(r),n},e):e}function Lt(t,e=0,n=!1){let r=[];for(let i=0,a=e<0?t.length:e;i{for(let a=Es(i,r),s=0,o=a.length;s{if(!(s+c>=o))return a[s+c]};e.some(({parse:c})=>c(l,t))}}),t}var H6=W({"src/lib/utils/task-parser.ts"(){"use strict";gl()}}),ev={};Qe(ev,{ExitCodes:()=>th,GitOutputStreams:()=>xs,LineParser:()=>fe,NOOP:()=>Xr,NULL:()=>zi,RemoteLineParser:()=>ur,append:()=>we,appendTaskOptions:()=>vh,asArray:()=>Cn,asCamelCase:()=>Wy,asFunction:()=>$y,asNumber:()=>Pe,asStringArray:()=>qy,bufferToString:()=>bs,callTaskParser:()=>nh,createInstanceConfig:()=>Jy,delay:()=>Qf,filterArray:()=>As,filterFunction:()=>Yy,filterHasLength:()=>yh,filterPlainObject:()=>gh,filterPrimitives:()=>mh,filterString:()=>gt,filterStringArray:()=>Zy,filterStringOrStringArray:()=>cl,filterType:()=>Fn,first:()=>zy,folderExists:()=>ph,forEachLineWithContent:()=>dh,getTrailingOptions:()=>Lt,including:()=>Vy,isUserFunction:()=>Hy,last:()=>qr,objectToString:()=>ks,orVoid:()=>eh,parseStringResponse:()=>Dt,pick:()=>Xy,prefixedArray:()=>ws,remove:()=>ml,splitOn:()=>Uy,toLinesWithContent:()=>Es,trailingFunctionArgument:()=>qe,trailingOptionsArgument:()=>wh});var oe=W({"src/lib/utils/index.ts"(){"use strict";Ky(),L6(),j6(),D6(),B6(),$6(),H6(),gl()}}),tv={};Qe(tv,{CheckRepoActions:()=>rh,checkIsBareRepoTask:()=>rv,checkIsRepoRootTask:()=>nv,checkIsRepoTask:()=>U6});function U6(t){switch(t){case"bare":return rv();case"root":return nv()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:yl,parser:bh}}function nv(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:yl,parser(e){return/^\.(git)?$/.test(e.trim())}}}function rv(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:yl,parser:bh}}function z6(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var rh,yl,bh,iv=W({"src/lib/tasks/check-is-repo.ts"(){"use strict";oe(),rh=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(rh||{}),yl=({exitCode:t},e,n,r)=>{if(t===128&&z6(e))return n(Buffer.from("false"));r(e)},bh=t=>t.trim()==="true"}});function G6(t,e){let n=new av(t),r=t?ov:sv;return Es(e).forEach(i=>{let a=i.replace(r,"");n.paths.push(a),(lv.test(a)?n.folders:n.files).push(a)}),n}var av,sv,ov,lv,V6=W({"src/lib/responses/CleanSummary.ts"(){"use strict";oe(),av=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},sv=/^[a-z]+\s*/i,ov=/^[a-z]+\s+[a-z]+\s*/i,lv=/\/$/}}),ih={};Qe(ih,{EMPTY_COMMANDS:()=>vl,adhocExecTask:()=>cv,configurationErrorTask:()=>jt,isBufferTask:()=>fv,isEmptyTask:()=>hv,straightThroughBufferTask:()=>uv,straightThroughStringTask:()=>Tt});function cv(t){return{commands:vl,format:"empty",parser:t}}function jt(t){return{commands:vl,format:"empty",parser(){throw typeof t=="string"?new By(t):t}}}function Tt(t,e=!1){return{commands:t,format:"utf-8",parser(n){return e?String(n).trim():n}}}function uv(t){return{commands:t,format:"buffer",parser(e){return e}}}function fv(t){return t.format==="buffer"}function hv(t){return t.format==="empty"||!t.commands.length}var vl,Je=W({"src/lib/tasks/task.ts"(){"use strict";Ny(),vl=[]}}),dv={};Qe(dv,{CONFIG_ERROR_INTERACTIVE_MODE:()=>xh,CONFIG_ERROR_MODE_REQUIRED:()=>_h,CONFIG_ERROR_UNKNOWN_OPTION:()=>Sh,CleanOptions:()=>il,cleanTask:()=>pv,cleanWithOptionsTask:()=>W6,isCleanOptionsArray:()=>q6});function W6(t,e){let{cleanMode:n,options:r,valid:i}=X6(t);return n?i.options?(r.push(...e),r.some(K6)?jt(xh):pv(n,r)):jt(Sh+JSON.stringify(t)):jt(_h)}function pv(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(r){return G6(t==="n",r)}}}function q6(t){return Array.isArray(t)&&t.every(e=>Eh.has(e))}function X6(t){let e,n=[],r={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{Y6(i)?(e=i,r.cleanMode=!0):r.options=r.options&&Z6(n[n.length]=`-${i}`)}),{cleanMode:e,options:n,valid:r}}function Y6(t){return t==="f"||t==="n"}function Z6(t){return/^-[a-z]$/i.test(t)&&Eh.has(t.charAt(1))}function K6(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var xh,_h,Sh,il,Eh,mv=W({"src/lib/tasks/clean.ts"(){"use strict";V6(),oe(),Je(),xh="Git clean interactive mode is not supported",_h='Git clean mode parameter ("n" or "f") is required',Sh="Git clean unknown option found in: ",il=(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))(il||{}),Eh=new Set(["i",...qy(Object.values(il))])}});function J6(t){let e=new yv;for(let n of gv(t))e.addValue(n.file,String(n.key),n.value);return e}function Q6(t,e){let n=null,r=[],i=new Map;for(let a of gv(t,e))a.key===e&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:e,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function e4(t){return t.replace(/^(file):/,"")}function*gv(t,e=null){let n=t.split("\0");for(let r=0,i=n.length-1;rObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=qr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,n){let r=this.addFile(t);r.hasOwnProperty(e)?Array.isArray(r[e])?r[e].push(n):r[e]=[r[e],n]:r[e]=n,this._all=void 0}}}});function qf(t,e){return typeof t=="string"&&ah.hasOwnProperty(t)?t:e}function n4(t,e,n,r){let i=["config",`--${r}`];return n&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function r4(t,e){let n=["config","--null","--show-origin","--get-all",t];return e&&n.splice(1,0,`--${e}`),{commands:n,format:"utf-8",parser(r){return Q6(r,t)}}}function i4(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(n){return J6(n)}}}function a4(){return{addConfig(t,e,...n){return this._runTask(n4(t,e,n[0]===!0,qf(n[1],"local")),qe(arguments))},getConfig(t,e){return this._runTask(r4(t,qf(e,void 0)),qe(arguments))},listConfig(...t){return this._runTask(i4(qf(t[0],void 0)),qe(arguments))}}}var ah,vv=W({"src/lib/tasks/config.ts"(){"use strict";t4(),oe(),ah=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(ah||{})}});function s4(t){return wv.has(t)}var Xf,wv,bv=W({"src/lib/tasks/diff-name-status.ts"(){"use strict";Xf=(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))(Xf||{}),wv=new Set(Object.values(Xf))}});function o4(...t){return new _v().param(...t)}function l4(t){let e=new Set,n={};return dh(t,r=>{let[i,a,s]=r.split(zi);e.add(i),(n[i]=n[i]||[]).push({line:Pe(a),path:i,preview:s})}),{paths:e,results:n}}function c4(){return{grep(t){let e=qe(arguments),n=Lt(arguments);for(let i of xv)if(n.includes(i))return this._runTask(jt(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=o4().param(t));let r=["grep","--null","-n","--full-name",...n,...t];return this._runTask({commands:r,format:"utf-8",parser(i){return l4(i)}},e)}}}var xv,gs,oy,_v,Sv=W({"src/lib/tasks/grep.ts"(){"use strict";oe(),Je(),xv=["-h"],gs=Symbol("grepQuery"),_v=class{constructor(){this[oy]=[]}*[(oy=gs,Symbol.iterator)](){for(let t of this[gs])yield t}and(...t){return t.length&&this[gs].push("--and","(",...ws(t,"-e"),")"),this}param(...t){return this[gs].push(...ws(t,"-e")),this}}}}),Ev={};Qe(Ev,{ResetMode:()=>al,getResetMode:()=>f4,resetTask:()=>u4});function u4(t,e){let n=["reset"];return kv(t)&&n.push(`--${t}`),n.push(...e),Tt(n)}function f4(t){if(kv(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function kv(t){return Av.includes(t)}var al,Av,Tv=W({"src/lib/tasks/reset.ts"(){"use strict";Je(),al=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(al||{}),Av=Array.from(Object.values(al))}});function h4(){return(0,ul.default)("simple-git")}function ly(t,e,n){return!e||!String(e).replace(/\s*/,"")?n?(r,...i)=>{t(r,...i),n(r,...i)}:t:(r,...i)=>{t(`%s ${r}`,e,...i),n&&n(r,...i)}}function d4(t,e,{namespace:n}){if(typeof t=="string")return t;let r=e&&e.namespace||"";return r.startsWith(n)?r.substr(n.length+1):r||n}function kh(t,e,n,r=h4()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?r.extend(e):e,o=d4(Fn(e,gt),s,r);return c(n);function l(u,f){return we(a,kh(t,o.replace(/^[^:]+/,u),f,r))}function c(u){let f=u&&`[${u}]`||"",h=s&&ly(s,f)||Xr,d=ly(r,`${i} ${f}`,h);return Object.assign(s?h:d,{label:t,sibling:l,info:d,step:c})}}var Cv=W({"src/lib/git-logger.ts"(){"use strict";oe(),ul.default.formatters.L=t=>String(yh(t)?t.length:"-"),ul.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):ks(t)}}),nl,sh,p4=W({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";fr(),Cv(),nl=class{constructor(t="GitExecutor"){this.logLabel=t,this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){let e=nl.getName(t.commands[0]),n=kh(this.logLabel,e);return{task:t,logger:n,name:e}}push(t){let e=this.createProgress(t);return e.logger("Adding task to the queue, commands = %o",t.commands),this._queue.set(t,e),e}fatal(t){for(let[e,{logger:n}]of Array.from(this._queue.entries()))e===t.task?(n.info("Failed %o",t),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",t.message),this.complete(e);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(t){this.withProgress(t)&&this._queue.delete(t)}attempt(t){let e=this.withProgress(t);if(!e)throw new dn(void 0,"TasksPendingQueue: attempt called for an unknown task");return e.logger("Starting task"),e}static getName(t="empty"){return`task:${t}:${++nl.counter}`}},sh=nl,sh.counter=0}});function Wr(t,e){return{method:zy(t.commands)||"",commands:e}}function m4(t,e){return n=>{e("[ERROR] child process exception %o",n),t.push(Buffer.from(String(n.stack),"ascii"))}}function cy(t,e,n,r){return i=>{n("%s received %L bytes",e,i),r("%B",i),t.push(i)}}var oh,g4=W({"src/lib/runners/git-executor-chain.ts"(){"use strict";fr(),Je(),oe(),p4(),oh=class{constructor(t,e,n){this._executor=t,this._scheduler=e,this._plugins=n,this._chain=Promise.resolve(),this._queue=new sh}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))}attemptTask(t){return ys(this,null,function*(){let e=yield this._scheduler.next(),n=()=>this._queue.complete(t);try{let{logger:r}=this._queue.attempt(t);return yield hv(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{n(),e()}})}onFatalException(t,e){let n=e instanceof dn?Object.assign(e,{task:t}):new dn(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(n),n}attemptRemoteTask(t,e){return ys(this,null,function*(){let n=this._plugins.exec("spawn.binary","",Wr(t,t.commands)),r=this._plugins.exec("spawn.args",[...t.commands],Wr(t,t.commands)),i=yield this.gitResponse(t,n,r,this.outputHandler,e.step("SPAWN")),a=yield this.handleTaskData(t,r,i,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),fv(t)?nh(t.parser,a):nh(t.parser,a.asStrings())})}attemptEmptyTask(t,e){return ys(this,null,function*(){return e("empty task bypassing child process to call to task's parser"),t.parser(this)})}handleTaskData(t,e,n,r){let{exitCode:i,rejection:a,stdOut:s,stdErr:o}=n;return new Promise((l,c)=>{r("Preparing to handle process response exitCode=%d stdOut=",i);let{error:u}=this._plugins.exec("task.error",{error:a},tn(tn({},Wr(t,e)),n));if(u&&t.onError)return r.info("exitCode=%s handling with custom error handler"),t.onError(n,u,f=>{r.info("custom error handler treated as success"),r("custom error returned a %s",ks(f)),l(new xs(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},c);if(u)return r.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,o.length,a),c(u);r.info("retrieving task output complete"),l(new xs(Buffer.concat(s),Buffer.concat(o)))})}gitResponse(t,e,n,r,i){return ys(this,null,function*(){let a=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Wr(t,t.commands));return new Promise(o=>{let l=[],c=[];i.info("%s %o",e,n),i("%O",s);let u=this._beforeSpawn(t,n);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,vs(tn({},Wr(t,n)),{kill(h){u=h||u}}));let f=(0,Fv.spawn)(e,n,s);f.stdout.on("data",cy(l,"stdOut",i,a.step("stdOut"))),f.stderr.on("data",cy(c,"stdErr",i,a.step("stdErr"))),f.on("error",m4(c,i)),r&&(i("Passing child process stdOut/stdErr to custom outputHandler"),r(e,f.stdout,f.stderr,[...n])),this._plugins.exec("spawn.after",void 0,vs(tn({},Wr(t,n)),{spawned:f,close(h,d){o({stdOut:l,stdErr:c,exitCode:h,rejection:u||d})},kill(h){f.killed||(u=h,f.kill("SIGINT"))}}))})})}_beforeSpawn(t,e){let n;return this._plugins.exec("spawn.before",void 0,vs(tn({},Wr(t,e)),{kill(r){n=r||n}})),n}}}}),Mv={};Qe(Mv,{GitExecutor:()=>Ov});var Ov,y4=W({"src/lib/runners/git-executor.ts"(){"use strict";g4(),Ov=class{constructor(t,e,n){this.cwd=t,this._scheduler=e,this._plugins=n,this._chain=new oh(this,this._scheduler,this._plugins)}chain(){return new oh(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function v4(t,e,n=Xr){let r=a=>{n(null,a)},i=a=>{(a==null?void 0:a.task)===t&&n(a instanceof Ss?w4(a):a,void 0)};e.then(r,i)}function w4(t){let e=r=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${r} should be GitResponseError.git.${r}, this will no longer be available in version 3`),e=Xr};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(n,{}));function n(r,i){return i in t||(r[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),r}}var b4=W({"src/lib/task-callback.ts"(){"use strict";Gi(),oe()}});function uy(t,e){return cv(n=>{if(!ph(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||n).cwd=t})}var x4=W({"src/lib/tasks/change-working-directory.ts"(){"use strict";oe(),Je()}});function Yf(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=ml(e,"-B")),Tt(e)}function _4(){return{checkout(){return this._runTask(Yf(Lt(arguments,1)),qe(arguments))},checkoutBranch(t,e){return this._runTask(Yf(["-b",t,e,...Lt(arguments)]),qe(arguments))},checkoutLocalBranch(t){return this._runTask(Yf(["-b",t,...Lt(arguments)]),qe(arguments))}}}var S4=W({"src/lib/tasks/checkout.ts"(){"use strict";oe(),Je()}});function E4(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function k4(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Dt(E4(),[Pv],t)}})}}}var Pv,A4=W({"src/lib/tasks/count-objects.ts"(){"use strict";oe(),Pv=new fe(/([a-z-]+): (\d+)$/,(t,[e,n])=>{let r=Wy(e);t.hasOwnProperty(r)&&(t[r]=Pe(n))})}});function T4(t){return Dt({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},Iv,t)}var Iv,C4=W({"src/lib/parsers/parse-commit.ts"(){"use strict";oe(),Iv=[new fe(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,n,r])=>{t.branch=e,t.commit=r,t.root=!!n}),new fe(/\s*Author:\s(.+)/i,(t,[e])=>{let n=e.split("<"),r=n.pop();!r||!r.includes("@")||(t.author={email:r.substr(0,r.length-1),name:n.join("<").trim()})}),new fe(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(n,10)||0,t.summary.deletions=parseInt(r,10)||0}),new fe(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(n,10)||0;r==="-"?t.summary.deletions=i:r==="+"&&(t.summary.insertions=i)})]}});function F4(t,e,n){return{commands:["-c","core.abbrev=40","commit",...ws(t,"-m"),...e,...n],format:"utf-8",parser:T4}}function M4(){return{commit(e,...n){let r=qe(arguments),i=t(e)||F4(Cn(e),Cn(Fn(n[0],cl,[])),[...Fn(n[1],As,[]),...Lt(arguments,0,!0)]);return this._runTask(i,r)}};function t(e){return!cl(e)&&jt("git.commit: requires the commit message to be supplied as a string/string[]")}}var O4=W({"src/lib/tasks/commit.ts"(){"use strict";C4(),oe(),Je()}});function P4(){return{firstCommit(){return this._runTask(Tt(["rev-list","--max-parents=0","HEAD"],!0),qe(arguments))}}}var I4=W({"src/lib/tasks/first-commit.ts"(){"use strict";oe(),Je()}});function R4(t,e){let n=["hash-object",t];return e&&n.push("-w"),Tt(n,!0)}var L4=W({"src/lib/tasks/hash-object.ts"(){"use strict";Je()}});function j4(t,e,n){let r=String(n).trim(),i;if(i=Rv.exec(r))return new sl(t,e,!1,i[1]);if(i=Lv.exec(r))return new sl(t,e,!0,i[1]);let a="",s=r.split(" ");for(;s.length;)if(s.shift()==="in"){a=s.join(" ");break}return new sl(t,e,/^re/i.test(r),a)}var sl,Rv,Lv,D4=W({"src/lib/responses/InitSummary.ts"(){"use strict";sl=class{constructor(t,e,n,r){this.bare=t,this.path=e,this.existing=n,this.gitDir=r}},Rv=/^Init.+ repository in (.+)$/,Lv=/^Rein.+ in (.+)$/}});function B4(t){return t.includes(Ah)}function N4(t=!1,e,n){let r=["init",...n];return t&&!B4(r)&&r.splice(1,0,Ah),{commands:r,format:"utf-8",parser(i){return j4(r.includes("--bare"),e,i)}}}var Ah,$4=W({"src/lib/tasks/init.ts"(){"use strict";D4(),Ah="--bare"}});function Th(t){for(let e=0;eDt(new jv,e,n,!1)}var Zf,fy,hy,dy,Bv,Nv=W({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Ts(),U4(),bv(),oe(),Zf=[new fe(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,n,r=""])=>{t.files.push({file:e.trim(),changes:Pe(n),insertions:r.replace(/[^+]/g,"").length,deletions:r.replace(/[^-]/g,"").length,binary:!1})}),new fe(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,n,r])=>{t.files.push({file:e.trim(),before:Pe(n),after:Pe(r),binary:!0})}),new fe(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);t.changed=Pe(e),t.insertions=Pe(r==null?void 0:r[1]),t.deletions=Pe(i==null?void 0:i[1])})],fy=[new fe(/(\d+)\t(\d+)\t(.+)$/,(t,[e,n,r])=>{let i=Pe(e),a=Pe(n);t.changed++,t.insertions+=i,t.deletions+=a,t.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new fe(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],hy=[new fe(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],dy=[new fe(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,n,r,i,a])=>{t.changed++,t.files.push({file:a!=null?a:r,changes:0,insertions:0,deletions:0,binary:!1,status:eh(s4(e)&&e),from:eh(!!a&&r!==a&&r),similarity:Pe(n)})})],Bv={"":Zf,"--stat":Zf,"--numstat":fy,"--name-status":dy,"--name-only":hy}}});function z4(t,e){return e.reduce((n,r,i)=>(n[r]=t[i]||"",n),Object.create({diff:null}))}function $v(t=Oh,e=Hv,n=""){let r=Dv(n);return function(i){let a=Es(i.trim(),!1,Fh).map(function(s){let o=s.split(Mh),l=z4(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=r(o[1])),l});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var Fh,Mh,Oh,Hv,Uv=W({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";oe(),Nv(),Ts(),Fh="\xF2\xF2\xF2\xF2\xF2\xF2 ",Mh=" \xF2\xF2",Oh=" \xF2 ",Hv=["hash","date","message","refs","author_name","author_email"]}}),zv={};Qe(zv,{diffSummaryTask:()=>G4,validateLogFormatConfig:()=>wl});function G4(t){let e=Th(t),n=["diff"];return e===""&&(e="--stat",n.push("--stat=4096")),n.push(...t),wl(n)||{commands:n,format:"utf-8",parser:Dv(e)}}function wl(t){let e=t.filter(H4);if(e.length>1)return jt(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return jt(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var Ph=W({"src/lib/tasks/diff.ts"(){"use strict";Ts(),Nv(),Je()}});function V4(t,e){let n=[],r=[];return Object.keys(t).forEach(i=>{n.push(i),r.push(String(t[i]))}),[n,r.join(e)]}function W4(t){return Object.keys(t).reduce((e,n)=>(n in lh||(e[n]=t[n]),e),{})}function Gv(t={},e=[]){let n=Fn(t.splitter,gt,Oh),r=!mh(t.format)&&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"},[i,a]=V4(r,n),s=[],o=[`--pretty=format:${Fh}${a}${Mh}`,...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?"...":"..";s.push(`${t.from||""}${c}${t.to||""}`)}return gt(t.file)&&o.push("--follow",R6(t.file)),vh(W4(t),o),{fields:i,splitter:n,commands:[...o,...s]}}function q4(t,e,n){let r=$v(t,e,Th(n));return{commands:["log",...n],format:"utf-8",parser:r}}function X4(){return{log(...n){let r=qe(arguments),i=Gv(wh(arguments),Fn(arguments[0],As)),a=e(...n)||wl(i.commands)||t(i);return this._runTask(a,r)}};function t(n){return q4(n.splitter,n.fields,n.commands)}function e(n,r){return gt(n)&>(r)&&jt("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var lh,Vv=W({"src/lib/tasks/log.ts"(){"use strict";Ts(),_s(),Uv(),oe(),Je(),Ph(),lh=(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))(lh||{})}}),ol,Wv,Y4=W({"src/lib/responses/MergeSummary.ts"(){"use strict";ol=class{constructor(t,e=null,n){this.reason=t,this.file=e,this.meta=n}toString(){return`${this.file}:${this.reason}`}},Wv=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"}}}}),ch,qv,Z4=W({"src/lib/responses/PullSummary.ts"(){"use strict";ch=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},qv=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Kf(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 py(t){let e=/^\s*(\d+)/.exec(t),n=/delta (\d+)/i.exec(t);return{count:Pe(e&&e[1]||"0"),delta:Pe(n&&n[1]||"0")}}var Xv,K4=W({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";oe(),Xv=[new ur(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Kf(t.remoteMessages);Object.assign(i,{[r]:Pe(n)})}),new ur(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Kf(t.remoteMessages);Object.assign(i,{[r]:Pe(n)})}),new ur(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,n,r])=>{let i=Kf(t.remoteMessages);i.total=py(e),i.reused=py(n),i.packReused=Pe(r)})]}});function Yv(t,e){return Dt({remoteMessages:new Kv},Zv,e)}var Zv,Kv,Jv=W({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";oe(),K4(),Zv=[new ur(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Xv,new ur([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new ur([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,n,r])=>{t.remoteMessages.vulnerabilities={count:Pe(e),summary:n,url:r}})],Kv=class{constructor(){this.all=[]}}}});function J4(t,e){let n=Dt(new qv,Qv,[t,e]);return n.message&&n}var my,gy,yy,vy,Qv,wy,Ih,ew=W({"src/lib/parsers/parse-pull.ts"(){"use strict";Z4(),oe(),Jv(),my=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,gy=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,yy=/^(create|delete) mode \d+ (.+)/,vy=[new fe(my,(t,[e,n,r])=>{t.files.push(e),n&&(t.insertions[e]=n.length),r&&(t.deletions[e]=r.length)}),new fe(gy,(t,[e,,n,,r])=>n!==void 0||r!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+n||0,t.summary.deletions=+r||0,!0):!1),new fe(yy,(t,[e,n])=>{we(t.files,n),we(e==="create"?t.created:t.deleted,n)})],Qv=[new fe(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new fe(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new fe(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,n,r,i])=>{t.branch.local=r,t.hash.local=e,t.branch.remote=i,t.hash.remote=n})],wy=(t,e)=>Dt(new ch,vy,[t,e]),Ih=(t,e)=>Object.assign(new ch,wy(t,e),Yv(t,e))}}),by,tw,xy,Q4=W({"src/lib/parsers/parse-merge.ts"(){"use strict";Y4(),oe(),ew(),by=[new fe(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new fe(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,n])=>{t.conflicts.push(new ol(e,n))}),new fe(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,n,r])=>{t.conflicts.push(new ol(e,n,{deleteRef:r}))}),new fe(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new ol(e,null))}),new fe(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],tw=(t,e)=>Object.assign(xy(t,e),Ih(t,e)),xy=t=>Dt(new Wv,by,t)}});function _y(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,n){let r=tw(e,n);if(r.failed)throw new Ss(r);return r}}:jt("Git.merge requires at least one option")}var eF=W({"src/lib/tasks/merge.ts"(){"use strict";Gi(),Q4(),Je()}});function tF(t,e,n){let r=n.includes("deleted"),i=n.includes("tag")||/^refs\/tags/.test(t),a=!n.includes("new");return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:t,remote:e}}var Sy,nw,Ey,nF=W({"src/lib/parsers/parse-push.ts"(){"use strict";oe(),Jv(),Sy=[new fe(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new fe(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref=vs(tn({},t.ref||{}),{local:e})}),new fe(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,n,r])=>{t.pushed.push(tF(e,n,r))}),new fe(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,n,r])=>{t.branch=vs(tn({},t.branch||{}),{local:e,remote:n,remoteName:r})}),new fe(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,n,r,i])=>{t.update={head:{local:e,remote:n},hash:{from:r,to:i}}})],nw=(t,e)=>{let n=Ey(t,e),r=Yv(t,e);return tn(tn({},n),r)},Ey=(t,e)=>Dt({pushed:[]},Sy,[t,e])}}),rw={};Qe(rw,{pushTagsTask:()=>rF,pushTask:()=>Rh});function rF(t={},e){return we(e,"--tags"),Rh(t,e)}function Rh(t={},e){let n=["push",...e];return t.branch&&n.splice(1,0,t.branch),t.remote&&n.splice(1,0,t.remote),ml(n,"-v"),we(n,"--verbose"),we(n,"--porcelain"),{commands:n,format:"utf-8",parser:nw}}var iw=W({"src/lib/tasks/push.ts"(){"use strict";nF(),oe()}});function iF(){return{showBuffer(){let t=["show",...Lt(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(uv(t),qe(arguments))},show(){let t=["show",...Lt(arguments,1)];return this._runTask(Tt(t),qe(arguments))}}}var aF=W({"src/lib/tasks/show.ts"(){"use strict";oe(),Je()}}),ky,aw,sF=W({"src/lib/responses/FileStatusSummary.ts"(){"use strict";ky=/^(.+)\0(.+)$/,aw=class{constructor(t,e,n){if(this.path=t,this.index=e,this.working_dir=n,e==="R"||n==="R"){let r=ky.exec(t)||[null,t,t];this.from=r[2]||"",this.path=r[1]||""}}}}});function Ay(t){let[e,n]=t.split(zi);return{from:n||e,to:e}}function Wt(t,e,n){return[`${t}${e}`,n]}function Jf(t,...e){return e.map(n=>Wt(t,n,(r,i)=>we(r.conflicted,i)))}function oF(t,e){let n=e.trim();switch(" "){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.substr(3));case n.charAt(1):return r(" ",n.charAt(0),n.substr(2));default:return}function r(i,a,s){let o=`${i}${a}`,l=sw.get(o);l&&l(t,s),o!=="##"&&o!=="!!"&&t.files.push(new aw(s,i,a))}}var Ty,sw,ow,lF=W({"src/lib/responses/StatusSummary.ts"(){"use strict";oe(),sF(),Ty=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}},sw=new Map([Wt(" ","A",(t,e)=>we(t.created,e)),Wt(" ","D",(t,e)=>we(t.deleted,e)),Wt(" ","M",(t,e)=>we(t.modified,e)),Wt("A"," ",(t,e)=>we(t.created,e)&&we(t.staged,e)),Wt("A","M",(t,e)=>we(t.created,e)&&we(t.staged,e)&&we(t.modified,e)),Wt("D"," ",(t,e)=>we(t.deleted,e)&&we(t.staged,e)),Wt("M"," ",(t,e)=>we(t.modified,e)&&we(t.staged,e)),Wt("M","M",(t,e)=>we(t.modified,e)&&we(t.staged,e)),Wt("R"," ",(t,e)=>{we(t.renamed,Ay(e))}),Wt("R","M",(t,e)=>{let n=Ay(e);we(t.renamed,n),we(t.modified,n.to)}),Wt("!","!",(t,e)=>{we(t.ignored=t.ignored||[],e)}),Wt("?","?",(t,e)=>we(t.not_added,e)),...Jf("A","A","U"),...Jf("D","D","U"),...Jf("U","A","D","U"),["##",(t,e)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,s=/\son\s([\S]+)$/,o;o=n.exec(e),t.ahead=o&&+o[1]||0,o=r.exec(e),t.behind=o&&+o[1]||0,o=i.exec(e),t.current=o&&o[1],o=a.exec(e),t.tracking=o&&o[1],o=s.exec(e),t.current=o&&o[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),ow=function(t){let e=t.split(zi),n=new Ty;for(let r=0,i=e.length;r!lw.includes(n))],parser(n){return ow(n)}}}var lw,uF=W({"src/lib/tasks/status.ts"(){"use strict";lF(),lw=["--null","-z"]}});function fl(t=0,e=0,n=0,r="",i=!0){return Object.defineProperty({major:t,minor:e,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function fF(){return fl(0,0,0,"",!1)}function hF(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:dF,onError(t,e,n,r){if(t.exitCode===-2)return n(Buffer.from(Lh));r(e)}})}}}function dF(t){return t===Lh?fF():Dt(fl(0,0,0,t),cw,t)}var Lh,cw,pF=W({"src/lib/tasks/version.ts"(){"use strict";oe(),Lh="installed=false",cw=[new fe(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,n,r,i=""])=>{Object.assign(t,fl(Pe(e),Pe(n),Pe(r),i))}),new fe(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,n,r,i=""])=>{Object.assign(t,fl(Pe(e),Pe(n),r,i))})]}}),uw={};Qe(uw,{SimpleGitApi:()=>uh});var uh,mF=W({"src/lib/simple-git-api.ts"(){"use strict";b4(),x4(),S4(),A4(),O4(),vv(),I4(),Sv(),L4(),$4(),Vv(),eF(),iw(),aF(),uF(),Je(),pF(),oe(),uh=class{constructor(t){this._executor=t}_runTask(t,e){let n=this._executor.chain(),r=n.push(t);return e&&v4(t,r,e),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(t){return this._runTask(Tt(["add",...Cn(t)]),qe(arguments))}cwd(t){let e=qe(arguments);return typeof t=="string"?this._runTask(uy(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(uy(t.path,t.root&&this._executor||void 0),e):this._runTask(jt("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(R4(t,e===!0),qe(arguments))}init(t){return this._runTask(N4(t===!0,this._executor.cwd,Lt(arguments)),qe(arguments))}merge(){return this._runTask(_y(Lt(arguments)),qe(arguments))}mergeFromTo(t,e){return gt(t)&>(e)?this._runTask(_y([t,e,...Lt(arguments)]),qe(arguments,!1)):this._runTask(jt("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=Rh({remote:Fn(arguments[0],gt),branch:Fn(arguments[1],gt)},Lt(arguments));return this._runTask(t,qe(arguments))}stash(){return this._runTask(Tt(["stash",...Lt(arguments)]),qe(arguments))}status(){return this._runTask(cF(Lt(arguments)),qe(arguments))}},Object.assign(uh.prototype,_4(),M4(),a4(),k4(),P4(),c4(),X4(),iF(),hF())}}),fw={};Qe(fw,{Scheduler:()=>dw});var Cy,dw,gF=W({"src/lib/runners/scheduler.ts"(){"use strict";oe(),Cv(),Cy=(()=>{let t=0;return()=>{t++;let{promise:e,done:n}=(0,hw.createDeferred)();return{promise:e,done:n,id:t}}})(),dw=class{constructor(t=2){this.concurrency=t,this.logger=kh("","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=we(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),ml(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=we(this.pending,Cy());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),pw={};Qe(pw,{applyPatchTask:()=>yF});function yF(t,e){return Tt(["apply",...e,...t])}var vF=W({"src/lib/tasks/apply-patch.ts"(){"use strict";Je()}});function wF(t,e){return{branch:t,hash:e,success:!0}}function bF(t){return{branch:t,hash:null,success:!1}}var mw,xF=W({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";mw=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function gw(t,e){return e===1&&fh.test(t)}var Fy,fh,My,bl,_F=W({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";xF(),oe(),Fy=/(\S+)\s+\(\S+\s([^)]+)\)/,fh=/^error[^']+'([^']+)'/m,My=[new fe(Fy,(t,[e,n])=>{let r=wF(e,n);t.all.push(r),t.branches[e]=r}),new fe(fh,(t,[e])=>{let n=bF(e);t.errors.push(n),t.all.push(n),t.branches[e]=n})],bl=(t,e)=>Dt(new mw,My,[t,e])}}),yw,SF=W({"src/lib/responses/BranchSummary.ts"(){"use strict";yw=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,n,r,i){t==="*"&&(this.detached=e,this.current=n),this.all.push(n),this.branches[n]={current:t==="*",linkedWorkTree:t==="+",name:n,commit:r,label:i}}}}});function Oy(t){return t?t.charAt(0):""}function vw(t){return Dt(new yw,ww,t)}var ww,EF=W({"src/lib/parsers/parse-branch.ts"(){"use strict";SF(),oe(),ww=[new fe(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,n,r,i])=>{t.push(Oy(e),!0,n,r,i)}),new fe(new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$","s"),(t,[e,n,r,i])=>{t.push(Oy(e),!1,n,r,i)})]}}),bw={};Qe(bw,{branchLocalTask:()=>AF,branchTask:()=>kF,containsDeleteBranchCommand:()=>xw,deleteBranchTask:()=>CF,deleteBranchesTask:()=>TF});function xw(t){let e=["-d","-D","--delete"];return t.some(n=>e.includes(n))}function kF(t){let e=xw(t),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(r,i){return e?bl(r,i).all[0]:vw(r)}}}function AF(){return{format:"utf-8",commands:["branch","-v"],parser:vw}}function TF(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(n,r){return bl(n,r)},onError({exitCode:n,stdOut:r},i,a,s){if(!gw(String(i),n))return s(i);a(r)}}}function CF(t,e=!1){let n={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(r,i){return bl(r,i).branches[t]},onError({exitCode:r,stdErr:i,stdOut:a},s,o,l){if(!gw(String(s),r))return l(s);throw new Ss(n.parser(bs(a),bs(i)),String(s))}};return n}var FF=W({"src/lib/tasks/branch.ts"(){"use strict";Gi(),_F(),EF(),oe()}}),_w,MF=W({"src/lib/responses/CheckIgnore.ts"(){"use strict";_w=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),Sw={};Qe(Sw,{checkIgnoreTask:()=>OF});function OF(t){return{commands:["check-ignore",...t],format:"utf-8",parser:_w}}var PF=W({"src/lib/tasks/check-ignore.ts"(){"use strict";MF()}}),Ew={};Qe(Ew,{cloneMirrorTask:()=>RF,cloneTask:()=>kw});function IF(t){return/^--upload-pack(=|$)/.test(t)}function kw(t,e,n){let r=["clone",...n];return gt(t)&&r.push(t),gt(e)&&r.push(e),r.find(IF)?jt("git.fetch: potential exploit argument blocked."):Tt(r)}function RF(t,e,n){return we(n,"--mirror"),kw(t,e,n)}var LF=W({"src/lib/tasks/clone.ts"(){"use strict";Je(),oe()}});function jF(t,e){return Dt({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},Aw,[t,e])}var Aw,DF=W({"src/lib/parsers/parse-fetch.ts"(){"use strict";oe(),Aw=[new fe(/From (.+)$/,(t,[e])=>{t.remote=e}),new fe(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.branches.push({name:e,tracking:n})}),new fe(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.tags.push({name:e,tracking:n})}),new fe(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new fe(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,n,r,i])=>{t.updated.push({name:r,tracking:i,to:n,from:e})})]}}),Tw={};Qe(Tw,{fetchTask:()=>NF});function BF(t){return/^--upload-pack(=|$)/.test(t)}function NF(t,e,n){let r=["fetch",...n];return t&&e&&r.push(t,e),r.find(BF)?jt("git.fetch: potential exploit argument blocked."):{commands:r,format:"utf-8",parser:jF}}var $F=W({"src/lib/tasks/fetch.ts"(){"use strict";DF(),Je()}});function HF(t){return Dt({moves:[]},Cw,t)}var Cw,UF=W({"src/lib/parsers/parse-move.ts"(){"use strict";oe(),Cw=[new fe(/^Renaming (.+) to (.+)$/,(t,[e,n])=>{t.moves.push({from:e,to:n})})]}}),Fw={};Qe(Fw,{moveTask:()=>zF});function zF(t,e){return{commands:["mv","-v",...Cn(t),e],format:"utf-8",parser:HF}}var GF=W({"src/lib/tasks/move.ts"(){"use strict";UF(),oe()}}),Mw={};Qe(Mw,{pullTask:()=>VF});function VF(t,e,n){let r=["pull",...n];return t&&e&&r.splice(1,0,t,e),{commands:r,format:"utf-8",parser(i,a){return Ih(i,a)},onError(i,a,s,o){let l=J4(bs(i.stdOut),bs(i.stdErr));if(l)return o(new Ss(l));o(a)}}}var WF=W({"src/lib/tasks/pull.ts"(){"use strict";Gi(),ew(),oe()}});function qF(t){let e={};return Ow(t,([n])=>e[n]={name:n}),Object.values(e)}function XF(t){let e={};return Ow(t,([n,r,i])=>{e.hasOwnProperty(n)||(e[n]={name:n,refs:{fetch:"",push:""}}),i&&r&&(e[n].refs[i.replace(/[^a-z]/g,"")]=r)}),Object.values(e)}function Ow(t,e){dh(t,n=>e(n.split(/\s+/)))}var YF=W({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";oe()}}),Pw={};Qe(Pw,{addRemoteTask:()=>ZF,getRemotesTask:()=>KF,listRemotesTask:()=>JF,remoteTask:()=>QF,removeRemoteTask:()=>eM});function ZF(t,e,n){return Tt(["remote","add",...n,t,e])}function KF(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?XF:qF}}function JF(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),Tt(e)}function QF(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),Tt(e)}function eM(t){return Tt(["remote","remove",t])}var tM=W({"src/lib/tasks/remote.ts"(){"use strict";YF(),Je()}}),Iw={};Qe(Iw,{stashListTask:()=>nM});function nM(t={},e){let n=Gv(t),r=["stash","list",...n.commands,...e],i=$v(n.splitter,n.fields,Th(r));return wl(r)||{commands:r,format:"utf-8",parser:i}}var rM=W({"src/lib/tasks/stash-list.ts"(){"use strict";Ts(),Uv(),Ph(),Vv()}}),Rw={};Qe(Rw,{addSubModuleTask:()=>iM,initSubModuleTask:()=>aM,subModuleTask:()=>xl,updateSubModuleTask:()=>sM});function iM(t,e){return xl(["add",t,e])}function aM(t){return xl(["init",...t])}function xl(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),Tt(e)}function sM(t){return xl(["update",...t])}var oM=W({"src/lib/tasks/sub-module.ts"(){"use strict";Je()}});function lM(t,e){let n=isNaN(t),r=isNaN(e);return n!==r?n?1:-1:n?Lw(t,e):0}function Lw(t,e){return t===e?0:t>e?1:-1}function cM(t){return t.trim()}function rl(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var Py,jw,uM=W({"src/lib/responses/TagList.ts"(){"use strict";Py=class{constructor(t,e){this.all=t,this.latest=e}},jw=function(t,e=!1){let n=t.split(` +`).map(cM).filter(Boolean);e||n.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return lM(rl(s[0]),rl(o[0]));for(let l=0,c=Math.max(s.length,o.length);li.indexOf(".")>=0);return new Py(n,r)}}}),Dw={};Qe(Dw,{addAnnotatedTagTask:()=>dM,addTagTask:()=>hM,tagListTask:()=>fM});function fM(t=[]){let e=t.some(n=>/^--sort=/.test(n));return{format:"utf-8",commands:["tag","-l",...t],parser(n){return jw(n,e)}}}function hM(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function dM(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var pM=W({"src/lib/tasks/tag.ts"(){"use strict";uM()}}),mM=P6({"src/git.js"(t,e){"use strict";var{GitExecutor:n}=(y4(),We(Mv)),{SimpleGitApi:r}=(mF(),We(uw)),{Scheduler:i}=(gF(),We(fw)),{configurationErrorTask:a}=(Je(),We(ih)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:h,trailingFunctionArgument:d,trailingOptionsArgument:p}=(oe(),We(ev)),{applyPatchTask:g}=(vF(),We(pw)),{branchTask:m,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:S}=(FF(),We(bw)),{checkIgnoreTask:k}=(PF(),We(Sw)),{checkIsRepoTask:x}=(iv(),We(tv)),{cloneTask:A,cloneMirrorTask:y}=(LF(),We(Ew)),{cleanWithOptionsTask:E,isCleanOptionsArray:_}=(mv(),We(dv)),{diffSummaryTask:C}=(Ph(),We(zv)),{fetchTask:M}=($F(),We(Tw)),{moveTask:L}=(GF(),We(Fw)),{pullTask:N}=(WF(),We(Mw)),{pushTagsTask:j}=(iw(),We(rw)),{addRemoteTask:Y,getRemotesTask:le,listRemotesTask:he,remoteTask:ie,removeRemoteTask:Me}=(tM(),We(Pw)),{getResetMode:de,resetTask:$}=(Tv(),We(Ev)),{stashListTask:G}=(rM(),We(Iw)),{addSubModuleTask:D,initSubModuleTask:se,subModuleTask:Se,updateSubModuleTask:mt}=(oM(),We(Rw)),{addAnnotatedTagTask:be,addTagTask:st,tagListTask:ee}=(pM(),We(Dw)),{straightThroughBufferTask:Ie,straightThroughStringTask:Ee}=(Je(),We(ih));function z(H,Z){this._plugins=Z,this._executor=new n(H.baseDir,new i(H.maxConcurrentProcesses),Z),this._trimmed=H.trimmed}(z.prototype=Object.create(r.prototype)).constructor=z,z.prototype.customBinary=function(H){return this._plugins.reconfigure("binary",H),this},z.prototype.env=function(H,Z){return arguments.length===1&&typeof H=="object"?this._executor.env=H:(this._executor.env=this._executor.env||{})[H]=Z,this},z.prototype.stashList=function(H){return this._runTask(G(p(arguments)||{},o(H)&&H||[]),d(arguments))};function nt(H,Z,ye,Ye){return typeof ye!="string"?a(`git.${H}() requires a string 'repoPath'`):Z(ye,f(Ye,c),h(arguments))}z.prototype.clone=function(){return this._runTask(nt("clone",A,...arguments),d(arguments))},z.prototype.mirror=function(){return this._runTask(nt("mirror",y,...arguments),d(arguments))},z.prototype.mv=function(H,Z){return this._runTask(L(H,Z),d(arguments))},z.prototype.checkoutLatestTag=function(H){var Z=this;return this.pull(function(){Z.tags(function(ye,Ye){Z.checkout(Ye.latest,H)})})},z.prototype.pull=function(H,Z,ye,Ye){return this._runTask(N(f(H,c),f(Z,c),h(arguments)),d(arguments))},z.prototype.fetch=function(H,Z){return this._runTask(M(f(H,c),f(Z,c),h(arguments)),d(arguments))},z.prototype.silent=function(H){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},z.prototype.tags=function(H,Z){return this._runTask(ee(h(arguments)),d(arguments))},z.prototype.rebase=function(){return this._runTask(Ee(["rebase",...h(arguments)]),d(arguments))},z.prototype.reset=function(H){return this._runTask($(de(H),h(arguments)),d(arguments))},z.prototype.revert=function(H){let Z=d(arguments);return typeof H!="string"?this._runTask(a("Commit must be a string"),Z):this._runTask(Ee(["revert",...h(arguments,0,!0),H]),Z)},z.prototype.addTag=function(H){let Z=typeof H=="string"?st(H):a("Git.addTag requires a tag name");return this._runTask(Z,d(arguments))},z.prototype.addAnnotatedTag=function(H,Z){return this._runTask(be(H,Z),d(arguments))},z.prototype.deleteLocalBranch=function(H,Z,ye){return this._runTask(S(H,typeof Z=="boolean"?Z:!1),d(arguments))},z.prototype.deleteLocalBranches=function(H,Z,ye){return this._runTask(b(H,typeof Z=="boolean"?Z:!1),d(arguments))},z.prototype.branch=function(H,Z){return this._runTask(m(h(arguments)),d(arguments))},z.prototype.branchLocal=function(H){return this._runTask(w(),d(arguments))},z.prototype.raw=function(H){let Z=!Array.isArray(H),ye=[].slice.call(Z?arguments:H,0);for(let _t=0;_tt.removeEventListener("abort",a))}}]:void 0}function vM(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function wM(t,e){if(vM(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new Gn(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function bM(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new Gn(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&/^\s*-u\b/.test(t))throw new Gn(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new Gn(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function xM({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(n,r){return n.forEach((i,a)=>{let s=aQf(i))).then(s.done)}return{type:"spawn.after",action(i,a){return ys(this,arguments,function*(s,{spawned:o,close:l}){var c,u;let f=n(),h=!0,d=()=>void(h=!1);(c=o.stdout)==null||c.on("data",d),(u=o.stderr)==null||u.on("data",d),o.on("error",d),o.on("close",p=>f.close(p)),o.on("exit",p=>f.exit(p));try{yield f.result,h&&(yield Qf(50)),l(f.exitCode)}catch(p){l(f.exitCode,p)}})}}}oe();var EM="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",Ry="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function kM(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(t)}function Ly(t,e){if(t.length<1||t.length>2)throw new Gn(void 0,"binary",EM);if(t.some(kM))if(e)console.warn(Ry);else throw new Gn(void 0,"binary",Ry);let[r,i]=t;return{binary:r,prefix:i}}function AM(t,e=["git"],n=!1){let r=Ly(Cn(e),n);t.on("binary",i=>{r=Ly(Cn(i),n)}),t.append("spawn.binary",()=>r.binary),t.append("spawn.args",i=>r.prefix?[r.prefix,...i]:i)}fr();function TM(t){return!!(t.exitCode&&t.stdErr.length)}function CM(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function FM(t=!1,e=TM,n=CM){return(r,i)=>!t&&r||!e(i)?r:n(i)}function jy(t){return{type:"task.error",action(e,n){let r=t(e.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new dn(void 0,r.toString("utf-8"))}:{error:r}}}}oe();var MM=class{constructor(){this.plugins=new Set,this.events=new Bw.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let n=we(this.plugins,{type:t,action:e});return()=>this.plugins.delete(n)}add(t){let e=[];return Cn(t).forEach(n=>n&&this.plugins.add(we(e,n))),()=>{e.forEach(n=>this.plugins.delete(n))}}exec(t,e,n){let r=e,i=Object.freeze(Object.create(n));for(let a of this.plugins)a.type===t&&(r=a.action(r,i));return r}};oe();function OM(t){let e="--progress",n=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,s){return n.includes(s.method)?Vy(a,e):a}},{type:"spawn.after",action(a,s){var o;s.commands.includes(e)&&((o=s.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:s.method,stage:PM(c[1]),progress:Pe(c[2]),processed:Pe(c[3]),total:Pe(c[4])})}))}}]}function PM(t){return String(t.toLowerCase().split(" ",1))||"unknown"}oe();function IM(t){let e=Xy(t,["uid","gid"]);return{type:"spawn.options",action(n){return tn(tn({},e),n)}}}function RM({block:t,stdErr:e=!0,stdOut:n=!0}){if(t>0)return{type:"spawn.after",action(r,i){var a,s;let o;function l(){o&&clearTimeout(o),o=setTimeout(u,t)}function c(){var f,h;(f=i.spawned.stdout)==null||f.off("data",l),(h=i.spawned.stderr)==null||h.off("data",l),i.spawned.off("exit",c),i.spawned.off("close",c),o&&clearTimeout(o)}function u(){c(),i.kill(new Gn(void 0,"timeout","block timeout reached"))}n&&((a=i.spawned.stdout)==null||a.on("data",l)),e&&((s=i.spawned.stderr)==null||s.on("data",l)),i.spawned.on("exit",c),i.spawned.on("close",c),l()}}}_s();function LM(){return{type:"spawn.args",action(t){let e=[],n;function r(i){(n=n||[]).push(...i)}for(let i=0;ill(s)&&sy(s)||s));break}e.push(a)}return n?[...e,"--",...n.map(String)]:e}}}oe();var jM=mM();function DM(t,e){var n;let r=new MM,i=Jy(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!ph(i.baseDir))throw new gM(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(_M(i.config)),r.add(xM(i.unsafe)),r.add(LM()),r.add(SM(i.completion)),i.abort&&r.add(yM(i.abort)),i.progress&&r.add(OM(i.progress)),i.timeout&&r.add(RM(i.timeout)),i.spawnOptions&&r.add(IM(i.spawnOptions)),r.add(jy(FM(!0))),i.errors&&r.add(jy(i.errors)),AM(r,i.binary,(n=i.unsafe)==null?void 0:n.allowUnsafeCustomBinary),new jM(i,r)}Gi();var Nw=DM;v();var $w=require("obsidian"),_l="YYYY-MM-DD",jh=`${_l} HH:mm`,Dh=`${_l} HH:mm:ss`,Sl=40,Vi="conflict-files-obsidian-git.md",Mn={commitMessage:"vault backup: {{date}}",commitDateFormat:Dh,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:$w.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:jh,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,gutterSpacingFallbackLength:5}},dt={type:"git-view",name:"Source Control",icon:"git-pull-request"},nn={type:"git-history-view",name:"History",icon:"history"},Ct={type:"diff-view",name:"Diff View",icon:"git-pull-request"};v();function Hw(t,e){let n=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:n})}var Wi=class extends Error{constructor(n){super("No network connection available");this.originalError=n}};v();var SS=Ze(a2()),ES=Ze(_S()),ra=require("obsidian"),ip=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function Xt(t,e){let n;if(e){if(e.button===0||e.button===1){let r=ra.Keymap.isModEvent(e);n=t.workspace.getLeaf(r)}}else n=t.workspace.getLeaf(!1);return n}function In(t,e,n,r,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(n);if(a!=null){let s=new ra.Menu;t.workspace.trigger("file-menu",s,a,i,r),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function yr(t){throw new Error("Impossible branch: "+t)}function ap(t){return`rgb(${t.r},${t.g},${t.b})`}function kS(t){var a;let e=(a=SS.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[n,r,i]=e;return{r:n,g:r,b:i}}function AS(t){return t.diff(ra.moment.unix(0),"seconds")}function TS(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function CS(t,e){return(0,ES.default)(t,e,{strict:!0})}function vr(t,e){return new Proxy(t,{get(n,r){return r==="length"?Math.min(e,n.length):n[r]}})}function FS(t,e,n){return t.length<=e?new Array(e-t.length).fill(n).join("")+t:t.substring(t.length-e)}function MS(t,e){if(e<=0)return t;let n=new Array(e).fill(" ").join(""),r=t.substring(e,t.length);return n+r}function sp(t,e,n){return t<=e&&e<=n}function wr(t){let[e,...n]=t.split("/");return[e,n.length===0?void 0:n.join("/")]}function Bt(t){return t.endsWith("/")?t:t.split("/").last().replace(".md","")}function $s(t){return t===1?"1 minute":`${t} minutes`}v();var OS=require("obsidian"),ia=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,n=!0){return n&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}_getTreeStructure(e,n=0){let r=[];for(e=[...e];e.length>0;){let i=e.first(),a=i.path.substring(n);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=e.filter(c=>c.path.substring(n).startsWith(s+"/"));o.forEach(c=>e.remove(c));let l=i.path.substring(0,a.indexOf("/")+n);r.push({title:s,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(n>0?n+s.length:s.length)+1)})}else r.push({title:a,data:i,path:i.path,vaultPath:this.getRelativeVaultPath(i.path)}),e.remove(i)}return r}simplify(e){var n,r,i,a;for(let s of e){for(;;){let o=((n=s.children)==null?void 0:n.length)==1,l=((i=(r=s.children)==null?void 0:r.first())==null?void 0:i.data)==null;if(!(s.children!=null&&o&&l))break;let c=s.children.first();s.title+="/"+c.title,s.data=c.data,s.path=c.path,s.vaultPath=c.vaultPath,s.children=c.children}s.children!=null&&this.simplify(s.children),(a=s.children)==null||a.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((s,o)=>{let l=(o.data==null?1:0)-(s.data==null?1:0);return l!=0?l:s.title.localeCompare(o.title)})}getTreeStructure(e){let n=this._getTreeStructure(e);return this.simplify(n)}async formatCommitMessage(e){let n;if(e.includes("{{numFiles}}")){n=await this.status();let r=n.staged.length;e=e.replace("{{numFiles}}",String(r))}if(e.includes("{{hostname}}")){let r=this.plugin.localStorage.getHostname()||"";e=e.replace("{{hostname}}",r)}if(e.includes("{{files}}")){n=n!=null?n:await this.status();let r={},i="";if(n.staged.length<100){n.staged.forEach(s=>{s.index in r?r[s.index].push(s.path):r[s.index]=[s.path]});let a=[];for(let[s,o]of Object.entries(r))a.push(s+" "+o.join(" "));i=a.join(", ")}else i="Too many files to list";e=e.replace("{{files}}",i)}if(e=e.replace("{{date}}",(0,OS.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let r=n!=null?n:await this.status(),i="";r.staged.length<100?i=r.staged.map(a=>a.path).join(` +`):i="Too many files to list",e=e+` -// src/main.ts -var import_obsidian31 = require("obsidian"); +Affected files: +`+i}return e}};var Le=class extends ia{constructor(e){super(e)}async setGitInstance(e=!1){if(this.isGitInstalled()){let n=this.app.vault.adapter,r=n.getBasePath(),i=r;this.plugin.settings.basePath&&(await n.exists((0,Jr.normalizePath)(this.plugin.settings.basePath))?i=vt.join(r,this.plugin.settings.basePath):e||new Jr.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=i,this.git=Nw({baseDir:i,binary:this.plugin.localStorage.getGitPath()||void 0,config:["core.quotepath=off"]});let a=this.plugin.localStorage.getPATHPaths(),s=this.plugin.localStorage.getEnvVars(),o=this.plugin.settings.gitDir;if(a.length>0){let l=process.env.PATH+":"+a.join(":");process.env.PATH=l}o&&(process.env.GIT_DIR=o);for(let l of s){let[c,u]=l.split("=");process.env[c]=u}if(LS.default.enable("simple-git"),await this.git.checkIsRepo()){let l=await this.git.revparse("--show-cdup"),c=(0,Hs.resolve)(i+Hs.sep+l);this.absoluteRepoPath=c,await this.git.cwd(c)}}}getRelativeVaultPath(e){let r=this.app.vault.adapter.getBasePath(),i=vt.join(this.absoluteRepoPath,e),a=vt.relative(r,i);return Jr.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(e,n=!0){if(n){let i=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,s=vt.join(i,e),o=vt.relative(a,s);return Jr.Platform.isWin&&(o=o.replace(/\\/g,"/")),o}return e}async status(){this.plugin.setPluginState({gitAction:1});let e=await this.git.status();this.plugin.setPluginState({gitAction:0});let n=e.files.map(r=>{let i=this.formatPath(r);return{path:i.path,from:i.from,index:r.index==="?"?"U":r.index,working_dir:r.working_dir==="?"?"U":r.working_dir,vault_path:this.getRelativeVaultPath(i.path)}});return{all:n,changed:n.filter(r=>r.working_dir!==" "),staged:n.filter(r=>r.index!==" "&&r.index!="U"),conflicted:e.conflicted.map(r=>this.formatPath({path:r}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(e){let n=this.getRelativeRepoPath(e),i=["-C",vt.dirname(n),"rev-parse","HEAD"],a=this.git.raw(i);return a.catch(s=>console.warn("obsidian-git: rev-parse error:",s)),a}async getSubmodulePaths(){return new Promise(e=>{this.git.outputHandler((n,r,i,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let s="",o=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");r.on("data",l=>{s+=l.toString("utf8")}),r.on("end",()=>{let c=s.split(` +`).map(u=>{let f=u.match(/'([^']*)'/);if(f!=null)return o+"/"+f[1]+Hs.sep}).filter(u=>!!u);c.reverse(),e(c)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(e,n=!1){function r(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return n?{from:r(e.from),path:r(e.path)}:{path:r(e.path)}}async blame(e,n,r){if(e=this.getRelativeRepoPath(e),!await this.isTracked(e))return"untracked";let i=await this.getSubmoduleOfFile(e),a=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:e;a.push("blame","--porcelain"),r&&a.push("-w");let o=`-C${Sl}`;switch(n){case"inactive":break;case"same-commit":a.push("-C",o);break;case"all-commits":a.push("-C","-C",o);break;default:yr(n)}a.push("--",s);let l=await this.git.raw(a);return NR(l)}async isTracked(e){let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("ls-files","--",i),this.git.raw(r).then(a=>a.trim()!=="")}async commitAll({message:e}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let r=await this.getSubmodulePaths();for(let i of r)await this.git.cwd({path:i,root:!1}).add("-A"),await this.git.cwd({path:i,root:!1}).commit(await this.formatCommitMessage(e))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let n=await this.git.commit(await this.formatCommitMessage(e));return this.app.workspace.trigger("obsidian-git:head-change"),n.summary.changes}async commit({message:e,amend:n}){this.plugin.setPluginState({gitAction:4});let r=(await this.git.commit(await this.formatCommitMessage(e),n?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),r}async stage(e,n){this.plugin.setPluginState({gitAction:3}),e=this.getRelativeRepoPath(e,n),await this.git.add(["--",e]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:e}){this.plugin.setPluginState({gitAction:3}),await this.git.add(e!=null?e:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:e}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(e!=null?["--",e]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(e,n){this.plugin.setPluginState({gitAction:3}),e=this.getRelativeRepoPath(e,n),await this.git.reset(["--",e]),this.plugin.setPluginState({gitAction:0})}async discard(e){this.plugin.setPluginState({gitAction:3}),await this.isTracked(e)?await this.git.checkout(["--",e]):await this.app.vault.adapter.rmdir(this.getRelativeVaultPath(e),!0),this.plugin.setPluginState({gitAction:0})}async hashObject(e){e=this.getRelativeRepoPath(e);let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("hash-object","--",i),this.git.raw(r)}async discardAll({dir:e}){return this.discard(e!=null?e:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let e=await this.branchInfo(),n=await this.git.revparse([e.current]);if(!e.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 r=await this.git.revparse([e.tracking]);if(n!==r){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{switch(this.plugin.settings.syncMethod){case"merge":await this.git.merge([e.tracking]);break;case"rebase":await this.git.rebase([e.tracking])}}catch(s){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in s?s.message:s}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${e.current}`,r]),await this.unstageAll({})}catch(s){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in s?s.message:s}`)}this.app.workspace.trigger("obsidian-git:head-change");let i=await this.git.revparse([e.current]);return(await this.git.diff([`${n}..${i}`,"--name-only"])).split(/\r\n|\r|\n/).filter(s=>s.length>0).map(s=>({path:s,working_dir:"P",vault_path:this.getRelativeVaultPath(s)}))}else return[]}catch(e){this.convertErrors(e)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=await this.git.env({...process.env,OBSIDIAN_GIT:1}).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 e=await this.git.status(),n=e.tracking,r=e.current;if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let i=(await this.git.diffSummary([r,n,"--"])).changed;return await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(),i}catch(e){this.convertErrors(e)}}async getUnpushedCommits(){let e=await this.git.status(),n=e.tracking,r=e.current;return n==null||r==null?0:(await this.git.diffSummary([r,n,"--"])).changed}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let e=await this.git.status(),n=e.tracking,r=e.current;return n?(await this.git.diffSummary([r,n,"--"])).changed!==0:!1}async checkRequirements(){return this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let e=await this.git.status(),n=await this.git.branch(["--no-color"]);return{current:e.current||void 0,tracking:e.tracking||void 0,branches:n.all}}async getRemoteUrl(e){try{return await this.git.remote(["get-url",e])||void 0}catch(n){if(String(n).contains(e))return;throw n}}async log(e,n=!0,r){let i;return e&&(i=this.getRelativeRepoPath(e,n)),(await this.git.log({file:i,maxCount:r,"-m":null,"--name-status":null})).all.map(s=>{var o,l,c,u;return{...s,author:{name:s.author_name,email:s.author_email},refs:s.refs.split(", ").filter(f=>f.length>0),diff:{...s.diff,files:(l=(o=s.diff)==null?void 0:o.files.map(f=>({...f,status:f.status,path:f.file,hash:s.hash,vault_path:this.getRelativeVaultPath(f.file)})))!=null?l:[]},fileName:(u=(c=s.diff)==null?void 0:c.files.first())==null?void 0:u.file}})}async show(e,n,r=!0){let i=this.getRelativeRepoPath(n,r);return this.git.show([e+":"+i])}async checkout(e,n){if(n&&(e=`${n}/${e}`),await this.git.checkout(e),this.plugin.settings.submoduleRecurseCheckout){let r=await this.getSubmodulePaths();for(let i of r){let a=await this.git.cwd({path:i,root:!1}).branch();Object.keys(a.branches).includes(e)&&await this.git.cwd({path:i,root:!1}).checkout(e)}}}async createBranch(e){await this.git.checkout(["-b",e])}async deleteBranch(e,n){await this.git.branch([n?"-D":"-d",e])}async branchIsMerged(e){return!(await this.git.branch(["--no-merged"])).all.contains(e)}async init(){await this.git.init(!1)}async clone(e,n,r){await this.git.clone(e,vt.join(this.app.vault.adapter.getBasePath(),n),r?["--depth",`${r}`]:[])}async setConfig(e,n){n==null?await this.git.raw(["config","--local","--unset",e]):await this.git.addConfig(e,n)}async getConfig(e){let r=(await this.git.listConfig("local")).all[e];if(typeof r=="string")return r;throw new Error("Config value is not a string")}async fetch(e){await this.git.fetch(e!=null?[e]:[])}async setRemote(e,n){(await this.getRemotes()).includes(e)?await this.git.remote(["set-url",e,n]):await this.git.remote(["add",e,n])}async getRemoteBranches(e){let n=await this.git.branch(["-r","--list",`${e}*`]),r=[];for(let i in n.branches)r.push(n.branches[i].name);return r}async getRemotes(){let e=await this.git.remote([]);return e?e.trim().split(` +`):[]}async removeRemote(e){await this.git.removeRemote(e)}async updateUpstreamBranch(e){try{await this.git.branch(["--set-upstream-to",e])}catch(n){console.error(n);try{await this.git.branch(["--set-upstream",e])}catch(r){console.error(r),await this.git.push(["--set-upstream",...wr(e)])}}}updateGitPath(e){return this.setGitInstance()}updateBasePath(e){return this.setGitInstance(!0)}async getDiffString(e,n=!1,r){return n?await this.git.diff(["--cached","--",e]):r?await this.git.show([`${r}`,"--",e]):await this.git.diff(["--",e])}async diff(e,n,r){return await this.git.diff([`${n}..${r}`,"--",e])}async getSubmoduleOfFile(e){if(!await this.app.vault.adapter.exists(vt.dirname(e)))return;let n=await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-toplevel"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message));if(n=n.trim(),(await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-superproject-working-tree"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(vt.normalize(e)),s=vt.relative(n,a);return{submodule:n,relativeFilepath:s}}async getLastCommitTime(){let e=await this.git.log({n:1});if(e!=null&&e.latest!=null)return new Date(e.latest.date)}isGitInstalled(){let e=(0,RS.spawnSync)(this.plugin.localStorage.getGitPath()||"git",["--version"],{stdio:"ignore"});return e.error?(console.error(e.error),!1):!0}convertErrors(e){if(e instanceof dn){let n=String(e.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Wi(n)}throw e}},jS={hash:"000000",isZeroCommit:!0,summary:""};function NR(t){let n=t.replace(`\r +`,` +`).split(` +`),r={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a=4&&n.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return r}function HR(t,e,n){let r=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[n],s=e.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(r){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=IS(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=IS(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}e.commits.set(a,s)}function UR(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);op(t.author)&&(t.author=void 0),op(t.committer)&&(t.committer=void 0),op(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function op(t){return!t||Object.keys(t).length===0}function PS(t){return t.length>0&&t[0].trim()===t[0]}function IS(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}v();var vE=require("@codemirror/state");v();var KS=require("@codemirror/state"),kc=require("obsidian");v();var lp=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,n){if(e)return this.ensureInitialized(e),n(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(n=>n.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()}},aa=new lp;v();var _c=require("@codemirror/state"),WS=Ze(cp());v();var V=require("obsidian");v();v();function gn(){}gn.prototype={diff:function(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var s=this;function o(k){return k=s.postProcess(k,i),a?(setTimeout(function(){a(k)},0),!0):k}e=this.castInput(e,i),n=this.castInput(n,i),e=this.removeEmpty(this.tokenize(e,i)),n=this.removeEmpty(this.tokenize(n,i));var l=n.length,c=e.length,u=1,f=l+c;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));var h=(r=i.timeout)!==null&&r!==void 0?r:1/0,d=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(p[0],n,e,0,i);if(p[0].oldPos+1>=c&&g+1>=l)return o(DS(s,p[0].lastComponent,n,e,s.useLongestToken));var m=-1/0,w=1/0;function b(){for(var k=Math.max(m,-u);k<=Math.min(w,u);k+=2){var x=void 0,A=p[k-1],y=p[k+1];A&&(p[k-1]=void 0);var E=!1;if(y){var _=y.oldPos-k;E=y&&0<=_&&_=c&&g+1>=l)return o(DS(s,x.lastComponent,n,e,s.useLongestToken));p[k]=x,x.oldPos+1>=c&&(w=Math.min(w,k-1)),g+1>=l&&(m=Math.max(m,k+1))}u++}if(a)(function k(){setTimeout(function(){if(u>f||Date.now()>d)return a();b()||k()},0)})();else for(;u<=f&&Date.now()<=d;){var S=b();if(S)return S}},addToPath:function(e,n,r,i,a){var s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===n&&s.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:n,removed:r,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:s}}},extractCommon:function(e,n,r,i,a){for(var s=n.length,o=r.length,l=e.oldPos,c=l-i,u=0;c+1d.length?g:d}),f.value=t.join(h)}else f.value=t.join(n.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}return a}var d$=new gn;function BS(t,e){var n;for(n=0;ne.length&&(n=t.length-e.length);var r=e.length;t.length0&&e[s]!=e[a];)a=i[a];e[s]==e[a]&&a++}a=0;for(var o=n;o0&&t[o]!=e[a];)a=i[a];t[o]==e[a]&&a++}return a}var pc="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",GR=new RegExp("[".concat(pc,"]+|\\s+|[^").concat(pc,"]"),"ug"),gc=new gn;gc.equals=function(t,e,n){return n.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};gc.tokenize=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');n=Array.from(e.intlSegmenter.segment(t),function(a){return a.segment})}else n=t.match(GR)||[];var r=[],i=null;return n.forEach(function(a){/\s/.test(a)?i==null?r.push(a):r.push(r.pop()+a):/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+a):r.push(i+a):r.push(a),i=a}),r};gc.join=function(t){return t.map(function(e,n){return n==0?e:e.replace(/^\s+/,"")}).join("")};gc.postProcess=function(t,e){if(!t||e.oneChangePerToken)return t;var n=null,r=null,i=null;return t.forEach(function(a){a.added?r=a:a.removed?i=a:((r||i)&&HS(n,i,r,a),n=a,r=null,i=null)}),(r||i)&&HS(n,i,r,null),t};function HS(t,e,n,r){if(e&&n){var i=e.value.match(/^\s*/)[0],a=e.value.match(/\s*$/)[0],s=n.value.match(/^\s*/)[0],o=n.value.match(/\s*$/)[0];if(t){var l=BS(i,s);t.value=hp(t.value,s,l),e.value=Us(e.value,l),n.value=Us(n.value,l)}if(r){var c=NS(a,o);r.value=fp(r.value,o,c),e.value=dc(e.value,c),n.value=dc(n.value,c)}}else if(n)t&&(n.value=n.value.replace(/^\s*/,"")),r&&(r.value=r.value.replace(/^\s*/,""));else if(t&&r){var u=r.value.match(/^\s*/)[0],f=e.value.match(/^\s*/)[0],h=e.value.match(/\s*$/)[0],d=BS(u,f);e.value=Us(e.value,d);var p=NS(Us(u,d),h);e.value=dc(e.value,p),r.value=fp(r.value,u,p),t.value=hp(t.value,u,u.slice(0,u.length-p.length))}else if(r){var g=r.value.match(/^\s*/)[0],m=e.value.match(/\s*$/)[0],w=$S(m,g);e.value=dc(e.value,w)}else if(t){var b=t.value.match(/\s*$/)[0],S=e.value.match(/^\s*/)[0],k=$S(b,S);e.value=Us(e.value,k)}}var VR=new gn;VR.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(pc,"]+|[^\\S\\n\\r]+|[^").concat(pc,"]"),"ug");return t.match(e)||[]};var yc=new gn;yc.tokenize=function(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` +`));var n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var i=0;it.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?f(L.lines.slice(-s.context)):[],d-=g.length,p-=g.length)}(M=g).push.apply(M,up(C.map(function(he){return(_.added?"+":"-")+he}))),_.added?w+=C.length:m+=C.length}else{if(d)if(C.length<=s.context*2&&S{this.resolve=e,this.open()})}onClose(){new Promise(e=>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,n){n.setText(e)}onChooseSuggestion(e,n){if(this.resolve){let r;this.config.allowEmpty&&e===" "?r="":e==="..."?r=void 0:r=e,this.resolve(r)}}};v();var br=require("obsidian"),wc=class{constructor(e,n){this.plugin=n;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,n){var r;if(this.maybeLog("Read: "+e+JSON.stringify(n)),n=="utf8"||n.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):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)):(r=this.index)!=null?r:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,n){if(this.maybeLog("Write: "+e),typeof n=="string"){let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modify(r,n):this.adapter.write(e,n)}else if(e.endsWith(this.gitDir+"/index"))this.index=n,this.indexmtime=Date.now();else{let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modifyBinary(r,n):this.adapter.writeBinary(e,n)}}async readdir(e){e==="."&&(e="/");let n=await this.adapter.list(e),r=[...n.files,...n.folders],i;return e!=="/"?i=r.map(a=>(0,br.normalizePath)(a.substring(e.length))):i=r,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,n){var r,i;return this.adapter.rmdir(e,(i=(r=n==null?void 0:n.options)==null?void 0:r.recursive)!=null?i:!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.length,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let r=await this.adapter.stat(e);if(r==null)throw{code:"ENOENT"};return this.indexctime=r.ctime,this.indexmtime=r.mtime,{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let n=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),n instanceof br.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:n.stat.ctime,mtimeMs:n.stat.mtime,size:n.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let r=await this.adapter.stat(e);if(r)return{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:r.type==="folder"?"directory":r.type,isFile:()=>r.type==="file",isDirectory:()=>r.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var yn=class extends ia{constructor(n){super(n);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 wc(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var n,r;return{username:(n=this.plugin.localStorage.getUsername())!=null?n:void 0,password:(r=this.plugin.localStorage.getPassword())!=null?r:void 0}},onAuthFailure:async()=>{new Qr.Notice("Authentication failed. Please try with different credentials");let n=await new Xe(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(n){let r=await new Xe(this.plugin,{placeholder:"Specify your password/personal access token"}).openAndGetResult();if(r)return this.plugin.localStorage.setUsername(n),this.plugin.localStorage.setPassword(r),{username:n,password:r}}return{cancel:!0}},http:{async request({url:n,method:r,headers:i,body:a}){let s;a&&(s=(await oL(a)).buffer);let o=await(0,Qr.requestUrl)({url:n,method:r,headers:i,body:s,throw:!1});return{url:n,method:r,headers:o.headers,body:[new Uint8Array(o.arrayBuffer)],statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(n){try{let r=await n;return await this.fs.saveAndClear(),r}catch(r){throw await this.fs.saveAndClear(),r}}async status(){let n,r=window.setTimeout(()=>{n=new Qr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let i=(await this.wrapFS(ae.statusMatrix({...this.getRepo()}))).map(l=>this.getFileStatusResult(l)),a=i.filter(l=>l.working_dir!==" "),s=i.filter(l=>l.index!==" "&&l.index!=="U"),o=[];return window.clearTimeout(r),n==null||n.hide(),{all:i,changed:a,staged:s,conflicted:o}}catch(i){throw window.clearTimeout(r),n==null||n.hide(),this.plugin.displayError(i),i}}async commitAll({message:n,status:r,unstagedFiles:i}){try{return await this.checkAuthorInfo(),await this.stageAll({status:r,unstagedFiles:i}),this.commit({message:n})}catch(a){throw this.plugin.displayError(a),a}}async commit({message:n}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let r=await this.formatCommitMessage(n),i=this.plugin.localStorage.getConflict(),a;if(i){let s=await this.branchInfo();a=[s.current,s.tracking]}await this.wrapFS(ae.commit({...this.getRepo(),message:r,parent:a})),this.plugin.localStorage.setConflict(!1);return}catch(r){throw this.plugin.displayError(r),r}}async stage(n,r){let i=this.getRelativeRepoPath(n,r),a;r?a=n:a=this.getRelativeVaultPath(n);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(a)?await this.wrapFS(ae.add({...this.getRepo(),filepath:i})):await this.wrapFS(ae.remove({...this.getRepo(),filepath:i}))}catch(s){throw this.plugin.displayError(s),s}}async stageAll({dir:n,status:r,unstagedFiles:i}){try{if(r)await Promise.all(r.changed.map(a=>a.working_dir!=="D"?this.wrapFS(ae.add({...this.getRepo(),filepath:a.path})):ae.remove({...this.getRepo(),filepath:a.path})));else{let a=i!=null?i:await this.getUnstagedFiles(n!=null?n:".");await Promise.all(a.map(({filepath:s,deleted:o})=>o?ae.remove({...this.getRepo(),filepath:s}):this.wrapFS(ae.add({...this.getRepo(),filepath:s}))))}}catch(a){throw this.plugin.displayError(a),a}}async unstage(n,r){try{this.plugin.setPluginState({gitAction:3}),n=this.getRelativeRepoPath(n,r),await this.wrapFS(ae.resetIndex({...this.getRepo(),filepath:n}))}catch(i){throw this.plugin.displayError(i),i}}async unstageAll({dir:n,status:r}){try{let i;r?i=r.staged.map(a=>a.path):i=(await this.getStagedFiles(n!=null?n:".")).map(({filepath:s})=>s),await this.wrapFS(Promise.all(i.map(a=>ae.resetIndex({...this.getRepo(),filepath:a}))))}catch(i){throw this.plugin.displayError(i),i}}async discard(n){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(ae.checkout({...this.getRepo(),filepaths:[n],force:!0}))}catch(r){throw this.plugin.displayError(r),r}}async discardAll({dir:n,status:r}){let i=[];r?n!=null?i=r.changed.filter(a=>a.path.startsWith(n)).map(a=>a.path):i=r.changed.map(a=>a.path):i=(await this.getUnstagedFiles(n)).map(({filepath:a})=>a);try{await this.wrapFS(ae.checkout({...this.getRepo(),filepaths:i,force:!0}))}catch(a){throw this.plugin.displayError(a),a}}getProgressText(n,r){let i=`${n} progress:`;return r.phase&&(i=`${i} ${r.phase}:`),r.loaded&&(i=`${i} ${r.loaded}`,r.total&&(i=`${i} of ${r.total}`)),i}resolveRef(n){return this.wrapFS(ae.resolveRef({...this.getRepo(),ref:n}))}async pull(){let n=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let r=await this.resolveRef("HEAD");await this.fetch();let i=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(ae.merge({...this.getRepo(),ours:i.current,theirs:i.tracking,abortOnConflict:!1}))).alreadyMerged||await this.wrapFS(ae.checkout({...this.getRepo(),ref:i.current,onProgress:l=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:i.remote})),n==null||n.hide();let s=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(r,s);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,working_dir:"P",index:"P",vault_path:this.getRelativeVaultPath(l.path)}))}catch(r){throw n==null||n.hide(),r instanceof hs.MergeConflictError&&await this.plugin.handleConflict(r.data.filepaths.map(i=>this.getRelativeVaultPath(i))),this.plugin.displayError(r),r}}async push(){if(!await this.canPush())return 0;let n=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let r=await this.branchInfo(),i=r.tracking,a=r.current,s=(await this.getFileChangesCount(a,i)).length;return this.plugin.setPluginState({gitAction:5}),await this.wrapFS(ae.push({...this.getRepo(),onProgress:o=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Pushing",o))}})),n==null||n.hide(),s}catch(r){throw n==null||n.hide(),this.plugin.displayError(r),r}}async getUnpushedCommits(){let n=await this.branchInfo(),r=n.tracking,i=n.current;if(r==null||i==null)return 0;let a=await this.resolveRef(i),s=await this.resolveRef(r);return(await this.getFileChangesCount(a,s)).length}async canPush(){let n=await this.branchInfo(),r=n.tracking,i=n.current,a=await this.resolveRef(i),s=await this.resolveRef(r);return a!=s}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var n,r;try{let i=await ae.currentBranch(this.getRepo())||"",a=await ae.listBranches(this.getRepo()),s=(n=await this.getConfig(`branch.${i}.remote`))!=null?n:"origin",o=(r=await this.getConfig(`branch.${i}.merge`))==null?void 0:r.split("refs/heads")[1],l=o?s+o:void 0;return{current:i,tracking:l,branches:a,remote:s}}catch(i){throw this.plugin.displayError(i),i}}async getCurrentRemote(){var i;let n=await ae.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${n}.remote`))!=null?i:"origin"}async checkout(n,r){try{return this.wrapFS(ae.checkout({...this.getRepo(),ref:n,force:!!r,remote:r}))}catch(i){throw this.plugin.displayError(i),i}}async createBranch(n){try{await this.wrapFS(ae.branch({...this.getRepo(),ref:n,checkout:!0}))}catch(r){throw this.plugin.displayError(r),r}}async deleteBranch(n){try{await this.wrapFS(ae.deleteBranch({...this.getRepo(),ref:n}))}catch(r){throw this.plugin.displayError(r),r}}branchIsMerged(n){return Promise.resolve(!0)}async init(){try{await this.wrapFS(ae.init(this.getRepo()))}catch(n){throw this.plugin.displayError(n),n}}async clone(n,r,i){let a=this.showNotice("Initializing clone");try{await this.wrapFS(ae.clone({...this.getRepo(),dir:r,url:n,depth:i,onProgress:s=>{a!==void 0&&(a.noticeEl.innerText=this.getProgressText("Cloning",s))}})),a==null||a.hide()}catch(s){throw a==null||a.hide(),this.plugin.displayError(s),s}}async setConfig(n,r){try{return this.wrapFS(ae.setConfig({...this.getRepo(),path:n,value:r}))}catch(i){throw this.plugin.displayError(i),i}}async getConfig(n){try{return this.wrapFS(ae.getConfig({...this.getRepo(),path:n}))}catch(r){throw this.plugin.displayError(r),r}}async fetch(n){let r=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:a=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Fetching",a))},remote:n!=null?n:await this.getCurrentRemote()};await this.wrapFS(ae.fetch(i)),r==null||r.hide()}catch(i){throw this.plugin.displayError(i),r==null||r.hide(),i}}async setRemote(n,r){try{await this.wrapFS(ae.addRemote({...this.getRepo(),remote:n,url:r,force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async getRemoteBranches(n){let r=[];return r.push(...await this.wrapFS(ae.listBranches({...this.getRepo(),remote:n}))),r.remove("HEAD"),r=r.map(i=>`${n}/${i}`),r}async getRemotes(){return(await this.wrapFS(ae.listRemotes({...this.getRepo()}))).map(n=>n.remote)}async removeRemote(n){await this.wrapFS(ae.deleteRemote({...this.getRepo(),remote:n}))}async getRemoteUrl(n){var r;return(r=(await this.wrapFS(ae.listRemotes({...this.getRepo()}))).filter(i=>i.remote==n)[0])==null?void 0:r.url}async log(n,r=!0,i){let a=await this.wrapFS(ae.log({...this.getRepo(),depth:i}));return Promise.all(a.map(async s=>{let o=s.commit.message.split(` -// src/lineAuthor/lineAuthorIntegration.ts -init_polyfill_buffer(); -var import_obsidian12 = require("obsidian"); +`);return{message:o[0],author:{name:s.commit.author.name,email:s.commit.author.email},body:o.slice(1).join(` -// src/gitManager/simpleGit.ts -init_polyfill_buffer(); -var import_child_process2 = require("child_process"); -var import_debug2 = __toESM(require_browser()); -var import_obsidian4 = require("obsidian"); -var path = __toESM(require("path")); -var import_path = require("path"); - -// node_modules/.pnpm/simple-git@https+++codeload.github.com+Vinzent03+git-js+tar.gz+6b9a2d899bc8256e38a1d6f0b8a881_rku6lxlylrt42756swupwur2wa/node_modules/simple-git/dist/esm/index.js -init_polyfill_buffer(); -var import_file_exists = __toESM(require_dist(), 1); -var import_debug = __toESM(require_browser(), 1); -var import_child_process = require("child_process"); -var import_promise_deferred = __toESM(require_dist2(), 1); -var import_promise_deferred2 = __toESM(require_dist2(), 1); -var __defProp2 = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropNames2 = Object.getOwnPropertyNames; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp2 = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp2.call(b, prop)) - __defNormalProp2(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp2(a, prop, b[prop]); - } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -var __markAsModule = (target) => __defProp2(target, "__esModule", { value: true }); -var __esm2 = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res; -}; -var __commonJS2 = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); -}; -var __reExport = (target, module2, copyDefault, desc) => { - if (module2 && typeof module2 === "object" || typeof module2 === "function") { - for (let key2 of __getOwnPropNames2(module2)) - if (!__hasOwnProp2.call(target, key2) && (copyDefault || key2 !== "default")) - __defProp2(target, key2, { get: () => module2[key2], enumerable: !(desc = __getOwnPropDesc2(module2, key2)) || desc.enumerable }); - } - return target; -}; -var __toCommonJS2 = /* @__PURE__ */ ((cache) => { - return (module2, temp) => { - return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp); - }; -})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); -var __async = (__this, __arguments, generator) => { - return new Promise((resolve2, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -var GitError; -var init_git_error = __esm2({ - "src/lib/errors/git-error.ts"() { - GitError = class extends Error { - constructor(task, message) { - super(message); - this.task = task; - Object.setPrototypeOf(this, new.target.prototype); - } - }; - } -}); -var GitResponseError; -var init_git_response_error = __esm2({ - "src/lib/errors/git-response-error.ts"() { - init_git_error(); - GitResponseError = class extends GitError { - constructor(git, message) { - super(void 0, message || String(git)); - this.git = git; - } - }; - } -}); -var TaskConfigurationError; -var init_task_configuration_error = __esm2({ - "src/lib/errors/task-configuration-error.ts"() { - init_git_error(); - TaskConfigurationError = class extends GitError { - constructor(message) { - super(void 0, message); - } - }; - } -}); -function asFunction(source) { - return typeof source === "function" ? source : NOOP; -} -function isUserFunction(source) { - return typeof source === "function" && source !== NOOP; -} -function splitOn(input, char) { - const index2 = input.indexOf(char); - if (index2 <= 0) { - return [input, ""]; - } - return [input.substr(0, index2), input.substr(index2 + 1)]; -} -function first(input, offset = 0) { - return isArrayLike(input) && input.length > offset ? input[offset] : void 0; -} -function last(input, offset = 0) { - if (isArrayLike(input) && input.length > offset) { - return input[input.length - 1 - offset]; - } -} -function isArrayLike(input) { - return !!(input && typeof input.length === "number"); -} -function toLinesWithContent(input = "", trimmed2 = true, separator2 = "\n") { - return input.split(separator2).reduce((output, line) => { - const lineContent = trimmed2 ? line.trim() : line; - if (lineContent) { - output.push(lineContent); - } - return output; - }, []); -} -function forEachLineWithContent(input, callback) { - return toLinesWithContent(input, true).map((line) => callback(line)); -} -function folderExists(path2) { - return (0, import_file_exists.exists)(path2, import_file_exists.FOLDER); -} -function append(target, item) { - if (Array.isArray(target)) { - if (!target.includes(item)) { - target.push(item); - } - } else { - target.add(item); - } - return item; -} -function including(target, item) { - if (Array.isArray(target) && !target.includes(item)) { - target.push(item); - } - return target; -} -function remove2(target, item) { - if (Array.isArray(target)) { - const index2 = target.indexOf(item); - if (index2 >= 0) { - target.splice(index2, 1); - } - } else { - target.delete(item); - } - return item; -} -function asArray(source) { - return Array.isArray(source) ? source : [source]; -} -function asStringArray(source) { - return asArray(source).map(String); -} -function asNumber(source, onNaN = 0) { - if (source == null) { - return onNaN; - } - const num2 = parseInt(source, 10); - return isNaN(num2) ? onNaN : num2; -} -function prefixedArray(input, prefix) { - const output = []; - for (let i = 0, max = input.length; i < max; i++) { - output.push(prefix, input[i]); - } - return output; -} -function bufferToString(input) { - return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8"); -} -function pick(source, properties) { - return Object.assign({}, ...properties.map((property) => property in source ? { [property]: source[property] } : {})); -} -function delay(duration = 0) { - return new Promise((done) => setTimeout(done, duration)); -} -var NULL; -var NOOP; -var objectToString; -var init_util = __esm2({ - "src/lib/utils/util.ts"() { - NULL = "\0"; - NOOP = () => { - }; - objectToString = Object.prototype.toString.call.bind(Object.prototype.toString); - } -}); -function filterType(input, filter, def) { - if (filter(input)) { - return input; - } - return arguments.length > 2 ? def : void 0; -} -function filterPrimitives(input, omit) { - return /number|string|boolean/.test(typeof input) && (!omit || !omit.includes(typeof input)); -} -function filterPlainObject(input) { - return !!input && objectToString(input) === "[object Object]"; -} -function filterFunction(input) { - return typeof input === "function"; -} -var filterArray; -var filterString; -var filterStringArray; -var filterStringOrStringArray; -var filterHasLength; -var init_argument_filters = __esm2({ - "src/lib/utils/argument-filters.ts"() { - init_util(); - filterArray = (input) => { - return Array.isArray(input); - }; - filterString = (input) => { - return typeof input === "string"; - }; - filterStringArray = (input) => { - return Array.isArray(input) && input.every(filterString); - }; - filterStringOrStringArray = (input) => { - return filterString(input) || Array.isArray(input) && input.every(filterString); - }; - filterHasLength = (input) => { - if (input == null || "number|boolean|function".includes(typeof input)) { - return false; - } - return Array.isArray(input) || typeof input === "string" || typeof input.length === "number"; - }; - } -}); -var ExitCodes; -var init_exit_codes = __esm2({ - "src/lib/utils/exit-codes.ts"() { - ExitCodes = /* @__PURE__ */ ((ExitCodes2) => { - ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS"; - ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR"; - ExitCodes2[ExitCodes2["NOT_FOUND"] = -2] = "NOT_FOUND"; - ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN"; - return ExitCodes2; - })(ExitCodes || {}); - } -}); -var GitOutputStreams; -var init_git_output_streams = __esm2({ - "src/lib/utils/git-output-streams.ts"() { - GitOutputStreams = class { - constructor(stdOut, stdErr) { - this.stdOut = stdOut; - this.stdErr = stdErr; - } - asStrings() { - return new GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8")); - } - }; - } -}); -var LineParser; -var RemoteLineParser; -var init_line_parser = __esm2({ - "src/lib/utils/line-parser.ts"() { - LineParser = class { - constructor(regExp, useMatches) { - this.matches = []; - this.parse = (line, target) => { - this.resetMatches(); - if (!this._regExp.every((reg, index2) => this.addMatch(reg, index2, line(index2)))) { - return false; - } - return this.useMatches(target, this.prepareMatches()) !== false; - }; - this._regExp = Array.isArray(regExp) ? regExp : [regExp]; - if (useMatches) { - this.useMatches = useMatches; - } - } - useMatches(target, match) { - throw new Error(`LineParser:useMatches not implemented`); - } - resetMatches() { - this.matches.length = 0; - } - prepareMatches() { - return this.matches; - } - addMatch(reg, index2, line) { - const matched = line && reg.exec(line); - if (matched) { - this.pushMatch(index2, matched); - } - return !!matched; - } - pushMatch(_index, matched) { - this.matches.push(...matched.slice(1)); - } - }; - RemoteLineParser = class extends LineParser { - addMatch(reg, index2, line) { - return /^remote:\s/.test(String(line)) && super.addMatch(reg, index2, line); - } - pushMatch(index2, matched) { - if (index2 > 0 || matched.length > 1) { - super.pushMatch(index2, matched); - } - } - }; - } -}); -function createInstanceConfig(...options) { - const baseDir = process.cwd(); - const config = Object.assign(__spreadValues({ baseDir }, defaultOptions), ...options.filter((o) => typeof o === "object" && o)); - config.baseDir = config.baseDir || baseDir; - config.trimmed = config.trimmed === true; - return config; -} -var defaultOptions; -var init_simple_git_options = __esm2({ - "src/lib/utils/simple-git-options.ts"() { - defaultOptions = { - binary: "git", - maxConcurrentProcesses: 5, - config: [], - trimmed: false - }; - } -}); -function appendTaskOptions(options, commands2 = []) { - if (!filterPlainObject(options)) { - return commands2; - } - return Object.keys(options).reduce((commands22, key2) => { - const value = options[key2]; - if (filterPrimitives(value, ["boolean"])) { - commands22.push(key2 + "=" + value); - } else { - commands22.push(key2); - } - return commands22; - }, commands2); -} -function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) { - const command = []; - for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) { - if ("string|number".includes(typeof args[i])) { - command.push(String(args[i])); - } - } - appendTaskOptions(trailingOptionsArgument(args), command); - if (!objectOnly) { - command.push(...trailingArrayArgument(args)); - } - return command; -} -function trailingArrayArgument(args) { - const hasTrailingCallback = typeof last(args) === "function"; - return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []); -} -function trailingOptionsArgument(args) { - const hasTrailingCallback = filterFunction(last(args)); - return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject); -} -function trailingFunctionArgument(args, includeNoop = true) { - const callback = asFunction(last(args)); - return includeNoop || isUserFunction(callback) ? callback : void 0; -} -var init_task_options = __esm2({ - "src/lib/utils/task-options.ts"() { - init_argument_filters(); - init_util(); - } -}); -function callTaskParser(parser3, streams) { - return parser3(streams.stdOut, streams.stdErr); -} -function parseStringResponse(result, parsers12, texts, trim = true) { - asArray(texts).forEach((text2) => { - for (let lines = toLinesWithContent(text2, trim), i = 0, max = lines.length; i < max; i++) { - const line = (offset = 0) => { - if (i + offset >= max) { - return; - } - return lines[i + offset]; - }; - parsers12.some(({ parse: parse2 }) => parse2(line, result)); - } - }); - return result; -} -var init_task_parser = __esm2({ - "src/lib/utils/task-parser.ts"() { - init_util(); - } -}); -var utils_exports = {}; -__export2(utils_exports, { - ExitCodes: () => ExitCodes, - GitOutputStreams: () => GitOutputStreams, - LineParser: () => LineParser, - NOOP: () => NOOP, - NULL: () => NULL, - RemoteLineParser: () => RemoteLineParser, - append: () => append, - appendTaskOptions: () => appendTaskOptions, - asArray: () => asArray, - asFunction: () => asFunction, - asNumber: () => asNumber, - asStringArray: () => asStringArray, - bufferToString: () => bufferToString, - callTaskParser: () => callTaskParser, - createInstanceConfig: () => createInstanceConfig, - delay: () => delay, - filterArray: () => filterArray, - filterFunction: () => filterFunction, - filterHasLength: () => filterHasLength, - filterPlainObject: () => filterPlainObject, - filterPrimitives: () => filterPrimitives, - filterString: () => filterString, - filterStringArray: () => filterStringArray, - filterStringOrStringArray: () => filterStringOrStringArray, - filterType: () => filterType, - first: () => first, - folderExists: () => folderExists, - forEachLineWithContent: () => forEachLineWithContent, - getTrailingOptions: () => getTrailingOptions, - including: () => including, - isUserFunction: () => isUserFunction, - last: () => last, - objectToString: () => objectToString, - parseStringResponse: () => parseStringResponse, - pick: () => pick, - prefixedArray: () => prefixedArray, - remove: () => remove2, - splitOn: () => splitOn, - toLinesWithContent: () => toLinesWithContent, - trailingFunctionArgument: () => trailingFunctionArgument, - trailingOptionsArgument: () => trailingOptionsArgument -}); -var init_utils = __esm2({ - "src/lib/utils/index.ts"() { - init_argument_filters(); - init_exit_codes(); - init_git_output_streams(); - init_line_parser(); - init_simple_git_options(); - init_task_options(); - init_task_parser(); - init_util(); - } -}); -var check_is_repo_exports = {}; -__export2(check_is_repo_exports, { - CheckRepoActions: () => CheckRepoActions, - checkIsBareRepoTask: () => checkIsBareRepoTask, - checkIsRepoRootTask: () => checkIsRepoRootTask, - checkIsRepoTask: () => checkIsRepoTask -}); -function checkIsRepoTask(action) { - switch (action) { - case "bare": - return checkIsBareRepoTask(); - case "root": - return checkIsRepoRootTask(); - } - const commands2 = ["rev-parse", "--is-inside-work-tree"]; - return { - commands: commands2, - format: "utf-8", - onError, - parser - }; -} -function checkIsRepoRootTask() { - const commands2 = ["rev-parse", "--git-dir"]; - return { - commands: commands2, - format: "utf-8", - onError, - parser(path2) { - return /^\.(git)?$/.test(path2.trim()); - } - }; -} -function checkIsBareRepoTask() { - const commands2 = ["rev-parse", "--is-bare-repository"]; - return { - commands: commands2, - format: "utf-8", - onError, - parser - }; -} -function isNotRepoMessage(error) { - return /(Not a git repository|Kein Git-Repository)/i.test(String(error)); -} -var CheckRepoActions; -var onError; -var parser; -var init_check_is_repo = __esm2({ - "src/lib/tasks/check-is-repo.ts"() { - init_utils(); - CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => { - CheckRepoActions2["BARE"] = "bare"; - CheckRepoActions2["IN_TREE"] = "tree"; - CheckRepoActions2["IS_REPO_ROOT"] = "root"; - return CheckRepoActions2; - })(CheckRepoActions || {}); - onError = ({ exitCode }, error, done, fail) => { - if (exitCode === 128 && isNotRepoMessage(error)) { - return done(Buffer.from("false")); - } - fail(error); - }; - parser = (text2) => { - return text2.trim() === "true"; - }; - } -}); -function cleanSummaryParser(dryRun, text2) { - const summary = new CleanResponse(dryRun); - const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp; - toLinesWithContent(text2).forEach((line) => { - const removed = line.replace(regexp, ""); - summary.paths.push(removed); - (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed); - }); - return summary; -} -var CleanResponse; -var removalRegexp; -var dryRunRemovalRegexp; -var isFolderRegexp; -var init_CleanSummary = __esm2({ - "src/lib/responses/CleanSummary.ts"() { - init_utils(); - CleanResponse = class { - constructor(dryRun) { - this.dryRun = dryRun; - this.paths = []; - this.files = []; - this.folders = []; - } - }; - removalRegexp = /^[a-z]+\s*/i; - dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i; - isFolderRegexp = /\/$/; - } -}); -var task_exports = {}; -__export2(task_exports, { - EMPTY_COMMANDS: () => EMPTY_COMMANDS, - adhocExecTask: () => adhocExecTask, - configurationErrorTask: () => configurationErrorTask, - isBufferTask: () => isBufferTask, - isEmptyTask: () => isEmptyTask, - straightThroughBufferTask: () => straightThroughBufferTask, - straightThroughStringTask: () => straightThroughStringTask -}); -function adhocExecTask(parser3) { - return { - commands: EMPTY_COMMANDS, - format: "empty", - parser: parser3 - }; -} -function configurationErrorTask(error) { - return { - commands: EMPTY_COMMANDS, - format: "empty", - parser() { - throw typeof error === "string" ? new TaskConfigurationError(error) : error; - } - }; -} -function straightThroughStringTask(commands2, trimmed2 = false) { - return { - commands: commands2, - format: "utf-8", - parser(text2) { - return trimmed2 ? String(text2).trim() : text2; - } - }; -} -function straightThroughBufferTask(commands2) { - return { - commands: commands2, - format: "buffer", - parser(buffer2) { - return buffer2; - } - }; -} -function isBufferTask(task) { - return task.format === "buffer"; -} -function isEmptyTask(task) { - return task.format === "empty" || !task.commands.length; -} -var EMPTY_COMMANDS; -var init_task = __esm2({ - "src/lib/tasks/task.ts"() { - init_task_configuration_error(); - EMPTY_COMMANDS = []; - } -}); -var clean_exports = {}; -__export2(clean_exports, { - CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE, - CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED, - CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION, - CleanOptions: () => CleanOptions, - cleanTask: () => cleanTask, - cleanWithOptionsTask: () => cleanWithOptionsTask, - isCleanOptionsArray: () => isCleanOptionsArray -}); -function cleanWithOptionsTask(mode, customArgs) { - const { cleanMode, options, valid } = getCleanOptions(mode); - if (!cleanMode) { - return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED); - } - if (!valid.options) { - return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode)); - } - options.push(...customArgs); - if (options.some(isInteractiveMode)) { - return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE); - } - return cleanTask(cleanMode, options); -} -function cleanTask(mode, customArgs) { - const commands2 = ["clean", `-${mode}`, ...customArgs]; - return { - commands: commands2, - format: "utf-8", - parser(text2) { - return cleanSummaryParser(mode === "n", text2); - } - }; -} -function isCleanOptionsArray(input) { - return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test)); -} -function getCleanOptions(input) { - let cleanMode; - let options = []; - let valid = { cleanMode: false, options: true }; - input.replace(/[^a-z]i/g, "").split("").forEach((char) => { - if (isCleanMode(char)) { - cleanMode = char; - valid.cleanMode = true; - } else { - valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`); - } - }); - return { - cleanMode, - options, - valid - }; -} -function isCleanMode(cleanMode) { - return cleanMode === "f" || cleanMode === "n"; -} -function isKnownOption(option) { - return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1)); -} -function isInteractiveMode(option) { - if (/^-[^\-]/.test(option)) { - return option.indexOf("i") > 0; - } - return option === "--interactive"; -} -var CONFIG_ERROR_INTERACTIVE_MODE; -var CONFIG_ERROR_MODE_REQUIRED; -var CONFIG_ERROR_UNKNOWN_OPTION; -var CleanOptions; -var CleanOptionValues; -var init_clean = __esm2({ - "src/lib/tasks/clean.ts"() { - init_CleanSummary(); - init_utils(); - init_task(); - CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported"; - CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required'; - CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: "; - CleanOptions = /* @__PURE__ */ ((CleanOptions2) => { - CleanOptions2["DRY_RUN"] = "n"; - CleanOptions2["FORCE"] = "f"; - CleanOptions2["IGNORED_INCLUDED"] = "x"; - CleanOptions2["IGNORED_ONLY"] = "X"; - CleanOptions2["EXCLUDING"] = "e"; - CleanOptions2["QUIET"] = "q"; - CleanOptions2["RECURSIVE"] = "d"; - return CleanOptions2; - })(CleanOptions || {}); - CleanOptionValues = /* @__PURE__ */ new Set([ - "i", - ...asStringArray(Object.values(CleanOptions)) - ]); - } -}); -function configListParser(text2) { - const config = new ConfigList(); - for (const item of configParser(text2)) { - config.addValue(item.file, String(item.key), item.value); - } - return config; -} -function configGetParser(text2, key2) { - let value = null; - const values = []; - const scopes = /* @__PURE__ */ new Map(); - for (const item of configParser(text2, key2)) { - if (item.key !== key2) { - continue; - } - values.push(value = item.value); - if (!scopes.has(item.file)) { - scopes.set(item.file, []); - } - scopes.get(item.file).push(value); - } - return { - key: key2, - paths: Array.from(scopes.keys()), - scopes, - value, - values - }; -} -function configFilePath(filePath) { - return filePath.replace(/^(file):/, ""); -} -function* configParser(text2, requestedKey = null) { - const lines = text2.split("\0"); - for (let i = 0, max = lines.length - 1; i < max; ) { - const file = configFilePath(lines[i++]); - let value = lines[i++]; - let key2 = requestedKey; - if (value.includes("\n")) { - const line = splitOn(value, "\n"); - key2 = line[0]; - value = line[1]; - } - yield { file, key: key2, value }; - } -} -var ConfigList; -var init_ConfigList = __esm2({ - "src/lib/responses/ConfigList.ts"() { - init_utils(); - ConfigList = class { - constructor() { - this.files = []; - this.values = /* @__PURE__ */ Object.create(null); - } - get all() { - if (!this._all) { - this._all = this.files.reduce((all, file) => { - return Object.assign(all, this.values[file]); - }, {}); - } - return this._all; - } - addFile(file) { - if (!(file in this.values)) { - const latest = last(this.files); - this.values[file] = latest ? Object.create(this.values[latest]) : {}; - this.files.push(file); - } - return this.values[file]; - } - addValue(file, key2, value) { - const values = this.addFile(file); - if (!values.hasOwnProperty(key2)) { - values[key2] = value; - } else if (Array.isArray(values[key2])) { - values[key2].push(value); - } else { - values[key2] = [values[key2], value]; - } - this._all = void 0; - } - }; - } -}); -function asConfigScope(scope, fallback) { - if (typeof scope === "string" && GitConfigScope.hasOwnProperty(scope)) { - return scope; - } - return fallback; -} -function addConfigTask(key2, value, append22, scope) { - const commands2 = ["config", `--${scope}`]; - if (append22) { - commands2.push("--add"); - } - commands2.push(key2, value); - return { - commands: commands2, - format: "utf-8", - parser(text2) { - return text2; - } - }; -} -function getConfigTask(key2, scope) { - const commands2 = ["config", "--null", "--show-origin", "--get-all", key2]; - if (scope) { - commands2.splice(1, 0, `--${scope}`); - } - return { - commands: commands2, - format: "utf-8", - parser(text2) { - return configGetParser(text2, key2); - } - }; -} -function listConfigTask(scope) { - const commands2 = ["config", "--list", "--show-origin", "--null"]; - if (scope) { - commands2.push(`--${scope}`); - } - return { - commands: commands2, - format: "utf-8", - parser(text2) { - return configListParser(text2); - } - }; -} -function config_default() { - return { - addConfig(key2, value, ...rest) { - return this._runTask(addConfigTask(key2, value, rest[0] === true, asConfigScope( - rest[1], - "local" - /* local */ - )), trailingFunctionArgument(arguments)); - }, - getConfig(key2, scope) { - return this._runTask(getConfigTask(key2, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments)); - }, - listConfig(...rest) { - return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments)); - } - }; -} -var GitConfigScope; -var init_config = __esm2({ - "src/lib/tasks/config.ts"() { - init_ConfigList(); - init_utils(); - GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => { - GitConfigScope2["system"] = "system"; - GitConfigScope2["global"] = "global"; - GitConfigScope2["local"] = "local"; - GitConfigScope2["worktree"] = "worktree"; - return GitConfigScope2; - })(GitConfigScope || {}); - } -}); -function grepQueryBuilder(...params) { - return new GrepQuery().param(...params); -} -function parseGrep(grep) { - const paths = /* @__PURE__ */ new Set(); - const results = {}; - forEachLineWithContent(grep, (input) => { - const [path2, line, preview] = input.split(NULL); - paths.add(path2); - (results[path2] = results[path2] || []).push({ - line: asNumber(line), - path: path2, - preview - }); - }); - return { - paths, - results - }; -} -function grep_default() { - return { - grep(searchTerm) { - const then = trailingFunctionArgument(arguments); - const options = getTrailingOptions(arguments); - for (const option of disallowedOptions) { - if (options.includes(option)) { - return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then); - } - } - if (typeof searchTerm === "string") { - searchTerm = grepQueryBuilder().param(searchTerm); - } - const commands2 = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm]; - return this._runTask({ - commands: commands2, - format: "utf-8", - parser(stdOut) { - return parseGrep(stdOut); - } - }, then); - } - }; -} -var disallowedOptions; -var Query; -var _a; -var GrepQuery; -var init_grep = __esm2({ - "src/lib/tasks/grep.ts"() { - init_utils(); - init_task(); - disallowedOptions = ["-h"]; - Query = Symbol("grepQuery"); - GrepQuery = class { - constructor() { - this[_a] = []; - } - *[(_a = Query, Symbol.iterator)]() { - for (const query of this[Query]) { - yield query; - } - } - and(...and) { - and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")"); - return this; - } - param(...param) { - this[Query].push(...prefixedArray(param, "-e")); - return this; - } - }; - } -}); -var reset_exports = {}; -__export2(reset_exports, { - ResetMode: () => ResetMode, - getResetMode: () => getResetMode, - resetTask: () => resetTask -}); -function resetTask(mode, customArgs) { - const commands2 = ["reset"]; - if (isValidResetMode(mode)) { - commands2.push(`--${mode}`); - } - commands2.push(...customArgs); - return straightThroughStringTask(commands2); -} -function getResetMode(mode) { - if (isValidResetMode(mode)) { - return mode; - } - switch (typeof mode) { - case "string": - case "undefined": - return "soft"; - } - return; -} -function isValidResetMode(mode) { - return ResetModes.includes(mode); -} -var ResetMode; -var ResetModes; -var init_reset = __esm2({ - "src/lib/tasks/reset.ts"() { - init_task(); - ResetMode = /* @__PURE__ */ ((ResetMode2) => { - ResetMode2["MIXED"] = "mixed"; - ResetMode2["SOFT"] = "soft"; - ResetMode2["HARD"] = "hard"; - ResetMode2["MERGE"] = "merge"; - ResetMode2["KEEP"] = "keep"; - return ResetMode2; - })(ResetMode || {}); - ResetModes = Array.from(Object.values(ResetMode)); - } -}); -function createLog() { - return (0, import_debug.default)("simple-git"); -} -function prefixedLogger(to, prefix, forward) { - if (!prefix || !String(prefix).replace(/\s*/, "")) { - return !forward ? to : (message, ...args) => { - to(message, ...args); - forward(message, ...args); - }; - } - return (message, ...args) => { - to(`%s ${message}`, prefix, ...args); - if (forward) { - forward(message, ...args); - } - }; -} -function childLoggerName(name, childDebugger, { namespace: parentNamespace }) { - if (typeof name === "string") { - return name; - } - const childNamespace = childDebugger && childDebugger.namespace || ""; - if (childNamespace.startsWith(parentNamespace)) { - return childNamespace.substr(parentNamespace.length + 1); - } - return childNamespace || parentNamespace; -} -function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { - const labelPrefix = label && `[${label}]` || ""; - const spawned = []; - const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose; - const key2 = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger); - return step(initialStep); - function sibling(name, initial) { - return append(spawned, createLogger(label, key2.replace(/^[^:]+/, name), initial, infoDebugger)); - } - function step(phase) { - const stepPrefix = phase && `[${phase}]` || ""; - const debug22 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP; - const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug22); - return Object.assign(debugDebugger ? debug22 : info, { - label, - sibling, - info, - step - }); - } -} -var init_git_logger = __esm2({ - "src/lib/git-logger.ts"() { - init_utils(); - import_debug.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-"); - import_debug.default.formatters.B = (value) => { - if (Buffer.isBuffer(value)) { - return value.toString("utf8"); - } - return objectToString(value); - }; - } -}); -var _TasksPendingQueue; -var TasksPendingQueue; -var init_tasks_pending_queue = __esm2({ - "src/lib/runners/tasks-pending-queue.ts"() { - init_git_error(); - init_git_logger(); - _TasksPendingQueue = class { - constructor(logLabel = "GitExecutor") { - this.logLabel = logLabel; - this._queue = /* @__PURE__ */ new Map(); - } - withProgress(task) { - return this._queue.get(task); - } - createProgress(task) { - const name = _TasksPendingQueue.getName(task.commands[0]); - const logger = createLogger(this.logLabel, name); - return { - task, - logger, - name - }; - } - push(task) { - const progress = this.createProgress(task); - progress.logger("Adding task to the queue, commands = %o", task.commands); - this._queue.set(task, progress); - return progress; - } - fatal(err) { - for (const [task, { logger }] of Array.from(this._queue.entries())) { - if (task === err.task) { - logger.info(`Failed %o`, err); - logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`); - } else { - logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message); - } - this.complete(task); - } - if (this._queue.size !== 0) { - throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`); - } - } - complete(task) { - const progress = this.withProgress(task); - if (progress) { - this._queue.delete(task); - } - } - attempt(task) { - const progress = this.withProgress(task); - if (!progress) { - throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task"); - } - progress.logger("Starting task"); - return progress; - } - static getName(name = "empty") { - return `task:${name}:${++_TasksPendingQueue.counter}`; - } - }; - TasksPendingQueue = _TasksPendingQueue; - TasksPendingQueue.counter = 0; - } -}); -function pluginContext(task, commands2) { - return { - method: first(task.commands) || "", - commands: commands2 - }; -} -function onErrorReceived(target, logger) { - return (err) => { - logger(`[ERROR] child process exception %o`, err); - target.push(Buffer.from(String(err.stack), "ascii")); - }; -} -function onDataReceived(target, name, logger, output) { - return (buffer2) => { - logger(`%s received %L bytes`, name, buffer2); - output(`%B`, buffer2); - target.push(buffer2); - }; -} -var GitExecutorChain; -var init_git_executor_chain = __esm2({ - "src/lib/runners/git-executor-chain.ts"() { - init_git_error(); - init_task(); - init_utils(); - init_tasks_pending_queue(); - GitExecutorChain = class { - constructor(_executor, _scheduler, _plugins) { - this._executor = _executor; - this._scheduler = _scheduler; - this._plugins = _plugins; - this._chain = Promise.resolve(); - this._queue = new TasksPendingQueue(); - } - get binary() { - return this._executor.binary; - } - get cwd() { - return this._cwd || this._executor.cwd; - } - set cwd(cwd) { - this._cwd = cwd; - } - get env() { - return this._executor.env; - } - get outputHandler() { - return this._executor.outputHandler; - } - chain() { - return this; - } - push(task) { - this._queue.push(task); - return this._chain = this._chain.then(() => this.attemptTask(task)); - } - attemptTask(task) { - return __async(this, null, function* () { - const onScheduleComplete = yield this._scheduler.next(); - const onQueueComplete = () => this._queue.complete(task); - try { - const { logger } = this._queue.attempt(task); - return yield isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger); - } catch (e) { - throw this.onFatalException(task, e); - } finally { - onQueueComplete(); - onScheduleComplete(); - } - }); - } - onFatalException(task, e) { - const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e)); - this._chain = Promise.resolve(); - this._queue.fatal(gitError); - return gitError; - } - attemptRemoteTask(task, logger) { - return __async(this, null, function* () { - const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands)); - const raw = yield this.gitResponse(task, this.binary, args, this.outputHandler, logger.step("SPAWN")); - const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE")); - logger(`passing response to task's parser as a %s`, task.format); - if (isBufferTask(task)) { - return callTaskParser(task.parser, outputStreams); - } - return callTaskParser(task.parser, outputStreams.asStrings()); - }); - } - attemptEmptyTask(task, logger) { - return __async(this, null, function* () { - logger(`empty task bypassing child process to call to task's parser`); - return task.parser(this); - }); - } - handleTaskData(task, args, result, logger) { - const { exitCode, rejection, stdOut, stdErr } = result; - return new Promise((done, fail) => { - logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode); - const { error } = this._plugins.exec("task.error", { error: rejection }, __spreadValues(__spreadValues({}, pluginContext(task, args)), result)); - if (error && task.onError) { - logger.info(`exitCode=%s handling with custom error handler`); - return task.onError(result, error, (newStdOut) => { - logger.info(`custom error handler treated as success`); - logger(`custom error returned a %s`, objectToString(newStdOut)); - done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr))); - }, fail); - } - if (error) { - logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection); - return fail(error); - } - logger.info(`retrieving task output complete`); - done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr))); - }); - } - gitResponse(task, command, args, outputHandler, logger) { - return __async(this, null, function* () { - const outputLogger = logger.sibling("output"); - const spawnOptions = this._plugins.exec("spawn.options", { - cwd: this.cwd, - env: this.env, - windowsHide: true - }, pluginContext(task, task.commands)); - return new Promise((done) => { - const stdOut = []; - const stdErr = []; - logger.info(`%s %o`, command, args); - logger("%O", spawnOptions); - let rejection = this._beforeSpawn(task, args); - if (rejection) { - return done({ - stdOut, - stdErr, - exitCode: 9901, - rejection - }); - } - this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), { - kill(reason) { - rejection = reason || rejection; - } - })); - const spawned = (0, import_child_process.spawn)(command, args, spawnOptions); - spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))); - spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))); - spawned.on("error", onErrorReceived(stdErr, logger)); - if (outputHandler) { - logger(`Passing child process stdOut/stdErr to custom outputHandler`); - outputHandler(command, spawned.stdout, spawned.stderr, [...args]); - } - this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), { - spawned, - close(exitCode, reason) { - done({ - stdOut, - stdErr, - exitCode, - rejection: rejection || reason - }); - }, - kill(reason) { - if (spawned.killed) { - return; - } - rejection = reason; - spawned.kill("SIGINT"); - } - })); - }); - }); - } - _beforeSpawn(task, args) { - let rejection; - this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), { - kill(reason) { - rejection = reason || rejection; - } - })); - return rejection; - } - }; - } -}); -var git_executor_exports = {}; -__export2(git_executor_exports, { - GitExecutor: () => GitExecutor -}); -var GitExecutor; -var init_git_executor = __esm2({ - "src/lib/runners/git-executor.ts"() { - init_git_executor_chain(); - GitExecutor = class { - constructor(binary = "git", cwd, _scheduler, _plugins) { - this.binary = binary; - this.cwd = cwd; - this._scheduler = _scheduler; - this._plugins = _plugins; - this._chain = new GitExecutorChain(this, this._scheduler, this._plugins); - } - chain() { - return new GitExecutorChain(this, this._scheduler, this._plugins); - } - push(task) { - return this._chain.push(task); - } - }; - } -}); -function taskCallback(task, response, callback = NOOP) { - const onSuccess = (data) => { - callback(null, data); - }; - const onError2 = (err) => { - if ((err == null ? void 0 : err.task) === task) { - callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0); - } - }; - response.then(onSuccess, onError2); -} -function addDeprecationNoticeToError(err) { - let log2 = (name) => { - console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`); - log2 = NOOP; - }; - return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {})); - function descriptorReducer(all, name) { - if (name in err) { - return all; - } - all[name] = { - enumerable: false, - configurable: false, - get() { - log2(name); - return err.git[name]; - } - }; - return all; - } -} -var init_task_callback = __esm2({ - "src/lib/task-callback.ts"() { - init_git_response_error(); - init_utils(); - } -}); -function changeWorkingDirectoryTask(directory, root2) { - return adhocExecTask((instance10) => { - if (!folderExists(directory)) { - throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`); - } - return (root2 || instance10).cwd = directory; - }); -} -var init_change_working_directory = __esm2({ - "src/lib/tasks/change-working-directory.ts"() { - init_utils(); - init_task(); - } -}); -function checkoutTask(args) { - const commands2 = ["checkout", ...args]; - if (commands2[1] === "-b" && commands2.includes("-B")) { - commands2[1] = remove2(commands2, "-B"); - } - return straightThroughStringTask(commands2); -} -function checkout_default() { - return { - checkout() { - return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments)); - }, - checkoutBranch(branchName, startPoint) { - return this._runTask(checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); - }, - checkoutLocalBranch(branchName) { - return this._runTask(checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); - } - }; -} -var init_checkout = __esm2({ - "src/lib/tasks/checkout.ts"() { - init_utils(); - init_task(); - } -}); -function parseCommitResult(stdOut) { - const result = { - author: null, - branch: "", - commit: "", - root: false, - summary: { - changes: 0, - insertions: 0, - deletions: 0 - } - }; - return parseStringResponse(result, parsers, stdOut); -} -var parsers; -var init_parse_commit = __esm2({ - "src/lib/parsers/parse-commit.ts"() { - init_utils(); - parsers = [ - new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch2, root2, commit2]) => { - result.branch = branch2; - result.commit = commit2; - result.root = !!root2; - }), - new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => { - const parts = author.split("<"); - const email = parts.pop(); - if (!email || !email.includes("@")) { - return; - } - result.author = { - email: email.substr(0, email.length - 1), - name: parts.join("<").trim() - }; - }), - new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => { - result.summary.changes = parseInt(changes, 10) || 0; - result.summary.insertions = parseInt(insertions, 10) || 0; - result.summary.deletions = parseInt(deletions, 10) || 0; - }), - new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => { - result.summary.changes = parseInt(changes, 10) || 0; - const count = parseInt(lines, 10) || 0; - if (direction === "-") { - result.summary.deletions = count; - } else if (direction === "+") { - result.summary.insertions = count; - } - }) - ]; - } -}); -function commitTask(message, files, customArgs) { - const commands2 = [ - "-c", - "core.abbrev=40", - "commit", - ...prefixedArray(message, "-m"), - ...files, - ...customArgs - ]; - return { - commands: commands2, - format: "utf-8", - parser: parseCommitResult - }; -} -function commit_default() { - return { - commit(message, ...rest) { - const next = trailingFunctionArgument(arguments); - const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]); - return this._runTask(task, next); - } - }; - function rejectDeprecatedSignatures(message) { - return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`); - } -} -var init_commit = __esm2({ - "src/lib/tasks/commit.ts"() { - init_parse_commit(); - init_utils(); - init_task(); - } -}); -function hashObjectTask(filePath, write) { - const commands2 = ["hash-object", filePath]; - if (write) { - commands2.push("-w"); - } - return straightThroughStringTask(commands2, true); -} -var init_hash_object = __esm2({ - "src/lib/tasks/hash-object.ts"() { - init_task(); - } -}); -function parseInit(bare, path2, text2) { - const response = String(text2).trim(); - let result; - if (result = initResponseRegex.exec(response)) { - return new InitSummary(bare, path2, false, result[1]); - } - if (result = reInitResponseRegex.exec(response)) { - return new InitSummary(bare, path2, true, result[1]); - } - let gitDir = ""; - const tokens = response.split(" "); - while (tokens.length) { - const token = tokens.shift(); - if (token === "in") { - gitDir = tokens.join(" "); - break; - } - } - return new InitSummary(bare, path2, /^re/i.test(response), gitDir); -} -var InitSummary; -var initResponseRegex; -var reInitResponseRegex; -var init_InitSummary = __esm2({ - "src/lib/responses/InitSummary.ts"() { - InitSummary = class { - constructor(bare, path2, existing, gitDir) { - this.bare = bare; - this.path = path2; - this.existing = existing; - this.gitDir = gitDir; - } - }; - initResponseRegex = /^Init.+ repository in (.+)$/; - reInitResponseRegex = /^Rein.+ in (.+)$/; - } -}); -function hasBareCommand(command) { - return command.includes(bareCommand); -} -function initTask(bare = false, path2, customArgs) { - const commands2 = ["init", ...customArgs]; - if (bare && !hasBareCommand(commands2)) { - commands2.splice(1, 0, bareCommand); - } - return { - commands: commands2, - format: "utf-8", - parser(text2) { - return parseInit(commands2.includes("--bare"), path2, text2); - } - }; -} -var bareCommand; -var init_init = __esm2({ - "src/lib/tasks/init.ts"() { - init_InitSummary(); - bareCommand = "--bare"; - } -}); -function logFormatFromCommand(customArgs) { - for (let i = 0; i < customArgs.length; i++) { - const format = logFormatRegex.exec(customArgs[i]); - if (format) { - return `--${format[1]}`; - } - } - return ""; -} -function isLogFormat(customArg) { - return logFormatRegex.test(customArg); -} -var logFormatRegex; -var init_log_format = __esm2({ - "src/lib/args/log-format.ts"() { - logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/; - } -}); -var DiffSummary; -var init_DiffSummary = __esm2({ - "src/lib/responses/DiffSummary.ts"() { - DiffSummary = class { - constructor() { - this.changed = 0; - this.deletions = 0; - this.insertions = 0; - this.files = []; - } - }; - } -}); -function getDiffParser(format = "") { - const parser3 = diffSummaryParsers[format]; - return (stdOut) => parseStringResponse(new DiffSummary(), parser3, stdOut, false); -} -var statParser; -var numStatParser; -var nameOnlyParser; -var nameStatusParser; -var diffSummaryParsers; -var init_parse_diff_summary = __esm2({ - "src/lib/parsers/parse-diff-summary.ts"() { - init_log_format(); - init_DiffSummary(); - init_utils(); - statParser = [ - new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => { - result.files.push({ - file: file.trim(), - changes: asNumber(changes), - insertions: alterations.replace(/[^+]/g, "").length, - deletions: alterations.replace(/[^-]/g, "").length, - binary: false - }); - }), - new LineParser(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => { - result.files.push({ - file: file.trim(), - before: asNumber(before), - after: asNumber(after), - binary: true - }); - }), - new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => { - const inserted = /(\d+) i/.exec(summary); - const deleted = /(\d+) d/.exec(summary); - result.changed = asNumber(changed); - result.insertions = asNumber(inserted == null ? void 0 : inserted[1]); - result.deletions = asNumber(deleted == null ? void 0 : deleted[1]); - }) - ]; - numStatParser = [ - new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => { - const insertions = asNumber(changesInsert); - const deletions = asNumber(changesDelete); - result.changed++; - result.insertions += insertions; - result.deletions += deletions; - result.files.push({ - file, - changes: insertions + deletions, - insertions, - deletions, - binary: false - }); - }), - new LineParser(/-\t-\t(.+)$/, (result, [file]) => { - result.changed++; - result.files.push({ - file, - after: 0, - before: 0, - binary: true - }); - }) - ]; - nameOnlyParser = [ - new LineParser(/(.+)$/, (result, [file]) => { - result.changed++; - result.files.push({ - file, - changes: 0, - insertions: 0, - deletions: 0, - binary: false - }); - }) - ]; - nameStatusParser = [ - new LineParser(/([ACDMRTUXB])([0-9][0-9][0-9])?\t(.[^\t]+)\t?(.*)?$/, (result, [status2, _similarity, from, to]) => { - result.changed++; - result.files.push({ - file: to != null ? to : from, - changes: 0, - status: status2, - insertions: 0, - deletions: 0, - binary: false - }); - }) - ]; - diffSummaryParsers = { - [ - "" - /* NONE */ - ]: statParser, - [ - "--stat" - /* STAT */ - ]: statParser, - [ - "--numstat" - /* NUM_STAT */ - ]: numStatParser, - [ - "--name-status" - /* NAME_STATUS */ - ]: nameStatusParser, - [ - "--name-only" - /* NAME_ONLY */ - ]: nameOnlyParser - }; - } -}); -function lineBuilder(tokens, fields) { - return fields.reduce((line, field, index2) => { - line[field] = tokens[index2] || ""; - return line; - }, /* @__PURE__ */ Object.create({ diff: null })); -} -function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "") { - const parseDiffResult = getDiffParser(logFormat); - return function(stdOut) { - const all = toLinesWithContent(stdOut, true, START_BOUNDARY).map(function(item) { - const lineDetail = item.trim().split(COMMIT_BOUNDARY); - const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields); - if (lineDetail.length > 1 && !!lineDetail[1].trim()) { - listLogLine.diff = parseDiffResult(lineDetail[1]); - } - return listLogLine; - }); - return { - all, - latest: all.length && all[0] || null, - total: all.length - }; - }; -} -var START_BOUNDARY; -var COMMIT_BOUNDARY; -var SPLITTER; -var defaultFieldNames; -var init_parse_list_log_summary = __esm2({ - "src/lib/parsers/parse-list-log-summary.ts"() { - init_utils(); - init_parse_diff_summary(); - init_log_format(); - START_BOUNDARY = "\xF2\xF2\xF2\xF2\xF2\xF2 "; - COMMIT_BOUNDARY = " \xF2\xF2"; - SPLITTER = " \xF2 "; - defaultFieldNames = ["hash", "date", "message", "refs", "author_name", "author_email"]; - } -}); -var diff_exports = {}; -__export2(diff_exports, { - diffSummaryTask: () => diffSummaryTask, - validateLogFormatConfig: () => validateLogFormatConfig -}); -function diffSummaryTask(customArgs) { - let logFormat = logFormatFromCommand(customArgs); - const commands2 = ["diff"]; - if (logFormat === "") { - logFormat = "--stat"; - commands2.push("--stat=4096"); - } - commands2.push(...customArgs); - return validateLogFormatConfig(commands2) || { - commands: commands2, - format: "utf-8", - parser: getDiffParser(logFormat) - }; -} -function validateLogFormatConfig(customArgs) { - const flags = customArgs.filter(isLogFormat); - if (flags.length > 1) { - return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`); - } - if (flags.length && customArgs.includes("-z")) { - return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`); - } -} -var init_diff = __esm2({ - "src/lib/tasks/diff.ts"() { - init_log_format(); - init_parse_diff_summary(); - init_task(); - } -}); -function prettyFormat(format, splitter) { - const fields = []; - const formatStr = []; - Object.keys(format).forEach((field) => { - fields.push(field); - formatStr.push(String(format[field])); - }); - return [fields, formatStr.join(splitter)]; -} -function userOptions(input) { - return Object.keys(input).reduce((out, key2) => { - if (!(key2 in excludeOptions)) { - out[key2] = input[key2]; - } - return out; - }, {}); -} -function parseLogOptions(opt = {}, customArgs = []) { - const splitter = filterType(opt.splitter, filterString, SPLITTER); - const format = !filterPrimitives(opt.format) && opt.format ? opt.format : { - hash: "%H", - date: opt.strictDate === false ? "%ai" : "%aI", - message: "%s", - refs: "%D", - body: opt.multiLine ? "%B" : "%b", - author_name: opt.mailMap !== false ? "%aN" : "%an", - author_email: opt.mailMap !== false ? "%aE" : "%ae" - }; - const [fields, formatStr] = prettyFormat(format, splitter); - const suffix = []; - const command = [ - `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`, - ...customArgs - ]; - const maxCount = opt.n || opt["max-count"] || opt.maxCount; - if (maxCount) { - command.push(`--max-count=${maxCount}`); - } - if (opt.from || opt.to) { - const rangeOperator = opt.symmetric !== false ? "..." : ".."; - suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`); - } - if (filterString(opt.file)) { - suffix.push("--follow", opt.file); - } - appendTaskOptions(userOptions(opt), command); - return { - fields, - splitter, - commands: [...command, ...suffix] - }; -} -function logTask(splitter, fields, customArgs) { - const parser3 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs)); - return { - commands: ["log", ...customArgs], - format: "utf-8", - parser: parser3 - }; -} -function log_default() { - return { - log(...rest) { - const next = trailingFunctionArgument(arguments); - const options = parseLogOptions(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray)); - const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options); - return this._runTask(task, next); - } - }; - function createLogTask(options) { - return logTask(options.splitter, options.fields, options.commands); - } - function rejectDeprecatedSignatures(from, to) { - return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`); - } -} -var excludeOptions; -var init_log = __esm2({ - "src/lib/tasks/log.ts"() { - init_log_format(); - init_parse_list_log_summary(); - init_utils(); - init_task(); - init_diff(); - excludeOptions = /* @__PURE__ */ ((excludeOptions2) => { - excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty"; - excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count"; - excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount"; - excludeOptions2[excludeOptions2["n"] = 3] = "n"; - excludeOptions2[excludeOptions2["file"] = 4] = "file"; - excludeOptions2[excludeOptions2["format"] = 5] = "format"; - excludeOptions2[excludeOptions2["from"] = 6] = "from"; - excludeOptions2[excludeOptions2["to"] = 7] = "to"; - excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter"; - excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric"; - excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap"; - excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine"; - excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate"; - return excludeOptions2; - })(excludeOptions || {}); - } -}); -var MergeSummaryConflict; -var MergeSummaryDetail; -var init_MergeSummary = __esm2({ - "src/lib/responses/MergeSummary.ts"() { - MergeSummaryConflict = class { - constructor(reason, file = null, meta) { - this.reason = reason; - this.file = file; - this.meta = meta; - } - toString() { - return `${this.file}:${this.reason}`; - } - }; - MergeSummaryDetail = class { - constructor() { - this.conflicts = []; - this.merges = []; - this.result = "success"; - } - get failed() { - return this.conflicts.length > 0; - } - get reason() { - return this.result; - } - toString() { - if (this.conflicts.length) { - return `CONFLICTS: ${this.conflicts.join(", ")}`; - } - return "OK"; - } - }; - } -}); -var PullSummary; -var PullFailedSummary; -var init_PullSummary = __esm2({ - "src/lib/responses/PullSummary.ts"() { - PullSummary = class { - constructor() { - this.remoteMessages = { - all: [] - }; - this.created = []; - this.deleted = []; - this.files = []; - this.deletions = {}; - this.insertions = {}; - this.summary = { - changes: 0, - deletions: 0, - insertions: 0 - }; - } - }; - PullFailedSummary = class { - constructor() { - this.remote = ""; - this.hash = { - local: "", - remote: "" - }; - this.branch = { - local: "", - remote: "" - }; - this.message = ""; - } - toString() { - return this.message; - } - }; - } -}); -function objectEnumerationResult(remoteMessages) { - return remoteMessages.objects = remoteMessages.objects || { - compressing: 0, - counting: 0, - enumerating: 0, - packReused: 0, - reused: { count: 0, delta: 0 }, - total: { count: 0, delta: 0 } - }; -} -function asObjectCount(source) { - const count = /^\s*(\d+)/.exec(source); - const delta = /delta (\d+)/i.exec(source); - return { - count: asNumber(count && count[1] || "0"), - delta: asNumber(delta && delta[1] || "0") - }; -} -var remoteMessagesObjectParsers; -var init_parse_remote_objects = __esm2({ - "src/lib/parsers/parse-remote-objects.ts"() { - init_utils(); - remoteMessagesObjectParsers = [ - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => { - const key2 = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key2]: asNumber(count) }); - }), - new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => { - const key2 = action.toLowerCase(); - const enumeration = objectEnumerationResult(result.remoteMessages); - Object.assign(enumeration, { [key2]: asNumber(count) }); - }), - new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => { - const objects = objectEnumerationResult(result.remoteMessages); - objects.total = asObjectCount(total); - objects.reused = asObjectCount(reused); - objects.packReused = asNumber(packReused); - }) - ]; - } -}); -function parseRemoteMessages(_stdOut, stdErr) { - return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr); -} -var parsers2; -var RemoteMessageSummary; -var init_parse_remote_messages = __esm2({ - "src/lib/parsers/parse-remote-messages.ts"() { - init_utils(); - init_parse_remote_objects(); - parsers2 = [ - new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text2]) => { - result.remoteMessages.all.push(text2.trim()); - return false; - }), - ...remoteMessagesObjectParsers, - new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => { - result.remoteMessages.pullRequestUrl = pullRequestUrl; - }), - new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => { - result.remoteMessages.vulnerabilities = { - count: asNumber(count), - summary, - url - }; - }) - ]; - RemoteMessageSummary = class { - constructor() { - this.all = []; - } - }; - } -}); -function parsePullErrorResult(stdOut, stdErr) { - const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]); - return pullError.message && pullError; -} -var FILE_UPDATE_REGEX; -var SUMMARY_REGEX; -var ACTION_REGEX; -var parsers3; -var errorParsers; -var parsePullDetail; -var parsePullResult; -var init_parse_pull = __esm2({ - "src/lib/parsers/parse-pull.ts"() { - init_PullSummary(); - init_utils(); - init_parse_remote_messages(); - FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/; - SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/; - ACTION_REGEX = /^(create|delete) mode \d+ (.+)/; - parsers3 = [ - new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => { - result.files.push(file); - if (insertions) { - result.insertions[file] = insertions.length; - } - if (deletions) { - result.deletions[file] = deletions.length; - } - }), - new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => { - if (insertions !== void 0 || deletions !== void 0) { - result.summary.changes = +changes || 0; - result.summary.insertions = +insertions || 0; - result.summary.deletions = +deletions || 0; - return true; - } - return false; - }), - new LineParser(ACTION_REGEX, (result, [action, file]) => { - append(result.files, file); - append(action === "create" ? result.created : result.deleted, file); - }) - ]; - errorParsers = [ - new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)), - new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)), - new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { - result.branch.local = branchLocal; - result.hash.local = hashLocal; - result.branch.remote = branchRemote; - result.hash.remote = hashRemote; - }) - ]; - parsePullDetail = (stdOut, stdErr) => { - return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]); - }; - parsePullResult = (stdOut, stdErr) => { - return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr)); - }; - } -}); -var parsers4; -var parseMergeResult; -var parseMergeDetail; -var init_parse_merge = __esm2({ - "src/lib/parsers/parse-merge.ts"() { - init_MergeSummary(); - init_utils(); - init_parse_pull(); - parsers4 = [ - new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => { - summary.merges.push(autoMerge); - }), - new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => { - summary.conflicts.push(new MergeSummaryConflict(reason, file)); - }), - new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef2]) => { - summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef: deleteRef2 })); - }), - new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => { - summary.conflicts.push(new MergeSummaryConflict(reason, null)); - }), - new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => { - summary.result = result; - }) - ]; - parseMergeResult = (stdOut, stdErr) => { - return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr)); - }; - parseMergeDetail = (stdOut) => { - return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut); - }; - } -}); -function mergeTask(customArgs) { - if (!customArgs.length) { - return configurationErrorTask("Git.merge requires at least one option"); - } - return { - commands: ["merge", ...customArgs], - format: "utf-8", - parser(stdOut, stdErr) { - const merge2 = parseMergeResult(stdOut, stdErr); - if (merge2.failed) { - throw new GitResponseError(merge2); - } - return merge2; - } - }; -} -var init_merge = __esm2({ - "src/lib/tasks/merge.ts"() { - init_git_response_error(); - init_parse_merge(); - init_task(); - } -}); -function pushResultPushedItem(local, remote, status2) { - const deleted = status2.includes("deleted"); - const tag2 = status2.includes("tag") || /^refs\/tags/.test(local); - const alreadyUpdated = !status2.includes("new"); - return { - deleted, - tag: tag2, - branch: !tag2, - new: !alreadyUpdated, - alreadyUpdated, - local, - remote - }; -} -var parsers5; -var parsePushResult; -var parsePushDetail; -var init_parse_push = __esm2({ - "src/lib/parsers/parse-push.ts"() { - init_utils(); - init_parse_remote_messages(); - parsers5 = [ - new LineParser(/^Pushing to (.+)$/, (result, [repo]) => { - result.repo = repo; - }), - new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => { - result.ref = __spreadProps(__spreadValues({}, result.ref || {}), { - local - }); - }), - new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => { - result.pushed.push(pushResultPushedItem(local, remote, type)); - }), - new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => { - result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { - local, - remote, - remoteName - }); - }), - new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => { - result.update = { - head: { - local, - remote - }, - hash: { - from, - to - } - }; - }) - ]; - parsePushResult = (stdOut, stdErr) => { - const pushDetail = parsePushDetail(stdOut, stdErr); - const responseDetail = parseRemoteMessages(stdOut, stdErr); - return __spreadValues(__spreadValues({}, pushDetail), responseDetail); - }; - parsePushDetail = (stdOut, stdErr) => { - return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]); - }; - } -}); -var push_exports = {}; -__export2(push_exports, { - pushTagsTask: () => pushTagsTask, - pushTask: () => pushTask -}); -function pushTagsTask(ref = {}, customArgs) { - append(customArgs, "--tags"); - return pushTask(ref, customArgs); -} -function pushTask(ref = {}, customArgs) { - const commands2 = ["push", ...customArgs]; - if (ref.branch) { - commands2.splice(1, 0, ref.branch); - } - if (ref.remote) { - commands2.splice(1, 0, ref.remote); - } - remove2(commands2, "-v"); - append(commands2, "--verbose"); - append(commands2, "--porcelain"); - return { - commands: commands2, - format: "utf-8", - parser: parsePushResult - }; -} -var init_push = __esm2({ - "src/lib/tasks/push.ts"() { - init_parse_push(); - init_utils(); - } -}); -var fromPathRegex; -var FileStatusSummary; -var init_FileStatusSummary = __esm2({ - "src/lib/responses/FileStatusSummary.ts"() { - fromPathRegex = /^(.+) -> (.+)$/; - FileStatusSummary = class { - constructor(path2, index2, working_dir) { - this.path = path2; - this.index = index2; - this.working_dir = working_dir; - if (index2 + working_dir === "R") { - const detail = fromPathRegex.exec(path2) || [null, path2, path2]; - this.from = detail[1] || ""; - this.path = detail[2] || ""; - } - } - }; - } -}); -function renamedFile(line) { - const [to, from] = line.split(NULL); - return { - from: from || to, - to - }; -} -function parser2(indexX, indexY, handler) { - return [`${indexX}${indexY}`, handler]; -} -function conflicts(indexX, ...indexY) { - return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file))); -} -function splitLine(result, lineStr) { - const trimmed2 = lineStr.trim(); - switch (" ") { - case trimmed2.charAt(2): - return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3)); - case trimmed2.charAt(1): - return data(" ", trimmed2.charAt(0), trimmed2.substr(2)); - default: - return; - } - function data(index2, workingDir, path2) { - const raw = `${index2}${workingDir}`; - const handler = parsers6.get(raw); - if (handler) { - handler(result, path2); - } - if (raw !== "##" && raw !== "!!") { - result.files.push(new FileStatusSummary(path2.replace(/\0.+$/, ""), index2, workingDir)); - } - } -} -var StatusSummary; -var parsers6; -var parseStatusSummary; -var init_StatusSummary = __esm2({ - "src/lib/responses/StatusSummary.ts"() { - init_utils(); - init_FileStatusSummary(); - StatusSummary = 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 = false; - this.isClean = () => { - return !this.files.length; - }; - } - }; - parsers6 = new Map([ - parser2(" ", "A", (result, file) => append(result.created, file)), - parser2(" ", "D", (result, file) => append(result.deleted, file)), - parser2(" ", "M", (result, file) => append(result.modified, file)), - parser2("A", " ", (result, file) => append(result.created, file) && append(result.staged, file)), - parser2("A", "M", (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)), - parser2("D", " ", (result, file) => append(result.deleted, file) && append(result.staged, file)), - parser2("M", " ", (result, file) => append(result.modified, file) && append(result.staged, file)), - parser2("M", "M", (result, file) => append(result.modified, file) && append(result.staged, file)), - parser2("R", " ", (result, file) => { - append(result.renamed, renamedFile(file)); - }), - parser2("R", "M", (result, file) => { - const renamed = renamedFile(file); - append(result.renamed, renamed); - append(result.modified, renamed.to); - }), - parser2("!", "!", (_result, _file) => { - append(_result.ignored = _result.ignored || [], _file); - }), - parser2("?", "?", (result, file) => append(result.not_added, file)), - ...conflicts( - "A", - "A", - "U" - /* UNMERGED */ - ), - ...conflicts( - "D", - "D", - "U" - /* UNMERGED */ - ), - ...conflicts( - "U", - "A", - "D", - "U" - /* UNMERGED */ - ), - [ - "##", - (result, line) => { - const aheadReg = /ahead (\d+)/; - const behindReg = /behind (\d+)/; - const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/; - const trackingReg = /\.{3}(\S*)/; - const onEmptyBranchReg = /\son\s([\S]+)$/; - let regexResult; - regexResult = aheadReg.exec(line); - result.ahead = regexResult && +regexResult[1] || 0; - regexResult = behindReg.exec(line); - result.behind = regexResult && +regexResult[1] || 0; - regexResult = currentReg.exec(line); - result.current = regexResult && regexResult[1]; - regexResult = trackingReg.exec(line); - result.tracking = regexResult && regexResult[1]; - regexResult = onEmptyBranchReg.exec(line); - result.current = regexResult && regexResult[1] || result.current; - result.detached = /\(no branch\)/.test(line); - } - ] - ]); - parseStatusSummary = function(text2) { - const lines = text2.split(NULL); - const status2 = new StatusSummary(); - for (let i = 0, l = lines.length; i < l; ) { - let line = lines[i++].trim(); - if (!line) { - continue; - } - if (line.charAt(0) === "R") { - line += NULL + (lines[i++] || ""); - } - splitLine(status2, line); - } - return status2; - }; - } -}); -function statusTask(customArgs) { - const commands2 = [ - "status", - "--porcelain", - "-b", - "-u", - "--null", - ...customArgs.filter((arg) => !ignoredOptions.includes(arg)) - ]; - return { - format: "utf-8", - commands: commands2, - parser(text2) { - return parseStatusSummary(text2); - } - }; -} -var ignoredOptions; -var init_status = __esm2({ - "src/lib/tasks/status.ts"() { - init_StatusSummary(); - ignoredOptions = ["--null", "-z"]; - } -}); -function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) { - return Object.defineProperty({ - major, - minor, - patch, - agent, - installed - }, "toString", { - value() { - return `${this.major}.${this.minor}.${this.patch}`; - }, - configurable: false, - enumerable: false - }); -} -function notInstalledResponse() { - return versionResponse(0, 0, 0, "", false); -} -function version_default() { - return { - version() { - return this._runTask({ - commands: ["--version"], - format: "utf-8", - parser: versionParser, - onError(result, error, done, fail) { - if (result.exitCode === -2) { - return done(Buffer.from(NOT_INSTALLED)); - } - fail(error); - } - }); - } - }; -} -function versionParser(stdOut) { - if (stdOut === NOT_INSTALLED) { - return notInstalledResponse(); - } - return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut); -} -var NOT_INSTALLED; -var parsers7; -var init_version = __esm2({ - "src/lib/tasks/version.ts"() { - init_utils(); - NOT_INSTALLED = "installed=false"; - parsers7 = [ - new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)); - }), - new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => { - Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent)); - }) - ]; - } -}); -var simple_git_api_exports = {}; -__export2(simple_git_api_exports, { - SimpleGitApi: () => SimpleGitApi -}); -var SimpleGitApi; -var init_simple_git_api = __esm2({ - "src/lib/simple-git-api.ts"() { - init_task_callback(); - init_change_working_directory(); - init_checkout(); - init_commit(); - init_config(); - init_grep(); - init_hash_object(); - init_init(); - init_log(); - init_merge(); - init_push(); - init_status(); - init_task(); - init_version(); - init_utils(); - SimpleGitApi = class { - constructor(_executor) { - this._executor = _executor; - } - _runTask(task, then) { - const chain = this._executor.chain(); - const promise2 = chain.push(task); - if (then) { - taskCallback(task, promise2, then); - } - return Object.create(this, { - then: { value: promise2.then.bind(promise2) }, - catch: { value: promise2.catch.bind(promise2) }, - _executor: { value: chain } - }); - } - add(files) { - return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments)); - } - cwd(directory) { - const next = trailingFunctionArgument(arguments); - if (typeof directory === "string") { - return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next); - } - if (typeof (directory == null ? void 0 : directory.path) === "string") { - return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next); - } - return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next); - } - hashObject(path2, write) { - return this._runTask(hashObjectTask(path2, write === true), trailingFunctionArgument(arguments)); - } - init(bare) { - return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); - } - merge() { - return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); - } - mergeFromTo(remote, branch2) { - if (!(filterString(remote) && filterString(branch2))) { - return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`)); - } - return this._runTask(mergeTask([remote, branch2, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false)); - } - outputHandler(handler) { - this._executor.outputHandler = handler; - return this; - } - push() { - const task = pushTask({ - remote: filterType(arguments[0], filterString), - branch: filterType(arguments[1], filterString) - }, getTrailingOptions(arguments)); - return this._runTask(task, trailingFunctionArgument(arguments)); - } - stash() { - return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); - } - status() { - return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); - } - }; - Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), grep_default(), log_default(), version_default()); - } -}); -var scheduler_exports = {}; -__export2(scheduler_exports, { - Scheduler: () => Scheduler -}); -var createScheduledTask; -var Scheduler; -var init_scheduler = __esm2({ - "src/lib/runners/scheduler.ts"() { - init_utils(); - init_git_logger(); - createScheduledTask = /* @__PURE__ */ (() => { - let id = 0; - return () => { - id++; - const { promise: promise2, done } = (0, import_promise_deferred.createDeferred)(); - return { - promise: promise2, - done, - id - }; - }; - })(); - Scheduler = class { - constructor(concurrency = 2) { - this.concurrency = concurrency; - this.logger = createLogger("", "scheduler"); - this.pending = []; - this.running = []; - this.logger(`Constructed, concurrency=%s`, concurrency); - } - 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; - } - const task = append(this.running, this.pending.shift()); - this.logger(`Attempting id=%s`, task.id); - task.done(() => { - this.logger(`Completing id=`, task.id); - remove2(this.running, task); - this.schedule(); - }); - } - next() { - const { promise: promise2, id } = append(this.pending, createScheduledTask()); - this.logger(`Scheduling id=%s`, id); - this.schedule(); - return promise2; - } - }; - } -}); -var apply_patch_exports = {}; -__export2(apply_patch_exports, { - applyPatchTask: () => applyPatchTask -}); -function applyPatchTask(patches, customArgs) { - return straightThroughStringTask(["apply", ...customArgs, ...patches]); -} -var init_apply_patch = __esm2({ - "src/lib/tasks/apply-patch.ts"() { - init_task(); - } -}); -function branchDeletionSuccess(branch2, hash2) { - return { - branch: branch2, - hash: hash2, - success: true - }; -} -function branchDeletionFailure(branch2) { - return { - branch: branch2, - hash: null, - success: false - }; -} -var BranchDeletionBatch; -var init_BranchDeleteSummary = __esm2({ - "src/lib/responses/BranchDeleteSummary.ts"() { - BranchDeletionBatch = class { - constructor() { - this.all = []; - this.branches = {}; - this.errors = []; - } - get success() { - return !this.errors.length; - } - }; - } -}); -function hasBranchDeletionError(data, processExitCode) { - return processExitCode === 1 && deleteErrorRegex.test(data); -} -var deleteSuccessRegex; -var deleteErrorRegex; -var parsers8; -var parseBranchDeletions; -var init_parse_branch_delete = __esm2({ - "src/lib/parsers/parse-branch-delete.ts"() { - init_BranchDeleteSummary(); - init_utils(); - deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/; - deleteErrorRegex = /^error[^']+'([^']+)'/m; - parsers8 = [ - new LineParser(deleteSuccessRegex, (result, [branch2, hash2]) => { - const deletion = branchDeletionSuccess(branch2, hash2); - result.all.push(deletion); - result.branches[branch2] = deletion; - }), - new LineParser(deleteErrorRegex, (result, [branch2]) => { - const deletion = branchDeletionFailure(branch2); - result.errors.push(deletion); - result.all.push(deletion); - result.branches[branch2] = deletion; - }) - ]; - parseBranchDeletions = (stdOut, stdErr) => { - return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]); - }; - } -}); -var BranchSummaryResult; -var init_BranchSummary = __esm2({ - "src/lib/responses/BranchSummary.ts"() { - BranchSummaryResult = class { - constructor() { - this.all = []; - this.branches = {}; - this.current = ""; - this.detached = false; - } - push(status2, detached, name, commit2, label) { - if (status2 === "*") { - this.detached = detached; - this.current = name; - } - this.all.push(name); - this.branches[name] = { - current: status2 === "*", - linkedWorkTree: status2 === "+", - name, - commit: commit2, - label - }; - } - }; - } -}); -function branchStatus(input) { - return input ? input.charAt(0) : ""; -} -function parseBranchSummary(stdOut) { - return parseStringResponse(new BranchSummaryResult(), parsers9, stdOut); -} -var parsers9; -var init_parse_branch = __esm2({ - "src/lib/parsers/parse-branch.ts"() { - init_BranchSummary(); - init_utils(); - parsers9 = [ - new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit2, label]) => { - result.push(branchStatus(current), true, name, commit2, label); - }), - new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit2, label]) => { - result.push(branchStatus(current), false, name, commit2, label); - }) - ]; - } -}); -var branch_exports = {}; -__export2(branch_exports, { - branchLocalTask: () => branchLocalTask, - branchTask: () => branchTask, - containsDeleteBranchCommand: () => containsDeleteBranchCommand, - deleteBranchTask: () => deleteBranchTask, - deleteBranchesTask: () => deleteBranchesTask -}); -function containsDeleteBranchCommand(commands2) { - const deleteCommands = ["-d", "-D", "--delete"]; - return commands2.some((command) => deleteCommands.includes(command)); -} -function branchTask(customArgs) { - const isDelete = containsDeleteBranchCommand(customArgs); - const commands2 = ["branch", ...customArgs]; - if (commands2.length === 1) { - commands2.push("-a"); - } - if (!commands2.includes("-v")) { - commands2.splice(1, 0, "-v"); - } - return { - format: "utf-8", - commands: commands2, - parser(stdOut, stdErr) { - if (isDelete) { - return parseBranchDeletions(stdOut, stdErr).all[0]; - } - return parseBranchSummary(stdOut); - } - }; -} -function branchLocalTask() { - const parser3 = parseBranchSummary; - return { - format: "utf-8", - commands: ["branch", "-v"], - parser: parser3 - }; -} -function deleteBranchesTask(branches, forceDelete = false) { - return { - format: "utf-8", - commands: ["branch", "-v", forceDelete ? "-D" : "-d", ...branches], - parser(stdOut, stdErr) { - return parseBranchDeletions(stdOut, stdErr); - }, - onError({ exitCode, stdOut }, error, done, fail) { - if (!hasBranchDeletionError(String(error), exitCode)) { - return fail(error); - } - done(stdOut); - } - }; -} -function deleteBranchTask(branch2, forceDelete = false) { - const task = { - format: "utf-8", - commands: ["branch", "-v", forceDelete ? "-D" : "-d", branch2], - parser(stdOut, stdErr) { - return parseBranchDeletions(stdOut, stdErr).branches[branch2]; - }, - onError({ exitCode, stdErr, stdOut }, error, _, fail) { - if (!hasBranchDeletionError(String(error), exitCode)) { - return fail(error); - } - throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error)); - } - }; - return task; -} -var init_branch = __esm2({ - "src/lib/tasks/branch.ts"() { - init_git_response_error(); - init_parse_branch_delete(); - init_parse_branch(); - init_utils(); - } -}); -var parseCheckIgnore; -var init_CheckIgnore = __esm2({ - "src/lib/responses/CheckIgnore.ts"() { - parseCheckIgnore = (text2) => { - return text2.split(/\n/g).map((line) => line.trim()).filter((file) => !!file); - }; - } -}); -var check_ignore_exports = {}; -__export2(check_ignore_exports, { - checkIgnoreTask: () => checkIgnoreTask -}); -function checkIgnoreTask(paths) { - return { - commands: ["check-ignore", ...paths], - format: "utf-8", - parser: parseCheckIgnore - }; -} -var init_check_ignore = __esm2({ - "src/lib/tasks/check-ignore.ts"() { - init_CheckIgnore(); - } -}); -var clone_exports = {}; -__export2(clone_exports, { - cloneMirrorTask: () => cloneMirrorTask, - cloneTask: () => cloneTask -}); -function disallowedCommand(command) { - return /^--upload-pack(=|$)/.test(command); -} -function cloneTask(repo, directory, customArgs) { - const commands2 = ["clone", ...customArgs]; - filterString(repo) && commands2.push(repo); - filterString(directory) && commands2.push(directory); - const banned = commands2.find(disallowedCommand); - if (banned) { - return configurationErrorTask(`git.fetch: potential exploit argument blocked.`); - } - return straightThroughStringTask(commands2); -} -function cloneMirrorTask(repo, directory, customArgs) { - append(customArgs, "--mirror"); - return cloneTask(repo, directory, customArgs); -} -var init_clone = __esm2({ - "src/lib/tasks/clone.ts"() { - init_task(); - init_utils(); - } -}); -function parseFetchResult(stdOut, stdErr) { - const result = { - raw: stdOut, - remote: null, - branches: [], - tags: [], - updated: [], - deleted: [] - }; - return parseStringResponse(result, parsers10, [stdOut, stdErr]); -} -var parsers10; -var init_parse_fetch = __esm2({ - "src/lib/parsers/parse-fetch.ts"() { - init_utils(); - parsers10 = [ - new LineParser(/From (.+)$/, (result, [remote]) => { - result.remote = remote; - }), - new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => { - result.branches.push({ - name, - tracking - }); - }), - new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => { - result.tags.push({ - name, - tracking - }); - }), - new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result, [tracking]) => { - result.deleted.push({ - tracking - }); - }), - new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => { - result.updated.push({ - name, - tracking, - to, - from - }); - }) - ]; - } -}); -var fetch_exports = {}; -__export2(fetch_exports, { - fetchTask: () => fetchTask -}); -function disallowedCommand2(command) { - return /^--upload-pack(=|$)/.test(command); -} -function fetchTask(remote, branch2, customArgs) { - const commands2 = ["fetch", ...customArgs]; - if (remote && branch2) { - commands2.push(remote, branch2); - } - const banned = commands2.find(disallowedCommand2); - if (banned) { - return configurationErrorTask(`git.fetch: potential exploit argument blocked.`); - } - return { - commands: commands2, - format: "utf-8", - parser: parseFetchResult - }; -} -var init_fetch = __esm2({ - "src/lib/tasks/fetch.ts"() { - init_parse_fetch(); - init_task(); - } -}); -function parseMoveResult(stdOut) { - return parseStringResponse({ moves: [] }, parsers11, stdOut); -} -var parsers11; -var init_parse_move = __esm2({ - "src/lib/parsers/parse-move.ts"() { - init_utils(); - parsers11 = [ - new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => { - result.moves.push({ from, to }); - }) - ]; - } -}); -var move_exports = {}; -__export2(move_exports, { - moveTask: () => moveTask -}); -function moveTask(from, to) { - return { - commands: ["mv", "-v", ...asArray(from), to], - format: "utf-8", - parser: parseMoveResult - }; -} -var init_move = __esm2({ - "src/lib/tasks/move.ts"() { - init_parse_move(); - init_utils(); - } -}); -var pull_exports = {}; -__export2(pull_exports, { - pullTask: () => pullTask -}); -function pullTask(remote, branch2, customArgs) { - const commands2 = ["pull", ...customArgs]; - if (remote && branch2) { - commands2.splice(1, 0, remote, branch2); - } - return { - commands: commands2, - format: "utf-8", - parser(stdOut, stdErr) { - return parsePullResult(stdOut, stdErr); - }, - onError(result, _error, _done, fail) { - const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr)); - if (pullError) { - return fail(new GitResponseError(pullError)); - } - fail(_error); - } - }; -} -var init_pull = __esm2({ - "src/lib/tasks/pull.ts"() { - init_git_response_error(); - init_parse_pull(); - init_utils(); - } -}); -function parseGetRemotes(text2) { - const remotes = {}; - forEach(text2, ([name]) => remotes[name] = { name }); - return Object.values(remotes); -} -function parseGetRemotesVerbose(text2) { - const remotes = {}; - forEach(text2, ([name, url, purpose]) => { - if (!remotes.hasOwnProperty(name)) { - remotes[name] = { - name, - refs: { fetch: "", push: "" } - }; - } - if (purpose && url) { - remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url; - } - }); - return Object.values(remotes); -} -function forEach(text2, handler) { - forEachLineWithContent(text2, (line) => handler(line.split(/\s+/))); -} -var init_GetRemoteSummary = __esm2({ - "src/lib/responses/GetRemoteSummary.ts"() { - init_utils(); - } -}); -var remote_exports = {}; -__export2(remote_exports, { - addRemoteTask: () => addRemoteTask, - getRemotesTask: () => getRemotesTask, - listRemotesTask: () => listRemotesTask, - remoteTask: () => remoteTask, - removeRemoteTask: () => removeRemoteTask -}); -function addRemoteTask(remoteName, remoteRepo, customArgs = []) { - return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]); -} -function getRemotesTask(verbose) { - const commands2 = ["remote"]; - if (verbose) { - commands2.push("-v"); - } - return { - commands: commands2, - format: "utf-8", - parser: verbose ? parseGetRemotesVerbose : parseGetRemotes - }; -} -function listRemotesTask(customArgs = []) { - const commands2 = [...customArgs]; - if (commands2[0] !== "ls-remote") { - commands2.unshift("ls-remote"); - } - return straightThroughStringTask(commands2); -} -function remoteTask(customArgs = []) { - const commands2 = [...customArgs]; - if (commands2[0] !== "remote") { - commands2.unshift("remote"); - } - return straightThroughStringTask(commands2); -} -function removeRemoteTask(remoteName) { - return straightThroughStringTask(["remote", "remove", remoteName]); -} -var init_remote = __esm2({ - "src/lib/tasks/remote.ts"() { - init_GetRemoteSummary(); - init_task(); - } -}); -var stash_list_exports = {}; -__export2(stash_list_exports, { - stashListTask: () => stashListTask -}); -function stashListTask(opt = {}, customArgs) { - const options = parseLogOptions(opt); - const commands2 = ["stash", "list", ...options.commands, ...customArgs]; - const parser3 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands2)); - return validateLogFormatConfig(commands2) || { - commands: commands2, - format: "utf-8", - parser: parser3 - }; -} -var init_stash_list = __esm2({ - "src/lib/tasks/stash-list.ts"() { - init_log_format(); - init_parse_list_log_summary(); - init_diff(); - init_log(); - } -}); -var sub_module_exports = {}; -__export2(sub_module_exports, { - addSubModuleTask: () => addSubModuleTask, - initSubModuleTask: () => initSubModuleTask, - subModuleTask: () => subModuleTask, - updateSubModuleTask: () => updateSubModuleTask -}); -function addSubModuleTask(repo, path2) { - return subModuleTask(["add", repo, path2]); -} -function initSubModuleTask(customArgs) { - return subModuleTask(["init", ...customArgs]); -} -function subModuleTask(customArgs) { - const commands2 = [...customArgs]; - if (commands2[0] !== "submodule") { - commands2.unshift("submodule"); - } - return straightThroughStringTask(commands2); -} -function updateSubModuleTask(customArgs) { - return subModuleTask(["update", ...customArgs]); -} -var init_sub_module = __esm2({ - "src/lib/tasks/sub-module.ts"() { - init_task(); - } -}); -function singleSorted(a, b) { - const aIsNum = isNaN(a); - const bIsNum = isNaN(b); - if (aIsNum !== bIsNum) { - return aIsNum ? 1 : -1; - } - return aIsNum ? sorted(a, b) : 0; -} -function sorted(a, b) { - return a === b ? 0 : a > b ? 1 : -1; -} -function trimmed(input) { - return input.trim(); -} -function toNumber(input) { - if (typeof input === "string") { - return parseInt(input.replace(/^\D+/g, ""), 10) || 0; - } - return 0; -} -var TagList; -var parseTagList; -var init_TagList = __esm2({ - "src/lib/responses/TagList.ts"() { - TagList = class { - constructor(all, latest) { - this.all = all; - this.latest = latest; - } - }; - parseTagList = function(data, customSort = false) { - const tags = data.split("\n").map(trimmed).filter(Boolean); - if (!customSort) { - tags.sort(function(tagA, tagB) { - const partsA = tagA.split("."); - const partsB = tagB.split("."); - if (partsA.length === 1 || partsB.length === 1) { - return singleSorted(toNumber(partsA[0]), toNumber(partsB[0])); - } - for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) { - const diff3 = sorted(toNumber(partsA[i]), toNumber(partsB[i])); - if (diff3) { - return diff3; - } - } - return 0; - }); - } - const latest = customSort ? tags[0] : [...tags].reverse().find((tag2) => tag2.indexOf(".") >= 0); - return new TagList(tags, latest); - }; - } -}); -var tag_exports = {}; -__export2(tag_exports, { - addAnnotatedTagTask: () => addAnnotatedTagTask, - addTagTask: () => addTagTask, - tagListTask: () => tagListTask -}); -function tagListTask(customArgs = []) { - const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option)); - return { - format: "utf-8", - commands: ["tag", "-l", ...customArgs], - parser(text2) { - return parseTagList(text2, hasCustomSort); - } - }; -} -function addTagTask(name) { - return { - format: "utf-8", - commands: ["tag", name], - parser() { - return { name }; - } - }; -} -function addAnnotatedTagTask(name, tagMessage) { - return { - format: "utf-8", - commands: ["tag", "-a", "-m", tagMessage, name], - parser() { - return { name }; - } - }; -} -var init_tag = __esm2({ - "src/lib/tasks/tag.ts"() { - init_TagList(); - } -}); -var require_git = __commonJS2({ - "src/git.js"(exports2, module2) { - var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS2(git_executor_exports)); - var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS2(simple_git_api_exports)); - var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS2(scheduler_exports)); - var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS2(task_exports)); - var { - asArray: asArray2, - filterArray: filterArray2, - filterPrimitives: filterPrimitives2, - filterString: filterString2, - filterStringOrStringArray: filterStringOrStringArray2, - filterType: filterType2, - getTrailingOptions: getTrailingOptions2, - trailingFunctionArgument: trailingFunctionArgument2, - trailingOptionsArgument: trailingOptionsArgument2 - } = (init_utils(), __toCommonJS2(utils_exports)); - var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS2(apply_patch_exports)); - var { - branchTask: branchTask2, - branchLocalTask: branchLocalTask2, - deleteBranchesTask: deleteBranchesTask2, - deleteBranchTask: deleteBranchTask2 - } = (init_branch(), __toCommonJS2(branch_exports)); - var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS2(check_ignore_exports)); - var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS2(check_is_repo_exports)); - var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS2(clone_exports)); - var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS2(clean_exports)); - var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS2(diff_exports)); - var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS2(fetch_exports)); - var { moveTask: moveTask2 } = (init_move(), __toCommonJS2(move_exports)); - var { pullTask: pullTask2 } = (init_pull(), __toCommonJS2(pull_exports)); - var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS2(push_exports)); - var { - addRemoteTask: addRemoteTask2, - getRemotesTask: getRemotesTask2, - listRemotesTask: listRemotesTask2, - remoteTask: remoteTask2, - removeRemoteTask: removeRemoteTask2 - } = (init_remote(), __toCommonJS2(remote_exports)); - var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS2(reset_exports)); - var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS2(stash_list_exports)); - var { - addSubModuleTask: addSubModuleTask2, - initSubModuleTask: initSubModuleTask2, - subModuleTask: subModuleTask2, - updateSubModuleTask: updateSubModuleTask2 - } = (init_sub_module(), __toCommonJS2(sub_module_exports)); - var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS2(tag_exports)); - var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS2(task_exports)); - function Git2(options, plugins) { - this._executor = new GitExecutor2(options.binary, options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins); - this._trimmed = options.trimmed; - } - (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2; - Git2.prototype.customBinary = function(command) { - this._executor.binary = command; - return this; - }; - Git2.prototype.env = function(name, value) { - if (arguments.length === 1 && typeof name === "object") { - this._executor.env = name; - } else { - (this._executor.env = this._executor.env || {})[name] = value; - } - return this; - }; - Git2.prototype.stashList = function(options) { - return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments)); - }; - function createCloneTask(api, task, repoPath, localPath) { - if (typeof repoPath !== "string") { - return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`); - } - return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments)); - } - Git2.prototype.clone = function() { - return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.mirror = function() { - return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.mv = function(from, to) { - return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.checkoutLatestTag = function(then) { - var git = this; - return this.pull(function() { - git.tags(function(err, tags) { - git.checkout(tags.latest, then); - }); - }); - }; - Git2.prototype.pull = function(remote, branch2, options, then) { - return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch2, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.fetch = function(remote, branch2) { - return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch2, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.silent = function(silence) { - console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"); - return this; - }; - Git2.prototype.tags = function(options, then) { - return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.rebase = function() { - return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.reset = function(mode) { - return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.revert = function(commit2) { - const next = trailingFunctionArgument2(arguments); - if (typeof commit2 !== "string") { - return this._runTask(configurationErrorTask2("Commit must be a string"), next); - } - return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit2]), next); - }; - Git2.prototype.addTag = function(name) { - const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name"); - return this._runTask(task, trailingFunctionArgument2(arguments)); - }; - Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) { - return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) { - return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) { - return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.branch = function(options, then) { - return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.branchLocal = function(then) { - return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.raw = function(commands2) { - const createRestCommands = !Array.isArray(commands2); - const command = [].slice.call(createRestCommands ? arguments : commands2, 0); - for (let i = 0; i < command.length && createRestCommands; i++) { - if (!filterPrimitives2(command[i])) { - command.splice(i, command.length - i); - break; - } - } - command.push(...getTrailingOptions2(arguments, 0, true)); - var next = trailingFunctionArgument2(arguments); - if (!command.length) { - return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next); - } - return this._runTask(straightThroughStringTask2(command, this._trimmed), next); - }; - Git2.prototype.submoduleAdd = function(repo, path2, then) { - return this._runTask(addSubModuleTask2(repo, path2), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.submoduleUpdate = function(args, then) { - return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.submoduleInit = function(args, then) { - return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.subModule = function(options, then) { - return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.listRemote = function() { - return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.addRemote = function(remoteName, remoteRepo, then) { - return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.removeRemote = function(remoteName, then) { - return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.getRemotes = function(verbose, then) { - return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.remote = function(options, then) { - return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.tag = function(options, then) { - const command = getTrailingOptions2(arguments); - if (command[0] !== "tag") { - command.unshift("tag"); - } - return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.updateServerInfo = function(then) { - return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.pushTags = function(remote, then) { - const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments)); - return this._runTask(task, trailingFunctionArgument2(arguments)); - }; - Git2.prototype.rm = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.rmKeepLocal = function(files) { - return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.catFile = function(options, then) { - return this._catFile("utf-8", arguments); - }; - Git2.prototype.binaryCatFile = function() { - return this._catFile("buffer", arguments); - }; - Git2.prototype._catFile = function(format, args) { - var handler = trailingFunctionArgument2(args); - var command = ["cat-file"]; - var options = args[0]; - if (typeof options === "string") { - return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler); - } - if (Array.isArray(options)) { - command.push.apply(command, options); - } - const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command); - return this._runTask(task, handler); - }; - Git2.prototype.diff = function(options, then) { - const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); - return this._runTask(task, trailingFunctionArgument2(arguments)); - }; - Git2.prototype.diffSummary = function() { - return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.applyPatch = function(patches) { - const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); - return this._runTask(task, trailingFunctionArgument2(arguments)); - }; - Git2.prototype.revparse = function() { - const commands2 = ["rev-parse", ...getTrailingOptions2(arguments, true)]; - return this._runTask(straightThroughStringTask2(commands2, true), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.show = function(options, then) { - return this._runTask(straightThroughStringTask2(["show", ...getTrailingOptions2(arguments, 1)]), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.clean = function(mode, options, then) { - const usingCleanOptionsArray = isCleanOptionsArray2(mode); - const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || ""; - const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0)); - return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.exec = function(then) { - const task = { - commands: [], - format: "utf-8", - parser() { - if (typeof then === "function") { - then(); - } - } - }; - return this._runTask(task); - }; - Git2.prototype.clearQueue = function() { - return this; - }; - Git2.prototype.checkIgnore = function(pathnames, then) { - return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments)); - }; - Git2.prototype.checkIsRepo = function(checkType, then) { - return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments)); - }; - module2.exports = Git2; - } -}); -init_git_error(); -var GitConstructError = class extends GitError { - constructor(config, message) { - super(void 0, message); - this.config = config; - } -}; -init_git_error(); -init_git_error(); -var GitPluginError = class extends GitError { - constructor(task, plugin, message) { - super(task, message); - this.task = task; - this.plugin = plugin; - Object.setPrototypeOf(this, new.target.prototype); - } -}; -init_git_response_error(); -init_task_configuration_error(); -init_check_is_repo(); -init_clean(); -init_config(); -init_grep(); -init_reset(); -function abortPlugin(signal) { - if (!signal) { - return; - } - const onSpawnAfter = { - type: "spawn.after", - action(_data, context) { - function kill() { - context.kill(new GitPluginError(void 0, "abort", "Abort signal received")); - } - signal.addEventListener("abort", kill); - context.spawned.on("close", () => signal.removeEventListener("abort", kill)); - } - }; - const onSpawnBefore = { - type: "spawn.before", - action(_data, context) { - if (signal.aborted) { - context.kill(new GitPluginError(void 0, "abort", "Abort already signaled")); - } - } - }; - return [onSpawnBefore, onSpawnAfter]; -} -function isConfigSwitch(arg) { - return typeof arg === "string" && arg.trim().toLowerCase() === "-c"; -} -function preventProtocolOverride(arg, next) { - if (!isConfigSwitch(arg)) { - return; - } - if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) { - return; - } - throw new GitPluginError(void 0, "unsafe", "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol"); -} -function preventUploadPack(arg, method2) { - if (/^\s*--(upload|receive)-pack/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`); - } - if (method2 === "clone" && /^\s*-u\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of clone with option -u is not permitted without enabling allowUnsafePack`); - } - if (method2 === "push" && /^\s*--exec\b/.test(arg)) { - throw new GitPluginError(void 0, "unsafe", `Use of push with option --exec is not permitted without enabling allowUnsafePack`); - } -} -function blockUnsafeOperationsPlugin({ - allowUnsafeProtocolOverride = false, - allowUnsafePack = false -} = {}) { - return { - type: "spawn.args", - action(args, context) { - args.forEach((current, index2) => { - const next = index2 < args.length ? args[index2 + 1] : ""; - allowUnsafeProtocolOverride || preventProtocolOverride(current, next); - allowUnsafePack || preventUploadPack(current, context.method); - }); - return args; - } - }; -} -init_utils(); -function commandConfigPrefixingPlugin(configuration) { - const prefix = prefixedArray(configuration, "-c"); - return { - type: "spawn.args", - action(data) { - return [...prefix, ...data]; - } - }; -} -init_utils(); -var never = (0, import_promise_deferred2.deferred)().promise; -function completionDetectionPlugin({ - onClose = true, - onExit = 50 -} = {}) { - function createEvents() { - let exitCode = -1; - const events = { - close: (0, import_promise_deferred2.deferred)(), - closeTimeout: (0, import_promise_deferred2.deferred)(), - exit: (0, import_promise_deferred2.deferred)(), - exitTimeout: (0, import_promise_deferred2.deferred)() - }; - const result = Promise.race([ - onClose === false ? never : events.closeTimeout.promise, - onExit === false ? never : events.exitTimeout.promise - ]); - configureTimeout(onClose, events.close, events.closeTimeout); - configureTimeout(onExit, events.exit, events.exitTimeout); - return { - close(code) { - exitCode = code; - events.close.done(); - }, - exit(code) { - exitCode = code; - events.exit.done(); - }, - get exitCode() { - return exitCode; - }, - result - }; - } - function configureTimeout(flag, event, timeout) { - if (flag === false) { - return; - } - (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done); - } - return { - type: "spawn.after", - action(_0, _1) { - return __async(this, arguments, function* (_data, { spawned, close }) { - var _a2, _b; - const events = createEvents(); - let deferClose = true; - let quickClose = () => void (deferClose = false); - (_a2 = spawned.stdout) == null ? void 0 : _a2.on("data", quickClose); - (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose); - spawned.on("error", quickClose); - spawned.on("close", (code) => events.close(code)); - spawned.on("exit", (code) => events.exit(code)); - try { - yield events.result; - if (deferClose) { - yield delay(50); - } - close(events.exitCode); - } catch (err) { - close(events.exitCode, err); - } - }); - } - }; -} -init_git_error(); -function isTaskError(result) { - return !!(result.exitCode && result.stdErr.length); -} -function getErrorMessage(result) { - return Buffer.concat([...result.stdOut, ...result.stdErr]); -} -function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) { - return (error, result) => { - if (!overwrite && error || !isError(result)) { - return error; - } - return errorMessage(result); - }; -} -function errorDetectionPlugin(config) { - return { - type: "task.error", - action(data, context) { - const error = config(data.error, { - stdErr: context.stdErr, - stdOut: context.stdOut, - exitCode: context.exitCode - }); - if (Buffer.isBuffer(error)) { - return { error: new GitError(void 0, error.toString("utf-8")) }; - } - return { - error - }; - } - }; -} -init_utils(); -var PluginStore = class { - constructor() { - this.plugins = /* @__PURE__ */ new Set(); - } - add(plugin) { - const plugins = []; - asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2))); - return () => { - plugins.forEach((plugin2) => this.plugins.delete(plugin2)); - }; - } - exec(type, data, context) { - let output = data; - const contextual = Object.freeze(Object.create(context)); - for (const plugin of this.plugins) { - if (plugin.type === type) { - output = plugin.action(output, contextual); - } - } - return output; - } -}; -init_utils(); -function progressMonitorPlugin(progress) { - const progressCommand = "--progress"; - const progressMethods = ["checkout", "clone", "fetch", "pull", "push"]; - const onProgress = { - type: "spawn.after", - action(_data, context) { - var _a2; - if (!context.commands.includes(progressCommand)) { - return; - } - (_a2 = context.spawned.stderr) == null ? void 0 : _a2.on("data", (chunk) => { - const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8")); - if (!message) { - return; - } - progress({ - method: context.method, - stage: progressEventStage(message[1]), - progress: asNumber(message[2]), - processed: asNumber(message[3]), - total: asNumber(message[4]) - }); - }); - } - }; - const onArgs = { - type: "spawn.args", - action(args, context) { - if (!progressMethods.includes(context.method)) { - return args; - } - return including(args, progressCommand); - } - }; - return [onArgs, onProgress]; -} -function progressEventStage(input) { - return String(input.toLowerCase().split(" ", 1)) || "unknown"; -} -init_utils(); -function spawnOptionsPlugin(spawnOptions) { - const options = pick(spawnOptions, ["uid", "gid"]); - return { - type: "spawn.options", - action(data) { - return __spreadValues(__spreadValues({}, options), data); - } - }; -} -function timeoutPlugin({ - block, - stdErr = true, - stdOut = true -}) { - if (block > 0) { - return { - type: "spawn.after", - action(_data, context) { - var _a2, _b; - let timeout; - function wait3() { - timeout && clearTimeout(timeout); - timeout = setTimeout(kill, block); - } - function stop() { - var _a3, _b2; - (_a3 = context.spawned.stdout) == null ? void 0 : _a3.off("data", wait3); - (_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait3); - context.spawned.off("exit", stop); - context.spawned.off("close", stop); - timeout && clearTimeout(timeout); - } - function kill() { - stop(); - context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`)); - } - stdOut && ((_a2 = context.spawned.stdout) == null ? void 0 : _a2.on("data", wait3)); - stdErr && ((_b = context.spawned.stderr) == null ? void 0 : _b.on("data", wait3)); - context.spawned.on("exit", stop); - context.spawned.on("close", stop); - wait3(); - } - }; - } -} -init_utils(); -var Git = require_git(); -function gitInstanceFactory(baseDir, options) { - const plugins = new PluginStore(); - const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options); - if (!folderExists(config.baseDir)) { - throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`); - } - if (Array.isArray(config.config)) { - plugins.add(commandConfigPrefixingPlugin(config.config)); - } - plugins.add(blockUnsafeOperationsPlugin(config.unsafe)); - plugins.add(completionDetectionPlugin(config.completion)); - config.abort && plugins.add(abortPlugin(config.abort)); - config.progress && plugins.add(progressMonitorPlugin(config.progress)); - config.timeout && plugins.add(timeoutPlugin(config.timeout)); - config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions)); - plugins.add(errorDetectionPlugin(errorDetectionHandler(true))); - config.errors && plugins.add(errorDetectionPlugin(config.errors)); - return new Git(config, plugins); -} -init_git_response_error(); -var esm_default = gitInstanceFactory; - -// src/constants.ts -init_polyfill_buffer(); -var import_obsidian2 = require("obsidian"); -var DATE_FORMAT = "YYYY-MM-DD"; -var DATE_TIME_FORMAT_MINUTES = `${DATE_FORMAT} HH:mm`; -var DATE_TIME_FORMAT_SECONDS = `${DATE_FORMAT} HH:mm:ss`; -var GIT_LINE_AUTHORING_MOVEMENT_DETECTION_MINIMAL_LENGTH = 40; -var DEFAULT_SETTINGS = { - commitMessage: "vault backup: {{date}}", - commitDateFormat: DATE_TIME_FORMAT_SECONDS, - autoSaveInterval: 0, - autoPushInterval: 0, - autoPullInterval: 0, - autoPullOnBoot: false, - disablePush: false, - pullBeforePush: true, - disablePopups: false, - disablePopupsForNoChanges: false, - listChangedFilesInMessageBody: false, - showStatusBar: true, - updateSubmodules: false, - syncMethod: "merge", - customMessageOnAutoBackup: false, - autoBackupAfterFileChange: false, - treeStructure: false, - refreshSourceControl: import_obsidian2.Platform.isDesktopApp, - basePath: "", - differentIntervalCommitAndPush: false, - changedFilesInStatusBar: false, - showedMobileNotice: false, - refreshSourceControlTimer: 7e3, - showBranchStatusBar: true, - setLastSaveToLastCommit: false, - submoduleRecurseCheckout: false, - gitDir: "", - showFileMenu: true, - authorInHistoryView: "hide", - dateInHistoryView: false, - lineAuthor: { - show: false, - followMovement: "inactive", - authorDisplay: "initials", - showCommitHash: false, - dateTimeFormatOptions: "date", - dateTimeFormatCustomString: DATE_TIME_FORMAT_MINUTES, - dateTimeTimezone: "viewer-local", - coloringMaxAge: "1y", - // colors were picked via: - // https://color.adobe.com/de/create/color-accessibility - colorNew: { r: 255, g: 150, b: 150 }, - colorOld: { r: 120, g: 160, b: 255 }, - textColorCss: "var(--text-muted)", - // more pronounced than line numbers, but less than the content text - ignoreWhitespace: false, - gutterSpacingFallbackLength: 5 - } -}; -var SOURCE_CONTROL_VIEW_CONFIG = { - type: "git-view", - name: "Source Control", - icon: "git-pull-request" -}; -var HISTORY_VIEW_CONFIG = { - type: "git-history-view", - name: "History", - icon: "history" -}; -var DIFF_VIEW_CONFIG = { - type: "diff-view", - name: "Diff View", - icon: "git-pull-request" -}; - -// src/types.ts -init_polyfill_buffer(); -function mergeSettingsByPriority(low, high) { - const lineAuthor = Object.assign({}, low.lineAuthor, high.lineAuthor); - return Object.assign({}, low, high, { lineAuthor }); -} - -// src/utils.ts -init_polyfill_buffer(); -var cssColorConverter = __toESM(require_lib3()); -var import_deep_equal = __toESM(require_deep_equal()); -var import_obsidian3 = require("obsidian"); -var worthWalking2 = (filepath, root2) => { - if (filepath === "." || root2 == null || root2.length === 0 || root2 === ".") { - return true; - } - if (root2.length >= filepath.length) { - return root2.startsWith(filepath); - } else { - return filepath.startsWith(root2); - } -}; -function getNewLeaf(event) { - let leaf; - if (event) { - if (event.button === 0 || event.button === 1) { - const type = import_obsidian3.Keymap.isModEvent(event); - leaf = app.workspace.getLeaf(type); - } - } else { - leaf = app.workspace.getLeaf(false); - } - return leaf; -} -function mayTriggerFileMenu(app2, event, filePath, view, source) { - if (event.button == 2) { - const file = app2.vault.getAbstractFileByPath(filePath); - if (file != null) { - const fileMenu = new import_obsidian3.Menu(); - app2.workspace.trigger("file-menu", fileMenu, file, source, view); - fileMenu.showAtPosition({ x: event.pageX, y: event.pageY }); - } - } -} -function impossibleBranch(x) { - throw new Error("Impossible branch: " + x); -} -function rgbToString(rgb) { - return `rgb(${rgb.r},${rgb.g},${rgb.b})`; -} -function convertToRgb(str) { - var _a2; - const color = (_a2 = cssColorConverter.fromString(str)) == null ? void 0 : _a2.toRgbaArray(); - if (color === void 0) { - return void 0; - } - const [r, g, b] = color; - return { r, g, b }; -} -function momentToEpochSeconds(instant) { - return instant.diff(import_obsidian3.moment.unix(0), "seconds"); -} -function median(array) { - if (array.length === 0) return void 0; - return array.slice().sort()[Math.floor(array.length / 2)]; -} -function strictDeepEqual(a, b) { - return (0, import_deep_equal.default)(a, b, { strict: true }); -} -function resizeToLength(original, desiredLength, fillChar) { - if (original.length <= desiredLength) { - const prefix = new Array(desiredLength - original.length).fill(fillChar).join(""); - return prefix + original; - } else { - return original.substring(original.length - desiredLength); - } -} -function prefixOfLengthAsWhitespace(toBeRenderedText, whitespacePrefixLength) { - if (whitespacePrefixLength <= 0) return toBeRenderedText; - const whitespacePrefix = new Array(whitespacePrefixLength).fill(" ").join(""); - const originalSuffix = toBeRenderedText.substring( - whitespacePrefixLength, - toBeRenderedText.length - ); - return whitespacePrefix + originalSuffix; -} -function between(l, x, r) { - return l <= x && x <= r; -} -function splitRemoteBranch(remoteBranch) { - const [remote, ...branch2] = remoteBranch.split("/"); - return [remote, branch2.length === 0 ? void 0 : branch2.join("/")]; -} -function getDisplayPath(path2) { - if (path2.endsWith("/")) return path2; - return path2.split("/").last().replace(".md", ""); -} -function formatMinutes(minutes) { - if (minutes === 1) return "1 minute"; - return `${minutes} minutes`; -} - -// src/gitManager/gitManager.ts -init_polyfill_buffer(); -var GitManager = class { - constructor(plugin) { - this.plugin = plugin; - this.app = plugin.app; - } - // Constructs a path relative to the vault from a path relative to the git repository - getRelativeVaultPath(path2) { - if (this.plugin.settings.basePath) { - return this.plugin.settings.basePath + "/" + path2; - } else { - return path2; - } - } - // Constructs a path relative to the git repository from a path relative to the vault - // - // @param doConversion - If false, the path is returned as is. This is added because that parameter is often passed on to functions where this method is called. - getRelativeRepoPath(filePath, doConversion = true) { - if (doConversion) { - if (this.plugin.settings.basePath.length > 0) { - return filePath.substring( - this.plugin.settings.basePath.length + 1 - ); - } - } - return filePath; - } - _getTreeStructure(children2, beginLength = 0) { - const list = []; - children2 = [...children2]; - while (children2.length > 0) { - const first2 = children2.first(); - const restPath = first2.path.substring(beginLength); - if (restPath.contains("/")) { - const title = restPath.substring(0, restPath.indexOf("/")); - const childrenWithSameTitle = children2.filter((item) => { - return item.path.substring(beginLength).startsWith(title + "/"); - }); - childrenWithSameTitle.forEach((item) => children2.remove(item)); - const path2 = first2.path.substring( - 0, - restPath.indexOf("/") + beginLength - ); - list.push({ - title, - path: path2, - vaultPath: this.getRelativeVaultPath(path2), - children: this._getTreeStructure( - childrenWithSameTitle, - (beginLength > 0 ? beginLength + title.length : title.length) + 1 - ) - }); - } else { - list.push({ - title: restPath, - data: first2, - path: first2.path, - vaultPath: this.getRelativeVaultPath(first2.path) - }); - children2.remove(first2); - } - } - return list; - } - /* - * Sorts the children and simplifies the title - * If a node only contains another subdirectory, that subdirectory is moved up one level and integrated into the parent node - */ - simplify(tree) { - var _a2, _b, _c, _d; - for (const node of tree) { - while (true) { - const singleChild = ((_a2 = node.children) == null ? void 0 : _a2.length) == 1; - const singleChildIsDir = ((_c = (_b = node.children) == null ? void 0 : _b.first()) == null ? void 0 : _c.data) == void 0; - if (!(node.children != void 0 && singleChild && singleChildIsDir)) - break; - const child = node.children.first(); - node.title += "/" + child.title; - node.data = child.data; - node.path = child.path; - node.vaultPath = child.vaultPath; - node.children = child.children; - } - if (node.children != void 0) { - this.simplify(node.children); - } - (_d = node.children) == null ? void 0 : _d.sort((a, b) => { - const dirCompare = (b.data == void 0 ? 1 : 0) - (a.data == void 0 ? 1 : 0); - if (dirCompare != 0) { - return dirCompare; - } else { - return a.title.localeCompare(b.title); - } - }); - } - return tree.sort((a, b) => { - const dirCompare = (b.data == void 0 ? 1 : 0) - (a.data == void 0 ? 1 : 0); - if (dirCompare != 0) { - return dirCompare; - } else { - return a.title.localeCompare(b.title); - } - }); - } - getTreeStructure(children2) { - const tree = this._getTreeStructure(children2); - const res = this.simplify(tree); - return res; - } - async formatCommitMessage(template) { - let status2; - if (template.includes("{{numFiles}}")) { - status2 = await this.status(); - const numFiles = status2.staged.length; - template = template.replace("{{numFiles}}", String(numFiles)); - } - if (template.includes("{{hostname}}")) { - const hostname = this.plugin.localStorage.getHostname() || ""; - template = template.replace("{{hostname}}", hostname); - } - if (template.includes("{{files}}")) { - status2 = status2 != null ? status2 : await this.status(); - const changeset = {}; - let files = ""; - if (status2.staged.length < 100) { - status2.staged.forEach((value) => { - if (value.index in changeset) { - changeset[value.index].push(value.path); - } else { - changeset[value.index] = [value.path]; - } - }); - const chunks = []; - for (const [action, files2] of Object.entries(changeset)) { - chunks.push(action + " " + files2.join(" ")); - } - files = chunks.join(", "); - } else { - files = "Too many files to list"; - } - template = template.replace("{{files}}", files); - } - const moment6 = window.moment; - template = template.replace( - "{{date}}", - moment6().format(this.plugin.settings.commitDateFormat) - ); - if (this.plugin.settings.listChangedFilesInMessageBody) { - const status22 = status2 != null ? status2 : await this.status(); - let files = ""; - if (status22.staged.length < 100) { - files = status22.staged.map((e) => e.path).join("\n"); - } else { - files = "Too many files to list"; - } - template = template + "\n\nAffected files:\n" + files; - } - return template; - } -}; - -// src/gitManager/simpleGit.ts -var SimpleGit = class extends GitManager { - constructor(plugin) { - super(plugin); - } - async setGitInstance(ignoreError = false) { - if (this.isGitInstalled()) { - const adapter = this.app.vault.adapter; - const vaultBasePath = adapter.getBasePath(); - let basePath = vaultBasePath; - if (this.plugin.settings.basePath) { - const exists2 = await adapter.exists( - (0, import_obsidian4.normalizePath)(this.plugin.settings.basePath) - ); - if (exists2) { - basePath = path.join( - vaultBasePath, - this.plugin.settings.basePath - ); - } else if (!ignoreError) { - new import_obsidian4.Notice("ObsidianGit: Base path does not exist"); - } - } - this.absoluteRepoPath = basePath; - this.git = esm_default({ - baseDir: basePath, - binary: this.plugin.localStorage.getGitPath() || void 0, - config: ["core.quotepath=off"] - }); - const pathPaths = this.plugin.localStorage.getPATHPaths(); - const envVars = this.plugin.localStorage.getEnvVars(); - const gitDir = this.plugin.settings.gitDir; - if (pathPaths.length > 0) { - const path2 = process.env["PATH"] + ":" + pathPaths.join(":"); - process.env["PATH"] = path2; - } - if (gitDir) { - process.env["GIT_DIR"] = gitDir; - } - for (const envVar of envVars) { - const [key2, value] = envVar.split("="); - process.env[key2] = value; - } - import_debug2.default.enable("simple-git"); - if (await this.git.checkIsRepo()) { - const relativeRoot = await this.git.revparse("--show-cdup"); - const absoluteRoot = (0, import_path.resolve)(basePath + import_path.sep + relativeRoot); - this.absoluteRepoPath = absoluteRoot; - await this.git.cwd(absoluteRoot); - } - } - } - // Constructs a path relative to the vault from a path relative to the git repository - getRelativeVaultPath(filePath) { - const adapter = this.app.vault.adapter; - const from = adapter.getBasePath(); - const to = path.join(this.absoluteRepoPath, filePath); - let res = path.relative(from, to); - if (import_obsidian4.Platform.isWin) { - res = res.replace(/\\/g, "/"); - } - return res; - } - // Constructs a path relative to the git repository from a path relative to the vault - // - // @param doConversion - If false, the path is returned as is. This is added because that parameter is often passed on to functions where this method is called. - getRelativeRepoPath(filePath, doConversion = true) { - if (doConversion) { - const adapter = this.plugin.app.vault.adapter; - const vaultPath = adapter.getBasePath(); - const from = this.absoluteRepoPath; - const to = path.join(vaultPath, filePath); - let res = path.relative(from, to); - if (import_obsidian4.Platform.isWin) { - res = res.replace(/\\/g, "/"); - } - return res; - } - return filePath; - } - async status() { - this.plugin.setState(1 /* status */); - const status2 = await this.git.status((err) => this.onError(err)); - this.plugin.setState(0 /* idle */); - const allFilesFormatted = status2.files.map((e) => { - const res = this.formatPath(e); - return { - path: res.path, - from: res.from, - index: e.index === "?" ? "U" : e.index, - working_dir: e.working_dir === "?" ? "U" : e.working_dir, - vault_path: this.getRelativeVaultPath(res.path) - }; - }); - return { - all: allFilesFormatted, - changed: allFilesFormatted.filter((e) => e.working_dir !== " "), - staged: allFilesFormatted.filter( - (e) => e.index !== " " && e.index != "U" - ), - conflicted: status2.conflicted.map( - (path2) => this.formatPath({ path: path2 }).path - ) - }; - } - async submoduleAwareHeadRevisonInContainingDirectory(filepath) { - const repoPath = this.getRelativeRepoPath(filepath); - const containingDirectory = path.dirname(repoPath); - const args = ["-C", containingDirectory, "rev-parse", "HEAD"]; - const result = this.git.raw(args); - result.catch( - (err) => console.warn("obsidian-git: rev-parse error:", err) - ); - return result; - } - async getSubmodulePaths() { - return new Promise(async (resolve2) => { - this.git.outputHandler(async (cmd, stdout, stderr, args) => { - if (!(args.contains("submodule") && args.contains("foreach"))) { - return; - } - let body = ""; - const root2 = this.app.vault.adapter.getBasePath() + (this.plugin.settings.basePath ? "/" + this.plugin.settings.basePath : ""); - stdout.on("data", (chunk) => { - body += chunk.toString("utf8"); - }); - stdout.on("end", async () => { - const submods = body.split("\n"); - const strippedSubmods = submods.map((i) => { - const submod = i.match(/'([^']*)'/); - if (submod != void 0) { - return root2 + "/" + submod[1] + import_path.sep; - } - }).filter((i) => !!i); - strippedSubmods.reverse(); - resolve2(strippedSubmods); - }); - }); - await this.git.subModule(["foreach", "--recursive", ""]); - this.git.outputHandler(() => { - }); - }); - } - //Remove wrong `"` like "My file.md" - formatPath(path2, renamed = false) { - function format(path3) { - if (path3 == void 0) return void 0; - if (path3.startsWith('"') && path3.endsWith('"')) { - return path3.substring(1, path3.length - 1); - } else { - return path3; - } - } - if (renamed) { - return { - from: format(path2.from), - path: format(path2.path) - }; - } else { - return { - path: format(path2.path) - }; - } - } - async blame(path2, trackMovement, ignoreWhitespace) { - path2 = this.getRelativeRepoPath(path2); - if (!await this.isTracked(path2)) return "untracked"; - const inSubmodule = await this.getSubmoduleOfFile(path2); - const args = inSubmodule ? ["-C", inSubmodule.submodule] : []; - const relativePath = inSubmodule ? inSubmodule.relativeFilepath : path2; - args.push("blame", "--porcelain"); - if (ignoreWhitespace) args.push("-w"); - const trackCArg = `-C${GIT_LINE_AUTHORING_MOVEMENT_DETECTION_MINIMAL_LENGTH}`; - switch (trackMovement) { - case "inactive": - break; - case "same-commit": - args.push("-C", trackCArg); - break; - case "all-commits": - args.push("-C", "-C", trackCArg); - break; - default: - impossibleBranch(trackMovement); - } - args.push("--", relativePath); - const rawBlame = await this.git.raw( - args, - (err) => err && console.warn("git-blame", err) - ); - return parseBlame(rawBlame); - } - async isTracked(path2) { - const inSubmodule = await this.getSubmoduleOfFile(path2); - const args = inSubmodule ? ["-C", inSubmodule.submodule] : []; - const relativePath = inSubmodule ? inSubmodule.relativeFilepath : path2; - args.push("ls-files", "--", relativePath); - return this.git.raw(args, (err) => err && console.warn("ls-files", err)).then((x) => x.trim() !== ""); - } - async commitAll({ message }) { - if (this.plugin.settings.updateSubmodules) { - this.plugin.setState(4 /* commit */); - const submodulePaths = await this.getSubmodulePaths(); - for (const item of submodulePaths) { - await this.git.cwd({ path: item, root: false }).add("-A", (err) => this.onError(err)); - await this.git.cwd({ path: item, root: false }).commit( - await this.formatCommitMessage(message), - (err) => this.onError(err) - ); - } - } - this.plugin.setState(3 /* add */); - await this.git.add("-A", (err) => this.onError(err)); - this.plugin.setState(4 /* commit */); - const res = await this.git.commit( - await this.formatCommitMessage(message), - (err) => this.onError(err) - ); - dispatchEvent(new CustomEvent("git-head-update")); - return res.summary.changes; - } - async commit({ - message, - amend - }) { - this.plugin.setState(4 /* commit */); - const res = (await this.git.commit( - await this.formatCommitMessage(message), - amend ? ["--amend"] : [], - (err) => this.onError(err) - )).summary.changes; - dispatchEvent(new CustomEvent("git-head-update")); - this.plugin.setState(0 /* idle */); - return res; - } - async stage(path2, relativeToVault) { - this.plugin.setState(3 /* add */); - path2 = this.getRelativeRepoPath(path2, relativeToVault); - await this.git.add(["--", path2], (err) => this.onError(err)); - this.plugin.setState(0 /* idle */); - } - async stageAll({ dir }) { - this.plugin.setState(3 /* add */); - await this.git.add(dir != null ? dir : "-A", (err) => this.onError(err)); - this.plugin.setState(0 /* idle */); - } - async unstageAll({ dir }) { - this.plugin.setState(3 /* add */); - await this.git.reset( - dir != void 0 ? ["--", dir] : [], - (err) => this.onError(err) - ); - this.plugin.setState(0 /* idle */); - } - async unstage(path2, relativeToVault) { - this.plugin.setState(3 /* add */); - path2 = this.getRelativeRepoPath(path2, relativeToVault); - await this.git.reset(["--", path2], (err) => this.onError(err)); - this.plugin.setState(0 /* idle */); - } - async discard(filepath) { - this.plugin.setState(3 /* add */); - await this.git.checkout(["--", filepath], (err) => this.onError(err)); - this.plugin.setState(0 /* idle */); - } - async hashObject(filepath) { - filepath = this.getRelativeRepoPath(filepath); - const inSubmodule = await this.getSubmoduleOfFile(filepath); - const args = inSubmodule ? ["-C", inSubmodule.submodule] : []; - const relativeFilepath = inSubmodule ? inSubmodule.relativeFilepath : filepath; - args.push("hash-object", "--", relativeFilepath); - const revision = this.git.raw(args); - revision.catch( - (err) => err && console.warn("obsidian-git. hash-object failed:", err == null ? void 0 : err.message) - ); - return revision; - } - async discardAll({ dir }) { - return this.discard(dir != null ? dir : "."); - } - async pull() { - this.plugin.setState(2 /* pull */); - if (this.plugin.settings.updateSubmodules) - await this.git.subModule( - ["update", "--remote", "--merge", "--recursive"], - (err) => this.onError(err) - ); - const branchInfo = await this.branchInfo(); - const localCommit = await this.git.revparse( - [branchInfo.current], - (err) => this.onError(err) - ); - if (!branchInfo.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((err) => this.onError(err)); - const upstreamCommit = await this.git.revparse( - [branchInfo.tracking], - (err) => this.onError(err) - ); - if (localCommit !== upstreamCommit) { - if (this.plugin.settings.syncMethod === "merge" || this.plugin.settings.syncMethod === "rebase") { - try { - switch (this.plugin.settings.syncMethod) { - case "merge": - await this.git.merge([branchInfo.tracking]); - break; - case "rebase": - await this.git.rebase([branchInfo.tracking]); - } - } catch (err) { - this.plugin.displayError( - `Pull failed (${this.plugin.settings.syncMethod}): ${err.message}` - ); - return; - } - } else if (this.plugin.settings.syncMethod === "reset") { - try { - await this.git.raw( - [ - "update-ref", - `refs/heads/${branchInfo.current}`, - upstreamCommit - ], - (err) => this.onError(err) - ); - await this.unstageAll({}); - } catch (err) { - this.plugin.displayError( - `Sync failed (${this.plugin.settings.syncMethod}): ${err.message}` - ); - } - } - dispatchEvent(new CustomEvent("git-head-update")); - const afterMergeCommit = await this.git.revparse( - [branchInfo.current], - (err) => this.onError(err) - ); - const filesChanged = await this.git.diff([ - `${localCommit}..${afterMergeCommit}`, - "--name-only" - ]); - return filesChanged.split(/\r\n|\r|\n/).filter((value) => value.length > 0).map((e) => { - return { - path: e, - working_dir: "P", - vault_path: this.getRelativeVaultPath(e) - }; - }); - } else { - return []; - } - } - async push() { - this.plugin.setState(5 /* push */); - if (this.plugin.settings.updateSubmodules) { - const res = await this.git.env({ ...process.env, OBSIDIAN_GIT: 1 }).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` - ], - (err) => this.onError(err) - ); - console.log(res); - } - const status2 = await this.git.status(); - const trackingBranch = status2.tracking; - const currentBranch2 = status2.current; - if (!trackingBranch && this.plugin.settings.updateSubmodules) { - this.plugin.log( - "No tracking branch found. Ignoring push of main repo and updating submodules only." - ); - return void 0; - } - const remoteChangedFiles = (await this.git.diffSummary( - [currentBranch2, trackingBranch, "--"], - (err) => this.onError(err) - )).changed; - await this.git.env({ ...process.env, OBSIDIAN_GIT: 1 }).push((err) => this.onError(err)); - return remoteChangedFiles; - } - async getUnpushedCommits() { - const status2 = await this.git.status(); - const trackingBranch = status2.tracking; - const currentBranch2 = status2.current; - if (trackingBranch == null || currentBranch2 == null) { - return 0; - } - const remoteChangedFiles = (await this.git.diffSummary( - [currentBranch2, trackingBranch, "--"], - (err) => this.onError(err) - )).changed; - return remoteChangedFiles; - } - async canPush() { - if (this.plugin.settings.updateSubmodules === true) { - return true; - } - const status2 = await this.git.status((err) => this.onError(err)); - const trackingBranch = status2.tracking; - const currentBranch2 = status2.current; - if (!trackingBranch) { - return false; - } - const remoteChangedFiles = (await this.git.diffSummary([currentBranch2, trackingBranch, "--"])).changed; - return remoteChangedFiles !== 0; - } - async checkRequirements() { - if (!this.isGitInstalled()) { - return "missing-git"; - } - if (!await this.git.checkIsRepo()) { - return "missing-repo"; - } - return "valid"; - } - async branchInfo() { - const status2 = await this.git.status((err) => this.onError(err)); - const branches = await this.git.branch( - ["--no-color"], - (err) => this.onError(err) - ); - return { - current: status2.current || void 0, - tracking: status2.tracking || void 0, - branches: branches.all - }; - } - async getRemoteUrl(remote) { - try { - return await this.git.remote(["get-url", remote]) || void 0; - } catch (error) { - if (error.toString().contains(remote)) { - return void 0; - } else { - this.onError(error); - } - } - } - // https://github.com/kometenstaub/obsidian-version-history-diff/issues/3 - async log(file, relativeToVault = true, limit) { - let path2; - if (file) { - path2 = this.getRelativeRepoPath(file, relativeToVault); - } - const res = await this.git.log( - { - file: path2, - maxCount: limit, - "-m": null, - "--name-status": null - }, - (err) => this.onError(err) - ); - return res.all.map((e) => { - var _a2, _b, _c, _d; - return { - ...e, - author: { - name: e.author_name, - email: e.author_email - }, - refs: e.refs.split(", ").filter((e2) => e2.length > 0), - diff: { - ...e.diff, - files: (_b = (_a2 = e.diff) == null ? void 0 : _a2.files.map((f) => ({ - ...f, - status: f.status, - path: f.file, - hash: e.hash, - vault_path: this.getRelativeVaultPath(f.file) - }))) != null ? _b : [] - }, - fileName: (_d = (_c = e.diff) == null ? void 0 : _c.files.first()) == null ? void 0 : _d.file - }; - }); - } - async show(commitHash, file, relativeToVault = true) { - const path2 = this.getRelativeRepoPath(file, relativeToVault); - return this.git.show( - [commitHash + ":" + path2], - (err) => this.onError(err) - ); - } - async checkout(branch2, remote) { - if (remote) { - branch2 = `${remote}/${branch2}`; - } - await this.git.checkout(branch2, (err) => this.onError(err)); - if (this.plugin.settings.submoduleRecurseCheckout) { - const submodulePaths = await this.getSubmodulePaths(); - for (const submodulePath of submodulePaths) { - const branchSummary = await this.git.cwd({ path: submodulePath, root: false }).branch(); - if (Object.keys(branchSummary.branches).includes(branch2)) { - await this.git.cwd({ path: submodulePath, root: false }).checkout(branch2, (err) => this.onError(err)); - } - } - } - } - async createBranch(branch2) { - await this.git.checkout(["-b", branch2], (err) => this.onError(err)); - } - async deleteBranch(branch2, force) { - await this.git.branch( - [force ? "-D" : "-d", branch2], - (err) => this.onError(err) - ); - } - async branchIsMerged(branch2) { - const notMergedBranches = await this.git.branch( - ["--no-merged"], - (err) => this.onError(err) - ); - return !notMergedBranches.all.contains(branch2); - } - async init() { - await this.git.init(false, (err) => this.onError(err)); - } - async clone(url, dir, depth) { - await this.git.clone( - url, - path.join( - this.app.vault.adapter.getBasePath(), - dir - ), - depth ? ["--depth", `${depth}`] : [], - (err) => this.onError(err) - ); - } - async setConfig(path2, value) { - if (value == void 0) { - await this.git.raw(["config", "--local", "--unset", path2]); - } else { - await this.git.addConfig(path2, value, (err) => this.onError(err)); - } - } - async getConfig(path2) { - const config = await this.git.listConfig( - "local", - (err) => this.onError(err) - ); - return config.all[path2]; - } - async fetch(remote) { - await this.git.fetch( - remote != void 0 ? [remote] : [], - (err) => this.onError(err) - ); - } - async setRemote(name, url) { - if ((await this.getRemotes()).includes(name)) - await this.git.remote( - ["set-url", name, url], - (err) => this.onError(err) - ); - else { - await this.git.remote( - ["add", name, url], - (err) => this.onError(err) - ); - } - } - async getRemoteBranches(remote) { - const res = await this.git.branch( - ["-r", "--list", `${remote}*`], - (err) => this.onError(err) - ); - const list = []; - for (const item in res.branches) { - list.push(res.branches[item].name); - } - return list; - } - async getRemotes() { - const res = await this.git.remote([], (err) => this.onError(err)); - if (res) { - return res.trim().split("\n"); - } else { - return []; - } - } - async removeRemote(remoteName) { - await this.git.removeRemote(remoteName); - } - async updateUpstreamBranch(remoteBranch) { - try { - await this.git.branch(["--set-upstream-to", remoteBranch]); - } catch (e) { - console.error(e); - try { - await this.git.branch(["--set-upstream", remoteBranch]); - } catch (e2) { - console.error(e2); - await this.git.push( - // A type error occurs here because the third element could be undefined. - // However, it is unlikely to be undefined due to the `remoteBranch`'s format, and error handling is in place. - // Therefore, we temporarily ignore the error. - // @ts-ignore - ["--set-upstream", ...splitRemoteBranch(remoteBranch)], - (err) => this.onError(err) - ); - } - } - } - updateGitPath(_) { - this.setGitInstance(); - } - updateBasePath(_) { - this.setGitInstance(true); - } - async getDiffString(filePath, stagedChanges = false, hash2) { - if (stagedChanges) - return await this.git.diff(["--cached", "--", filePath]); - if (hash2) return await this.git.show([`${hash2}`, "--", filePath]); - else return await this.git.diff(["--", filePath]); - } - async diff(file, commit1, commit2) { - return await this.git.diff([`${commit1}..${commit2}`, "--", file]); - } - async getSubmoduleOfFile(repositoryRelativeFile) { - let submoduleRoot = await this.git.raw( - [ - "-C", - path.dirname(repositoryRelativeFile), - "rev-parse", - "--show-toplevel" - ], - (err) => err && console.warn("get-submodule-of-file", err == null ? void 0 : err.message) - ); - submoduleRoot = submoduleRoot.trim(); - const superProject = await this.git.raw( - [ - "-C", - path.dirname(repositoryRelativeFile), - "rev-parse", - "--show-superproject-working-tree" - ], - (err) => err && console.warn("get-submodule-of-file", err == null ? void 0 : err.message) - ); - if (superProject.trim() === "") { - return void 0; - } - const fsAdapter = this.app.vault.adapter; - const absolutePath = fsAdapter.getFullPath( - path.normalize(repositoryRelativeFile) - ); - const newRelativePath = path.relative(submoduleRoot, absolutePath); - return { submodule: submoduleRoot, relativeFilepath: newRelativePath }; - } - async getLastCommitTime() { - const res = await this.git.log({ n: 1 }, (err) => this.onError(err)); - if (res != null && res.latest != null) { - return new Date(res.latest.date); - } - } - isGitInstalled() { - const command = (0, import_child_process2.spawnSync)( - this.plugin.localStorage.getGitPath() || "git", - ["--version"], - { - stdio: "ignore" - } - ); - if (command.error) { - console.error(command.error); - return false; - } - return true; - } - onError(error) { - if (error) { - const networkFailure = error.message.contains("Could not resolve host") || error.message.match( - /ssh: connect to host .*? port .*?: Operation timed out/ - ) || error.message.match( - /ssh: connect to host .*? port .*?: Network is unreachable/ - ); - if (!networkFailure) { - this.plugin.displayError(error.message); - this.plugin.setState(0 /* idle */); - } else if (!this.plugin.offlineMode) { - this.plugin.displayError( - "Git: Going into offline mode. Future network errors will no longer be displayed.", - 2e3 - ); - } - if (networkFailure) { - this.plugin.offlineMode = true; - this.plugin.setState(0 /* idle */); - } - } - } -}; -var zeroCommit = { - hash: "000000", - isZeroCommit: true, - summary: "" -}; -function parseBlame(blameOutputUnnormalized) { - const blameOutput = blameOutputUnnormalized.replace("\r\n", "\n"); - const blameLines = blameOutput.split("\n"); - const result = { - commits: /* @__PURE__ */ new Map(), - hashPerLine: [void 0], - // one-based indices - originalFileLineNrPerLine: [void 0], - finalFileLineNrPerLine: [void 0], - groupSizePerStartingLine: /* @__PURE__ */ new Map() - }; - let line = 1; - for (let bi = 0; bi < blameLines.length; ) { - if (startsWithNonWhitespace(blameLines[bi])) { - const lineInfo = blameLines[bi].split(" "); - const commitHash = parseLineInfoInto(lineInfo, line, result); - bi++; - for (; startsWithNonWhitespace(blameLines[bi]); bi++) { - const spaceSeparatedHeaderValues = blameLines[bi].split(" "); - parseHeaderInto(spaceSeparatedHeaderValues, result, line); - } - finalizeBlameCommitInfo(result.commits.get(commitHash)); - line += 1; - } else if (blameLines[bi] === "" && bi === blameLines.length - 1) { - } else { - throw Error( - `Expected non-whitespace line or EOF, but found: ${blameLines[bi]}` - ); - } - bi++; - } - return result; -} -function parseLineInfoInto(lineInfo, line, result) { - const hash2 = lineInfo[0]; - result.hashPerLine.push(hash2); - result.originalFileLineNrPerLine.push(parseInt(lineInfo[1])); - result.finalFileLineNrPerLine.push(parseInt(lineInfo[2])); - lineInfo.length >= 4 && result.groupSizePerStartingLine.set(line, parseInt(lineInfo[3])); - if (parseInt(lineInfo[2]) !== line) { - throw Error( - `git-blame output is out of order: ${line} vs ${lineInfo[2]}` - ); - } - return hash2; -} -function parseHeaderInto(header, out, line) { - const key2 = header[0]; - const value = header.slice(1).join(" "); - const commitHash = out.hashPerLine[line]; - const commit2 = out.commits.get(commitHash) || { - hash: commitHash, - author: {}, - committer: {}, - previous: {} - }; - switch (key2) { - case "summary": - commit2.summary = value; - break; - case "author": - commit2.author.name = value; - break; - case "author-mail": - commit2.author.email = removeEmailBrackets(value); - break; - case "author-time": - commit2.author.epochSeconds = parseInt(value); - break; - case "author-tz": - commit2.author.tz = value; - break; - case "committer": - commit2.committer.name = value; - break; - case "committer-mail": - commit2.committer.email = removeEmailBrackets(value); - break; - case "committer-time": - commit2.committer.epochSeconds = parseInt(value); - break; - case "committer-tz": - commit2.committer.tz = value; - break; - case "previous": - commit2.previous.commitHash = value; - break; - case "filename": - commit2.previous.filename = value; - break; - } - out.commits.set(commitHash, commit2); -} -function finalizeBlameCommitInfo(commit2) { - if (commit2.summary === void 0) { - throw Error(`Summary not provided for commit: ${commit2.hash}`); - } - if (isUndefinedOrEmptyObject(commit2.author)) { - commit2.author = void 0; - } - if (isUndefinedOrEmptyObject(commit2.committer)) { - commit2.committer = void 0; - } - if (isUndefinedOrEmptyObject(commit2.previous)) { - commit2.previous = void 0; - } - commit2.isZeroCommit = Boolean(commit2.hash.match(/^0*$/)); -} -function isUndefinedOrEmptyObject(obj) { - return !obj || Object.keys(obj).length === 0; -} -function startsWithNonWhitespace(str) { - return str.length > 0 && str[0].trim() === str[0]; -} -function removeEmailBrackets(gitEmail) { - const prefixCleaned = gitEmail.startsWith("<") ? gitEmail.substring(1) : gitEmail; - return prefixCleaned.endsWith(">") ? prefixCleaned.substring(0, prefixCleaned.length - 1) : prefixCleaned; -} - -// src/lineAuthor/lineAuthorProvider.ts -init_polyfill_buffer(); -var import_state4 = require("@codemirror/state"); - -// src/lineAuthor/control.ts -init_polyfill_buffer(); -var import_state2 = require("@codemirror/state"); -var import_obsidian9 = require("obsidian"); - -// src/lineAuthor/eventsPerFilepath.ts -init_polyfill_buffer(); -var SECONDS = 1e3; -var REMOVE_STALES_FREQUENCY = 60 * SECONDS; -var EventsPerFilePath = class { - constructor() { - this.eventsPerFilepath = /* @__PURE__ */ new Map(); - this.startRemoveStalesSubscribersInterval(); - } - /** - * Run the {@link handler} on the subscribers to {@link filepath}. - */ - ifFilepathDefinedTransformSubscribers(filepath, handler) { - if (!filepath) return; - this.ensureInitialized(filepath); - return handler(this.eventsPerFilepath.get(filepath)); - } - forEachSubscriber(handler) { - this.eventsPerFilepath.forEach((subs) => subs.forEach(handler)); - } - ensureInitialized(filepath) { - if (!this.eventsPerFilepath.get(filepath)) - this.eventsPerFilepath.set(filepath, /* @__PURE__ */ new Set()); - } - startRemoveStalesSubscribersInterval() { - this.removeStalesSubscribersTimer = window.setInterval( - () => this == null ? void 0 : this.forEachSubscriber((las) => las == null ? void 0 : las.removeIfStale()), - REMOVE_STALES_FREQUENCY - ); - } - clear() { - window.clearInterval(this.removeStalesSubscribersTimer); - this.eventsPerFilepath.clear(); - } -}; -var eventsPerFilePathSingleton = new EventsPerFilePath(); - -// src/lineAuthor/model.ts -init_polyfill_buffer(); -var import_state = require("@codemirror/state"); -var import_js_sha256 = __toESM(require_sha256()); - -// src/setting/settings.ts -init_polyfill_buffer(); -var import_obsidian8 = require("obsidian"); - -// src/gitManager/isomorphicGit.ts -init_polyfill_buffer(); - -// node_modules/.pnpm/diff@5.2.0/node_modules/diff/lib/index.mjs -init_polyfill_buffer(); -function Diff() { -} -Diff.prototype = { - diff: function diff(oldString, newString) { - var _options$timeout; - var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - var callback = options.callback; - if (typeof options === "function") { - callback = options; - options = {}; - } - this.options = options; - var self2 = this; - function done(value) { - if (callback) { - setTimeout(function() { - callback(void 0, value); - }, 0); - return true; - } else { - return value; - } - } - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); - var newLen = newString.length, oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - if (options.maxEditLength) { - maxEditLength = Math.min(maxEditLength, options.maxEditLength); - } - var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; - var abortAfterTimestamp = Date.now() + maxExecutionTime; - var bestPath = [{ - oldPos: -1, - lastComponent: void 0 - }]; - var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { - return done([{ - value: this.join(newString), - count: newString.length - }]); - } - var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity; - function execEditLength() { - for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { - var basePath = void 0; - var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1]; - if (removePath) { - bestPath[diagonalPath - 1] = void 0; - } - var canAdd = false; - if (addPath) { - var addPathNewPos = addPath.oldPos - diagonalPath; - canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; - } - var canRemove = removePath && removePath.oldPos + 1 < oldLen; - if (!canAdd && !canRemove) { - bestPath[diagonalPath] = void 0; - continue; - } - if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { - basePath = self2.addToPath(addPath, true, void 0, 0); - } else { - basePath = self2.addToPath(removePath, void 0, true, 1); - } - newPos = self2.extractCommon(basePath, newString, oldString, diagonalPath); - if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { - return done(buildValues(self2, basePath.lastComponent, newString, oldString, self2.useLongestToken)); - } else { - bestPath[diagonalPath] = basePath; - if (basePath.oldPos + 1 >= oldLen) { - maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); - } - if (newPos + 1 >= newLen) { - minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); - } - } - } - editLength++; - } - if (callback) { - (function exec() { - setTimeout(function() { - if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { - return callback(); - } - if (!execEditLength()) { - exec(); - } - }, 0); - })(); - } else { - while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { - var ret = execEditLength(); - if (ret) { - return ret; - } - } - } - }, - addToPath: function addToPath(path2, added, removed, oldPosInc) { - var last2 = path2.lastComponent; - if (last2 && last2.added === added && last2.removed === removed) { - return { - oldPos: path2.oldPos + oldPosInc, - lastComponent: { - count: last2.count + 1, - added, - removed, - previousComponent: last2.previousComponent - } - }; - } else { - return { - oldPos: path2.oldPos + oldPosInc, - lastComponent: { - count: 1, - added, - removed, - previousComponent: last2 - } - }; - } - }, - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0; - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - if (commonCount) { - basePath.lastComponent = { - count: commonCount, - previousComponent: basePath.lastComponent - }; - } - basePath.oldPos = oldPos; - return newPos; - }, - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); - } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); - } - }, - removeEmpty: function removeEmpty(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - return ret; - }, - castInput: function castInput(value) { - return value; - }, - tokenize: function tokenize(value) { - return value.split(""); - }, - join: function join3(chars) { - return chars.join(""); - } -}; -function buildValues(diff3, lastComponent, newString, oldString, useLongestToken) { - var components = []; - var nextComponent; - while (lastComponent) { - components.push(lastComponent); - nextComponent = lastComponent.previousComponent; - delete lastComponent.previousComponent; - lastComponent = nextComponent; - } - components.reverse(); - var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = value.map(function(value2, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value2.length ? oldValue : value2; - }); - component.value = diff3.join(value); - } else { - component.value = diff3.join(newString.slice(newPos, newPos + component.count)); - } - newPos += component.count; - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = diff3.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } - var finalComponent = components[componentLen - 1]; - if (componentLen > 1 && typeof finalComponent.value === "string" && (finalComponent.added || finalComponent.removed) && diff3.equals("", finalComponent.value)) { - components[componentLen - 2].value += finalComponent.value; - components.pop(); - } - return components; -} -var characterDiff = new Diff(); -var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; -var reWhitespace = /\S/; -var wordDiff = new Diff(); -wordDiff.equals = function(left, right) { - if (this.options.ignoreCase) { - left = left.toLowerCase(); - right = right.toLowerCase(); - } - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); -}; -wordDiff.tokenize = function(value) { - var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); - for (var i = 0; i < tokens.length - 1; i++) { - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - return tokens; -}; -var lineDiff = new Diff(); -lineDiff.tokenize = function(value) { - if (this.options.stripTrailingCr) { - value = value.replace(/\r\n/g, "\n"); - } - var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); - } - } - return retLines; -}; -function diffLines(oldStr, newStr, callback) { - return lineDiff.diff(oldStr, newStr, callback); -} -var sentenceDiff = new Diff(); -sentenceDiff.tokenize = function(value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); -}; -var cssDiff = new Diff(); -cssDiff.tokenize = function(value) { - return value.split(/([{}:;,]|\s+)/); -}; -function _typeof(obj) { - "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function(obj2) { - return typeof obj2; - }; - } else { - _typeof = function(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof(obj); -} -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); -} -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return _arrayLikeToArray(arr); -} -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); -} -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return _arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); -} -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; -} -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -var objectPrototypeToString = Object.prototype.toString; -var jsonDiff = new Diff(); -jsonDiff.useLongestToken = true; -jsonDiff.tokenize = lineDiff.tokenize; -jsonDiff.castInput = function(value) { - var _this$options = this.options, undefinedReplacement = _this$options.undefinedReplacement, _this$options$stringi = _this$options.stringifyReplacer, stringifyReplacer = _this$options$stringi === void 0 ? function(k, v) { - return typeof v === "undefined" ? undefinedReplacement : v; - } : _this$options$stringi; - return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " "); -}; -jsonDiff.equals = function(left, right) { - return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1")); -}; -function canonicalize(obj, stack, replacementStack, replacer, key2) { - stack = stack || []; - replacementStack = replacementStack || []; - if (replacer) { - obj = replacer(key2, obj); - } - var i; - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - var canonicalizedObj; - if ("[object Array]" === objectPrototypeToString.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key2); - } - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - if (_typeof(obj) === "object" && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - var sortedKeys = [], _key; - for (_key in obj) { - if (obj.hasOwnProperty(_key)) { - sortedKeys.push(_key); - } - } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { - _key = sortedKeys[i]; - canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); - } - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - return canonicalizedObj; -} -var arrayDiff = new Diff(); -arrayDiff.tokenize = function(value) { - return value.slice(); -}; -arrayDiff.join = arrayDiff.removeEmpty = function(value) { - return value; -}; -function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - if (!options) { - options = {}; - } - if (typeof options.context === "undefined") { - options.context = 4; - } - var diff3 = diffLines(oldStr, newStr, options); - if (!diff3) { - return; - } - diff3.push({ - value: "", - lines: [] - }); - function contextLines(lines) { - return lines.map(function(entry) { - return " " + entry; - }); - } - var hunks = []; - var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; - var _loop = function _loop2(i2) { - var current = diff3[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n"); - current.lines = lines; - if (current.added || current.removed) { - var _curRange; - if (!oldRangeStart) { - var prev = diff3[i2 - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } - (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function(entry) { - return (current.added ? "+" : "-") + entry; - }))); - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - if (oldRangeStart) { - if (lines.length <= options.context * 2 && i2 < diff3.length - 2) { - var _curRange2; - (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); - } else { - var _curRange3; - var contextSize = Math.min(lines.length, options.context); - (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - if (i2 >= diff3.length - 2 && lines.length <= options.context) { - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) { - curRange.splice(hunk.oldLines, 0, "\\ No newline at end of file"); - } - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push("\\ No newline at end of file"); - } - } - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; - } - } - oldLine += lines.length; - newLine += lines.length; - } - }; - for (var i = 0; i < diff3.length; i++) { - _loop(i); - } - return { - oldFileName, - newFileName, - oldHeader, - newHeader, - hunks - }; -} -function formatPatch(diff3) { - if (Array.isArray(diff3)) { - return diff3.map(formatPatch).join("\n"); - } - var ret = []; - if (diff3.oldFileName == diff3.newFileName) { - ret.push("Index: " + diff3.oldFileName); - } - ret.push("==================================================================="); - ret.push("--- " + diff3.oldFileName + (typeof diff3.oldHeader === "undefined" ? "" : " " + diff3.oldHeader)); - ret.push("+++ " + diff3.newFileName + (typeof diff3.newHeader === "undefined" ? "" : " " + diff3.newHeader)); - for (var i = 0; i < diff3.hunks.length; i++) { - var hunk = diff3.hunks[i]; - if (hunk.oldLines === 0) { - hunk.oldStart -= 1; - } - if (hunk.newLines === 0) { - hunk.newStart -= 1; - } - ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@"); - ret.push.apply(ret, hunk.lines); - } - return ret.join("\n") + "\n"; -} -function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)); -} -function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { - return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); -} - -// src/gitManager/isomorphicGit.ts -var import_obsidian7 = require("obsidian"); - -// src/ui/modals/generalModal.ts -init_polyfill_buffer(); -var import_obsidian5 = require("obsidian"); -var generalModalConfigDefaults = { - options: [], - placeholder: "", - allowEmpty: false, - onlySelection: false, - initialValue: void 0 -}; -var GeneralModal = class extends import_obsidian5.SuggestModal { - constructor(config) { - super(app); - this.config = { ...generalModalConfigDefaults, ...config }; - this.setPlaceholder(this.config.placeholder); - } - open() { - super.open(); - if (this.config.initialValue != void 0) { - this.inputEl.value = this.config.initialValue; - this.inputEl.dispatchEvent(new Event("input")); - } - return new Promise((resolve2) => { - this.resolve = resolve2; - }); - } - selectSuggestion(value, evt) { - if (this.resolve) { - let res; - if (this.config.allowEmpty && value === " ") res = ""; - else if (value === "...") res = void 0; - else res = value; - this.resolve(res); - } - super.selectSuggestion(value, evt); - } - onClose() { - if (this.resolve) this.resolve(void 0); - } - getSuggestions(query) { - if (this.config.onlySelection) { - return this.config.options; - } else if (this.config.allowEmpty) { - return [query.length > 0 ? query : " ", ...this.config.options]; - } else { - return [query.length > 0 ? query : "...", ...this.config.options]; - } - } - renderSuggestion(value, el) { - el.setText(value); - } - onChooseSuggestion(item, evt) { - } -}; - -// src/gitManager/myAdapter.ts -init_polyfill_buffer(); -var import_obsidian6 = require("obsidian"); -var MyAdapter = class { - constructor(vault, plugin) { - this.plugin = plugin; - this.promises = {}; - this.adapter = vault.adapter; - this.vault = vault; - 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(path2, opts) { - var _a2; - this.maybeLog("Read: " + path2 + JSON.stringify(opts)); - if (opts == "utf8" || opts.encoding == "utf8") { - const file = this.vault.getAbstractFileByPath(path2); - if (file instanceof import_obsidian6.TFile) { - this.maybeLog("Reuse"); - return this.vault.read(file); - } else { - return this.adapter.read(path2); - } - } else { - if (path2.endsWith(this.gitDir + "/index")) { - if (this.plugin.settings.basePath != this.lastBasePath) { - this.clearIndex(); - this.lastBasePath = this.plugin.settings.basePath; - return this.adapter.readBinary(path2); - } - return (_a2 = this.index) != null ? _a2 : this.adapter.readBinary(path2); - } - const file = this.vault.getAbstractFileByPath(path2); - if (file instanceof import_obsidian6.TFile) { - this.maybeLog("Reuse"); - return this.vault.readBinary(file); - } else { - return this.adapter.readBinary(path2); - } - } - } - async writeFile(path2, data) { - this.maybeLog("Write: " + path2); - if (typeof data === "string") { - const file = this.vault.getAbstractFileByPath(path2); - if (file instanceof import_obsidian6.TFile) { - return this.vault.modify(file, data); - } else { - return this.adapter.write(path2, data); - } - } else { - if (path2.endsWith(this.gitDir + "/index")) { - this.index = data; - this.indexmtime = Date.now(); - } else { - const file = this.vault.getAbstractFileByPath(path2); - if (file instanceof import_obsidian6.TFile) { - return this.vault.modifyBinary(file, data); - } else { - return this.adapter.writeBinary(path2, data); - } - } - } - } - async readdir(path2) { - if (path2 === ".") path2 = "/"; - const res = await this.adapter.list(path2); - const all = [...res.files, ...res.folders]; - let formattedAll; - if (path2 !== "/") { - formattedAll = all.map( - (e) => (0, import_obsidian6.normalizePath)(e.substring(path2.length)) - ); - } else { - formattedAll = all; - } - return formattedAll; - } - async mkdir(path2) { - return this.adapter.mkdir(path2); - } - async rmdir(path2, opts) { - var _a2, _b; - return this.adapter.rmdir(path2, (_b = (_a2 = opts == null ? void 0 : opts.options) == null ? void 0 : _a2.recursive) != null ? _b : false); - } - async stat(path2) { - if (path2.endsWith(this.gitDir + "/index")) { - if (this.index !== void 0 && this.indexctime != void 0 && this.indexmtime != void 0) { - return { - isFile: () => true, - isDirectory: () => false, - isSymbolicLink: () => false, - size: this.index.length, - type: "file", - ctimeMs: this.indexctime, - mtimeMs: this.indexmtime - }; - } else { - const stat = await this.adapter.stat(path2); - if (stat == void 0) { - throw { code: "ENOENT" }; - } - this.indexctime = stat.ctime; - this.indexmtime = stat.mtime; - return { - ctimeMs: stat.ctime, - mtimeMs: stat.mtime, - size: stat.size, - type: "file", - isFile: () => true, - isDirectory: () => false, - isSymbolicLink: () => false - }; - } - } - if (path2 === ".") path2 = "/"; - const file = this.vault.getAbstractFileByPath(path2); - this.maybeLog("Stat: " + path2); - if (file instanceof import_obsidian6.TFile) { - this.maybeLog("Reuse stat"); - return { - ctimeMs: file.stat.ctime, - mtimeMs: file.stat.mtime, - size: file.stat.size, - type: "file", - isFile: () => true, - isDirectory: () => false, - isSymbolicLink: () => false - }; - } else { - const stat = await this.adapter.stat(path2); - if (stat) { - return { - ctimeMs: stat.ctime, - mtimeMs: stat.mtime, - size: stat.size, - type: stat.type === "folder" ? "directory" : stat.type, - isFile: () => stat.type === "file", - isDirectory: () => stat.type === "folder", - isSymbolicLink: () => false - }; - } else { - throw { code: "ENOENT" }; - } - } - } - async unlink(path2) { - return this.adapter.remove(path2); - } - async lstat(path2) { - return this.stat(path2); - } - async readlink(path2) { - throw new Error(`readlink of (${path2}) is not implemented.`); - } - async symlink(path2) { - throw new Error(`symlink of (${path2}) is not implemented.`); - } - async saveAndClear() { - if (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(text2) { - } -}; - -// src/gitManager/isomorphicGit.ts -var IsomorphicGit = class extends GitManager { - constructor(plugin) { - super(plugin); - this.FILE = 0; - this.HEAD = 1; - this.WORKDIR = 2; - this.STAGE = 3; - // Mapping from statusMatrix to git status codes based off git status --short - // See: https://isomorphic-git.org/docs/en/statusMatrix - this.status_mapping = { - "000": " ", - "003": "AD", - "020": "??", - "022": "A ", - "023": "AM", - "100": "D ", - "101": " D", - "103": "MD", - "110": "DA", - // Technically, two files: first one is deleted "D " and second one is untracked "??" - "111": " ", - "113": "MM", - "120": "DA", - // Same as "110" - "121": " M", - "122": "M ", - "123": "MM" - }; - this.noticeLength = 999999; - this.fs = new MyAdapter(this.app.vault, this.plugin); - } - getRepo() { - return { - fs: this.fs, - dir: this.plugin.settings.basePath, - gitdir: this.plugin.settings.gitDir || void 0, - onAuth: () => { - var _a2, _b; - return { - username: (_a2 = this.plugin.localStorage.getUsername()) != null ? _a2 : void 0, - password: (_b = this.plugin.localStorage.getPassword()) != null ? _b : void 0 - }; - }, - onAuthFailure: async () => { - new import_obsidian7.Notice( - "Authentication failed. Please try with different credentials" - ); - const username = await new GeneralModal({ - placeholder: "Specify your username" - }).open(); - if (username) { - const password = await new GeneralModal({ - placeholder: "Specify your password/personal access token" - }).open(); - if (password) { - this.plugin.localStorage.setUsername(username); - this.plugin.localStorage.setPassword(password); - return { - username, - password - }; - } - } - return { cancel: true }; - }, - http: { - async request({ - url, - method: method2, - headers, - body - }) { - if (body) { - body = await collect2(body); - body = body.buffer; - } - const res = await (0, import_obsidian7.requestUrl)({ - url, - method: method2, - headers, - body, - throw: false - }); - return { - url, - method: method2, - headers: res.headers, - body: [new Uint8Array(res.arrayBuffer)], - statusCode: res.status, - statusMessage: res.status.toString() - }; - } - } - }; - } - async wrapFS(call) { - try { - const res = await call; - await this.fs.saveAndClear(); - return res; - } catch (error) { - await this.fs.saveAndClear(); - throw error; - } - } - async status() { - let notice; - const timeout = window.setTimeout(function() { - notice = new import_obsidian7.Notice( - "This takes longer: Getting status", - this.noticeLength - ); - }, 2e4); - try { - this.plugin.setState(1 /* status */); - const status2 = (await this.wrapFS(isomorphic_git_default.statusMatrix({ ...this.getRepo() }))).map((row) => this.getFileStatusResult(row)); - const changed = status2.filter( - (fileStatus) => fileStatus.working_dir !== " " - ); - const staged = status2.filter( - (fileStatus) => fileStatus.index !== " " && fileStatus.index !== "U" - ); - const conflicted = []; - window.clearTimeout(timeout); - notice == null ? void 0 : notice.hide(); - return { all: status2, changed, staged, conflicted }; - } catch (error) { - window.clearTimeout(timeout); - notice == null ? void 0 : notice.hide(); - this.plugin.displayError(error); - throw error; - } - } - async commitAll({ - message, - status: status2, - unstagedFiles - }) { - try { - await this.checkAuthorInfo(); - await this.stageAll({ status: status2, unstagedFiles }); - return this.commit({ message }); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async commit({ - message - }) { - try { - await this.checkAuthorInfo(); - this.plugin.setState(4 /* commit */); - const formatMessage = await this.formatCommitMessage(message); - const hadConflict = this.plugin.localStorage.getConflict(); - let parent = void 0; - if (hadConflict) { - const branchInfo = await this.branchInfo(); - parent = [branchInfo.current, branchInfo.tracking]; - } - await this.wrapFS( - isomorphic_git_default.commit({ - ...this.getRepo(), - message: formatMessage, - parent - }) - ); - this.plugin.localStorage.setConflict(false); - return; - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async stage(filepath, relativeToVault) { - const gitPath = this.getRelativeRepoPath(filepath, relativeToVault); - let vaultPath; - if (relativeToVault) { - vaultPath = filepath; - } else { - vaultPath = this.getRelativeVaultPath(filepath); - } - try { - this.plugin.setState(3 /* add */); - if (await this.app.vault.adapter.exists(vaultPath)) { - await this.wrapFS( - isomorphic_git_default.add({ ...this.getRepo(), filepath: gitPath }) - ); - } else { - await this.wrapFS( - isomorphic_git_default.remove({ ...this.getRepo(), filepath: gitPath }) - ); - } - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async stageAll({ - dir, - status: status2, - unstagedFiles - }) { - try { - if (status2) { - await Promise.all( - status2.changed.map( - (file) => file.working_dir !== "D" ? this.wrapFS( - isomorphic_git_default.add({ - ...this.getRepo(), - filepath: file.path - }) - ) : isomorphic_git_default.remove({ - ...this.getRepo(), - filepath: file.path - }) - ) - ); - } else { - const filesToStage = unstagedFiles != null ? unstagedFiles : await this.getUnstagedFiles(dir != null ? dir : "."); - await Promise.all( - filesToStage.map( - ({ filepath, deleted }) => deleted ? isomorphic_git_default.remove({ ...this.getRepo(), filepath }) : this.wrapFS( - isomorphic_git_default.add({ ...this.getRepo(), filepath }) - ) - ) - ); - } - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async unstage(filepath, relativeToVault) { - try { - this.plugin.setState(3 /* add */); - filepath = this.getRelativeRepoPath(filepath, relativeToVault); - await this.wrapFS( - isomorphic_git_default.resetIndex({ ...this.getRepo(), filepath }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async unstageAll({ - dir, - status: status2 - }) { - try { - let staged; - if (status2) { - staged = status2.staged.map((file) => file.path); - } else { - const res = await this.getStagedFiles(dir != null ? dir : "."); - staged = res.map(({ filepath }) => filepath); - } - await this.wrapFS( - Promise.all( - staged.map( - (file) => isomorphic_git_default.resetIndex({ ...this.getRepo(), filepath: file }) - ) - ) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async discard(filepath) { - try { - this.plugin.setState(3 /* add */); - await this.wrapFS( - isomorphic_git_default.checkout({ - ...this.getRepo(), - filepaths: [filepath], - force: true - }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async discardAll({ - dir, - status: status2 - }) { - let files = []; - if (status2) { - if (dir != void 0) { - files = status2.changed.filter((file) => file.path.startsWith(dir)).map((file) => file.path); - } else { - files = status2.changed.map((file) => file.path); - } - } else { - files = (await this.getUnstagedFiles(dir)).map( - ({ filepath }) => filepath - ); - } - try { - await this.wrapFS( - isomorphic_git_default.checkout({ - ...this.getRepo(), - filepaths: files, - force: true - }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - getProgressText(action, event) { - let out = `${action} progress:`; - if (event.phase) { - out = `${out} ${event.phase}:`; - } - if (event.loaded) { - out = `${out} ${event.loaded}`; - if (event.total) { - out = `${out} of ${event.total}`; - } - } - return out; - } - resolveRef(ref) { - return this.wrapFS(isomorphic_git_default.resolveRef({ ...this.getRepo(), ref })); - } - async pull() { - const progressNotice = this.showNotice("Initializing pull"); - try { - this.plugin.setState(2 /* pull */); - const localCommit = await this.resolveRef("HEAD"); - await this.fetch(); - const branchInfo = await this.branchInfo(); - await this.checkAuthorInfo(); - const mergeRes = await this.wrapFS( - isomorphic_git_default.merge({ - ...this.getRepo(), - ours: branchInfo.current, - theirs: branchInfo.tracking, - abortOnConflict: false - }) - ); - if (!mergeRes.alreadyMerged) { - await this.wrapFS( - isomorphic_git_default.checkout({ - ...this.getRepo(), - ref: branchInfo.current, - onProgress: (progress) => { - if (progressNotice !== void 0) { - progressNotice.noticeEl.innerText = this.getProgressText("Checkout", progress); - } - }, - remote: branchInfo.remote - }) - ); - } - progressNotice == null ? void 0 : progressNotice.hide(); - const upstreamCommit = await this.resolveRef("HEAD"); - const changedFiles = await this.getFileChangesCount( - localCommit, - upstreamCommit - ); - this.showNotice("Finished pull", false); - return changedFiles.map((file) => ({ - path: file.path, - working_dir: "P", - index: "P", - vault_path: this.getRelativeVaultPath(file.path) - })); - } catch (error) { - progressNotice == null ? void 0 : progressNotice.hide(); - if (error instanceof Errors.MergeConflictError) { - this.plugin.handleConflict( - error.data.filepaths.map( - (file) => this.getRelativeVaultPath(file) - ) - ); - } - this.plugin.displayError(error); - throw error; - } - } - async push() { - if (!await this.canPush()) { - return 0; - } - const progressNotice = this.showNotice("Initializing push"); - try { - this.plugin.setState(1 /* status */); - const status2 = await this.branchInfo(); - const trackingBranch = status2.tracking; - const currentBranch2 = status2.current; - const numChangedFiles = (await this.getFileChangesCount(currentBranch2, trackingBranch)).length; - this.plugin.setState(5 /* push */); - await this.wrapFS( - isomorphic_git_default.push({ - ...this.getRepo(), - onProgress: (progress) => { - if (progressNotice !== void 0) { - progressNotice.noticeEl.innerText = this.getProgressText("Pushing", progress); - } - } - }) - ); - progressNotice == null ? void 0 : progressNotice.hide(); - return numChangedFiles; - } catch (error) { - progressNotice == null ? void 0 : progressNotice.hide(); - this.plugin.displayError(error); - throw error; - } - } - async getUnpushedCommits() { - const status2 = await this.branchInfo(); - const trackingBranch = status2.tracking; - const currentBranch2 = status2.current; - if (trackingBranch == null || currentBranch2 == null) { - return 0; - } - const localCommit = await this.resolveRef(currentBranch2); - const upstreamCommit = await this.resolveRef(trackingBranch); - const changedFiles = await this.getFileChangesCount( - localCommit, - upstreamCommit - ); - return changedFiles.length; - } - async canPush() { - const status2 = await this.branchInfo(); - const trackingBranch = status2.tracking; - const currentBranch2 = status2.current; - const current = await this.resolveRef(currentBranch2); - const tracking = await this.resolveRef(trackingBranch); - return current != tracking; - } - async checkRequirements() { - const headExists = await this.plugin.app.vault.adapter.exists( - `${this.getRepo().dir}/.git/HEAD` - ); - return headExists ? "valid" : "missing-repo"; - } - async branchInfo() { - var _a2, _b; - try { - const current = await isomorphic_git_default.currentBranch(this.getRepo()) || ""; - const branches = await isomorphic_git_default.listBranches(this.getRepo()); - const remote = (_a2 = await this.getConfig(`branch.${current}.remote`)) != null ? _a2 : "origin"; - const trackingBranch = (_b = await this.getConfig(`branch.${current}.merge`)) == null ? void 0 : _b.split("refs/heads")[1]; - const tracking = trackingBranch ? remote + trackingBranch : void 0; - return { - current, - tracking, - branches, - remote - }; - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async getCurrentRemote() { - var _a2; - const current = await isomorphic_git_default.currentBranch(this.getRepo()) || ""; - const remote = (_a2 = await this.getConfig(`branch.${current}.remote`)) != null ? _a2 : "origin"; - return remote; - } - async checkout(branch2, remote) { - try { - return this.wrapFS( - isomorphic_git_default.checkout({ - ...this.getRepo(), - ref: branch2, - force: !!remote, - remote - }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async createBranch(branch2) { - try { - await this.wrapFS( - isomorphic_git_default.branch({ ...this.getRepo(), ref: branch2, checkout: true }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async deleteBranch(branch2) { - try { - await this.wrapFS( - isomorphic_git_default.deleteBranch({ ...this.getRepo(), ref: branch2 }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async branchIsMerged(_) { - return true; - } - async init() { - try { - await this.wrapFS(isomorphic_git_default.init(this.getRepo())); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async clone(url, dir, depth) { - const progressNotice = this.showNotice("Initializing clone"); - try { - await this.wrapFS( - isomorphic_git_default.clone({ - ...this.getRepo(), - dir, - url, - depth, - onProgress: (progress) => { - if (progressNotice !== void 0) { - progressNotice.noticeEl.innerText = this.getProgressText("Cloning", progress); - } - } - }) - ); - progressNotice == null ? void 0 : progressNotice.hide(); - } catch (error) { - progressNotice == null ? void 0 : progressNotice.hide(); - this.plugin.displayError(error); - throw error; - } - } - async setConfig(path2, value) { - try { - return this.wrapFS( - isomorphic_git_default.setConfig({ - ...this.getRepo(), - path: path2, - value - }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async getConfig(path2) { - try { - return this.wrapFS( - isomorphic_git_default.getConfig({ - ...this.getRepo(), - path: path2 - }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async fetch(remote) { - const progressNotice = this.showNotice("Initializing fetch"); - try { - const args = { - ...this.getRepo(), - onProgress: (progress) => { - if (progressNotice !== void 0) { - progressNotice.noticeEl.innerText = this.getProgressText("Fetching", progress); - } - }, - remote: remote != null ? remote : await this.getCurrentRemote() - }; - await this.wrapFS(isomorphic_git_default.fetch(args)); - progressNotice == null ? void 0 : progressNotice.hide(); - } catch (error) { - this.plugin.displayError(error); - progressNotice == null ? void 0 : progressNotice.hide(); - throw error; - } - } - async setRemote(name, url) { - try { - await this.wrapFS( - isomorphic_git_default.addRemote({ - ...this.getRepo(), - remote: name, - url, - force: true - }) - ); - } catch (error) { - this.plugin.displayError(error); - throw error; - } - } - async getRemoteBranches(remote) { - let remoteBranches = []; - remoteBranches.push( - ...await this.wrapFS( - isomorphic_git_default.listBranches({ ...this.getRepo(), remote }) - ) - ); - remoteBranches.remove("HEAD"); - remoteBranches = remoteBranches.map((e) => `${remote}/${e}`); - return remoteBranches; - } - async getRemotes() { - return (await this.wrapFS(isomorphic_git_default.listRemotes({ ...this.getRepo() }))).map( - (remoteUrl) => remoteUrl.remote - ); - } - async removeRemote(remoteName) { - await this.wrapFS( - isomorphic_git_default.deleteRemote({ ...this.getRepo(), remote: remoteName }) - ); - } - async getRemoteUrl(remote) { - var _a2; - return (_a2 = (await this.wrapFS(isomorphic_git_default.listRemotes({ ...this.getRepo() }))).filter((item) => item.remote == remote)[0]) == null ? void 0 : _a2.url; - } - async log(_, __ = true, limit) { - const logs = await this.wrapFS( - isomorphic_git_default.log({ ...this.getRepo(), depth: limit }) - ); - return Promise.all( - logs.map(async (log2) => { - const completeMessage = log2.commit.message.split("\n\n"); - return { - message: completeMessage[0], - author: { - name: log2.commit.author.name, - email: log2.commit.author.email - }, - body: completeMessage.slice(1).join("\n\n"), - date: new Date( - log2.commit.committer.timestamp - ).toDateString(), - diff: { - changed: 0, - files: (await this.getFileChangesCount( - log2.commit.parent.first(), - log2.oid - )).map((item) => { - return { - path: item.path, - status: item.type, - vault_path: this.getRelativeVaultPath( - item.path - ), - hash: log2.oid, - binary: void 0 - }; - }) - }, - hash: log2.oid, - refs: [] - }; - }) - ); - } - updateBasePath(basePath) { - this.getRepo().dir = basePath; - } - async updateUpstreamBranch(remoteBranch) { - const [remote, branch2] = splitRemoteBranch(remoteBranch); - const branchInfo = await this.branchInfo(); - await this.setConfig( - `branch.${branchInfo.current}.merge`, - `refs/heads/${branch2}` - ); - await this.setConfig(`branch.${branch2}.remote`, remote); - } - updateGitPath(_) { - return; - } - async getFileChangesCount(commitHash1, commitHash2) { - return this.walkDifference({ - walkers: [ - isomorphic_git_default.TREE({ ref: commitHash1 }), - isomorphic_git_default.TREE({ ref: commitHash2 }) - ] - }); - } - async walkDifference({ - walkers, - dir: base - }) { - const res = await this.wrapFS( - isomorphic_git_default.walk({ - ...this.getRepo(), - trees: walkers, - map: async function(filepath, [A, B]) { - if (!worthWalking2(filepath, base)) { - return null; - } - if (await (A == null ? void 0 : A.type()) === "tree" || await (B == null ? void 0 : B.type()) === "tree") { - return; - } - const Aoid = await (A == null ? void 0 : A.oid()); - const Boid = await (B == null ? void 0 : B.oid()); - let type = "equal"; - if (Aoid !== Boid) { - type = "M"; - } - if (Aoid === void 0) { - type = "A"; - } - if (Boid === void 0) { - type = "D"; - } - if (Aoid === void 0 && Boid === void 0) { - console.log("Something weird happened:"); - console.log(A); - console.log(B); - } - if (type === "equal") { - return; - } - return { - path: filepath, - type - }; - } - }) - ); - return res; - } - async getStagedFiles(dir = ".") { - const res = await this.walkDifference({ - walkers: [isomorphic_git_default.TREE({ ref: "HEAD" }), isomorphic_git_default.STAGE()], - dir - }); - return res.map((file) => { - return { - vault_path: this.getRelativeVaultPath(file.path), - filepath: file.path - }; - }); - } - async getUnstagedFiles(base = ".") { - let notice; - const timeout = window.setTimeout(function() { - notice = new import_obsidian7.Notice( - "This takes longer: Getting status", - this.noticeLength - ); - }, 2e4); - try { - const repo = this.getRepo(); - const res = await this.wrapFS( - //Modified from `git.statusMatrix` - isomorphic_git_default.walk({ - ...repo, - trees: [isomorphic_git_default.WORKDIR(), isomorphic_git_default.STAGE()], - map: async function(filepath, [workdir, stage]) { - if (!stage && workdir) { - const isIgnored2 = await isomorphic_git_default.isIgnored({ - ...repo, - filepath - }); - if (isIgnored2) { - return null; - } - } - if (!worthWalking2(filepath, base)) { - return null; - } - const [workdirType, stageType] = await Promise.all([ - workdir && workdir.type(), - stage && stage.type() - ]); - const isBlob = [workdirType, stageType].includes( - "blob" - ); - if ((workdirType === "tree" || workdirType === "special") && !isBlob) - return; - if (stageType === "commit") return null; - if ((stageType === "tree" || stageType === "special") && !isBlob) - return; - const stageOid = stageType === "blob" ? await stage.oid() : void 0; - let workdirOid; - if (workdirType === "blob" && stageType !== "blob") { - workdirOid = "42"; - } else if (workdirType === "blob") { - workdirOid = await workdir.oid(); - } - if (!workdirOid) { - return { - filepath, - deleted: true - }; - } - if (workdirOid !== stageOid) { - return { - filepath, - deleted: false - }; - } - return null; - } - }) - ); - window.clearTimeout(timeout); - notice == null ? void 0 : notice.hide(); - return res; - } catch (error) { - window.clearTimeout(timeout); - notice == null ? void 0 : notice.hide(); - this.plugin.displayError(error); - throw error; - } - } - async getDiffString(filePath, stagedChanges = false, hash2) { - const vaultPath = this.getRelativeVaultPath(filePath); - const map = async (file, [A]) => { - if (filePath == file) { - const oid = await A.oid(); - const contents = await isomorphic_git_default.readBlob({ - ...this.getRepo(), - oid - }); - return contents.blob; - } - }; - if (hash2) { - const commitContent = await readBlob({ - ...this.getRepo(), - filepath: filePath, - oid: hash2 - }).then((headBlob) => new TextDecoder().decode(headBlob.blob)).catch((err) => { - if (err instanceof isomorphic_git_default.Errors.NotFoundError) - return void 0; - throw err; - }); - const commit2 = await isomorphic_git_default.readCommit({ - ...this.getRepo(), - oid: hash2 - }); - const previousContent = await readBlob({ - ...this.getRepo(), - filepath: filePath, - oid: commit2.commit.parent.first() - }).then((headBlob) => new TextDecoder().decode(headBlob.blob)).catch((err) => { - if (err instanceof isomorphic_git_default.Errors.NotFoundError) - return void 0; - throw err; - }); - const diff3 = createPatch( - vaultPath, - previousContent != null ? previousContent : "", - commitContent != null ? commitContent : "" - ); - return diff3; - } - const stagedBlob = (await isomorphic_git_default.walk({ - ...this.getRepo(), - trees: [isomorphic_git_default.STAGE()], - map - })).first(); - const stagedContent = new TextDecoder().decode(stagedBlob); - if (stagedChanges) { - const headContent = await this.resolveRef("HEAD").then( - (oid) => readBlob({ - ...this.getRepo(), - filepath: filePath, - oid - }) - ).then((headBlob) => new TextDecoder().decode(headBlob.blob)).catch((err) => { - if (err instanceof isomorphic_git_default.Errors.NotFoundError) - return void 0; - throw err; - }); - const diff3 = createPatch( - vaultPath, - headContent != null ? headContent : "", - stagedContent - ); - return diff3; - } else { - let workdirContent; - if (await this.app.vault.adapter.exists(vaultPath)) { - workdirContent = await this.app.vault.adapter.read(vaultPath); - } else { - workdirContent = ""; - } - const diff3 = createPatch(vaultPath, stagedContent, workdirContent); - return diff3; - } - } - async getLastCommitTime() { - const repo = this.getRepo(); - const oid = await this.resolveRef("HEAD"); - const commit2 = await isomorphic_git_default.readCommit({ ...repo, oid }); - const date = commit2.commit.committer.timestamp; - return new Date(date * 1e3); - } - getFileStatusResult(row) { - const status2 = this.status_mapping[`${row[this.HEAD]}${row[this.WORKDIR]}${row[this.STAGE]}`]; - return { - index: status2[0] == "?" ? "U" : status2[0], - working_dir: status2[1] == "?" ? "U" : status2[1], - path: row[this.FILE], - vault_path: this.getRelativeVaultPath(row[this.FILE]) - }; - } - async checkAuthorInfo() { - const name = await this.getConfig("user.name"); - const email = await this.getConfig("user.email"); - if (!name || !email) { - throw "Git author information is not set. Please set it in the settings."; - } - } - showNotice(message, infinity = true) { - if (!this.plugin.settings.disablePopups) { - return new import_obsidian7.Notice( - message, - infinity ? this.noticeLength : void 0 - ); - } - } -}; -function fromValue2(value) { - let queue = [value]; - return { - next() { - return Promise.resolve({ - done: queue.length === 0, - value: queue.pop() - }); - }, - return() { - queue = []; - return {}; - }, - [Symbol.asyncIterator]() { - return this; - } - }; -} -function getIterator2(iterable) { - if (iterable[Symbol.asyncIterator]) { - return iterable[Symbol.asyncIterator](); - } - if (iterable[Symbol.iterator]) { - return iterable[Symbol.iterator](); - } - if (iterable.next) { - return iterable; - } - return fromValue2(iterable); -} -async function forAwait2(iterable, cb) { - const iter = getIterator2(iterable); - while (true) { - const { value, done } = await iter.next(); - if (value) await cb(value); - if (done) break; - } - if (iter.return) iter.return(); -} -async function collect2(iterable) { - let size = 0; - const buffers = []; - await forAwait2(iterable, (value) => { - buffers.push(value); - size += value.byteLength; - }); - const result = new Uint8Array(size); - let nextIndex = 0; - for (const buffer2 of buffers) { - result.set(buffer2, nextIndex); - nextIndex += buffer2.byteLength; - } - return result; -} - -// src/setting/settings.ts -var FORMAT_STRING_REFERENCE_URL = "https://momentjs.com/docs/#/parsing/string-format/"; -var LINE_AUTHOR_FEATURE_WIKI_LINK = "https://publish.obsidian.md/git-doc/Line+Authoring"; -var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab { - constructor(app2, plugin) { - super(app2, plugin); - this.plugin = plugin; - this.lineAuthorColorSettings = /* @__PURE__ */ new Map(); - } - get settings() { - return this.plugin.settings; - } - display() { - const { containerEl } = this; - const plugin = this.plugin; - const commitOrBackup = plugin.settings.differentIntervalCommitAndPush ? "commit" : "backup"; - const gitReady = plugin.gitReady; - containerEl.empty(); - if (!gitReady) { - containerEl.createEl("p", { - text: "Git is not ready. When all settings are correct you can configure auto backup, etc." - }); - containerEl.createEl("br"); - } - if (gitReady) { - new import_obsidian8.Setting(containerEl).setName("Automatic").setHeading(); - new import_obsidian8.Setting(containerEl).setName("Split automatic commit and push").setDesc("Enable to use separate timer for commit and push").addToggle( - (toggle) => toggle.setValue( - plugin.settings.differentIntervalCommitAndPush - ).onChange((value) => { - plugin.settings.differentIntervalCommitAndPush = value; - plugin.saveSettings(); - plugin.clearAutoBackup(); - plugin.clearAutoPush(); - if (plugin.settings.autoSaveInterval > 0) { - plugin.startAutoBackup( - plugin.settings.autoSaveInterval - ); - } - if (value && plugin.settings.autoPushInterval > 0) { - plugin.startAutoPush( - plugin.settings.autoPushInterval - ); - } - this.display(); - }) - ); - new import_obsidian8.Setting(containerEl).setName(`Vault ${commitOrBackup} interval (minutes)`).setDesc( - `${plugin.settings.differentIntervalCommitAndPush ? "Commit" : "Commit and push"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)` - ).addText( - (text2) => text2.setValue(String(plugin.settings.autoSaveInterval)).onChange((value) => { - if (!isNaN(Number(value))) { - plugin.settings.autoSaveInterval = Number(value); - plugin.saveSettings(); - if (plugin.settings.autoSaveInterval > 0) { - plugin.clearAutoBackup(); - plugin.startAutoBackup( - plugin.settings.autoSaveInterval - ); - new import_obsidian8.Notice( - `Automatic ${commitOrBackup} enabled! Every ${formatMinutes( - plugin.settings.autoSaveInterval - )}.` - ); - } else if (plugin.settings.autoSaveInterval <= 0) { - plugin.clearAutoBackup() && new import_obsidian8.Notice( - `Automatic ${commitOrBackup} disabled!` - ); - } - } else { - new import_obsidian8.Notice("Please specify a valid number."); - } - }) - ); - if (!plugin.settings.setLastSaveToLastCommit) - new import_obsidian8.Setting(containerEl).setName(`Auto Backup after stopping file edits`).setDesc( - `Requires the ${commitOrBackup} interval not to be 0. - If turned on, do auto ${commitOrBackup} every ${formatMinutes( - plugin.settings.autoSaveInterval - )} after stopping file edits. - This also prevents auto ${commitOrBackup} while editing a file. If turned off, it's independent from the last change.` - ).addToggle( - (toggle) => toggle.setValue(plugin.settings.autoBackupAfterFileChange).onChange((value) => { - plugin.settings.autoBackupAfterFileChange = value; - this.display(); - plugin.saveSettings(); - plugin.clearAutoBackup(); - if (plugin.settings.autoSaveInterval > 0) { - plugin.startAutoBackup( - plugin.settings.autoSaveInterval - ); - } - }) - ); - if (!plugin.settings.autoBackupAfterFileChange) - new import_obsidian8.Setting(containerEl).setName(`Auto ${commitOrBackup} after latest commit`).setDesc( - `If turned on, set last auto ${commitOrBackup} time to latest commit` - ).addToggle( - (toggle) => toggle.setValue(plugin.settings.setLastSaveToLastCommit).onChange(async (value) => { - plugin.settings.setLastSaveToLastCommit = value; - plugin.saveSettings(); - this.display(); - plugin.clearAutoBackup(); - await plugin.setUpAutoBackup(); - }) - ); - if (plugin.settings.differentIntervalCommitAndPush) { - new import_obsidian8.Setting(containerEl).setName(`Vault push interval (minutes)`).setDesc( - "Push changes every X minutes. Set to 0 (default) to disable." - ).addText( - (text2) => text2.setValue(String(plugin.settings.autoPushInterval)).onChange((value) => { - if (!isNaN(Number(value))) { - plugin.settings.autoPushInterval = Number(value); - plugin.saveSettings(); - if (plugin.settings.autoPushInterval > 0) { - plugin.clearAutoPush(); - plugin.startAutoPush( - plugin.settings.autoPushInterval - ); - new import_obsidian8.Notice( - `Automatic push enabled! Every ${formatMinutes( - plugin.settings.autoPushInterval - )}.` - ); - } else if (plugin.settings.autoPushInterval <= 0) { - plugin.clearAutoPush() && new import_obsidian8.Notice( - "Automatic push disabled!" - ); - } - } else { - new import_obsidian8.Notice( - "Please specify a valid number." - ); - } - }) - ); - } - new import_obsidian8.Setting(containerEl).setName("Auto pull interval (minutes)").setDesc( - "Pull changes every X minutes. Set to 0 (default) to disable." - ).addText( - (text2) => text2.setValue(String(plugin.settings.autoPullInterval)).onChange((value) => { - if (!isNaN(Number(value))) { - plugin.settings.autoPullInterval = Number(value); - plugin.saveSettings(); - if (plugin.settings.autoPullInterval > 0) { - plugin.clearAutoPull(); - plugin.startAutoPull( - plugin.settings.autoPullInterval - ); - new import_obsidian8.Notice( - `Automatic pull enabled! Every ${formatMinutes( - plugin.settings.autoPullInterval - )}.` - ); - } else if (plugin.settings.autoPullInterval <= 0) { - plugin.clearAutoPull() && new import_obsidian8.Notice("Automatic pull disabled!"); - } - } else { - new import_obsidian8.Notice("Please specify a valid number."); - } - }) - ); - new import_obsidian8.Setting(containerEl).setName("Specify custom commit message on auto backup").setDesc("You will get a pop up to specify your message").addToggle( - (toggle) => toggle.setValue(plugin.settings.customMessageOnAutoBackup).onChange((value) => { - plugin.settings.customMessageOnAutoBackup = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Commit message on auto backup/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)" - ).addTextArea( - (text2) => text2.setPlaceholder("vault backup: {{date}}").setValue(plugin.settings.autoCommitMessage).onChange((value) => { - plugin.settings.autoCommitMessage = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Commit message").setHeading(); - new import_obsidian8.Setting(containerEl).setName("Commit message on manual backup/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)" - ).addTextArea( - (text2) => text2.setPlaceholder("vault backup: {{date}}").setValue( - plugin.settings.commitMessage ? plugin.settings.commitMessage : "" - ).onChange((value) => { - plugin.settings.commitMessage = value; - plugin.saveSettings(); - }) - ); - const datePlaceholderSetting = new import_obsidian8.Setting(containerEl).setName("{{date}} placeholder format").addText( - (text2) => text2.setPlaceholder(plugin.settings.commitDateFormat).setValue(plugin.settings.commitDateFormat).onChange(async (value) => { - plugin.settings.commitDateFormat = value; - await plugin.saveSettings(); - }) - ); - datePlaceholderSetting.descEl.innerHTML = ` - Specify custom date format. E.g. "${DATE_TIME_FORMAT_SECONDS}. See Moment.js for more formats.`; - new import_obsidian8.Setting(containerEl).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText( - (text2) => { - var _a2; - return text2.setValue((_a2 = plugin.localStorage.getHostname()) != null ? _a2 : "").onChange(async (value) => { - plugin.localStorage.setHostname(value); - }); - } - ); - new import_obsidian8.Setting(containerEl).setName("Preview commit message").addButton( - (button) => button.setButtonText("Preview").onClick(async () => { - const commitMessagePreview = await plugin.gitManager.formatCommitMessage( - plugin.settings.commitMessage - ); - new import_obsidian8.Notice(`${commitMessagePreview}`); - }) - ); - new import_obsidian8.Setting(containerEl).setName("List filenames affected by commit in the commit body").addToggle( - (toggle) => toggle.setValue(plugin.settings.listChangedFilesInMessageBody).onChange((value) => { - plugin.settings.listChangedFilesInMessageBody = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Backup").setHeading(); - if (plugin.gitManager instanceof SimpleGit) - new import_obsidian8.Setting(containerEl).setName("Sync Method").setDesc( - "Selects the method used for handling new changes found in your remote git repository." - ).addDropdown((dropdown) => { - const options = { - merge: "Merge", - rebase: "Rebase", - reset: "Other sync service (Only updates the HEAD without touching the working directory)" - }; - dropdown.addOptions(options); - dropdown.setValue(plugin.settings.syncMethod); - dropdown.onChange(async (option) => { - plugin.settings.syncMethod = option; - plugin.saveSettings(); - }); - }); - new import_obsidian8.Setting(containerEl).setName("Pull updates on startup").setDesc("Automatically pull updates when Obsidian starts").addToggle( - (toggle) => toggle.setValue(plugin.settings.autoPullOnBoot).onChange((value) => { - plugin.settings.autoPullOnBoot = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Push on backup").setDesc("Disable to only commit changes").addToggle( - (toggle) => toggle.setValue(!plugin.settings.disablePush).onChange((value) => { - plugin.settings.disablePush = !value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Pull changes before push").setDesc("Commit -> pull -> push (Only if pushing is enabled)").addToggle( - (toggle) => toggle.setValue(plugin.settings.pullBeforePush).onChange((value) => { - plugin.settings.pullBeforePush = value; - plugin.saveSettings(); - }) - ); - if (plugin.gitManager instanceof SimpleGit) { - new import_obsidian8.Setting(containerEl).setName("Line author information").setHeading(); - this.addLineAuthorInfoSettings(); - } - } - new import_obsidian8.Setting(containerEl).setName("History view").setHeading(); - new import_obsidian8.Setting(containerEl).setName("Show Author").setDesc("Show the author of the commit in the history view").addDropdown((dropdown) => { - const options = { - hide: "Hide", - full: "Full", - initials: "Initials" - }; - dropdown.addOptions(options); - dropdown.setValue(plugin.settings.authorInHistoryView); - dropdown.onChange(async (option) => { - plugin.settings.authorInHistoryView = option; - plugin.saveSettings(); - plugin.refresh(); - }); - }); - new import_obsidian8.Setting(containerEl).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( - (toggle) => toggle.setValue(plugin.settings.dateInHistoryView).onChange((value) => { - plugin.settings.dateInHistoryView = value; - plugin.saveSettings(); - plugin.refresh(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Source control view").setHeading(); - new import_obsidian8.Setting(containerEl).setName( - "Automatically refresh source control view on file changes" - ).setDesc( - "On slower machines this may cause lags. If so, just disable this option" - ).addToggle( - (toggle) => toggle.setValue(plugin.settings.refreshSourceControl).onChange((value) => { - plugin.settings.refreshSourceControl = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Source control view refresh interval").setDesc( - "Milliseconds to wait after file change before refreshing the Source Control View" - ).addText( - (toggle) => toggle.setValue( - plugin.settings.refreshSourceControlTimer.toString() - ).setPlaceholder("7000").onChange((value) => { - plugin.settings.refreshSourceControlTimer = Math.max( - parseInt(value), - 500 - ); - plugin.saveSettings(); - plugin.setRefreshDebouncer(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Miscellaneous").setHeading(); - new import_obsidian8.Setting(containerEl).setName("Disable notifications").setDesc( - "Disable notifications for git operations to minimize distraction (refer to status bar for updates). Errors are still shown as notifications even if you enable this setting" - ).addToggle( - (toggle) => toggle.setValue(plugin.settings.disablePopups).onChange((value) => { - plugin.settings.disablePopups = value; - this.display(); - plugin.saveSettings(); - }) - ); - if (!plugin.settings.disablePopups) - new import_obsidian8.Setting(containerEl).setName("Hide notifications for no changes").setDesc( - "Don't show notifications when there are no changes to commit/push" - ).addToggle( - (toggle) => toggle.setValue(plugin.settings.disablePopupsForNoChanges).onChange((value) => { - plugin.settings.disablePopupsForNoChanges = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Show status bar").setDesc( - "Obsidian must be restarted for the changes to take affect" - ).addToggle( - (toggle) => toggle.setValue(plugin.settings.showStatusBar).onChange((value) => { - plugin.settings.showStatusBar = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Show stage/unstage button in file menu").addToggle( - (toggle) => toggle.setValue(plugin.settings.showFileMenu).onChange((value) => { - plugin.settings.showFileMenu = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Show branch status bar").setDesc( - "Obsidian must be restarted for the changes to take affect" - ).addToggle( - (toggle) => toggle.setValue(plugin.settings.showBranchStatusBar).onChange((value) => { - plugin.settings.showBranchStatusBar = value; - plugin.saveSettings(); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Show the count of modified files in the status bar").addToggle( - (toggle) => toggle.setValue(plugin.settings.changedFilesInStatusBar).onChange((value) => { - plugin.settings.changedFilesInStatusBar = value; - plugin.saveSettings(); - }) - ); - if (plugin.gitManager instanceof IsomorphicGit) { - new import_obsidian8.Setting(containerEl).setName("Authentication/commit author").setHeading(); - } else { - new import_obsidian8.Setting(containerEl).setName("Commit author").setHeading(); - } - if (plugin.gitManager instanceof IsomorphicGit) - new import_obsidian8.Setting(containerEl).setName( - "Username on your git server. E.g. your username on GitHub" - ).addText((cb) => { - var _a2; - cb.setValue((_a2 = plugin.localStorage.getUsername()) != null ? _a2 : ""); - cb.onChange((value) => { - plugin.localStorage.setUsername(value); - }); - }); - if (plugin.gitManager instanceof IsomorphicGit) - new import_obsidian8.Setting(containerEl).setName("Password/Personal access token").setDesc( - "Type in your password. You won't be able to see it again." - ).addText((cb) => { - cb.inputEl.autocapitalize = "off"; - cb.inputEl.autocomplete = "off"; - cb.inputEl.spellcheck = false; - cb.onChange((value) => { - plugin.localStorage.setPassword(value); - }); - }); - if (plugin.gitReady) - new import_obsidian8.Setting(containerEl).setName("Author name for commit").addText(async (cb) => { - cb.setValue(await plugin.gitManager.getConfig("user.name")); - cb.onChange((value) => { - plugin.gitManager.setConfig( - "user.name", - value == "" ? void 0 : value - ); - }); - }); - if (plugin.gitReady) - new import_obsidian8.Setting(containerEl).setName("Author email for commit").addText(async (cb) => { - cb.setValue( - await plugin.gitManager.getConfig("user.email") - ); - cb.onChange((value) => { - plugin.gitManager.setConfig( - "user.email", - value == "" ? void 0 : value - ); - }); - }); - new import_obsidian8.Setting(containerEl).setName("Advanced").setHeading(); - if (plugin.gitManager instanceof SimpleGit) { - new import_obsidian8.Setting(containerEl).setName("Update submodules").setDesc( - '"Create backup" 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( - (toggle) => toggle.setValue(plugin.settings.updateSubmodules).onChange((value) => { - plugin.settings.updateSubmodules = value; - plugin.saveSettings(); - }) - ); - if (plugin.settings.updateSubmodules) { - new import_obsidian8.Setting(containerEl).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( - (toggle) => toggle.setValue(plugin.settings.submoduleRecurseCheckout).onChange((value) => { - plugin.settings.submoduleRecurseCheckout = value; - plugin.saveSettings(); - }) - ); - } - } - if (plugin.gitManager instanceof SimpleGit) - new import_obsidian8.Setting(containerEl).setName("Custom Git binary path").addText((cb) => { - var _a2; - cb.setValue((_a2 = plugin.localStorage.getGitPath()) != null ? _a2 : ""); - cb.setPlaceholder("git"); - cb.onChange((value) => { - plugin.localStorage.setGitPath(value); - plugin.gitManager.updateGitPath(value || "git"); - }); - }); - if (plugin.gitManager instanceof SimpleGit) - new import_obsidian8.Setting(containerEl).setName("Additional environment variables").setDesc( - "Use each line for a new environment variable in the format KEY=VALUE" - ).addTextArea((cb) => { - cb.setPlaceholder("GIT_DIR=/path/to/git/dir"); - cb.setValue(plugin.localStorage.getEnvVars().join("\n")); - cb.onChange((value) => { - plugin.localStorage.setEnvVars(value.split("\n")); - }); - }); - if (plugin.gitManager instanceof SimpleGit) - new import_obsidian8.Setting(containerEl).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea((cb) => { - cb.setValue(plugin.localStorage.getPATHPaths().join("\n")); - cb.onChange((value) => { - plugin.localStorage.setPATHPaths(value.split("\n")); - }); - }); - if (plugin.gitManager instanceof SimpleGit) - new import_obsidian8.Setting(containerEl).setName("Reload with new environment variables").setDesc( - "Removing previously added environment variables will not take effect until Obsidian is restarted." - ).addButton((cb) => { - cb.setButtonText("Reload"); - cb.setCta(); - cb.onClick(() => { - plugin.gitManager.setGitInstance(); - }); - }); - new import_obsidian8.Setting(containerEl).setName("Custom base path (Git repository path)").setDesc( - ` +`),date:new Date(s.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(s.commit.parent.first(),s.oid)).map(l=>({path:l.path,status:l.type,vault_path:this.getRelativeVaultPath(l.path),hash:s.oid,binary:void 0}))},hash:s.oid,refs:[]}}))}updateBasePath(n){return this.getRepo().dir=n,Promise.resolve()}async updateUpstreamBranch(n){let[r,i]=wr(n),a=await this.branchInfo();await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`),await this.setConfig(`branch.${i}.remote`,r)}updateGitPath(n){return Promise.resolve()}async getFileChangesCount(n,r){return this.walkDifference({walkers:[ae.TREE({ref:n}),ae.TREE({ref:r})]})}async walkDifference({walkers:n,dir:r}){return await this.wrapFS(ae.walk({...this.getRepo(),trees:n,map:async function(a,[s,o]){if(!ip(a,r))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.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(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(n="."){return(await this.walkDifference({walkers:[ae.TREE({ref:"HEAD"}),ae.STAGE()],dir:n})).map(i=>({vault_path:this.getRelativeVaultPath(i.path),filepath:i.path}))}async getUnstagedFiles(n="."){let r,i=window.setTimeout(()=>{r=new Qr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(ae.walk({...a,trees:[ae.WORKDIR(),ae.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await ae.isIgnored({...a,filepath:o})||!ip(o,n))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),h=[u,f].includes("blob");if((u==="tree"||u==="special")&&!h)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!h)return;let d=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?p!==d?{filepath:o,deleted:!1}:null:{filepath:o,deleted:!0}}}));return window.clearTimeout(i),r==null||r.hide(),s}catch(a){throw window.clearTimeout(i),r==null||r.hide(),this.plugin.displayError(a),a}}async getDiffString(n,r=!1,i){let a=this.getRelativeVaultPath(n),s=async(c,[u])=>{if(n==c){let f=await u.oid();return(await ae.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await ms({...this.getRepo(),filepath:n,oid:i}).then(d=>new TextDecoder().decode(d.blob)).catch(d=>{if(!(d instanceof ae.Errors.NotFoundError))throw d}),u=await ae.readCommit({...this.getRepo(),oid:i}),f=await ms({...this.getRepo(),filepath:n,oid:u.commit.parent.first()}).then(d=>new TextDecoder().decode(d.blob)).catch(d=>{if(!(d instanceof ae.Errors.NotFoundError))throw d});return vc(a,f!=null?f:"",c!=null?c:"")}let o=(await ae.walk({...this.getRepo(),trees:[ae.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(r){let c=await this.resolveRef("HEAD").then(f=>ms({...this.getRepo(),filepath:n,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ae.Errors.NotFoundError))throw f});return vc(a,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(a)?c=await this.app.vault.adapter.read(a):c="",vc(a,l,c)}}async getLastCommitTime(){let n=this.getRepo(),r=await this.resolveRef("HEAD"),a=(await ae.readCommit({...n,oid:r})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(n){let r=this.status_mapping[`${n[this.HEAD]}${n[this.WORKDIR]}${n[this.STAGE]}`];return{index:r[0]=="?"?"U":r[0],working_dir:r[1]=="?"?"U":r[1],path:n[this.FILE],vault_path:this.getRelativeVaultPath(n[this.FILE])}}async checkAuthorInfo(){let n=await this.getConfig("user.name"),r=await this.getConfig("user.email");if(!n||!r)throw Error("Git author information is not set. Please set it in the settings.")}showNotice(n,r=!0){if(!this.plugin.settings.disablePopups)return new Qr.Notice(n,r?this.noticeLength:void 0)}};function iL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function aL(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:iL(t)}async function sL(t,e){let n=aL(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function oL(t){let e=0,n=[];await sL(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}var lL="https://momentjs.com/docs/#/parsing/string-format/",cL="https://publish.obsidian.md/git-doc/Line+Authoring",bc=class extends V.PluginSettingTab{constructor(n,r){super(n,r);this.plugin=r;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:n}=this,r=this.plugin,i;r.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=r.gitReady;n.empty(),a||(n.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),n.createEl("br"));let s;if(a){new V.Setting(n).setName("Automatic").setHeading(),new V.Setting(n).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(u=>u.setValue(r.settings.differentIntervalCommitAndPush).onChange(async f=>{r.settings.differentIntervalCommitAndPush=f,await r.saveSettings(),r.automaticsManager.reload("commit","push"),this.display()})),new V.Setting(n).setName(`Auto ${i} interval (minutes)`).setDesc(`${r.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(u=>u.setValue(String(r.settings.autoSaveInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoSaveInterval=Number(f),await r.saveSettings(),r.automaticsManager.reload("commit"),r.settings.autoSaveInterval>0?new V.Notice(`Automatic ${i} enabled! Every ${$s(r.settings.autoSaveInterval)}.`):r.settings.autoSaveInterval<=0&&new V.Notice(`Automatic ${i} disabled!`))})),s=new V.Setting(n).setName(`Auto ${i} after stopping file edits`).setDesc(`Requires the ${i} interval not to be 0. + If turned on, do auto ${i} every ${$s(r.settings.autoSaveInterval)} after stopping file edits. + This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(u=>u.setValue(r.settings.autoBackupAfterFileChange).onChange(async f=>{r.settings.autoBackupAfterFileChange=f,this.display(),await r.saveSettings(),r.automaticsManager.reload("commit")})),this.mayDisableSetting(s,r.settings.setLastSaveToLastCommit),s=new V.Setting(n).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(u=>u.setValue(r.settings.setLastSaveToLastCommit).onChange(async f=>{r.settings.setLastSaveToLastCommit=f,await r.saveSettings(),r.automaticsManager.reload("commit"),this.display()})),this.mayDisableSetting(s,r.settings.autoBackupAfterFileChange),s=new V.Setting(n).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPushInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoPushInterval=Number(f),await r.saveSettings(),r.settings.autoPushInterval>0?(r.automaticsManager.reload("push"),new V.Notice(`Automatic push enabled! Every ${$s(r.settings.autoPushInterval)}.`)):r.settings.autoPushInterval<=0&&new V.Notice("Automatic push disabled!"))})),this.mayDisableSetting(s,!r.settings.differentIntervalCommitAndPush),new V.Setting(n).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPullInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoPullInterval=Number(f),await r.saveSettings(),r.settings.autoPullInterval>0?(r.automaticsManager.reload("pull"),new V.Notice(`Automatic pull enabled! Every ${$s(r.settings.autoPullInterval)}.`)):r.settings.autoPullInterval<=0&&new V.Notice("Automatic pull disabled!"))})),new V.Setting(n).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(u=>u.setValue(r.settings.customMessageOnAutoBackup).onChange(async f=>{r.settings.customMessageOnAutoBackup=f,await r.saveSettings(),this.display()})),s=new V.Setting(n).setName(`Commit message on auto ${i}`).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(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.autoCommitMessage).onChange(async f=>{r.settings.autoCommitMessage=f,await r.saveSettings()})),this.mayDisableSetting(s,r.settings.customMessageOnAutoBackup),new V.Setting(n).setName("Commit message").setHeading(),new V.Setting(n).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).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.commitMessage?r.settings.commitMessage:"").onChange(async f=>{r.settings.commitMessage=f,await r.saveSettings()}));let c=new V.Setting(n).setName("{{date}} placeholder format").addMomentFormat(u=>u.setDefaultFormat(r.settings.commitDateFormat).setValue(r.settings.commitDateFormat).onChange(async f=>{r.settings.commitDateFormat=f,await r.saveSettings()}));c.descEl.innerHTML=` + Specify custom date format. E.g. "${Dh}. See Moment.js for more formats.`,new V.Setting(n).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(u=>{var f;return u.setValue((f=r.localStorage.getHostname())!=null?f:"").onChange(h=>{r.localStorage.setHostname(h)})}),new V.Setting(n).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await r.gitManager.formatCommitMessage(r.settings.commitMessage);new V.Notice(`${f}`)})),new V.Setting(n).setName("List filenames affected by commit in the commit body").addToggle(u=>u.setValue(r.settings.listChangedFilesInMessageBody).onChange(async f=>{r.settings.listChangedFilesInMessageBody=f,await r.saveSettings()})),new V.Setting(n).setName("Pull").setHeading(),r.gitManager instanceof Le&&new V.Setting(n).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(u=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};u.addOptions(f),u.setValue(r.settings.syncMethod),u.onChange(async h=>{r.settings.syncMethod=h,await r.saveSettings()})}),new V.Setting(n).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(u=>u.setValue(r.settings.autoPullOnBoot).onChange(async f=>{r.settings.autoPullOnBoot=f,await r.saveSettings()})),new V.Setting(n).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(),s=new V.Setting(n).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 ${r.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(u=>u.setValue(!r.settings.disablePush).onChange(async f=>{r.settings.disablePush=!f,this.display(),await r.saveSettings()})),new V.Setting(n).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 ${r.settings.disablePush?"":"and push "}only.`).addToggle(u=>u.setValue(r.settings.pullBeforePush).onChange(async f=>{r.settings.pullBeforePush=f,this.display(),await r.saveSettings()})),r.gitManager instanceof Le&&(new V.Setting(n).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new V.Setting(n).setName("History view").setHeading(),new V.Setting(n).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(r.settings.authorInHistoryView),c.onChange(async f=>{r.settings.authorInHistoryView=f,await r.saveSettings(),await r.refresh()})}),new V.Setting(n).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(r.settings.dateInHistoryView).onChange(async u=>{r.settings.dateInHistoryView=u,await r.saveSettings(),await r.refresh()})),new V.Setting(n).setName("Source control view").setHeading(),new V.Setting(n).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(r.settings.refreshSourceControl).onChange(async u=>{r.settings.refreshSourceControl=u,await r.saveSettings()})),new V.Setting(n).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>c.setValue(r.settings.refreshSourceControlTimer.toString()).setPlaceholder("7000").onChange(async u=>{r.settings.refreshSourceControlTimer=Math.max(parseInt(u),500),await r.saveSettings(),r.setRefreshDebouncer()})),new V.Setting(n).setName("Miscellaneous").setHeading(),new V.Setting(n).setName("Disable notifications").setDesc("Disable notifications for git operations to minimize distraction (refer to status bar for updates). Errors are still shown as notifications even if you enable this setting.").addToggle(c=>c.setValue(r.settings.disablePopups).onChange(async u=>{r.settings.disablePopups=u,this.display(),await r.saveSettings()})),r.settings.disablePopups||new V.Setting(n).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(r.settings.disablePopupsForNoChanges).onChange(async u=>{r.settings.disablePopupsForNoChanges=u,await r.saveSettings()})),new V.Setting(n).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showStatusBar).onChange(async u=>{r.settings.showStatusBar=u,await r.saveSettings()})),new V.Setting(n).setName("Show stage/unstage button in file menu").addToggle(c=>c.setValue(r.settings.showFileMenu).onChange(async u=>{r.settings.showFileMenu=u,await r.saveSettings()})),new V.Setting(n).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showBranchStatusBar).onChange(async u=>{r.settings.showBranchStatusBar=u,await r.saveSettings()})),new V.Setting(n).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(r.settings.changedFilesInStatusBar).onChange(async u=>{r.settings.changedFilesInStatusBar=u,await r.saveSettings()})),r.gitManager instanceof yn?new V.Setting(n).setName("Authentication/commit author").setHeading():new V.Setting(n).setName("Commit author").setHeading(),r.gitManager instanceof yn&&new V.Setting(n).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=r.localStorage.getUsername())!=null?u:""),c.onChange(f=>{r.localStorage.setUsername(f)})}),r.gitManager instanceof yn&&new V.Setting(n).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=>{r.localStorage.setPassword(u)})}),r.gitReady&&new V.Setting(n).setName("Author name for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.name")),c.onChange(async u=>{await r.gitManager.setConfig("user.name",u==""?void 0:u)})}),r.gitReady&&new V.Setting(n).setName("Author email for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.email")),c.onChange(async u=>{await r.gitManager.setConfig("user.email",u==""?void 0:u)})}),new V.Setting(n).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be requried for special setups.").setHeading(),r.gitManager instanceof Le&&(new V.Setting(n).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(r.settings.updateSubmodules).onChange(async u=>{r.settings.updateSubmodules=u,await r.saveSettings()})),r.settings.updateSubmodules&&new V.Setting(n).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(r.settings.submoduleRecurseCheckout).onChange(async u=>{r.settings.submoduleRecurseCheckout=u,await r.saveSettings()}))),r.gitManager instanceof Le&&new V.Setting(n).setName("Custom Git binary path").addText(c=>{var u;c.setValue((u=r.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{r.localStorage.setGitPath(f),r.gitManager.updateGitPath(f||"git").catch(h=>r.displayError(h))})}),r.gitManager instanceof Le&&new V.Setting(n).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(r.localStorage.getEnvVars().join(` +`)),c.onChange(u=>{r.localStorage.setEnvVars(u.split(` +`))})}),r.gitManager instanceof Le&&new V.Setting(n).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(r.localStorage.getPATHPaths().join(` +`)),c.onChange(u=>{r.localStorage.setPATHPaths(u.split(` +`))})}),r.gitManager instanceof Le&&new V.Setting(n).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 r.gitManager.setGitInstance()})}),new V.Setting(n).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((cb) => { - cb.setValue(plugin.settings.basePath); - cb.setPlaceholder("directory/directory-with-git-repo"); - cb.onChange((value) => { - plugin.settings.basePath = value; - plugin.saveSettings(); - plugin.gitManager.updateBasePath(value || ""); - }); - }); - new import_obsidian8.Setting(containerEl).setName("Custom Git directory path (Instead of '.git')").setDesc( - `Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.` - ).addText((cb) => { - cb.setValue(plugin.settings.gitDir); - cb.setPlaceholder(".git"); - cb.onChange((value) => { - plugin.settings.gitDir = value; - plugin.saveSettings(); - }); - }); - new import_obsidian8.Setting(containerEl).setName("Disable on this device").setDesc( - "Disables the plugin on this device. This setting is not synced." - ).addToggle( - (toggle) => toggle.setValue(plugin.localStorage.getPluginDisabled()).onChange((value) => { - plugin.localStorage.setPluginDisabled(value); - if (value) { - plugin.unloadPlugin(); - } else { - plugin.loadPlugin(); - } - new import_obsidian8.Notice( - "Obsidian must be restarted for the changes to take affect" - ); - }) - ); - new import_obsidian8.Setting(containerEl).setName("Donate").setDesc( - "If you like this Plugin, consider donating to support continued development." - ).addButton((bt) => { - bt.buttonEl.outerHTML = "Buy Me a Coffee at ko-fi.com"; - }); - const info = containerEl.createDiv(); - info.setAttr("align", "center"); - info.setText( - "Debugging and logging:\nYou can always see the logs of this and every other plugin by opening the console with" - ); - const keys = containerEl.createDiv(); - keys.setAttr("align", "center"); - keys.addClass("obsidian-git-shortcuts"); - if (import_obsidian8.Platform.isMacOS === true) { - keys.createEl("kbd", { text: "CMD (\u2318) + OPTION (\u2325) + I" }); - } else { - keys.createEl("kbd", { text: "CTRL + SHIFT + I" }); - } - } - configureLineAuthorShowStatus(show) { - this.settings.lineAuthor.show = show; - this.plugin.saveSettings(); - if (show) this.plugin.lineAuthoringFeature.activateFeature(); - else this.plugin.lineAuthoringFeature.deactivateFeature(); - } - /** - * Persists the setting {@link key} with value {@link value} and - * refreshes the line author info views. - */ - lineAuthorSettingHandler(key2, value) { - this.settings.lineAuthor[key2] = value; - this.plugin.saveSettings(); - this.plugin.lineAuthoringFeature.refreshLineAuthorViews(); - } - /** - * Ensure, that certain last shown values are persisten in the settings. - * - * Necessary for the line author info gutter context menus. - */ - beforeSaveSettings() { - const laSettings = this.settings.lineAuthor; - if (laSettings.authorDisplay !== "hide") { - laSettings.lastShownAuthorDisplay = laSettings.authorDisplay; - } - if (laSettings.dateTimeFormatOptions !== "hide") { - laSettings.lastShownDateTimeFormatOptions = laSettings.dateTimeFormatOptions; - } - } - addLineAuthorInfoSettings() { - const baseLineAuthorInfoSetting = new import_obsidian8.Setting(this.containerEl).setName( - "Show commit authoring information next to each line" - ); - if (!this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()) { - baseLineAuthorInfoSetting.setDesc("Only available on desktop currently.").setDisabled(true); - } - baseLineAuthorInfoSetting.descEl.innerHTML = ` - Feature guide and quick examples
- The commit hash, author name and authoring date can all be individually toggled.
Hide everything, to only show the age-colored sidebar.`; - baseLineAuthorInfoSetting.addToggle( - (toggle) => toggle.setValue(this.settings.lineAuthor.show).onChange((value) => { - this.configureLineAuthorShowStatus(value); - this.display(); - }) - ); - if (this.settings.lineAuthor.show) { - const trackMovement = new import_obsidian8.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown((dropdown) => { - dropdown.addOptions({ - inactive: "Do not follow (default)", - "same-commit": "Follow within same commit", - "all-commits": "Follow within all commits (maybe slow)" - }); - dropdown.setValue(this.settings.lineAuthor.followMovement); - dropdown.onChange( - (value) => this.lineAuthorSettingHandler("followMovement", value) - ); - }); - trackMovement.descEl.innerHTML = ` + `).addText(c=>{c.setValue(r.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{r.settings.basePath=u,await r.saveSettings(),r.gitManager.updateBasePath(u||"").catch(f=>r.displayError(f))})}),new V.Setting(n).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(r.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{r.settings.gitDir=u,await r.saveSettings()})}),new V.Setting(n).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(r.localStorage.getPluginDisabled()).onChange(u=>{r.localStorage.setPluginDisabled(u),u?r.unloadPlugin():r.init({fromReload:!0}).catch(f=>r.displayError(f)),new V.Notice("Obsidian must be restarted for the changes to take affect.")})),new V.Setting(n).setName("Support").setHeading(),new V.Setting(n).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{c.buttonEl.outerHTML="Buy Me a Coffee at ko-fi.com"});let o=n.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 V.Notice("Debug information copied to clipboard. May contain sensitive information!")},V.Platform.isDesktopApp){let c=n.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=n.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),V.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(n,r){r&&(n.setDisabled(r),n.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(n){this.settings.lineAuthor.show=n,this.plugin.saveSettings(),n?this.plugin.lineAuthoringFeature.activateFeature():this.plugin.lineAuthoringFeature.deactivateFeature()}async lineAuthorSettingHandler(n,r){this.settings.lineAuthor[n]=r,await this.plugin.saveSettings(),this.plugin.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let n=this.settings.lineAuthor;n.authorDisplay!=="hide"&&(n.lastShownAuthorDisplay=n.authorDisplay),n.dateTimeFormatOptions!=="hide"&&(n.lastShownDateTimeFormatOptions=n.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let n=new V.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.innerHTML=` + Feature guide and quick examples
+ The commit hash, author name and authoring date can all be individually toggled.
Hide everything, to only show the age-colored sidebar.`,n.addToggle(r=>r.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.display()})),this.settings.lineAuthor.show){let r=new V.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(a=>{a.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),a.setValue(this.settings.lineAuthor.followMovement),a.onChange(s=>this.lineAuthorSettingHandler("followMovement",s))});if(r.descEl.innerHTML=` By default (deactivated), each line only shows the newest commit where it was changed.
With same commit, cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown. @@ -32918,119 +148,12 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab { With all commits, cut-copy-paste-ing text inbetween multiple commits will be detected.
It uses git-blame and - for matches (at least ${GIT_LINE_AUTHORING_MOVEMENT_DETECTION_MINIMAL_LENGTH} characters) within the same (or all) commit(s), the originating commit's information is shown.`; - new import_obsidian8.Setting(this.containerEl).setName("Show commit hash").addToggle((tgl) => { - tgl.setValue(this.settings.lineAuthor.showCommitHash); - tgl.onChange( - async (value) => this.lineAuthorSettingHandler("showCommitHash", value) - ); - }); - new import_obsidian8.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown((dropdown) => { - const options = { - hide: "Hide", - initials: "Initials (default)", - "first name": "First name", - "last name": "Last name", - full: "Full name" - }; - dropdown.addOptions(options); - dropdown.setValue(this.settings.lineAuthor.authorDisplay); - dropdown.onChange( - async (value) => this.lineAuthorSettingHandler("authorDisplay", value) - ); - }); - new import_obsidian8.Setting(this.containerEl).setName("Authoring date display").setDesc( - "If and how the date and time of authoring the line is displayed" - ).addDropdown((dropdown) => { - const options = { - hide: "Hide", - date: "Date (default)", - datetime: "Date and time", - "natural language": "Natural language", - custom: "Custom" - }; - dropdown.addOptions(options); - dropdown.setValue( - this.settings.lineAuthor.dateTimeFormatOptions - ); - dropdown.onChange( - async (value) => { - this.lineAuthorSettingHandler( - "dateTimeFormatOptions", - value - ); - this.display(); - } - ); - }); - if (this.settings.lineAuthor.dateTimeFormatOptions === "custom") { - const dateTimeFormatCustomStringSetting = new import_obsidian8.Setting( - this.containerEl - ); - dateTimeFormatCustomStringSetting.setName("Custom authoring date format").addText((cb) => { - cb.setValue( - this.settings.lineAuthor.dateTimeFormatCustomString - ); - cb.setPlaceholder("YYYY-MM-DD HH:mm"); - cb.onChange((value) => { - this.lineAuthorSettingHandler( - "dateTimeFormatCustomString", - value - ); - dateTimeFormatCustomStringSetting.descEl.innerHTML = this.previewCustomDateTimeDescriptionHtml( - value - ); - }); - }); - dateTimeFormatCustomStringSetting.descEl.innerHTML = this.previewCustomDateTimeDescriptionHtml( - this.settings.lineAuthor.dateTimeFormatCustomString - ); - } - new import_obsidian8.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown((dropdown) => { - const options = { - "viewer-local": "My local (default)", - "author-local": "Author's local", - utc0000: "UTC+0000/Z" - }; - dropdown.addOptions(options); - dropdown.setValue( - this.settings.lineAuthor.dateTimeTimezone - ); - dropdown.onChange( - async (value) => this.lineAuthorSettingHandler("dateTimeTimezone", value) - ); - }).descEl.innerHTML = ` + for matches (at least ${Sl} characters) within the same (or all) commit(s), the originating commit's information is shown.`,new V.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new V.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new V.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.display()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new V.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new V.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=` 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 UTC\xB100:00. - `; - const oldestAgeSetting = new import_obsidian8.Setting(this.containerEl).setName( - "Oldest age in coloring" - ); - oldestAgeSetting.descEl.innerHTML = this.previewOldestAgeDescriptionHtml( - this.settings.lineAuthor.coloringMaxAge - )[0]; - oldestAgeSetting.addText((text2) => { - text2.setPlaceholder("1y"); - text2.setValue(this.settings.lineAuthor.coloringMaxAge); - text2.onChange((value) => { - const [preview, valid] = this.previewOldestAgeDescriptionHtml(value); - oldestAgeSetting.descEl.innerHTML = preview; - if (valid) { - this.lineAuthorSettingHandler("coloringMaxAge", value); - this.refreshColorSettingsName("oldest"); - } - }); - }); - this.createColorSetting("newest"); - this.createColorSetting("oldest"); - new import_obsidian8.Setting(this.containerEl).setName("Text color").addText((field) => { - field.setValue(this.settings.lineAuthor.textColorCss); - field.onChange((value) => { - this.lineAuthorSettingHandler("textColorCss", value); - }); - }).descEl.innerHTML = ` + `;let i=new V.Setting(this.containerEl).setName("Oldest age in coloring");i.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],i.addText(a=>{a.setPlaceholder("1y"),a.setValue(this.settings.lineAuthor.coloringMaxAge),a.onChange(async s=>{let[o,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(await this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new V.Setting(this.containerEl).setName("Text color").addText(a=>{a.setValue(this.settings.lineAuthor.textColorCss),a.onChange(async s=>{await this.lineAuthorSettingHandler("textColorCss",s)})}).descEl.innerHTML=` The CSS color of the gutter text.
It is higly recommended to use @@ -33044,13 +167,7 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab { See: List of available CSS variables in Obsidian - `; - new import_obsidian8.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle((tgl) => { - tgl.setValue(this.settings.lineAuthor.ignoreWhitespace); - tgl.onChange( - (value) => this.lineAuthorSettingHandler("ignoreWhitespace", value) - ); - }).descEl.innerHTML = ` + `,new V.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(a=>{a.setValue(this.settings.lineAuthor.ignoreWhitespace),a.onChange(s=>this.lineAuthorSettingHandler("ignoreWhitespace",s))}).descEl.innerHTML=` Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). @@ -33061,11670 +178,137 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab { 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(which) { - const setting = new import_obsidian8.Setting(this.containerEl).setName("").addText((text2) => { - const color = pickColor(which, this.settings.lineAuthor); - const defaultColor = pickColor( - which, - DEFAULT_SETTINGS.lineAuthor - ); - text2.setPlaceholder(rgbToString(defaultColor)); - text2.setValue(rgbToString(color)); - text2.onChange((colorNew) => { - const rgb = convertToRgb(colorNew); - if (rgb !== void 0) { - const key2 = which === "newest" ? "colorNew" : "colorOld"; - this.lineAuthorSettingHandler(key2, rgb); - } - this.refreshColorSettingsDesc(which, rgb); - }); - }); - this.lineAuthorColorSettings.set(which, setting); - this.refreshColorSettingsName(which); - this.refreshColorSettingsDesc( - which, - pickColor(which, this.settings.lineAuthor) - ); - } - refreshColorSettingsName(which) { - const settingsDom = this.lineAuthorColorSettings.get(which); - if (settingsDom) { - const whichDescriber = which === "oldest" ? `oldest (${this.settings.lineAuthor.coloringMaxAge} or older)` : "newest"; - settingsDom.nameEl.innerText = `Color for ${whichDescriber} commits`; - } - } - refreshColorSettingsDesc(which, rgb) { - const settingsDom = this.lineAuthorColorSettings.get(which); - if (settingsDom) { - settingsDom.descEl.innerHTML = this.colorSettingPreviewDescHtml( - which, - this.settings.lineAuthor, - rgb !== void 0 - ); - } - } - colorSettingPreviewDescHtml(which, laSettings, colorIsValid) { - const rgbStr = colorIsValid ? previewColor(which, laSettings) : `rgba(127,127,127,0.3)`; - const today = import_obsidian8.moment.unix(import_obsidian8.moment.now() / 1e3).format("YYYY-MM-DD"); - const text2 = colorIsValid ? `abcdef Author Name ${today}` : "invalid color"; - const preview = `
{let a=vp(n,this.settings.lineAuthor),s=vp(n,Mn.lineAuthor);i.setPlaceholder(ap(s)),i.setValue(ap(a)),i.onChange(async o=>{let l=kS(o);if(l!==void 0){let c=n==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(n,l)})});this.lineAuthorColorSettings.set(n,r),this.refreshColorSettingsName(n),this.refreshColorSettingsDesc(n,vp(n,this.settings.lineAuthor))}refreshColorSettingsName(n){let r=this.lineAuthorColorSettings.get(n);if(r){let i=n==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";r.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(n,r){let i=this.lineAuthorColorSettings.get(n);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(n,this.settings.lineAuthor,r!==void 0))}colorSettingPreviewDescHtml(n,r,i){let a=i?wp(n,r):"rgba(127,127,127,0.3)",s=V.moment.unix(V.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and + named colors (e.g. 'black', 'purple'). Color preview: ${`
${text2}
`; - return `Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and - named colors (e.g. 'black', 'purple'). Color preview: ${preview}`; - } - previewCustomDateTimeDescriptionHtml(dateTimeFormatCustomString) { - const formattedDateTime = (0, import_obsidian8.moment)().format(dateTimeFormatCustomString); - return `
Format string to display the authoring date.
Currently: ${formattedDateTime}`; - } - previewOldestAgeDescriptionHtml(coloringMaxAge) { - const duration = parseColoringMaxAgeDuration(coloringMaxAge); - const durationString = duration !== void 0 ? `${duration.asDays()} days` : "invalid!"; - return [ - `The oldest age in the line author coloring. Everything older will have the same color. -
Smallest valid age is "1d". Currently: ${durationString}`, - duration - ]; - } -}; -function pickColor(which, las) { - return which === "oldest" ? las.colorOld : las.colorNew; -} -function parseColoringMaxAgeDuration(durationString) { - const duration = import_obsidian8.moment.duration("P" + durationString.toUpperCase()); - return duration.isValid() && duration.asDays() && duration.asDays() >= 1 ? duration : void 0; -} - -// src/lineAuthor/model.ts -function lineAuthoringId(head, objHash, path2) { - if (head === void 0 || objHash === void 0 || path2 === void 0) { - return void 0; - } - return `head${head}-obj${objHash}-path${path2}`; -} -var LineAuthoringContainerType = import_state.Annotation.define(); -function newComputationResultAsTransaction(key2, la, state) { - return state.update({ - annotations: LineAuthoringContainerType.of({ - key: key2, - la, - lineOffsetsFromUnsavedChanges: /* @__PURE__ */ new Map() - }) - }); -} -function getLineAuthorAnnotation(tr) { - return tr.annotation(LineAuthoringContainerType); -} -var lineAuthorState = import_state.StateField.define({ - create: (_state) => void 0, - /** - * The state can be updated from either an annotated transaction containing - * the newest line authoring (for the saved document) - or from - * unsaved changes of the document as the user is actively typing in the editor. - * - * In the first case, we take the new line authoring and discard anything we had remembered - * from unsaved changes. In the second case, we use the unsaved changes in {@link enrichUnsavedChanges} to pre-compute information to immediately update the - * line author gutter without needing to wait until the document is saved and the - * line authoring is properly computed. - */ - update: (previous, transaction) => { - var _a2; - return (_a2 = getLineAuthorAnnotation(transaction)) != null ? _a2 : enrichUnsavedChanges(transaction, previous); - }, - // compare cache keys. - // equality rate is >= 95% :) - // hence avoids recomputation of views - compare: (l, r) => (l == null ? void 0 : l.key) === (r == null ? void 0 : r.key) -}); -function laStateDigest(laState) { - var _a2; - const digest = import_js_sha256.sha256.create(); - if (!laState) return digest; - const { la, key: key2, lineOffsetsFromUnsavedChanges } = laState; - digest.update(la === "untracked" ? "t" : "f"); - digest.update(key2); - for (const [k, v] of (_a2 = lineOffsetsFromUnsavedChanges.entries()) != null ? _a2 : []) - digest.update([k, v]); - return digest; -} -var latestSettings = { - get: void 0, - save: void 0 -}; -function provideSettingsAccess(settingsGetter, settingsSetter) { - latestSettings.get = settingsGetter; - latestSettings.save = settingsSetter; -} -function maxAgeInDaysFromSettings(settings) { - var _a2, _b; - return (_b = (_a2 = parseColoringMaxAgeDuration(settings.coloringMaxAge)) == null ? void 0 : _a2.asDays()) != null ? _b : parseColoringMaxAgeDuration( - DEFAULT_SETTINGS.lineAuthor.coloringMaxAge - ).asDays(); -} -function enrichUnsavedChanges(tr, prev) { - if (!prev) return void 0; - if (!tr.changes.empty) { - tr.changes.iterChanges((fromA, toA, fromB, toB) => { - var _a2; - const oldDoc = tr.startState.doc; - const { newDoc } = tr; - const beforeFrom = oldDoc.lineAt(fromA).number; - const beforeTo = oldDoc.lineAt(toA).number; - const afterFrom = newDoc.lineAt(fromB).number; - const afterTo = newDoc.lineAt(toB).number; - const beforeLen = beforeTo - beforeFrom + 1; - const afterLen = afterTo - afterFrom + 1; - for (let afterI = afterFrom; afterI <= afterTo; afterI++) { - let offset = (_a2 = prev.lineOffsetsFromUnsavedChanges.get(afterI)) != null ? _a2 : 0; - const isLastLine = afterTo === afterI; - const changeInNumberOfLines = afterLen - beforeLen; - if (isLastLine) offset += changeInNumberOfLines; - prev.lineOffsetsFromUnsavedChanges.set(afterI, offset); - } - }); - } - return prev; -} - -// src/lineAuthor/control.ts -var LineAuthoringSubscriber = class { - // remember path to detect and adapt to renames - constructor(state) { - this.state = state; - this.subscribeMe(); - } - async notifyLineAuthoring(id, la) { - if (this.view === void 0) { - console.warn( - `Git: View is not defined for editor cache key. Unforeseen situation. id: ${id}` - ); - return; - } - const state = this.view.state; - const transaction = newComputationResultAsTransaction(id, la, state); - this.view.dispatch(transaction); - } - updateToNewState(state) { - const filepathChanged = this.lastSeenPath && this.filepath != this.lastSeenPath; - this.state = state; - if (filepathChanged) { - this.unsubscribeMe(this.lastSeenPath); - this.subscribeMe(); - } - return this; - } - removeIfStale() { - if (this.view.destroyed) { - this.unsubscribeMe(this.lastSeenPath); - } - } - subscribeMe() { - if (this.filepath === void 0) return; - eventsPerFilePathSingleton.ifFilepathDefinedTransformSubscribers( - this.filepath, - (subs) => subs.add(this) - ); - this.lastSeenPath = this.filepath; - } - unsubscribeMe(oldFilepath) { - eventsPerFilePathSingleton.ifFilepathDefinedTransformSubscribers( - oldFilepath, - (subs) => subs.delete(this) - ); - } - get filepath() { - var _a2, _b; - return (_b = (_a2 = this.state.field(import_obsidian9.editorViewField)) == null ? void 0 : _a2.file) == null ? void 0 : _b.path; - } - get view() { - return this.state.field(import_obsidian9.editorEditorField); - } -}; -var subscribeNewEditor = import_state2.StateField.define({ - create: (state) => new LineAuthoringSubscriber(state), - update: (v, transaction) => v.updateToNewState(transaction.state), - compare: (a, b) => a === b -}); - -// src/lineAuthor/view/cache.ts -init_polyfill_buffer(); -function clearViewCache() { - longestRenderedGutter = void 0; - renderedAgeInDaysForAdaptiveInitialColoring = []; - ageIdx = 0; - gutterInstances.clear(); - gutterMarkersRangeSet.clear(); - attachedGutterElements.clear(); -} -var longestRenderedGutter = void 0; -var getLongestRenderedGutter = () => longestRenderedGutter; -function conditionallyUpdateLongestRenderedGutter(gutter2, text2) { - var _a2; - const length = text2.length; - if (length < ((_a2 = longestRenderedGutter == null ? void 0 : longestRenderedGutter.length) != null ? _a2 : 0)) return; - longestRenderedGutter = { gutter: gutter2, length, text: text2 }; - const settings = latestSettings.get(); - if (length !== settings.gutterSpacingFallbackLength) { - settings.gutterSpacingFallbackLength = length; - latestSettings.save(settings); - } -} -var renderedAgeInDaysForAdaptiveInitialColoring = []; -var ADAPTIVE_INITIAL_COLORING_AGE_CACHE_SIZE = 15; -var ageIdx = 0; -function recordRenderedAgeInDays(age) { - renderedAgeInDaysForAdaptiveInitialColoring[ageIdx] = age; - ageIdx = (ageIdx + 1) % ADAPTIVE_INITIAL_COLORING_AGE_CACHE_SIZE; -} -function computeAdaptiveInitialColoringAgeInDays() { - return median(renderedAgeInDaysForAdaptiveInitialColoring); -} -var gutterInstances = /* @__PURE__ */ new Map(); -var gutterMarkersRangeSet = /* @__PURE__ */ new Map(); -var attachedGutterElements = /* @__PURE__ */ new Set(); - -// src/lineAuthor/view/view.ts -init_polyfill_buffer(); -var import_state3 = require("@codemirror/state"); -var import_view2 = require("@codemirror/view"); - -// src/lineAuthor/view/gutter/gutter.ts -init_polyfill_buffer(); -var import_view = require("@codemirror/view"); -var import_js_sha2562 = __toESM(require_sha256()); -var import_obsidian10 = require("obsidian"); - -// src/lineAuthor/view/contextMenu.ts -init_polyfill_buffer(); - -// src/lineAuthor/view/gutter/gutterElementSearch.ts -init_polyfill_buffer(); -var mouseXY = { x: -10, y: -10 }; -function prepareGutterSearchForContextMenuHandling() { - if (mouseXY.x === -10) { - window.addEventListener("mousedown", (e) => { - mouseXY.x = e.clientX; - mouseXY.y = e.clientY; - }); - } -} -function findGutterElementUnderMouse() { - for (const elt of attachedGutterElements) { - if (contains(elt, mouseXY)) return elt; - } -} -function contains(elt, pt) { - const { x, y, width, height } = elt.getBoundingClientRect(); - return x <= pt.x && pt.x <= x + width && y <= pt.y && pt.y <= y + height; -} - -// src/pluginGlobalRef.ts -init_polyfill_buffer(); -var pluginRef = {}; - -// src/lineAuthor/view/contextMenu.ts -var COMMIT_ATTR = "data-commit"; -function handleContextMenu(menu, editor, _mdv) { - if (editor.hasFocus()) return; - const gutterElement = findGutterElementUnderMouse(); - if (!gutterElement) return; - const info = getCommitInfo(gutterElement); - if (!info) return; - if (!info.isZeroCommit && !info.isWaitingGutter) { - addCopyHashMenuItem(info, menu); - } - addConfigurableLineAuthorSettings("showCommitHash", menu); - addConfigurableLineAuthorSettings("authorDisplay", menu); - addConfigurableLineAuthorSettings("dateTimeFormatOptions", menu); -} -function addCopyHashMenuItem(commit2, menu) { - menu.addItem( - (item) => item.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick((_e) => navigator.clipboard.writeText(commit2.hash)) - ); -} -function addConfigurableLineAuthorSettings(key2, menu) { - var _a2, _b; - let title; - let actionNewValue; - const settings = pluginRef.plugin.settings.lineAuthor; - const currentValue = settings[key2]; - const currentlyShown = typeof currentValue === "boolean" ? currentValue : currentValue !== "hide"; - const defaultValue = DEFAULT_SETTINGS.lineAuthor[key2]; - if (key2 === "showCommitHash") { - title = "Show commit hash"; - actionNewValue = !currentValue; - } else if (key2 === "authorDisplay") { - const showOption = (_a2 = settings.lastShownAuthorDisplay) != null ? _a2 : defaultValue; - title = "Show author " + (currentlyShown ? currentValue : showOption); - actionNewValue = currentlyShown ? "hide" : showOption; - } else if (key2 === "dateTimeFormatOptions") { - const showOption = (_b = settings.lastShownDateTimeFormatOptions) != null ? _b : defaultValue; - title = "Show " + (currentlyShown ? currentValue : showOption); - title += !title.contains("date") ? " date" : ""; - actionNewValue = currentlyShown ? "hide" : showOption; - } else { - impossibleBranch(key2); - } - menu.addItem( - (item) => item.setTitle(title).setSection("obs-git-line-author-configure").setChecked(currentlyShown).onClick( - (_e) => { - var _a3, _b2; - return (_b2 = (_a3 = pluginRef.plugin) == null ? void 0 : _a3.settingsTab) == null ? void 0 : _b2.lineAuthorSettingHandler( - key2, - actionNewValue - ); - } - ) - ); -} -function enrichCommitInfoForContextMenu(commit2, isWaitingGutter, elt) { - elt.setAttr( - COMMIT_ATTR, - JSON.stringify({ - hash: commit2.hash, - isZeroCommit: commit2.isZeroCommit, - isWaitingGutter - }) - ); -} -function getCommitInfo(elt) { - const commitInfoStr = elt.getAttr(COMMIT_ATTR); - return commitInfoStr ? JSON.parse(commitInfoStr) : void 0; -} - -// src/lineAuthor/view/gutter/coloring.ts -init_polyfill_buffer(); -function previewColor(which, settings) { - return which === "oldest" ? coloringBasedOnCommitAge(0, false, settings).color : coloringBasedOnCommitAge(void 0, true, settings).color; -} -function coloringBasedOnCommitAge(commitAuthorEpochSeonds, isZeroCommit, settings) { - const maxAgeInDays = maxAgeInDaysFromSettings(settings); - const epochSecondsNow = Date.now() / 1e3; - const authoringEpochSeconds = commitAuthorEpochSeonds != null ? commitAuthorEpochSeonds : 0; - const secondsSinceCommit = isZeroCommit ? 0 : epochSecondsNow - authoringEpochSeconds; - const daysSinceCommit = secondsSinceCommit / 60 / 60 / 24; - const x = Math.pow( - Math.clamp(daysSinceCommit / maxAgeInDays, 0, 1), - 1 / 2.3 - ); - const dark = isDarkMode(); - const color0 = settings.colorNew; - const color1 = settings.colorOld; - const scaling = dark ? 0.4 : 1; - const r = lin(color0.r, color1.r, x) * scaling; - const g = lin(color0.g, color1.g, x) * scaling; - const b = lin(color0.b, color1.b, x) * scaling; - const a = dark ? 0.75 : 0.25; - return { color: `rgba(${r},${g},${b},${a})`, daysSinceCommit }; -} -function lin(z0, z1, x) { - return z0 + (z1 - z0) * x; -} -function isDarkMode() { - const obsidian = window == null ? void 0 : window.app; - return (obsidian == null ? void 0 : obsidian.getTheme()) === "obsidian"; -} -function setTextColorCssBasedOnSetting(settings) { - document.body.style.setProperty( - "--obs-git-gutter-text", - settings.textColorCss - ); -} - -// src/lineAuthor/view/gutter/commitChoice.ts -init_polyfill_buffer(); -function chooseNewestCommit(lineAuthoring, startLine, endLine) { - let newest = void 0; - for (let line = startLine; line <= endLine; line++) { - const currentHash = lineAuthoring.hashPerLine[line]; - const currentCommit = lineAuthoring.commits.get(currentHash); - if (!newest || currentCommit.isZeroCommit || isNewerThan(currentCommit, newest)) { - newest = currentCommit; - } - } - return newest; -} -function isNewerThan(left, right) { - var _a2, _b, _c, _d; - const l = (_b = (_a2 = left.author) == null ? void 0 : _a2.epochSeconds) != null ? _b : 0; - const r = (_d = (_c = right.author) == null ? void 0 : _c.epochSeconds) != null ? _d : 0; - return l > r; -} - -// src/lineAuthor/view/gutter/gutter.ts -var VALUE_NOT_FOUND_FALLBACK = "-"; -var NEW_CHANGE_CHARACTER = "+"; -var NEW_CHANGE_NUMBER_OF_CHARACTERS = 3; -var DIFFERING_AUTHOR_COMMITTER_MARKER = "*"; -var NON_WHITESPACE_REGEXP = /\S/g; -var UNINTRUSIVE_CHARACTER_FOR_WAITING_RENDERING = "%"; -var TextGutter = class extends import_view.GutterMarker { - constructor(text2) { - super(); - this.text = text2; - } - eq(other) { - return this.text === (other == null ? void 0 : other.text); - } - toDOM() { - return document.createTextNode(this.text); - } - destroy(dom) { - if (!document.body.contains(dom)) dom.remove(); - } -}; -var LineAuthoringGutter = class extends import_view.GutterMarker { - /** - * **This should only be called {@link lineAuthoringGutterMarker}!** - * - * We want to avoid creating the same instance multiple times for improved performance. - */ - constructor(lineAuthoring, startLine, endLine, key2, settings, options) { - super(); - this.lineAuthoring = lineAuthoring; - this.startLine = startLine; - this.endLine = endLine; - this.key = key2; - this.settings = settings; - this.options = options; - this.point = false; - this.elementClass = "obs-git-blame-gutter"; - } - // Equality used by CodeMirror for optimisations - eq(other) { - return this.key === (other == null ? void 0 : other.key) && this.startLine === (other == null ? void 0 : other.startLine) && this.endLine === (other == null ? void 0 : other.endLine) && (this == null ? void 0 : this.options) === (other == null ? void 0 : other.options); - } - /** - * Renders to a Html node. - * - * It choses the newest commit within the line-range, - * renders it, makes adjustments for fake-commits and finally warps - * it into HTML. - * - * The DOM is actually precomputed with {@link computeDom}, - * which provides a finaliser to run before the DOM is handed over to CodeMirror. - * This is done, because this method is called frequently. It is called, - * whenever a gutter gets into the viewport and needs to be rendered. - * - * The age in days is recorded via {@link recordRenderedAgeInDays} to enable adaptive coloring. - */ - toDOM() { - var _a2; - this.precomputedDomProvider = (_a2 = this.precomputedDomProvider) != null ? _a2 : this.computeDom(); - return this.precomputedDomProvider(); - } - destroy(dom) { - if (!document.body.contains(dom)) { - dom.remove(); - attachedGutterElements.delete(dom); - } - } - /** - * Prepares the DOM for this gutter. - */ - computeDom() { - const commit2 = chooseNewestCommit( - this.lineAuthoring, - this.startLine, - this.endLine - ); - let toBeRenderedText = commit2.isZeroCommit ? "" : this.renderNonZeroCommit(commit2); - const isTrueCommit = !commit2.isZeroCommit && this.options !== "waiting-for-result"; - if (isTrueCommit) { - conditionallyUpdateLongestRenderedGutter(this, toBeRenderedText); - } else { - toBeRenderedText = this.adaptTextForFakeCommit( - commit2, - toBeRenderedText, - this.options - ); - } - const domProvider = this.createHtmlNode( - commit2, - toBeRenderedText, - this.options === "waiting-for-result" - ); - return domProvider; - } - createHtmlNode(commit2, text2, isWaitingGutter) { - var _a2; - const templateElt = window.createDiv(); - templateElt.innerText = text2; - const { color, daysSinceCommit } = coloringBasedOnCommitAge( - (_a2 = commit2 == null ? void 0 : commit2.author) == null ? void 0 : _a2.epochSeconds, - commit2 == null ? void 0 : commit2.isZeroCommit, - this.settings - ); - templateElt.style.backgroundColor = color; - enrichCommitInfoForContextMenu(commit2, isWaitingGutter, templateElt); - function prepareForDomAttachment() { - const elt = templateElt.cloneNode(true); - attachedGutterElements.add(elt); - if (!isWaitingGutter) recordRenderedAgeInDays(daysSinceCommit); - return elt; - } - return prepareForDomAttachment; - } - renderNonZeroCommit(commit2) { - const optionalShortHash = this.settings.showCommitHash ? this.renderHash(commit2) : ""; - const optionalAuthorName = this.settings.authorDisplay === "hide" ? "" : `${this.renderAuthorName( - commit2, - this.settings.authorDisplay - )}`; - const optionalAuthoringDate = this.settings.dateTimeFormatOptions === "hide" ? "" : `${this.renderAuthoringDate( - commit2, - this.settings.dateTimeFormatOptions, - this.settings.dateTimeFormatCustomString, - this.settings.dateTimeTimezone - )}`; - const parts = [ - optionalShortHash, - optionalAuthorName, - optionalAuthoringDate - ]; - return parts.filter((x) => x.length >= 1).join(" "); - } - renderHash(nonZeroCommit) { - return nonZeroCommit.hash.substring(0, 6); - } - renderAuthorName(nonZeroCommit, authorDisplay) { - var _a2, _b, _c, _d; - const name = (_b = (_a2 = nonZeroCommit == null ? void 0 : nonZeroCommit.author) == null ? void 0 : _a2.name) != null ? _b : ""; - const words = name.split(" ").filter((word) => word.length >= 1); - let rendered; - switch (authorDisplay) { - case "initials": - rendered = words.map((word) => word[0].toUpperCase()).join(""); - break; - case "first name": - rendered = (_c = words.first()) != null ? _c : VALUE_NOT_FOUND_FALLBACK; - break; - case "last name": - rendered = (_d = words.last()) != null ? _d : VALUE_NOT_FOUND_FALLBACK; - break; - case "full": - rendered = name; - break; - default: - return impossibleBranch(authorDisplay); - } - if (!strictDeepEqual(nonZeroCommit == null ? void 0 : nonZeroCommit.author, nonZeroCommit == null ? void 0 : nonZeroCommit.committer)) { - rendered = rendered + DIFFERING_AUTHOR_COMMITTER_MARKER; - } - return rendered; - } - renderAuthoringDate(nonZeroCommit, dateTimeFormatOptions, dateTimeFormatCustomString, dateTimeTimezone) { - var _a2; - const FALLBACK_COMMIT_DATE = "?"; - if (((_a2 = nonZeroCommit == null ? void 0 : nonZeroCommit.author) == null ? void 0 : _a2.epochSeconds) === void 0) - return FALLBACK_COMMIT_DATE; - let dateTimeFormatting; - switch (dateTimeFormatOptions) { - case "date": - dateTimeFormatting = DATE_FORMAT; - break; - case "datetime": - dateTimeFormatting = DATE_TIME_FORMAT_MINUTES; - break; - case "custom": - dateTimeFormatting = dateTimeFormatCustomString; - break; - case "natural language": - dateTimeFormatting = (time) => { - const diff3 = time.diff((0, import_obsidian10.moment)()); - const addFluentSuffix = true; - return import_obsidian10.moment.duration(diff3).humanize(addFluentSuffix); - }; - break; - default: - return impossibleBranch(dateTimeFormatOptions); - } - let authoringDate = import_obsidian10.moment.unix( - nonZeroCommit.author.epochSeconds - ); - switch (dateTimeTimezone) { - case "viewer-local": - break; - case "author-local": - authoringDate = authoringDate.utcOffset( - nonZeroCommit.author.tz - ); - dateTimeFormatting += " Z"; - break; - case "utc0000": - authoringDate = authoringDate.utc(); - dateTimeFormatting += "[Z]"; - break; - default: - return impossibleBranch(dateTimeTimezone); - } - if (typeof dateTimeFormatting === "string") { - return authoringDate.format(dateTimeFormatting); - } else { - return dateTimeFormatting(authoringDate); - } - } - adaptTextForFakeCommit(commit2, toBeRenderedText, options) { - var _a2, _b, _c, _d; - const original = (_b = (_a2 = getLongestRenderedGutter()) == null ? void 0 : _a2.text) != null ? _b : toBeRenderedText; - const fillCharacter = options !== "waiting-for-result" && commit2.isZeroCommit ? NEW_CHANGE_CHARACTER : UNINTRUSIVE_CHARACTER_FOR_WAITING_RENDERING; - toBeRenderedText = original.replace( - NON_WHITESPACE_REGEXP, - fillCharacter - ); - const desiredTextLength = (_d = (_c = latestSettings.get()) == null ? void 0 : _c.gutterSpacingFallbackLength) != null ? _d : toBeRenderedText.length; - toBeRenderedText = resizeToLength( - toBeRenderedText, - desiredTextLength, - fillCharacter - ); - if (options !== "waiting-for-result" && commit2.isZeroCommit) { - const numberOfLastCharactersToKeep = Math.min( - desiredTextLength, - NEW_CHANGE_NUMBER_OF_CHARACTERS - ); - toBeRenderedText = prefixOfLengthAsWhitespace( - toBeRenderedText, - desiredTextLength - numberOfLastCharactersToKeep - ); - } - return toBeRenderedText; - } -}; -function lineAuthoringGutterMarker(la, startLine, endLine, key2, settings, options) { - const digest = import_js_sha2562.sha256.create(); - digest.update(Object.values(settings).join(",")); - digest.update(`s${startLine}-e${endLine}-k${key2}-o${options}`); - const cacheKey = digest.hex(); - const cached = gutterInstances.get(cacheKey); - if (cached) return cached; - const result = new LineAuthoringGutter( - la, - startLine, - endLine, - key2, - settings, - options - ); - gutterInstances.set(cacheKey, result); - return result; -} - -// src/lineAuthor/view/gutter/initial.ts -init_polyfill_buffer(); -var import_obsidian11 = require("obsidian"); -function initialSpacingGutter() { - var _a2, _b; - const length = (_b = (_a2 = latestSettings.get()) == null ? void 0 : _a2.gutterSpacingFallbackLength) != null ? _b : DEFAULT_SETTINGS.lineAuthor.gutterSpacingFallbackLength; - return new TextGutter(Array(length).fill("-").join("")); -} -function initialLineAuthoringGutter(settings) { - const { lineAuthoring, ageForInitialRender } = adaptiveInitialColoredWaitingLineAuthoring(settings); - return lineAuthoringGutterMarker( - lineAuthoring, - 1, - 1, - "initialGutter" + ageForInitialRender, - // use a age coloring based cache key - settings, - "waiting-for-result" - ); -} -function adaptiveInitialColoredWaitingLineAuthoring(settings) { - var _a2; - const ageForInitialRender = (_a2 = computeAdaptiveInitialColoringAgeInDays()) != null ? _a2 : maxAgeInDaysFromSettings(settings) * 0.25; - const slightlyOlderAgeForInitialRender = (0, import_obsidian11.moment)().add( - -ageForInitialRender, - "days" - ); - const dummyAuthor = { - name: "", - epochSeconds: momentToEpochSeconds(slightlyOlderAgeForInitialRender), - tz: "+0000" - }; - const dummyCommit = { - hash: "waiting-for-result", - author: dummyAuthor, - committer: dummyAuthor, - isZeroCommit: false - }; - return { - lineAuthoring: { - hashPerLine: [void 0, "waiting-for-result"], - commits: /* @__PURE__ */ new Map([["waiting-for-result", dummyCommit]]) - }, - ageForInitialRender - }; -} - -// src/lineAuthor/view/gutter/untrackedFile.ts -init_polyfill_buffer(); -function newUntrackedFileGutter(key2, settings) { - const dummyLineAuthoring = { - hashPerLine: [void 0, "000000"], - commits: /* @__PURE__ */ new Map([["000000", zeroCommit]]) - }; - return lineAuthoringGutterMarker(dummyLineAuthoring, 1, 1, key2, settings); -} - -// src/lineAuthor/view/view.ts -var UNDISPLAYED = new TextGutter(""); -var lineAuthorGutter = (0, import_view2.gutter)({ - class: "line-author-gutter-container", - markers(view) { - const lineAuthoring = view.state.field(lineAuthorState, false); - return lineAuthoringGutterMarkersRangeSet(view, lineAuthoring); - }, - lineMarkerChange(update2) { - const newLineAuthoringId = laStateDigest( - update2.state.field(lineAuthorState) - ); - const oldLineAuthoringId = laStateDigest( - update2.startState.field(lineAuthorState) - ); - return oldLineAuthoringId !== newLineAuthoringId; - }, - renderEmptyElements: true, - initialSpacer: (view) => { - temporaryWorkaroundGutterSpacingForRenderedLineAuthoring(view); - return initialSpacingGutter(); - }, - updateSpacer: (_sp, update2) => { - var _a2, _b; - temporaryWorkaroundGutterSpacingForRenderedLineAuthoring(update2.view); - return (_b = (_a2 = getLongestRenderedGutter()) == null ? void 0 : _a2.gutter) != null ? _b : initialSpacingGutter(); - } -}); -function lineAuthoringGutterMarkersRangeSet(view, optLA) { - const digest = laStateDigest(optLA); - const doc = view.state.doc; - const lineBlockEndPos = /* @__PURE__ */ new Map(); - for (let line = 1; line <= doc.lines; line++) { - const from = doc.line(line).from; - const to = view.lineBlockAt(from).to; - lineBlockEndPos.set(line, [from, to]); - digest.update([from, to, 0]); - } - const laSettings = latestSettings.get(); - digest.update("s" + Object.values(latestSettings).join(",")); - const cacheKey = digest.hex(); - const cached = gutterMarkersRangeSet.get(cacheKey); - if (cached) return cached; - const { result, allowCache } = computeLineAuthoringGutterMarkersRangeSet( - doc, - lineBlockEndPos, - laSettings, - optLA - ); - if (allowCache) gutterMarkersRangeSet.set(cacheKey, result); - return result; -} -function computeLineAuthoringGutterMarkersRangeSet(doc, blocksPerLine, settings, optLA) { - let allowCache = true; - const docLastLine = doc.lines; - const ranges = []; - function add2(from, to, gutter2) { - return ranges.push(gutter2.range(from, to)); - } - const lineFrom = computeLineMappingForUnsavedChanges(docLastLine, optLA); - const emptyDoc = doc.length === 0; - const lastLineIsEmpty = doc.iterLines(docLastLine, docLastLine + 1).next().value === ""; - for (let startLine = 1; startLine <= docLastLine; startLine++) { - const [from, to] = blocksPerLine.get(startLine); - const endLine = doc.lineAt(to).number; - if (emptyDoc) { - add2(from, to, UNDISPLAYED); - continue; - } - if (startLine === docLastLine && lastLineIsEmpty) { - add2(from, to, UNDISPLAYED); - continue; - } - if (optLA === void 0) { - add2(from, to, initialLineAuthoringGutter(settings)); - allowCache = false; - continue; - } - const { key: key2, la } = optLA; - if (la === "untracked") { - add2(from, to, newUntrackedFileGutter(la, settings)); - continue; - } - const lastAuthorLine = la.hashPerLine.length - 1; - const laStartLine = lineFrom[startLine]; - const laEndLine = lineFrom[endLine]; - if (laEndLine && laEndLine > lastAuthorLine) { - add2(from, to, UNDISPLAYED); - } - if (laStartLine !== void 0 && between(1, laStartLine, lastAuthorLine) && laEndLine !== void 0 && between(1, laEndLine, lastAuthorLine)) { - add2( - from, - to, - lineAuthoringGutterMarker( - la, - laStartLine, - laEndLine, - key2, - settings - ) - ); - continue; - } - if (lastAuthorLine < 1) { - add2(from, to, initialLineAuthoringGutter(settings)); - allowCache = false; - continue; - } - const start = Math.clamp(laStartLine != null ? laStartLine : startLine, 1, lastAuthorLine); - const end = Math.clamp(laEndLine != null ? laEndLine : endLine, 1, lastAuthorLine); - add2( - from, - to, - lineAuthoringGutterMarker( - la, - start, - end, - key2 + "computing", - settings, - "waiting-for-result" - ) - ); - } - return { result: import_state3.RangeSet.of( - ranges, - /* sort = */ - true - ), allowCache }; -} -function computeLineMappingForUnsavedChanges(docLastLine, optLA) { - if (!(optLA == null ? void 0 : optLA.lineOffsetsFromUnsavedChanges)) { - return Array.from(new Array(docLastLine + 1), (ln) => ln); - } - const lineFrom = [void 0]; - let cumulativeLineOffset = 0; - for (let ln = 1; ln <= docLastLine; ln++) { - const unsavedChanges = optLA.lineOffsetsFromUnsavedChanges.get(ln); - cumulativeLineOffset += unsavedChanges != null ? unsavedChanges : 0; - lineFrom[ln] = unsavedChanges === void 0 ? ln - cumulativeLineOffset : void 0; - } - return lineFrom; -} -function temporaryWorkaroundGutterSpacingForRenderedLineAuthoring(view) { - const guttersContainers = view.dom.querySelectorAll( - ".cm-gutters" - ); - guttersContainers.forEach((cont) => { - if (!(cont == null ? void 0 : cont.style)) return; - if (!cont.style.marginLeft) { - cont.style.marginLeft = "unset"; - } - }); -} - -// src/lineAuthor/lineAuthorProvider.ts -var LineAuthorProvider = class { - constructor(plugin) { - this.plugin = plugin; - /** - * Saves all computed line authoring results. - * - * See {@link LineAuthoringId} - */ - this.lineAuthorings = /* @__PURE__ */ new Map(); - } - async trackChanged(file) { - this.trackChangedHelper(file).catch((reason) => { - console.warn("Git: Error in trackChanged." + reason); - return Promise.reject(reason); - }); - } - async trackChangedHelper(file) { - if (!file) return; - if (file.path === void 0) { - console.warn( - "Git: Attempted to track change of undefined filepath. Unforeseen situation." - ); - return; - } - this.computeLineAuthorInfo(file.path); - } - destroy() { - this.lineAuthorings.clear(); - eventsPerFilePathSingleton.clear(); - clearViewCache(); - } - async computeLineAuthorInfo(filepath) { - const gitManager = this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager; - const headRevision = await gitManager.submoduleAwareHeadRevisonInContainingDirectory( - filepath - ); - const fileHash = await gitManager.hashObject(filepath); - const key2 = lineAuthoringId(headRevision, fileHash, filepath); - if (key2 === void 0) { - return; - } - if (this.lineAuthorings.has(key2)) { - } else { - const gitAuthorResult = await gitManager.blame( - filepath, - this.plugin.settings.lineAuthor.followMovement, - this.plugin.settings.lineAuthor.ignoreWhitespace - ); - this.lineAuthorings.set(key2, gitAuthorResult); - } - this.notifyComputationResultToSubscribers(filepath, key2); - } - notifyComputationResultToSubscribers(filepath, key2) { - eventsPerFilePathSingleton.ifFilepathDefinedTransformSubscribers( - filepath, - async (subs) => subs.forEach( - (sub) => sub.notifyLineAuthoring(key2, this.lineAuthorings.get(key2)) - ) - ); - } -}; -var enabledLineAuthorInfoExtensions = import_state4.Prec.high([ - subscribeNewEditor, - lineAuthorState, - lineAuthorGutter -]); - -// src/lineAuthor/lineAuthorIntegration.ts -var LineAuthoringFeature = class { - constructor(plg) { - this.plg = plg; - this.codeMirrorExtensions = []; - this.handleWorkspaceLeaf = (leaf) => { - const obsView = leaf == null ? void 0 : leaf.view; - const file = obsView == null ? void 0 : obsView.file; - if (!this.lineAuthorInfoProvider) { - console.warn( - "Git: undefined lineAuthorInfoProvider. Unexpected situation." - ); - return; - } - if (file === void 0 || (obsView == null ? void 0 : obsView.allowNoFile) === true) return; - this.lineAuthorInfoProvider.trackChanged(file); - }; - } - // ========================= INIT and DE-INIT ========================== - onLoadPlugin() { - this.plg.registerEditorExtension(this.codeMirrorExtensions); - provideSettingsAccess( - () => this.plg.settings.lineAuthor, - (laSettings) => { - this.plg.settings.lineAuthor = laSettings; - this.plg.saveSettings(); - } - ); - } - conditionallyActivateBySettings() { - if (this.plg.settings.lineAuthor.show) { - this.activateFeature(); - } - } - activateFeature() { - try { - if (!this.isAvailableOnCurrentPlatform().available) return; - setTextColorCssBasedOnSetting(this.plg.settings.lineAuthor); - this.lineAuthorInfoProvider = new LineAuthorProvider(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(); - } - } - /** - * Deactivates the feature. This function is very defensive, as it is also - * called to cleanup, if a critical error in the line authoring has occurred. - */ - deactivateFeature() { - var _a2; - this.destroyEventHandlers(); - this.deactivateCodeMirrorExtensions(); - (_a2 = this.lineAuthorInfoProvider) == null ? void 0 : _a2.destroy(); - this.lineAuthorInfoProvider = void 0; - console.log(this.plg.manifest.name + ": Disabled line authoring."); - } - isAvailableOnCurrentPlatform() { - return { - available: this.plg.useSimpleGit && import_obsidian12.Platform.isDesktopApp, - gitManager: this.plg.gitManager instanceof SimpleGit ? this.plg.gitManager : void 0 - }; - } - // ========================= REFRESH ========================== - refreshLineAuthorViews() { - if (this.plg.settings.lineAuthor.show) { - this.deactivateFeature(); - this.activateFeature(); - } - } - // ========================= CODEMIRROR EXTENSIONS ========================== - activateCodeMirrorExtensions() { - this.codeMirrorExtensions.push(enabledLineAuthorInfoExtensions); - this.plg.app.workspace.updateOptions(); - this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf); - } - deactivateCodeMirrorExtensions() { - for (const ext of this.codeMirrorExtensions) { - this.codeMirrorExtensions.remove(ext); - } - this.plg.app.workspace.updateOptions(); - } - // ========================= HANDLERS ========================== - createEventHandlers() { - this.gutterContextMenuEvent = this.createGutterContextMenuHandler(); - this.fileOpenEvent = this.createFileOpenEvent(); - this.workspaceLeafChangeEvent = this.createWorkspaceLeafChangeEvent(); - this.fileModificationEvent = this.createVaultFileModificationHandler(); - this.refreshOnCssChangeEvent = this.createCssRefreshHandler(); - this.fileRenameEvent = this.createFileRenameEvent(); - prepareGutterSearchForContextMenuHandling(); - 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.fileRenameEvent); - } - destroyEventHandlers() { - 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.fileRenameEvent); - this.plg.app.workspace.offref(this.gutterContextMenuEvent); - } - createFileOpenEvent() { - return this.plg.app.workspace.on( - "file-open", - (file) => { - var _a2; - return (_a2 = this.lineAuthorInfoProvider) == null ? void 0 : _a2.trackChanged(file); - } - ); - } - createWorkspaceLeafChangeEvent() { - return this.plg.app.workspace.on( - "active-leaf-change", - this.handleWorkspaceLeaf - ); - } - createFileRenameEvent() { - return this.plg.app.vault.on( - "rename", - (file, _old) => { - var _a2; - return file instanceof import_obsidian12.TFile && ((_a2 = this.lineAuthorInfoProvider) == null ? void 0 : _a2.trackChanged(file)); - } - ); - } - createVaultFileModificationHandler() { - return this.plg.app.vault.on( - "modify", - (anyPath) => { - var _a2; - return anyPath instanceof import_obsidian12.TFile && ((_a2 = this.lineAuthorInfoProvider) == null ? void 0 : _a2.trackChanged(anyPath)); - } - ); - } - createCssRefreshHandler() { - return this.plg.app.workspace.on( - "css-change", - () => this.refreshLineAuthorViews() - ); - } - createGutterContextMenuHandler() { - return this.plg.app.workspace.on("editor-menu", handleContextMenu); - } -}; - -// src/promiseQueue.ts -init_polyfill_buffer(); -var PromiseQueue = class { - constructor() { - this.tasks = []; - } - addTask(task) { - this.tasks.push(task); - if (this.tasks.length === 1) { - this.handleTask(); - } - } - async handleTask() { - if (this.tasks.length > 0) { - this.tasks[0]().finally(() => { - this.tasks.shift(); - this.handleTask(); - }); - } - } -}; - -// src/statusBar.ts -init_polyfill_buffer(); -var import_obsidian13 = require("obsidian"); -var StatusBar = class { - constructor(statusBarEl, plugin) { - this.statusBarEl = statusBarEl; - this.plugin = plugin; - this.messages = []; - this.base = "obsidian-git-statusbar-"; - this.statusBarEl.setAttribute("data-tooltip-position", "top"); - addEventListener("git-refresh", this.refreshCommitTimestamp.bind(this)); - } - displayMessage(message, timeout) { - this.messages.push({ - message: `Git: ${message.slice(0, 100)}`, - timeout - }); - this.display(); - } - display() { - if (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(); - } else if (this.currentMessage) { - const messageAge = Date.now() - this.lastMessageTimestamp; - if (messageAge >= this.currentMessage.timeout) { - this.currentMessage = null; - this.lastMessageTimestamp = null; - } - } else { - this.displayState(); - } - } - displayState() { - if (this.statusBarEl.getText().length > 3 || !this.statusBarEl.hasChildNodes()) { - this.statusBarEl.empty(); - this.iconEl = this.statusBarEl.createDiv(); - this.textEl = this.statusBarEl.createDiv(); - this.textEl.style.float = "right"; - this.textEl.style.marginLeft = "5px"; - this.iconEl.style.float = "left"; - } - switch (this.plugin.state) { - case 0 /* idle */: - this.displayFromNow(); - break; - case 1 /* status */: - this.statusBarEl.ariaLabel = "Checking repository status..."; - (0, import_obsidian13.setIcon)(this.iconEl, "refresh-cw"); - this.statusBarEl.addClass(this.base + "status"); - break; - case 3 /* add */: - this.statusBarEl.ariaLabel = "Adding files..."; - (0, import_obsidian13.setIcon)(this.iconEl, "refresh-w"); - this.statusBarEl.addClass(this.base + "add"); - break; - case 4 /* commit */: - this.statusBarEl.ariaLabel = "Committing changes..."; - (0, import_obsidian13.setIcon)(this.iconEl, "git-commit"); - this.statusBarEl.addClass(this.base + "commit"); - break; - case 5 /* push */: - this.statusBarEl.ariaLabel = "Pushing changes..."; - (0, import_obsidian13.setIcon)(this.iconEl, "upload"); - this.statusBarEl.addClass(this.base + "push"); - break; - case 2 /* pull */: - this.statusBarEl.ariaLabel = "Pulling changes..."; - (0, import_obsidian13.setIcon)(this.iconEl, "download"); - this.statusBarEl.addClass(this.base + "pull"); - break; - case 6 /* conflicted */: - this.statusBarEl.ariaLabel = "You have conflict files..."; - (0, import_obsidian13.setIcon)(this.iconEl, "alert-circle"); - this.statusBarEl.addClass(this.base + "conflict"); - break; - default: - this.statusBarEl.ariaLabel = "Failed on initialization!"; - (0, import_obsidian13.setIcon)(this.iconEl, "alert-triangle"); - this.statusBarEl.addClass(this.base + "failed-init"); - break; - } - } - displayFromNow() { - var _a2; - const timestamp = this.lastCommitTimestamp; - if (timestamp) { - const moment6 = window.moment; - const fromNow = moment6(timestamp).fromNow(); - this.statusBarEl.ariaLabel = `${this.plugin.offlineMode ? "Offline: " : ""}Last Commit: ${fromNow}`; - if ((_a2 = this.unPushedCommits) != null ? _a2 : 0 > 0) { - this.statusBarEl.ariaLabel += ` -(${this.unPushedCommits} unpushed commits)`; - } - } else { - this.statusBarEl.ariaLabel = this.plugin.offlineMode ? "Git is offline" : "Git is ready"; - } - if (this.plugin.offlineMode) { - (0, import_obsidian13.setIcon)(this.iconEl, "globe"); - } else { - (0, import_obsidian13.setIcon)(this.iconEl, "check"); - } - if (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(); - } -}; - -// src/ui/modals/changedFilesModal.ts -init_polyfill_buffer(); -var import_obsidian14 = require("obsidian"); -var ChangedFilesModal = class extends import_obsidian14.FuzzySuggestModal { - constructor(plugin, changedFiles) { - super(plugin.app); - this.plugin = plugin; - this.changedFiles = changedFiles; - this.setPlaceholder( - "Not supported files will be opened by default app!" - ); - } - getItems() { - return this.changedFiles; - } - getItemText(item) { - if (item.index == "U" && item.working_dir == "U") { - return `Untracked | ${item.vault_path}`; - } - let working_dir = ""; - let index2 = ""; - if (item.working_dir != " ") - working_dir = `Working Dir: ${item.working_dir} `; - if (item.index != " ") index2 = `Index: ${item.index}`; - return `${working_dir}${index2} | ${item.vault_path}`; - } - onChooseItem(item, _) { - if (this.plugin.app.metadataCache.getFirstLinkpathDest( - item.vault_path, - "" - ) == null) { - this.app.openWithDefaultApp(item.vault_path); - } else { - this.plugin.app.workspace.openLinkText(item.vault_path, "/"); - } - } -}; - -// src/ui/modals/customMessageModal.ts -init_polyfill_buffer(); -var import_obsidian15 = require("obsidian"); -var CustomMessageModal = class extends import_obsidian15.SuggestModal { - constructor(plugin, fromAutoBackup) { - super(plugin.app); - this.fromAutoBackup = fromAutoBackup; - this.resolve = null; - this.plugin = plugin; - this.setPlaceholder( - "Type your message and select optional the version with the added date." - ); - } - open() { - super.open(); - return new Promise((resolve2) => { - this.resolve = resolve2; - }); - } - onClose() { - if (this.resolve) this.resolve(void 0); - } - selectSuggestion(value, evt) { - if (this.resolve) this.resolve(value); - super.selectSuggestion(value, evt); - } - getSuggestions(query) { - const date = window.moment().format(this.plugin.settings.commitDateFormat); - if (query == "") query = "..."; - return [query, `${date}: ${query}`, `${query}: ${date}`]; - } - renderSuggestion(value, el) { - el.innerText = value; - } - onChooseSuggestion(item, _) { - } -}; - -// src/openInGitHub.ts -init_polyfill_buffer(); -var import_obsidian16 = require("obsidian"); -async function openLineInGitHub(editor, file, manager) { - const data = await getData(file, manager); - if (data.result === "failure") { - new import_obsidian16.Notice(data.reason); - return; - } - const { isGitHub, branch: branch2, repo, user, filePath } = data; - if (isGitHub) { - const from = editor.getCursor("from").line + 1; - const to = editor.getCursor("to").line + 1; - if (from === to) { - window.open( - `https://github.com/${user}/${repo}/blob/${branch2}/${filePath}?plain=1#L${from}` - ); - } else { - window.open( - `https://github.com/${user}/${repo}/blob/${branch2}/${filePath}?plain=1#L${from}-L${to}` - ); - } - } else { - new import_obsidian16.Notice("It seems like you are not using GitHub"); - } -} -async function openHistoryInGitHub(file, manager) { - const data = await getData(file, manager); - if (data.result === "failure") { - new import_obsidian16.Notice(data.reason); - return; - } - const { isGitHub, branch: branch2, repo, user, filePath } = data; - if (isGitHub) { - window.open( - `https://github.com/${user}/${repo}/commits/${branch2}/${filePath}` - ); - } else { - new import_obsidian16.Notice("It seems like you are not using GitHub"); - } -} -async function getData(file, manager) { - const branchInfo = await manager.branchInfo(); - let remoteBranch = branchInfo.tracking; - let branch2 = branchInfo.current; - let remoteUrl = void 0; - let filePath = manager.getRelativeRepoPath(file.path); - if (manager instanceof SimpleGit) { - const submodule = await manager.getSubmoduleOfFile( - manager.getRelativeRepoPath(file.path) - ); - if (submodule) { - filePath = submodule.relativeFilepath; - const status2 = await manager.git.cwd({ - path: submodule.submodule, - root: false - }).status(); - remoteBranch = status2.tracking || void 0; - branch2 = status2.current || void 0; - if (remoteBranch) { - const remote = remoteBranch.substring( - 0, - remoteBranch.indexOf("/") - ); - const config = await manager.git.cwd({ - path: submodule.submodule, - root: false - }).getConfig(`remote.${remote}.url`, "local"); - if (config.value != null) { - remoteUrl = config.value; - } else { - return { - result: "failure", - reason: "Failed to get remote url of submodule" - }; - } - } - } - } - if (remoteBranch == null) { - return { - result: "failure", - reason: "Remote branch is not configured" - }; - } - if (branch2 == null) { - return { - result: "failure", - reason: "Failed to get current branch name" - }; - } - if (remoteUrl == null) { - const remote = remoteBranch.substring(0, remoteBranch.indexOf("/")); - remoteUrl = await manager.getConfig(`remote.${remote}.url`); - if (remoteUrl == null) { - return { - result: "failure", - reason: "Failed to get remote url" - }; - } - } - const res = remoteUrl.match( - /(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/ - ); - if (res == null) { - return { - result: "failure", - reason: "Could not parse remote url" - }; - } else { - const [isGitHub, httpsUser, httpsRepo, sshUser, sshRepo] = res; - return { - result: "success", - isGitHub: !!isGitHub, - repo: httpsRepo || sshRepo, - user: httpsUser || sshUser, - branch: branch2, - filePath - }; - } -} - -// src/setting/localStorageSettings.ts -init_polyfill_buffer(); -var LocalStorageSettings = class { - constructor(plugin) { - this.plugin = plugin; - this.prefix = this.plugin.manifest.id + ":"; - } - migrate() { - const keys = [ - "password", - "hostname", - "conflict", - "lastAutoPull", - "lastAutoBackup", - "lastAutoPush", - "gitPath", - "pluginDisabled" - ]; - for (const key2 of keys) { - const old = localStorage.getItem(this.prefix + key2); - if (app.loadLocalStorage(this.prefix + key2) == null && old != null) { - if (old != null) { - app.saveLocalStorage(this.prefix + key2, old); - localStorage.removeItem(this.prefix + key2); - } - } - } - } - getPassword() { - return app.loadLocalStorage(this.prefix + "password"); - } - setPassword(value) { - return app.saveLocalStorage(this.prefix + "password", value); - } - getUsername() { - return app.loadLocalStorage(this.prefix + "username"); - } - setUsername(value) { - return app.saveLocalStorage(this.prefix + "username", value); - } - getHostname() { - return app.loadLocalStorage(this.prefix + "hostname"); - } - setHostname(value) { - return app.saveLocalStorage(this.prefix + "hostname", value); - } - getConflict() { - return app.loadLocalStorage(this.prefix + "conflict") == "true"; - } - setConflict(value) { - return app.saveLocalStorage(this.prefix + "conflict", `${value}`); - } - getLastAutoPull() { - return app.loadLocalStorage(this.prefix + "lastAutoPull"); - } - setLastAutoPull(value) { - return app.saveLocalStorage(this.prefix + "lastAutoPull", value); - } - getLastAutoBackup() { - return app.loadLocalStorage(this.prefix + "lastAutoBackup"); - } - setLastAutoBackup(value) { - return app.saveLocalStorage(this.prefix + "lastAutoBackup", value); - } - getLastAutoPush() { - return app.loadLocalStorage(this.prefix + "lastAutoPush"); - } - setLastAutoPush(value) { - return app.saveLocalStorage(this.prefix + "lastAutoPush", value); - } - getGitPath() { - return app.loadLocalStorage(this.prefix + "gitPath"); - } - setGitPath(value) { - return app.saveLocalStorage(this.prefix + "gitPath", value); - } - getPATHPaths() { - var _a2, _b; - return (_b = (_a2 = app.loadLocalStorage(this.prefix + "PATHPaths")) == null ? void 0 : _a2.split(":")) != null ? _b : []; - } - setPATHPaths(value) { - return app.saveLocalStorage(this.prefix + "PATHPaths", value.join(":")); - } - getEnvVars() { - var _a2; - return JSON.parse( - (_a2 = app.loadLocalStorage(this.prefix + "envVars")) != null ? _a2 : "[]" - ); - } - setEnvVars(value) { - return app.saveLocalStorage( - this.prefix + "envVars", - JSON.stringify(value) - ); - } - getPluginDisabled() { - return app.loadLocalStorage(this.prefix + "pluginDisabled") == "true"; - } - setPluginDisabled(value) { - return app.saveLocalStorage(this.prefix + "pluginDisabled", `${value}`); - } -}; - -// src/ui/diff/diffView.ts -init_polyfill_buffer(); - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/diff2html.js -init_polyfill_buffer(); - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/diff-parser.js -init_polyfill_buffer(); - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/types.js -init_polyfill_buffer(); -var LineType; -(function(LineType2) { - LineType2["INSERT"] = "insert"; - LineType2["DELETE"] = "delete"; - LineType2["CONTEXT"] = "context"; -})(LineType || (LineType = {})); -var OutputFormatType = { - LINE_BY_LINE: "line-by-line", - SIDE_BY_SIDE: "side-by-side" -}; -var LineMatchingType = { - LINES: "lines", - WORDS: "words", - NONE: "none" -}; -var DiffStyleType = { - WORD: "word", - CHAR: "char" -}; -var ColorSchemeType; -(function(ColorSchemeType2) { - ColorSchemeType2["AUTO"] = "auto"; - ColorSchemeType2["DARK"] = "dark"; - ColorSchemeType2["LIGHT"] = "light"; -})(ColorSchemeType || (ColorSchemeType = {})); - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/utils.js -init_polyfill_buffer(); -var specials = [ - "-", - "[", - "]", - "/", - "{", - "}", - "(", - ")", - "*", - "+", - "?", - ".", - "\\", - "^", - "$", - "|" -]; -var regex = RegExp("[" + specials.join("\\") + "]", "g"); -function escapeForRegExp(str) { - return str.replace(regex, "\\$&"); -} -function unifyPath(path2) { - return path2 ? path2.replace(/\\/g, "/") : path2; -} -function hashCode(text2) { - let i, chr, len; - let hash2 = 0; - for (i = 0, len = text2.length; i < len; i++) { - chr = text2.charCodeAt(i); - hash2 = (hash2 << 5) - hash2 + chr; - hash2 |= 0; - } - return hash2; -} - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/diff-parser.js -function getExtension(filename, language) { - const filenameParts = filename.split("."); - return filenameParts.length > 1 ? filenameParts[filenameParts.length - 1] : language; -} -function startsWithAny(str, prefixes) { - return prefixes.reduce((startsWith, prefix) => startsWith || str.startsWith(prefix), false); -} -var baseDiffFilenamePrefixes = ["a/", "b/", "i/", "w/", "c/", "o/"]; -function getFilename(line, linePrefix, extraPrefix) { - const prefixes = extraPrefix !== void 0 ? [...baseDiffFilenamePrefixes, extraPrefix] : baseDiffFilenamePrefixes; - const FilenameRegExp = linePrefix ? new RegExp(`^${escapeForRegExp(linePrefix)} "?(.+?)"?$`) : new RegExp('^"?(.+?)"?$'); - const [, filename = ""] = FilenameRegExp.exec(line) || []; - const matchingPrefix = prefixes.find((p) => filename.indexOf(p) === 0); - const fnameWithoutPrefix = matchingPrefix ? filename.slice(matchingPrefix.length) : filename; - return fnameWithoutPrefix.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/, ""); -} -function getSrcFilename(line, srcPrefix) { - return getFilename(line, "---", srcPrefix); -} -function getDstFilename(line, dstPrefix) { - return getFilename(line, "+++", dstPrefix); -} -function parse(diffInput, config = {}) { - const files = []; - let currentFile = null; - let currentBlock = null; - let oldLine = null; - let oldLine2 = null; - let newLine = null; - let possibleOldName = null; - let possibleNewName = null; - const oldFileNameHeader = "--- "; - const newFileNameHeader = "+++ "; - const hunkHeaderPrefix = "@@"; - const oldMode = /^old mode (\d{6})/; - const newMode = /^new mode (\d{6})/; - const deletedFileMode = /^deleted file mode (\d{6})/; - const newFileMode = /^new file mode (\d{6})/; - const copyFrom = /^copy from "?(.+)"?/; - const copyTo = /^copy to "?(.+)"?/; - const renameFrom = /^rename from "?(.+)"?/; - const renameTo = /^rename to "?(.+)"?/; - const similarityIndex = /^similarity index (\d+)%/; - const dissimilarityIndex = /^dissimilarity index (\d+)%/; - const index2 = /^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/; - const binaryFiles = /^Binary files (.*) and (.*) differ/; - const binaryDiff = /^GIT binary patch/; - const combinedIndex = /^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/; - const combinedMode = /^mode (\d{6}),(\d{6})\.\.(\d{6})/; - const combinedNewFile = /^new file mode (\d{6})/; - const combinedDeletedFile = /^deleted file mode (\d{6}),(\d{6})/; - const diffLines2 = diffInput.replace(/\\ No newline at end of file/g, "").replace(/\r\n?/g, "\n").split("\n"); - function saveBlock() { - if (currentBlock !== null && currentFile !== null) { - currentFile.blocks.push(currentBlock); - currentBlock = null; - } - } - function saveFile() { - if (currentFile !== null) { - if (!currentFile.oldName && possibleOldName !== null) { - currentFile.oldName = possibleOldName; - } - if (!currentFile.newName && possibleNewName !== null) { - currentFile.newName = possibleNewName; - } - if (currentFile.newName) { - files.push(currentFile); - currentFile = null; - } - } - possibleOldName = null; - possibleNewName = null; - } - function startFile() { - saveBlock(); - saveFile(); - currentFile = { - blocks: [], - deletedLines: 0, - addedLines: 0 - }; - } - function startBlock(line) { - saveBlock(); - let values; - if (currentFile !== null) { - if (values = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line)) { - currentFile.isCombined = false; - oldLine = parseInt(values[1], 10); - newLine = parseInt(values[2], 10); - } else if (values = /^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line)) { - currentFile.isCombined = true; - oldLine = parseInt(values[1], 10); - oldLine2 = parseInt(values[2], 10); - newLine = parseInt(values[3], 10); - } else { - if (line.startsWith(hunkHeaderPrefix)) { - console.error("Failed to parse lines, starting in 0!"); - } - oldLine = 0; - newLine = 0; - currentFile.isCombined = false; - } - } - currentBlock = { - lines: [], - oldStartLine: oldLine, - oldStartLine2: oldLine2, - newStartLine: newLine, - header: line - }; - } - function createLine(line) { - if (currentFile === null || currentBlock === null || oldLine === null || newLine === null) - return; - const currentLine = { - content: line - }; - const addedPrefixes = currentFile.isCombined ? ["+ ", " +", "++"] : ["+"]; - const deletedPrefixes = currentFile.isCombined ? ["- ", " -", "--"] : ["-"]; - if (startsWithAny(line, addedPrefixes)) { - currentFile.addedLines++; - currentLine.type = LineType.INSERT; - currentLine.oldNumber = void 0; - currentLine.newNumber = newLine++; - } else if (startsWithAny(line, deletedPrefixes)) { - currentFile.deletedLines++; - currentLine.type = LineType.DELETE; - currentLine.oldNumber = oldLine++; - currentLine.newNumber = void 0; - } else { - currentLine.type = LineType.CONTEXT; - currentLine.oldNumber = oldLine++; - currentLine.newNumber = newLine++; - } - currentBlock.lines.push(currentLine); - } - function existHunkHeader(line, lineIdx) { - let idx = lineIdx; - while (idx < diffLines2.length - 3) { - if (line.startsWith("diff")) { - return false; - } - if (diffLines2[idx].startsWith(oldFileNameHeader) && diffLines2[idx + 1].startsWith(newFileNameHeader) && diffLines2[idx + 2].startsWith(hunkHeaderPrefix)) { - return true; - } - idx++; - } - return false; - } - diffLines2.forEach((line, lineIndex) => { - if (!line || line.startsWith("*")) { - return; - } - let values; - const prevLine = diffLines2[lineIndex - 1]; - const nxtLine = diffLines2[lineIndex + 1]; - const afterNxtLine = diffLines2[lineIndex + 2]; - if (line.startsWith("diff --git") || line.startsWith("diff --combined")) { - startFile(); - const gitDiffStart = /^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/; - if (values = gitDiffStart.exec(line)) { - possibleOldName = getFilename(values[1], void 0, config.dstPrefix); - possibleNewName = getFilename(values[2], void 0, config.srcPrefix); - } - if (currentFile === null) { - throw new Error("Where is my file !!!"); - } - currentFile.isGitDiff = true; - return; - } - if (line.startsWith("Binary files") && !(currentFile === null || currentFile === void 0 ? void 0 : currentFile.isGitDiff)) { - startFile(); - const unixDiffBinaryStart = /^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/; - if (values = unixDiffBinaryStart.exec(line)) { - possibleOldName = getFilename(values[1], void 0, config.dstPrefix); - possibleNewName = getFilename(values[2], void 0, config.srcPrefix); - } - if (currentFile === null) { - throw new Error("Where is my file !!!"); - } - currentFile.isBinary = true; - return; - } - if (!currentFile || !currentFile.isGitDiff && currentFile && line.startsWith(oldFileNameHeader) && nxtLine.startsWith(newFileNameHeader) && afterNxtLine.startsWith(hunkHeaderPrefix)) { - startFile(); - } - if (currentFile === null || currentFile === void 0 ? void 0 : currentFile.isTooBig) { - return; - } - if (currentFile && (typeof config.diffMaxChanges === "number" && currentFile.addedLines + currentFile.deletedLines > config.diffMaxChanges || typeof config.diffMaxLineLength === "number" && line.length > config.diffMaxLineLength)) { - currentFile.isTooBig = true; - currentFile.addedLines = 0; - currentFile.deletedLines = 0; - currentFile.blocks = []; - currentBlock = null; - const message = typeof config.diffTooBigMessage === "function" ? config.diffTooBigMessage(files.length) : "Diff too big to be displayed"; - startBlock(message); - return; - } - if (line.startsWith(oldFileNameHeader) && nxtLine.startsWith(newFileNameHeader) || line.startsWith(newFileNameHeader) && prevLine.startsWith(oldFileNameHeader)) { - if (currentFile && !currentFile.oldName && line.startsWith("--- ") && (values = getSrcFilename(line, config.srcPrefix))) { - currentFile.oldName = values; - currentFile.language = getExtension(currentFile.oldName, currentFile.language); - return; - } - if (currentFile && !currentFile.newName && line.startsWith("+++ ") && (values = getDstFilename(line, config.dstPrefix))) { - currentFile.newName = values; - currentFile.language = getExtension(currentFile.newName, currentFile.language); - return; - } - } - if (currentFile && (line.startsWith(hunkHeaderPrefix) || currentFile.isGitDiff && currentFile.oldName && currentFile.newName && !currentBlock)) { - startBlock(line); - return; - } - if (currentBlock && (line.startsWith("+") || line.startsWith("-") || line.startsWith(" "))) { - createLine(line); - return; - } - const doesNotExistHunkHeader = !existHunkHeader(line, lineIndex); - if (currentFile === null) { - throw new Error("Where is my file !!!"); - } - if (values = oldMode.exec(line)) { - currentFile.oldMode = values[1]; - } else if (values = newMode.exec(line)) { - currentFile.newMode = values[1]; - } else if (values = deletedFileMode.exec(line)) { - currentFile.deletedFileMode = values[1]; - currentFile.isDeleted = true; - } else if (values = newFileMode.exec(line)) { - currentFile.newFileMode = values[1]; - currentFile.isNew = true; - } else if (values = copyFrom.exec(line)) { - if (doesNotExistHunkHeader) { - currentFile.oldName = values[1]; - } - currentFile.isCopy = true; - } else if (values = copyTo.exec(line)) { - if (doesNotExistHunkHeader) { - currentFile.newName = values[1]; - } - currentFile.isCopy = true; - } else if (values = renameFrom.exec(line)) { - if (doesNotExistHunkHeader) { - currentFile.oldName = values[1]; - } - currentFile.isRename = true; - } else if (values = renameTo.exec(line)) { - if (doesNotExistHunkHeader) { - currentFile.newName = values[1]; - } - currentFile.isRename = true; - } else if (values = binaryFiles.exec(line)) { - currentFile.isBinary = true; - currentFile.oldName = getFilename(values[1], void 0, config.srcPrefix); - currentFile.newName = getFilename(values[2], void 0, config.dstPrefix); - startBlock("Binary file"); - } else if (binaryDiff.test(line)) { - currentFile.isBinary = true; - startBlock(line); - } else if (values = similarityIndex.exec(line)) { - currentFile.unchangedPercentage = parseInt(values[1], 10); - } else if (values = dissimilarityIndex.exec(line)) { - currentFile.changedPercentage = parseInt(values[1], 10); - } else if (values = index2.exec(line)) { - currentFile.checksumBefore = values[1]; - currentFile.checksumAfter = values[2]; - values[3] && (currentFile.mode = values[3]); - } else if (values = combinedIndex.exec(line)) { - currentFile.checksumBefore = [values[2], values[3]]; - currentFile.checksumAfter = values[1]; - } else if (values = combinedMode.exec(line)) { - currentFile.oldMode = [values[2], values[3]]; - currentFile.newMode = values[1]; - } else if (values = combinedNewFile.exec(line)) { - currentFile.newFileMode = values[1]; - currentFile.isNew = true; - } else if (values = combinedDeletedFile.exec(line)) { - currentFile.deletedFileMode = values[1]; - currentFile.isDeleted = true; - } - }); - saveBlock(); - saveFile(); - return files; -} - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/file-list-renderer.js -init_polyfill_buffer(); - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/render-utils.js -init_polyfill_buffer(); - -// node_modules/.pnpm/diff@5.1.0/node_modules/diff/lib/index.mjs -init_polyfill_buffer(); -function Diff2() { -} -Diff2.prototype = { - diff: function diff2(oldString, newString) { - var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - var callback = options.callback; - if (typeof options === "function") { - callback = options; - options = {}; - } - this.options = options; - var self2 = this; - function done(value) { - if (callback) { - setTimeout(function() { - callback(void 0, value); - }, 0); - return true; - } else { - return value; - } - } - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); - var newLen = newString.length, oldLen = oldString.length; - var editLength = 1; - var maxEditLength = newLen + oldLen; - if (options.maxEditLength) { - maxEditLength = Math.min(maxEditLength, options.maxEditLength); - } - var bestPath = [{ - newPos: -1, - components: [] - }]; - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { - return done([{ - value: this.join(newString), - count: newString.length - }]); - } - function execEditLength() { - for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { - var basePath = void 0; - var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - if (addPath) { - bestPath[diagonalPath - 1] = void 0; - } - var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; - if (!canAdd && !canRemove) { - bestPath[diagonalPath] = void 0; - continue; - } - if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { - basePath = clonePath(removePath); - self2.pushComponent(basePath.components, void 0, true); - } else { - basePath = addPath; - basePath.newPos++; - self2.pushComponent(basePath.components, true, void 0); - } - _oldPos = self2.extractCommon(basePath, newString, oldString, diagonalPath); - if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { - return done(buildValues2(self2, basePath.components, newString, oldString, self2.useLongestToken)); - } else { - bestPath[diagonalPath] = basePath; - } - } - editLength++; - } - if (callback) { - (function exec() { - setTimeout(function() { - if (editLength > maxEditLength) { - return callback(); - } - if (!execEditLength()) { - exec(); - } - }, 0); - })(); - } else { - while (editLength <= maxEditLength) { - var ret = execEditLength(); - if (ret) { - return ret; - } - } - } - }, - pushComponent: function pushComponent(components, added, removed) { - var last2 = components[components.length - 1]; - if (last2 && last2.added === added && last2.removed === removed) { - components[components.length - 1] = { - count: last2.count + 1, - added, - removed - }; - } else { - components.push({ - count: 1, - added, - removed - }); - } - }, - extractCommon: function extractCommon2(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0; - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { - newPos++; - oldPos++; - commonCount++; - } - if (commonCount) { - basePath.components.push({ - count: commonCount - }); - } - basePath.newPos = newPos; - return oldPos; - }, - equals: function equals2(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); - } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); - } - }, - removeEmpty: function removeEmpty2(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - return ret; - }, - castInput: function castInput2(value) { - return value; - }, - tokenize: function tokenize2(value) { - return value.split(""); - }, - join: function join4(chars) { - return chars.join(""); - } -}; -function buildValues2(diff3, components, newString, oldString, useLongestToken) { - var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; - for (; componentPos < componentLen; componentPos++) { - var component = components[componentPos]; - if (!component.removed) { - if (!component.added && useLongestToken) { - var value = newString.slice(newPos, newPos + component.count); - value = value.map(function(value2, i) { - var oldValue = oldString[oldPos + i]; - return oldValue.length > value2.length ? oldValue : value2; - }); - component.value = diff3.join(value); - } else { - component.value = diff3.join(newString.slice(newPos, newPos + component.count)); - } - newPos += component.count; - if (!component.added) { - oldPos += component.count; - } - } else { - component.value = diff3.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } - } - } - var lastComponent = components[componentLen - 1]; - if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff3.equals("", lastComponent.value)) { - components[componentLen - 2].value += lastComponent.value; - components.pop(); - } - return components; -} -function clonePath(path2) { - return { - newPos: path2.newPos, - components: path2.components.slice(0) - }; -} -var characterDiff2 = new Diff2(); -function diffChars(oldStr, newStr, options) { - return characterDiff2.diff(oldStr, newStr, options); -} -var extendedWordChars2 = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; -var reWhitespace2 = /\S/; -var wordDiff2 = new Diff2(); -wordDiff2.equals = function(left, right) { - if (this.options.ignoreCase) { - left = left.toLowerCase(); - right = right.toLowerCase(); - } - return left === right || this.options.ignoreWhitespace && !reWhitespace2.test(left) && !reWhitespace2.test(right); -}; -wordDiff2.tokenize = function(value) { - var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); - for (var i = 0; i < tokens.length - 1; i++) { - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars2.test(tokens[i]) && extendedWordChars2.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - return tokens; -}; -function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff2.diff(oldStr, newStr, options); -} -var lineDiff2 = new Diff2(); -lineDiff2.tokenize = function(value) { - var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); - if (!linesAndNewlines[linesAndNewlines.length - 1]) { - linesAndNewlines.pop(); - } - for (var i = 0; i < linesAndNewlines.length; i++) { - var line = linesAndNewlines[i]; - if (i % 2 && !this.options.newlineIsToken) { - retLines[retLines.length - 1] += line; - } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); - } - } - return retLines; -}; -var sentenceDiff2 = new Diff2(); -sentenceDiff2.tokenize = function(value) { - return value.split(/(\S.+?[.!?])(?=\s+|$)/); -}; -var cssDiff2 = new Diff2(); -cssDiff2.tokenize = function(value) { - return value.split(/([{}:;,]|\s+)/); -}; -function _typeof2(obj) { - "@babel/helpers - typeof"; - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); -} -var objectPrototypeToString2 = Object.prototype.toString; -var jsonDiff2 = new Diff2(); -jsonDiff2.useLongestToken = true; -jsonDiff2.tokenize = lineDiff2.tokenize; -jsonDiff2.castInput = function(value) { - var _this$options = this.options, undefinedReplacement = _this$options.undefinedReplacement, _this$options$stringi = _this$options.stringifyReplacer, stringifyReplacer = _this$options$stringi === void 0 ? function(k, v) { - return typeof v === "undefined" ? undefinedReplacement : v; - } : _this$options$stringi; - return typeof value === "string" ? value : JSON.stringify(canonicalize2(value, null, null, stringifyReplacer), stringifyReplacer, " "); -}; -jsonDiff2.equals = function(left, right) { - return Diff2.prototype.equals.call(jsonDiff2, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1")); -}; -function canonicalize2(obj, stack, replacementStack, replacer, key2) { - stack = stack || []; - replacementStack = replacementStack || []; - if (replacer) { - obj = replacer(key2, obj); - } - var i; - for (i = 0; i < stack.length; i += 1) { - if (stack[i] === obj) { - return replacementStack[i]; - } - } - var canonicalizedObj; - if ("[object Array]" === objectPrototypeToString2.call(obj)) { - stack.push(obj); - canonicalizedObj = new Array(obj.length); - replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { - canonicalizedObj[i] = canonicalize2(obj[i], stack, replacementStack, replacer, key2); - } - stack.pop(); - replacementStack.pop(); - return canonicalizedObj; - } - if (obj && obj.toJSON) { - obj = obj.toJSON(); - } - if (_typeof2(obj) === "object" && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - replacementStack.push(canonicalizedObj); - var sortedKeys = [], _key; - for (_key in obj) { - if (obj.hasOwnProperty(_key)) { - sortedKeys.push(_key); - } - } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { - _key = sortedKeys[i]; - canonicalizedObj[_key] = canonicalize2(obj[_key], stack, replacementStack, replacer, _key); - } - stack.pop(); - replacementStack.pop(); - } else { - canonicalizedObj = obj; - } - return canonicalizedObj; -} -var arrayDiff2 = new Diff2(); -arrayDiff2.tokenize = function(value) { - return value.slice(); -}; -arrayDiff2.join = arrayDiff2.removeEmpty = function(value) { - return value; -}; - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/rematch.js -init_polyfill_buffer(); -function levenshtein(a, b) { - if (a.length === 0) { - return b.length; - } - if (b.length === 0) { - return a.length; - } - const matrix = []; - let i; - for (i = 0; i <= b.length; i++) { - matrix[i] = [i]; - } - let j; - for (j = 0; j <= a.length; j++) { - matrix[0][j] = j; - } - for (i = 1; i <= b.length; i++) { - for (j = 1; j <= a.length; j++) { - if (b.charAt(i - 1) === a.charAt(j - 1)) { - matrix[i][j] = matrix[i - 1][j - 1]; - } else { - matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1)); - } - } - } - return matrix[b.length][a.length]; -} -function newDistanceFn(str) { - return (x, y) => { - const xValue = str(x).trim(); - const yValue = str(y).trim(); - const lev = levenshtein(xValue, yValue); - return lev / (xValue.length + yValue.length); - }; -} -function newMatcherFn(distance2) { - function findBestMatch(a, b, cache = /* @__PURE__ */ new Map()) { - let bestMatchDist = Infinity; - let bestMatch; - for (let i = 0; i < a.length; ++i) { - for (let j = 0; j < b.length; ++j) { - const cacheKey = JSON.stringify([a[i], b[j]]); - let md; - if (!(cache.has(cacheKey) && (md = cache.get(cacheKey)))) { - md = distance2(a[i], b[j]); - cache.set(cacheKey, md); - } - if (md < bestMatchDist) { - bestMatchDist = md; - bestMatch = { indexA: i, indexB: j, score: bestMatchDist }; - } - } - } - return bestMatch; - } - function group(a, b, level = 0, cache = /* @__PURE__ */ new Map()) { - const bm = findBestMatch(a, b, cache); - if (!bm || a.length + b.length < 3) { - return [[a, b]]; - } - const a1 = a.slice(0, bm.indexA); - const b1 = b.slice(0, bm.indexB); - const aMatch = [a[bm.indexA]]; - const bMatch = [b[bm.indexB]]; - const tailA = bm.indexA + 1; - const tailB = bm.indexB + 1; - const a2 = a.slice(tailA); - const b2 = b.slice(tailB); - const group1 = group(a1, b1, level + 1, cache); - const groupMatch = group(aMatch, bMatch, level + 1, cache); - const group2 = group(a2, b2, level + 1, cache); - let result = groupMatch; - if (bm.indexA > 0 || bm.indexB > 0) { - result = group1.concat(result); - } - if (a.length > tailA || b.length > tailB) { - result = result.concat(group2); - } - return result; - } - return group; -} - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/render-utils.js -var CSSLineClass = { - INSERTS: "d2h-ins", - DELETES: "d2h-del", - CONTEXT: "d2h-cntx", - INFO: "d2h-info", - INSERT_CHANGES: "d2h-ins d2h-change", - DELETE_CHANGES: "d2h-del d2h-change" -}; -var defaultRenderConfig = { - matching: LineMatchingType.NONE, - matchWordsThreshold: 0.25, - maxLineLengthHighlight: 1e4, - diffStyle: DiffStyleType.WORD, - colorScheme: ColorSchemeType.LIGHT -}; -var separator = "/"; -var distance = newDistanceFn((change) => change.value); -var matcher = newMatcherFn(distance); -function isDevNullName(name) { - return name.indexOf("dev/null") !== -1; -} -function removeInsElements(line) { - return line.replace(/(]*>((.|\n)*?)<\/ins>)/g, ""); -} -function removeDelElements(line) { - return line.replace(/(]*>((.|\n)*?)<\/del>)/g, ""); -} -function toCSSClass(lineType) { - switch (lineType) { - case LineType.CONTEXT: - return CSSLineClass.CONTEXT; - case LineType.INSERT: - return CSSLineClass.INSERTS; - case LineType.DELETE: - return CSSLineClass.DELETES; - } -} -function colorSchemeToCss(colorScheme) { - switch (colorScheme) { - case ColorSchemeType.DARK: - return "d2h-dark-color-scheme"; - case ColorSchemeType.AUTO: - return "d2h-auto-color-scheme"; - case ColorSchemeType.LIGHT: - default: - return "d2h-light-color-scheme"; - } -} -function prefixLength(isCombined) { - return isCombined ? 2 : 1; -} -function escapeForHtml(str) { - return str.slice(0).replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/"); -} -function deconstructLine(line, isCombined, escape = true) { - const indexToSplit = prefixLength(isCombined); - return { - prefix: line.substring(0, indexToSplit), - content: escape ? escapeForHtml(line.substring(indexToSplit)) : line.substring(indexToSplit) - }; -} -function filenameDiff(file) { - const oldFilename = unifyPath(file.oldName); - const newFilename = unifyPath(file.newName); - if (oldFilename !== newFilename && !isDevNullName(oldFilename) && !isDevNullName(newFilename)) { - const prefixPaths = []; - const suffixPaths = []; - const oldFilenameParts = oldFilename.split(separator); - const newFilenameParts = newFilename.split(separator); - const oldFilenamePartsSize = oldFilenameParts.length; - const newFilenamePartsSize = newFilenameParts.length; - let i = 0; - let j = oldFilenamePartsSize - 1; - let k = newFilenamePartsSize - 1; - while (i < j && i < k) { - if (oldFilenameParts[i] === newFilenameParts[i]) { - prefixPaths.push(newFilenameParts[i]); - i += 1; - } else { - break; - } - } - while (j > i && k > i) { - if (oldFilenameParts[j] === newFilenameParts[k]) { - suffixPaths.unshift(newFilenameParts[k]); - j -= 1; - k -= 1; - } else { - break; - } - } - const finalPrefix = prefixPaths.join(separator); - const finalSuffix = suffixPaths.join(separator); - const oldRemainingPath = oldFilenameParts.slice(i, j + 1).join(separator); - const newRemainingPath = newFilenameParts.slice(i, k + 1).join(separator); - if (finalPrefix.length && finalSuffix.length) { - return finalPrefix + separator + "{" + oldRemainingPath + " \u2192 " + newRemainingPath + "}" + separator + finalSuffix; - } else if (finalPrefix.length) { - return finalPrefix + separator + "{" + oldRemainingPath + " \u2192 " + newRemainingPath + "}"; - } else if (finalSuffix.length) { - return "{" + oldRemainingPath + " \u2192 " + newRemainingPath + "}" + separator + finalSuffix; - } - return oldFilename + " \u2192 " + newFilename; - } else if (!isDevNullName(newFilename)) { - return newFilename; - } else { - return oldFilename; - } -} -function getHtmlId(file) { - return `d2h-${hashCode(filenameDiff(file)).toString().slice(-6)}`; -} -function getFileIcon(file) { - let templateName = "file-changed"; - if (file.isRename) { - templateName = "file-renamed"; - } else if (file.isCopy) { - templateName = "file-renamed"; - } else if (file.isNew) { - templateName = "file-added"; - } else if (file.isDeleted) { - templateName = "file-deleted"; - } else if (file.newName !== file.oldName) { - templateName = "file-renamed"; - } - return templateName; -} -function diffHighlight(diffLine1, diffLine2, isCombined, config = {}) { - const { matching, maxLineLengthHighlight, matchWordsThreshold, diffStyle } = Object.assign(Object.assign({}, defaultRenderConfig), config); - const line1 = deconstructLine(diffLine1, isCombined, false); - const line2 = deconstructLine(diffLine2, isCombined, false); - if (line1.content.length > maxLineLengthHighlight || line2.content.length > maxLineLengthHighlight) { - return { - oldLine: { - prefix: line1.prefix, - content: escapeForHtml(line1.content) - }, - newLine: { - prefix: line2.prefix, - content: escapeForHtml(line2.content) - } - }; - } - const diff3 = diffStyle === "char" ? diffChars(line1.content, line2.content) : diffWordsWithSpace(line1.content, line2.content); - const changedWords = []; - if (diffStyle === "word" && matching === "words") { - const removed = diff3.filter((element2) => element2.removed); - const added = diff3.filter((element2) => element2.added); - const chunks = matcher(added, removed); - chunks.forEach((chunk) => { - if (chunk[0].length === 1 && chunk[1].length === 1) { - const dist = distance(chunk[0][0], chunk[1][0]); - if (dist < matchWordsThreshold) { - changedWords.push(chunk[0][0]); - changedWords.push(chunk[1][0]); - } - } - }); - } - const highlightedLine = diff3.reduce((highlightedLine2, part) => { - const elemType = part.added ? "ins" : part.removed ? "del" : null; - const addClass = changedWords.indexOf(part) > -1 ? ' class="d2h-change"' : ""; - const escapedValue = escapeForHtml(part.value); - return elemType !== null ? `${highlightedLine2}<${elemType}${addClass}>${escapedValue}` : `${highlightedLine2}${escapedValue}`; - }, ""); - return { - oldLine: { - prefix: line1.prefix, - content: removeInsElements(highlightedLine) - }, - newLine: { - prefix: line2.prefix, - content: removeDelElements(highlightedLine) - } - }; -} - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/file-list-renderer.js -var baseTemplatesPath = "file-summary"; -var iconsBaseTemplatesPath = "icon"; -var defaultFileListRendererConfig = { - colorScheme: defaultRenderConfig.colorScheme -}; -var FileListRenderer = class { - constructor(hoganUtils, config = {}) { - this.hoganUtils = hoganUtils; - this.config = Object.assign(Object.assign({}, defaultFileListRendererConfig), config); - } - render(diffFiles) { - const files = diffFiles.map((file) => this.hoganUtils.render(baseTemplatesPath, "line", { - fileHtmlId: getHtmlId(file), - oldName: file.oldName, - newName: file.newName, - fileName: filenameDiff(file), - deletedLines: "-" + file.deletedLines, - addedLines: "+" + file.addedLines - }, { - fileIcon: this.hoganUtils.template(iconsBaseTemplatesPath, getFileIcon(file)) - })).join("\n"); - return this.hoganUtils.render(baseTemplatesPath, "wrapper", { - colorScheme: colorSchemeToCss(this.config.colorScheme), - filesNumber: diffFiles.length, - files - }); - } -}; - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/line-by-line-renderer.js -init_polyfill_buffer(); -var defaultLineByLineRendererConfig = Object.assign(Object.assign({}, defaultRenderConfig), { renderNothingWhenEmpty: false, matchingMaxComparisons: 2500, maxLineSizeInBlockForComparison: 200 }); -var genericTemplatesPath = "generic"; -var baseTemplatesPath2 = "line-by-line"; -var iconsBaseTemplatesPath2 = "icon"; -var tagsBaseTemplatesPath = "tag"; -var LineByLineRenderer = class { - constructor(hoganUtils, config = {}) { - this.hoganUtils = hoganUtils; - this.config = Object.assign(Object.assign({}, defaultLineByLineRendererConfig), config); - } - render(diffFiles) { - const diffsHtml = diffFiles.map((file) => { - let diffs; - if (file.blocks.length) { - diffs = this.generateFileHtml(file); - } else { - diffs = this.generateEmptyDiff(); - } - return this.makeFileDiffHtml(file, diffs); - }).join("\n"); - return this.hoganUtils.render(genericTemplatesPath, "wrapper", { - colorScheme: colorSchemeToCss(this.config.colorScheme), - content: diffsHtml - }); - } - makeFileDiffHtml(file, diffs) { - if (this.config.renderNothingWhenEmpty && Array.isArray(file.blocks) && file.blocks.length === 0) - return ""; - const fileDiffTemplate = this.hoganUtils.template(baseTemplatesPath2, "file-diff"); - const filePathTemplate = this.hoganUtils.template(genericTemplatesPath, "file-path"); - const fileIconTemplate = this.hoganUtils.template(iconsBaseTemplatesPath2, "file"); - const fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath, getFileIcon(file)); - return fileDiffTemplate.render({ - file, - fileHtmlId: getHtmlId(file), - diffs, - filePath: filePathTemplate.render({ - fileDiffName: filenameDiff(file) - }, { - fileIcon: fileIconTemplate, - fileTag: fileTagTemplate - }) - }); - } - generateEmptyDiff() { - return this.hoganUtils.render(genericTemplatesPath, "empty-diff", { - contentClass: "d2h-code-line", - CSSLineClass - }); - } - generateFileHtml(file) { - const matcher2 = newMatcherFn(newDistanceFn((e) => deconstructLine(e.content, file.isCombined).content)); - return file.blocks.map((block) => { - let lines = this.hoganUtils.render(genericTemplatesPath, "block-header", { - CSSLineClass, - blockHeader: file.isTooBig ? block.header : escapeForHtml(block.header), - lineClass: "d2h-code-linenumber", - contentClass: "d2h-code-line" - }); - this.applyLineGroupping(block).forEach(([contextLines, oldLines, newLines]) => { - if (oldLines.length && newLines.length && !contextLines.length) { - this.applyRematchMatching(oldLines, newLines, matcher2).map(([oldLines2, newLines2]) => { - const { left, right } = this.processChangedLines(file, file.isCombined, oldLines2, newLines2); - lines += left; - lines += right; - }); - } else if (contextLines.length) { - contextLines.forEach((line) => { - const { prefix, content } = deconstructLine(line.content, file.isCombined); - lines += this.generateSingleLineHtml(file, { - type: CSSLineClass.CONTEXT, - prefix, - content, - oldNumber: line.oldNumber, - newNumber: line.newNumber - }); - }); - } else if (oldLines.length || newLines.length) { - const { left, right } = this.processChangedLines(file, file.isCombined, oldLines, newLines); - lines += left; - lines += right; - } else { - console.error("Unknown state reached while processing groups of lines", contextLines, oldLines, newLines); - } - }); - return lines; - }).join("\n"); - } - applyLineGroupping(block) { - const blockLinesGroups = []; - let oldLines = []; - let newLines = []; - for (let i = 0; i < block.lines.length; i++) { - const diffLine = block.lines[i]; - if (diffLine.type !== LineType.INSERT && newLines.length || diffLine.type === LineType.CONTEXT && oldLines.length > 0) { - blockLinesGroups.push([[], oldLines, newLines]); - oldLines = []; - newLines = []; - } - if (diffLine.type === LineType.CONTEXT) { - blockLinesGroups.push([[diffLine], [], []]); - } else if (diffLine.type === LineType.INSERT && oldLines.length === 0) { - blockLinesGroups.push([[], [], [diffLine]]); - } else if (diffLine.type === LineType.INSERT && oldLines.length > 0) { - newLines.push(diffLine); - } else if (diffLine.type === LineType.DELETE) { - oldLines.push(diffLine); - } - } - if (oldLines.length || newLines.length) { - blockLinesGroups.push([[], oldLines, newLines]); - oldLines = []; - newLines = []; - } - return blockLinesGroups; - } - applyRematchMatching(oldLines, newLines, matcher2) { - const comparisons = oldLines.length * newLines.length; - const maxLineSizeInBlock = Math.max.apply(null, [0].concat(oldLines.concat(newLines).map((elem) => elem.content.length))); - const doMatching = comparisons < this.config.matchingMaxComparisons && maxLineSizeInBlock < this.config.maxLineSizeInBlockForComparison && (this.config.matching === "lines" || this.config.matching === "words"); - return doMatching ? matcher2(oldLines, newLines) : [[oldLines, newLines]]; - } - processChangedLines(file, isCombined, oldLines, newLines) { - const fileHtml = { - right: "", - left: "" - }; - const maxLinesNumber = Math.max(oldLines.length, newLines.length); - for (let i = 0; i < maxLinesNumber; i++) { - const oldLine = oldLines[i]; - const newLine = newLines[i]; - const diff3 = oldLine !== void 0 && newLine !== void 0 ? diffHighlight(oldLine.content, newLine.content, isCombined, this.config) : void 0; - const preparedOldLine = oldLine !== void 0 && oldLine.oldNumber !== void 0 ? Object.assign(Object.assign({}, diff3 !== void 0 ? { - prefix: diff3.oldLine.prefix, - content: diff3.oldLine.content, - type: CSSLineClass.DELETE_CHANGES - } : Object.assign(Object.assign({}, deconstructLine(oldLine.content, isCombined)), { type: toCSSClass(oldLine.type) })), { oldNumber: oldLine.oldNumber, newNumber: oldLine.newNumber }) : void 0; - const preparedNewLine = newLine !== void 0 && newLine.newNumber !== void 0 ? Object.assign(Object.assign({}, diff3 !== void 0 ? { - prefix: diff3.newLine.prefix, - content: diff3.newLine.content, - type: CSSLineClass.INSERT_CHANGES - } : Object.assign(Object.assign({}, deconstructLine(newLine.content, isCombined)), { type: toCSSClass(newLine.type) })), { oldNumber: newLine.oldNumber, newNumber: newLine.newNumber }) : void 0; - const { left, right } = this.generateLineHtml(file, preparedOldLine, preparedNewLine); - fileHtml.left += left; - fileHtml.right += right; - } - return fileHtml; - } - generateLineHtml(file, oldLine, newLine) { - return { - left: this.generateSingleLineHtml(file, oldLine), - right: this.generateSingleLineHtml(file, newLine) - }; - } - generateSingleLineHtml(file, line) { - if (line === void 0) - return ""; - const lineNumberHtml = this.hoganUtils.render(baseTemplatesPath2, "numbers", { - oldNumber: line.oldNumber || "", - newNumber: line.newNumber || "" - }); - return this.hoganUtils.render(genericTemplatesPath, "line", { - type: line.type, - lineClass: "d2h-code-linenumber", - contentClass: "d2h-code-line", - prefix: line.prefix === " " ? " " : line.prefix, - content: line.content, - lineNumber: lineNumberHtml, - line, - file - }); - } -}; - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/side-by-side-renderer.js -init_polyfill_buffer(); -var defaultSideBySideRendererConfig = Object.assign(Object.assign({}, defaultRenderConfig), { renderNothingWhenEmpty: false, matchingMaxComparisons: 2500, maxLineSizeInBlockForComparison: 200 }); -var genericTemplatesPath2 = "generic"; -var baseTemplatesPath3 = "side-by-side"; -var iconsBaseTemplatesPath3 = "icon"; -var tagsBaseTemplatesPath2 = "tag"; -var SideBySideRenderer = class { - constructor(hoganUtils, config = {}) { - this.hoganUtils = hoganUtils; - this.config = Object.assign(Object.assign({}, defaultSideBySideRendererConfig), config); - } - render(diffFiles) { - const diffsHtml = diffFiles.map((file) => { - let diffs; - if (file.blocks.length) { - diffs = this.generateFileHtml(file); - } else { - diffs = this.generateEmptyDiff(); - } - return this.makeFileDiffHtml(file, diffs); - }).join("\n"); - return this.hoganUtils.render(genericTemplatesPath2, "wrapper", { - colorScheme: colorSchemeToCss(this.config.colorScheme), - content: diffsHtml - }); - } - makeFileDiffHtml(file, diffs) { - if (this.config.renderNothingWhenEmpty && Array.isArray(file.blocks) && file.blocks.length === 0) - return ""; - const fileDiffTemplate = this.hoganUtils.template(baseTemplatesPath3, "file-diff"); - const filePathTemplate = this.hoganUtils.template(genericTemplatesPath2, "file-path"); - const fileIconTemplate = this.hoganUtils.template(iconsBaseTemplatesPath3, "file"); - const fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath2, getFileIcon(file)); - return fileDiffTemplate.render({ - file, - fileHtmlId: getHtmlId(file), - diffs, - filePath: filePathTemplate.render({ - fileDiffName: filenameDiff(file) - }, { - fileIcon: fileIconTemplate, - fileTag: fileTagTemplate - }) - }); - } - generateEmptyDiff() { - return { - right: "", - left: this.hoganUtils.render(genericTemplatesPath2, "empty-diff", { - contentClass: "d2h-code-side-line", - CSSLineClass - }) - }; - } - generateFileHtml(file) { - const matcher2 = newMatcherFn(newDistanceFn((e) => deconstructLine(e.content, file.isCombined).content)); - return file.blocks.map((block) => { - const fileHtml = { - left: this.makeHeaderHtml(block.header, file), - right: this.makeHeaderHtml("") - }; - this.applyLineGroupping(block).forEach(([contextLines, oldLines, newLines]) => { - if (oldLines.length && newLines.length && !contextLines.length) { - this.applyRematchMatching(oldLines, newLines, matcher2).map(([oldLines2, newLines2]) => { - const { left, right } = this.processChangedLines(file.isCombined, oldLines2, newLines2); - fileHtml.left += left; - fileHtml.right += right; - }); - } else if (contextLines.length) { - contextLines.forEach((line) => { - const { prefix, content } = deconstructLine(line.content, file.isCombined); - const { left, right } = this.generateLineHtml({ - type: CSSLineClass.CONTEXT, - prefix, - content, - number: line.oldNumber - }, { - type: CSSLineClass.CONTEXT, - prefix, - content, - number: line.newNumber - }); - fileHtml.left += left; - fileHtml.right += right; - }); - } else if (oldLines.length || newLines.length) { - const { left, right } = this.processChangedLines(file.isCombined, oldLines, newLines); - fileHtml.left += left; - fileHtml.right += right; - } else { - console.error("Unknown state reached while processing groups of lines", contextLines, oldLines, newLines); - } - }); - return fileHtml; - }).reduce((accomulated, html2) => { - return { left: accomulated.left + html2.left, right: accomulated.right + html2.right }; - }, { left: "", right: "" }); - } - applyLineGroupping(block) { - const blockLinesGroups = []; - let oldLines = []; - let newLines = []; - for (let i = 0; i < block.lines.length; i++) { - const diffLine = block.lines[i]; - if (diffLine.type !== LineType.INSERT && newLines.length || diffLine.type === LineType.CONTEXT && oldLines.length > 0) { - blockLinesGroups.push([[], oldLines, newLines]); - oldLines = []; - newLines = []; - } - if (diffLine.type === LineType.CONTEXT) { - blockLinesGroups.push([[diffLine], [], []]); - } else if (diffLine.type === LineType.INSERT && oldLines.length === 0) { - blockLinesGroups.push([[], [], [diffLine]]); - } else if (diffLine.type === LineType.INSERT && oldLines.length > 0) { - newLines.push(diffLine); - } else if (diffLine.type === LineType.DELETE) { - oldLines.push(diffLine); - } - } - if (oldLines.length || newLines.length) { - blockLinesGroups.push([[], oldLines, newLines]); - oldLines = []; - newLines = []; - } - return blockLinesGroups; - } - applyRematchMatching(oldLines, newLines, matcher2) { - const comparisons = oldLines.length * newLines.length; - const maxLineSizeInBlock = Math.max.apply(null, [0].concat(oldLines.concat(newLines).map((elem) => elem.content.length))); - const doMatching = comparisons < this.config.matchingMaxComparisons && maxLineSizeInBlock < this.config.maxLineSizeInBlockForComparison && (this.config.matching === "lines" || this.config.matching === "words"); - return doMatching ? matcher2(oldLines, newLines) : [[oldLines, newLines]]; - } - makeHeaderHtml(blockHeader, file) { - return this.hoganUtils.render(genericTemplatesPath2, "block-header", { - CSSLineClass, - blockHeader: (file === null || file === void 0 ? void 0 : file.isTooBig) ? blockHeader : escapeForHtml(blockHeader), - lineClass: "d2h-code-side-linenumber", - contentClass: "d2h-code-side-line" - }); - } - processChangedLines(isCombined, oldLines, newLines) { - const fileHtml = { - right: "", - left: "" - }; - const maxLinesNumber = Math.max(oldLines.length, newLines.length); - for (let i = 0; i < maxLinesNumber; i++) { - const oldLine = oldLines[i]; - const newLine = newLines[i]; - const diff3 = oldLine !== void 0 && newLine !== void 0 ? diffHighlight(oldLine.content, newLine.content, isCombined, this.config) : void 0; - const preparedOldLine = oldLine !== void 0 && oldLine.oldNumber !== void 0 ? Object.assign(Object.assign({}, diff3 !== void 0 ? { - prefix: diff3.oldLine.prefix, - content: diff3.oldLine.content, - type: CSSLineClass.DELETE_CHANGES - } : Object.assign(Object.assign({}, deconstructLine(oldLine.content, isCombined)), { type: toCSSClass(oldLine.type) })), { number: oldLine.oldNumber }) : void 0; - const preparedNewLine = newLine !== void 0 && newLine.newNumber !== void 0 ? Object.assign(Object.assign({}, diff3 !== void 0 ? { - prefix: diff3.newLine.prefix, - content: diff3.newLine.content, - type: CSSLineClass.INSERT_CHANGES - } : Object.assign(Object.assign({}, deconstructLine(newLine.content, isCombined)), { type: toCSSClass(newLine.type) })), { number: newLine.newNumber }) : void 0; - const { left, right } = this.generateLineHtml(preparedOldLine, preparedNewLine); - fileHtml.left += left; - fileHtml.right += right; - } - return fileHtml; - } - generateLineHtml(oldLine, newLine) { - return { - left: this.generateSingleHtml(oldLine), - right: this.generateSingleHtml(newLine) - }; - } - generateSingleHtml(line) { - const lineClass = "d2h-code-side-linenumber"; - const contentClass = "d2h-code-side-line"; - return this.hoganUtils.render(genericTemplatesPath2, "line", { - type: (line === null || line === void 0 ? void 0 : line.type) || `${CSSLineClass.CONTEXT} d2h-emptyplaceholder`, - lineClass: line !== void 0 ? lineClass : `${lineClass} d2h-code-side-emptyplaceholder`, - contentClass: line !== void 0 ? contentClass : `${contentClass} d2h-code-side-emptyplaceholder`, - prefix: (line === null || line === void 0 ? void 0 : line.prefix) === " " ? " " : line === null || line === void 0 ? void 0 : line.prefix, - content: line === null || line === void 0 ? void 0 : line.content, - lineNumber: line === null || line === void 0 ? void 0 : line.number - }); - } -}; - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/hoganjs-utils.js -init_polyfill_buffer(); -var Hogan3 = __toESM(require_hogan()); - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/diff2html-templates.js -init_polyfill_buffer(); -var Hogan2 = __toESM(require_hogan()); -var defaultTemplates = {}; -defaultTemplates["file-summary-line"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('
  • '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(t.rp("'); - t.b(t.v(t.f("fileName", c, p, 0))); - t.b(""); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(' '); - t.b(t.v(t.f("addedLines", c, p, 0))); - t.b(""); - t.b("\n" + i); - t.b(' '); - t.b(t.v(t.f("deletedLines", c, p, 0))); - t.b(""); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b("
  • "); - return t.fl(); -}, partials: { "'); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b(' Files changed ('); - t.b(t.v(t.f("filesNumber", c, p, 0))); - t.b(")"); - t.b("\n" + i); - t.b(' hide'); - t.b("\n" + i); - t.b(' show'); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b('
      '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.f("files", c, p, 0))); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["generic-block-header"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b(""); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b('
    '); - if (t.s(t.f("blockHeader", c, p, 1), c, p, 0, 156, 173, "{{ }}")) { - t.rs(c, p, function(c2, p2, t2) { - t2.b(t2.t(t2.f("blockHeader", c2, p2, 0))); - }); - c.pop(); - } - if (!t.s(t.f("blockHeader", c, p, 1), c, p, 1, 0, 0, "")) { - t.b(" "); - } - ; - t.b("
    "); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b(""); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["generic-empty-diff"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b(""); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b(" File without changes"); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b(""); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["generic-file-path"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b(''); - t.b("\n" + i); - t.b(t.rp("'); - t.b(t.v(t.f("fileDiffName", c, p, 0))); - t.b(""); - t.b("\n" + i); - t.b(t.rp(""); - t.b("\n" + i); - t.b('"); - return t.fl(); -}, partials: { ""); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.f("lineNumber", c, p, 0))); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - if (t.s(t.f("prefix", c, p, 1), c, p, 0, 162, 238, "{{ }}")) { - t.rs(c, p, function(c2, p2, t2) { - t2.b(' '); - t2.b(t2.t(t2.f("prefix", c2, p2, 0))); - t2.b(""); - t2.b("\n" + i); - }); - c.pop(); - } - if (!t.s(t.f("prefix", c, p, 1), c, p, 1, 0, 0, "")) { - t.b('  '); - t.b("\n" + i); - } - ; - if (t.s(t.f("content", c, p, 1), c, p, 0, 371, 445, "{{ }}")) { - t.rs(c, p, function(c2, p2, t2) { - t2.b(' '); - t2.b(t2.t(t2.f("content", c2, p2, 0))); - t2.b(""); - t2.b("\n" + i); - }); - c.pop(); - } - if (!t.s(t.f("content", c, p, 1), c, p, 1, 0, 0, "")) { - t.b('
    '); - t.b("\n" + i); - } - ; - t.b("
    "); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b(""); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["generic-wrapper"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('
    '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.f("content", c, p, 0))); - t.b("\n" + i); - t.b("
    "); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["icon-file-added"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('"); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["icon-file-changed"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('"); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["icon-file-deleted"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('"); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["icon-file-renamed"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('"); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["icon-file"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('"); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["line-by-line-file-diff"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('
    '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.f("filePath", c, p, 0))); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.f("diffs", c, p, 0))); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["line-by-line-numbers"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('
    '); - t.b(t.v(t.f("oldNumber", c, p, 0))); - t.b("
    "); - t.b("\n" + i); - t.b('
    '); - t.b(t.v(t.f("newNumber", c, p, 0))); - t.b("
    "); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["side-by-side-file-diff"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('
    '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.f("filePath", c, p, 0))); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.d("diffs.left", c, p, 0))); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b('
    '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(' '); - t.b("\n" + i); - t.b(" "); - t.b(t.t(t.d("diffs.right", c, p, 0))); - t.b("\n" + i); - t.b(" "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - t.b("\n" + i); - t.b("
    "); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["tag-file-added"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('ADDED'); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["tag-file-changed"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('CHANGED'); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["tag-file-deleted"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('DELETED'); - return t.fl(); -}, partials: {}, subs: {} }); -defaultTemplates["tag-file-renamed"] = new Hogan2.Template({ code: function(c, p, i) { - var t = this; - t.b(i = i || ""); - t.b('RENAMED'); - return t.fl(); -}, partials: {}, subs: {} }); - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/hoganjs-utils.js -var HoganJsUtils = class { - constructor({ compiledTemplates = {}, rawTemplates = {} }) { - const compiledRawTemplates = Object.entries(rawTemplates).reduce((previousTemplates, [name, templateString]) => { - const compiledTemplate = Hogan3.compile(templateString, { asString: false }); - return Object.assign(Object.assign({}, previousTemplates), { [name]: compiledTemplate }); - }, {}); - this.preCompiledTemplates = Object.assign(Object.assign(Object.assign({}, defaultTemplates), compiledTemplates), compiledRawTemplates); - } - static compile(templateString) { - return Hogan3.compile(templateString, { asString: false }); - } - render(namespace, view, params, partials, indent2) { - const templateKey = this.templateKey(namespace, view); - try { - const template = this.preCompiledTemplates[templateKey]; - return template.render(params, partials, indent2); - } catch (e) { - throw new Error(`Could not find template to render '${templateKey}'`); - } - } - template(namespace, view) { - return this.preCompiledTemplates[this.templateKey(namespace, view)]; - } - templateKey(namespace, view) { - return `${namespace}-${view}`; - } -}; - -// node_modules/.pnpm/diff2html@3.4.48/node_modules/diff2html/lib-esm/diff2html.js -var defaultDiff2HtmlConfig = Object.assign(Object.assign(Object.assign({}, defaultLineByLineRendererConfig), defaultSideBySideRendererConfig), { outputFormat: OutputFormatType.LINE_BY_LINE, drawFileList: true }); -function html(diffInput, configuration = {}) { - const config = Object.assign(Object.assign({}, defaultDiff2HtmlConfig), configuration); - const diffJson = typeof diffInput === "string" ? parse(diffInput, config) : diffInput; - const hoganUtils = new HoganJsUtils(config); - const { colorScheme } = config; - const fileListRendererConfig = { colorScheme }; - const fileList = config.drawFileList ? new FileListRenderer(hoganUtils, fileListRendererConfig).render(diffJson) : ""; - const diffOutput = config.outputFormat === "side-by-side" ? new SideBySideRenderer(hoganUtils, config).render(diffJson) : new LineByLineRenderer(hoganUtils, config).render(diffJson); - return fileList + diffOutput; -} - -// src/ui/diff/diffView.ts -var import_obsidian17 = require("obsidian"); -var DiffView = class extends import_obsidian17.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.plugin = plugin; - this.gettingDiff = false; - this.gitRefreshBind = this.refresh.bind(this); - this.gitViewRefreshBind = this.refresh.bind(this); - this.parser = new DOMParser(); - this.navigation = true; - addEventListener("git-refresh", this.gitRefreshBind); - addEventListener("git-view-refresh", this.gitViewRefreshBind); - } - getViewType() { - return DIFF_VIEW_CONFIG.type; - } - getDisplayText() { - var _a2; - if (((_a2 = this.state) == null ? void 0 : _a2.file) != null) { - let fileName = this.state.file.split("/").last(); - if (fileName == null ? void 0 : fileName.endsWith(".md")) fileName = fileName.slice(0, -3); - return DIFF_VIEW_CONFIG.name + ` (${fileName})`; - } - return DIFF_VIEW_CONFIG.name; - } - getIcon() { - return DIFF_VIEW_CONFIG.icon; - } - async setState(state, result) { - this.state = state; - if (import_obsidian17.Platform.isMobile) { - this.leaf.view.titleEl.textContent = this.getDisplayText(); - } - await this.refresh(); - } - getState() { - return this.state; - } - onClose() { - removeEventListener("git-refresh", this.gitRefreshBind); - removeEventListener("git-view-refresh", this.gitViewRefreshBind); - return super.onClose(); - } - onOpen() { - this.refresh(); - return super.onOpen(); - } - async refresh() { - var _a2; - if (((_a2 = this.state) == null ? void 0 : _a2.file) && !this.gettingDiff && this.plugin.gitManager) { - this.gettingDiff = true; - try { - let diff3 = await this.plugin.gitManager.getDiffString( - this.state.file, - this.state.staged, - this.state.hash - ); - this.contentEl.empty(); - if (!diff3) { - if (this.plugin.gitManager instanceof SimpleGit && await this.plugin.gitManager.isTracked( - this.state.file - )) { - diff3 = [ - `--- ${this.state.file}`, - `+++ ${this.state.file}`, - "" - ].join("\n"); - } else { - const content = await this.app.vault.adapter.read( - this.plugin.gitManager.getRelativeVaultPath( - this.state.file - ) - ); - const header = `--- /dev/null + style="background-color: ${a}; width: 30ch;" + >${o}`}`}previewCustomDateTimeDescriptionHtml(n){let r=(0,V.moment)().format(n);return`Format string to display the authoring date.
    Currently: ${r}`}previewOldestAgeDescriptionHtml(n){let r=xc(n);return[`The oldest age in the line author coloring. Everything older will have the same color. +
    Smallest valid age is "1d". Currently: ${r!==void 0?`${r.asDays()} days`:"invalid!"}`,r]}};function vp(t,e){return t==="oldest"?e.colorOld:e.colorNew}function xc(t){let e=V.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}function qS(t,e,n){if(!(t===void 0||e===void 0||n===void 0))return`head${t}-obj${e}-path${n}`}var XS=_c.Annotation.define();function YS(t,e,n){return n.update({annotations:XS.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}function uL(t){return t.annotation(XS)}var sa=_c.StateField.define({create:t=>{},update:(t,e)=>{var n;return(n=uL(e))!=null?n:fL(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function Sc(t){var a;let e=WS.sha256.create();if(!t)return e;let{la:n,key:r,lineOffsetsFromUnsavedChanges:i}=t;e.update(n==="untracked"?"t":"f"),e.update(r);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var an={get:void 0,save:void 0};function ZS(t,e){an.get=t,an.save=e}function Ec(t){var e,n;return(n=(e=xc(t.coloringMaxAge))==null?void 0:e.asDays())!=null?n:xc(Mn.lineAuthor.coloringMaxAge).asDays()}function fL(t,e){if(e)return t.changes.empty||t.changes.iterChanges((n,r,i,a)=>{var p;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(n).number,c=s.lineAt(r).number,u=o.lineAt(i).number,f=o.lineAt(a).number,h=c-l+1,d=f-u+1;for(let g=u;g<=f;g++){let m=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,w=f===g,b=d-h;w&&(m+=b),e.lineOffsetsFromUnsavedChanges.set(g,m)}}),e}var bp=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,n){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let r=this.view.state,i=YS(e,n,r);this.view.dispatch(i)}updateToNewState(e){let n=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=e,n&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(aa.ifFilepathDefinedTransformSubscribers(this.filepath,e=>e.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(e){aa.ifFilepathDefinedTransformSubscribers(e,n=>n.delete(this))}get filepath(){var e,n;return(n=(e=this.state.field(kc.editorInfoField))==null?void 0:e.file)==null?void 0:n.path}get view(){return this.state.field(kc.editorEditorField)}},JS=KS.StateField.define({create:t=>new bp(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});v();function QS(){oa=void 0,xp=[],Ac=0,Cc.clear(),Fc.clear(),la.clear()}var oa,Tc=()=>oa;function eE(t,e){var i;let n=e.length;if(n<((i=oa==null?void 0:oa.length)!=null?i:0))return;oa={gutter:t,length:n,text:e};let r=an.get();n!==r.gutterSpacingFallbackLength&&(r.gutterSpacingFallbackLength=n,an.save(r))}var xp=[],hL=15,Ac=0;function tE(t){xp[Ac]=t,Ac=(Ac+1)%hL}function nE(){return TS(xp)}var Cc=new Map,Fc=new Map,la=new Set;v();var mE=require("@codemirror/state"),gE=require("@codemirror/view");v();var kp=require("@codemirror/view"),fE=Ze(cp()),Pc=require("obsidian");v();v();var Mc={x:-10,y:-10};function rE(){Mc.x===-10&&window.addEventListener("mousedown",t=>{Mc.x=t.clientX,Mc.y=t.clientY})}function iE(){for(let t of la)if(dL(t,Mc))return t}function dL(t,e){let{x:n,y:r,width:i,height:a}=t.getBoundingClientRect();return n<=e.x&&e.x<=n+i&&r<=e.y&&e.y<=r+a}v();var Gs={};var aE="data-commit";function sE(t,e,n){if(e.hasFocus())return;let r=iE();if(!r)return;let i=mL(r);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&pL(i,t),_p("showCommitHash",t),_p("authorDisplay",t),_p("dateTimeFormatOptions",t))}function pL(t,e){e.addItem(n=>n.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(r=>navigator.clipboard.writeText(t.hash)))}function _p(t,e){var l,c;let n,r,i=Gs.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=Mn.lineAuthor[t];if(t==="showCommitHash")n="Show commit hash",r=a;else if(t==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:o;n="Show author "+(s?a:u),r=s?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=i.lastShownDateTimeFormatOptions)!=null?c:o;n="Show "+(s?a:u),n+=n.contains("date")?"":" date",r=s?"hide":u}else yr(t);e.addItem(u=>u.setTitle(n).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var h,d;return(d=(h=Gs.plugin)==null?void 0:h.settingsTab)==null?void 0:d.lineAuthorSettingHandler(t,r)}))}function oE(t,e,n){n.setAttr(aE,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function mL(t){let e=t.getAttr(aE);return e?JSON.parse(e):void 0}v();function wp(t,e){return t==="oldest"?Oc(0,!1,e).color:Oc(void 0,!0,e).color}function Oc(t,e,n){let r=Ec(n),i=Date.now()/1e3,a=t!=null?t:0,o=(e?0:i-a)/60/60/24,l=Math.pow(Math.clamp(o/r,0,1),1/2.3),c=gL(),u=n.colorNew,f=n.colorOld,h=c?.4:1,d=Sp(u.r,f.r,l)*h,p=Sp(u.g,f.g,l)*h,g=Sp(u.b,f.b,l)*h;return{color:`rgba(${d},${p},${g},${c?.75:.25})`,daysSinceCommit:o}}function Sp(t,e,n){return t+(e-t)*n}function gL(){var t;return((t=window.app)==null?void 0:t.getTheme())==="obsidian"}function lE(t){document.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}v();function cE(t,e,n){let r;for(let i=e;i<=n;i++){let a=t.hashPerLine[i],s=t.commits.get(a);(!r||s.isZeroCommit||yL(s,r))&&(r=s)}return r}function yL(t,e){var i,a,s,o;let n=(a=(i=t.author)==null?void 0:i.epochSeconds)!=null?a:0,r=(o=(s=e.author)==null?void 0:s.epochSeconds)!=null?o:0;return n>r}var uE="-",vL="+",wL=3,bL="*",xL=/\S/g,_L="%",ca=class t extends kp.GutterMarker{constructor(n){super();this.text=n}eq(n){return n instanceof t&&this.text===n.text}toDOM(){return document.createTextNode(this.text)}destroy(n){document.body.contains(n)||n.remove()}},Ep=class extends kp.GutterMarker{constructor(n,r,i,a,s,o){super();this.lineAuthoring=n;this.startLine=r;this.endLine=i;this.key=a;this.settings=s;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(n){return this.key===(n==null?void 0:n.key)&&this.startLine===(n==null?void 0:n.startLine)&&this.endLine===(n==null?void 0:n.endLine)&&(this==null?void 0:this.options)===(n==null?void 0:n.options)}toDOM(){var n;return this.precomputedDomProvider=(n=this.precomputedDomProvider)!=null?n:this.computeDom(),this.precomputedDomProvider()}destroy(n){document.body.contains(n)||(n.remove(),la.delete(n))}computeDom(){let n=cE(this.lineAuthoring,this.startLine,this.endLine),r=n.isZeroCommit?"":this.renderNonZeroCommit(n);return!n.isZeroCommit&&this.options!=="waiting-for-result"?eE(this,r):r=this.adaptTextForFakeCommit(n,r,this.options),this.createHtmlNode(n,r,this.options==="waiting-for-result")}createHtmlNode(n,r,i){var c;let a=window.createDiv();a.innerText=r;let{color:s,daysSinceCommit:o}=Oc((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds,n==null?void 0:n.isZeroCommit,this.settings);a.style.backgroundColor=s,oE(n,i,a);function l(){let u=a.cloneNode(!0);return la.add(u),i||tE(o),u}return l}renderNonZeroCommit(n){let r=this.settings.showCommitHash?this.renderHash(n):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(n,this.settings.authorDisplay)}`,a=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(n,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[r,i,a].filter(o=>o.length>=1).join(" ")}renderHash(n){return n.hash.substring(0,6)}renderAuthorName(n,r){var o,l,c,u;let i=(l=(o=n==null?void 0:n.author)==null?void 0:o.name)!=null?l:"",a=i.split(" ").filter(f=>f.length>=1),s;switch(r){case"initials":s=a.map(f=>f[0].toUpperCase()).join("");break;case"first name":s=(c=a.first())!=null?c:uE;break;case"last name":s=(u=a.last())!=null?u:uE;break;case"full":s=i;break;default:return yr(r)}return CS(n==null?void 0:n.author,n==null?void 0:n.committer)||(s=s+bL),s}renderAuthoringDate(n,r,i,a){var c;let s="?";if(((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds)===void 0)return s;let o;switch(r){case"date":o=_l;break;case"datetime":o=jh;break;case"custom":o=i;break;case"natural language":o=u=>{let f=u.diff((0,Pc.moment)());return Pc.moment.duration(f).humanize(!0)};break;default:return yr(r)}let l=Pc.moment.unix(n.author.epochSeconds);switch(a){case"viewer-local":break;case"author-local":l=l.utcOffset(n.author.tz),typeof o=="string"&&(o+=" Z");break;case"utc0000":l=l.utc(),typeof o=="string"&&(o+="[Z]");break;default:return yr(a)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(n,r,i){var l,c,u,f;let a=(c=(l=Tc())==null?void 0:l.text)!=null?c:r,s=i!=="waiting-for-result"&&n.isZeroCommit?vL:_L;r=a.replace(xL,s);let o=(f=(u=an.get())==null?void 0:u.gutterSpacingFallbackLength)!=null?f:r.length;if(r=FS(r,o,s),i!=="waiting-for-result"&&n.isZeroCommit){let h=Math.min(o,wL);r=MS(r,o-h)}return r}};function ei(t,e,n,r,i,a){let s=fE.sha256.create();s.update(Object.values(i).join(",")),s.update(`s${e}-e${n}-k${r}-o${a}`);let o=s.hex(),l=Cc.get(o);if(l)return l;let c=new Ep(t,e,n,r,i,a);return Cc.set(o,c),c}v();var hE=require("obsidian");function Ap(){var e,n;let t=(n=(e=an.get())==null?void 0:e.gutterSpacingFallbackLength)!=null?n:Mn.lineAuthor.gutterSpacingFallbackLength;return new ca(Array(t).fill("-").join(""))}function Tp(t){let{lineAuthoring:e,ageForInitialRender:n}=SL(t);return ei(e,1,1,"initialGutter"+n,t,"waiting-for-result")}function SL(t){var a;let e=(a=nE())!=null?a:Ec(t)*.25,n=(0,hE.moment)().add(-e,"days"),r={name:"",epochSeconds:AS(n),tz:"+0000"},i={hash:"waiting-for-result",author:r,committer:r,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:e}}v();function dE(t,e){return ei({hashPerLine:[void 0,"000000"],commits:new Map([["000000",jS]])},1,1,t,e)}var Cp=new ca(""),yE=(0,gE.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(sa,!1);return EL(t,e)},lineMarkerChange(t){let e=Sc(t.state.field(sa));return Sc(t.startState.field(sa))!==e},renderEmptyElements:!0,initialSpacer:t=>(pE(t),Ap()),updateSpacer:(t,e)=>{var n,r;return pE(e.view),(r=(n=Tc())==null?void 0:n.gutter)!=null?r:Ap()}});function EL(t,e){let n=Sc(e),r=t.state.doc,i=new Map;for(let u=1;u<=r.lines;u++){let f=r.line(u).from,h=t.lineBlockAt(f).to;i.set(u,[f,h]),n.update([f,h,0])}let a=an.get();n.update("s"+Object.values(an).join(","));let s=n.hex(),o=Fc.get(s);if(o)return o;let{result:l,allowCache:c}=kL(r,i,a,e);return c&&Fc.set(s,l),l}function kL(t,e,n,r){let i=!0,a=t.lines,s=[];function o(f,h,d){return s.push(d.range(f,h))}let l=AL(a,r),c=t.length===0,u=t.iterLines(a,a+1).next().value==="";for(let f=1;f<=a;f++){let[h,d]=e.get(f),p=t.lineAt(d).number;if(c){o(h,d,Cp);continue}if(f===a&&u){o(h,d,Cp);continue}if(r===void 0){o(h,d,Tp(n)),i=!1;continue}let{key:g,la:m}=r;if(m==="untracked"){o(h,d,dE(m,n));continue}let w=m.hashPerLine.length-1,b=l[f],S=l[p];if(S&&S>w&&o(h,d,Cp),b!==void 0&&sp(1,b,w)&&S!==void 0&&sp(1,S,w)){o(h,d,ei(m,b,S,g,n));continue}if(w<1){o(h,d,Tp(n)),i=!1;continue}let k=Math.clamp(b!=null?b:f,1,w),x=Math.clamp(S!=null?S:p,1,w);o(h,d,ei(m,k,x,g+"computing",n,"waiting-for-result"))}return{result:mE.RangeSet.of(s,!0),allowCache:i}}function AL(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),i=>i);let n=[void 0],r=0;for(let i=1;i<=t;i++){let a=e.lineOffsetsFromUnsavedChanges.get(i);r+=a!=null?a:0,n[i]=a===void 0?i-r:void 0}return n}function pE(t){t.dom.querySelectorAll(".cm-gutters").forEach(n=>{n!=null&&n.style&&(n.style.marginLeft||(n.style.marginLeft="unset"))})}var Ic=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){return this.trackChangedHelper(e).catch(n=>(console.warn("Git: Error in trackChanged."+n),Promise.reject(n)))}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(),aa.clear(),QS()}async computeLineAuthorInfo(e){let n=this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,r=await n.submoduleAwareHeadRevisonInContainingDirectory(e),i=await n.hashObject(e),a=qS(r,i,e);if(a!==void 0){if(!this.lineAuthorings.has(a)){let s=await n.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(a,s)}this.notifyComputationResultToSubscribers(e,a)}}notifyComputationResultToSubscribers(e,n){aa.ifFilepathDefinedTransformSubscribers(e,r=>r.forEach(i=>i.notifyLineAuthoring(n,this.lineAuthorings.get(n))))}},wE=vE.Prec.high([JS,sa,yE]);var Rc=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let n=e==null?void 0:e.view;!(n instanceof ti.MarkdownView)||n.file==null||(n==null?void 0:n.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(n.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),ZS(()=>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;lE(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new Ic(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&&ti.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Le?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(wE),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.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),rE(),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.fileRenameEvent)}destroyEventHandlers(){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.fileRenameEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var n;return void((n=this.lineAuthorInfoProvider)==null?void 0:n.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,n)=>{var r;return e instanceof ti.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var n;return e instanceof ti.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",sE)}};v();var Lc=class{constructor(e){this.plugin=e;this.tasks=[]}addTask(e){this.tasks.push(e),this.tasks.length===1&&this.handleTask()}handleTask(){this.tasks.length>0&&this.tasks[0]().catch(e=>this.plugin.displayError(e)).finally(()=>{this.tasks.shift(),this.handleTask()})}};v();var sn=require("obsidian");var jc=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),n.registerEvent(n.app.workspace.on("obsidian-git:refresh",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,n){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:n}),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.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,sn.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.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,sn.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,sn.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,sn.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,sn.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,sn.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,sn.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var r;let e=this.lastCommitTimestamp,n=this.plugin.state.offlineMode;if(e){let i=(0,sn.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${n?"Offline: ":""}Last Commit: ${i}`,(r=this.unPushedCommits)!=null&&r&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=n?"Git is offline":"Git is ready";n?(0,sn.setIcon)(this.iconEl,"globe"):(0,sn.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()}};v();var Bc=require("obsidian"),Dc=class extends Bc.SuggestModal{constructor(n){super(n.app);this.plugin=n;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(n=>{this.resolve=n,this.open()})}onClose(){new Promise(n=>setTimeout(n,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(n){let r=(0,Bc.moment)().format(this.plugin.settings.commitDateFormat);return n==""&&(n="..."),[n,`${r}: ${n}`,`${n}: ${r}`]}renderSuggestion(n,r){r.innerText=n}onChooseSuggestion(n,r){this.resolve&&this.resolve(n)}};v();var bE=require("obsidian"),Vs=class{constructor(e){this.plugin=e}saveLastAuto(e,n){n==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):n==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):n==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,n,r;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((n=this.plugin.localStorage.getLastAutoPull())!=null?n:""),push:new Date((r=this.plugin.localStorage.getLastAutoPush())!=null?r:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let n=new Date,r=this.plugin.settings.autoPushInterval-Math.round((n.getTime()-e.push.getTime())/1e3/60);this.startAutoPush(r<=0?0:r)}if(this.plugin.settings.autoPullInterval>0){let n=new Date,r=this.plugin.settings.autoPullInterval-Math.round((n.getTime()-e.pull.getTime())/1e3/60);this.startAutoPull(r<=0?0:r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){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.plugin.localStorage.setLastAutoBackup(e.toString())}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let n=new Date,r=this.plugin.settings.autoSaveInterval-Math.round((n.getTime()-e.backup.getTime())/1e3/60);this.startAutoCommitAndSync(r<=0?0:r)}}}startAutoCommitAndSync(e){let n=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,bE.debounce)(()=>this.doAutoCommitAndSync(),n,!0):(n>2147483647&&(n=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),n))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(()=>this.plugin.settings.differentIntervalCommitAndPush?this.plugin.commit({fromAuto:!0}):this.plugin.commitAndSync(!0)),this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync()}startAutoPull(e){let n=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPull=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote()),this.saveLastAuto(new Date,"pull"),this.startAutoPull()},n)}startAutoPush(e){let n=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPush=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.push()),this.saveLastAuto(new Date,"push"),this.startAutoPush()},n)}clearAutoCommitAndSync(){var n;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((n=this.plugin.autoCommitDebouncer)==null||n.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}};v();var qs=require("obsidian");v();var Ws=require("obsidian");async function xE(t,e,n){let r=await SE(e,n);if(r.result==="failure"){new Ws.Notice(r.reason);return}let{isGitHub:i,branch:a,repo:s,user:o,filePath:l}=r;if(i){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}-L${u}`)}else new Ws.Notice("It seems like you are not using GitHub")}async function _E(t,e){let n=await SE(t,e);if(n.result==="failure"){new Ws.Notice(n.reason);return}let{isGitHub:r,branch:i,repo:a,user:s,filePath:o}=n;r?window.open(`https://github.com/${s}/${a}/commits/${i}/${o}`):new Ws.Notice("It seems like you are not using GitHub")}async function SE(t,e){let n=await e.branchInfo(),r=n.tracking,i=n.current,a,s=e.getRelativeRepoPath(t.path);if(e instanceof Le){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){s=l.relativeFilepath;let c=await e.git.cwd({path:l.submodule,root:!1}).status();if(r=c.tracking||void 0,i=c.current||void 0,r){let u=r.substring(0,r.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)a=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(r==null)return{result:"failure",reason:"Remote branch is not configured"};if(i==null)return{result:"failure",reason:"Failed to get current branch name"};if(a==null){let l=r.substring(0,r.indexOf("/"));if(a=await e.getConfig(`remote.${l}.url`),a==null)return{result:"failure",reason:"Failed to get remote url"}}let o=a.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,h]=o;return{result:"success",isGitHub:!!l,repo:u||h,user:c||f,branch:i,filePath:s}}}v();var EE=require("obsidian"),Nc=class extends EE.FuzzySuggestModal{constructor(e,n){super(e.app),this.plugin=e,this.changedFiles=n,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.working_dir=="U")return`Untracked | ${e.vault_path}`;let n="",r="";return e.working_dir!=" "&&(n=`Working Dir: ${e.working_dir} `),e.index!=" "&&(r=`Index: ${e.index}`),`${n}${r} | ${e.vault_path}`}onChooseItem(e,n){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vault_path,"")==null?this.app.openWithDefaultApp(e.vault_path):this.plugin.app.workspace.openLinkText(e.vault_path,"/")}};v();var kE=require("obsidian"),$c=class extends kE.Modal{constructor(n,r){super(n);this.content=r;this.resolve=null}openAndGetReslt(){return new Promise(n=>{this.resolve=n,this.open()})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText("Edit .gitignore");let i=n.createDiv(),a=i.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});i.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(a.value),this.close()})}onClose(){let{contentEl:n}=this;n.empty(),this.resolve&&this.resolve(void 0)}};function AE(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let n=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(n)||await e.vault.adapter.write(n,"");let r=await e.vault.adapter.read(n),a=await new $c(e,r).openAndGetReslt();a!==void 0&&(await e.vault.adapter.write(n,a),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(dt.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:dt.type})):r=n.first(),await e.workspace.revealLeaf(r),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(nn.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:nn.type})):r=n.first(),await e.workspace.revealLeaf(r),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:n=>{var i;let r=e.workspace.getActiveFile();if(n)return r!==null;(i=Xt(e))==null||i.setViewState({type:Ct.type,active:!0,state:{staged:!1,file:t.gitManager.getRelativeRepoPath(r.path,!0)}})}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(n,{file:r})=>{if(r)return xE(n,r,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(n,{file:r})=>{if(r)return _E(r,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:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.addFileToGitignore(r).catch(i=>t.displayError(i))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync(!1),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1,!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-staged",name:"Commit staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:!0}))}),qs.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-staged-specified-message",name:"Commit staged with specific message",callback:()=>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:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.stageFile(r))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.unstageFile(r))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>t.editRemotes().catch(n=>t.displayError(n))}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>t.removeRemote().catch(n=>t.displayError(n))}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>t.setUpstreamBranch().catch(n=>t.displayError(n))}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new Xe(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 qs.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new qs.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>t.createNewRepo().catch(n=>t.displayError(n))}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>t.cloneNewRepo().catch(n=>t.displayError(n))}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(await t.isAllInitialized())try{let n=await t.updateCachedStatus();if(n.changed.length+n.staged.length>500){t.displayError("Too many changes to display");return}new Nc(t,n.all).open()}catch(n){t.displayError(n)}}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch().catch(n=>t.displayError(n))}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch().catch(n=>t.displayError(n))}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch().catch(n=>t.displayError(n))}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{if(!await t.isAllInitialized())return!1;await new Xe(t,{options:["NO","YES"],placeholder:"Do you want to discard all changes to tracked files? plugin action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"&&t.promiseQueue.addTask(()=>t.discardAll())}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var n;return(n=t.settingsTab)==null?void 0:n.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}})}v();var Hc=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 n of e){let r=localStorage.getItem(this.prefix+n);this.app.loadLocalStorage(this.prefix+n)==null&&r!=null&&r!=null&&(this.app.saveLocalStorage(this.prefix+n,r),localStorage.removeItem(this.prefix+n))}}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,n;return(n=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?n:[]}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}`)}};v();v();v();v();var $e;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})($e||($e={}));var TE={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},CE={LINES:"lines",WORDS:"words",NONE:"none"},FE={WORD:"word",CHAR:"char"},ni;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(ni||(ni={}));v();var TL=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],CL=RegExp("["+TL.join("\\")+"]","g");function ME(t){return t.replace(CL,"\\$&")}function Fp(t){return t&&t.replace(/\\/g,"/")}function OE(t){let e,n,r,i=0;for(e=0,r=t.length;e1?n[n.length-1]:e}function IE(t,e){return e.reduce((n,r)=>n||t.startsWith(r),!1)}var RE=["a/","b/","i/","w/","c/","o/"];function xr(t,e,n){let r=n!==void 0?[...RE,n]:RE,i=e?new RegExp(`^${ME(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=r.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function FL(t,e){return xr(t,"---",e)}function ML(t,e){return xr(t,"+++",e)}function LE(t,e={}){let n=[],r=null,i=null,a=null,s=null,o=null,l=null,c=null,u="--- ",f="+++ ",h="@@",d=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,m=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,k=/^rename to "?(.+)"?/,x=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,y=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,E=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,C=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,M=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,L=/^new file mode (\d{6})/,N=/^deleted file mode (\d{6}),(\d{6})/,j=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function Y(){i!==null&&r!==null&&(r.blocks.push(i),i=null)}function le(){r!==null&&(!r.oldName&&l!==null&&(r.oldName=l),!r.newName&&c!==null&&(r.newName=c),r.newName&&(n.push(r),r=null)),l=null,c=null}function he(){Y(),le(),r={blocks:[],deletedLines:0,addedLines:0}}function ie($){Y();let G;r!==null&&((G=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec($))?(r.isCombined=!1,a=parseInt(G[1],10),o=parseInt(G[2],10)):(G=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec($))?(r.isCombined=!0,a=parseInt(G[1],10),s=parseInt(G[2],10),o=parseInt(G[3],10)):($.startsWith(h)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,r.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:$}}function Me($){if(r===null||i===null||a===null||o===null)return;let G={content:$},D=r.isCombined?["+ "," +","++"]:["+"],se=r.isCombined?["- "," -","--"]:["-"];IE($,D)?(r.addedLines++,G.type=$e.INSERT,G.oldNumber=void 0,G.newNumber=o++):IE($,se)?(r.deletedLines++,G.type=$e.DELETE,G.oldNumber=a++,G.newNumber=void 0):(G.type=$e.CONTEXT,G.oldNumber=a++,G.newNumber=o++),i.lines.push(G)}function de($,G){let D=G;for(;D{if(!$||$.startsWith("*"))return;let D,se=j[G-1],Se=j[G+1],mt=j[G+2];if($.startsWith("diff --git")||$.startsWith("diff --combined")){if(he(),(D=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec($))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isGitDiff=!0;return}if($.startsWith("Binary files")&&!(r!=null&&r.isGitDiff)){if(he(),(D=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec($))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isBinary=!0;return}if((!r||!r.isGitDiff&&r&&$.startsWith(u)&&Se.startsWith(f)&&mt.startsWith(h))&&he(),r!=null&&r.isTooBig)return;if(r&&(typeof e.diffMaxChanges=="number"&&r.addedLines+r.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&$.length>e.diffMaxLineLength)){r.isTooBig=!0,r.addedLines=0,r.deletedLines=0,r.blocks=[],i=null;let st=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(n.length):"Diff too big to be displayed";ie(st);return}if($.startsWith(u)&&Se.startsWith(f)||$.startsWith(f)&&se.startsWith(u)){if(r&&!r.oldName&&$.startsWith("--- ")&&(D=FL($,e.srcPrefix))){r.oldName=D,r.language=PE(r.oldName,r.language);return}if(r&&!r.newName&&$.startsWith("+++ ")&&(D=ML($,e.dstPrefix))){r.newName=D,r.language=PE(r.newName,r.language);return}}if(r&&($.startsWith(h)||r.isGitDiff&&r.oldName&&r.newName&&!i)){ie($);return}if(i&&($.startsWith("+")||$.startsWith("-")||$.startsWith(" "))){Me($);return}let be=!de($,G);if(r===null)throw new Error("Where is my file !!!");(D=d.exec($))?r.oldMode=D[1]:(D=p.exec($))?r.newMode=D[1]:(D=g.exec($))?(r.deletedFileMode=D[1],r.isDeleted=!0):(D=m.exec($))?(r.newFileMode=D[1],r.isNew=!0):(D=w.exec($))?(be&&(r.oldName=D[1]),r.isCopy=!0):(D=b.exec($))?(be&&(r.newName=D[1]),r.isCopy=!0):(D=S.exec($))?(be&&(r.oldName=D[1]),r.isRename=!0):(D=k.exec($))?(be&&(r.newName=D[1]),r.isRename=!0):(D=E.exec($))?(r.isBinary=!0,r.oldName=xr(D[1],void 0,e.srcPrefix),r.newName=xr(D[2],void 0,e.dstPrefix),ie("Binary file")):_.test($)?(r.isBinary=!0,ie($)):(D=x.exec($))?r.unchangedPercentage=parseInt(D[1],10):(D=A.exec($))?r.changedPercentage=parseInt(D[1],10):(D=y.exec($))?(r.checksumBefore=D[1],r.checksumAfter=D[2],D[3]&&(r.mode=D[3])):(D=C.exec($))?(r.checksumBefore=[D[2],D[3]],r.checksumAfter=D[1]):(D=M.exec($))?(r.oldMode=[D[2],D[3]],r.newMode=D[1]):(D=L.exec($))?(r.newFileMode=D[1],r.isNew=!0):(D=N.exec($))&&(r.deletedFileMode=D[1],r.isDeleted=!0)}),Y(),le(),n}v();v();v();function Xn(){}Xn.prototype={diff:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.callback;typeof r=="function"&&(i=r,r={}),this.options=r;var a=this;function s(g){return i?(setTimeout(function(){i(void 0,g)},0),!0):g}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var o=n.length,l=e.length,c=1,u=o+l;r.maxEditLength&&(u=Math.min(u,r.maxEditLength));var f=[{newPos:-1,components:[]}],h=this.extractCommon(f[0],n,e,0);if(f[0].newPos+1>=o&&h+1>=l)return s([{value:this.join(n),count:n.length}]);function d(){for(var g=-1*c;g<=c;g+=2){var m=void 0,w=f[g-1],b=f[g+1],S=(b?b.newPos:0)-g;w&&(f[g-1]=void 0);var k=w&&w.newPos+1=o&&S+1>=l)return s(PL(a,m.components,n,e,a.useLongestToken));f[g]=m}c++}if(i)(function g(){setTimeout(function(){if(c>u)return i();d()||g()},0)})();else for(;c<=u;){var p=d();if(p)return p}},pushComponent:function(e,n,r){var i=e[e.length-1];i&&i.added===n&&i.removed===r?e[e.length-1]={count:i.count+1,added:n,removed:r}:e.push({count:1,added:n,removed:r})},extractCommon:function(e,n,r,i){for(var a=n.length,s=r.length,o=e.newPos,l=o-i,c=0;o+1d.length?g:d}),c.value=t.join(u)}else c.value=t.join(n.slice(o,o+c.count));o+=c.count,c.added||(l+=c.count)}}var h=e[s-1];return s>1&&typeof h.value=="string"&&(h.added||h.removed)&&t.equals("",h.value)&&(e[s-2].value+=h.value,e.pop()),e}function IL(t){return{newPos:t.newPos,components:t.components.slice(0)}}var RL=new Xn;function BE(t,e,n){return RL.diff(t,e,n)}var jE=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,DE=/\S/,Pp=new Xn;Pp.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!DE.test(t)&&!DE.test(e)};Pp.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n{let r=t(e).trim(),i=t(n).trim();return NL(r,i)/(r.length+i.length)}}function fa(t){function e(r,i,a=new Map){let s=1/0,o;for(let l=0;l0||o.indexB>0)&&(S=m.concat(S)),(r.length>h||i.length>d)&&(S=S.concat(b)),S}return n}var pt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},ri={matching:CE.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:FE.WORD,colorScheme:ni.LIGHT},Rn="/",HE=ua(t=>t.value),$L=fa(HE);function Rp(t){return t.indexOf("dev/null")!==-1}function HL(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function UL(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function ha(t){switch(t){case $e.CONTEXT:return pt.CONTEXT;case $e.INSERT:return pt.INSERTS;case $e.DELETE:return pt.DELETES}}function da(t){switch(t){case ni.DARK:return"d2h-dark-color-scheme";case ni.AUTO:return"d2h-auto-color-scheme";case ni.LIGHT:default:return"d2h-light-color-scheme"}}function zL(t){return t?2:1}function _r(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function on(t,e,n=!0){let r=zL(e);return{prefix:t.substring(0,r),content:n?_r(t.substring(r)):t.substring(r)}}function ii(t){let e=Fp(t.oldName),n=Fp(t.newName);if(e!==n&&!Rp(e)&&!Rp(n)){let r=[],i=[],a=e.split(Rn),s=n.split(Rn),o=a.length,l=s.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&a[u]===s[f];)i.unshift(s[f]),u-=1,f-=1;let h=r.join(Rn),d=i.join(Rn),p=a.slice(c,u+1).join(Rn),g=s.slice(c,f+1).join(Rn);return h.length&&d.length?h+Rn+"{"+p+" \u2192 "+g+"}"+Rn+d:h.length?h+Rn+"{"+p+" \u2192 "+g+"}":d.length?"{"+p+" \u2192 "+g+"}"+Rn+d:e+" \u2192 "+n}else return Rp(n)?e:n}function pa(t){return`d2h-${OE(ii(t)).toString().slice(-6)}`}function ma(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 zc(t,e,n,r={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},ri),r),l=on(t,n,!1),c=on(e,n,!1);if(l.content.length>a||c.content.length>a)return{oldLine:{prefix:l.prefix,content:_r(l.content)},newLine:{prefix:c.prefix,content:_r(c.content)}};let u=o==="char"?BE(l.content,c.content):NE(l.content,c.content),f=[];if(o==="word"&&i==="words"){let d=u.filter(m=>m.removed),p=u.filter(m=>m.added);$L(p,d).forEach(m=>{m[0].length===1&&m[1].length===1&&HE(m[0][0],m[1][0]){let g=p.added?"ins":p.removed?"del":null,m=f.indexOf(p)>-1?' class="d2h-change"':"",w=_r(p.value);return g!==null?`${d}<${g}${m}>${w}`:`${d}${w}`},"");return{oldLine:{prefix:l.prefix,content:HL(h)},newLine:{prefix:c.prefix,content:UL(h)}}}var UE="file-summary",GL="icon",VL={colorScheme:ri.colorScheme},Gc=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},VL),n)}render(e){let n=e.map(r=>this.hoganUtils.render(UE,"line",{fileHtmlId:pa(r),oldName:r.oldName,newName:r.newName,fileName:ii(r),deletedLines:"-"+r.deletedLines,addedLines:"+"+r.addedLines},{fileIcon:this.hoganUtils.template(GL,ma(r))})).join(` +`);return this.hoganUtils.render(UE,"wrapper",{colorScheme:da(this.config.colorScheme),filesNumber:e.length,files:n})}};v();var jp=Object.assign(Object.assign({},ri),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ys="generic",zE="line-by-line",WL="icon",qL="tag",Zs=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},jp),n)}render(e){let n=e.map(r=>{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` +`);return this.hoganUtils.render(Ys,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(zE,"file-diff"),i=this.hoganUtils.template(Ys,"file-path"),a=this.hoganUtils.template(WL,"file"),s=this.hoganUtils.template(qL,ma(e));return r.render({file:e,fileHtmlId:pa(e),diffs:n,filePath:i.render({fileDiffName:ii(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(Ys,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:pt})}generateFileHtml(e){let n=fa(ua(r=>on(r.content,e.isCombined).content));return e.blocks.map(r=>{let i=this.hoganUtils.render(Ys,"block-header",{CSSLineClass:pt,blockHeader:e.isTooBig?r.header:_r(r.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=on(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:pt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(` +`)}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===$e.CONTEXT?n.push([[s],[],[]]):s.type===$e.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===$e.INSERT&&r.length>0?i.push(s):s.type===$e.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` +`);return this.hoganUtils.render(Ks,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(XL,"file-diff"),i=this.hoganUtils.template(Ks,"file-path"),a=this.hoganUtils.template(YL,"file"),s=this.hoganUtils.template(ZL,ma(e));return r.render({file:e,fileHtmlId:pa(e),diffs:n,filePath:i.render({fileDiffName:ii(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Ks,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:pt})}}generateFileHtml(e){let n=fa(ua(r=>on(r.content,e.isCombined).content));return e.blocks.map(r=>{let i={left:this.makeHeaderHtml(r.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=on(l.content,e.isCombined),{left:f,right:h}=this.generateLineHtml({type:pt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:pt.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=h});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((r,i)=>({left:r.left+i.left,right:r.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===$e.CONTEXT?n.push([[s],[],[]]):s.type===$e.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===$e.INSERT&&r.length>0?i.push(s):s.type===$e.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(r.rp("'),r.b(r.v(r.f("fileName",t,e,0))),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(r.v(r.f("addedLines",t,e,0))),r.b(""),r.b(` +`+n),r.b(' '),r.b(r.v(r.f("deletedLines",t,e,0))),r.b(""),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{"'),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(' Files changed ('),r.b(r.v(r.f("filesNumber",t,e,0))),r.b(")"),r.b(` +`+n),r.b(' hide'),r.b(` +`+n),r.b(' show'),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b('
      '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("files",t,e,0))),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-block-header"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
    '),r.s(r.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),r.s(r.f("blockHeader",t,e,1),t,e,1,0,0,"")||r.b(" "),r.b("
    "),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-empty-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(" File without changes"),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-file-path"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(''),r.b(` +`+n),r.b(r.rp("'),r.b(r.v(r.f("fileDiffName",t,e,0))),r.b(""),r.b(` +`+n),r.b(r.rp(""),r.b(` +`+n),r.b('"),r.fl()},partials:{""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("lineNumber",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.s(r.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("prefix",i,a,0))),s.b(""),s.b(` +`+n)}),t.pop()),r.s(r.f("prefix",t,e,1),t,e,1,0,0,"")||(r.b('  '),r.b(` +`+n)),r.s(r.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("content",i,a,0))),s.b(""),s.b(` +`+n)}),t.pop()),r.s(r.f("content",t,e,1),t,e,1,0,0,"")||(r.b('
    '),r.b(` +`+n)),r.b("
    "),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-wrapper"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
    '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("content",t,e,0))),r.b(` +`+n),r.b("
    "),r.fl()},partials:{},subs:{}});et["icon-file-added"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file-changed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file-deleted"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file-renamed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["line-by-line-file-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
    '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("diffs",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.fl()},partials:{},subs:{}});et["line-by-line-numbers"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
    '),r.b(r.v(r.f("oldNumber",t,e,0))),r.b("
    "),r.b(` +`+n),r.b('
    '),r.b(r.v(r.f("newNumber",t,e,0))),r.b("
    "),r.fl()},partials:{},subs:{}});et["side-by-side-file-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
    '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.d("diffs.left",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.d("diffs.right",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.b(` +`+n),r.b("
    "),r.fl()},partials:{},subs:{}});et["tag-file-added"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('ADDED'),r.fl()},partials:{},subs:{}});et["tag-file-changed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('CHANGED'),r.fl()},partials:{},subs:{}});et["tag-file-deleted"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('DELETED'),r.fl()},partials:{},subs:{}});et["tag-file-renamed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('RENAMED'),r.fl()},partials:{},subs:{}});var Qs=class{constructor({compiledTemplates:e={},rawTemplates:n={}}){let r=Object.entries(n).reduce((i,[a,s])=>{let o=Hp.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},et),e),r)}static compile(e){return Hp.compile(e,{asString:!1})}render(e,n,r,i,a){let s=this.templateKey(e,n);try{return this.preCompiledTemplates[s].render(r,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,n){return this.preCompiledTemplates[this.templateKey(e,n)]}templateKey(e,n){return`${e}-${n}`}};var JL=Object.assign(Object.assign(Object.assign({},jp),Dp),{outputFormat:TE.LINE_BY_LINE,drawFileList:!0});function qE(t,e={}){let n=Object.assign(Object.assign({},JL),e),r=typeof t=="string"?LE(t,n):t,i=new Qs(n),{colorScheme:a}=n,s={colorScheme:a},o=n.drawFileList?new Gc(i,s).render(r):"",l=n.outputFormat==="side-by-side"?new Js(i,n).render(r):new Zs(i,n).render(r);return o+l}var Wc=require("obsidian");var ga=class extends Wc.ItemView{constructor(n,r){super(n);this.plugin=r;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.gitRefreshRef=this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(console.error)}),this.gitViewRefreshRef=this.app.workspace.on("obsidian-git:view-refresh",()=>{this.refresh().catch(console.error)})}getViewType(){return Ct.type}getDisplayText(){var n;if(((n=this.state)==null?void 0:n.file)!=null){let r=this.state.file.split("/").last();return r!=null&&r.endsWith(".md")&&(r=r.slice(0,-3)),Ct.name+` (${r})`}return Ct.name}getIcon(){return Ct.icon}async setState(n,r){this.state=n,Wc.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 n;if((n=this.state)!=null&&n.file&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let r=await this.plugin.gitManager.getDiffString(this.state.file,this.state.staged,this.state.hash);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.file);if(!r){if(this.plugin.gitManager instanceof Le&&await this.plugin.gitManager.isTracked(this.state.file))r=[`--- ${this.state.file}`,`+++ ${this.state.file}`,""].join(` +`);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);r=[...`--- /dev/null +++ ${this.state.file} -@@ -0,0 +1,${content.split("\n").length} @@`; - diff3 = [ - ...header.split("\n"), - ...content.split("\n").map((line) => `+${line}`) - ].join("\n"); - } - } - const diffEl = this.parser.parseFromString(html(diff3), "text/html").querySelector(".d2h-file-diff"); - this.contentEl.append(diffEl); - } finally { - this.gettingDiff = false; - } - } - } -}; - -// src/ui/history/historyView.ts -init_polyfill_buffer(); -var import_obsidian21 = require("obsidian"); - -// src/ui/history/historyView.svelte -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/index.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/animations.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/utils.js -init_polyfill_buffer(); -function noop() { -} -var identity = (x) => x; -function run(fn) { - return fn(); -} -function blank_object() { - return /* @__PURE__ */ Object.create(null); -} -function run_all(fns) { - fns.forEach(run); -} -function is_function(thing) { - return typeof thing === "function"; -} -function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function"; -} -function is_empty(obj) { - return Object.keys(obj).length === 0; -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/environment.js -init_polyfill_buffer(); -var is_client = typeof window !== "undefined"; -var now = is_client ? () => window.performance.now() : () => Date.now(); -var raf = is_client ? (cb) => requestAnimationFrame(cb) : noop; - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/loop.js -init_polyfill_buffer(); -var tasks = /* @__PURE__ */ new Set(); -function run_tasks(now2) { - tasks.forEach((task) => { - if (!task.c(now2)) { - tasks.delete(task); - task.f(); - } - }); - if (tasks.size !== 0) raf(run_tasks); -} -function loop(callback) { - let task; - if (tasks.size === 0) raf(run_tasks); - return { - promise: new Promise((fulfill) => { - tasks.add(task = { c: callback, f: fulfill }); - }), - abort() { - tasks.delete(task); - } - }; -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/style_manager.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/dom.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/ResizeObserverSingleton.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/globals.js -init_polyfill_buffer(); -var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : ( - // @ts-ignore Node typings have this - global -); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/ResizeObserverSingleton.js -var ResizeObserverSingleton = class _ResizeObserverSingleton { - /** @param {ResizeObserverOptions} options */ - constructor(options) { - /** - * @private - * @readonly - * @type {WeakMap} - */ - __publicField(this, "_listeners", "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0); - /** - * @private - * @type {ResizeObserver} - */ - __publicField(this, "_observer"); - /** @type {ResizeObserverOptions} */ - __publicField(this, "options"); - this.options = options; - } - /** - * @param {Element} element - * @param {import('./private.js').Listener} listener - * @returns {() => void} - */ - observe(element2, listener) { - this._listeners.set(element2, listener); - this._getObserver().observe(element2, this.options); - return () => { - this._listeners.delete(element2); - this._observer.unobserve(element2); - }; - } - /** - * @private - */ - _getObserver() { - var _a2; - return (_a2 = this._observer) != null ? _a2 : this._observer = new ResizeObserver((entries) => { - var _a3; - for (const entry of entries) { - _ResizeObserverSingleton.entries.set(entry.target, entry); - (_a3 = this._listeners.get(entry.target)) == null ? void 0 : _a3(entry); - } - }); - } -}; -ResizeObserverSingleton.entries = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0; - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/dom.js -var is_hydrating = false; -function start_hydrating() { - is_hydrating = true; -} -function end_hydrating() { - is_hydrating = false; -} -function append2(target, node) { - target.appendChild(node); -} -function append_styles(target, style_sheet_id, styles) { - const append_styles_to = get_root_for_style(target); - if (!append_styles_to.getElementById(style_sheet_id)) { - const style = element("style"); - style.id = style_sheet_id; - style.textContent = styles; - append_stylesheet(append_styles_to, style); - } -} -function get_root_for_style(node) { - if (!node) return document; - const root2 = node.getRootNode ? node.getRootNode() : node.ownerDocument; - if (root2 && /** @type {ShadowRoot} */ - root2.host) { - return ( - /** @type {ShadowRoot} */ - root2 - ); - } - return node.ownerDocument; -} -function append_empty_stylesheet(node) { - const style_element = element("style"); - style_element.textContent = "/* empty */"; - append_stylesheet(get_root_for_style(node), style_element); - return style_element.sheet; -} -function append_stylesheet(node, style) { - append2( - /** @type {Document} */ - node.head || node, - style - ); - return style.sheet; -} -function insert(target, node, anchor) { - target.insertBefore(node, anchor || null); -} -function detach(node) { - if (node.parentNode) { - node.parentNode.removeChild(node); - } -} -function destroy_each(iterations, detaching) { - for (let i = 0; i < iterations.length; i += 1) { - if (iterations[i]) iterations[i].d(detaching); - } -} -function element(name) { - return document.createElement(name); -} -function text(data) { - return document.createTextNode(data); -} -function space() { - return text(" "); -} -function empty() { - return text(""); -} -function listen(node, event, handler, options) { - node.addEventListener(event, handler, options); - return () => node.removeEventListener(event, handler, options); -} -function stop_propagation(fn) { - return function(event) { - event.stopPropagation(); - return fn.call(this, event); - }; -} -function attr(node, attribute, value) { - if (value == null) node.removeAttribute(attribute); - else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); -} -function children(element2) { - return Array.from(element2.childNodes); -} -function set_data(text2, data) { - data = "" + data; - if (text2.data === data) return; - text2.data = /** @type {string} */ - data; -} -function set_input_value(input, value) { - input.value = value == null ? "" : value; -} -function set_style(node, key2, value, important) { - if (value == null) { - node.style.removeProperty(key2); - } else { - node.style.setProperty(key2, value, important ? "important" : ""); - } -} -function toggle_class(element2, name, toggle) { - element2.classList.toggle(name, !!toggle); -} -function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { - return new CustomEvent(type, { detail, bubbles, cancelable }); -} -function get_custom_elements_slots(element2) { - const result = {}; - element2.childNodes.forEach( - /** @param {Element} node */ - (node) => { - result[node.slot || "default"] = true; - } - ); - return result; -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/style_manager.js -var managed_styles = /* @__PURE__ */ new Map(); -var active = 0; -function hash(str) { - let hash2 = 5381; - let i = str.length; - while (i--) hash2 = (hash2 << 5) - hash2 ^ str.charCodeAt(i); - return hash2 >>> 0; -} -function create_style_information(doc, node) { - const info = { stylesheet: append_empty_stylesheet(node), rules: {} }; - managed_styles.set(doc, info); - return info; -} -function create_rule(node, a, b, duration, delay2, ease, fn, uid = 0) { - const step = 16.666 / duration; - let keyframes = "{\n"; - for (let p = 0; p <= 1; p += step) { - const t = a + (b - a) * ease(p); - keyframes += p * 100 + `%{${fn(t, 1 - t)}} -`; - } - const rule = keyframes + `100% {${fn(b, 1 - b)}} -}`; - const name = `__svelte_${hash(rule)}_${uid}`; - const doc = get_root_for_style(node); - const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node); - if (!rules[name]) { - rules[name] = true; - stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); - } - const animation = node.style.animation || ""; - node.style.animation = `${animation ? `${animation}, ` : ""}${name} ${duration}ms linear ${delay2}ms 1 both`; - active += 1; - return name; -} -function delete_rule(node, name) { - const previous = (node.style.animation || "").split(", "); - const next = previous.filter( - name ? (anim) => anim.indexOf(name) < 0 : (anim) => anim.indexOf("__svelte") === -1 - // remove all Svelte animations - ); - const deleted = previous.length - next.length; - if (deleted) { - node.style.animation = next.join(", "); - active -= deleted; - if (!active) clear_rules(); - } -} -function clear_rules() { - raf(() => { - if (active) return; - managed_styles.forEach((info) => { - const { ownerNode } = info.stylesheet; - if (ownerNode) detach(ownerNode); - }); - managed_styles.clear(); - }); -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/await_block.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/transitions.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/scheduler.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/lifecycle.js -init_polyfill_buffer(); -var current_component; -function set_current_component(component) { - current_component = component; -} -function get_current_component() { - if (!current_component) throw new Error("Function called outside component initialization"); - return current_component; -} -function onDestroy(fn) { - get_current_component().$$.on_destroy.push(fn); -} -function bubble(component, event) { - const callbacks = component.$$.callbacks[event.type]; - if (callbacks) { - callbacks.slice().forEach((fn) => fn.call(this, event)); - } -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/scheduler.js -var dirty_components = []; -var binding_callbacks = []; -var render_callbacks = []; -var flush_callbacks = []; -var resolved_promise = /* @__PURE__ */ Promise.resolve(); -var update_scheduled = false; -function schedule_update() { - if (!update_scheduled) { - update_scheduled = true; - resolved_promise.then(flush); - } -} -function add_render_callback(fn) { - render_callbacks.push(fn); -} -var seen_callbacks = /* @__PURE__ */ new Set(); -var flushidx = 0; -function flush() { - if (flushidx !== 0) { - return; - } - const saved_component = current_component; - do { - try { - while (flushidx < dirty_components.length) { - const component = dirty_components[flushidx]; - flushidx++; - set_current_component(component); - update(component.$$); - } - } catch (e) { - dirty_components.length = 0; - flushidx = 0; - throw e; - } - set_current_component(null); - dirty_components.length = 0; - flushidx = 0; - while (binding_callbacks.length) binding_callbacks.pop()(); - for (let i = 0; i < render_callbacks.length; i += 1) { - const callback = render_callbacks[i]; - if (!seen_callbacks.has(callback)) { - seen_callbacks.add(callback); - callback(); - } - } - render_callbacks.length = 0; - } while (dirty_components.length); - while (flush_callbacks.length) { - flush_callbacks.pop()(); - } - update_scheduled = false; - seen_callbacks.clear(); - set_current_component(saved_component); -} -function update($$) { - if ($$.fragment !== null) { - $$.update(); - run_all($$.before_update); - const dirty = $$.dirty; - $$.dirty = [-1]; - $$.fragment && $$.fragment.p($$.ctx, dirty); - $$.after_update.forEach(add_render_callback); - } -} -function flush_render_callbacks(fns) { - const filtered = []; - const targets = []; - render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)); - targets.forEach((c) => c()); - render_callbacks = filtered; -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/transitions.js -var promise; -function wait() { - if (!promise) { - promise = Promise.resolve(); - promise.then(() => { - promise = null; - }); - } - return promise; -} -function dispatch(node, direction, kind) { - node.dispatchEvent(custom_event(`${direction ? "intro" : "outro"}${kind}`)); -} -var outroing = /* @__PURE__ */ new Set(); -var outros; -function group_outros() { - outros = { - r: 0, - c: [], - p: outros - // parent group - }; -} -function check_outros() { - if (!outros.r) { - run_all(outros.c); - } - outros = outros.p; -} -function transition_in(block, local) { - if (block && block.i) { - outroing.delete(block); - block.i(local); - } -} -function transition_out(block, local, detach2, callback) { - if (block && block.o) { - if (outroing.has(block)) return; - outroing.add(block); - outros.c.push(() => { - outroing.delete(block); - if (callback) { - if (detach2) block.d(1); - callback(); - } - }); - block.o(local); - } else if (callback) { - callback(); - } -} -var null_transition = { duration: 0 }; -function create_bidirectional_transition(node, fn, params, intro) { - const options = { direction: "both" }; - let config = fn(node, params, options); - let t = intro ? 0 : 1; - let running_program = null; - let pending_program = null; - let animation_name = null; - let original_inert_value; - function clear_animation() { - if (animation_name) delete_rule(node, animation_name); - } - function init3(program, duration) { - const d = ( - /** @type {Program['d']} */ - program.b - t - ); - duration *= Math.abs(d); - return { - a: t, - b: program.b, - d, - duration, - start: program.start, - end: program.start + duration, - group: program.group - }; - } - function go(b) { - const { - delay: delay2 = 0, - duration = 300, - easing = identity, - tick: tick2 = noop, - css - } = config || null_transition; - const program = { - start: now() + delay2, - b - }; - if (!b) { - program.group = outros; - outros.r += 1; - } - if ("inert" in node) { - if (b) { - if (original_inert_value !== void 0) { - node.inert = original_inert_value; - } - } else { - original_inert_value = /** @type {HTMLElement} */ - node.inert; - node.inert = true; - } - } - if (running_program || pending_program) { - pending_program = program; - } else { - if (css) { - clear_animation(); - animation_name = create_rule(node, t, b, duration, delay2, easing, css); - } - if (b) tick2(0, 1); - running_program = init3(program, duration); - add_render_callback(() => dispatch(node, b, "start")); - loop((now2) => { - if (pending_program && now2 > pending_program.start) { - running_program = init3(pending_program, duration); - pending_program = null; - dispatch(node, running_program.b, "start"); - if (css) { - clear_animation(); - animation_name = create_rule( - node, - t, - running_program.b, - running_program.duration, - 0, - easing, - config.css - ); - } - } - if (running_program) { - if (now2 >= running_program.end) { - tick2(t = running_program.b, 1 - t); - dispatch(node, running_program.b, "end"); - if (!pending_program) { - if (running_program.b) { - clear_animation(); - } else { - if (!--running_program.group.r) run_all(running_program.group.c); - } - } - running_program = null; - } else if (now2 >= running_program.start) { - const p = now2 - running_program.start; - t = running_program.a + running_program.d * easing(p / running_program.duration); - tick2(t, 1 - t); - } - } - return !!(running_program || pending_program); - }); - } - } - return { - run(b) { - if (is_function(config)) { - wait().then(() => { - const opts = { direction: b ? "in" : "out" }; - config = config(opts); - go(b); - }); - } else { - go(b); - } - }, - end() { - clear_animation(); - running_program = pending_program = null; - } - }; -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/each.js -init_polyfill_buffer(); -function ensure_array_like(array_like_or_iterator) { - return (array_like_or_iterator == null ? void 0 : array_like_or_iterator.length) !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator); -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/spread.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/ssr.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/shared/boolean_attributes.js -init_polyfill_buffer(); -var _boolean_attributes = ( - /** @type {const} */ - [ - "allowfullscreen", - "allowpaymentrequest", - "async", - "autofocus", - "autoplay", - "checked", - "controls", - "default", - "defer", - "disabled", - "formnovalidate", - "hidden", - "inert", - "ismap", - "loop", - "multiple", - "muted", - "nomodule", - "novalidate", - "open", - "playsinline", - "readonly", - "required", - "reversed", - "selected" - ] -); -var boolean_attributes = /* @__PURE__ */ new Set([..._boolean_attributes]); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/shared/utils/names.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/Component.js -init_polyfill_buffer(); -function create_component(block) { - block && block.c(); -} -function mount_component(component, target, anchor) { - const { fragment, after_update } = component.$$; - fragment && fragment.m(target, anchor); - add_render_callback(() => { - const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); - if (component.$$.on_destroy) { - component.$$.on_destroy.push(...new_on_destroy); - } else { - run_all(new_on_destroy); - } - component.$$.on_mount = []; - }); - after_update.forEach(add_render_callback); -} -function destroy_component(component, detaching) { - const $$ = component.$$; - if ($$.fragment !== null) { - flush_render_callbacks($$.after_update); - run_all($$.on_destroy); - $$.fragment && $$.fragment.d(detaching); - $$.on_destroy = $$.fragment = null; - $$.ctx = []; - } -} -function make_dirty(component, i) { - if (component.$$.dirty[0] === -1) { - dirty_components.push(component); - schedule_update(); - component.$$.dirty.fill(0); - } - component.$$.dirty[i / 31 | 0] |= 1 << i % 31; -} -function init2(component, options, instance10, create_fragment10, not_equal, props, append_styles2 = null, dirty = [-1]) { - const parent_component = current_component; - set_current_component(component); - const $$ = component.$$ = { - fragment: null, - ctx: [], - // state - props, - update: noop, - not_equal, - bound: blank_object(), - // lifecycle - on_mount: [], - on_destroy: [], - on_disconnect: [], - before_update: [], - after_update: [], - context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), - // everything else - callbacks: blank_object(), - dirty, - skip_bound: false, - root: options.target || parent_component.$$.root - }; - append_styles2 && append_styles2($$.root); - let ready = false; - $$.ctx = instance10 ? instance10(component, options.props || {}, (i, ret, ...rest) => { - const value = rest.length ? rest[0] : ret; - if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { - if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); - if (ready) make_dirty(component, i); - } - return ret; - }) : []; - $$.update(); - ready = true; - run_all($$.before_update); - $$.fragment = create_fragment10 ? create_fragment10($$.ctx) : false; - if (options.target) { - if (options.hydrate) { - start_hydrating(); - const nodes = children(options.target); - $$.fragment && $$.fragment.l(nodes); - nodes.forEach(detach); - } else { - $$.fragment && $$.fragment.c(); - } - if (options.intro) transition_in(component.$$.fragment); - mount_component(component, options.target, options.anchor); - end_hydrating(); - flush(); - } - set_current_component(parent_component); -} -var SvelteElement; -if (typeof HTMLElement === "function") { - SvelteElement = class extends HTMLElement { - constructor($$componentCtor, $$slots, use_shadow_dom) { - super(); - /** The Svelte component constructor */ - __publicField(this, "$$ctor"); - /** Slots */ - __publicField(this, "$$s"); - /** The Svelte component instance */ - __publicField(this, "$$c"); - /** Whether or not the custom element is connected */ - __publicField(this, "$$cn", false); - /** Component props data */ - __publicField(this, "$$d", {}); - /** `true` if currently in the process of reflecting component props back to attributes */ - __publicField(this, "$$r", false); - /** @type {Record} Props definition (name, reflected, type etc) */ - __publicField(this, "$$p_d", {}); - /** @type {Record} Event listeners */ - __publicField(this, "$$l", {}); - /** @type {Map} Event listener unsubscribe functions */ - __publicField(this, "$$l_u", /* @__PURE__ */ new Map()); - this.$$ctor = $$componentCtor; - this.$$s = $$slots; - if (use_shadow_dom) { - this.attachShadow({ mode: "open" }); - } - } - addEventListener(type, listener, options) { - this.$$l[type] = this.$$l[type] || []; - this.$$l[type].push(listener); - if (this.$$c) { - const unsub = this.$$c.$on(type, listener); - this.$$l_u.set(listener, unsub); - } - super.addEventListener(type, listener, options); - } - removeEventListener(type, listener, options) { - super.removeEventListener(type, listener, options); - if (this.$$c) { - const unsub = this.$$l_u.get(listener); - if (unsub) { - unsub(); - this.$$l_u.delete(listener); - } - } - } - async connectedCallback() { - this.$$cn = true; - if (!this.$$c) { - let create_slot = function(name) { - return () => { - let node; - const obj = { - c: function create() { - node = element("slot"); - if (name !== "default") { - attr(node, "name", name); - } - }, - /** - * @param {HTMLElement} target - * @param {HTMLElement} [anchor] - */ - m: function mount(target, anchor) { - insert(target, node, anchor); - }, - d: function destroy(detaching) { - if (detaching) { - detach(node); - } - } - }; - return obj; - }; - }; - await Promise.resolve(); - if (!this.$$cn || this.$$c) { - return; - } - const $$slots = {}; - const existing_slots = get_custom_elements_slots(this); - for (const name of this.$$s) { - if (name in existing_slots) { - $$slots[name] = [create_slot(name)]; - } - } - for (const attribute of this.attributes) { - const name = this.$$g_p(attribute.name); - if (!(name in this.$$d)) { - this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp"); - } - } - for (const key2 in this.$$p_d) { - if (!(key2 in this.$$d) && this[key2] !== void 0) { - this.$$d[key2] = this[key2]; - delete this[key2]; - } - } - this.$$c = new this.$$ctor({ - target: this.shadowRoot || this, - props: { - ...this.$$d, - $$slots, - $$scope: { - ctx: [] - } - } - }); - const reflect_attributes = () => { - this.$$r = true; - for (const key2 in this.$$p_d) { - this.$$d[key2] = this.$$c.$$.ctx[this.$$c.$$.props[key2]]; - if (this.$$p_d[key2].reflect) { - const attribute_value = get_custom_element_value( - key2, - this.$$d[key2], - this.$$p_d, - "toAttribute" - ); - if (attribute_value == null) { - this.removeAttribute(this.$$p_d[key2].attribute || key2); - } else { - this.setAttribute(this.$$p_d[key2].attribute || key2, attribute_value); - } - } - } - this.$$r = false; - }; - this.$$c.$$.after_update.push(reflect_attributes); - reflect_attributes(); - for (const type in this.$$l) { - for (const listener of this.$$l[type]) { - const unsub = this.$$c.$on(type, listener); - this.$$l_u.set(listener, unsub); - } - } - this.$$l = {}; - } - } - // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte - // and setting attributes through setAttribute etc, this is helpful - attributeChangedCallback(attr2, _oldValue, newValue) { - var _a2; - if (this.$$r) return; - attr2 = this.$$g_p(attr2); - this.$$d[attr2] = get_custom_element_value(attr2, newValue, this.$$p_d, "toProp"); - (_a2 = this.$$c) == null ? void 0 : _a2.$set({ [attr2]: this.$$d[attr2] }); - } - disconnectedCallback() { - this.$$cn = false; - Promise.resolve().then(() => { - if (!this.$$cn && this.$$c) { - this.$$c.$destroy(); - this.$$c = void 0; - } - }); - } - $$g_p(attribute_name) { - return Object.keys(this.$$p_d).find( - (key2) => this.$$p_d[key2].attribute === attribute_name || !this.$$p_d[key2].attribute && key2.toLowerCase() === attribute_name - ) || attribute_name; - } - }; -} -function get_custom_element_value(prop, value, props_definition, transform) { - var _a2; - const type = (_a2 = props_definition[prop]) == null ? void 0 : _a2.type; - value = type === "Boolean" && typeof value !== "boolean" ? value != null : value; - if (!transform || !props_definition[prop]) { - return value; - } else if (transform === "toAttribute") { - switch (type) { - case "Object": - case "Array": - return value == null ? null : JSON.stringify(value); - case "Boolean": - return value ? "" : null; - case "Number": - return value == null ? null : value; - default: - return value; - } - } else { - switch (type) { - case "Object": - case "Array": - return value && JSON.parse(value); - case "Boolean": - return value; - case "Number": - return value != null ? +value : value; - default: - return value; - } - } -} -var SvelteComponent = class { - constructor() { - /** - * ### PRIVATE API - * - * Do not use, may change at any time - * - * @type {any} - */ - __publicField(this, "$$"); - /** - * ### PRIVATE API - * - * Do not use, may change at any time - * - * @type {any} - */ - __publicField(this, "$$set"); - } - /** @returns {void} */ - $destroy() { - destroy_component(this, 1); - this.$destroy = noop; - } - /** - * @template {Extract} K - * @param {K} type - * @param {((e: Events[K]) => void) | null | undefined} callback - * @returns {() => void} - */ - $on(type, callback) { - if (!is_function(callback)) { - return noop; - } - const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); - callbacks.push(callback); - return () => { - const index2 = callbacks.indexOf(callback); - if (index2 !== -1) callbacks.splice(index2, 1); - }; - } - /** - * @param {Partial} props - * @returns {void} - */ - $set(props) { - if (this.$$set && !is_empty(props)) { - this.$$.skip_bound = true; - this.$$set(props); - this.$$.skip_bound = false; - } - } -}; - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/dev.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/shared/version.js -init_polyfill_buffer(); -var PUBLIC_VERSION = "4"; - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/internal/disclose-version/index.js -init_polyfill_buffer(); -if (typeof window !== "undefined") - (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION); - -// node_modules/.pnpm/tslib@2.6.3/node_modules/tslib/tslib.es6.mjs -init_polyfill_buffer(); -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -// src/ui/history/historyView.svelte -var import_obsidian20 = require("obsidian"); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/index.js -init_polyfill_buffer(); - -// src/ui/history/components/logComponent.svelte -init_polyfill_buffer(); -var import_obsidian19 = require("obsidian"); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/transition/index.js -init_polyfill_buffer(); - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/easing/index.js -init_polyfill_buffer(); -function cubicOut(t) { - const f = t - 1; - return f * f * f + 1; -} - -// node_modules/.pnpm/svelte@4.2.18/node_modules/svelte/src/runtime/transition/index.js -function slide(node, { delay: delay2 = 0, duration = 400, easing = cubicOut, axis = "y" } = {}) { - const style = getComputedStyle(node); - const opacity = +style.opacity; - const primary_property = axis === "y" ? "height" : "width"; - const primary_property_value = parseFloat(style[primary_property]); - const secondary_properties = axis === "y" ? ["top", "bottom"] : ["left", "right"]; - const capitalized_secondary_properties = secondary_properties.map( - (e) => `${e[0].toUpperCase()}${e.slice(1)}` - ); - const padding_start_value = parseFloat(style[`padding${capitalized_secondary_properties[0]}`]); - const padding_end_value = parseFloat(style[`padding${capitalized_secondary_properties[1]}`]); - const margin_start_value = parseFloat(style[`margin${capitalized_secondary_properties[0]}`]); - const margin_end_value = parseFloat(style[`margin${capitalized_secondary_properties[1]}`]); - const border_width_start_value = parseFloat( - style[`border${capitalized_secondary_properties[0]}Width`] - ); - const border_width_end_value = parseFloat( - style[`border${capitalized_secondary_properties[1]}Width`] - ); - return { - delay: delay2, - duration, - easing, - css: (t) => `overflow: hidden;opacity: ${Math.min(t * 20, 1) * opacity};${primary_property}: ${t * primary_property_value}px;padding-${secondary_properties[0]}: ${t * padding_start_value}px;padding-${secondary_properties[1]}: ${t * padding_end_value}px;margin-${secondary_properties[0]}: ${t * margin_start_value}px;margin-${secondary_properties[1]}: ${t * margin_end_value}px;border-${secondary_properties[0]}-width: ${t * border_width_start_value}px;border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;` - }; -} - -// src/ui/history/components/logFileComponent.svelte -init_polyfill_buffer(); -var import_obsidian18 = require("obsidian"); -function add_css(target) { - append_styles(target, "svelte-1wbh8tp", "main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}"); -} -function create_if_block(ctx) { - let div; - let mounted; - let dispose; - return { - c() { - div = element("div"); - attr(div, "data-icon", "go-to-file"); - attr(div, "aria-label", "Open File"); - attr(div, "class", "clickable-icon"); - }, - m(target, anchor) { - insert(target, div, anchor); - ctx[7](div); - if (!mounted) { - dispose = [ - listen(div, "auxclick", stop_propagation( - /*open*/ - ctx[4] - )), - listen(div, "click", stop_propagation( - /*open*/ - ctx[4] - )) - ]; - mounted = true; - } - }, - p: noop, - d(detaching) { - if (detaching) { - detach(div); - } - ctx[7](null); - mounted = false; - run_all(dispose); - } - }; -} -function create_fragment(ctx) { - let main; - let div3; - let div0; - let t0_value = getDisplayPath( - /*diff*/ - ctx[0].vault_path - ) + ""; - let t0; - let t1; - let div2; - let div1; - let show_if = ( - /*view*/ - ctx[1].app.vault.getAbstractFileByPath( - /*diff*/ - ctx[0].vault_path - ) instanceof import_obsidian18.TFile - ); - let t2; - let span; - let t3_value = ( - /*diff*/ - ctx[0].status + "" - ); - let t3; - let span_data_type_value; - let div3_data_path_value; - let div3_aria_label_value; - let mounted; - let dispose; - let if_block = show_if && create_if_block(ctx); - return { - c() { - var _a2, _b; - main = element("main"); - div3 = element("div"); - div0 = element("div"); - t0 = text(t0_value); - t1 = space(); - div2 = element("div"); - div1 = element("div"); - if (if_block) if_block.c(); - t2 = space(); - span = element("span"); - t3 = text(t3_value); - attr(div0, "class", "tree-item-inner nav-file-title-content"); - attr(div1, "class", "buttons"); - attr(span, "class", "type"); - attr(span, "data-type", span_data_type_value = /*diff*/ - ctx[0].status); - attr(div2, "class", "git-tools"); - attr(div3, "class", "tree-item-self is-clickable nav-file-title svelte-1wbh8tp"); - attr(div3, "data-path", div3_data_path_value = /*diff*/ - ctx[0].vault_path); - attr( - div3, - "data-tooltip-position", - /*side*/ - ctx[3] - ); - attr(div3, "aria-label", div3_aria_label_value = /*diff*/ - ctx[0].vault_path); - toggle_class( - div3, - "is-active", - /*view*/ - ((_a2 = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _a2.file) == /*diff*/ - ctx[0].vault_path && /*view*/ - ((_b = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _b.hash) - ); - attr(main, "class", "tree-item nav-file svelte-1wbh8tp"); - }, - m(target, anchor) { - insert(target, main, anchor); - append2(main, div3); - append2(div3, div0); - append2(div0, t0); - append2(div3, t1); - append2(div3, div2); - append2(div2, div1); - if (if_block) if_block.m(div1, null); - append2(div2, t2); - append2(div2, span); - append2(span, t3); - if (!mounted) { - dispose = [ - listen(main, "click", stop_propagation( - /*showDiff*/ - ctx[5] - )), - listen(main, "auxclick", stop_propagation( - /*auxclick_handler*/ - ctx[8] - )), - listen( - main, - "focus", - /*focus_handler*/ - ctx[6] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - var _a2, _b; - if (dirty & /*diff*/ - 1 && t0_value !== (t0_value = getDisplayPath( - /*diff*/ - ctx2[0].vault_path - ) + "")) set_data(t0, t0_value); - if (dirty & /*view, diff*/ - 3) show_if = /*view*/ - ctx2[1].app.vault.getAbstractFileByPath( - /*diff*/ - ctx2[0].vault_path - ) instanceof import_obsidian18.TFile; - if (show_if) { - if (if_block) { - if_block.p(ctx2, dirty); - } else { - if_block = create_if_block(ctx2); - if_block.c(); - if_block.m(div1, null); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } - if (dirty & /*diff*/ - 1 && t3_value !== (t3_value = /*diff*/ - ctx2[0].status + "")) set_data(t3, t3_value); - if (dirty & /*diff*/ - 1 && span_data_type_value !== (span_data_type_value = /*diff*/ - ctx2[0].status)) { - attr(span, "data-type", span_data_type_value); - } - if (dirty & /*diff*/ - 1 && div3_data_path_value !== (div3_data_path_value = /*diff*/ - ctx2[0].vault_path)) { - attr(div3, "data-path", div3_data_path_value); - } - if (dirty & /*side*/ - 8) { - attr( - div3, - "data-tooltip-position", - /*side*/ - ctx2[3] - ); - } - if (dirty & /*diff*/ - 1 && div3_aria_label_value !== (div3_aria_label_value = /*diff*/ - ctx2[0].vault_path)) { - attr(div3, "aria-label", div3_aria_label_value); - } - if (dirty & /*view, diff*/ - 3) { - toggle_class( - div3, - "is-active", - /*view*/ - ((_a2 = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _a2.file) == /*diff*/ - ctx2[0].vault_path && /*view*/ - ((_b = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _b.hash) - ); - } - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(main); - } - if (if_block) if_block.d(); - mounted = false; - run_all(dispose); - } - }; -} -function instance($$self, $$props, $$invalidate) { - let side; - let { diff: diff3 } = $$props; - let { view } = $$props; - let buttons = []; - window.setTimeout(() => buttons.forEach((b) => (0, import_obsidian18.setIcon)(b, b.getAttr("data-icon"))), 0); - function open(event) { - var _a2; - const file = view.app.vault.getAbstractFileByPath(diff3.vault_path); - if (file instanceof import_obsidian18.TFile) { - (_a2 = getNewLeaf(event)) === null || _a2 === void 0 ? void 0 : _a2.openFile(file); - } - } - function showDiff(event) { - var _a2; - (_a2 = getNewLeaf(event)) === null || _a2 === void 0 ? void 0 : _a2.setViewState({ - type: DIFF_VIEW_CONFIG.type, - active: true, - state: { - file: diff3.path, - staged: false, - hash: diff3.hash - } - }); - } - function focus_handler(event) { - bubble.call(this, $$self, event); - } - function div_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[0] = $$value; - $$invalidate(2, buttons); - }); - } - const auxclick_handler = (event) => mayTriggerFileMenu(view.app, event, diff3.vault_path, view.leaf, "git-history"); - $$self.$$set = ($$props2) => { - if ("diff" in $$props2) $$invalidate(0, diff3 = $$props2.diff); - if ("view" in $$props2) $$invalidate(1, view = $$props2.view); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*view*/ - 2) { - $: $$invalidate(3, side = view.leaf.getRoot().side == "left" ? "right" : "left"); - } - }; - return [ - diff3, - view, - buttons, - side, - open, - showDiff, - focus_handler, - div_binding, - auxclick_handler - ]; -} -var LogFileComponent = class extends SvelteComponent { - constructor(options) { - super(); - init2(this, options, instance, create_fragment, safe_not_equal, { diff: 0, view: 1 }, add_css); - } -}; -var logFileComponent_default = LogFileComponent; - -// src/ui/history/components/logTreeComponent.svelte -init_polyfill_buffer(); -function add_css2(target) { - append_styles(target, "svelte-1lnl15d", "main.svelte-1lnl15d .nav-folder-title-content.svelte-1lnl15d{display:flex;align-items:center}"); -} -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[8] = list[i]; - return child_ctx; -} -function create_else_block(ctx) { - let div4; - let div3; - let div0; - let t0; - let div1; - let t1; - let div2; - let t2_value = ( - /*entity*/ - ctx[8].title + "" - ); - let t2; - let div3_aria_label_value; - let t3; - let t4; - let current; - let mounted; - let dispose; - function click_handler() { - return ( - /*click_handler*/ - ctx[7]( - /*entity*/ - ctx[8] - ) - ); - } - let if_block = !/*closed*/ - ctx[4][ - /*entity*/ - ctx[8].title - ] && create_if_block_1(ctx); - return { - c() { - div4 = element("div"); - div3 = element("div"); - div0 = element("div"); - t0 = space(); - div1 = element("div"); - div1.innerHTML = ``; - t1 = space(); - div2 = element("div"); - t2 = text(t2_value); - t3 = space(); - if (if_block) if_block.c(); - t4 = space(); - attr(div0, "data-icon", "folder"); - set_style(div0, "padding-right", "5px"); - set_style(div0, "display", "flex"); - attr(div1, "class", "tree-item-icon nav-folder-collapse-indicator collapse-icon"); - toggle_class( - div1, - "is-collapsed", - /*closed*/ - ctx[4][ - /*entity*/ - ctx[8].title - ] - ); - attr(div2, "class", "tree-item-inner nav-folder-title-content svelte-1lnl15d"); - attr(div3, "class", "tree-item-self is-clickable nav-folder-title"); - attr( - div3, - "data-tooltip-position", - /*side*/ - ctx[5] - ); - attr(div3, "aria-label", div3_aria_label_value = /*entity*/ - ctx[8].vaultPath); - attr(div4, "class", "tree-item nav-folder"); - toggle_class( - div4, - "is-collapsed", - /*closed*/ - ctx[4][ - /*entity*/ - ctx[8].title - ] - ); - }, - m(target, anchor) { - insert(target, div4, anchor); - append2(div4, div3); - append2(div3, div0); - append2(div3, t0); - append2(div3, div1); - append2(div3, t1); - append2(div3, div2); - append2(div2, t2); - append2(div4, t3); - if (if_block) if_block.m(div4, null); - append2(div4, t4); - current = true; - if (!mounted) { - dispose = listen(div3, "click", click_handler); - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - if (!current || dirty & /*closed, hierarchy*/ - 17) { - toggle_class( - div1, - "is-collapsed", - /*closed*/ - ctx[4][ - /*entity*/ - ctx[8].title - ] - ); - } - if ((!current || dirty & /*hierarchy*/ - 1) && t2_value !== (t2_value = /*entity*/ - ctx[8].title + "")) set_data(t2, t2_value); - if (!current || dirty & /*side*/ - 32) { - attr( - div3, - "data-tooltip-position", - /*side*/ - ctx[5] - ); - } - if (!current || dirty & /*hierarchy*/ - 1 && div3_aria_label_value !== (div3_aria_label_value = /*entity*/ - ctx[8].vaultPath)) { - attr(div3, "aria-label", div3_aria_label_value); - } - if (!/*closed*/ - ctx[4][ - /*entity*/ - ctx[8].title - ]) { - if (if_block) { - if_block.p(ctx, dirty); - if (dirty & /*closed, hierarchy*/ - 17) { - transition_in(if_block, 1); - } - } else { - if_block = create_if_block_1(ctx); - if_block.c(); - transition_in(if_block, 1); - if_block.m(div4, t4); - } - } else if (if_block) { - group_outros(); - transition_out(if_block, 1, 1, () => { - if_block = null; - }); - check_outros(); - } - if (!current || dirty & /*closed, hierarchy*/ - 17) { - toggle_class( - div4, - "is-collapsed", - /*closed*/ - ctx[4][ - /*entity*/ - ctx[8].title - ] - ); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div4); - } - if (if_block) if_block.d(); - mounted = false; - dispose(); - } - }; -} -function create_if_block2(ctx) { - let div; - let logfilecomponent; - let t; - let current; - logfilecomponent = new logFileComponent_default({ - props: { - diff: ( - /*entity*/ - ctx[8].data - ), - view: ( - /*view*/ - ctx[2] - ) - } - }); - return { - c() { - div = element("div"); - create_component(logfilecomponent.$$.fragment); - t = space(); - }, - m(target, anchor) { - insert(target, div, anchor); - mount_component(logfilecomponent, div, null); - append2(div, t); - current = true; - }, - p(ctx2, dirty) { - const logfilecomponent_changes = {}; - if (dirty & /*hierarchy*/ - 1) logfilecomponent_changes.diff = /*entity*/ - ctx2[8].data; - if (dirty & /*view*/ - 4) logfilecomponent_changes.view = /*view*/ - ctx2[2]; - logfilecomponent.$set(logfilecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(logfilecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(logfilecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - destroy_component(logfilecomponent); - } - }; -} -function create_if_block_1(ctx) { - let div; - let logtreecomponent; - let div_transition; - let current; - logtreecomponent = new LogTreeComponent({ - props: { - hierarchy: ( - /*entity*/ - ctx[8] - ), - plugin: ( - /*plugin*/ - ctx[1] - ), - view: ( - /*view*/ - ctx[2] - ) - } - }); - return { - c() { - div = element("div"); - create_component(logtreecomponent.$$.fragment); - attr(div, "class", "tree-item-children nav-folder-children"); - }, - m(target, anchor) { - insert(target, div, anchor); - mount_component(logtreecomponent, div, null); - current = true; - }, - p(ctx2, dirty) { - const logtreecomponent_changes = {}; - if (dirty & /*hierarchy*/ - 1) logtreecomponent_changes.hierarchy = /*entity*/ - ctx2[8]; - if (dirty & /*plugin*/ - 2) logtreecomponent_changes.plugin = /*plugin*/ - ctx2[1]; - if (dirty & /*view*/ - 4) logtreecomponent_changes.view = /*view*/ - ctx2[2]; - logtreecomponent.$set(logtreecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(logtreecomponent.$$.fragment, local); - if (local) { - add_render_callback(() => { - if (!current) return; - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true); - div_transition.run(1); - }); - } - current = true; - }, - o(local) { - transition_out(logtreecomponent.$$.fragment, local); - if (local) { - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false); - div_transition.run(0); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - destroy_component(logtreecomponent); - if (detaching && div_transition) div_transition.end(); - } - }; -} -function create_each_block(ctx) { - let current_block_type_index; - let if_block; - let if_block_anchor; - let current; - const if_block_creators = [create_if_block2, create_else_block]; - const if_blocks = []; - function select_block_type(ctx2, dirty) { - if ( - /*entity*/ - ctx2[8].data - ) return 0; - return 1; - } - current_block_type_index = select_block_type(ctx, -1); - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - return { - c() { - if_block.c(); - if_block_anchor = empty(); - }, - m(target, anchor) { - if_blocks[current_block_type_index].m(target, anchor); - insert(target, if_block_anchor, anchor); - current = true; - }, - p(ctx2, dirty) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type(ctx2, dirty); - if (current_block_type_index === previous_block_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } else { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(if_block_anchor); - } - if_blocks[current_block_type_index].d(detaching); - } - }; -} -function create_fragment2(ctx) { - let main; - let current; - let each_value = ensure_array_like( - /*hierarchy*/ - ctx[0].children - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); - } - const out = (i) => transition_out(each_blocks[i], 1, 1, () => { - each_blocks[i] = null; - }); - return { - c() { - main = element("main"); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - attr(main, "class", "svelte-1lnl15d"); - toggle_class( - main, - "topLevel", - /*topLevel*/ - ctx[3] - ); - }, - m(target, anchor) { - insert(target, main, anchor); - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(main, null); - } - } - current = true; - }, - p(ctx2, [dirty]) { - if (dirty & /*hierarchy, view, closed, plugin, side, fold*/ - 119) { - each_value = ensure_array_like( - /*hierarchy*/ - ctx2[0].children - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - transition_in(each_blocks[i], 1); - } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - transition_in(each_blocks[i], 1); - each_blocks[i].m(main, null); - } - } - group_outros(); - for (i = each_value.length; i < each_blocks.length; i += 1) { - out(i); - } - check_outros(); - } - if (!current || dirty & /*topLevel*/ - 8) { - toggle_class( - main, - "topLevel", - /*topLevel*/ - ctx2[3] - ); - } - }, - i(local) { - if (current) return; - for (let i = 0; i < each_value.length; i += 1) { - transition_in(each_blocks[i]); - } - current = true; - }, - o(local) { - each_blocks = each_blocks.filter(Boolean); - for (let i = 0; i < each_blocks.length; i += 1) { - transition_out(each_blocks[i]); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(main); - } - destroy_each(each_blocks, detaching); - } - }; -} -function instance2($$self, $$props, $$invalidate) { - let side; - let { hierarchy } = $$props; - let { plugin } = $$props; - let { view } = $$props; - let { topLevel = false } = $$props; - const closed = {}; - function fold(item) { - $$invalidate(4, closed[item.title] = !closed[item.title], closed); - } - const click_handler = (entity) => fold(entity); - $$self.$$set = ($$props2) => { - if ("hierarchy" in $$props2) $$invalidate(0, hierarchy = $$props2.hierarchy); - if ("plugin" in $$props2) $$invalidate(1, plugin = $$props2.plugin); - if ("view" in $$props2) $$invalidate(2, view = $$props2.view); - if ("topLevel" in $$props2) $$invalidate(3, topLevel = $$props2.topLevel); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*view*/ - 4) { - $: $$invalidate(5, side = view.leaf.getRoot().side == "left" ? "right" : "left"); - } - }; - return [hierarchy, plugin, view, topLevel, closed, side, fold, click_handler]; -} -var LogTreeComponent = class extends SvelteComponent { - constructor(options) { - super(); - init2( - this, - options, - instance2, - create_fragment2, - safe_not_equal, - { - hierarchy: 0, - plugin: 1, - view: 2, - topLevel: 3 - }, - add_css2 - ); - } -}; -var logTreeComponent_default = LogTreeComponent; - -// src/ui/history/components/logComponent.svelte -function get_each_context2(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[9] = list[i]; - return child_ctx; -} -function create_if_block_4(ctx) { - let div; - let t_value = ( - /*log*/ - ctx[0].refs.join(", ") + "" - ); - let t; - return { - c() { - div = element("div"); - t = text(t_value); - attr(div, "class", "git-ref"); - }, - m(target, anchor) { - insert(target, div, anchor); - append2(div, t); - }, - p(ctx2, dirty) { - if (dirty & /*log*/ - 1 && t_value !== (t_value = /*log*/ - ctx2[0].refs.join(", ") + "")) set_data(t, t_value); - }, - d(detaching) { - if (detaching) { - detach(div); - } - } - }; -} -function create_if_block_3(ctx) { - let div; - let t_value = ( - /*authorToString*/ - ctx[7]( - /*log*/ - ctx[0] - ) + "" - ); - let t; - return { - c() { - div = element("div"); - t = text(t_value); - attr(div, "class", "git-author"); - }, - m(target, anchor) { - insert(target, div, anchor); - append2(div, t); - }, - p(ctx2, dirty) { - if (dirty & /*log*/ - 1 && t_value !== (t_value = /*authorToString*/ - ctx2[7]( - /*log*/ - ctx2[0] - ) + "")) set_data(t, t_value); - }, - d(detaching) { - if (detaching) { - detach(div); - } - } - }; -} -function create_if_block_2(ctx) { - let div; - let t_value = (0, import_obsidian19.moment)( - /*log*/ - ctx[0].date - ).format( - /*plugin*/ - ctx[3].settings.commitDateFormat - ) + ""; - let t; - return { - c() { - div = element("div"); - t = text(t_value); - attr(div, "class", "git-date"); - }, - m(target, anchor) { - insert(target, div, anchor); - append2(div, t); - }, - p(ctx2, dirty) { - if (dirty & /*log, plugin*/ - 9 && t_value !== (t_value = (0, import_obsidian19.moment)( - /*log*/ - ctx2[0].date - ).format( - /*plugin*/ - ctx2[3].settings.commitDateFormat - ) + "")) set_data(t, t_value); - }, - d(detaching) { - if (detaching) { - detach(div); - } - } - }; -} -function create_if_block3(ctx) { - let div; - let current_block_type_index; - let if_block; - let div_transition; - let current; - const if_block_creators = [create_if_block_12, create_else_block2]; - const if_blocks = []; - function select_block_type(ctx2, dirty) { - if ( - /*showTree*/ - ctx2[2] - ) return 0; - return 1; - } - current_block_type_index = select_block_type(ctx, -1); - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - return { - c() { - div = element("div"); - if_block.c(); - attr(div, "class", "tree-item-children nav-folder-children"); - }, - m(target, anchor) { - insert(target, div, anchor); - if_blocks[current_block_type_index].m(div, null); - current = true; - }, - p(ctx2, dirty) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type(ctx2, dirty); - if (current_block_type_index === previous_block_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } else { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(div, null); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - if (local) { - add_render_callback(() => { - if (!current) return; - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true); - div_transition.run(1); - }); - } - current = true; - }, - o(local) { - transition_out(if_block); - if (local) { - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false); - div_transition.run(0); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - if_blocks[current_block_type_index].d(); - if (detaching && div_transition) div_transition.end(); - } - }; -} -function create_else_block2(ctx) { - let each_1_anchor; - let current; - let each_value = ensure_array_like( - /*log*/ - ctx[0].diff.files - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block2(get_each_context2(ctx, each_value, i)); - } - const out = (i) => transition_out(each_blocks[i], 1, 1, () => { - each_blocks[i] = null; - }); - return { - c() { - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - each_1_anchor = empty(); - }, - m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(target, anchor); - } - } - insert(target, each_1_anchor, anchor); - current = true; - }, - p(ctx2, dirty) { - if (dirty & /*view, log*/ - 3) { - each_value = ensure_array_like( - /*log*/ - ctx2[0].diff.files - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context2(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - transition_in(each_blocks[i], 1); - } else { - each_blocks[i] = create_each_block2(child_ctx); - each_blocks[i].c(); - transition_in(each_blocks[i], 1); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); - } - } - group_outros(); - for (i = each_value.length; i < each_blocks.length; i += 1) { - out(i); - } - check_outros(); - } - }, - i(local) { - if (current) return; - for (let i = 0; i < each_value.length; i += 1) { - transition_in(each_blocks[i]); - } - current = true; - }, - o(local) { - each_blocks = each_blocks.filter(Boolean); - for (let i = 0; i < each_blocks.length; i += 1) { - transition_out(each_blocks[i]); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(each_1_anchor); - } - destroy_each(each_blocks, detaching); - } - }; -} -function create_if_block_12(ctx) { - let logtreecomponent; - let current; - logtreecomponent = new logTreeComponent_default({ - props: { - hierarchy: ( - /*logsHierarchy*/ - ctx[6] - ), - plugin: ( - /*plugin*/ - ctx[3] - ), - view: ( - /*view*/ - ctx[1] - ), - topLevel: true - } - }); - return { - c() { - create_component(logtreecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(logtreecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const logtreecomponent_changes = {}; - if (dirty & /*logsHierarchy*/ - 64) logtreecomponent_changes.hierarchy = /*logsHierarchy*/ - ctx2[6]; - if (dirty & /*plugin*/ - 8) logtreecomponent_changes.plugin = /*plugin*/ - ctx2[3]; - if (dirty & /*view*/ - 2) logtreecomponent_changes.view = /*view*/ - ctx2[1]; - logtreecomponent.$set(logtreecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(logtreecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(logtreecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(logtreecomponent, detaching); - } - }; -} -function create_each_block2(ctx) { - let logfilecomponent; - let current; - logfilecomponent = new logFileComponent_default({ - props: { - view: ( - /*view*/ - ctx[1] - ), - diff: ( - /*file*/ - ctx[9] - ) - } - }); - return { - c() { - create_component(logfilecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(logfilecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const logfilecomponent_changes = {}; - if (dirty & /*view*/ - 2) logfilecomponent_changes.view = /*view*/ - ctx2[1]; - if (dirty & /*log*/ - 1) logfilecomponent_changes.diff = /*file*/ - ctx2[9]; - logfilecomponent.$set(logfilecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(logfilecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(logfilecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(logfilecomponent, detaching); - } - }; -} -function create_fragment3(ctx) { - var _a2; - let main; - let div4; - let div3; - let div0; - let t0; - let div2; - let t1; - let t2; - let t3; - let div1; - let t4_value = ( - /*log*/ - ctx[0].message + "" - ); - let t4; - let div3_aria_label_value; - let t5; - let current; - let mounted; - let dispose; - let if_block0 = ( - /*log*/ - ctx[0].refs.length > 0 && create_if_block_4(ctx) - ); - let if_block1 = ( - /*plugin*/ - ctx[3].settings.authorInHistoryView != "hide" && /*log*/ - ((_a2 = ctx[0].author) == null ? void 0 : _a2.name) && create_if_block_3(ctx) - ); - let if_block2 = ( - /*plugin*/ - ctx[3].settings.dateInHistoryView && create_if_block_2(ctx) - ); - let if_block3 = !/*isCollapsed*/ - ctx[4] && create_if_block3(ctx); - return { - c() { - var _a3; - main = element("main"); - div4 = element("div"); - div3 = element("div"); - div0 = element("div"); - div0.innerHTML = ``; - t0 = space(); - div2 = element("div"); - if (if_block0) if_block0.c(); - t1 = space(); - if (if_block1) if_block1.c(); - t2 = space(); - if (if_block2) if_block2.c(); - t3 = space(); - div1 = element("div"); - t4 = text(t4_value); - t5 = space(); - if (if_block3) if_block3.c(); - attr(div0, "class", "tree-item-icon nav-folder-collapse-indicator collapse-icon"); - toggle_class( - div0, - "is-collapsed", - /*isCollapsed*/ - ctx[4] - ); - attr(div1, "class", "tree-item-inner nav-folder-title-content"); - attr(div3, "class", "tree-item-self is-clickable nav-folder-title"); - attr(div3, "aria-label", div3_aria_label_value = `${/*log*/ - ctx[0].refs.length > 0 ? ( - /*log*/ - ctx[0].refs.join(", ") + "\n" - ) : ""}${/*log*/ - (_a3 = ctx[0].author) == null ? void 0 : _a3.name} -${(0, import_obsidian19.moment)( - /*log*/ - ctx[0].date - ).format( - /*plugin*/ - ctx[3].settings.commitDateFormat - )} -${/*log*/ - ctx[0].message}`); - attr( - div3, - "data-tooltip-position", - /*side*/ - ctx[5] - ); - attr(div4, "class", "tree-item nav-folder"); - toggle_class( - div4, - "is-collapsed", - /*isCollapsed*/ - ctx[4] - ); - }, - m(target, anchor) { - insert(target, main, anchor); - append2(main, div4); - append2(div4, div3); - append2(div3, div0); - append2(div3, t0); - append2(div3, div2); - if (if_block0) if_block0.m(div2, null); - append2(div2, t1); - if (if_block1) if_block1.m(div2, null); - append2(div2, t2); - if (if_block2) if_block2.m(div2, null); - append2(div2, t3); - append2(div2, div1); - append2(div1, t4); - append2(div4, t5); - if (if_block3) if_block3.m(div4, null); - current = true; - if (!mounted) { - dispose = listen( - div3, - "click", - /*click_handler*/ - ctx[8] - ); - mounted = true; - } - }, - p(ctx2, [dirty]) { - var _a3, _b; - if (!current || dirty & /*isCollapsed*/ - 16) { - toggle_class( - div0, - "is-collapsed", - /*isCollapsed*/ - ctx2[4] - ); - } - if ( - /*log*/ - ctx2[0].refs.length > 0 - ) { - if (if_block0) { - if_block0.p(ctx2, dirty); - } else { - if_block0 = create_if_block_4(ctx2); - if_block0.c(); - if_block0.m(div2, t1); - } - } else if (if_block0) { - if_block0.d(1); - if_block0 = null; - } - if ( - /*plugin*/ - ctx2[3].settings.authorInHistoryView != "hide" && /*log*/ - ((_a3 = ctx2[0].author) == null ? void 0 : _a3.name) - ) { - if (if_block1) { - if_block1.p(ctx2, dirty); - } else { - if_block1 = create_if_block_3(ctx2); - if_block1.c(); - if_block1.m(div2, t2); - } - } else if (if_block1) { - if_block1.d(1); - if_block1 = null; - } - if ( - /*plugin*/ - ctx2[3].settings.dateInHistoryView - ) { - if (if_block2) { - if_block2.p(ctx2, dirty); - } else { - if_block2 = create_if_block_2(ctx2); - if_block2.c(); - if_block2.m(div2, t3); - } - } else if (if_block2) { - if_block2.d(1); - if_block2 = null; - } - if ((!current || dirty & /*log*/ - 1) && t4_value !== (t4_value = /*log*/ - ctx2[0].message + "")) set_data(t4, t4_value); - if (!current || dirty & /*log, plugin*/ - 9 && div3_aria_label_value !== (div3_aria_label_value = `${/*log*/ - ctx2[0].refs.length > 0 ? ( - /*log*/ - ctx2[0].refs.join(", ") + "\n" - ) : ""}${/*log*/ - (_b = ctx2[0].author) == null ? void 0 : _b.name} -${(0, import_obsidian19.moment)( - /*log*/ - ctx2[0].date - ).format( - /*plugin*/ - ctx2[3].settings.commitDateFormat - )} -${/*log*/ - ctx2[0].message}`)) { - attr(div3, "aria-label", div3_aria_label_value); - } - if (!current || dirty & /*side*/ - 32) { - attr( - div3, - "data-tooltip-position", - /*side*/ - ctx2[5] - ); - } - if (!/*isCollapsed*/ - ctx2[4]) { - if (if_block3) { - if_block3.p(ctx2, dirty); - if (dirty & /*isCollapsed*/ - 16) { - transition_in(if_block3, 1); - } - } else { - if_block3 = create_if_block3(ctx2); - if_block3.c(); - transition_in(if_block3, 1); - if_block3.m(div4, null); - } - } else if (if_block3) { - group_outros(); - transition_out(if_block3, 1, 1, () => { - if_block3 = null; - }); - check_outros(); - } - if (!current || dirty & /*isCollapsed*/ - 16) { - toggle_class( - div4, - "is-collapsed", - /*isCollapsed*/ - ctx2[4] - ); - } - }, - i(local) { - if (current) return; - transition_in(if_block3); - current = true; - }, - o(local) { - transition_out(if_block3); - current = false; - }, - d(detaching) { - if (detaching) { - detach(main); - } - if (if_block0) if_block0.d(); - if (if_block1) if_block1.d(); - if (if_block2) if_block2.d(); - if (if_block3) if_block3.d(); - mounted = false; - dispose(); - } - }; -} -function instance3($$self, $$props, $$invalidate) { - let logsHierarchy; - let side; - let { log: log2 } = $$props; - let { view } = $$props; - let { showTree } = $$props; - let { plugin } = $$props; - let isCollapsed = true; - function authorToString(log3) { - const name = log3.author.name; - if (plugin.settings.authorInHistoryView == "full") { - return name; - } else if (plugin.settings.authorInHistoryView == "initials") { - const words = name.split(" ").filter((word) => word.length > 0); - return words.map((word) => word[0].toUpperCase()).join(""); - } - } - const click_handler = () => $$invalidate(4, isCollapsed = !isCollapsed); - $$self.$$set = ($$props2) => { - if ("log" in $$props2) $$invalidate(0, log2 = $$props2.log); - if ("view" in $$props2) $$invalidate(1, view = $$props2.view); - if ("showTree" in $$props2) $$invalidate(2, showTree = $$props2.showTree); - if ("plugin" in $$props2) $$invalidate(3, plugin = $$props2.plugin); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*plugin, log*/ - 9) { - $: $$invalidate(6, logsHierarchy = { - title: "", - path: "", - vaultPath: "", - children: plugin.gitManager.getTreeStructure(log2.diff.files) - }); - } - if ($$self.$$.dirty & /*view*/ - 2) { - $: $$invalidate(5, side = view.leaf.getRoot().side == "left" ? "right" : "left"); - } - }; - return [ - log2, - view, - showTree, - plugin, - isCollapsed, - side, - logsHierarchy, - authorToString, - click_handler - ]; -} -var LogComponent = class extends SvelteComponent { - constructor(options) { - super(); - init2(this, options, instance3, create_fragment3, safe_not_equal, { log: 0, view: 1, showTree: 2, plugin: 3 }); - } -}; -var logComponent_default = LogComponent; - -// src/ui/history/historyView.svelte -function get_each_context3(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[11] = list[i]; - return child_ctx; -} -function create_if_block4(ctx) { - let div1; - let div0; - let current; - let each_value = ensure_array_like( - /*logs*/ - ctx[6] - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block3(get_each_context3(ctx, each_value, i)); - } - const out = (i) => transition_out(each_blocks[i], 1, 1, () => { - each_blocks[i] = null; - }); - return { - c() { - div1 = element("div"); - div0 = element("div"); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - attr(div0, "class", "tree-item-children nav-folder-children"); - attr(div1, "class", "tree-item nav-folder mod-root"); - }, - m(target, anchor) { - insert(target, div1, anchor); - append2(div1, div0); - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(div0, null); - } - } - current = true; - }, - p(ctx2, dirty) { - if (dirty & /*view, showTree, logs, plugin*/ - 71) { - each_value = ensure_array_like( - /*logs*/ - ctx2[6] - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context3(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - transition_in(each_blocks[i], 1); - } else { - each_blocks[i] = create_each_block3(child_ctx); - each_blocks[i].c(); - transition_in(each_blocks[i], 1); - each_blocks[i].m(div0, null); - } - } - group_outros(); - for (i = each_value.length; i < each_blocks.length; i += 1) { - out(i); - } - check_outros(); - } - }, - i(local) { - if (current) return; - for (let i = 0; i < each_value.length; i += 1) { - transition_in(each_blocks[i]); - } - current = true; - }, - o(local) { - each_blocks = each_blocks.filter(Boolean); - for (let i = 0; i < each_blocks.length; i += 1) { - transition_out(each_blocks[i]); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(div1); - } - destroy_each(each_blocks, detaching); - } - }; -} -function create_each_block3(ctx) { - let logcomponent; - let current; - logcomponent = new logComponent_default({ - props: { - view: ( - /*view*/ - ctx[1] - ), - showTree: ( - /*showTree*/ - ctx[2] - ), - log: ( - /*log*/ - ctx[11] - ), - plugin: ( - /*plugin*/ - ctx[0] - ) - } - }); - return { - c() { - create_component(logcomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(logcomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const logcomponent_changes = {}; - if (dirty & /*view*/ - 2) logcomponent_changes.view = /*view*/ - ctx2[1]; - if (dirty & /*showTree*/ - 4) logcomponent_changes.showTree = /*showTree*/ - ctx2[2]; - if (dirty & /*logs*/ - 64) logcomponent_changes.log = /*log*/ - ctx2[11]; - if (dirty & /*plugin*/ - 1) logcomponent_changes.plugin = /*plugin*/ - ctx2[0]; - logcomponent.$set(logcomponent_changes); - }, - i(local) { - if (current) return; - transition_in(logcomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(logcomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(logcomponent, detaching); - } - }; -} -function create_fragment4(ctx) { - let main; - let div3; - let div2; - let div0; - let t0; - let div1; - let t1; - let div4; - let current; - let mounted; - let dispose; - let if_block = ( - /*logs*/ - ctx[6] && create_if_block4(ctx) - ); - return { - c() { - main = element("main"); - div3 = element("div"); - div2 = element("div"); - div0 = element("div"); - t0 = space(); - div1 = element("div"); - t1 = space(); - div4 = element("div"); - if (if_block) if_block.c(); - attr(div0, "id", "layoutChange"); - attr(div0, "class", "clickable-icon nav-action-button"); - attr(div0, "aria-label", "Change Layout"); - attr(div1, "id", "refresh"); - attr(div1, "class", "clickable-icon nav-action-button"); - attr(div1, "data-icon", "refresh-cw"); - attr(div1, "aria-label", "Refresh"); - set_style(div1, "margin", "1px"); - toggle_class( - div1, - "loading", - /*loading*/ - ctx[4] - ); - attr(div2, "class", "nav-buttons-container"); - attr(div3, "class", "nav-header"); - attr(div4, "class", "nav-files-container"); - set_style(div4, "position", "relative"); - }, - m(target, anchor) { - insert(target, main, anchor); - append2(main, div3); - append2(div3, div2); - append2(div2, div0); - ctx[7](div0); - append2(div2, t0); - append2(div2, div1); - ctx[9](div1); - append2(main, t1); - append2(main, div4); - if (if_block) if_block.m(div4, null); - current = true; - if (!mounted) { - dispose = [ - listen( - div0, - "click", - /*click_handler*/ - ctx[8] - ), - listen(div1, "click", triggerRefresh) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - if (!current || dirty & /*loading*/ - 16) { - toggle_class( - div1, - "loading", - /*loading*/ - ctx2[4] - ); - } - if ( - /*logs*/ - ctx2[6] - ) { - if (if_block) { - if_block.p(ctx2, dirty); - if (dirty & /*logs*/ - 64) { - transition_in(if_block, 1); - } - } else { - if_block = create_if_block4(ctx2); - if_block.c(); - transition_in(if_block, 1); - if_block.m(div4, null); - } - } else if (if_block) { - group_outros(); - transition_out(if_block, 1, 1, () => { - if_block = null; - }); - check_outros(); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(main); - } - ctx[7](null); - ctx[9](null); - if (if_block) if_block.d(); - mounted = false; - run_all(dispose); - } - }; -} -function triggerRefresh() { - dispatchEvent(new CustomEvent("git-refresh")); -} -function instance4($$self, $$props, $$invalidate) { - let { plugin } = $$props; - let { view } = $$props; - let loading; - let buttons = []; - let logs; - let showTree = plugin.settings.treeStructure; - let layoutBtn; - addEventListener("git-view-refresh", refresh); - plugin.app.workspace.onLayoutReady(() => { - window.setTimeout( - () => { - buttons.forEach((btn) => (0, import_obsidian20.setIcon)(btn, btn.getAttr("data-icon"))); - (0, import_obsidian20.setIcon)(layoutBtn, showTree ? "list" : "folder"); - }, - 0 - ); - }); - onDestroy(() => { - removeEventListener("git-view-refresh", refresh); - }); - function refresh() { - return __awaiter(this, void 0, void 0, function* () { - $$invalidate(4, loading = true); - const isSimpleGit = plugin.gitManager instanceof SimpleGit; - $$invalidate(6, logs = yield plugin.gitManager.log(void 0, false, isSimpleGit ? 50 : 10)); - $$invalidate(4, loading = false); - }); - } - function div0_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - layoutBtn = $$value; - $$invalidate(3, layoutBtn); - }); - } - const click_handler = () => { - $$invalidate(2, showTree = !showTree); - $$invalidate(0, plugin.settings.treeStructure = showTree, plugin); - plugin.saveSettings(); - }; - function div1_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[6] = $$value; - $$invalidate(5, buttons); - }); - } - $$self.$$set = ($$props2) => { - if ("plugin" in $$props2) $$invalidate(0, plugin = $$props2.plugin); - if ("view" in $$props2) $$invalidate(1, view = $$props2.view); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*layoutBtn, showTree*/ - 12) { - $: { - if (layoutBtn) { - layoutBtn.empty(); - (0, import_obsidian20.setIcon)(layoutBtn, showTree ? "list" : "folder"); - } - } - } - }; - return [ - plugin, - view, - showTree, - layoutBtn, - loading, - buttons, - logs, - div0_binding, - click_handler, - div1_binding - ]; -} -var HistoryView = class extends SvelteComponent { - constructor(options) { - super(); - init2(this, options, instance4, create_fragment4, safe_not_equal, { plugin: 0, view: 1 }); - } -}; -var historyView_default = HistoryView; - -// src/ui/history/historyView.ts -var HistoryView2 = class extends import_obsidian21.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.plugin = plugin; - this.hoverPopover = null; - } - getViewType() { - return HISTORY_VIEW_CONFIG.type; - } - getDisplayText() { - return HISTORY_VIEW_CONFIG.name; - } - getIcon() { - return HISTORY_VIEW_CONFIG.icon; - } - onClose() { - return super.onClose(); - } - onOpen() { - this._view = new historyView_default({ - target: this.contentEl, - props: { - plugin: this.plugin, - view: this - } - }); - return super.onOpen(); - } -}; - -// src/ui/modals/branchModal.ts -init_polyfill_buffer(); -var import_obsidian22 = require("obsidian"); -var BranchModal = class extends import_obsidian22.FuzzySuggestModal { - constructor(branches) { - super(app); - this.branches = branches; - this.setPlaceholder("Select branch to checkout"); - } - getItems() { - return this.branches; - } - getItemText(item) { - return item; - } - onChooseItem(item, evt) { - this.resolve(item); - } - open() { - super.open(); - return new Promise((resolve2) => { - this.resolve = resolve2; - }); - } - async onClose() { - await new Promise((resolve2) => setTimeout(resolve2, 10)); - if (this.resolve) this.resolve(void 0); - } -}; - -// src/ui/modals/ignoreModal.ts -init_polyfill_buffer(); -var import_obsidian23 = require("obsidian"); -var IgnoreModal = class extends import_obsidian23.Modal { - constructor(app2, content) { - super(app2); - this.content = content; - this.resolve = null; - } - open() { - super.open(); - return new Promise((resolve2) => { - this.resolve = resolve2; - }); - } - onOpen() { - const { contentEl, titleEl } = this; - titleEl.setText("Edit .gitignore"); - const div = contentEl.createDiv(); - const text2 = div.createEl("textarea", { - text: this.content, - cls: ["obsidian-git-textarea"], - attr: { rows: 10, cols: 30, wrap: "off" } - }); - div.createEl("button", { - cls: ["mod-cta", "obsidian-git-center-button"], - text: "Save" - }).addEventListener("click", async () => { - this.resolve(text2.value); - this.close(); - }); - } - onClose() { - const { contentEl } = this; - this.resolve(void 0); - contentEl.empty(); - } -}; - -// src/ui/sourceControl/sourceControl.ts -init_polyfill_buffer(); -var import_obsidian30 = require("obsidian"); - -// src/ui/sourceControl/sourceControl.svelte -init_polyfill_buffer(); -var import_obsidian29 = require("obsidian"); - -// src/ui/modals/discardModal.ts -init_polyfill_buffer(); -var import_obsidian24 = require("obsidian"); -var DiscardModal = class extends import_obsidian24.Modal { - constructor(app2, deletion, filename) { - super(app2); - this.deletion = deletion; - this.filename = filename; - this.resolve = null; - } - myOpen() { - this.open(); - return new Promise((resolve2) => { - this.resolve = resolve2; - }); - } - onOpen() { - const { contentEl, titleEl } = this; - titleEl.setText(`${this.deletion ? "Delete" : "Discard"} this file?`); - contentEl.createEl("p").setText( - `Do you really want to ${this.deletion ? "delete" : "discard the changes of"} "${this.filename}"` - ); - const div = contentEl.createDiv({ cls: "modal-button-container" }); - const discard = div.createEl("button", { - cls: "mod-warning", - text: this.deletion ? "Delete" : "Discard" - }); - discard.addEventListener("click", async () => { - if (this.resolve) this.resolve(true); - this.close(); - }); - discard.addEventListener("keypress", async () => { - if (this.resolve) this.resolve(true); - this.close(); - }); - const close = div.createEl("button", { - text: "Cancel" - }); - close.addEventListener("click", () => { - if (this.resolve) this.resolve(false); - return this.close(); - }); - close.addEventListener("keypress", () => { - if (this.resolve) this.resolve(false); - return this.close(); - }); - } - onClose() { - const { contentEl } = this; - contentEl.empty(); - } -}; - -// src/ui/sourceControl/components/fileComponent.svelte -init_polyfill_buffer(); -var import_obsidian26 = require("obsidian"); - -// node_modules/.pnpm/obsidian-community-lib@https+++codeload.github.com+Vinzent03+obsidian-community-lib+tar.gz+e6_gis2so5ruhuavxzhyb52fw447e/node_modules/obsidian-community-lib/dist/index.js -init_polyfill_buffer(); - -// node_modules/.pnpm/obsidian-community-lib@https+++codeload.github.com+Vinzent03+obsidian-community-lib+tar.gz+e6_gis2so5ruhuavxzhyb52fw447e/node_modules/obsidian-community-lib/dist/utils.js -init_polyfill_buffer(); -var feather = __toESM(require_feather()); -var import_obsidian25 = require("obsidian"); -function hoverPreview(event, view, to) { - const targetEl = event.target; - app.workspace.trigger("hover-link", { - event, - source: view.getViewType(), - hoverParent: view, - targetEl, - linktext: to - }); -} - -// src/ui/sourceControl/components/fileComponent.svelte -function add_css3(target) { - append_styles(target, "svelte-1wbh8tp", "main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}"); -} -function create_if_block5(ctx) { - let div; - let mounted; - let dispose; - return { - c() { - div = element("div"); - attr(div, "data-icon", "go-to-file"); - attr(div, "aria-label", "Open File"); - attr(div, "class", "clickable-icon"); - }, - m(target, anchor) { - insert(target, div, anchor); - ctx[11](div); - if (!mounted) { - dispose = [ - listen(div, "auxclick", stop_propagation( - /*open*/ - ctx[5] - )), - listen(div, "click", stop_propagation( - /*open*/ - ctx[5] - )) - ]; - mounted = true; - } - }, - p: noop, - d(detaching) { - if (detaching) { - detach(div); - } - ctx[11](null); - mounted = false; - run_all(dispose); - } - }; -} -function create_fragment5(ctx) { - let main; - let div6; - let div0; - let t0_value = getDisplayPath( - /*change*/ - ctx[0].vault_path - ) + ""; - let t0; - let t1; - let div5; - let div3; - let show_if = ( - /*view*/ - ctx[1].app.vault.getAbstractFileByPath( - /*change*/ - ctx[0].vault_path - ) - ); - let t2; - let div1; - let t3; - let div2; - let t4; - let div4; - let t5_value = ( - /*change*/ - ctx[0].working_dir + "" - ); - let t5; - let div4_data_type_value; - let div6_data_path_value; - let div6_aria_label_value; - let mounted; - let dispose; - let if_block = show_if && create_if_block5(ctx); - return { - c() { - var _a2, _b, _c; - main = element("main"); - div6 = element("div"); - div0 = element("div"); - t0 = text(t0_value); - t1 = space(); - div5 = element("div"); - div3 = element("div"); - if (if_block) if_block.c(); - t2 = space(); - div1 = element("div"); - t3 = space(); - div2 = element("div"); - t4 = space(); - div4 = element("div"); - t5 = text(t5_value); - attr(div0, "class", "tree-item-inner nav-file-title-content"); - attr(div1, "data-icon", "undo"); - attr(div1, "aria-label", "Discard"); - attr(div1, "class", "clickable-icon"); - attr(div2, "data-icon", "plus"); - attr(div2, "aria-label", "Stage"); - attr(div2, "class", "clickable-icon"); - attr(div3, "class", "buttons"); - attr(div4, "class", "type"); - attr(div4, "data-type", div4_data_type_value = /*change*/ - ctx[0].working_dir); - attr(div5, "class", "git-tools"); - attr(div6, "class", "tree-item-self is-clickable nav-file-title svelte-1wbh8tp"); - attr(div6, "data-path", div6_data_path_value = /*change*/ - ctx[0].vault_path); - attr( - div6, - "data-tooltip-position", - /*side*/ - ctx[3] - ); - attr(div6, "aria-label", div6_aria_label_value = /*change*/ - ctx[0].vault_path); - toggle_class( - div6, - "is-active", - /*view*/ - ((_a2 = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _a2.file) == /*change*/ - ctx[0].vault_path && !/*view*/ - ((_b = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _b.hash) && !/*view*/ - ((_c = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _c.staged) - ); - attr(main, "class", "tree-item nav-file svelte-1wbh8tp"); - }, - m(target, anchor) { - insert(target, main, anchor); - append2(main, div6); - append2(div6, div0); - append2(div0, t0); - append2(div6, t1); - append2(div6, div5); - append2(div5, div3); - if (if_block) if_block.m(div3, null); - append2(div3, t2); - append2(div3, div1); - ctx[12](div1); - append2(div3, t3); - append2(div3, div2); - ctx[13](div2); - append2(div5, t4); - append2(div5, div4); - append2(div4, t5); - if (!mounted) { - dispose = [ - listen(div1, "click", stop_propagation( - /*discard*/ - ctx[8] - )), - listen(div2, "click", stop_propagation( - /*stage*/ - ctx[6] - )), - listen( - main, - "mouseover", - /*hover*/ - ctx[4] - ), - listen(main, "click", stop_propagation( - /*showDiff*/ - ctx[7] - )), - listen(main, "auxclick", stop_propagation( - /*auxclick_handler*/ - ctx[14] - )), - listen( - main, - "focus", - /*focus_handler*/ - ctx[10] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - var _a2, _b, _c; - if (dirty & /*change*/ - 1 && t0_value !== (t0_value = getDisplayPath( - /*change*/ - ctx2[0].vault_path - ) + "")) set_data(t0, t0_value); - if (dirty & /*view, change*/ - 3) show_if = /*view*/ - ctx2[1].app.vault.getAbstractFileByPath( - /*change*/ - ctx2[0].vault_path - ); - if (show_if) { - if (if_block) { - if_block.p(ctx2, dirty); - } else { - if_block = create_if_block5(ctx2); - if_block.c(); - if_block.m(div3, t2); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } - if (dirty & /*change*/ - 1 && t5_value !== (t5_value = /*change*/ - ctx2[0].working_dir + "")) set_data(t5, t5_value); - if (dirty & /*change*/ - 1 && div4_data_type_value !== (div4_data_type_value = /*change*/ - ctx2[0].working_dir)) { - attr(div4, "data-type", div4_data_type_value); - } - if (dirty & /*change*/ - 1 && div6_data_path_value !== (div6_data_path_value = /*change*/ - ctx2[0].vault_path)) { - attr(div6, "data-path", div6_data_path_value); - } - if (dirty & /*side*/ - 8) { - attr( - div6, - "data-tooltip-position", - /*side*/ - ctx2[3] - ); - } - if (dirty & /*change*/ - 1 && div6_aria_label_value !== (div6_aria_label_value = /*change*/ - ctx2[0].vault_path)) { - attr(div6, "aria-label", div6_aria_label_value); - } - if (dirty & /*view, change*/ - 3) { - toggle_class( - div6, - "is-active", - /*view*/ - ((_a2 = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _a2.file) == /*change*/ - ctx2[0].vault_path && !/*view*/ - ((_b = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _b.hash) && !/*view*/ - ((_c = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _c.staged) - ); - } - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(main); - } - if (if_block) if_block.d(); - ctx[12](null); - ctx[13](null); - mounted = false; - run_all(dispose); - } - }; -} -function instance5($$self, $$props, $$invalidate) { - let side; - let { change } = $$props; - let { view } = $$props; - let { manager } = $$props; - let buttons = []; - window.setTimeout(() => buttons.forEach((b) => (0, import_obsidian26.setIcon)(b, b.getAttr("data-icon"))), 0); - function hover(event) { - if (app.vault.getAbstractFileByPath(change.vault_path)) { - hoverPreview(event, view, change.vault_path); - } - } - function open(event) { - var _a2; - const file = view.app.vault.getAbstractFileByPath(change.vault_path); - if (file instanceof import_obsidian26.TFile) { - (_a2 = getNewLeaf(event)) === null || _a2 === void 0 ? void 0 : _a2.openFile(file); - } - } - function stage() { - manager.stage(change.path, false).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - }); - } - function showDiff(event) { - var _a2; - (_a2 = getNewLeaf(event)) === null || _a2 === void 0 ? void 0 : _a2.setViewState({ - type: DIFF_VIEW_CONFIG.type, - active: true, - state: { file: change.path, staged: false } - }); - } - function discard() { - const deleteFile = change.working_dir == "U"; - new DiscardModal(view.app, deleteFile, change.vault_path).myOpen().then((shouldDiscard) => { - if (shouldDiscard === true) { - if (deleteFile) { - view.app.vault.adapter.remove(change.vault_path).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - }); - } else { - manager.discard(change.path).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - }); - } - } - }); - } - function focus_handler(event) { - bubble.call(this, $$self, event); - } - function div_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[1] = $$value; - $$invalidate(2, buttons); - }); - } - function div1_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[0] = $$value; - $$invalidate(2, buttons); - }); - } - function div2_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[2] = $$value; - $$invalidate(2, buttons); - }); - } - const auxclick_handler = (event) => mayTriggerFileMenu(view.app, event, change.vault_path, view.leaf, "git-source-control"); - $$self.$$set = ($$props2) => { - if ("change" in $$props2) $$invalidate(0, change = $$props2.change); - if ("view" in $$props2) $$invalidate(1, view = $$props2.view); - if ("manager" in $$props2) $$invalidate(9, manager = $$props2.manager); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*view*/ - 2) { - $: $$invalidate(3, side = view.leaf.getRoot().side == "left" ? "right" : "left"); - } - }; - return [ - change, - view, - buttons, - side, - hover, - open, - stage, - showDiff, - discard, - manager, - focus_handler, - div_binding, - div1_binding, - div2_binding, - auxclick_handler - ]; -} -var FileComponent = class extends SvelteComponent { - constructor(options) { - super(); - init2(this, options, instance5, create_fragment5, safe_not_equal, { change: 0, view: 1, manager: 9 }, add_css3); - } -}; -var fileComponent_default = FileComponent; - -// src/ui/sourceControl/components/pulledFileComponent.svelte -init_polyfill_buffer(); -var import_obsidian27 = require("obsidian"); -function add_css4(target) { - append_styles(target, "svelte-1wbh8tp", "main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}"); -} -function create_fragment6(ctx) { - let main; - let div2; - let div0; - let t0_value = getDisplayPath( - /*change*/ - ctx[0].vault_path - ) + ""; - let t0; - let t1; - let div1; - let span; - let t2_value = ( - /*change*/ - ctx[0].working_dir + "" - ); - let t2; - let span_data_type_value; - let div2_data_path_value; - let div2_aria_label_value; - let mounted; - let dispose; - return { - c() { - main = element("main"); - div2 = element("div"); - div0 = element("div"); - t0 = text(t0_value); - t1 = space(); - div1 = element("div"); - span = element("span"); - t2 = text(t2_value); - attr(div0, "class", "tree-item-inner nav-file-title-content"); - attr(span, "class", "type"); - attr(span, "data-type", span_data_type_value = /*change*/ - ctx[0].working_dir); - attr(div1, "class", "git-tools"); - attr(div2, "class", "tree-item-self is-clickable nav-file-title svelte-1wbh8tp"); - attr(div2, "data-path", div2_data_path_value = /*change*/ - ctx[0].vault_path); - attr( - div2, - "data-tooltip-position", - /*side*/ - ctx[2] - ); - attr(div2, "aria-label", div2_aria_label_value = /*change*/ - ctx[0].vault_path); - attr(main, "class", "tree-item nav-file svelte-1wbh8tp"); - }, - m(target, anchor) { - insert(target, main, anchor); - append2(main, div2); - append2(div2, div0); - append2(div0, t0); - append2(div2, t1); - append2(div2, div1); - append2(div1, span); - append2(span, t2); - if (!mounted) { - dispose = [ - listen( - main, - "mouseover", - /*hover*/ - ctx[3] - ), - listen(main, "click", stop_propagation( - /*open*/ - ctx[4] - )), - listen(main, "auxclick", stop_propagation( - /*auxclick_handler*/ - ctx[6] - )), - listen( - main, - "focus", - /*focus_handler*/ - ctx[5] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - if (dirty & /*change*/ - 1 && t0_value !== (t0_value = getDisplayPath( - /*change*/ - ctx2[0].vault_path - ) + "")) set_data(t0, t0_value); - if (dirty & /*change*/ - 1 && t2_value !== (t2_value = /*change*/ - ctx2[0].working_dir + "")) set_data(t2, t2_value); - if (dirty & /*change*/ - 1 && span_data_type_value !== (span_data_type_value = /*change*/ - ctx2[0].working_dir)) { - attr(span, "data-type", span_data_type_value); - } - if (dirty & /*change*/ - 1 && div2_data_path_value !== (div2_data_path_value = /*change*/ - ctx2[0].vault_path)) { - attr(div2, "data-path", div2_data_path_value); - } - if (dirty & /*side*/ - 4) { - attr( - div2, - "data-tooltip-position", - /*side*/ - ctx2[2] - ); - } - if (dirty & /*change*/ - 1 && div2_aria_label_value !== (div2_aria_label_value = /*change*/ - ctx2[0].vault_path)) { - attr(div2, "aria-label", div2_aria_label_value); - } - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(main); - } - mounted = false; - run_all(dispose); - } - }; -} -function instance6($$self, $$props, $$invalidate) { - let side; - let { change } = $$props; - let { view } = $$props; - function hover(event) { - if (app.vault.getAbstractFileByPath(change.vault_path)) { - hoverPreview(event, view, change.vault_path); - } - } - function open(event) { - var _a2; - const file = view.app.vault.getAbstractFileByPath(change.vault_path); - if (file instanceof import_obsidian27.TFile) { - (_a2 = getNewLeaf(event)) === null || _a2 === void 0 ? void 0 : _a2.openFile(file); - } - } - function focus_handler(event) { - bubble.call(this, $$self, event); - } - const auxclick_handler = (event) => mayTriggerFileMenu(view.app, event, change.vault_path, view.leaf, "git-source-control"); - $$self.$$set = ($$props2) => { - if ("change" in $$props2) $$invalidate(0, change = $$props2.change); - if ("view" in $$props2) $$invalidate(1, view = $$props2.view); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*view*/ - 2) { - $: $$invalidate(2, side = view.leaf.getRoot().side == "left" ? "right" : "left"); - } - }; - return [change, view, side, hover, open, focus_handler, auxclick_handler]; -} -var PulledFileComponent = class extends SvelteComponent { - constructor(options) { - super(); - init2(this, options, instance6, create_fragment6, safe_not_equal, { change: 0, view: 1 }, add_css4); - } -}; -var pulledFileComponent_default = PulledFileComponent; - -// src/ui/sourceControl/components/stagedFileComponent.svelte -init_polyfill_buffer(); -var import_obsidian28 = require("obsidian"); -function add_css5(target) { - append_styles(target, "svelte-1wbh8tp", "main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}"); -} -function create_if_block6(ctx) { - let div; - let mounted; - let dispose; - return { - c() { - div = element("div"); - attr(div, "data-icon", "go-to-file"); - attr(div, "aria-label", "Open File"); - attr(div, "class", "clickable-icon"); - }, - m(target, anchor) { - insert(target, div, anchor); - ctx[10](div); - if (!mounted) { - dispose = listen(div, "click", stop_propagation( - /*open*/ - ctx[5] - )); - mounted = true; - } - }, - p: noop, - d(detaching) { - if (detaching) { - detach(div); - } - ctx[10](null); - mounted = false; - dispose(); - } - }; -} -function create_fragment7(ctx) { - let main; - let div5; - let div0; - let t0_value = getDisplayPath( - /*change*/ - ctx[0].vault_path - ) + ""; - let t0; - let t1; - let div4; - let div2; - let show_if = ( - /*view*/ - ctx[1].app.vault.getAbstractFileByPath( - /*change*/ - ctx[0].vault_path - ) - ); - let t2; - let div1; - let t3; - let div3; - let t4_value = ( - /*change*/ - ctx[0].index + "" - ); - let t4; - let div3_data_type_value; - let div5_data_path_value; - let div5_aria_label_value; - let mounted; - let dispose; - let if_block = show_if && create_if_block6(ctx); - return { - c() { - var _a2, _b, _c; - main = element("main"); - div5 = element("div"); - div0 = element("div"); - t0 = text(t0_value); - t1 = space(); - div4 = element("div"); - div2 = element("div"); - if (if_block) if_block.c(); - t2 = space(); - div1 = element("div"); - t3 = space(); - div3 = element("div"); - t4 = text(t4_value); - attr(div0, "class", "tree-item-inner nav-file-title-content"); - attr(div1, "data-icon", "minus"); - attr(div1, "aria-label", "Unstage"); - attr(div1, "class", "clickable-icon"); - attr(div2, "class", "buttons"); - attr(div3, "class", "type"); - attr(div3, "data-type", div3_data_type_value = /*change*/ - ctx[0].index); - attr(div4, "class", "git-tools"); - attr(div5, "class", "tree-item-self is-clickable nav-file-title svelte-1wbh8tp"); - attr(div5, "data-path", div5_data_path_value = /*change*/ - ctx[0].vault_path); - attr( - div5, - "data-tooltip-position", - /*side*/ - ctx[3] - ); - attr(div5, "aria-label", div5_aria_label_value = /*change*/ - ctx[0].vault_path); - toggle_class( - div5, - "is-active", - /*view*/ - ((_a2 = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _a2.file) == /*change*/ - ctx[0].vault_path && !/*view*/ - ((_b = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _b.hash) && /*view*/ - ((_c = ctx[1].plugin.lastDiffViewState) == null ? void 0 : _c.staged) - ); - attr(main, "class", "tree-item nav-file svelte-1wbh8tp"); - }, - m(target, anchor) { - insert(target, main, anchor); - append2(main, div5); - append2(div5, div0); - append2(div0, t0); - append2(div5, t1); - append2(div5, div4); - append2(div4, div2); - if (if_block) if_block.m(div2, null); - append2(div2, t2); - append2(div2, div1); - ctx[11](div1); - append2(div4, t3); - append2(div4, div3); - append2(div3, t4); - if (!mounted) { - dispose = [ - listen(div1, "click", stop_propagation( - /*unstage*/ - ctx[7] - )), - listen( - main, - "mouseover", - /*hover*/ - ctx[4] - ), - listen( - main, - "focus", - /*focus_handler*/ - ctx[9] - ), - listen(main, "click", stop_propagation( - /*showDiff*/ - ctx[6] - )), - listen(main, "auxclick", stop_propagation( - /*auxclick_handler*/ - ctx[12] - )) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - var _a2, _b, _c; - if (dirty & /*change*/ - 1 && t0_value !== (t0_value = getDisplayPath( - /*change*/ - ctx2[0].vault_path - ) + "")) set_data(t0, t0_value); - if (dirty & /*view, change*/ - 3) show_if = /*view*/ - ctx2[1].app.vault.getAbstractFileByPath( - /*change*/ - ctx2[0].vault_path - ); - if (show_if) { - if (if_block) { - if_block.p(ctx2, dirty); - } else { - if_block = create_if_block6(ctx2); - if_block.c(); - if_block.m(div2, t2); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } - if (dirty & /*change*/ - 1 && t4_value !== (t4_value = /*change*/ - ctx2[0].index + "")) set_data(t4, t4_value); - if (dirty & /*change*/ - 1 && div3_data_type_value !== (div3_data_type_value = /*change*/ - ctx2[0].index)) { - attr(div3, "data-type", div3_data_type_value); - } - if (dirty & /*change*/ - 1 && div5_data_path_value !== (div5_data_path_value = /*change*/ - ctx2[0].vault_path)) { - attr(div5, "data-path", div5_data_path_value); - } - if (dirty & /*side*/ - 8) { - attr( - div5, - "data-tooltip-position", - /*side*/ - ctx2[3] - ); - } - if (dirty & /*change*/ - 1 && div5_aria_label_value !== (div5_aria_label_value = /*change*/ - ctx2[0].vault_path)) { - attr(div5, "aria-label", div5_aria_label_value); - } - if (dirty & /*view, change*/ - 3) { - toggle_class( - div5, - "is-active", - /*view*/ - ((_a2 = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _a2.file) == /*change*/ - ctx2[0].vault_path && !/*view*/ - ((_b = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _b.hash) && /*view*/ - ((_c = ctx2[1].plugin.lastDiffViewState) == null ? void 0 : _c.staged) - ); - } - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(main); - } - if (if_block) if_block.d(); - ctx[11](null); - mounted = false; - run_all(dispose); - } - }; -} -function instance7($$self, $$props, $$invalidate) { - let side; - let { change } = $$props; - let { view } = $$props; - let { manager } = $$props; - let buttons = []; - window.setTimeout(() => buttons.forEach((b) => (0, import_obsidian28.setIcon)(b, b.getAttr("data-icon"))), 0); - function hover(event) { - if (app.vault.getAbstractFileByPath(change.vault_path)) { - hoverPreview(event, view, change.vault_path); - } - } - function open(event) { - var _a2; - const file = view.app.vault.getAbstractFileByPath(change.vault_path); - if (file instanceof import_obsidian28.TFile) { - (_a2 = getNewLeaf(event)) === null || _a2 === void 0 ? void 0 : _a2.openFile(file); - } - } - function showDiff(event) { - var _a2; - (_a2 = getNewLeaf(event)) === null || _a2 === void 0 ? void 0 : _a2.setViewState({ - type: DIFF_VIEW_CONFIG.type, - active: true, - state: { file: change.path, staged: true } - }); - } - function unstage() { - manager.unstage(change.path, false).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - }); - } - function focus_handler(event) { - bubble.call(this, $$self, event); - } - function div_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[1] = $$value; - $$invalidate(2, buttons); - }); - } - function div1_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[0] = $$value; - $$invalidate(2, buttons); - }); - } - const auxclick_handler = (event) => mayTriggerFileMenu(view.app, event, change.vault_path, view.leaf, "git-source-control"); - $$self.$$set = ($$props2) => { - if ("change" in $$props2) $$invalidate(0, change = $$props2.change); - if ("view" in $$props2) $$invalidate(1, view = $$props2.view); - if ("manager" in $$props2) $$invalidate(8, manager = $$props2.manager); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*view*/ - 2) { - $: $$invalidate(3, side = view.leaf.getRoot().side == "left" ? "right" : "left"); - } - }; - return [ - change, - view, - buttons, - side, - hover, - open, - showDiff, - unstage, - manager, - focus_handler, - div_binding, - div1_binding, - auxclick_handler - ]; -} -var StagedFileComponent = class extends SvelteComponent { - constructor(options) { - super(); - init2(this, options, instance7, create_fragment7, safe_not_equal, { change: 0, view: 1, manager: 8 }, add_css5); - } -}; -var stagedFileComponent_default = StagedFileComponent; - -// src/ui/sourceControl/components/treeComponent.svelte -init_polyfill_buffer(); -function add_css6(target) { - append_styles(target, "svelte-hup5mn", "main.svelte-hup5mn .nav-folder-title.svelte-hup5mn{align-items:center}"); -} -function get_each_context4(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[16] = list[i]; - return child_ctx; -} -function create_else_block3(ctx) { - let div7; - let div6; - let div0; - let t0; - let div1; - let t1; - let div2; - let t2_value = ( - /*entity*/ - ctx[16].title + "" - ); - let t2; - let t3; - let div5; - let div4; - let t4; - let div3; - let div6_aria_label_value; - let t5; - let t6; - let current; - let mounted; - let dispose; - function select_block_type_2(ctx2, dirty) { - if ( - /*fileType*/ - ctx2[3] == 0 /* staged */ - ) return create_if_block_5; - return create_else_block_1; - } - let current_block_type = select_block_type_2(ctx, -1); - let if_block0 = current_block_type(ctx); - let if_block1 = !/*closed*/ - ctx[5][ - /*entity*/ - ctx[16].title - ] && create_if_block_42(ctx); - function click_handler_3() { - return ( - /*click_handler_3*/ - ctx[14]( - /*entity*/ - ctx[16] - ) - ); - } - function auxclick_handler(...args) { - return ( - /*auxclick_handler*/ - ctx[15]( - /*entity*/ - ctx[16], - ...args - ) - ); - } - return { - c() { - div7 = element("div"); - div6 = element("div"); - div0 = element("div"); - t0 = space(); - div1 = element("div"); - div1.innerHTML = ``; - t1 = space(); - div2 = element("div"); - t2 = text(t2_value); - t3 = space(); - div5 = element("div"); - div4 = element("div"); - if_block0.c(); - t4 = space(); - div3 = element("div"); - t5 = space(); - if (if_block1) if_block1.c(); - t6 = space(); - attr(div0, "data-icon", "folder"); - set_style(div0, "padding-right", "5px"); - set_style(div0, "display", "flex"); - attr(div1, "class", "tree-item-icon nav-folder-collapse-indicator collapse-icon"); - toggle_class( - div1, - "is-collapsed", - /*closed*/ - ctx[5][ - /*entity*/ - ctx[16].title - ] - ); - attr(div2, "class", "tree-item-inner nav-folder-title-content"); - set_style(div3, "width", "11px"); - attr(div4, "class", "buttons"); - attr(div5, "class", "git-tools"); - attr(div6, "class", "tree-item-self is-clickable nav-folder-title svelte-hup5mn"); - attr( - div6, - "data-tooltip-position", - /*side*/ - ctx[6] - ); - attr(div6, "aria-label", div6_aria_label_value = /*entity*/ - ctx[16].vaultPath); - attr(div7, "class", "tree-item nav-folder"); - toggle_class( - div7, - "is-collapsed", - /*closed*/ - ctx[5][ - /*entity*/ - ctx[16].title - ] - ); - }, - m(target, anchor) { - insert(target, div7, anchor); - append2(div7, div6); - append2(div6, div0); - append2(div6, t0); - append2(div6, div1); - append2(div6, t1); - append2(div6, div2); - append2(div2, t2); - append2(div6, t3); - append2(div6, div5); - append2(div5, div4); - if_block0.m(div4, null); - append2(div4, t4); - append2(div4, div3); - append2(div7, t5); - if (if_block1) if_block1.m(div7, null); - append2(div7, t6); - current = true; - if (!mounted) { - dispose = [ - listen(div7, "click", stop_propagation(click_handler_3)), - listen(div7, "auxclick", stop_propagation(auxclick_handler)) - ]; - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - if (!current || dirty & /*closed, hierarchy*/ - 33) { - toggle_class( - div1, - "is-collapsed", - /*closed*/ - ctx[5][ - /*entity*/ - ctx[16].title - ] - ); - } - if ((!current || dirty & /*hierarchy*/ - 1) && t2_value !== (t2_value = /*entity*/ - ctx[16].title + "")) set_data(t2, t2_value); - if (current_block_type === (current_block_type = select_block_type_2(ctx, dirty)) && if_block0) { - if_block0.p(ctx, dirty); - } else { - if_block0.d(1); - if_block0 = current_block_type(ctx); - if (if_block0) { - if_block0.c(); - if_block0.m(div4, t4); - } - } - if (!current || dirty & /*side*/ - 64) { - attr( - div6, - "data-tooltip-position", - /*side*/ - ctx[6] - ); - } - if (!current || dirty & /*hierarchy*/ - 1 && div6_aria_label_value !== (div6_aria_label_value = /*entity*/ - ctx[16].vaultPath)) { - attr(div6, "aria-label", div6_aria_label_value); - } - if (!/*closed*/ - ctx[5][ - /*entity*/ - ctx[16].title - ]) { - if (if_block1) { - if_block1.p(ctx, dirty); - if (dirty & /*closed, hierarchy*/ - 33) { - transition_in(if_block1, 1); - } - } else { - if_block1 = create_if_block_42(ctx); - if_block1.c(); - transition_in(if_block1, 1); - if_block1.m(div7, t6); - } - } else if (if_block1) { - group_outros(); - transition_out(if_block1, 1, 1, () => { - if_block1 = null; - }); - check_outros(); - } - if (!current || dirty & /*closed, hierarchy*/ - 33) { - toggle_class( - div7, - "is-collapsed", - /*closed*/ - ctx[5][ - /*entity*/ - ctx[16].title - ] - ); - } - }, - i(local) { - if (current) return; - transition_in(if_block1); - current = true; - }, - o(local) { - transition_out(if_block1); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div7); - } - if_block0.d(); - if (if_block1) if_block1.d(); - mounted = false; - run_all(dispose); - } - }; -} -function create_if_block7(ctx) { - let div; - let current_block_type_index; - let if_block; - let t; - let current; - const if_block_creators = [create_if_block_13, create_if_block_22, create_if_block_32]; - const if_blocks = []; - function select_block_type_1(ctx2, dirty) { - if ( - /*fileType*/ - ctx2[3] == 0 /* staged */ - ) return 0; - if ( - /*fileType*/ - ctx2[3] == 1 /* changed */ - ) return 1; - if ( - /*fileType*/ - ctx2[3] == 2 /* pulled */ - ) return 2; - return -1; - } - if (~(current_block_type_index = select_block_type_1(ctx, -1))) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - } - return { - c() { - div = element("div"); - if (if_block) if_block.c(); - t = space(); - }, - m(target, anchor) { - insert(target, div, anchor); - if (~current_block_type_index) { - if_blocks[current_block_type_index].m(div, null); - } - append2(div, t); - current = true; - }, - p(ctx2, dirty) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type_1(ctx2, dirty); - if (current_block_type_index === previous_block_index) { - if (~current_block_type_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } - } else { - if (if_block) { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - } - if (~current_block_type_index) { - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(div, t); - } else { - if_block = null; - } - } - }, - i(local) { - if (current) return; - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - if (~current_block_type_index) { - if_blocks[current_block_type_index].d(); - } - } - }; -} -function create_else_block_1(ctx) { - let div0; - let t; - let div1; - let mounted; - let dispose; - function click_handler_1() { - return ( - /*click_handler_1*/ - ctx[12]( - /*entity*/ - ctx[16] - ) - ); - } - function click_handler_2() { - return ( - /*click_handler_2*/ - ctx[13]( - /*entity*/ - ctx[16] - ) - ); - } - return { - c() { - div0 = element("div"); - div0.innerHTML = ``; - t = space(); - div1 = element("div"); - div1.innerHTML = ``; - attr(div0, "data-icon", "undo"); - attr(div0, "aria-label", "Discard"); - attr(div0, "class", "clickable-icon"); - attr(div1, "data-icon", "plus"); - attr(div1, "aria-label", "Stage"); - attr(div1, "class", "clickable-icon"); - }, - m(target, anchor) { - insert(target, div0, anchor); - insert(target, t, anchor); - insert(target, div1, anchor); - if (!mounted) { - dispose = [ - listen(div0, "click", stop_propagation(click_handler_1)), - listen(div1, "click", stop_propagation(click_handler_2)) - ]; - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - }, - d(detaching) { - if (detaching) { - detach(div0); - detach(t); - detach(div1); - } - mounted = false; - run_all(dispose); - } - }; -} -function create_if_block_5(ctx) { - let div; - let mounted; - let dispose; - function click_handler() { - return ( - /*click_handler*/ - ctx[11]( - /*entity*/ - ctx[16] - ) - ); - } - return { - c() { - div = element("div"); - div.innerHTML = ``; - attr(div, "data-icon", "minus"); - attr(div, "aria-label", "Unstage"); - attr(div, "class", "clickable-icon"); - }, - m(target, anchor) { - insert(target, div, anchor); - if (!mounted) { - dispose = listen(div, "click", stop_propagation(click_handler)); - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - }, - d(detaching) { - if (detaching) { - detach(div); - } - mounted = false; - dispose(); - } - }; -} -function create_if_block_42(ctx) { - let div; - let treecomponent; - let div_transition; - let current; - treecomponent = new TreeComponent({ - props: { - hierarchy: ( - /*entity*/ - ctx[16] - ), - plugin: ( - /*plugin*/ - ctx[1] - ), - view: ( - /*view*/ - ctx[2] - ), - fileType: ( - /*fileType*/ - ctx[3] - ) - } - }); - return { - c() { - div = element("div"); - create_component(treecomponent.$$.fragment); - attr(div, "class", "tree-item-children nav-folder-children"); - }, - m(target, anchor) { - insert(target, div, anchor); - mount_component(treecomponent, div, null); - current = true; - }, - p(ctx2, dirty) { - const treecomponent_changes = {}; - if (dirty & /*hierarchy*/ - 1) treecomponent_changes.hierarchy = /*entity*/ - ctx2[16]; - if (dirty & /*plugin*/ - 2) treecomponent_changes.plugin = /*plugin*/ - ctx2[1]; - if (dirty & /*view*/ - 4) treecomponent_changes.view = /*view*/ - ctx2[2]; - if (dirty & /*fileType*/ - 8) treecomponent_changes.fileType = /*fileType*/ - ctx2[3]; - treecomponent.$set(treecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(treecomponent.$$.fragment, local); - if (local) { - add_render_callback(() => { - if (!current) return; - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true); - div_transition.run(1); - }); - } - current = true; - }, - o(local) { - transition_out(treecomponent.$$.fragment, local); - if (local) { - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false); - div_transition.run(0); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - destroy_component(treecomponent); - if (detaching && div_transition) div_transition.end(); - } - }; -} -function create_if_block_32(ctx) { - let pulledfilecomponent; - let current; - pulledfilecomponent = new pulledFileComponent_default({ - props: { - change: ( - /*entity*/ - ctx[16].data - ), - view: ( - /*view*/ - ctx[2] - ) - } - }); - return { - c() { - create_component(pulledfilecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(pulledfilecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const pulledfilecomponent_changes = {}; - if (dirty & /*hierarchy*/ - 1) pulledfilecomponent_changes.change = /*entity*/ - ctx2[16].data; - if (dirty & /*view*/ - 4) pulledfilecomponent_changes.view = /*view*/ - ctx2[2]; - pulledfilecomponent.$set(pulledfilecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(pulledfilecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(pulledfilecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(pulledfilecomponent, detaching); - } - }; -} -function create_if_block_22(ctx) { - let filecomponent; - let current; - filecomponent = new fileComponent_default({ - props: { - change: ( - /*entity*/ - ctx[16].data - ), - manager: ( - /*plugin*/ - ctx[1].gitManager - ), - view: ( - /*view*/ - ctx[2] - ) - } - }); - return { - c() { - create_component(filecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(filecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const filecomponent_changes = {}; - if (dirty & /*hierarchy*/ - 1) filecomponent_changes.change = /*entity*/ - ctx2[16].data; - if (dirty & /*plugin*/ - 2) filecomponent_changes.manager = /*plugin*/ - ctx2[1].gitManager; - if (dirty & /*view*/ - 4) filecomponent_changes.view = /*view*/ - ctx2[2]; - filecomponent.$set(filecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(filecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(filecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(filecomponent, detaching); - } - }; -} -function create_if_block_13(ctx) { - let stagedfilecomponent; - let current; - stagedfilecomponent = new stagedFileComponent_default({ - props: { - change: ( - /*entity*/ - ctx[16].data - ), - manager: ( - /*plugin*/ - ctx[1].gitManager - ), - view: ( - /*view*/ - ctx[2] - ) - } - }); - return { - c() { - create_component(stagedfilecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(stagedfilecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const stagedfilecomponent_changes = {}; - if (dirty & /*hierarchy*/ - 1) stagedfilecomponent_changes.change = /*entity*/ - ctx2[16].data; - if (dirty & /*plugin*/ - 2) stagedfilecomponent_changes.manager = /*plugin*/ - ctx2[1].gitManager; - if (dirty & /*view*/ - 4) stagedfilecomponent_changes.view = /*view*/ - ctx2[2]; - stagedfilecomponent.$set(stagedfilecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(stagedfilecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(stagedfilecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(stagedfilecomponent, detaching); - } - }; -} -function create_each_block4(ctx) { - let current_block_type_index; - let if_block; - let if_block_anchor; - let current; - const if_block_creators = [create_if_block7, create_else_block3]; - const if_blocks = []; - function select_block_type(ctx2, dirty) { - if ( - /*entity*/ - ctx2[16].data - ) return 0; - return 1; - } - current_block_type_index = select_block_type(ctx, -1); - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - return { - c() { - if_block.c(); - if_block_anchor = empty(); - }, - m(target, anchor) { - if_blocks[current_block_type_index].m(target, anchor); - insert(target, if_block_anchor, anchor); - current = true; - }, - p(ctx2, dirty) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type(ctx2, dirty); - if (current_block_type_index === previous_block_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } else { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(if_block_anchor); - } - if_blocks[current_block_type_index].d(detaching); - } - }; -} -function create_fragment8(ctx) { - let main; - let current; - let each_value = ensure_array_like( - /*hierarchy*/ - ctx[0].children - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block4(get_each_context4(ctx, each_value, i)); - } - const out = (i) => transition_out(each_blocks[i], 1, 1, () => { - each_blocks[i] = null; - }); - return { - c() { - main = element("main"); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - attr(main, "class", "svelte-hup5mn"); - toggle_class( - main, - "topLevel", - /*topLevel*/ - ctx[4] - ); - }, - m(target, anchor) { - insert(target, main, anchor); - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(main, null); - } - } - current = true; - }, - p(ctx2, [dirty]) { - if (dirty & /*hierarchy, plugin, view, fileType, closed, fold, side, unstage, stage, discard*/ - 2031) { - each_value = ensure_array_like( - /*hierarchy*/ - ctx2[0].children - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context4(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - transition_in(each_blocks[i], 1); - } else { - each_blocks[i] = create_each_block4(child_ctx); - each_blocks[i].c(); - transition_in(each_blocks[i], 1); - each_blocks[i].m(main, null); - } - } - group_outros(); - for (i = each_value.length; i < each_blocks.length; i += 1) { - out(i); - } - check_outros(); - } - if (!current || dirty & /*topLevel*/ - 16) { - toggle_class( - main, - "topLevel", - /*topLevel*/ - ctx2[4] - ); - } - }, - i(local) { - if (current) return; - for (let i = 0; i < each_value.length; i += 1) { - transition_in(each_blocks[i]); - } - current = true; - }, - o(local) { - each_blocks = each_blocks.filter(Boolean); - for (let i = 0; i < each_blocks.length; i += 1) { - transition_out(each_blocks[i]); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(main); - } - destroy_each(each_blocks, detaching); - } - }; -} -function instance8($$self, $$props, $$invalidate) { - let side; - let { hierarchy } = $$props; - let { plugin } = $$props; - let { view } = $$props; - let { fileType } = $$props; - let { topLevel = false } = $$props; - const closed = {}; - function stage(path2) { - plugin.gitManager.stageAll({ dir: path2 }).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - }); - } - function unstage(path2) { - plugin.gitManager.unstageAll({ dir: path2 }).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - }); - } - function discard(item) { - new DiscardModal(view.app, false, item.vaultPath).myOpen().then((shouldDiscard) => { - if (shouldDiscard === true) { - plugin.gitManager.discardAll({ - dir: item.path, - status: plugin.cachedStatus - }).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - }); - } - }); - } - function fold(item) { - $$invalidate(5, closed[item.title] = !closed[item.title], closed); - } - const click_handler = (entity) => unstage(entity.path); - const click_handler_1 = (entity) => discard(entity); - const click_handler_2 = (entity) => stage(entity.path); - const click_handler_3 = (entity) => fold(entity); - const auxclick_handler = (entity, event) => mayTriggerFileMenu(view.app, event, entity.vaultPath, view.leaf, "git-source-control"); - $$self.$$set = ($$props2) => { - if ("hierarchy" in $$props2) $$invalidate(0, hierarchy = $$props2.hierarchy); - if ("plugin" in $$props2) $$invalidate(1, plugin = $$props2.plugin); - if ("view" in $$props2) $$invalidate(2, view = $$props2.view); - if ("fileType" in $$props2) $$invalidate(3, fileType = $$props2.fileType); - if ("topLevel" in $$props2) $$invalidate(4, topLevel = $$props2.topLevel); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*view*/ - 4) { - $: $$invalidate(6, side = view.leaf.getRoot().side == "left" ? "right" : "left"); - } - }; - return [ - hierarchy, - plugin, - view, - fileType, - topLevel, - closed, - side, - stage, - unstage, - discard, - fold, - click_handler, - click_handler_1, - click_handler_2, - click_handler_3, - auxclick_handler - ]; -} -var TreeComponent = class extends SvelteComponent { - constructor(options) { - super(); - init2( - this, - options, - instance8, - create_fragment8, - safe_not_equal, - { - hierarchy: 0, - plugin: 1, - view: 2, - fileType: 3, - topLevel: 4 - }, - add_css6 - ); - } -}; -var treeComponent_default = TreeComponent; - -// src/ui/sourceControl/sourceControl.svelte -function add_css7(target) { - append_styles(target, "svelte-11adhly", `.commit-msg-input.svelte-11adhly.svelte-11adhly{width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field)}.git-commit-msg.svelte-11adhly.svelte-11adhly{position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto}main.svelte-11adhly .git-tools .files-count.svelte-11adhly{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}.nav-folder-title.svelte-11adhly.svelte-11adhly{align-items:center}.git-commit-msg-clear-button.svelte-11adhly.svelte-11adhly{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-11adhly.svelte-11adhly: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 get_each_context5(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[40] = list[i]; - return child_ctx; -} -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[40] = list[i]; - return child_ctx; -} -function get_each_context_2(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[45] = list[i]; - return child_ctx; -} -function create_if_block_8(ctx) { - let div; - let div_aria_label_value; - let mounted; - let dispose; - return { - c() { - div = element("div"); - attr(div, "class", "git-commit-msg-clear-button svelte-11adhly"); - attr(div, "aria-label", div_aria_label_value = "Clear"); - }, - m(target, anchor) { - insert(target, div, anchor); - if (!mounted) { - dispose = listen( - div, - "click", - /*click_handler_1*/ - ctx[33] - ); - mounted = true; - } - }, - p: noop, - d(detaching) { - if (detaching) { - detach(div); - } - mounted = false; - dispose(); - } - }; -} -function create_if_block8(ctx) { - let div18; - let div17; - let div7; - let div6; - let div0; - let t0; - let div1; - let t2; - let div5; - let div3; - let div2; - let t3; - let div4; - let t4_value = ( - /*status*/ - ctx[6].staged.length + "" - ); - let t4; - let t5; - let t6; - let div16; - let div15; - let div8; - let t7; - let div9; - let t9; - let div14; - let div12; - let div10; - let t10; - let div11; - let t11; - let div13; - let t12_value = ( - /*status*/ - ctx[6].changed.length + "" - ); - let t12; - let t13; - let t14; - let current; - let mounted; - let dispose; - let if_block0 = ( - /*stagedOpen*/ - ctx[13] && create_if_block_6(ctx) - ); - let if_block1 = ( - /*changesOpen*/ - ctx[12] && create_if_block_43(ctx) - ); - let if_block2 = ( - /*lastPulledFiles*/ - ctx[7].length > 0 && create_if_block_14(ctx) - ); - return { - c() { - div18 = element("div"); - div17 = element("div"); - div7 = element("div"); - div6 = element("div"); - div0 = element("div"); - div0.innerHTML = ``; - t0 = space(); - div1 = element("div"); - div1.textContent = "Staged Changes"; - t2 = space(); - div5 = element("div"); - div3 = element("div"); - div2 = element("div"); - div2.innerHTML = ``; - t3 = space(); - div4 = element("div"); - t4 = text(t4_value); - t5 = space(); - if (if_block0) if_block0.c(); - t6 = space(); - div16 = element("div"); - div15 = element("div"); - div8 = element("div"); - div8.innerHTML = ``; - t7 = space(); - div9 = element("div"); - div9.textContent = "Changes"; - t9 = space(); - div14 = element("div"); - div12 = element("div"); - div10 = element("div"); - div10.innerHTML = ``; - t10 = space(); - div11 = element("div"); - div11.innerHTML = ``; - t11 = space(); - div13 = element("div"); - t12 = text(t12_value); - t13 = space(); - if (if_block1) if_block1.c(); - t14 = space(); - if (if_block2) if_block2.c(); - attr(div0, "class", "tree-item-icon nav-folder-collapse-indicator collapse-icon"); - toggle_class(div0, "is-collapsed", !/*stagedOpen*/ - ctx[13]); - attr(div1, "class", "tree-item-inner nav-folder-title-content"); - attr(div2, "data-icon", "minus"); - attr(div2, "aria-label", "Unstage"); - attr(div2, "class", "clickable-icon"); - attr(div3, "class", "buttons"); - attr(div4, "class", "files-count svelte-11adhly"); - attr(div5, "class", "git-tools"); - attr(div6, "class", "tree-item-self is-clickable nav-folder-title svelte-11adhly"); - attr(div7, "class", "staged tree-item nav-folder"); - toggle_class(div7, "is-collapsed", !/*stagedOpen*/ - ctx[13]); - attr(div8, "class", "tree-item-icon nav-folder-collapse-indicator collapse-icon"); - toggle_class(div8, "is-collapsed", !/*changesOpen*/ - ctx[12]); - attr(div9, "class", "tree-item-inner nav-folder-title-content"); - attr(div10, "data-icon", "undo"); - attr(div10, "aria-label", "Discard"); - attr(div10, "class", "clickable-icon"); - attr(div11, "data-icon", "plus"); - attr(div11, "aria-label", "Stage"); - attr(div11, "class", "clickable-icon"); - attr(div12, "class", "buttons"); - attr(div13, "class", "files-count svelte-11adhly"); - attr(div14, "class", "git-tools"); - attr(div15, "class", "tree-item-self is-clickable nav-folder-title svelte-11adhly"); - attr(div16, "class", "changes tree-item nav-folder"); - toggle_class(div16, "is-collapsed", !/*changesOpen*/ - ctx[12]); - attr(div17, "class", "tree-item-children nav-folder-children"); - attr(div18, "class", "tree-item nav-folder mod-root"); - }, - m(target, anchor) { - insert(target, div18, anchor); - append2(div18, div17); - append2(div17, div7); - append2(div7, div6); - append2(div6, div0); - append2(div6, t0); - append2(div6, div1); - append2(div6, t2); - append2(div6, div5); - append2(div5, div3); - append2(div3, div2); - ctx[34](div2); - append2(div5, t3); - append2(div5, div4); - append2(div4, t4); - append2(div7, t5); - if (if_block0) if_block0.m(div7, null); - append2(div17, t6); - append2(div17, div16); - append2(div16, div15); - append2(div15, div8); - append2(div15, t7); - append2(div15, div9); - append2(div15, t9); - append2(div15, div14); - append2(div14, div12); - append2(div12, div10); - append2(div12, t10); - append2(div12, div11); - ctx[36](div11); - append2(div14, t11); - append2(div14, div13); - append2(div13, t12); - append2(div16, t13); - if (if_block1) if_block1.m(div16, null); - append2(div17, t14); - if (if_block2) if_block2.m(div17, null); - current = true; - if (!mounted) { - dispose = [ - listen(div2, "click", stop_propagation( - /*unstageAll*/ - ctx[19] - )), - listen( - div6, - "click", - /*click_handler_2*/ - ctx[35] - ), - listen(div10, "click", stop_propagation( - /*discard*/ - ctx[22] - )), - listen(div11, "click", stop_propagation( - /*stageAll*/ - ctx[18] - )), - listen( - div15, - "click", - /*click_handler_3*/ - ctx[37] - ) - ]; - mounted = true; - } - }, - p(ctx2, dirty) { - if (!current || dirty[0] & /*stagedOpen*/ - 8192) { - toggle_class(div0, "is-collapsed", !/*stagedOpen*/ - ctx2[13]); - } - if ((!current || dirty[0] & /*status*/ - 64) && t4_value !== (t4_value = /*status*/ - ctx2[6].staged.length + "")) set_data(t4, t4_value); - if ( - /*stagedOpen*/ - ctx2[13] - ) { - if (if_block0) { - if_block0.p(ctx2, dirty); - if (dirty[0] & /*stagedOpen*/ - 8192) { - transition_in(if_block0, 1); - } - } else { - if_block0 = create_if_block_6(ctx2); - if_block0.c(); - transition_in(if_block0, 1); - if_block0.m(div7, null); - } - } else if (if_block0) { - group_outros(); - transition_out(if_block0, 1, 1, () => { - if_block0 = null; - }); - check_outros(); - } - if (!current || dirty[0] & /*stagedOpen*/ - 8192) { - toggle_class(div7, "is-collapsed", !/*stagedOpen*/ - ctx2[13]); - } - if (!current || dirty[0] & /*changesOpen*/ - 4096) { - toggle_class(div8, "is-collapsed", !/*changesOpen*/ - ctx2[12]); - } - if ((!current || dirty[0] & /*status*/ - 64) && t12_value !== (t12_value = /*status*/ - ctx2[6].changed.length + "")) set_data(t12, t12_value); - if ( - /*changesOpen*/ - ctx2[12] - ) { - if (if_block1) { - if_block1.p(ctx2, dirty); - if (dirty[0] & /*changesOpen*/ - 4096) { - transition_in(if_block1, 1); - } - } else { - if_block1 = create_if_block_43(ctx2); - if_block1.c(); - transition_in(if_block1, 1); - if_block1.m(div16, null); - } - } else if (if_block1) { - group_outros(); - transition_out(if_block1, 1, 1, () => { - if_block1 = null; - }); - check_outros(); - } - if (!current || dirty[0] & /*changesOpen*/ - 4096) { - toggle_class(div16, "is-collapsed", !/*changesOpen*/ - ctx2[12]); - } - if ( - /*lastPulledFiles*/ - ctx2[7].length > 0 - ) { - if (if_block2) { - if_block2.p(ctx2, dirty); - if (dirty[0] & /*lastPulledFiles*/ - 128) { - transition_in(if_block2, 1); - } - } else { - if_block2 = create_if_block_14(ctx2); - if_block2.c(); - transition_in(if_block2, 1); - if_block2.m(div17, null); - } - } else if (if_block2) { - group_outros(); - transition_out(if_block2, 1, 1, () => { - if_block2 = null; - }); - check_outros(); - } - }, - i(local) { - if (current) return; - transition_in(if_block0); - transition_in(if_block1); - transition_in(if_block2); - current = true; - }, - o(local) { - transition_out(if_block0); - transition_out(if_block1); - transition_out(if_block2); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div18); - } - ctx[34](null); - if (if_block0) if_block0.d(); - ctx[36](null); - if (if_block1) if_block1.d(); - if (if_block2) if_block2.d(); - mounted = false; - run_all(dispose); - } - }; -} -function create_if_block_6(ctx) { - let div; - let current_block_type_index; - let if_block; - let div_transition; - let current; - const if_block_creators = [create_if_block_7, create_else_block_2]; - const if_blocks = []; - function select_block_type(ctx2, dirty) { - if ( - /*showTree*/ - ctx2[3] - ) return 0; - return 1; - } - current_block_type_index = select_block_type(ctx, [-1, -1]); - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - return { - c() { - div = element("div"); - if_block.c(); - attr(div, "class", "tree-item-children nav-folder-children"); - }, - m(target, anchor) { - insert(target, div, anchor); - if_blocks[current_block_type_index].m(div, null); - current = true; - }, - p(ctx2, dirty) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type(ctx2, dirty); - if (current_block_type_index === previous_block_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } else { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(div, null); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - if (local) { - add_render_callback(() => { - if (!current) return; - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true); - div_transition.run(1); - }); - } - current = true; - }, - o(local) { - transition_out(if_block); - if (local) { - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false); - div_transition.run(0); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - if_blocks[current_block_type_index].d(); - if (detaching && div_transition) div_transition.end(); - } - }; -} -function create_else_block_2(ctx) { - let each_1_anchor; - let current; - let each_value_2 = ensure_array_like( - /*status*/ - ctx[6].staged - ); - let each_blocks = []; - for (let i = 0; i < each_value_2.length; i += 1) { - each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); - } - const out = (i) => transition_out(each_blocks[i], 1, 1, () => { - each_blocks[i] = null; - }); - return { - c() { - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - each_1_anchor = empty(); - }, - m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(target, anchor); - } - } - insert(target, each_1_anchor, anchor); - current = true; - }, - p(ctx2, dirty) { - if (dirty[0] & /*status, view, plugin*/ - 67) { - each_value_2 = ensure_array_like( - /*status*/ - ctx2[6].staged - ); - let i; - for (i = 0; i < each_value_2.length; i += 1) { - const child_ctx = get_each_context_2(ctx2, each_value_2, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - transition_in(each_blocks[i], 1); - } else { - each_blocks[i] = create_each_block_2(child_ctx); - each_blocks[i].c(); - transition_in(each_blocks[i], 1); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); - } - } - group_outros(); - for (i = each_value_2.length; i < each_blocks.length; i += 1) { - out(i); - } - check_outros(); - } - }, - i(local) { - if (current) return; - for (let i = 0; i < each_value_2.length; i += 1) { - transition_in(each_blocks[i]); - } - current = true; - }, - o(local) { - each_blocks = each_blocks.filter(Boolean); - for (let i = 0; i < each_blocks.length; i += 1) { - transition_out(each_blocks[i]); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(each_1_anchor); - } - destroy_each(each_blocks, detaching); - } - }; -} -function create_if_block_7(ctx) { - let treecomponent; - let current; - treecomponent = new treeComponent_default({ - props: { - hierarchy: ( - /*stagedHierarchy*/ - ctx[10] - ), - plugin: ( - /*plugin*/ - ctx[0] - ), - view: ( - /*view*/ - ctx[1] - ), - fileType: 0 /* staged */, - topLevel: true - } - }); - return { - c() { - create_component(treecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(treecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const treecomponent_changes = {}; - if (dirty[0] & /*stagedHierarchy*/ - 1024) treecomponent_changes.hierarchy = /*stagedHierarchy*/ - ctx2[10]; - if (dirty[0] & /*plugin*/ - 1) treecomponent_changes.plugin = /*plugin*/ - ctx2[0]; - if (dirty[0] & /*view*/ - 2) treecomponent_changes.view = /*view*/ - ctx2[1]; - treecomponent.$set(treecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(treecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(treecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(treecomponent, detaching); - } - }; -} -function create_each_block_2(ctx) { - let stagedfilecomponent; - let current; - stagedfilecomponent = new stagedFileComponent_default({ - props: { - change: ( - /*stagedFile*/ - ctx[45] - ), - view: ( - /*view*/ - ctx[1] - ), - manager: ( - /*plugin*/ - ctx[0].gitManager - ) - } - }); - return { - c() { - create_component(stagedfilecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(stagedfilecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const stagedfilecomponent_changes = {}; - if (dirty[0] & /*status*/ - 64) stagedfilecomponent_changes.change = /*stagedFile*/ - ctx2[45]; - if (dirty[0] & /*view*/ - 2) stagedfilecomponent_changes.view = /*view*/ - ctx2[1]; - if (dirty[0] & /*plugin*/ - 1) stagedfilecomponent_changes.manager = /*plugin*/ - ctx2[0].gitManager; - stagedfilecomponent.$set(stagedfilecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(stagedfilecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(stagedfilecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(stagedfilecomponent, detaching); - } - }; -} -function create_if_block_43(ctx) { - let div; - let current_block_type_index; - let if_block; - let div_transition; - let current; - const if_block_creators = [create_if_block_52, create_else_block_12]; - const if_blocks = []; - function select_block_type_1(ctx2, dirty) { - if ( - /*showTree*/ - ctx2[3] - ) return 0; - return 1; - } - current_block_type_index = select_block_type_1(ctx, [-1, -1]); - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - return { - c() { - div = element("div"); - if_block.c(); - attr(div, "class", "tree-item-children nav-folder-children"); - }, - m(target, anchor) { - insert(target, div, anchor); - if_blocks[current_block_type_index].m(div, null); - current = true; - }, - p(ctx2, dirty) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type_1(ctx2, dirty); - if (current_block_type_index === previous_block_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } else { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(div, null); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - if (local) { - add_render_callback(() => { - if (!current) return; - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true); - div_transition.run(1); - }); - } - current = true; - }, - o(local) { - transition_out(if_block); - if (local) { - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false); - div_transition.run(0); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - if_blocks[current_block_type_index].d(); - if (detaching && div_transition) div_transition.end(); - } - }; -} -function create_else_block_12(ctx) { - let each_1_anchor; - let current; - let each_value_1 = ensure_array_like( - /*status*/ - ctx[6].changed - ); - let each_blocks = []; - for (let i = 0; i < each_value_1.length; i += 1) { - each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); - } - const out = (i) => transition_out(each_blocks[i], 1, 1, () => { - each_blocks[i] = null; - }); - return { - c() { - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - each_1_anchor = empty(); - }, - m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(target, anchor); - } - } - insert(target, each_1_anchor, anchor); - current = true; - }, - p(ctx2, dirty) { - if (dirty[0] & /*status, view, plugin*/ - 67) { - each_value_1 = ensure_array_like( - /*status*/ - ctx2[6].changed - ); - let i; - for (i = 0; i < each_value_1.length; i += 1) { - const child_ctx = get_each_context_1(ctx2, each_value_1, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - transition_in(each_blocks[i], 1); - } else { - each_blocks[i] = create_each_block_1(child_ctx); - each_blocks[i].c(); - transition_in(each_blocks[i], 1); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); - } - } - group_outros(); - for (i = each_value_1.length; i < each_blocks.length; i += 1) { - out(i); - } - check_outros(); - } - }, - i(local) { - if (current) return; - for (let i = 0; i < each_value_1.length; i += 1) { - transition_in(each_blocks[i]); - } - current = true; - }, - o(local) { - each_blocks = each_blocks.filter(Boolean); - for (let i = 0; i < each_blocks.length; i += 1) { - transition_out(each_blocks[i]); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(each_1_anchor); - } - destroy_each(each_blocks, detaching); - } - }; -} -function create_if_block_52(ctx) { - let treecomponent; - let current; - treecomponent = new treeComponent_default({ - props: { - hierarchy: ( - /*changeHierarchy*/ - ctx[9] - ), - plugin: ( - /*plugin*/ - ctx[0] - ), - view: ( - /*view*/ - ctx[1] - ), - fileType: 1 /* changed */, - topLevel: true - } - }); - return { - c() { - create_component(treecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(treecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const treecomponent_changes = {}; - if (dirty[0] & /*changeHierarchy*/ - 512) treecomponent_changes.hierarchy = /*changeHierarchy*/ - ctx2[9]; - if (dirty[0] & /*plugin*/ - 1) treecomponent_changes.plugin = /*plugin*/ - ctx2[0]; - if (dirty[0] & /*view*/ - 2) treecomponent_changes.view = /*view*/ - ctx2[1]; - treecomponent.$set(treecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(treecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(treecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(treecomponent, detaching); - } - }; -} -function create_each_block_1(ctx) { - let filecomponent; - let current; - filecomponent = new fileComponent_default({ - props: { - change: ( - /*change*/ - ctx[40] - ), - view: ( - /*view*/ - ctx[1] - ), - manager: ( - /*plugin*/ - ctx[0].gitManager - ) - } - }); - filecomponent.$on("git-refresh", triggerRefresh2); - return { - c() { - create_component(filecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(filecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const filecomponent_changes = {}; - if (dirty[0] & /*status*/ - 64) filecomponent_changes.change = /*change*/ - ctx2[40]; - if (dirty[0] & /*view*/ - 2) filecomponent_changes.view = /*view*/ - ctx2[1]; - if (dirty[0] & /*plugin*/ - 1) filecomponent_changes.manager = /*plugin*/ - ctx2[0].gitManager; - filecomponent.$set(filecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(filecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(filecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(filecomponent, detaching); - } - }; -} -function create_if_block_14(ctx) { - let div3; - let div2; - let div0; - let t0; - let div1; - let t2; - let span; - let t3_value = ( - /*lastPulledFiles*/ - ctx[7].length + "" - ); - let t3; - let t4; - let current; - let mounted; - let dispose; - let if_block = ( - /*lastPulledFilesOpen*/ - ctx[14] && create_if_block_23(ctx) - ); - return { - c() { - div3 = element("div"); - div2 = element("div"); - div0 = element("div"); - div0.innerHTML = ``; - t0 = space(); - div1 = element("div"); - div1.textContent = "Recently Pulled Files"; - t2 = space(); - span = element("span"); - t3 = text(t3_value); - t4 = space(); - if (if_block) if_block.c(); - attr(div0, "class", "tree-item-icon nav-folder-collapse-indicator collapse-icon"); - attr(div1, "class", "tree-item-inner nav-folder-title-content"); - attr(span, "class", "tree-item-flair"); - attr(div2, "class", "tree-item-self is-clickable nav-folder-title svelte-11adhly"); - attr(div3, "class", "pulled nav-folder"); - toggle_class(div3, "is-collapsed", !/*lastPulledFilesOpen*/ - ctx[14]); - }, - m(target, anchor) { - insert(target, div3, anchor); - append2(div3, div2); - append2(div2, div0); - append2(div2, t0); - append2(div2, div1); - append2(div2, t2); - append2(div2, span); - append2(span, t3); - append2(div3, t4); - if (if_block) if_block.m(div3, null); - current = true; - if (!mounted) { - dispose = listen( - div2, - "click", - /*click_handler_4*/ - ctx[38] - ); - mounted = true; - } - }, - p(ctx2, dirty) { - if ((!current || dirty[0] & /*lastPulledFiles*/ - 128) && t3_value !== (t3_value = /*lastPulledFiles*/ - ctx2[7].length + "")) set_data(t3, t3_value); - if ( - /*lastPulledFilesOpen*/ - ctx2[14] - ) { - if (if_block) { - if_block.p(ctx2, dirty); - if (dirty[0] & /*lastPulledFilesOpen*/ - 16384) { - transition_in(if_block, 1); - } - } else { - if_block = create_if_block_23(ctx2); - if_block.c(); - transition_in(if_block, 1); - if_block.m(div3, null); - } - } else if (if_block) { - group_outros(); - transition_out(if_block, 1, 1, () => { - if_block = null; - }); - check_outros(); - } - if (!current || dirty[0] & /*lastPulledFilesOpen*/ - 16384) { - toggle_class(div3, "is-collapsed", !/*lastPulledFilesOpen*/ - ctx2[14]); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div3); - } - if (if_block) if_block.d(); - mounted = false; - dispose(); - } - }; -} -function create_if_block_23(ctx) { - let div; - let current_block_type_index; - let if_block; - let div_transition; - let current; - const if_block_creators = [create_if_block_33, create_else_block4]; - const if_blocks = []; - function select_block_type_2(ctx2, dirty) { - if ( - /*showTree*/ - ctx2[3] - ) return 0; - return 1; - } - current_block_type_index = select_block_type_2(ctx, [-1, -1]); - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - return { - c() { - div = element("div"); - if_block.c(); - attr(div, "class", "tree-item-children nav-folder-children"); - }, - m(target, anchor) { - insert(target, div, anchor); - if_blocks[current_block_type_index].m(div, null); - current = true; - }, - p(ctx2, dirty) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type_2(ctx2, dirty); - if (current_block_type_index === previous_block_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } else { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(div, null); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - if (local) { - add_render_callback(() => { - if (!current) return; - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, true); - div_transition.run(1); - }); - } - current = true; - }, - o(local) { - transition_out(if_block); - if (local) { - if (!div_transition) div_transition = create_bidirectional_transition(div, slide, { duration: 150 }, false); - div_transition.run(0); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - if_blocks[current_block_type_index].d(); - if (detaching && div_transition) div_transition.end(); - } - }; -} -function create_else_block4(ctx) { - let each_1_anchor; - let current; - let each_value = ensure_array_like( - /*lastPulledFiles*/ - ctx[7] - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block5(get_each_context5(ctx, each_value, i)); - } - const out = (i) => transition_out(each_blocks[i], 1, 1, () => { - each_blocks[i] = null; - }); - return { - c() { - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - each_1_anchor = empty(); - }, - m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(target, anchor); - } - } - insert(target, each_1_anchor, anchor); - current = true; - }, - p(ctx2, dirty) { - if (dirty[0] & /*lastPulledFiles, view*/ - 130) { - each_value = ensure_array_like( - /*lastPulledFiles*/ - ctx2[7] - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context5(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - transition_in(each_blocks[i], 1); - } else { - each_blocks[i] = create_each_block5(child_ctx); - each_blocks[i].c(); - transition_in(each_blocks[i], 1); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); - } - } - group_outros(); - for (i = each_value.length; i < each_blocks.length; i += 1) { - out(i); - } - check_outros(); - } - }, - i(local) { - if (current) return; - for (let i = 0; i < each_value.length; i += 1) { - transition_in(each_blocks[i]); - } - current = true; - }, - o(local) { - each_blocks = each_blocks.filter(Boolean); - for (let i = 0; i < each_blocks.length; i += 1) { - transition_out(each_blocks[i]); - } - current = false; - }, - d(detaching) { - if (detaching) { - detach(each_1_anchor); - } - destroy_each(each_blocks, detaching); - } - }; -} -function create_if_block_33(ctx) { - let treecomponent; - let current; - treecomponent = new treeComponent_default({ - props: { - hierarchy: ( - /*lastPulledFilesHierarchy*/ - ctx[11] - ), - plugin: ( - /*plugin*/ - ctx[0] - ), - view: ( - /*view*/ - ctx[1] - ), - fileType: 2 /* pulled */, - topLevel: true - } - }); - return { - c() { - create_component(treecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(treecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const treecomponent_changes = {}; - if (dirty[0] & /*lastPulledFilesHierarchy*/ - 2048) treecomponent_changes.hierarchy = /*lastPulledFilesHierarchy*/ - ctx2[11]; - if (dirty[0] & /*plugin*/ - 1) treecomponent_changes.plugin = /*plugin*/ - ctx2[0]; - if (dirty[0] & /*view*/ - 2) treecomponent_changes.view = /*view*/ - ctx2[1]; - treecomponent.$set(treecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(treecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(treecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(treecomponent, detaching); - } - }; -} -function create_each_block5(ctx) { - let pulledfilecomponent; - let current; - pulledfilecomponent = new pulledFileComponent_default({ - props: { - change: ( - /*change*/ - ctx[40] - ), - view: ( - /*view*/ - ctx[1] - ) - } - }); - pulledfilecomponent.$on("git-refresh", triggerRefresh2); - return { - c() { - create_component(pulledfilecomponent.$$.fragment); - }, - m(target, anchor) { - mount_component(pulledfilecomponent, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const pulledfilecomponent_changes = {}; - if (dirty[0] & /*lastPulledFiles*/ - 128) pulledfilecomponent_changes.change = /*change*/ - ctx2[40]; - if (dirty[0] & /*view*/ - 2) pulledfilecomponent_changes.view = /*view*/ - ctx2[1]; - pulledfilecomponent.$set(pulledfilecomponent_changes); - }, - i(local) { - if (current) return; - transition_in(pulledfilecomponent.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(pulledfilecomponent.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(pulledfilecomponent, detaching); - } - }; -} -function create_fragment9(ctx) { - let main; - let div9; - let div8; - let div0; - let t0; - let div1; - let t1; - let div2; - let t2; - let div3; - let t3; - let div4; - let t4; - let div5; - let t5; - let div6; - let t6; - let div7; - let t7; - let div10; - let textarea; - let t8; - let t9; - let div11; - let main_data_type_value; - let current; - let mounted; - let dispose; - let if_block0 = ( - /*commitMessage*/ - ctx[2] && create_if_block_8(ctx) - ); - let if_block1 = ( - /*status*/ - ctx[6] && /*stagedHierarchy*/ - ctx[10] && /*changeHierarchy*/ - ctx[9] && create_if_block8(ctx) - ); - return { - c() { - main = element("main"); - div9 = element("div"); - div8 = element("div"); - div0 = element("div"); - t0 = space(); - div1 = element("div"); - t1 = space(); - div2 = element("div"); - t2 = space(); - div3 = element("div"); - t3 = space(); - div4 = element("div"); - t4 = space(); - div5 = element("div"); - t5 = space(); - div6 = element("div"); - t6 = space(); - div7 = element("div"); - t7 = space(); - div10 = element("div"); - textarea = element("textarea"); - t8 = space(); - if (if_block0) if_block0.c(); - t9 = space(); - div11 = element("div"); - if (if_block1) if_block1.c(); - attr(div0, "id", "backup-btn"); - attr(div0, "data-icon", "arrow-up-circle"); - attr(div0, "class", "clickable-icon nav-action-button"); - attr(div0, "aria-label", "Backup"); - attr(div1, "id", "commit-btn"); - attr(div1, "data-icon", "check"); - attr(div1, "class", "clickable-icon nav-action-button"); - attr(div1, "aria-label", "Commit"); - attr(div2, "id", "stage-all"); - attr(div2, "class", "clickable-icon nav-action-button"); - attr(div2, "data-icon", "plus-circle"); - attr(div2, "aria-label", "Stage all"); - attr(div3, "id", "unstage-all"); - attr(div3, "class", "clickable-icon nav-action-button"); - attr(div3, "data-icon", "minus-circle"); - attr(div3, "aria-label", "Unstage all"); - attr(div4, "id", "push"); - attr(div4, "class", "clickable-icon nav-action-button"); - attr(div4, "data-icon", "upload"); - attr(div4, "aria-label", "Push"); - attr(div5, "id", "pull"); - attr(div5, "class", "clickable-icon nav-action-button"); - attr(div5, "data-icon", "download"); - attr(div5, "aria-label", "Pull"); - attr(div6, "id", "layoutChange"); - attr(div6, "class", "clickable-icon nav-action-button"); - attr(div6, "aria-label", "Change Layout"); - attr(div7, "id", "refresh"); - attr(div7, "class", "clickable-icon nav-action-button"); - attr(div7, "data-icon", "refresh-cw"); - attr(div7, "aria-label", "Refresh"); - set_style(div7, "margin", "1px"); - toggle_class( - div7, - "loading", - /*loading*/ - ctx[5] - ); - attr(div8, "class", "nav-buttons-container"); - attr(div9, "class", "nav-header"); - attr( - textarea, - "rows", - /*rows*/ - ctx[15] - ); - attr(textarea, "class", "commit-msg-input svelte-11adhly"); - attr(textarea, "spellcheck", "true"); - attr(textarea, "placeholder", "Commit Message"); - attr(div10, "class", "git-commit-msg svelte-11adhly"); - attr(div11, "class", "nav-files-container"); - set_style(div11, "position", "relative"); - attr(main, "data-type", main_data_type_value = SOURCE_CONTROL_VIEW_CONFIG.type); - attr(main, "class", "svelte-11adhly"); - }, - m(target, anchor) { - insert(target, main, anchor); - append2(main, div9); - append2(div9, div8); - append2(div8, div0); - ctx[23](div0); - append2(div8, t0); - append2(div8, div1); - ctx[24](div1); - append2(div8, t1); - append2(div8, div2); - ctx[25](div2); - append2(div8, t2); - append2(div8, div3); - ctx[26](div3); - append2(div8, t3); - append2(div8, div4); - ctx[27](div4); - append2(div8, t4); - append2(div8, div5); - ctx[28](div5); - append2(div8, t5); - append2(div8, div6); - ctx[29](div6); - append2(div8, t6); - append2(div8, div7); - ctx[31](div7); - append2(main, t7); - append2(main, div10); - append2(div10, textarea); - set_input_value( - textarea, - /*commitMessage*/ - ctx[2] - ); - append2(div10, t8); - if (if_block0) if_block0.m(div10, null); - append2(main, t9); - append2(main, div11); - if (if_block1) if_block1.m(div11, null); - current = true; - if (!mounted) { - dispose = [ - listen( - div0, - "click", - /*backup*/ - ctx[17] - ), - listen( - div1, - "click", - /*commit*/ - ctx[16] - ), - listen( - div2, - "click", - /*stageAll*/ - ctx[18] - ), - listen( - div3, - "click", - /*unstageAll*/ - ctx[19] - ), - listen( - div4, - "click", - /*push*/ - ctx[20] - ), - listen( - div5, - "click", - /*pull*/ - ctx[21] - ), - listen( - div6, - "click", - /*click_handler*/ - ctx[30] - ), - listen(div7, "click", triggerRefresh2), - listen( - textarea, - "input", - /*textarea_input_handler*/ - ctx[32] - ) - ]; - mounted = true; - } - }, - p(ctx2, dirty) { - if (!current || dirty[0] & /*loading*/ - 32) { - toggle_class( - div7, - "loading", - /*loading*/ - ctx2[5] - ); - } - if (!current || dirty[0] & /*rows*/ - 32768) { - attr( - textarea, - "rows", - /*rows*/ - ctx2[15] - ); - } - if (dirty[0] & /*commitMessage*/ - 4) { - set_input_value( - textarea, - /*commitMessage*/ - ctx2[2] - ); - } - if ( - /*commitMessage*/ - ctx2[2] - ) { - if (if_block0) { - if_block0.p(ctx2, dirty); - } else { - if_block0 = create_if_block_8(ctx2); - if_block0.c(); - if_block0.m(div10, null); - } - } else if (if_block0) { - if_block0.d(1); - if_block0 = null; - } - if ( - /*status*/ - ctx2[6] && /*stagedHierarchy*/ - ctx2[10] && /*changeHierarchy*/ - ctx2[9] - ) { - if (if_block1) { - if_block1.p(ctx2, dirty); - if (dirty[0] & /*status, stagedHierarchy, changeHierarchy*/ - 1600) { - transition_in(if_block1, 1); - } - } else { - if_block1 = create_if_block8(ctx2); - if_block1.c(); - transition_in(if_block1, 1); - if_block1.m(div11, null); - } - } else if (if_block1) { - group_outros(); - transition_out(if_block1, 1, 1, () => { - if_block1 = null; - }); - check_outros(); - } - }, - i(local) { - if (current) return; - transition_in(if_block1); - current = true; - }, - o(local) { - transition_out(if_block1); - current = false; - }, - d(detaching) { - if (detaching) { - detach(main); - } - ctx[23](null); - ctx[24](null); - ctx[25](null); - ctx[26](null); - ctx[27](null); - ctx[28](null); - ctx[29](null); - ctx[31](null); - if (if_block0) if_block0.d(); - if (if_block1) if_block1.d(); - mounted = false; - run_all(dispose); - } - }; -} -function triggerRefresh2() { - dispatchEvent(new CustomEvent("git-refresh")); -} -function instance9($$self, $$props, $$invalidate) { - let rows; - let { plugin } = $$props; - let { view } = $$props; - let loading; - let status2; - let lastPulledFiles = []; - let commitMessage = plugin.settings.commitMessage; - let buttons = []; - let changeHierarchy; - let stagedHierarchy; - let lastPulledFilesHierarchy; - let changesOpen = true; - let stagedOpen = true; - let lastPulledFilesOpen = true; - let showTree = plugin.settings.treeStructure; - let layoutBtn; - addEventListener("git-view-refresh", refresh); - plugin.app.workspace.onLayoutReady(() => { - window.setTimeout( - () => { - buttons.forEach((btn) => (0, import_obsidian29.setIcon)(btn, btn.getAttr("data-icon"))); - (0, import_obsidian29.setIcon)(layoutBtn, showTree ? "list" : "folder"); - }, - 0 - ); - }); - onDestroy(() => { - removeEventListener("git-view-refresh", refresh); - }); - function commit2() { - return __awaiter(this, void 0, void 0, function* () { - $$invalidate(5, loading = true); - if (status2) { - if (yield plugin.hasTooBigFiles(status2.staged)) { - plugin.setState(0 /* idle */); - return false; - } - plugin.promiseQueue.addTask(() => plugin.gitManager.commit({ message: commitMessage }).then(() => { - if (commitMessage !== plugin.settings.commitMessage) { - $$invalidate(2, commitMessage = ""); - } - plugin.setUpAutoBackup(); - }).finally(triggerRefresh2)); - } - }); - } - function backup() { - return __awaiter(this, void 0, void 0, function* () { - $$invalidate(5, loading = true); - if (status2) { - plugin.promiseQueue.addTask(() => plugin.createBackup(false, false, commitMessage).then(() => { - if (commitMessage !== plugin.settings.commitMessage) { - $$invalidate(2, commitMessage = ""); - } - }).finally(triggerRefresh2)); - } - }); - } - function refresh() { - return __awaiter(this, void 0, void 0, function* () { - if (!plugin.gitReady) { - $$invalidate(6, status2 = void 0); - return; - } - const unPushedCommits = yield plugin.gitManager.getUnpushedCommits(); - buttons.forEach((btn) => { - var _a2, _b; - if (import_obsidian29.Platform.isMobile) { - btn.removeClass("button-border"); - if (btn.id == "push" && unPushedCommits > 0) { - btn.addClass("button-border"); - } - } else { - (_a2 = btn.firstElementChild) === null || _a2 === void 0 ? void 0 : _a2.removeAttribute("color"); - if (btn.id == "push" && unPushedCommits > 0) { - (_b = btn.firstElementChild) === null || _b === void 0 ? void 0 : _b.setAttr("color", "var(--text-accent)"); - } - } - }); - $$invalidate(6, status2 = plugin.cachedStatus); - if (plugin.lastPulledFiles && plugin.lastPulledFiles != lastPulledFiles) { - $$invalidate(7, lastPulledFiles = plugin.lastPulledFiles); - $$invalidate(11, lastPulledFilesHierarchy = { - title: "", - path: "", - vaultPath: "", - children: plugin.gitManager.getTreeStructure(lastPulledFiles) - }); - } - if (status2) { - const sort = (a, b) => { - return a.vault_path.split("/").last().localeCompare(getDisplayPath(b.vault_path)); - }; - status2.changed.sort(sort); - status2.staged.sort(sort); - if (status2.changed.length + status2.staged.length > 500) { - $$invalidate(6, status2 = void 0); - if (!plugin.loading) { - plugin.displayError("Too many changes to display"); - } - } else { - $$invalidate(9, changeHierarchy = { - title: "", - path: "", - vaultPath: "", - children: plugin.gitManager.getTreeStructure(status2.changed) - }); - $$invalidate(10, stagedHierarchy = { - title: "", - path: "", - vaultPath: "", - children: plugin.gitManager.getTreeStructure(status2.staged) - }); - } - } else { - $$invalidate(9, changeHierarchy = void 0); - $$invalidate(10, stagedHierarchy = void 0); - } - $$invalidate(5, loading = plugin.loading); - }); - } - function stageAll() { - $$invalidate(5, loading = true); - plugin.promiseQueue.addTask(() => plugin.gitManager.stageAll({ status: status2 }).finally(triggerRefresh2)); - } - function unstageAll() { - $$invalidate(5, loading = true); - plugin.promiseQueue.addTask(() => plugin.gitManager.unstageAll({ status: status2 }).finally(triggerRefresh2)); - } - function push2() { - $$invalidate(5, loading = true); - plugin.promiseQueue.addTask(() => plugin.push().finally(triggerRefresh2)); - } - function pull2() { - $$invalidate(5, loading = true); - plugin.promiseQueue.addTask(() => plugin.pullChangesFromRemote().finally(triggerRefresh2)); - } - function discard() { - new DiscardModal(view.app, false, plugin.gitManager.getRelativeVaultPath("/")).myOpen().then((shouldDiscard) => { - if (shouldDiscard === true) { - plugin.promiseQueue.addTask(() => plugin.gitManager.discardAll({ status: plugin.cachedStatus }).finally(() => { - dispatchEvent(new CustomEvent("git-refresh")); - })); - } - }); - } - function div0_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[5] = $$value; - $$invalidate(8, buttons); - }); - } - function div1_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[0] = $$value; - $$invalidate(8, buttons); - }); - } - function div2_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[1] = $$value; - $$invalidate(8, buttons); - }); - } - function div3_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[2] = $$value; - $$invalidate(8, buttons); - }); - } - function div4_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[3] = $$value; - $$invalidate(8, buttons); - }); - } - function div5_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[4] = $$value; - $$invalidate(8, buttons); - }); - } - function div6_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - layoutBtn = $$value; - $$invalidate(4, layoutBtn); - }); - } - const click_handler = () => { - $$invalidate(3, showTree = !showTree); - $$invalidate(0, plugin.settings.treeStructure = showTree, plugin); - plugin.saveSettings(); - }; - function div7_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[6] = $$value; - $$invalidate(8, buttons); - }); - } - function textarea_input_handler() { - commitMessage = this.value; - $$invalidate(2, commitMessage); - } - const click_handler_1 = () => $$invalidate(2, commitMessage = ""); - function div2_binding_1($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[8] = $$value; - $$invalidate(8, buttons); - }); - } - const click_handler_2 = () => $$invalidate(13, stagedOpen = !stagedOpen); - function div11_binding($$value) { - binding_callbacks[$$value ? "unshift" : "push"](() => { - buttons[9] = $$value; - $$invalidate(8, buttons); - }); - } - const click_handler_3 = () => $$invalidate(12, changesOpen = !changesOpen); - const click_handler_4 = () => $$invalidate(14, lastPulledFilesOpen = !lastPulledFilesOpen); - $$self.$$set = ($$props2) => { - if ("plugin" in $$props2) $$invalidate(0, plugin = $$props2.plugin); - if ("view" in $$props2) $$invalidate(1, view = $$props2.view); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty[0] & /*layoutBtn, showTree*/ - 24) { - $: { - if (layoutBtn) { - layoutBtn.empty(); - (0, import_obsidian29.setIcon)(layoutBtn, showTree ? "list" : "folder"); - } - } - } - if ($$self.$$.dirty[0] & /*commitMessage*/ - 4) { - $: $$invalidate(15, rows = (commitMessage.match(/\n/g) || []).length + 1 || 1); - } - }; - return [ - plugin, - view, - commitMessage, - showTree, - layoutBtn, - loading, - status2, - lastPulledFiles, - buttons, - changeHierarchy, - stagedHierarchy, - lastPulledFilesHierarchy, - changesOpen, - stagedOpen, - lastPulledFilesOpen, - rows, - commit2, - backup, - stageAll, - unstageAll, - push2, - pull2, - discard, - div0_binding, - div1_binding, - div2_binding, - div3_binding, - div4_binding, - div5_binding, - div6_binding, - click_handler, - div7_binding, - textarea_input_handler, - click_handler_1, - div2_binding_1, - click_handler_2, - div11_binding, - click_handler_3, - click_handler_4 - ]; -} -var SourceControl = class extends SvelteComponent { - constructor(options) { - super(); - init2(this, options, instance9, create_fragment9, safe_not_equal, { plugin: 0, view: 1 }, add_css7, [-1, -1]); - } -}; -var sourceControl_default = SourceControl; - -// src/ui/sourceControl/sourceControl.ts -var GitView = class extends import_obsidian30.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.plugin = plugin; - this.hoverPopover = null; - } - getViewType() { - return SOURCE_CONTROL_VIEW_CONFIG.type; - } - getDisplayText() { - return SOURCE_CONTROL_VIEW_CONFIG.name; - } - getIcon() { - return SOURCE_CONTROL_VIEW_CONFIG.icon; - } - onClose() { - return super.onClose(); - } - onOpen() { - this._view = new sourceControl_default({ - target: this.contentEl, - props: { - plugin: this.plugin, - view: this - } - }); - return super.onOpen(); - } -}; - -// src/ui/statusBar/branchStatusBar.ts -init_polyfill_buffer(); -var BranchStatusBar = class { - constructor(statusBarEl, plugin) { - this.statusBarEl = statusBarEl; - this.plugin = plugin; - this.statusBarEl.addClass("mod-clickable"); - this.statusBarEl.onClickEvent((e) => { - this.plugin.switchBranch(); - }); - } - async display() { - if (this.plugin.gitReady) { - const branchInfo = await this.plugin.gitManager.branchInfo(); - if (branchInfo.current != void 0) { - this.statusBarEl.setText(branchInfo.current); - } else { - this.statusBarEl.empty(); - } - } else { - this.statusBarEl.empty(); - } - } -}; - -// src/main.ts -var ObsidianGit = class extends import_obsidian31.Plugin { - constructor() { - super(...arguments); - this.gitReady = false; - this.promiseQueue = new PromiseQueue(); - this.conflictOutputFile = "conflict-files-obsidian-git.md"; - this.offlineMode = false; - this.loading = false; - this.lineAuthoringFeature = new LineAuthoringFeature(this); - } - setState(state) { - var _a2; - this.state = state; - (_a2 = this.statusBar) == null ? void 0 : _a2.display(); - } - async updateCachedStatus() { - this.cachedStatus = await this.gitManager.status(); - return this.cachedStatus; - } - async refresh() { - const gitView = this.app.workspace.getLeavesOfType( - SOURCE_CONTROL_VIEW_CONFIG.type - ); - const historyView = this.app.workspace.getLeavesOfType( - HISTORY_VIEW_CONFIG.type - ); - if (this.settings.changedFilesInStatusBar || gitView.length > 0 || historyView.length > 0) { - this.loading = true; - dispatchEvent(new CustomEvent("git-view-refresh")); - await this.updateCachedStatus(); - this.loading = false; - dispatchEvent(new CustomEvent("git-view-refresh")); - } - } - async refreshUpdatedHead() { - this.lineAuthoringFeature.refreshLineAuthorViews(); - } - async onload() { - console.log("loading " + this.manifest.name + " plugin"); - pluginRef.plugin = this; - this.localStorage = new LocalStorageSettings(this); - this.localStorage.migrate(); - await this.loadSettings(); - this.migrateSettings(); - this.settingsTab = new ObsidianGitSettingsTab(this.app, this); - this.addSettingTab(this.settingsTab); - if (!this.localStorage.getPluginDisabled()) { - this.loadPlugin(); - } - } - async loadPlugin() { - addEventListener("git-refresh", this.refresh.bind(this)); - addEventListener("git-head-update", this.refreshUpdatedHead.bind(this)); - this.registerView(SOURCE_CONTROL_VIEW_CONFIG.type, (leaf) => { - return new GitView(leaf, this); - }); - this.registerView(HISTORY_VIEW_CONFIG.type, (leaf) => { - return new HistoryView2(leaf, this); - }); - this.registerView(DIFF_VIEW_CONFIG.type, (leaf) => { - return new DiffView(leaf, this); - }); - this.lineAuthoringFeature.onLoadPlugin(); - this.app.workspace.registerHoverLinkSource( - SOURCE_CONTROL_VIEW_CONFIG.type, - { - display: "Git View", - defaultMod: true - } - ); - this.setRefreshDebouncer(); - this.addCommand({ - id: "edit-gitignore", - name: "Edit .gitignore", - callback: async () => { - const path2 = this.gitManager.getRelativeVaultPath(".gitignore"); - if (!await this.app.vault.adapter.exists(path2)) { - this.app.vault.adapter.write(path2, ""); - } - const content = await this.app.vault.adapter.read(path2); - const modal = new IgnoreModal(this.app, content); - const res = await modal.open(); - if (res !== void 0) { - await this.app.vault.adapter.write(path2, res); - this.refresh(); - } - } - }); - this.addCommand({ - id: "open-git-view", - name: "Open source control view", - callback: async () => { - var _a2; - const leafs = this.app.workspace.getLeavesOfType( - SOURCE_CONTROL_VIEW_CONFIG.type - ); - let leaf; - if (leafs.length === 0) { - leaf = (_a2 = this.app.workspace.getRightLeaf(false)) != null ? _a2 : this.app.workspace.getLeaf(); - await leaf.setViewState({ - type: SOURCE_CONTROL_VIEW_CONFIG.type - }); - } else { - leaf = leafs.first(); - } - this.app.workspace.revealLeaf(leaf); - dispatchEvent(new CustomEvent("git-refresh")); - } - }); - this.addCommand({ - id: "open-history-view", - name: "Open history view", - callback: async () => { - var _a2; - const leafs = this.app.workspace.getLeavesOfType( - HISTORY_VIEW_CONFIG.type - ); - let leaf; - if (leafs.length === 0) { - leaf = (_a2 = this.app.workspace.getRightLeaf(false)) != null ? _a2 : this.app.workspace.getLeaf(); - await leaf.setViewState({ - type: HISTORY_VIEW_CONFIG.type - }); - } else { - leaf = leafs.first(); - } - this.app.workspace.revealLeaf(leaf); - dispatchEvent(new CustomEvent("git-refresh")); - } - }); - this.addCommand({ - id: "open-diff-view", - name: "Open diff view", - checkCallback: (checking) => { - var _a2; - const file = this.app.workspace.getActiveFile(); - if (checking) { - return file !== null; - } else { - (_a2 = getNewLeaf()) == null ? void 0 : _a2.setViewState({ - type: DIFF_VIEW_CONFIG.type, - active: true, - state: { - staged: false, - file: this.gitManager.getRelativeRepoPath( - file.path, - true - ) - } - }); - } - } - }); - this.addCommand({ - id: "view-file-on-github", - name: "Open file on GitHub", - editorCallback: (editor, { file }) => { - if (file) - return openLineInGitHub(editor, file, this.gitManager); - } - }); - this.addCommand({ - id: "view-history-on-github", - name: "Open file history on GitHub", - editorCallback: (_, { file }) => { - if (file) return openHistoryInGitHub(file, this.gitManager); - } - }); - this.addCommand({ - id: "pull", - name: "Pull", - callback: () => this.promiseQueue.addTask(() => this.pullChangesFromRemote()) - }); - this.addCommand({ - id: "fetch", - name: "fetch", - callback: () => this.promiseQueue.addTask(() => this.fetch()) - }); - this.addCommand({ - id: "switch-to-remote-branch", - name: "Switch to remote branch", - callback: () => this.promiseQueue.addTask(() => this.switchRemoteBranch()) - }); - this.addCommand({ - id: "add-to-gitignore", - name: "Add file to gitignore", - checkCallback: (checking) => { - const file = this.app.workspace.getActiveFile(); - if (checking) { - return file !== null; - } else { - this.addFileToGitignore(file); - } - } - }); - this.addCommand({ - id: "push", - name: "Create backup", - callback: () => this.promiseQueue.addTask(() => this.createBackup(false)) - }); - this.addCommand({ - id: "backup-and-close", - name: "Create backup and close", - callback: () => this.promiseQueue.addTask(async () => { - await this.createBackup(false); - window.close(); - }) - }); - this.addCommand({ - id: "commit-push-specified-message", - name: "Create backup with specific message", - callback: () => this.promiseQueue.addTask(() => this.createBackup(false, true)) - }); - this.addCommand({ - id: "commit", - name: "Commit all changes", - callback: () => this.promiseQueue.addTask( - () => this.commit({ fromAutoBackup: false }) - ) - }); - this.addCommand({ - id: "commit-specified-message", - name: "Commit all changes with specific message", - callback: () => this.promiseQueue.addTask( - () => this.commit({ - fromAutoBackup: false, - requestCustomMessage: true - }) - ) - }); - this.addCommand({ - id: "commit-staged", - name: "Commit staged", - callback: () => this.promiseQueue.addTask( - () => this.commit({ - fromAutoBackup: false, - requestCustomMessage: false, - onlyStaged: true - }) - ) - }); - if (import_obsidian31.Platform.isDesktopApp) { - this.addCommand({ - id: "commit-amend-staged-specified-message", - name: "Commit Amend", - callback: () => this.promiseQueue.addTask( - () => this.commit({ - fromAutoBackup: false, - requestCustomMessage: true, - onlyStaged: true, - amend: true - }) - ) - }); - } - this.addCommand({ - id: "commit-staged-specified-message", - name: "Commit staged with specific message", - callback: () => this.promiseQueue.addTask( - () => this.commit({ - fromAutoBackup: false, - requestCustomMessage: true, - onlyStaged: true - }) - ) - }); - this.addCommand({ - id: "push2", - name: "Push", - callback: () => this.promiseQueue.addTask(() => this.push()) - }); - this.addCommand({ - id: "stage-current-file", - name: "Stage current file", - checkCallback: (checking) => { - const file = this.app.workspace.getActiveFile(); - if (checking) { - return file !== null; - } else { - this.promiseQueue.addTask(() => this.stageFile(file)); - } - } - }); - this.addCommand({ - id: "unstage-current-file", - name: "Unstage current file", - checkCallback: (checking) => { - const file = this.app.workspace.getActiveFile(); - if (checking) { - return file !== null; - } else { - this.promiseQueue.addTask(() => this.unstageFile(file)); - } - } - }); - this.addCommand({ - id: "edit-remotes", - name: "Edit remotes", - callback: async () => this.editRemotes() - }); - this.addCommand({ - id: "remove-remote", - name: "Remove remote", - callback: async () => this.removeRemote() - }); - this.addCommand({ - id: "set-upstream-branch", - name: "Set upstream branch", - callback: async () => this.setUpstreamBranch() - }); - this.addCommand({ - id: "delete-repo", - name: "CAUTION: Delete repository", - callback: async () => { - const repoExists = await this.app.vault.adapter.exists( - `${this.settings.basePath}/.git` - ); - if (repoExists) { - const modal = new GeneralModal({ - options: ["NO", "YES"], - placeholder: "Do you really want to delete the repository (.git directory)? This action cannot be undone.", - onlySelection: true - }); - const shouldDelete = await modal.open() === "YES"; - if (shouldDelete) { - await this.app.vault.adapter.rmdir( - `${this.settings.basePath}/.git`, - true - ); - new import_obsidian31.Notice( - "Successfully deleted repository. Reloading plugin..." - ); - this.unloadPlugin(); - this.init(); - } - } else { - new import_obsidian31.Notice("No repository found"); - } - } - }); - this.addCommand({ - id: "init-repo", - name: "Initialize a new repo", - callback: async () => this.createNewRepo() - }); - this.addCommand({ - id: "clone-repo", - name: "Clone an existing remote repo", - callback: async () => this.cloneNewRepo() - }); - this.addCommand({ - id: "list-changed-files", - name: "List changed files", - callback: async () => { - if (!await this.isAllInitialized()) return; - const status2 = await this.gitManager.status(); - console.log(status2); - this.setState(0 /* idle */); - if (status2.changed.length + status2.staged.length > 500) { - this.displayError("Too many changes to display"); - return; - } - new ChangedFilesModal(this, status2.all).open(); - } - }); - this.addCommand({ - id: "switch-branch", - name: "Switch branch", - callback: () => { - this.switchBranch(); - } - }); - this.addCommand({ - id: "create-branch", - name: "Create new branch", - callback: () => { - this.createBranch(); - } - }); - this.addCommand({ - id: "delete-branch", - name: "Delete branch", - callback: () => { - this.deleteBranch(); - } - }); - this.addCommand({ - id: "discard-all", - name: "CAUTION: Discard all changes", - callback: async () => { - if (!await this.isAllInitialized()) return false; - const modal = new GeneralModal({ - options: ["NO", "YES"], - placeholder: "Do you want to discard all changes to tracked files? This action cannot be undone.", - onlySelection: true - }); - const shouldDiscardAll = await modal.open() === "YES"; - if (shouldDiscardAll) { - this.promiseQueue.addTask(() => this.discardAll()); - } - } - }); - this.addCommand({ - id: "toggle-line-author-info", - name: "Toggle line author information", - callback: () => { - var _a2; - return (_a2 = this.settingsTab) == null ? void 0 : _a2.configureLineAuthorShowStatus( - !this.settings.lineAuthor.show - ); - } - }); - this.registerEvent( - this.app.workspace.on("file-menu", (menu, file, source) => { - this.handleFileMenu(menu, file, source); - }) - ); - if (this.settings.showStatusBar) { - const statusBarEl = this.addStatusBarItem(); - this.statusBar = new StatusBar(statusBarEl, this); - this.registerInterval( - window.setInterval(() => { - var _a2; - return (_a2 = this.statusBar) == null ? void 0 : _a2.display(); - }, 1e3) - ); - } - if (import_obsidian31.Platform.isDesktop && this.settings.showBranchStatusBar) { - const branchStatusBarEl = this.addStatusBarItem(); - this.branchBar = new BranchStatusBar(branchStatusBarEl, this); - this.registerInterval( - window.setInterval(() => { - var _a2; - return (_a2 = this.branchBar) == null ? void 0 : _a2.display(); - }, 6e4) - ); - } - this.app.workspace.onLayoutReady(() => this.init()); - } - setRefreshDebouncer() { - var _a2; - (_a2 = this.debRefresh) == null ? void 0 : _a2.cancel(); - this.debRefresh = (0, import_obsidian31.debounce)( - () => { - if (this.settings.refreshSourceControl) { - this.refresh(); - } - }, - this.settings.refreshSourceControlTimer, - true - ); - } - async showNotices() { - const length = 1e4; - if (this.manifest.id === "obsidian-git" && import_obsidian31.Platform.isDesktopApp && !this.settings.showedMobileNotice) { - new import_obsidian31.Notice( - "Git is now available on mobile! Please read the plugin's README for more information.", - length - ); - this.settings.showedMobileNotice = true; - await this.saveSettings(); - } - if (this.manifest.id === "obsidian-git-isomorphic") { - new import_obsidian31.Notice( - "Git Mobile is now deprecated. Please uninstall it and install Git instead.", - length - ); - } - } - async addFileToGitignore(file) { - await this.app.vault.adapter.append( - this.gitManager.getRelativeVaultPath(".gitignore"), - "\n" + this.gitManager.getRelativeRepoPath(file.path, true) - ); - this.refresh(); - } - handleFileMenu(menu, file, source) { - if (!this.gitReady) return; - if (!this.settings.showFileMenu) return; - if (!file) return; - if (this.settings.showFileMenu && source == "file-explorer-context-menu") { - menu.addItem((item) => { - item.setTitle(`Git: Stage`).setIcon("plus-circle").setSection("action").onClick((_) => { - this.promiseQueue.addTask(async () => { - if (file instanceof import_obsidian31.TFile) { - await this.gitManager.stage(file.path, true); - } else { - await this.gitManager.stageAll({ - dir: this.gitManager.getRelativeRepoPath( - file.path, - true - ) - }); - } - this.displayMessage(`Staged ${file.path}`); - }); - }); - }); - menu.addItem((item) => { - item.setTitle(`Git: Unstage`).setIcon("minus-circle").setSection("action").onClick((_) => { - this.promiseQueue.addTask(async () => { - if (file instanceof import_obsidian31.TFile) { - await this.gitManager.unstage(file.path, true); - } else { - await this.gitManager.unstageAll({ - dir: this.gitManager.getRelativeRepoPath( - file.path, - true - ) - }); - } - this.displayMessage(`Unstaged ${file.path}`); - }); - }); - }); - menu.addItem((item) => { - item.setTitle(`Git: Add to .gitignore`).setIcon("file-x").setSection("action").onClick((_) => { - this.addFileToGitignore(file); - }); - }); - } - if (source == "git-source-control") { - menu.addItem((item) => { - item.setTitle(`Git: Add to .gitignore`).setIcon("file-x").setSection("action").onClick((_) => { - this.addFileToGitignore(file); - }); - }); - } - } - async migrateSettings() { - if (this.settings.mergeOnPull != void 0) { - this.settings.syncMethod = this.settings.mergeOnPull ? "merge" : "rebase"; - this.settings.mergeOnPull = void 0; - await this.saveSettings(); - } - if (this.settings.autoCommitMessage === void 0) { - this.settings.autoCommitMessage = this.settings.commitMessage; - await this.saveSettings(); - } - if (this.settings.gitPath != void 0) { - this.localStorage.setGitPath(this.settings.gitPath); - this.settings.gitPath = void 0; - await this.saveSettings(); - } - if (this.settings.username != void 0) { - this.localStorage.setPassword(this.settings.username); - this.settings.username = void 0; - await this.saveSettings(); - } - } - unloadPlugin() { - this.gitReady = false; - dispatchEvent(new CustomEvent("git-refresh")); - this.lineAuthoringFeature.deactivateFeature(); - this.clearAutoPull(); - this.clearAutoPush(); - this.clearAutoBackup(); - removeEventListener("git-refresh", this.refresh.bind(this)); - removeEventListener( - "git-head-update", - this.refreshUpdatedHead.bind(this) - ); - this.app.workspace.offref(this.openEvent); - this.app.metadataCache.offref(this.modifyEvent); - this.app.metadataCache.offref(this.deleteEvent); - this.app.metadataCache.offref(this.createEvent); - this.app.metadataCache.offref(this.renameEvent); - this.debRefresh.cancel(); - } - async onunload() { - this.app.workspace.unregisterHoverLinkSource( - SOURCE_CONTROL_VIEW_CONFIG.type - ); - this.unloadPlugin(); - console.log("unloading " + this.manifest.name + " plugin"); - } - async loadSettings() { - let data = await this.loadData(); - if (data == void 0) { - data = { showedMobileNotice: true }; - } - this.settings = mergeSettingsByPriority(DEFAULT_SETTINGS, data); - } - async saveSettings() { - var _a2; - (_a2 = this.settingsTab) == null ? void 0 : _a2.beforeSaveSettings(); - await this.saveData(this.settings); - } - saveLastAuto(date, mode) { - if (mode === "backup") { - this.localStorage.setLastAutoBackup(date.toString()); - } else if (mode === "pull") { - this.localStorage.setLastAutoPull(date.toString()); - } else if (mode === "push") { - this.localStorage.setLastAutoPush(date.toString()); - } - } - loadLastAuto() { - var _a2, _b, _c; - return { - backup: new Date((_a2 = this.localStorage.getLastAutoBackup()) != null ? _a2 : ""), - pull: new Date((_b = this.localStorage.getLastAutoPull()) != null ? _b : ""), - push: new Date((_c = this.localStorage.getLastAutoPush()) != null ? _c : "") - }; - } - get useSimpleGit() { - return import_obsidian31.Platform.isDesktopApp; - } - async init() { - var _a2; - this.showNotices(); - try { - if (this.useSimpleGit) { - this.gitManager = new SimpleGit(this); - await this.gitManager.setGitInstance(); - } else { - this.gitManager = new IsomorphicGit(this); - } - const result = await this.gitManager.checkRequirements(); - switch (result) { - case "missing-git": - this.displayError("Cannot run git command"); - break; - case "missing-repo": - new import_obsidian31.Notice( - "Can't find a valid git repository. Please create one via the given command or clone an existing repo.", - 1e4 - ); - break; - case "valid": - this.gitReady = true; - this.setState(0 /* idle */); - this.openEvent = this.app.workspace.on( - "active-leaf-change", - (leaf) => this.handleViewActiveState(leaf) - ); - this.modifyEvent = this.app.vault.on("modify", () => { - this.debRefresh(); - }); - this.deleteEvent = this.app.vault.on("delete", () => { - this.debRefresh(); - }); - this.createEvent = this.app.vault.on("create", () => { - this.debRefresh(); - }); - this.renameEvent = this.app.vault.on("rename", () => { - this.debRefresh(); - }); - this.registerEvent(this.modifyEvent); - this.registerEvent(this.deleteEvent); - this.registerEvent(this.createEvent); - this.registerEvent(this.renameEvent); - (_a2 = this.branchBar) == null ? void 0 : _a2.display(); - this.lineAuthoringFeature.conditionallyActivateBySettings(); - dispatchEvent(new CustomEvent("git-refresh")); - if (this.settings.autoPullOnBoot) { - this.promiseQueue.addTask( - () => this.pullChangesFromRemote() - ); - } - this.setUpAutos(); - break; - default: - console.log( - "Something weird happened. The 'checkRequirements' result is " + result - ); - } - } catch (error) { - this.displayError(error); - console.error(error); - } - } - async createNewRepo() { - await this.gitManager.init(); - new import_obsidian31.Notice("Initialized new repo"); - await this.init(); - } - async cloneNewRepo() { - const modal = new GeneralModal({ placeholder: "Enter remote URL" }); - const url = await modal.open(); - if (url) { - const confirmOption = "Vault Root"; - let dir = await new GeneralModal({ - options: this.gitManager instanceof IsomorphicGit ? [confirmOption] : [], - placeholder: "Enter directory for clone. It needs to be empty or not existent.", - allowEmpty: this.gitManager instanceof IsomorphicGit - }).open(); - if (dir !== void 0) { - if (dir === confirmOption) { - dir = "."; - } - dir = (0, import_obsidian31.normalizePath)(dir); - if (dir === "/") { - dir = "."; - } - if (dir === ".") { - const modal2 = new GeneralModal({ - options: ["NO", "YES"], - placeholder: `Does your remote repo contain a ${app.vault.configDir} directory at the root?`, - onlySelection: true - }); - const containsConflictDir = await modal2.open(); - if (containsConflictDir === void 0) { - new import_obsidian31.Notice("Aborted clone"); - return; - } else if (containsConflictDir === "YES") { - const confirmOption2 = "DELETE ALL YOUR LOCAL CONFIG AND PLUGINS"; - const modal3 = new GeneralModal({ - options: ["Abort clone", confirmOption2], - placeholder: `To avoid conflicts, the local ${app.vault.configDir} directory needs to be deleted.`, - onlySelection: true - }); - const shouldDelete = await modal3.open() === confirmOption2; - if (shouldDelete) { - await this.app.vault.adapter.rmdir( - app.vault.configDir, - true - ); - } else { - new import_obsidian31.Notice("Aborted clone"); - return; - } - } - } - const depth = await new GeneralModal({ - placeholder: "Specify depth of clone. Leave empty for full clone.", - allowEmpty: true - }).open(); - let depthInt = void 0; - if (depth !== "") { - depthInt = parseInt(depth); - if (isNaN(depthInt)) { - new import_obsidian31.Notice("Invalid depth. Aborting clone."); - return; - } - } - new import_obsidian31.Notice(`Cloning new repo into "${dir}"`); - const oldBase = this.settings.basePath; - const customDir = dir && dir !== "."; - if (customDir) { - this.settings.basePath = dir; - } - try { - await this.gitManager.clone(url, dir, depthInt); - } catch (error) { - this.settings.basePath = oldBase; - this.saveSettings(); - throw error; - } - new import_obsidian31.Notice("Cloned new repo."); - new import_obsidian31.Notice("Please restart Obsidian"); - if (customDir) { - this.saveSettings(); - } - } - } - } - /** - * Retries to call `this.init()` if necessary, otherwise returns directly - * @returns true if `this.gitManager` is ready to be used, false if not. - */ - async isAllInitialized() { - if (!this.gitReady) { - await this.init(); - } - return this.gitReady; - } - ///Used for command - async pullChangesFromRemote() { - if (!await this.isAllInitialized()) return; - const filesUpdated = await this.pull(); - this.setUpAutoBackup(); - if (filesUpdated === false) { - return; - } - if (!filesUpdated) { - this.displayMessage("Everything is up-to-date"); - } - if (this.gitManager instanceof SimpleGit) { - const status2 = await this.gitManager.status(); - if (status2.conflicted.length > 0) { - this.displayError( - `You have conflicts in ${status2.conflicted.length} ${status2.conflicted.length == 1 ? "file" : "files"}` - ); - this.handleConflict(status2.conflicted); - } - } - dispatchEvent(new CustomEvent("git-refresh")); - this.setState(0 /* idle */); - } - async createBackup(fromAutoBackup, requestCustomMessage = false, commitMessage) { - if (!await this.isAllInitialized()) return; - if (this.settings.syncMethod == "reset" && this.settings.pullBeforePush) { - await this.pull(); - } - if (!await this.commit({ - fromAutoBackup, - requestCustomMessage, - commitMessage - })) { - return; - } - if (!this.settings.disablePush) { - if (await this.remotesAreSet() && await this.gitManager.canPush()) { - if (this.settings.syncMethod != "reset" && this.settings.pullBeforePush) { - await this.pull(); - } - await this.push(); - } else { - this.displayMessage("No changes to push"); - } - } - this.setState(0 /* idle */); - } - // Returns true if commit was successfully - async commit({ - fromAutoBackup, - requestCustomMessage = false, - onlyStaged = false, - commitMessage, - amend = false - }) { - if (!await this.isAllInitialized()) return false; - let hadConflict = this.localStorage.getConflict(); - let changedFiles; - let status2; - let unstagedFiles; - if (this.gitManager instanceof SimpleGit) { - this.mayDeleteConflictFile(); - status2 = await this.updateCachedStatus(); - if (status2.conflicted.length == 0) { - this.localStorage.setConflict(false); - hadConflict = false; - } - if (fromAutoBackup && status2.conflicted.length > 0) { - this.displayError( - `Did not commit, because you have conflicts in ${status2.conflicted.length} ${status2.conflicted.length == 1 ? "file" : "files"}. Please resolve them and commit per command.` - ); - this.handleConflict(status2.conflicted); - return false; - } - changedFiles = [...status2.changed, ...status2.staged]; - } else if (fromAutoBackup && hadConflict) { - this.setState(6 /* conflicted */); - this.displayError( - `Did not commit, because you have conflicts. Please resolve them and commit per command.` - ); - return false; - } else if (hadConflict) { - await this.mayDeleteConflictFile(); - status2 = await this.updateCachedStatus(); - changedFiles = [...status2.changed, ...status2.staged]; - } else { - if (onlyStaged) { - changedFiles = await this.gitManager.getStagedFiles(); - } else { - unstagedFiles = await this.gitManager.getUnstagedFiles(); - changedFiles = unstagedFiles.map(({ filepath }) => ({ - vault_path: this.gitManager.getRelativeVaultPath(filepath) - })); - } - } - if (await this.hasTooBigFiles(changedFiles)) { - this.setState(0 /* idle */); - return false; - } - if (changedFiles.length !== 0 || hadConflict) { - let cmtMessage = commitMessage != null ? commitMessage : commitMessage = fromAutoBackup ? this.settings.autoCommitMessage : this.settings.commitMessage; - if (fromAutoBackup && this.settings.customMessageOnAutoBackup || requestCustomMessage) { - if (!this.settings.disablePopups && fromAutoBackup) { - new import_obsidian31.Notice( - "Auto backup: Please enter a custom commit message. Leave empty to abort" - ); - } - const tempMessage = await new CustomMessageModal( - this, - true - ).open(); - if (tempMessage != void 0 && tempMessage != "" && tempMessage != "...") { - cmtMessage = tempMessage; - } else { - this.setState(0 /* idle */); - return false; - } - } - let committedFiles; - if (onlyStaged) { - committedFiles = await this.gitManager.commit({ - message: cmtMessage, - amend - }); - } else { - committedFiles = await this.gitManager.commitAll({ - message: cmtMessage, - status: status2, - unstagedFiles, - amend - }); - } - if (this.gitManager instanceof SimpleGit) { - if ((await this.updateCachedStatus()).conflicted.length == 0) { - this.localStorage.setConflict(false); - } - } - let roughly = false; - if (committedFiles === void 0) { - roughly = true; - committedFiles = changedFiles.length; - } - this.setUpAutoBackup(); - this.displayMessage( - `Committed${roughly ? " approx." : ""} ${committedFiles} ${committedFiles == 1 ? "file" : "files"}` - ); - } else { - this.displayMessage("No changes to commit"); - } - dispatchEvent(new CustomEvent("git-refresh")); - this.setState(0 /* idle */); - return true; - } - async hasTooBigFiles(files) { - const branchInfo = await this.gitManager.branchInfo(); - const remote = branchInfo.tracking ? splitRemoteBranch(branchInfo.tracking)[0] : null; - if (remote) { - const remoteUrl = await this.gitManager.getRemoteUrl(remote); - if (remoteUrl == null ? void 0 : remoteUrl.includes("github.com")) { - const tooBigFiles = files.filter((f) => { - const file = this.app.vault.getAbstractFileByPath( - f.vault_path - ); - if (file instanceof import_obsidian31.TFile) { - return file.stat.size >= 1e8; - } - return false; - }); - if (tooBigFiles.length > 0) { - this.displayError( - `Did not commit, because following files are too big: ${tooBigFiles.map( - (e) => e.vault_path - )}. Please remove them.` - ); - return true; - } - } - } - return false; - } - async push() { - if (!await this.isAllInitialized()) return false; - if (!await this.remotesAreSet()) { - return false; - } - const hadConflict = this.localStorage.getConflict(); - if (this.gitManager instanceof SimpleGit) - await this.mayDeleteConflictFile(); - let status2; - if (this.gitManager instanceof SimpleGit && (status2 = await this.updateCachedStatus()).conflicted.length > 0) { - this.displayError( - `Cannot push. You have conflicts in ${status2.conflicted.length} ${status2.conflicted.length == 1 ? "file" : "files"}` - ); - this.handleConflict(status2.conflicted); - return false; - } else if (this.gitManager instanceof IsomorphicGit && hadConflict) { - this.displayError(`Cannot push. You have conflicts`); - this.setState(6 /* conflicted */); - return false; - } - console.log("Pushing...."); - const pushedFiles = await this.gitManager.push(); - if (pushedFiles !== void 0) { - console.log("Pushed!", pushedFiles); - if (pushedFiles > 0) { - this.displayMessage( - `Pushed ${pushedFiles} ${pushedFiles == 1 ? "file" : "files"} to remote` - ); - } else { - this.displayMessage(`No changes to push`); - } - } - this.offlineMode = false; - this.setState(0 /* idle */); - dispatchEvent(new CustomEvent("git-refresh")); - return true; - } - /** Used for internals - Returns whether the pull added a commit or not. - - See {@link pullChangesFromRemote} for the command version. */ - async pull() { - if (!await this.remotesAreSet()) { - return false; - } - const pulledFiles = await this.gitManager.pull() || []; - this.offlineMode = false; - if (pulledFiles.length > 0) { - this.displayMessage( - `Pulled ${pulledFiles.length} ${pulledFiles.length == 1 ? "file" : "files"} from remote` - ); - this.lastPulledFiles = pulledFiles; - } - return pulledFiles.length; - } - async fetch() { - if (!await this.remotesAreSet()) { - return; - } - await this.gitManager.fetch(); - this.displayMessage(`Fetched from remote`); - this.offlineMode = false; - dispatchEvent(new CustomEvent("git-refresh")); - } - async mayDeleteConflictFile() { - const file = this.app.vault.getAbstractFileByPath( - this.conflictOutputFile - ); - if (file) { - this.app.workspace.iterateAllLeaves((leaf) => { - var _a2; - if (leaf.view instanceof import_obsidian31.MarkdownView && ((_a2 = leaf.view.file) == null ? void 0 : _a2.path) == file.path) { - leaf.detach(); - } - }); - await this.app.vault.delete(file); - } - } - async stageFile(file) { - if (!await this.isAllInitialized()) return false; - await this.gitManager.stage(file.path, true); - this.displayMessage(`Staged ${file.path}`); - dispatchEvent(new CustomEvent("git-refresh")); - this.setState(0 /* idle */); - return true; - } - async unstageFile(file) { - if (!await this.isAllInitialized()) return false; - await this.gitManager.unstage(file.path, true); - this.displayMessage(`Unstaged ${file.path}`); - dispatchEvent(new CustomEvent("git-refresh")); - this.setState(0 /* idle */); - return true; - } - async switchBranch() { - var _a2; - if (!await this.isAllInitialized()) return; - const branchInfo = await this.gitManager.branchInfo(); - const selectedBranch = await new BranchModal( - branchInfo.branches - ).open(); - if (selectedBranch != void 0) { - await this.gitManager.checkout(selectedBranch); - this.displayMessage(`Switched to ${selectedBranch}`); - (_a2 = this.branchBar) == null ? void 0 : _a2.display(); - return selectedBranch; - } - } - async switchRemoteBranch() { - var _a2; - if (!await this.isAllInitialized()) return; - const selectedBranch = await this.selectRemoteBranch() || ""; - const [remote, branch2] = splitRemoteBranch(selectedBranch); - if (branch2 != void 0 && remote != void 0) { - await this.gitManager.checkout(branch2, remote); - this.displayMessage(`Switched to ${selectedBranch}`); - (_a2 = this.branchBar) == null ? void 0 : _a2.display(); - return selectedBranch; - } - } - async createBranch() { - var _a2; - if (!await this.isAllInitialized()) return; - const newBranch = await new GeneralModal({ - placeholder: "Create new branch" - }).open(); - if (newBranch != void 0) { - await this.gitManager.createBranch(newBranch); - this.displayMessage(`Created new branch ${newBranch}`); - (_a2 = this.branchBar) == null ? void 0 : _a2.display(); - return newBranch; - } - } - async deleteBranch() { - var _a2; - if (!await this.isAllInitialized()) return; - const branchInfo = await this.gitManager.branchInfo(); - if (branchInfo.current) branchInfo.branches.remove(branchInfo.current); - const branch2 = await new GeneralModal({ - options: branchInfo.branches, - placeholder: "Delete branch", - onlySelection: true - }).open(); - if (branch2 != void 0) { - let force = false; - const merged = await this.gitManager.branchIsMerged(branch2); - if (!merged) { - const forceAnswer = await new GeneralModal({ - options: ["YES", "NO"], - placeholder: "This branch isn't merged into HEAD. Force delete?", - onlySelection: true - }).open(); - if (forceAnswer !== "YES") { - return; - } - force = forceAnswer === "YES"; - } - await this.gitManager.deleteBranch(branch2, force); - this.displayMessage(`Deleted branch ${branch2}`); - (_a2 = this.branchBar) == null ? void 0 : _a2.display(); - return branch2; - } - } - // Ensures that the upstream branch is set. - // If not, it will prompt the user to set it. - // - // An exception is when the user has submodules enabled. - // In this case, the upstream branch is not required, - // to allow pulling/pushing only the submodules and not the outer repo. - async remotesAreSet() { - if (this.settings.updateSubmodules) { - return true; - } - if (!(await this.gitManager.branchInfo()).tracking) { - new import_obsidian31.Notice("No upstream branch is set. Please select one."); - return await this.setUpstreamBranch(); - } - return true; - } - async setUpstreamBranch() { - const remoteBranch = await this.selectRemoteBranch(); - if (remoteBranch == void 0) { - this.displayError("Aborted. No upstream-branch is set!", 1e4); - this.setState(0 /* idle */); - return false; - } else { - await this.gitManager.updateUpstreamBranch(remoteBranch); - this.displayMessage(`Set upstream branch to ${remoteBranch}`); - this.setState(0 /* idle */); - return true; - } - } - async setUpAutoBackup() { - if (this.settings.setLastSaveToLastCommit) { - this.clearAutoBackup(); - const lastCommitDate = await this.gitManager.getLastCommitTime(); - if (lastCommitDate) { - this.localStorage.setLastAutoBackup(lastCommitDate.toString()); - } - } - if (!this.timeoutIDBackup && !this.onFileModifyEventRef) { - const lastAutos = this.loadLastAuto(); - if (this.settings.autoSaveInterval > 0) { - const now2 = /* @__PURE__ */ new Date(); - const diff3 = this.settings.autoSaveInterval - Math.round( - (now2.getTime() - lastAutos.backup.getTime()) / 1e3 / 60 - ); - this.startAutoBackup(diff3 <= 0 ? 0 : diff3); - } - } - } - async setUpAutos() { - this.setUpAutoBackup(); - const lastAutos = this.loadLastAuto(); - if (this.settings.differentIntervalCommitAndPush && this.settings.autoPushInterval > 0) { - const now2 = /* @__PURE__ */ new Date(); - const diff3 = this.settings.autoPushInterval - Math.round( - (now2.getTime() - lastAutos.push.getTime()) / 1e3 / 60 - ); - this.startAutoPush(diff3 <= 0 ? 0 : diff3); - } - if (this.settings.autoPullInterval > 0) { - const now2 = /* @__PURE__ */ new Date(); - const diff3 = this.settings.autoPullInterval - Math.round( - (now2.getTime() - lastAutos.pull.getTime()) / 1e3 / 60 - ); - this.startAutoPull(diff3 <= 0 ? 0 : diff3); - } - } - async discardAll() { - await this.gitManager.discardAll({ - status: this.cachedStatus - }); - new import_obsidian31.Notice( - "All local changes have been discarded. New files remain untouched." - ); - } - clearAutos() { - this.clearAutoBackup(); - this.clearAutoPush(); - this.clearAutoPull(); - } - startAutoBackup(minutes) { - let time = (minutes != null ? minutes : this.settings.autoSaveInterval) * 6e4; - if (this.settings.autoBackupAfterFileChange) { - if (minutes === 0) { - this.doAutoBackup(); - } else { - this.onFileModifyEventRef = this.app.vault.on( - "modify", - () => this.autoBackupDebouncer() - ); - this.autoBackupDebouncer = (0, import_obsidian31.debounce)( - () => this.doAutoBackup(), - time, - true - ); - } - } else { - if (time > 2147483647) time = 2147483647; - this.timeoutIDBackup = window.setTimeout( - () => this.doAutoBackup(), - time - ); - } - } - // This is used for both auto backup and commit - doAutoBackup() { - this.promiseQueue.addTask(() => { - if (this.settings.differentIntervalCommitAndPush) { - return this.commit({ fromAutoBackup: true }); - } else { - return this.createBackup(true); - } - }); - this.saveLastAuto(/* @__PURE__ */ new Date(), "backup"); - this.saveSettings(); - this.startAutoBackup(); - } - startAutoPull(minutes) { - let time = (minutes != null ? minutes : this.settings.autoPullInterval) * 6e4; - if (time > 2147483647) time = 2147483647; - this.timeoutIDPull = window.setTimeout(() => { - this.promiseQueue.addTask(() => this.pullChangesFromRemote()); - this.saveLastAuto(/* @__PURE__ */ new Date(), "pull"); - this.saveSettings(); - this.startAutoPull(); - }, time); - } - startAutoPush(minutes) { - let time = (minutes != null ? minutes : this.settings.autoPushInterval) * 6e4; - if (time > 2147483647) time = 2147483647; - this.timeoutIDPush = window.setTimeout(() => { - this.promiseQueue.addTask(() => this.push()); - this.saveLastAuto(/* @__PURE__ */ new Date(), "push"); - this.saveSettings(); - this.startAutoPush(); - }, time); - } - clearAutoBackup() { - var _a2; - let wasActive = false; - if (this.timeoutIDBackup) { - window.clearTimeout(this.timeoutIDBackup); - this.timeoutIDBackup = void 0; - wasActive = true; - } - if (this.onFileModifyEventRef) { - (_a2 = this.autoBackupDebouncer) == null ? void 0 : _a2.cancel(); - this.app.vault.offref(this.onFileModifyEventRef); - this.onFileModifyEventRef = void 0; - wasActive = true; - } - return wasActive; - } - clearAutoPull() { - if (this.timeoutIDPull) { - window.clearTimeout(this.timeoutIDPull); - this.timeoutIDPull = void 0; - return true; - } - return false; - } - clearAutoPush() { - if (this.timeoutIDPush) { - window.clearTimeout(this.timeoutIDPush); - this.timeoutIDPush = void 0; - return true; - } - return false; - } - async handleConflict(conflicted) { - this.setState(6 /* conflicted */); - this.localStorage.setConflict(true); - let lines; - if (conflicted !== void 0) { - lines = [ - "# 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", - "", - ...conflicted.map((e) => { - const file = this.app.vault.getAbstractFileByPath(e); - if (file instanceof import_obsidian31.TFile) { - const link = this.app.metadataCache.fileToLinktext( - file, - "/" - ); - return `- [[${link}]]`; - } else { - return `- Not a file: ${e}`; - } - }), - ` +@@ -0,0 +1,${a.split(` +`).length} @@`.split(` +`),...a.split(` +`).map(o=>`+${o}`)].join(` +`)}}if(r){let a=this.parser.parseFromString(qE(r),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(a)}else{let a=this.contentEl.createDiv({cls:"obsidian-git-center"});a.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),a.createEl("br"),a.createSpan({text:"File not found: "+this.state.file})}}finally{this.gettingDiff=!1}}}};v();var Ak=require("obsidian");v();v();v();v();function ke(){}var eo=t=>t;function Up(t){return t()}function qc(){return Object.create(null)}function Ae(t){t.forEach(Up)}function ya(t){return typeof t=="function"}function it(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function XE(t){return Object.keys(t).length===0}v();var YE=typeof window!="undefined",zp=YE?()=>window.performance.now():()=>Date.now(),to=YE?t=>requestAnimationFrame(t):ke;v();var va=new Set;function ZE(t){va.forEach(e=>{e.c(t)||(va.delete(e),e.f())}),va.size!==0&&to(ZE)}function Gp(t){let e;return va.size===0&&to(ZE),{promise:new Promise(n=>{va.add(e={c:t,f:n})}),abort(){va.delete(e)}}}v();v();v();v();var Vp=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Xc=class t{constructor(e){ct(this,"_listeners","WeakMap"in Vp?new WeakMap:void 0);ct(this,"_observer");ct(this,"options");this.options=e}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(n=>{var r;for(let i of n)t.entries.set(i.target,i),(r=this._listeners.get(i.target))==null||r(i)})}};Xc.entries="WeakMap"in Vp?new WeakMap:void 0;var KE=!1;function JE(){KE=!0}function QE(){KE=!1}function O(t,e){t.appendChild(e)}function Nt(t,e,n){let r=Yc(t);if(!r.getElementById(e)){let i=I("style");i.id=e,i.textContent=n,tk(r,i)}}function Yc(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function ek(t){let e=I("style");return e.textContent="/* empty */",tk(Yc(t),e),e.sheet}function tk(t,e){return O(t.head||t,e),e.sheet}function re(t,e,n){t.insertBefore(e,n||null)}function ne(t){t.parentNode&&t.parentNode.removeChild(t)}function ln(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function xe(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function T(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function nk(t){return Array.from(t.childNodes)}function Oe(t,e){e=""+e,t.data!==e&&(t.data=e)}function Wp(t,e){t.value=e==null?"":e}function Yt(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function ce(t,e,n){t.classList.toggle(e,!!n)}function Zc(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function rk(t){let e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}var Kc=new Map,Jc=0;function ej(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function tj(t,e){let n={stylesheet:ek(e),rules:{}};return Kc.set(t,n),n}function Qc(t,e,n,r,i,a,s,o=0){let l=16.666/r,c=`{ +`;for(let m=0;m<=1;m+=l){let w=e+(n-e)*a(m);c+=m*100+`%{${s(w,1-w)}} +`}let u=c+`100% {${s(n,1-n)}} +}`,f=`__svelte_${ej(u)}_${o}`,h=Yc(t),{stylesheet:d,rules:p}=Kc.get(h)||tj(h,t);p[f]||(p[f]=!0,d.insertRule(`@keyframes ${f} ${u}`,d.cssRules.length));let g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${f} ${r}ms linear ${i}ms 1 both`,Jc+=1,f}function qp(t,e){let n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Jc-=i,Jc||nj())}function nj(){to(()=>{Jc||(Kc.forEach(t=>{let{ownerNode:e}=t.stylesheet;e&&ne(e)}),Kc.clear())})}v();v();v();v();var Sr;function Yn(t){Sr=t}function ik(){if(!Sr)throw new Error("Function called outside component initialization");return Sr}function no(t){ik().$$.on_destroy.push(t)}function Er(t,e){let n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}var ai=[];var je=[],xa=[],ak=[],rj=Promise.resolve(),Yp=!1;function sk(){Yp||(Yp=!0,rj.then(eu))}function wt(t){xa.push(t)}var Xp=new Set,ba=0;function eu(){if(ba!==0)return;let t=Sr;do{try{for(;bat.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),xa=e}var ro;function aj(){return ro||(ro=Promise.resolve(),ro.then(()=>{ro=null})),ro}function Zp(t,e,n){t.dispatchEvent(Zc(`${e?"intro":"outro"}${n}`))}var tu=new Set,Zn;function Ce(){Zn={r:0,c:[],p:Zn}}function Fe(){Zn.r||Ae(Zn.c),Zn=Zn.p}function U(t,e){t&&t.i&&(tu.delete(t),t.i(e))}function X(t,e,n,r){if(t&&t.o){if(tu.has(t))return;tu.add(t),Zn.c.push(()=>{tu.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}var sj={duration:0};function bt(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,l=null,c=null,u;function f(){c&&qp(t,c)}function h(p,g){let m=p.b-s;return g*=Math.abs(m),{a:s,b:p.b,d:m,duration:g,start:p.start,end:p.start+g,group:p.group}}function d(p){let{delay:g=0,duration:m=300,easing:w=eo,tick:b=ke,css:S}=a||sj,k={start:zp()+g,b:p};p||(k.group=Zn,Zn.r+=1),"inert"in t&&(p?u!==void 0&&(t.inert=u):(u=t.inert,t.inert=!0)),o||l?l=k:(S&&(f(),c=Qc(t,s,p,m,g,w,S)),p&&b(0,1),o=h(k,m),wt(()=>Zp(t,p,"start")),Gp(x=>{if(l&&x>l.start&&(o=h(l,m),l=null,Zp(t,o.b,"start"),S&&(f(),c=Qc(t,s,o.b,o.duration,0,w,a.css))),o){if(x>=o.end)b(s=o.b,1-s),Zp(t,o.b,"end"),l||(o.b?f():--o.group.r||Ae(o.group.c)),o=null;else if(x>=o.start){let A=x-o.start;s=o.a+o.d*w(A/o.duration),b(s,1-s)}}return!!(o||l)}))}return{run(p){ya(a)?aj().then(()=>{a=a({direction:p?"in":"out"}),d(p)}):d(p)},end(){f(),o=l=null}}}v();function tt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}v();v();v();var oj=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],lj=new Set([...oj]);v();v();v();function He(t){t&&t.c()}function De(t,e,n){let{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),wt(()=>{let a=t.$$.on_mount.map(Up).filter(ya);t.$$.on_destroy?t.$$.on_destroy.push(...a):Ae(a),t.$$.on_mount=[]}),i.forEach(wt)}function Be(t,e){let n=t.$$;n.fragment!==null&&(ok(n.after_update),Ae(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function uj(t,e){t.$$.dirty[0]===-1&&(ai.push(t),sk(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let p=d.length?d[0]:h;return c.ctx&&i(c.ctx[f],c.ctx[f]=p)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](p),u&&uj(t,f)),h}):[],c.update(),u=!0,Ae(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){JE();let f=nk(e.target);c.fragment&&c.fragment.l(f),f.forEach(ne)}else c.fragment&&c.fragment.c();e.intro&&U(t.$$.fragment),De(t,e.target,e.anchor),QE(),eu()}Yn(l)}var fj;typeof HTMLElement=="function"&&(fj=class extends HTMLElement{constructor(e,n,r){super();ct(this,"$$ctor");ct(this,"$$s");ct(this,"$$c");ct(this,"$$cn",!1);ct(this,"$$d",{});ct(this,"$$r",!1);ct(this,"$$p_d",{});ct(this,"$$l",{});ct(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(e,n,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(n),this.$$c){let i=this.$$c.$on(e,n);this.$$l_u.set(n,i)}super.addEventListener(e,n,r)}removeEventListener(e,n,r){if(super.removeEventListener(e,n,r),this.$$c){let i=this.$$l_u.get(n);i&&(i(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(a){return()=>{let s;return{c:function(){s=I("slot"),a!=="default"&&T(s,"name",a)},m:function(c,u){re(c,s,u)},d:function(c){c&&ne(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let n={},r=rk(this);for(let a of this.$$s)a in r&&(n[a]=[e(a)]);for(let a of this.attributes){let s=this.$$g_p(a.name);s in this.$$d||(this.$$d[s]=Kp(s,a.value,this.$$p_d,"toProp"))}for(let a in this.$$p_d)!(a in this.$$d)&&this[a]!==void 0&&(this.$$d[a]=this[a],delete this[a]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$scope:{ctx:[]}}});let i=()=>{this.$$r=!0;for(let a in this.$$p_d)if(this.$$d[a]=this.$$c.$$.ctx[this.$$c.$$.props[a]],this.$$p_d[a].reflect){let s=Kp(a,this.$$d[a],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,s)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(let a in this.$$l)for(let s of this.$$l[a]){let o=this.$$c.$on(a,s);this.$$l_u.set(s,o)}this.$$l={}}}attributeChangedCallback(e,n,r){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Kp(e,r,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(n=>this.$$p_d[n].attribute===e||!this.$$p_d[n].attribute&&n.toLowerCase()===e)||e}});function Kp(t,e,n,r){var a;let i=(a=n[t])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(i){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(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Ve=class{constructor(){ct(this,"$$");ct(this,"$$set")}$destroy(){Be(this,1),this.$destroy=ke}$on(e,n){if(!ya(n))return ke;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!XE(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};v();v();var lk="4";v();typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(lk);v();function _a(t,e,n,r){function i(a){return a instanceof n?a:new n(function(s){s(a)})}return new(n||(n=Promise))(function(a,s){function o(u){try{c(r.next(u))}catch(f){s(f)}}function l(u){try{c(r.throw(u))}catch(f){s(f)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((r=r.apply(t,e||[])).next())})}var iu=require("obsidian");v();v();var io=require("obsidian");v();v();function ck(t){let e=t-1;return e*e*e+1}function xt(t,{delay:e=0,duration:n=400,easing:r=ck,axis:i="y"}={}){let a=getComputedStyle(t),s=+a.opacity,o=i==="y"?"height":"width",l=parseFloat(a[o]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),f=parseFloat(a[`padding${u[0]}`]),h=parseFloat(a[`padding${u[1]}`]),d=parseFloat(a[`margin${u[0]}`]),p=parseFloat(a[`margin${u[1]}`]),g=parseFloat(a[`border${u[0]}Width`]),m=parseFloat(a[`border${u[1]}Width`]);return{delay:e,duration:n,easing:r,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${o}: ${w*l}px;padding-${c[0]}: ${w*f}px;padding-${c[1]}: ${w*h}px;margin-${c[0]}: ${w*d}px;margin-${c[1]}: ${w*p}px;border-${c[0]}-width: ${w*g}px;border-${c[1]}-width: ${w*m}px;`}}v();var Sa=require("obsidian");function hj(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function uk(t){let e,n,r;return{c(){e=I("div"),T(e,"data-icon","go-to-file"),T(e,"aria-label","Open File"),T(e,"class","clickable-icon")},m(i,a){re(i,e,a),t[7](e),n||(r=[te(e,"auxclick",xe(t[4])),te(e,"click",xe(t[4]))],n=!0)},p:ke,d(i){i&&ne(e),t[7](null),n=!1,Ae(r)}}}function dj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof Sa.TFile,u,f,h=t[0].status+"",d,p,g,m,w,b,S=c&&uk(t);return{c(){var k,x;e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("div"),S&&S.c(),u=J(),f=I("span"),d=Te(h),T(r,"class","tree-item-inner nav-file-title-content"),T(l,"class","buttons"),T(f,"class","type"),T(f,"data-type",p=t[0].status),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",g=t[0].vault_path),T(n,"data-tooltip-position",t[3]),T(n,"aria-label",m=t[0].vault_path),ce(n,"is-active",((k=t[1].plugin.lastDiffViewState)==null?void 0:k.file)==t[0].vault_path&&((x=t[1].plugin.lastDiffViewState)==null?void 0:x.hash)),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(k,x){re(k,e,x),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),S&&S.m(l,null),O(o,u),O(o,f),O(f,d),w||(b=[te(e,"click",xe(t[5])),te(e,"auxclick",xe(t[8])),te(e,"focus",t[6])],w=!0)},p(k,[x]){var A,y;x&1&&i!==(i=Bt(k[0].vault_path)+"")&&Oe(a,i),x&3&&(c=k[1].app.vault.getAbstractFileByPath(k[0].vault_path)instanceof Sa.TFile),c?S?S.p(k,x):(S=uk(k),S.c(),S.m(l,null)):S&&(S.d(1),S=null),x&1&&h!==(h=k[0].status+"")&&Oe(d,h),x&1&&p!==(p=k[0].status)&&T(f,"data-type",p),x&1&&g!==(g=k[0].vault_path)&&T(n,"data-path",g),x&8&&T(n,"data-tooltip-position",k[3]),x&1&&m!==(m=k[0].vault_path)&&T(n,"aria-label",m),x&3&&ce(n,"is-active",((A=k[1].plugin.lastDiffViewState)==null?void 0:A.file)==k[0].vault_path&&((y=k[1].plugin.lastDiffViewState)==null?void 0:y.hash))},i:ke,o:ke,d(k){k&&ne(e),S&&S.d(),w=!1,Ae(b)}}}function pj(t,e,n){let r,{diff:i}=e,{view:a}=e,s=[];window.setTimeout(()=>s.forEach(h=>(0,Sa.setIcon)(h,h.getAttr("data-icon"))),0);function o(h){var d;let p=a.app.vault.getAbstractFileByPath(i.vault_path);p instanceof Sa.TFile&&((d=Xt(a.app,h))===null||d===void 0||d.openFile(p).catch(g=>a.plugin.displayError(g)))}function l(h){var d;(d=Xt(a.app,h))===null||d===void 0||d.setViewState({type:Ct.type,active:!0,state:{file:i.path,staged:!1,hash:i.hash}})}function c(h){Er.call(this,t,h)}function u(h){je[h?"unshift":"push"](()=>{s[0]=h,n(2,s)})}let f=h=>{h.button==2?In(a.app,h,i.vault_path,a.leaf,"git-history"):l(h)};return t.$$set=h=>{"diff"in h&&n(0,i=h.diff),"view"in h&&n(1,a=h.view)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,r,o,l,c,u,f]}var Jp=class extends Ve{constructor(e){super(),at(this,e,pj,dj,it,{diff:0,view:1},hj)}},nu=Jp;v();function mj(t){Nt(t,"svelte-1lnl15d","main.svelte-1lnl15d .nav-folder-title-content.svelte-1lnl15d{display:flex;align-items:center}")}function fk(t,e,n){let r=t.slice();return r[8]=e[n],r}function gj(t){let e,n,r,i,a,s,o,l=t[8].title+"",c,u,f,h,d,p,g;function m(){return t[7](t[8])}let w=!t[4][t[8].title]&&hk(t);return{c(){e=I("div"),n=I("div"),r=I("div"),i=J(),a=I("div"),a.innerHTML='',s=J(),o=I("div"),c=Te(l),f=J(),w&&w.c(),h=J(),T(r,"data-icon","folder"),Yt(r,"padding-right","5px"),Yt(r,"display","flex"),T(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(a,"is-collapsed",t[4][t[8].title]),T(o,"class","tree-item-inner nav-folder-title-content svelte-1lnl15d"),T(n,"class","tree-item-self is-clickable nav-folder-title"),T(n,"data-tooltip-position",t[5]),T(n,"aria-label",u=t[8].vaultPath),T(e,"class","tree-item nav-folder"),ce(e,"is-collapsed",t[4][t[8].title])},m(b,S){re(b,e,S),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,f),w&&w.m(e,null),O(e,h),d=!0,p||(g=te(n,"click",m),p=!0)},p(b,S){t=b,(!d||S&17)&&ce(a,"is-collapsed",t[4][t[8].title]),(!d||S&1)&&l!==(l=t[8].title+"")&&Oe(c,l),(!d||S&32)&&T(n,"data-tooltip-position",t[5]),(!d||S&1&&u!==(u=t[8].vaultPath))&&T(n,"aria-label",u),t[4][t[8].title]?w&&(Ce(),X(w,1,1,()=>{w=null}),Fe()):w?(w.p(t,S),S&17&&U(w,1)):(w=hk(t),w.c(),U(w,1),w.m(e,h)),(!d||S&17)&&ce(e,"is-collapsed",t[4][t[8].title])},i(b){d||(U(w),d=!0)},o(b){X(w),d=!1},d(b){b&&ne(e),w&&w.d(),p=!1,g()}}}function yj(t){let e,n,r,i;return n=new nu({props:{diff:t[8].data,view:t[2]}}),{c(){e=I("div"),He(n.$$.fragment),r=J()},m(a,s){re(a,e,s),De(n,e,null),O(e,r),i=!0},p(a,s){let o={};s&1&&(o.diff=a[8].data),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(U(n.$$.fragment,a),i=!0)},o(a){X(n.$$.fragment,a),i=!1},d(a){a&&ne(e),Be(n)}}}function hk(t){let e,n,r,i;return n=new ru({props:{hierarchy:t[8],plugin:t[1],view:t[2]}}),{c(){e=I("div"),He(n.$$.fragment),T(e,"class","tree-item-children nav-folder-children")},m(a,s){re(a,e,s),De(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[8]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(U(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){X(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Be(n),a&&r&&r.end()}}}function dk(t){let e,n,r,i,a=[yj,gj],s=[];function o(l,c){return l[8].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=wa()},m(l,c){s[e].m(l,c),re(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ce(),X(s[u],1,1,()=>{s[u]=null}),Fe(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),U(n,1),n.m(r.parentNode,r))},i(l){i||(U(n),i=!0)},o(l){X(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function vj(t){let e,n,r=tt(t[0].children),i=[];for(let s=0;sX(i[s],1,1,()=>{i[s]=null});return{c(){e=I("main");for(let s=0;sc(f);return t.$$set=f=>{"hierarchy"in f&&n(0,i=f.hierarchy),"plugin"in f&&n(1,a=f.plugin),"view"in f&&n(2,s=f.view),"topLevel"in f&&n(3,o=f.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(5,r=s.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,o,l,r,c,u]}var ru=class extends Ve{constructor(e){super(),at(this,e,wj,vj,it,{hierarchy:0,plugin:1,view:2,topLevel:3},mj)}},pk=ru;function mk(t,e,n){let r=t.slice();return r[9]=e[n],r}function gk(t){let e,n=t[0].refs.join(", ")+"",r;return{c(){e=I("div"),r=Te(n),T(e,"class","git-ref")},m(i,a){re(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[0].refs.join(", ")+"")&&Oe(r,n)},d(i){i&&ne(e)}}}function yk(t){let e,n=t[7](t[0])+"",r;return{c(){e=I("div"),r=Te(n),T(e,"class","git-author")},m(i,a){re(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[7](i[0])+"")&&Oe(r,n)},d(i){i&&ne(e)}}}function vk(t){let e,n=(0,io.moment)(t[0].date).format(t[3].settings.commitDateFormat)+"",r;return{c(){e=I("div"),r=Te(n),T(e,"class","git-date")},m(i,a){re(i,e,a),O(e,r)},p(i,a){a&9&&n!==(n=(0,io.moment)(i[0].date).format(i[3].settings.commitDateFormat)+"")&&Oe(r,n)},d(i){i&&ne(e)}}}function wk(t){let e,n,r,i,a,s=[xj,bj],o=[];function l(c,u){return c[2]?0:1}return n=l(t,-1),r=o[n]=s[n](t),{c(){e=I("div"),r.c(),T(e,"class","tree-item-children nav-folder-children")},m(c,u){re(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ce(),X(o[f],1,1,()=>{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function bj(t){let e,n,r=tt(t[0].diff.files),i=[];for(let s=0;sX(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s0&&gk(t),S=t[3].settings.authorInHistoryView!="hide"&&((A=t[0].author)==null?void 0:A.name)&&yk(t),k=t[3].settings.dateInHistoryView&&vk(t),x=!t[4]&&wk(t);return{c(){var y;e=I("main"),n=I("div"),r=I("div"),i=I("div"),i.innerHTML='',a=J(),s=I("div"),b&&b.c(),o=J(),S&&S.c(),l=J(),k&&k.c(),c=J(),u=I("div"),h=Te(f),p=J(),x&&x.c(),T(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(i,"is-collapsed",t[4]),T(u,"class","tree-item-inner nav-folder-title-content"),T(r,"class","tree-item-self is-clickable nav-folder-title"),T(r,"aria-label",d=`${t[0].refs.length>0?t[0].refs.join(", ")+` +`:""}${(y=t[0].author)==null?void 0:y.name} +${(0,io.moment)(t[0].date).format(t[3].settings.commitDateFormat)} +${t[0].message}`),T(r,"data-tooltip-position",t[5]),T(n,"class","tree-item nav-folder"),ce(n,"is-collapsed",t[4])},m(y,E){re(y,e,E),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),b&&b.m(s,null),O(s,o),S&&S.m(s,null),O(s,l),k&&k.m(s,null),O(s,c),O(s,u),O(u,h),O(n,p),x&&x.m(n,null),g=!0,m||(w=te(r,"click",t[8]),m=!0)},p(y,[E]){var _,C;(!g||E&16)&&ce(i,"is-collapsed",y[4]),y[0].refs.length>0?b?b.p(y,E):(b=gk(y),b.c(),b.m(s,o)):b&&(b.d(1),b=null),y[3].settings.authorInHistoryView!="hide"&&((_=y[0].author)!=null&&_.name)?S?S.p(y,E):(S=yk(y),S.c(),S.m(s,l)):S&&(S.d(1),S=null),y[3].settings.dateInHistoryView?k?k.p(y,E):(k=vk(y),k.c(),k.m(s,c)):k&&(k.d(1),k=null),(!g||E&1)&&f!==(f=y[0].message+"")&&Oe(h,f),(!g||E&9&&d!==(d=`${y[0].refs.length>0?y[0].refs.join(", ")+` +`:""}${(C=y[0].author)==null?void 0:C.name} +${(0,io.moment)(y[0].date).format(y[3].settings.commitDateFormat)} +${y[0].message}`))&&T(r,"aria-label",d),(!g||E&32)&&T(r,"data-tooltip-position",y[5]),y[4]?x&&(Ce(),X(x,1,1,()=>{x=null}),Fe()):x?(x.p(y,E),E&16&&U(x,1)):(x=wk(y),x.c(),U(x,1),x.m(n,null)),(!g||E&16)&&ce(n,"is-collapsed",y[4])},i(y){g||(U(x),g=!0)},o(y){X(x),g=!1},d(y){y&&ne(e),b&&b.d(),S&&S.d(),k&&k.d(),x&&x.d(),m=!1,w()}}}function Sj(t,e,n){let r,i,{log:a}=e,{view:s}=e,{showTree:o}=e,{plugin:l}=e,c=!0;function u(h){let d=h.author.name;if(l.settings.authorInHistoryView=="full")return d;if(l.settings.authorInHistoryView=="initials")return d.split(" ").filter(g=>g.length>0).map(g=>g[0].toUpperCase()).join("")}let f=()=>n(4,c=!c);return t.$$set=h=>{"log"in h&&n(0,a=h.log),"view"in h&&n(1,s=h.view),"showTree"in h&&n(2,o=h.showTree),"plugin"in h&&n(3,l=h.plugin)},t.$$.update=()=>{t.$$.dirty&9&&n(6,r={title:"",path:"",vaultPath:"",children:l.gitManager.getTreeStructure(a.diff.files)}),t.$$.dirty&2&&n(5,i=s.leaf.getRoot().side=="left"?"right":"left")},[a,s,o,l,c,i,r,u,f]}var Qp=class extends Ve{constructor(e){super(),at(this,e,Sj,_j,it,{log:0,view:1,showTree:2,plugin:3})}},xk=Qp;function _k(t,e,n){let r=t.slice();return r[13]=e[n],r}function Sk(t){let e,n,r=tt(t[6]),i=[];for(let s=0;sX(i[s],1,1,()=>{i[s]=null});return{c(){e=I("div");for(let s=0;s{h=null}),Fe())},i(d){c||(U(h),c=!0)},o(d){X(h),c=!1},d(d){d&&ne(e),t[8](null),t[10](null),h&&h.d(),u=!1,Ae(f)}}}function kj(t,e,n){let{plugin:r}=e,{view:i}=e,a,s=[],o,l=r.settings.treeStructure,c,u;c=i.app.workspace.on("obsidian-git:view-refresh",()=>void h().catch(console.error)),h().catch(console.error),r.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{s.forEach(m=>(0,iu.setIcon)(m,m.getAttr("data-icon"))),(0,iu.setIcon)(u,l?"list":"folder")},0)}),no(()=>{i.app.workspace.offref(c)});function f(){i.app.workspace.trigger("obsidian-git:refresh")}function h(){return _a(this,void 0,void 0,function*(){if(!r.gitReady){n(6,o=void 0);return}n(4,a=!0);let m=r.gitManager instanceof Le;n(6,o=yield r.gitManager.log(void 0,!1,m?50:10)),n(4,a=!1)})}function d(m){je[m?"unshift":"push"](()=>{u=m,n(3,u)})}let p=()=>{n(2,l=!l),n(0,r.settings.treeStructure=l,r),r.saveSettings()};function g(m){je[m?"unshift":"push"](()=>{s[6]=m,n(5,s)})}return t.$$set=m=>{"plugin"in m&&n(0,r=m.plugin),"view"in m&&n(1,i=m.view)},t.$$.update=()=>{t.$$.dirty&12&&u&&(u.empty(),(0,iu.setIcon)(u,l?"list":"folder"))},[r,i,l,u,a,s,o,f,d,p,g]}var em=class extends Ve{constructor(e){super(),at(this,e,kj,Ej,it,{plugin:0,view:1})}},kk=em;var ao=class extends Ak.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return nn.type}getDisplayText(){return nn.name}getIcon(){return nn.icon}onClose(){var e;return(e=this._view)==null||e.$destroy(),super.onClose()}reload(){var e;(e=this._view)==null||e.$destroy(),this._view=new kk({target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};v();var Tk=require("obsidian"),au=class extends Tk.FuzzySuggestModal{constructor(n,r){super(n.app);this.branches=r;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(n){return n}onChooseItem(n,r){this.resolve(n)}openAndGetReslt(){return new Promise(n=>{this.resolve=n,this.open()})}onClose(){new Promise(n=>setTimeout(n,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};v();var Zk=require("obsidian");v();var Ta=require("obsidian");v();var Ck=require("obsidian"),kr=class extends Ck.Modal{constructor(n,r,i){super(n);this.deletion=r;this.filename=i;this.resolve=null}myOpen(){return this.open(),new Promise(n=>{this.resolve=n})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText(`${this.deletion?"Delete":"Discard"} this file?`),n.createEl("p").setText(`Do you really want to ${this.deletion?"delete":"discard the changes of"} "${this.filename}"`);let i=n.createDiv({cls:"modal-button-container"}),a=i.createEl("button",{cls:"mod-warning",text:this.deletion?"Delete":"Discard"});a.addEventListener("click",()=>{this.resolve&&this.resolve(!0),this.close()}),a.addEventListener("keypress",()=>{this.resolve&&this.resolve(!0),this.close()});let s=i.createEl("button",{text:"Cancel"});s.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),s.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:n}=this;n.empty()}};v();var Ea=require("obsidian");v();v();var Aj=Ze(Fk()),Ar=require("obsidian");function si(t,e,n){let r=t.target;app.workspace.trigger("hover-link",{event:t,source:e.getViewType(),hoverParent:e,targetEl:r,linktext:n})}function Tj(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function Mk(t){let e,n,r;return{c(){e=I("div"),T(e,"data-icon","go-to-file"),T(e,"aria-label","Open File"),T(e,"class","clickable-icon")},m(i,a){re(i,e,a),t[11](e),n||(r=[te(e,"auxclick",xe(t[5])),te(e,"click",xe(t[5]))],n=!0)},p:ke,d(i){i&&ne(e),t[11](null),n=!1,Ae(r)}}}function Cj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof Ea.TFile,u,f,h,d,p,g,m=t[0].working_dir+"",w,b,S,k,x,A,y=c&&Mk(t);return{c(){var E,_,C;e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("div"),y&&y.c(),u=J(),f=I("div"),h=J(),d=I("div"),p=J(),g=I("div"),w=Te(m),T(r,"class","tree-item-inner nav-file-title-content"),T(f,"data-icon","undo"),T(f,"aria-label","Discard"),T(f,"class","clickable-icon"),T(d,"data-icon","plus"),T(d,"aria-label","Stage"),T(d,"class","clickable-icon"),T(l,"class","buttons"),T(g,"class","type"),T(g,"data-type",b=t[0].working_dir),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",S=t[0].vault_path),T(n,"data-tooltip-position",t[3]),T(n,"aria-label",k=t[0].vault_path),ce(n,"is-active",((E=t[1].plugin.lastDiffViewState)==null?void 0:E.file)==t[0].vault_path&&!((_=t[1].plugin.lastDiffViewState)!=null&&_.hash)&&!((C=t[1].plugin.lastDiffViewState)!=null&&C.staged)),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(E,_){re(E,e,_),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),y&&y.m(l,null),O(l,u),O(l,f),t[12](f),O(l,h),O(l,d),t[13](d),O(o,p),O(o,g),O(g,w),x||(A=[te(f,"click",xe(t[8])),te(d,"click",xe(t[6])),te(e,"mouseover",t[4]),te(e,"click",xe(t[7])),te(e,"auxclick",xe(t[14])),te(e,"focus",t[10])],x=!0)},p(E,[_]){var C,M,L;_&1&&i!==(i=Bt(E[0].vault_path)+"")&&Oe(a,i),_&3&&(c=E[1].app.vault.getAbstractFileByPath(E[0].vault_path)instanceof Ea.TFile),c?y?y.p(E,_):(y=Mk(E),y.c(),y.m(l,u)):y&&(y.d(1),y=null),_&1&&m!==(m=E[0].working_dir+"")&&Oe(w,m),_&1&&b!==(b=E[0].working_dir)&&T(g,"data-type",b),_&1&&S!==(S=E[0].vault_path)&&T(n,"data-path",S),_&8&&T(n,"data-tooltip-position",E[3]),_&1&&k!==(k=E[0].vault_path)&&T(n,"aria-label",k),_&3&&ce(n,"is-active",((C=E[1].plugin.lastDiffViewState)==null?void 0:C.file)==E[0].vault_path&&!((M=E[1].plugin.lastDiffViewState)!=null&&M.hash)&&!((L=E[1].plugin.lastDiffViewState)!=null&&L.staged))},i:ke,o:ke,d(E){E&&ne(e),y&&y.d(),t[12](null),t[13](null),x=!1,Ae(A)}}}function Fj(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(b=>(0,Ea.setIcon)(b,b.getAttr("data-icon"))),0);function l(b){a.app.vault.getAbstractFileByPath(i.vault_path)&&si(b,a,i.vault_path)}function c(b){var S;let k=a.app.vault.getAbstractFileByPath(i.vault_path);k instanceof Ea.TFile&&((S=Xt(a.app,b))===null||S===void 0||S.openFile(k).catch(x=>a.plugin.displayError(x)))}function u(){s.stage(i.path,!1).catch(b=>a.plugin.displayError(b)).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")})}function f(b){var S;(S=Xt(a.app,b))===null||S===void 0||S.setViewState({type:Ct.type,active:!0,state:{file:i.path,staged:!1}})}function h(){let b=i.working_dir=="U";new kr(a.app,b,i.vault_path).myOpen().then(S=>{if(S===!0)return b?a.app.vault.adapter.remove(i.vault_path).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")}):s.discard(i.path).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")})},S=>a.plugin.displayError(S))}function d(b){Er.call(this,t,b)}function p(b){je[b?"unshift":"push"](()=>{o[1]=b,n(2,o)})}function g(b){je[b?"unshift":"push"](()=>{o[0]=b,n(2,o)})}function m(b){je[b?"unshift":"push"](()=>{o[2]=b,n(2,o)})}let w=b=>{b.button==2?In(a.app,b,i.vault_path,a.leaf,"git-source-control"):f(b)};return t.$$set=b=>{"change"in b&&n(0,i=b.change),"view"in b&&n(1,a=b.view),"manager"in b&&n(9,s=b.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,h,s,d,p,g,m,w]}var nm=class extends Ve{constructor(e){super(),at(this,e,Fj,Cj,it,{change:0,view:1,manager:9},Tj)}},su=nm;v();var Ok=require("obsidian");function Mj(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function Oj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[0].working_dir+"",u,f,h,d,p,g;return{c(){e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("span"),u=Te(c),T(r,"class","tree-item-inner nav-file-title-content"),T(l,"class","type"),T(l,"data-type",f=t[0].working_dir),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",h=t[0].vault_path),T(n,"data-tooltip-position",t[2]),T(n,"aria-label",d=t[0].vault_path),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(m,w){re(m,e,w),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),O(l,u),p||(g=[te(e,"mouseover",t[3]),te(e,"click",xe(t[4])),te(e,"auxclick",xe(t[6])),te(e,"focus",t[5])],p=!0)},p(m,[w]){w&1&&i!==(i=Bt(m[0].vault_path)+"")&&Oe(a,i),w&1&&c!==(c=m[0].working_dir+"")&&Oe(u,c),w&1&&f!==(f=m[0].working_dir)&&T(l,"data-type",f),w&1&&h!==(h=m[0].vault_path)&&T(n,"data-path",h),w&4&&T(n,"data-tooltip-position",m[2]),w&1&&d!==(d=m[0].vault_path)&&T(n,"aria-label",d)},i:ke,o:ke,d(m){m&&ne(e),p=!1,Ae(g)}}}function Pj(t,e,n){let r,{change:i}=e,{view:a}=e;function s(u){a.app.vault.getAbstractFileByPath(i.vault_path)&&si(u,a,i.vault_path)}function o(u){var f;let h=a.app.vault.getAbstractFileByPath(i.vault_path);h instanceof Ok.TFile&&((f=Xt(a.app,u))===null||f===void 0||f.openFile(h).catch(d=>a.plugin.displayError(d)))}function l(u){Er.call(this,t,u)}let c=u=>{u.button==2?In(a.app,u,i.vault_path,a.leaf,"git-source-control"):o(u)};return t.$$set=u=>{"change"in u&&n(0,i=u.change),"view"in u&&n(1,a=u.view)},t.$$.update=()=>{t.$$.dirty&2&&n(2,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,r,s,o,l,c]}var rm=class extends Ve{constructor(e){super(),at(this,e,Pj,Oj,it,{change:0,view:1},Mj)}},ou=rm;v();var ka=require("obsidian");function Ij(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function Pk(t){let e,n,r;return{c(){e=I("div"),T(e,"data-icon","go-to-file"),T(e,"aria-label","Open File"),T(e,"class","clickable-icon")},m(i,a){re(i,e,a),t[10](e),n||(r=te(e,"click",xe(t[5])),n=!0)},p:ke,d(i){i&&ne(e),t[10](null),n=!1,r()}}}function Rj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof ka.TFile,u,f,h,d,p=t[0].index+"",g,m,w,b,S,k,x=c&&Pk(t);return{c(){var A,y,E;e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("div"),x&&x.c(),u=J(),f=I("div"),h=J(),d=I("div"),g=Te(p),T(r,"class","tree-item-inner nav-file-title-content"),T(f,"data-icon","minus"),T(f,"aria-label","Unstage"),T(f,"class","clickable-icon"),T(l,"class","buttons"),T(d,"class","type"),T(d,"data-type",m=t[0].index),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",w=t[0].vault_path),T(n,"data-tooltip-position",t[3]),T(n,"aria-label",b=t[0].vault_path),ce(n,"is-active",((A=t[1].plugin.lastDiffViewState)==null?void 0:A.file)==t[0].vault_path&&!((y=t[1].plugin.lastDiffViewState)!=null&&y.hash)&&((E=t[1].plugin.lastDiffViewState)==null?void 0:E.staged)),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(A,y){re(A,e,y),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),x&&x.m(l,null),O(l,u),O(l,f),t[11](f),O(o,h),O(o,d),O(d,g),S||(k=[te(f,"click",xe(t[7])),te(e,"mouseover",t[4]),te(e,"focus",t[9]),te(e,"click",xe(t[6])),te(e,"auxclick",xe(t[12]))],S=!0)},p(A,[y]){var E,_,C;y&1&&i!==(i=Bt(A[0].vault_path)+"")&&Oe(a,i),y&3&&(c=A[1].app.vault.getAbstractFileByPath(A[0].vault_path)instanceof ka.TFile),c?x?x.p(A,y):(x=Pk(A),x.c(),x.m(l,u)):x&&(x.d(1),x=null),y&1&&p!==(p=A[0].index+"")&&Oe(g,p),y&1&&m!==(m=A[0].index)&&T(d,"data-type",m),y&1&&w!==(w=A[0].vault_path)&&T(n,"data-path",w),y&8&&T(n,"data-tooltip-position",A[3]),y&1&&b!==(b=A[0].vault_path)&&T(n,"aria-label",b),y&3&&ce(n,"is-active",((E=A[1].plugin.lastDiffViewState)==null?void 0:E.file)==A[0].vault_path&&!((_=A[1].plugin.lastDiffViewState)!=null&&_.hash)&&((C=A[1].plugin.lastDiffViewState)==null?void 0:C.staged))},i:ke,o:ke,d(A){A&&ne(e),x&&x.d(),t[11](null),S=!1,Ae(k)}}}function Lj(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(m=>(0,ka.setIcon)(m,m.getAttr("data-icon"))),0);function l(m){a.app.vault.getFileByPath(i.vault_path)&&si(m,a,i.vault_path)}function c(m){var w;let b=a.app.vault.getAbstractFileByPath(i.vault_path);b instanceof ka.TFile&&((w=Xt(a.app,m))===null||w===void 0||w.openFile(b).catch(S=>a.plugin.displayError(S)))}function u(m){var w;(w=Xt(a.app,m))===null||w===void 0||w.setViewState({type:Ct.type,active:!0,state:{file:i.path,staged:!0}})}function f(){s.unstage(i.path,!1).catch(m=>a.plugin.displayError(m)).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")})}function h(m){Er.call(this,t,m)}function d(m){je[m?"unshift":"push"](()=>{o[1]=m,n(2,o)})}function p(m){je[m?"unshift":"push"](()=>{o[0]=m,n(2,o)})}let g=m=>{m.button==2?In(a.app,m,i.vault_path,a.leaf,"git-source-control"):u(m)};return t.$$set=m=>{"change"in m&&n(0,i=m.change),"view"in m&&n(1,a=m.view),"manager"in m&&n(8,s=m.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,s,h,d,p,g]}var im=class extends Ve{constructor(e){super(),at(this,e,Lj,Rj,it,{change:0,view:1,manager:8},Ij)}},lu=im;v();v();function Ik(t){let e,n,r,i="And "+(t[0].length-500)+" more files",a,s;return{c(){e=I("div"),n=I("div"),r=I("div"),a=Te(i),T(r,"class","tree-item-inner nav-file-title-content"),T(n,"class","tree-item-self nav-file-title"),T(n,"aria-label",s="And "+(t[0].length-500)+" more files"),T(e,"class","tree-item nav-file")},m(o,l){re(o,e,l),O(e,n),O(n,r),O(r,a)},p(o,l){l&1&&i!==(i="And "+(o[0].length-500)+" more files")&&Oe(a,i),l&1&&s!==(s="And "+(o[0].length-500)+" more files")&&T(n,"aria-label",s)},d(o){o&&ne(e)}}}function jj(t){let e,n=t[0].length>500&&Ik(t);return{c(){e=I("main"),n&&n.c()},m(r,i){re(r,e,i),n&&n.m(e,null)},p(r,[i]){r[0].length>500?n?n.p(r,i):(n=Ik(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ke,o:ke,d(r){r&&ne(e),n&&n.d()}}}function Dj(t,e,n){let{files:r}=e;return t.$$set=i=>{"files"in i&&n(0,r=i.files)},[r]}var am=class extends Ve{constructor(e){super(),at(this,e,Dj,jj,it,{files:0})}},Aa=am;function Nj(t){Nt(t,"svelte-hup5mn","main.svelte-hup5mn .nav-folder-title.svelte-hup5mn{align-items:center}")}function Rk(t,e,n){let r=t.slice();return r[18]=e[n],r}function $j(t){let e,n,r,i,a,s,o,l=t[18].title+"",c,u,f,h,d,p,g,m,w,b,S;function k(C,M){return C[3]==0?zj:Uj}let x=k(t,-1),A=x(t),y=!t[5][t[18].title]&&Lk(t);function E(){return t[14](t[18])}function _(...C){return t[15](t[18],...C)}return{c(){e=I("div"),n=I("div"),r=I("div"),i=J(),a=I("div"),a.innerHTML='',s=J(),o=I("div"),c=Te(l),u=J(),f=I("div"),h=I("div"),A.c(),d=J(),p=I("div"),m=J(),y&&y.c(),T(r,"data-icon","folder"),Yt(r,"padding-right","5px"),Yt(r,"display","flex"),T(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(a,"is-collapsed",t[5][t[18].title]),T(o,"class","tree-item-inner nav-folder-title-content"),Yt(p,"width","11px"),T(h,"class","buttons"),T(f,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-folder-title svelte-hup5mn"),T(n,"data-tooltip-position",t[6]),T(n,"aria-label",g=t[18].vaultPath),T(e,"class","tree-item nav-folder"),ce(e,"is-collapsed",t[5][t[18].title])},m(C,M){re(C,e,M),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(n,u),O(n,f),O(f,h),A.m(h,null),O(h,d),O(h,p),O(e,m),y&&y.m(e,null),w=!0,b||(S=[te(e,"click",xe(E)),te(e,"auxclick",xe(_))],b=!0)},p(C,M){t=C,(!w||M&33)&&ce(a,"is-collapsed",t[5][t[18].title]),(!w||M&1)&&l!==(l=t[18].title+"")&&Oe(c,l),x===(x=k(t,M))&&A?A.p(t,M):(A.d(1),A=x(t),A&&(A.c(),A.m(h,d))),(!w||M&64)&&T(n,"data-tooltip-position",t[6]),(!w||M&1&&g!==(g=t[18].vaultPath))&&T(n,"aria-label",g),t[5][t[18].title]?y&&(Ce(),X(y,1,1,()=>{y=null}),Fe()):y?(y.p(t,M),M&33&&U(y,1)):(y=Lk(t),y.c(),U(y,1),y.m(e,null)),(!w||M&33)&&ce(e,"is-collapsed",t[5][t[18].title])},i(C){w||(U(y),w=!0)},o(C){X(y),w=!1},d(C){C&&ne(e),A.d(),y&&y.d(),b=!1,Ae(S)}}}function Hj(t){let e,n,r,i,a=[Wj,Vj,Gj],s=[];function o(l,c){return l[3]==0?0:l[3]==1?1:l[3]==2?2:-1}return~(n=o(t,-1))&&(r=s[n]=a[n](t)),{c(){e=I("div"),r&&r.c()},m(l,c){re(l,e,c),~n&&s[n].m(e,null),i=!0},p(l,c){let u=n;n=o(l,c),n===u?~n&&s[n].p(l,c):(r&&(Ce(),X(s[u],1,1,()=>{s[u]=null}),Fe()),~n?(r=s[n],r?r.p(l,c):(r=s[n]=a[n](l),r.c()),U(r,1),r.m(e,null)):r=null)},i(l){i||(U(r),i=!0)},o(l){X(r),i=!1},d(l){l&&ne(e),~n&&s[n].d()}}}function Uj(t){let e,n,r,i,a;function s(){return t[12](t[18])}function o(){return t[13](t[18])}return{c(){e=I("div"),e.innerHTML='',n=J(),r=I("div"),r.innerHTML='',T(e,"data-icon","undo"),T(e,"aria-label","Discard"),T(e,"class","clickable-icon"),T(r,"data-icon","plus"),T(r,"aria-label","Stage"),T(r,"class","clickable-icon")},m(l,c){re(l,e,c),re(l,n,c),re(l,r,c),i||(a=[te(e,"click",xe(s)),te(r,"click",xe(o))],i=!0)},p(l,c){t=l},d(l){l&&(ne(e),ne(n),ne(r)),i=!1,Ae(a)}}}function zj(t){let e,n,r;function i(){return t[11](t[18])}return{c(){e=I("div"),e.innerHTML='',T(e,"data-icon","minus"),T(e,"aria-label","Unstage"),T(e,"class","clickable-icon")},m(a,s){re(a,e,s),n||(r=te(e,"click",xe(i)),n=!0)},p(a,s){t=a},d(a){a&&ne(e),n=!1,r()}}}function Lk(t){let e,n,r,i;return n=new cu({props:{hierarchy:t[18],plugin:t[1],view:t[2],fileType:t[3]}}),{c(){e=I("div"),He(n.$$.fragment),T(e,"class","tree-item-children nav-folder-children")},m(a,s){re(a,e,s),De(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[18]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),s&8&&(o.fileType=a[3]),n.$set(o)},i(a){i||(U(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){X(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Be(n),a&&r&&r.end()}}}function Gj(t){let e,n;return e=new ou({props:{change:t[18].data,view:t[2]}}),{c(){He(e.$$.fragment)},m(r,i){De(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[18].data),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(U(e.$$.fragment,r),n=!0)},o(r){X(e.$$.fragment,r),n=!1},d(r){Be(e,r)}}}function Vj(t){let e,n;return e=new su({props:{change:t[18].data,manager:t[1].gitManager,view:t[2]}}),{c(){He(e.$$.fragment)},m(r,i){De(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[18].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(U(e.$$.fragment,r),n=!0)},o(r){X(e.$$.fragment,r),n=!1},d(r){Be(e,r)}}}function Wj(t){let e,n;return e=new lu({props:{change:t[18].data,manager:t[1].gitManager,view:t[2]}}),{c(){He(e.$$.fragment)},m(r,i){De(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[18].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(U(e.$$.fragment,r),n=!0)},o(r){X(e.$$.fragment,r),n=!1},d(r){Be(e,r)}}}function jk(t){let e,n,r,i,a=[Hj,$j],s=[];function o(l,c){return l[18].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=wa()},m(l,c){s[e].m(l,c),re(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ce(),X(s[u],1,1,()=>{s[u]=null}),Fe(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),U(n,1),n.m(r.parentNode,r))},i(l){i||(U(n),i=!0)},o(l){X(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function qj(t){let e,n,r,i,a=tt(vr(t[0].children,500)),s=[];for(let l=0;lX(s[l],1,1,()=>{s[l]=null});return r=new Aa({props:{files:t[0].children}}),{c(){e=I("main");for(let l=0;l100;function h(x){o.gitManager.stageAll({dir:x}).catch(A=>o.displayError(A)).finally(()=>{l.app.workspace.trigger("obsidian-git:refresh")})}function d(x){o.gitManager.unstageAll({dir:x}).catch(A=>o.displayError(A)).finally(()=>{l.app.workspace.trigger("obsidian-git:refresh")})}function p(x){new kr(l.app,!1,x.vaultPath).myOpen().then(A=>{if(A===!0)return o.gitManager.discardAll({dir:x.path,status:o.cachedStatus}).finally(()=>{l.app.workspace.trigger("obsidian-git:refresh")})},A=>o.displayError(A))}function g(x){n(5,f[x.title]=!f[x.title],f)}let m=x=>d(x.path),w=x=>p(x),b=x=>h(x.path),S=x=>g(x),k=(x,A)=>In(l.app,A,x.vaultPath,l.leaf,"git-source-control");return t.$$set=x=>{"hierarchy"in x&&n(0,s=x.hierarchy),"plugin"in x&&n(1,o=x.plugin),"view"in x&&n(2,l=x.view),"fileType"in x&&n(3,c=x.fileType),"topLevel"in x&&n(4,u=x.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(6,r=l.leaf.getRoot().side=="left"?"right":"left")},[s,o,l,c,u,f,r,h,d,p,g,m,w,b,S,k]}var cu=class extends Ve{constructor(e){super(),at(this,e,Xj,qj,it,{hierarchy:0,plugin:1,view:2,fileType:3,topLevel:4},Nj)}},uu=cu;function Yj(t){Nt(t,"svelte-11adhly",`.commit-msg-input.svelte-11adhly.svelte-11adhly{width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field)}.git-commit-msg.svelte-11adhly.svelte-11adhly{position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto}main.svelte-11adhly .git-tools .files-count.svelte-11adhly{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}.nav-folder-title.svelte-11adhly.svelte-11adhly{align-items:center}.git-commit-msg-clear-button.svelte-11adhly.svelte-11adhly{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-11adhly.svelte-11adhly: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 Dk(t,e,n){let r=t.slice();return r[42]=e[n],r}function Bk(t,e,n){let r=t.slice();return r[42]=e[n],r}function Nk(t,e,n){let r=t.slice();return r[47]=e[n],r}function $k(t){let e,n,r,i;return{c(){e=I("div"),T(e,"class","git-commit-msg-clear-button svelte-11adhly"),T(e,"aria-label",n="Clear")},m(a,s){re(a,e,s),r||(i=te(e,"click",t[34]),r=!0)},p:ke,d(a){a&&ne(e),r=!1,i()}}}function Hk(t){let e,n,r,i,a,s,o,l,c,u,f,h,d=t[6].staged.length+"",p,g,m,w,b,S,k,x,A,y,E,_,C,M,L,N,j=t[6].changed.length+"",Y,le,he,ie,Me,de,$=t[13]&&Uk(t),G=t[12]&&Gk(t),D=t[7].length>0&&Wk(t);return{c(){e=I("div"),n=I("div"),r=I("div"),i=I("div"),i.innerHTML='',a=J(),s=I("div"),s.textContent="Staged Changes",o=J(),l=I("div"),c=I("div"),u=I("div"),u.innerHTML='',f=J(),h=I("div"),p=Te(d),g=J(),$&&$.c(),m=J(),w=I("div"),b=I("div"),S=I("div"),S.innerHTML='',k=J(),x=I("div"),x.textContent="Changes",A=J(),y=I("div"),E=I("div"),_=I("div"),_.innerHTML='',C=J(),M=I("div"),M.innerHTML='',L=J(),N=I("div"),Y=Te(j),le=J(),G&&G.c(),he=J(),D&&D.c(),T(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(i,"is-collapsed",!t[13]),T(s,"class","tree-item-inner nav-folder-title-content"),T(u,"data-icon","minus"),T(u,"aria-label","Unstage"),T(u,"class","clickable-icon"),T(c,"class","buttons"),T(h,"class","files-count svelte-11adhly"),T(l,"class","git-tools"),T(r,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),T(n,"class","staged tree-item nav-folder"),ce(n,"is-collapsed",!t[13]),T(S,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(S,"is-collapsed",!t[12]),T(x,"class","tree-item-inner nav-folder-title-content"),T(_,"data-icon","undo"),T(_,"aria-label","Discard"),T(_,"class","clickable-icon"),T(M,"data-icon","plus"),T(M,"aria-label","Stage"),T(M,"class","clickable-icon"),T(E,"class","buttons"),T(N,"class","files-count svelte-11adhly"),T(y,"class","git-tools"),T(b,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),T(w,"class","changes tree-item nav-folder"),ce(w,"is-collapsed",!t[12]),T(e,"class","tree-item nav-folder mod-root")},m(se,Se){re(se,e,Se),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),O(r,o),O(r,l),O(l,c),O(c,u),t[35](u),O(l,f),O(l,h),O(h,p),O(n,g),$&&$.m(n,null),O(e,m),O(e,w),O(w,b),O(b,S),O(b,k),O(b,x),O(b,A),O(b,y),O(y,E),O(E,_),O(E,C),O(E,M),t[37](M),O(y,L),O(y,N),O(N,Y),O(w,le),G&&G.m(w,null),O(e,he),D&&D.m(e,null),ie=!0,Me||(de=[te(u,"click",xe(t[20])),te(r,"click",t[36]),te(_,"click",xe(t[23])),te(M,"click",xe(t[19])),te(b,"click",t[38])],Me=!0)},p(se,Se){(!ie||Se[0]&8192)&&ce(i,"is-collapsed",!se[13]),(!ie||Se[0]&64)&&d!==(d=se[6].staged.length+"")&&Oe(p,d),se[13]?$?($.p(se,Se),Se[0]&8192&&U($,1)):($=Uk(se),$.c(),U($,1),$.m(n,null)):$&&(Ce(),X($,1,1,()=>{$=null}),Fe()),(!ie||Se[0]&8192)&&ce(n,"is-collapsed",!se[13]),(!ie||Se[0]&4096)&&ce(S,"is-collapsed",!se[12]),(!ie||Se[0]&64)&&j!==(j=se[6].changed.length+"")&&Oe(Y,j),se[12]?G?(G.p(se,Se),Se[0]&4096&&U(G,1)):(G=Gk(se),G.c(),U(G,1),G.m(w,null)):G&&(Ce(),X(G,1,1,()=>{G=null}),Fe()),(!ie||Se[0]&4096)&&ce(w,"is-collapsed",!se[12]),se[7].length>0?D?(D.p(se,Se),Se[0]&128&&U(D,1)):(D=Wk(se),D.c(),U(D,1),D.m(e,null)):D&&(Ce(),X(D,1,1,()=>{D=null}),Fe())},i(se){ie||(U($),U(G),U(D),ie=!0)},o(se){X($),X(G),X(D),ie=!1},d(se){se&&ne(e),t[35](null),$&&$.d(),t[37](null),G&&G.d(),D&&D.d(),Me=!1,Ae(de)}}}function Uk(t){let e,n,r,i,a,s=[Kj,Zj],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=I("div"),r.c(),T(e,"class","tree-item-children nav-folder-children")},m(c,u){re(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ce(),X(o[f],1,1,()=>{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function Zj(t){let e,n,r,i=tt(vr(t[6].staged,500)),a=[];for(let o=0;oX(a[o],1,1,()=>{a[o]=null});return n=new Aa({props:{files:t[6].staged}}),{c(){for(let o=0;o{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function Jj(t){let e,n,r,i=tt(vr(t[6].changed,500)),a=[];for(let o=0;oX(a[o],1,1,()=>{a[o]=null});return n=new Aa({props:{files:t[6].changed}}),{c(){for(let o=0;o',i=J(),a=I("div"),a.textContent="Recently Pulled Files",s=J(),o=I("span"),c=Te(l),u=J(),p&&p.c(),T(r,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),T(a,"class","tree-item-inner nav-folder-title-content"),T(o,"class","tree-item-flair"),T(n,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),T(e,"class","pulled nav-folder"),ce(e,"is-collapsed",!t[14])},m(g,m){re(g,e,m),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,u),p&&p.m(e,null),f=!0,h||(d=te(n,"click",t[39]),h=!0)},p(g,m){(!f||m[0]&128)&&l!==(l=g[7].length+"")&&Oe(c,l),g[14]?p?(p.p(g,m),m[0]&16384&&U(p,1)):(p=qk(g),p.c(),U(p,1),p.m(e,null)):p&&(Ce(),X(p,1,1,()=>{p=null}),Fe()),(!f||m[0]&16384)&&ce(e,"is-collapsed",!g[14])},i(g){f||(U(p),f=!0)},o(g){X(p),f=!1},d(g){g&&ne(e),p&&p.d(),h=!1,d()}}}function qk(t){let e,n,r,i,a,s=[t7,e7],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=I("div"),r.c(),T(e,"class","tree-item-children nav-folder-children")},m(c,u){re(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ce(),X(o[f],1,1,()=>{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function e7(t){let e,n,r,i=tt(t[7]),a=[];for(let o=0;oX(a[o],1,1,()=>{a[o]=null});return n=new Aa({props:{files:t[7]}}),{c(){for(let o=0;o{j=null}),Fe())},i(Y){C||(U(j),C=!0)},o(Y){X(j),C=!1},d(Y){Y&&ne(e),t[24](null),t[25](null),t[26](null),t[27](null),t[28](null),t[29](null),t[30](null),t[32](null),N&&N.d(),j&&j.d(),M=!1,Ae(L)}}}function r7(t,e,n){let r,{plugin:i}=e,{view:a}=e,s,o,l=[],c=i.settings.commitMessage,u=[],f,h,d,p=!0,g=!0,m=!0,w=i.settings.treeStructure,b,S;S=a.app.workspace.on("obsidian-git:view-refresh",()=>void A().catch(console.error)),A().catch(console.error),i.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{u.forEach(ee=>(0,Ta.setIcon)(ee,ee.getAttr("data-icon"))),(0,Ta.setIcon)(b,w?"list":"folder")},0)}),no(()=>{a.app.workspace.offref(S)});function k(){return _a(this,void 0,void 0,function*(){if(n(5,s=!0),o){if(yield i.tools.hasTooBigFiles(o.staged))return i.setPluginState({gitAction:0}),!1;i.promiseQueue.addTask(()=>i.gitManager.commit({message:c}).then(()=>_a(this,void 0,void 0,function*(){c!==i.settings.commitMessage&&n(2,c=""),yield i.automaticsManager.setUpAutoCommitAndSync()})).finally(y))}})}function x(){n(5,s=!0),o&&i.promiseQueue.addTask(()=>i.commitAndSync(!1,!1,c).then(()=>{c!==i.settings.commitMessage&&n(2,c="")}).finally(y))}function A(){return _a(this,void 0,void 0,function*(){if(!i.gitReady){n(6,o=void 0);return}let ee=yield i.gitManager.getUnpushedCommits();if(u.forEach(Ie=>{var Ee,z;Ie&&(Ta.Platform.isMobile?(Ie.removeClass("button-border"),Ie.id=="push"&&ee>0&&Ie.addClass("button-border")):((Ee=Ie.firstElementChild)===null||Ee===void 0||Ee.removeAttribute("color"),Ie.id=="push"&&ee>0&&((z=Ie.firstElementChild)===null||z===void 0||z.setAttr("color","var(--text-accent)"))))}),n(6,o=i.cachedStatus),i.lastPulledFiles&&i.lastPulledFiles!=l&&(n(7,l=i.lastPulledFiles),n(11,d={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(l)})),o){let Ie=(Ee,z)=>Ee.vault_path.split("/").last().localeCompare(Bt(z.vault_path));o.changed.sort(Ie),o.staged.sort(Ie),n(9,f={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.changed)}),n(10,h={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.staged)})}else n(9,f=void 0),n(10,h=void 0);n(5,s=i.loading)})}function y(){a.app.workspace.trigger("obsidian-git:refresh")}function E(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.stageAll({status:o}).finally(y))}function _(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.unstageAll({status:o}).finally(y))}function C(){n(5,s=!0),i.promiseQueue.addTask(()=>i.push().finally(y))}function M(){n(5,s=!0),i.promiseQueue.addTask(()=>i.pullChangesFromRemote().finally(y))}function L(){new kr(a.app,!1,i.gitManager.getRelativeVaultPath("/")).myOpen().then(ee=>{ee===!0&&i.promiseQueue.addTask(()=>i.gitManager.discardAll({status:i.cachedStatus}).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")}))},console.error)}function N(ee){je[ee?"unshift":"push"](()=>{u[5]=ee,n(8,u)})}function j(ee){je[ee?"unshift":"push"](()=>{u[0]=ee,n(8,u)})}function Y(ee){je[ee?"unshift":"push"](()=>{u[1]=ee,n(8,u)})}function le(ee){je[ee?"unshift":"push"](()=>{u[2]=ee,n(8,u)})}function he(ee){je[ee?"unshift":"push"](()=>{u[3]=ee,n(8,u)})}function ie(ee){je[ee?"unshift":"push"](()=>{u[4]=ee,n(8,u)})}function Me(ee){je[ee?"unshift":"push"](()=>{b=ee,n(4,b)})}let de=()=>{n(3,w=!w),n(0,i.settings.treeStructure=w,i),i.saveSettings()};function $(ee){je[ee?"unshift":"push"](()=>{u[6]=ee,n(8,u)})}function G(){c=this.value,n(2,c)}let D=()=>n(2,c="");function se(ee){je[ee?"unshift":"push"](()=>{u[8]=ee,n(8,u)})}let Se=()=>n(13,g=!g);function mt(ee){je[ee?"unshift":"push"](()=>{u[9]=ee,n(8,u)})}let be=()=>n(12,p=!p),st=()=>n(14,m=!m);return t.$$set=ee=>{"plugin"in ee&&n(0,i=ee.plugin),"view"in ee&&n(1,a=ee.view)},t.$$.update=()=>{t.$$.dirty[0]&24&&b&&(b.empty(),(0,Ta.setIcon)(b,w?"list":"folder")),t.$$.dirty[0]&4&&n(15,r=(c.match(/\n/g)||[]).length+1||1)},[i,a,c,w,b,s,o,l,u,f,h,d,p,g,m,r,k,x,y,E,_,C,M,L,N,j,Y,le,he,ie,Me,de,$,G,D,se,Se,mt,be,st]}var sm=class extends Ve{constructor(e){super(),at(this,e,r7,n7,it,{plugin:0,view:1},Yj,[-1,-1])}},Yk=sm;var oo=class extends Zk.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return dt.type}getDisplayText(){return dt.name}getIcon(){return dt.icon}onClose(){var e;return(e=this._view)==null||e.$destroy(),super.onClose()}reload(){var e;(e=this._view)==null||e.$destroy(),this._view=new Yk({target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};v();var fu=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(r=>{this.plugin.switchBranch().catch(i=>n.displayError(i))})}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()}};v();var Kk=require("obsidian");var lo=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let n=await this.plugin.gitManager.branchInfo(),r=n.tracking?wr(n.tracking)[0]:null;if(r){let i=await this.plugin.gitManager.getRemoteUrl(r);if(i!=null&&i.includes("github.com")){let a=e.filter(s=>{let o=this.plugin.app.vault.getAbstractFileByPath(s.vault_path);return o instanceof Kk.TFile?o.stat.size>=1e8:!1});if(a.length>0)return this.plugin.displayError(`Did not commit, because following files are too big: ${a.map(s=>s.vault_path).join(` +`)}. Please remove them.`),!0}}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(Vi,e);let n=!1;this.plugin.app.workspace.iterateAllLeaves(r=>{r.getDisplayText()!=""&&Vi.startsWith(r.getDisplayText())&&(n=!0)}),n||await this.plugin.app.workspace.openLinkText(Vi,"/",!0)}};var hu=class extends _e.Plugin{constructor(){super(...arguments);this.tools=new lo(this);this.state={gitAction:0,loading:!1,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new Lc(this);this.loading=!1;this.intervalsToClear=[];this.lineAuthoringFeature=new Rc(this)}setPluginState(n){var r;this.state=Object.assign(this.state,n),(r=this.statusBar)==null||r.display()}async updateCachedStatus(){var n,r;return this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((n=this.branchBar)==null?void 0:n.display())):(this.localStorage.setConflict(!1),await((r=this.branchBar)==null?void 0:r.display())),this.cachedStatus}async refresh(){if(!this.gitReady)return;let n=this.app.workspace.getLeavesOfType(dt.type),r=this.app.workspace.getLeavesOfType(nn.type);(this.settings.changedFilesInStatusBar||n.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)})||r.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)}))&&(this.loading=!0,this.app.workspace.trigger("obsidian-git:view-refresh"),await this.updateCachedStatus().catch(i=>this.displayError(i)),this.loading=!1,this.app.workspace.trigger("obsidian-git:view-refresh"))}refreshUpdatedHead(){this.lineAuthoringFeature.refreshLineAuthorViews()}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Gs.plugin=this,this.localStorage=new Hc(this),this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new bc(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(n=>this.displayError(n))))}onExternalSettingsChange(){this.reloadSettings().catch(n=>this.displayError(n))}async reloadSettings(){let n=JSON.stringify(this.settings);await this.loadSettings();let r=JSON.stringify(this.settings);n!==r&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(dt.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}),this.app.workspace.getLeavesOfType(nn.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}))}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(n=>this.displayError(n))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(n,r,i)=>{this.handleFileMenu(n,r,i)})),this.registerEvent(this.app.workspace.on("active-leaf-change",n=>{this.handleViewActiveState(n)})),this.registerEvent(this.app.vault.on("modify",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerView(dt.type,n=>new oo(n,this)),this.registerView(nn.type,n=>new ao(n,this)),this.registerView(Ct.type,n=>new ga(n,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let n=this.app.workspace.getLeavesOfType(dt.type),r;n.length===0?(r=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await r.setViewState({type:dt.type})):r=n.first(),await this.app.workspace.revealLeaf(r),this.app.workspace.trigger("obsidian-git:refresh")}),this.registerHoverLinkSource(dt.type,{display:"Git View",defaultMod:!0}),this.lineAuthoringFeature.onLoadPlugin(),this.setRefreshDebouncer(),AE(this)}setRefreshDebouncer(){var n;(n=this.debRefresh)==null||n.cancel(),this.debRefresh=(0,_e.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(n){return await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+this.gitManager.getRelativeRepoPath(n.path,!0)),this.refresh()}handleFileMenu(n,r,i){this.gitReady&&this.settings.showFileMenu&&r&&(this.settings.showFileMenu&&i=="file-explorer-context-menu"&&(n.addItem(a=>{a.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof _e.TFile?await this.gitManager.stage(r.path,!0):await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Staged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof _e.TFile?await this.gitManager.unstage(r.path,!0):await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Unstaged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r).catch(o=>this.displayError(o))})})),i=="git-source-control"&&n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r).catch(o=>this.displayError(o))})}))}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 n,r;this.gitReady=!1,this.app.workspace.trigger("obsidian-git:refresh"),this.lineAuthoringFeature.deactivateFeature(),this.automaticsManager.unload(),(n=this.branchBar)==null||n.remove(),(r=this.statusBar)==null||r.remove();for(let i of this.intervalsToClear)window.clearInterval(i);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let n=await this.loadData();n==null&&(n={showedMobileNotice:!0}),this.settings=Hw(Mn,n)}async saveSettings(){var n;(n=this.settingsTab)==null||n.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return _e.Platform.isDesktopApp}async init({fromReload:n=!1}){var r;if(this.settings.showStatusBar){let i=this.addStatusBarItem();this.statusBar=new jc(i,this),this.intervalsToClear.push(window.setInterval(()=>{var a;return(a=this.statusBar)==null?void 0:a.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Le(this),await this.gitManager.setGitInstance()):this.gitManager=new yn(this);let i=await this.gitManager.checkRequirements();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new _e.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}),_e.Platform.isDesktop&&this.settings.showBranchStatusBar){let a=this.addStatusBarItem();this.branchBar=new fu(a,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return void((s=this.branchBar)==null?void 0:s.display().catch(console.error))},6e4))}await((r=this.branchBar)==null?void 0:r.display()),this.lineAuthoringFeature.conditionallyActivateBySettings(),this.app.workspace.trigger("obsidian-git:refresh"),!n&&this.settings.autoPullOnBoot&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),this.automaticsManager=new Vs(this),await this.automaticsManager.init();break;default:this.log("Something weird happened. The 'checkRequirements' result is "+i)}}catch(i){this.displayError(i),console.error(i)}}async createNewRepo(){try{await this.gitManager.init(),new _e.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(n){this.displayError(n)}}async cloneNewRepo(){let r=await new Xe(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(r){let i="Vault Root",a=await new Xe(this,{options:this.gitManager instanceof yn?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof yn}).openAndGetResult();if(a==null)return;if(a===i&&(a="."),a=(0,_e.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new Xe(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 _e.Notice("Aborted clone");return}else if(f==="YES"){let h="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new Xe(this,{options:["Abort clone",h],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===h)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new _e.Notice("Aborted clone");return}}}let s=await new Xe(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(s!==""&&(o=parseInt(s),isNaN(o))){new _e.Notice("Invalid depth. Aborting clone.");return}new _e.Notice(`Cloning new repo into "${a}"`);let l=this.settings.basePath,c=a&&a!==".";c&&(this.settings.basePath=a);try{await this.gitManager.clone(r,a,o),new _e.Notice("Cloned new repo."),new _e.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 n=await this.pull();if(await this.automaticsManager.setUpAutoCommitAndSync(),n!==!1){if(n||this.displayMessage("Everything is up-to-date"),this.gitManager instanceof Le){let r=await this.updateCachedStatus();r.conflicted.length>0&&(this.displayError(`You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),await this.handleConflict(r.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync(n,r=!1,i){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:n,requestCustomMessage:r,commitMessage:i}))||(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:n,requestCustomMessage:r=!1,onlyStaged:i=!1,commitMessage:a,amend:s=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,c,u;if(this.gitManager instanceof Le){if(await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),c.conflicted.length==0&&(o=!1),n&&c.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${c.conflicted.length} ${c.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(c.conflicted),!1;l=[...c.changed,...c.staged]}else{if(n&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;if(o)await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),l=[...c.changed,...c.staged];else{let f=this.gitManager;i?l=await f.getStagedFiles():(u=await f.getUnstagedFiles(),l=u.map(({filepath:h})=>({vault_path:this.gitManager.getRelativeVaultPath(h)})))}}if(await this.tools.hasTooBigFiles(l))return this.setPluginState({gitAction:0}),!1;if(l.length!==0||o){let f=a!=null?a:a=n?this.settings.autoCommitMessage:this.settings.commitMessage;if(n&&this.settings.customMessageOnAutoBackup||r){!this.settings.disablePopups&&n&&new _e.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let p=await new Dc(this).openAndGetResult();if(p!=null&&p!=""&&p!="...")f=p;else return this.setPluginState({gitAction:0}),!1}let h;i?h=await this.gitManager.commit({message:f,amend:s}):h=await this.gitManager.commitAll({message:f,status:c,unstagedFiles:u,amend:s}),this.gitManager instanceof Le&&await this.updateCachedStatus();let d=!1;h===void 0&&(d=!0,h=l.length),await this.automaticsManager.setUpAutoCommitAndSync(),this.displayMessage(`Committed${d?" approx.":""} ${h} ${h==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 n=this.localStorage.getConflict();try{this.gitManager instanceof Le&&await this.mayDeleteConflictFile();let r;if(this.gitManager instanceof Le&&(r=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),await this.handleConflict(r.conflicted),!1;if(this.gitManager instanceof yn&&n)return this.displayError("Cannot push. You have conflicts"),!1;this.log("Pushing....");let i=await this.gitManager.push();return i!==void 0&&(i>0?this.displayMessage(`Pushed ${i} ${i==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(r){return r instanceof Wi?this.handleNoNetworkError(r):this.displayError(r),!1}}async pull(){if(!await this.remotesAreSet())return!1;try{this.log("Pulling....");let n=await this.gitManager.pull()||[];return this.setPluginState({offlineMode:!1}),n.length>0&&(this.displayMessage(`Pulled ${n.length} ${n.length==1?"file":"files"} from remote`),this.lastPulledFiles=n),n.length}catch(n){return this.displayError(n),!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(n){this.displayError(n)}}async mayDeleteConflictFile(){let n=this.app.vault.getAbstractFileByPath(Vi);n&&(this.app.workspace.iterateAllLeaves(r=>{var i;r.view instanceof _e.MarkdownView&&((i=r.view.file)==null?void 0:i.path)==n.path&&r.detach()}),await this.app.vault.delete(n))}async stageFile(n){return await this.isAllInitialized()?(await this.gitManager.stage(n.path,!0),this.displayMessage(`Staged ${n.path}`),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async unstageFile(n){return await this.isAllInitialized()?(await this.gitManager.unstage(n.path,!0),this.displayMessage(`Unstaged ${n.path}`),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async switchBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo(),r=await new au(this,n.branches).openAndGetReslt();if(r!=null)return await this.gitManager.checkout(r),this.displayMessage(`Switched to ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}async switchRemoteBranch(){var a;if(!await this.isAllInitialized())return;let n=await this.selectRemoteBranch()||"",[r,i]=wr(n);if(i!=null&&r!=null)return await this.gitManager.checkout(i,r),this.displayMessage(`Switched to ${n}`),await((a=this.branchBar)==null?void 0:a.display()),n}async createBranch(){var r;if(!await this.isAllInitialized())return;let n=await new Xe(this,{placeholder:"Create new branch"}).openAndGetResult();if(n!=null)return await this.gitManager.createBranch(n),this.displayMessage(`Created new branch ${n}`),await((r=this.branchBar)==null?void 0:r.display()),n}async deleteBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo();n.current&&n.branches.remove(n.current);let r=await new Xe(this,{options:n.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(r!=null){let a=!1;if(!await this.gitManager.branchIsMerged(r)){let o=await new Xe(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;a=o==="YES"}return await this.gitManager.deleteBranch(r,a),this.displayMessage(`Deleted branch ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}}async remotesAreSet(){return this.settings.updateSubmodules||(await this.gitManager.branchInfo()).tracking?!0:(new _e.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let n=await this.selectRemoteBranch();return n==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setPluginState({gitAction:0}),!1):(await this.gitManager.updateUpstreamBranch(n),this.displayMessage(`Set upstream branch to ${n}`),this.setPluginState({gitAction:0}),!0)}async discardAll(){await this.gitManager.discardAll({status:this.cachedStatus}),new _e.Notice("All local changes have been discarded. New files remain untouched.")}async handleConflict(n){this.localStorage.setConflict(!0);let r;n!==void 0&&(r=["# 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","",...n.map(i=>{let a=this.app.vault.getAbstractFileByPath(i);return a instanceof _e.TFile?`- [[${this.app.metadataCache.fileToLinktext(a,"/")}]]`:`- Not a file: ${i}`}),` # 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. @@ -44734,135 +318,8 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For ======= File changes in remote repository >>>>>>> origin/main -\`\`\`` - ]; - } - this.writeAndOpenFile(lines == null ? void 0 : lines.join("\n")); - } - async editRemotes() { - if (!await this.isAllInitialized()) return; - const remotes = await this.gitManager.getRemotes(); - const nameModal = new GeneralModal({ - options: remotes, - placeholder: "Select or create a new remote by typing its name and selecting it" - }); - const remoteName = await nameModal.open(); - if (remoteName) { - const oldUrl = await this.gitManager.getRemoteUrl(remoteName); - const urlModal = new GeneralModal({ initialValue: oldUrl }); - const remoteURL = await urlModal.open(); - if (remoteURL) { - await this.gitManager.setRemote(remoteName, remoteURL); - return remoteName; - } - } - } - async selectRemoteBranch() { - let remotes = await this.gitManager.getRemotes(); - let selectedRemote; - if (remotes.length === 0) { - selectedRemote = await this.editRemotes(); - if (selectedRemote == void 0) { - remotes = await this.gitManager.getRemotes(); - } - } - const nameModal = new GeneralModal({ - options: remotes, - placeholder: "Select or create a new remote by typing its name and selecting it" - }); - const remoteName = selectedRemote != null ? selectedRemote : await nameModal.open(); - if (remoteName) { - this.displayMessage("Fetching remote branches"); - await this.gitManager.fetch(remoteName); - const branches = await this.gitManager.getRemoteBranches(remoteName); - const branchModal = new GeneralModal({ - options: branches, - placeholder: "Select or create a new remote branch by typing its name and selecting it" - }); - return await branchModal.open(); - } - } - async removeRemote() { - if (!await this.isAllInitialized()) return; - const remotes = await this.gitManager.getRemotes(); - const nameModal = new GeneralModal({ - options: remotes, - placeholder: "Select a remote" - }); - const remoteName = await nameModal.open(); - if (remoteName) { - this.gitManager.removeRemote(remoteName); - } - } - async writeAndOpenFile(text2) { - if (text2 !== void 0) { - await this.app.vault.adapter.write(this.conflictOutputFile, text2); - } - let fileIsAlreadyOpened = false; - this.app.workspace.iterateAllLeaves((leaf) => { - if (leaf.getDisplayText() != "" && this.conflictOutputFile.startsWith(leaf.getDisplayText())) { - fileIsAlreadyOpened = true; - } - }); - if (!fileIsAlreadyOpened) { - this.app.workspace.openLinkText(this.conflictOutputFile, "/", true); - } - } - handleViewActiveState(leaf) { - var _a2, _b; - if (!(leaf == null ? void 0 : leaf.view.getState().file)) return; - const sourceControlLeaf = this.app.workspace.getLeavesOfType(SOURCE_CONTROL_VIEW_CONFIG.type).first(); - const historyLeaf = this.app.workspace.getLeavesOfType(HISTORY_VIEW_CONFIG.type).first(); - (_a2 = sourceControlLeaf == null ? void 0 : sourceControlLeaf.view.containerEl.querySelector(`div.nav-file-title.is-active`)) == null ? void 0 : _a2.removeClass("is-active"); - (_b = historyLeaf == null ? void 0 : historyLeaf.view.containerEl.querySelector(`div.nav-file-title.is-active`)) == null ? void 0 : _b.removeClass("is-active"); - if ((leaf == null ? void 0 : leaf.view) instanceof DiffView) { - const path2 = leaf.view.state.file; - this.lastDiffViewState = leaf.view.getState(); - let el; - if (sourceControlLeaf && leaf.view.state.staged) { - el = sourceControlLeaf.view.containerEl.querySelector( - `div.staged div.nav-file-title[data-path='${path2}']` - ); - } else if (sourceControlLeaf && leaf.view.state.staged === false && !leaf.view.state.hash) { - el = sourceControlLeaf.view.containerEl.querySelector( - `div.changes div.nav-file-title[data-path='${path2}']` - ); - } else if (historyLeaf && leaf.view.state.hash) { - el = historyLeaf.view.containerEl.querySelector( - `div.nav-file-title[data-path='${path2}']` - ); - } - el == null ? void 0 : el.addClass("is-active"); - } else { - this.lastDiffViewState = void 0; - } - } - // region: displaying / formatting messages - displayMessage(message, timeout = 4 * 1e3) { - var _a2; - (_a2 = this.statusBar) == null ? void 0 : _a2.displayMessage(message.toLowerCase(), timeout); - if (!this.settings.disablePopups) { - if (!this.settings.disablePopupsForNoChanges || !message.startsWith("No changes")) { - new import_obsidian31.Notice(message, 5 * 1e3); - } - } - this.log(message); - } - displayError(message, timeout = 10 * 1e3) { - var _a2; - if (message instanceof Errors.UserCanceledError) { - new import_obsidian31.Notice("Aborted"); - return; - } - message = message.toString(); - new import_obsidian31.Notice(message, timeout); - console.log(`git obsidian error: ${message}`); - (_a2 = this.statusBar) == null ? void 0 : _a2.displayMessage(message.toLowerCase(), timeout); - } - log(message) { - console.log(`${this.manifest.id}: ` + message); - } -}; +\`\`\``]),await this.tools.writeAndOpenFile(r==null?void 0:r.join(` +`))}async editRemotes(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new Xe(this,{options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new Xe(this,{initialValue:a}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,o),i}}async selectRemoteBranch(){let n=await this.gitManager.getRemotes(),r;n.length===0&&(r=await this.editRemotes(),r==null&&(n=await this.gitManager.getRemotes()));let i=new Xe(this,{options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=r!=null?r:await i.openAndGetResult();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a);return await new Xe(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult()}}async removeRemote(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new Xe(this,{options:n,placeholder:"Select a remote"}).openAndGetResult();i&&await this.gitManager.removeRemote(i)}handleViewActiveState(n){var a,s;if(!(n!=null&&n.view.getState().file))return;let r=this.app.workspace.getLeavesOfType(dt.type).first(),i=this.app.workspace.getLeavesOfType(nn.type).first();if((a=r==null?void 0:r.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||a.removeClass("is-active"),(s=i==null?void 0:i.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||s.removeClass("is-active"),(n==null?void 0:n.view)instanceof ga){let o=n.view.state.file;this.lastDiffViewState=n.view.getState();let l;r&&n.view.state.staged?l=r.view.containerEl.querySelector(`div.staged div.nav-file-title[data-path='${o}']`):r&&n.view.state.staged===!1&&!n.view.state.hash?l=r.view.containerEl.querySelector(`div.changes div.nav-file-title[data-path='${o}']`):i&&n.view.state.hash&&(l=i.view.containerEl.querySelector(`div.nav-file-title[data-path='${o}']`)),l==null||l.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(n){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(n,r=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(n.toLowerCase(),r),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!n.startsWith("No changes"))&&new _e.Notice(n,5*1e3),this.log(n)}displayError(n,r=10*1e3){var a;if(n instanceof hs.UserCanceledError){new _e.Notice("Aborted");return}let i;n instanceof Error?i=n:i=new Error(String(n)),this.setPluginState({gitAction:0}),new _e.Notice(i.message,r),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),r)}log(...n){console.log(`${this.manifest.id}:`,...n)}}; /*! Bundled license information: ieee754/index.js: @@ -44899,3 +356,5 @@ feather-icons/dist/feather.js: http://jedwatson.github.io/classnames *) */ + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json index 3179c1e..504a694 100644 --- a/.obsidian/plugins/obsidian-git/manifest.json +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -6,5 +6,5 @@ "description": "Integrate Git version control with automatic backup and other advanced features.", "isDesktopOnly": false, "fundingUrl": "https://ko-fi.com/vinzent", - "version": "2.25.0" + "version": "2.28.2" } diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css index d5ad0cc..abe81d4 100644 --- a/.obsidian/plugins/obsidian-git/styles.css +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -39,6 +39,10 @@ margin-right: auto; } +.obsidian-git-disabled { + opacity: 0.5; +} + .obsidian-git-center-button { display: block; margin: 20px auto; diff --git a/.obsidian/plugins/obsidian-importer/main.js b/.obsidian/plugins/obsidian-importer/main.js index ebfef8a..914febc 100644 --- a/.obsidian/plugins/obsidian-importer/main.js +++ b/.obsidian/plugins/obsidian-importer/main.js @@ -3,35 +3,35 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ -var ud=Object.create;var vi=Object.defineProperty;var fd=Object.getOwnPropertyDescriptor;var dd=Object.getOwnPropertyNames;var md=Object.getPrototypeOf,hd=Object.prototype.hasOwnProperty;var Y=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Se=(n,t)=>{for(var e in t)vi(n,e,{get:t[e],enumerable:!0})},ts=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of dd(t))!hd.call(n,r)&&r!==e&&vi(n,r,{get:()=>t[r],enumerable:!(i=fd(t,r))||i.enumerable});return n};var ns=(n,t,e)=>(e=n!=null?ud(md(n)):{},ts(t||!n||!n.__esModule?vi(e,"default",{value:n,enumerable:!0}):e,n)),gd=n=>ts(vi({},"__esModule",{value:!0}),n);var Do=Y((Ax,Ll)=>{"use strict";Ll.exports=ih;function ih(n,t){for(var e=new Array(arguments.length-1),i=0,r=2,o=!0;r{"use strict";var zi=$l;zi.length=function(t){var e=t.length;if(!e)return 0;for(var i=0;--e%4>1&&t.charAt(e)==="=";)++i;return Math.ceil(t.length*3)/4-i};var wn=new Array(64),Ml=new Array(123);for(Ye=0;Ye<64;)Ml[wn[Ye]=Ye<26?Ye+65:Ye<52?Ye+71:Ye<62?Ye-4:Ye-59|43]=Ye++;var Ye;zi.encode=function(t,e,i){for(var r=null,o=[],a=0,s=0,l;e>2],l=(c&3)<<4,s=1;break;case 1:o[a++]=wn[l|c>>4],l=(c&15)<<2,s=2;break;case 2:o[a++]=wn[l|c>>6],o[a++]=wn[c&63],s=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),a=0)}return s&&(o[a++]=wn[l],o[a++]=61,s===1&&(o[a++]=61)),r?(a&&r.push(String.fromCharCode.apply(String,o.slice(0,a))),r.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var Pl="invalid encoding";zi.decode=function(t,e,i){for(var r=i,o=0,a,s=0;s1)break;if((l=Ml[l])===void 0)throw Error(Pl);switch(o){case 0:a=l,o=1;break;case 1:e[i++]=a<<2|(l&48)>>4,a=l,o=2;break;case 2:e[i++]=(a&15)<<4|(l&60)>>2,a=l,o=3;break;case 3:e[i++]=(a&3)<<6|l,o=0;break}}if(o===1)throw Error(Pl);return i-r};zi.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var jl=Y((Nx,Ul)=>{"use strict";Ul.exports=Gi;function Gi(){this._listeners={}}Gi.prototype.on=function(t,e,i){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:i||this}),this};Gi.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var i=this._listeners[t],r=0;r{"use strict";zl.exports=Hl(Hl);function Hl(n){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),i=e[3]===128;function r(l,c,p){t[0]=l,c[p]=e[0],c[p+1]=e[1],c[p+2]=e[2],c[p+3]=e[3]}function o(l,c,p){t[0]=l,c[p]=e[3],c[p+1]=e[2],c[p+2]=e[1],c[p+3]=e[0]}n.writeFloatLE=i?r:o,n.writeFloatBE=i?o:r;function a(l,c){return e[0]=l[c],e[1]=l[c+1],e[2]=l[c+2],e[3]=l[c+3],t[0]}function s(l,c){return e[3]=l[c],e[2]=l[c+1],e[1]=l[c+2],e[0]=l[c+3],t[0]}n.readFloatLE=i?a:s,n.readFloatBE=i?s:a}():function(){function t(i,r,o,a){var s=r<0?1:0;if(s&&(r=-r),r===0)i(1/r>0?0:2147483648,o,a);else if(isNaN(r))i(2143289344,o,a);else if(r>34028234663852886e22)i((s<<31|2139095040)>>>0,o,a);else if(r<11754943508222875e-54)i((s<<31|Math.round(r/1401298464324817e-60))>>>0,o,a);else{var l=Math.floor(Math.log(r)/Math.LN2),c=Math.round(r*Math.pow(2,-l)*8388608)&8388607;i((s<<31|l+127<<23|c)>>>0,o,a)}}n.writeFloatLE=t.bind(null,ql),n.writeFloatBE=t.bind(null,Wl);function e(i,r,o){var a=i(r,o),s=(a>>31)*2+1,l=a>>>23&255,c=a&8388607;return l===255?c?NaN:s*(1/0):l===0?s*1401298464324817e-60*c:s*Math.pow(2,l-150)*(c+8388608)}n.readFloatLE=e.bind(null,Zl),n.readFloatBE=e.bind(null,Yl)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),i=e[7]===128;function r(l,c,p){t[0]=l,c[p]=e[0],c[p+1]=e[1],c[p+2]=e[2],c[p+3]=e[3],c[p+4]=e[4],c[p+5]=e[5],c[p+6]=e[6],c[p+7]=e[7]}function o(l,c,p){t[0]=l,c[p]=e[7],c[p+1]=e[6],c[p+2]=e[5],c[p+3]=e[4],c[p+4]=e[3],c[p+5]=e[2],c[p+6]=e[1],c[p+7]=e[0]}n.writeDoubleLE=i?r:o,n.writeDoubleBE=i?o:r;function a(l,c){return e[0]=l[c],e[1]=l[c+1],e[2]=l[c+2],e[3]=l[c+3],e[4]=l[c+4],e[5]=l[c+5],e[6]=l[c+6],e[7]=l[c+7],t[0]}function s(l,c){return e[7]=l[c],e[6]=l[c+1],e[5]=l[c+2],e[4]=l[c+3],e[3]=l[c+4],e[2]=l[c+5],e[1]=l[c+6],e[0]=l[c+7],t[0]}n.readDoubleLE=i?a:s,n.readDoubleBE=i?s:a}():function(){function t(i,r,o,a,s,l){var c=a<0?1:0;if(c&&(a=-a),a===0)i(0,s,l+r),i(1/a>0?0:2147483648,s,l+o);else if(isNaN(a))i(0,s,l+r),i(2146959360,s,l+o);else if(a>17976931348623157e292)i(0,s,l+r),i((c<<31|2146435072)>>>0,s,l+o);else{var p;if(a<22250738585072014e-324)p=a/5e-324,i(p>>>0,s,l+r),i((c<<31|p/4294967296)>>>0,s,l+o);else{var m=Math.floor(Math.log(a)/Math.LN2);m===1024&&(m=1023),p=a*Math.pow(2,-m),i(p*4503599627370496>>>0,s,l+r),i((c<<31|m+1023<<20|p*1048576&1048575)>>>0,s,l+o)}}}n.writeDoubleLE=t.bind(null,ql,0,4),n.writeDoubleBE=t.bind(null,Wl,4,0);function e(i,r,o,a,s){var l=i(a,s+r),c=i(a,s+o),p=(c>>31)*2+1,m=c>>>20&2047,y=4294967296*(c&1048575)+l;return m===2047?y?NaN:p*(1/0):m===0?p*5e-324*y:p*Math.pow(2,m-1075)*(y+4503599627370496)}n.readDoubleLE=e.bind(null,Zl,0,4),n.readDoubleBE=e.bind(null,Yl,4,0)}(),n}function ql(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}function Wl(n,t,e){t[e]=n>>>24,t[e+1]=n>>>16&255,t[e+2]=n>>>8&255,t[e+3]=n&255}function Zl(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0}function Yl(n,t){return(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0}});var Co=Y((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}});var Kl=Y(Vl=>{"use strict";var Io=Vl;Io.length=function(t){for(var e=0,i=0,r=0;r191&&l<224?a[s++]=(l&31)<<6|t[e++]&63:l>239&&l<365?(l=((l&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,a[s++]=55296+(l>>10),a[s++]=56320+(l&1023)):a[s++]=(l&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};Io.write=function(t,e,i){for(var r=i,o,a,s=0;s>6|192,e[i++]=o&63|128):(o&64512)===55296&&((a=t.charCodeAt(s+1))&64512)===56320?(o=65536+((o&1023)<<10)+(a&1023),++s,e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=o&63|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=o&63|128);return i-r}});var Jl=Y((Ox,Xl)=>{"use strict";Xl.exports=rh;function rh(n,t,e){var i=e||8192,r=i>>>1,o=null,a=i;return function(l){if(l<1||l>r)return n(l);a+l>i&&(o=n(i),a=0);var c=t.call(o,a,a+=l);return a&7&&(a=(a|7)+1),c}}});var ec=Y((Dx,Ql)=>{"use strict";Ql.exports=ge;var Qn=et();function ge(n,t){this.lo=n>>>0,this.hi=t>>>0}var Jt=ge.zero=new ge(0,0);Jt.toNumber=function(){return 0};Jt.zzEncode=Jt.zzDecode=function(){return this};Jt.length=function(){return 1};var oh=ge.zeroHash="\0\0\0\0\0\0\0\0";ge.fromNumber=function(t){if(t===0)return Jt;var e=t<0;e&&(t=-t);var i=t>>>0,r=(t-i)/4294967296>>>0;return e&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new ge(i,r)};ge.from=function(t){if(typeof t=="number")return ge.fromNumber(t);if(Qn.isString(t))if(Qn.Long)t=Qn.Long.fromString(t);else return ge.fromNumber(parseInt(t,10));return t.low||t.high?new ge(t.low>>>0,t.high>>>0):Jt};ge.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,i=~this.hi>>>0;return e||(i=i+1>>>0),-(e+i*4294967296)}return this.lo+this.hi*4294967296};ge.prototype.toLong=function(t){return Qn.Long?new Qn.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var Ot=String.prototype.charCodeAt;ge.fromHash=function(t){return t===oh?Jt:new ge((Ot.call(t,0)|Ot.call(t,1)<<8|Ot.call(t,2)<<16|Ot.call(t,3)<<24)>>>0,(Ot.call(t,4)|Ot.call(t,5)<<8|Ot.call(t,6)<<16|Ot.call(t,7)<<24)>>>0)};ge.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};ge.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};ge.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};ge.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}});var et=Y(Fo=>{"use strict";var j=Fo;j.asPromise=Do();j.base64=Bl();j.EventEmitter=jl();j.float=Gl();j.inquire=Co();j.utf8=Kl();j.pool=Jl();j.LongBits=ec();j.isNode=Boolean(typeof global!="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node);j.global=j.isNode&&global||typeof window!="undefined"&&window||typeof self!="undefined"&&self||Fo;j.emptyArray=Object.freeze?Object.freeze([]):[];j.emptyObject=Object.freeze?Object.freeze({}):{};j.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};j.isString=function(t){return typeof t=="string"||t instanceof String};j.isObject=function(t){return t&&typeof t=="object"};j.isset=j.isSet=function(t,e){var i=t[e];return i!=null&&t.hasOwnProperty(e)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};j.Buffer=function(){try{var n=j.inquire("buffer").Buffer;return n.prototype.utf8Write?n:null}catch(t){return null}}();j._Buffer_from=null;j._Buffer_allocUnsafe=null;j.newBuffer=function(t){return typeof t=="number"?j.Buffer?j._Buffer_allocUnsafe(t):new j.Array(t):j.Buffer?j._Buffer_from(t):typeof Uint8Array=="undefined"?t:new Uint8Array(t)};j.Array=typeof Uint8Array!="undefined"?Uint8Array:Array;j.Long=j.global.dcodeIO&&j.global.dcodeIO.Long||j.global.Long||j.inquire("long");j.key2Re=/^true|false|0|1$/;j.key32Re=/^-?(?:0|[1-9][0-9]*)$/;j.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;j.longToHash=function(t){return t?j.LongBits.from(t).toHash():j.LongBits.zeroHash};j.longFromHash=function(t,e){var i=j.LongBits.fromHash(t);return j.Long?j.Long.fromBits(i.lo,i.hi,e):i.toNumber(Boolean(e))};function tc(n,t,e){for(var i=Object.keys(t),r=0;r-1;--o)if(e[r[o]]===1&&this[r[o]]!==void 0&&this[r[o]]!==null)return r[o]}};j.oneOfSetter=function(t){return function(e){for(var i=0;i{"use strict";ac.exports=X;var $e=et(),Lo,Vi=$e.LongBits,ic=$e.base64,rc=$e.utf8;function ei(n,t,e){this.fn=n,this.len=t,this.next=void 0,this.val=e}function Mo(){}function ah(n){this.head=n.head,this.tail=n.tail,this.len=n.len,this.next=n.states}function X(){this.len=0,this.head=new ei(Mo,0,0),this.tail=this.head,this.states=null}var oc=function(){return $e.Buffer?function(){return(X.create=function(){return new Lo})()}:function(){return new X}};X.create=oc();X.alloc=function(t){return new $e.Array(t)};$e.Array!==Array&&(X.alloc=$e.pool(X.alloc,$e.Array.prototype.subarray));X.prototype._push=function(t,e,i){return this.tail=this.tail.next=new ei(t,e,i),this.len+=e,this};function $o(n,t,e){t[e]=n&255}function sh(n,t,e){for(;n>127;)t[e++]=n&127|128,n>>>=7;t[e]=n}function Bo(n,t){this.len=n,this.next=void 0,this.val=t}Bo.prototype=Object.create(ei.prototype);Bo.prototype.fn=sh;X.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Bo((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};X.prototype.int32=function(t){return t<0?this._push(Uo,10,Vi.fromNumber(t)):this.uint32(t)};X.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Uo(n,t,e){for(;n.hi;)t[e++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)t[e++]=n.lo&127|128,n.lo=n.lo>>>7;t[e++]=n.lo}X.prototype.uint64=function(t){var e=Vi.from(t);return this._push(Uo,e.length(),e)};X.prototype.int64=X.prototype.uint64;X.prototype.sint64=function(t){var e=Vi.from(t).zzEncode();return this._push(Uo,e.length(),e)};X.prototype.bool=function(t){return this._push($o,1,t?1:0)};function Po(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}X.prototype.fixed32=function(t){return this._push(Po,4,t>>>0)};X.prototype.sfixed32=X.prototype.fixed32;X.prototype.fixed64=function(t){var e=Vi.from(t);return this._push(Po,4,e.lo)._push(Po,4,e.hi)};X.prototype.sfixed64=X.prototype.fixed64;X.prototype.float=function(t){return this._push($e.float.writeFloatLE,4,t)};X.prototype.double=function(t){return this._push($e.float.writeDoubleLE,8,t)};var lh=$e.Array.prototype.set?function(t,e,i){e.set(t,i)}:function(t,e,i){for(var r=0;r>>0;if(!e)return this._push($o,1,0);if($e.isString(t)){var i=X.alloc(e=ic.length(t));ic.decode(t,i,0),t=i}return this.uint32(e)._push(lh,e,t)};X.prototype.string=function(t){var e=rc.length(t);return e?this.uint32(e)._push(rc.write,e,t):this._push($o,1,0)};X.prototype.fork=function(){return this.states=new ah(this),this.head=this.tail=new ei(Mo,0,0),this.len=0,this};X.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ei(Mo,0,0),this.len=0),this};X.prototype.ldelim=function(){var t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=t.next,this.tail=e,this.len+=i),this};X.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e};X._configure=function(n){Lo=n,X.create=oc(),Lo._configure()}});var cc=Y((Fx,lc)=>{"use strict";lc.exports=tt;var sc=Ki();(tt.prototype=Object.create(sc.prototype)).constructor=tt;var Dt=et();function tt(){sc.call(this)}tt._configure=function(){tt.alloc=Dt._Buffer_allocUnsafe,tt.writeBytesBuffer=Dt.Buffer&&Dt.Buffer.prototype instanceof Uint8Array&&Dt.Buffer.prototype.set.name==="set"?function(t,e,i){e.set(t,i)}:function(t,e,i){if(t.copy)t.copy(e,i,0,t.length);else for(var r=0;r>>0;return this.uint32(e),e&&this._push(tt.writeBytesBuffer,e,t),this};function ch(n,t,e){n.length<40?Dt.utf8.write(n,t,e):t.utf8Write?t.utf8Write(n,e):t.write(n,e)}tt.prototype.string=function(t){var e=Dt.Buffer.byteLength(t);return this.uint32(e),e&&this._push(ch,e,t),this};tt._configure()});var Ji=Y((Lx,mc)=>{"use strict";mc.exports=se;var ze=et(),Ho,fc=ze.LongBits,ph=ze.utf8;function Ge(n,t){return RangeError("index out of range: "+n.pos+" + "+(t||1)+" > "+n.len)}function se(n){this.buf=n,this.pos=0,this.len=n.length}var pc=typeof Uint8Array!="undefined"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new se(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new se(t);throw Error("illegal buffer")},dc=function(){return ze.Buffer?function(e){return(se.create=function(r){return ze.Buffer.isBuffer(r)?new Ho(r):pc(r)})(e)}:pc};se.create=dc();se.prototype._slice=ze.Array.prototype.subarray||ze.Array.prototype.slice;se.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Ge(this,10);return t}}();se.prototype.int32=function(){return this.uint32()|0};se.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function jo(){var n=new fc(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(n.lo=(n.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n;if(n.lo=(n.lo|(this.buf[this.pos]&127)<<28)>>>0,n.hi=(n.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return n;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Ge(this);if(n.lo=(n.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n}return n.lo=(n.lo|(this.buf[this.pos++]&127)<>>0,n}if(this.len-this.pos>4){for(;t<5;++t)if(n.hi=(n.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n}else for(;t<5;++t){if(this.pos>=this.len)throw Ge(this);if(n.hi=(n.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n}throw Error("invalid varint encoding")}se.prototype.bool=function(){return this.uint32()!==0};function Xi(n,t){return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0}se.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return Xi(this.buf,this.pos+=4)};se.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return Xi(this.buf,this.pos+=4)|0};function uc(){if(this.pos+8>this.len)throw Ge(this,8);return new fc(Xi(this.buf,this.pos+=4),Xi(this.buf,this.pos+=4))}se.prototype.float=function(){if(this.pos+4>this.len)throw Ge(this,4);var t=ze.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};se.prototype.double=function(){if(this.pos+8>this.len)throw Ge(this,4);var t=ze.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};se.prototype.bytes=function(){var t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw Ge(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,i);if(e===i){var r=ze.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,i)};se.prototype.string=function(){var t=this.bytes();return ph.read(t,0,t.length)};se.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Ge(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Ge(this);while(this.buf[this.pos++]&128);return this};se.prototype.skipType=function(n){switch(n){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(n=this.uint32()&7)!==4;)this.skipType(n);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+n+" at offset "+this.pos)}return this};se._configure=function(n){Ho=n,se.create=dc(),Ho._configure();var t=ze.Long?"toLong":"toNumber";ze.merge(se.prototype,{int64:function(){return jo.call(this)[t](!1)},uint64:function(){return jo.call(this)[t](!0)},sint64:function(){return jo.call(this).zzDecode()[t](!1)},fixed64:function(){return uc.call(this)[t](!0)},sfixed64:function(){return uc.call(this)[t](!1)}})}});var bc=Y((Px,yc)=>{"use strict";yc.exports=Qt;var gc=Ji();(Qt.prototype=Object.create(gc.prototype)).constructor=Qt;var hc=et();function Qt(n){gc.call(this,n)}Qt._configure=function(){hc.Buffer&&(Qt.prototype._slice=hc.Buffer.prototype.slice)};Qt.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};Qt._configure()});var wc=Y((Mx,xc)=>{"use strict";xc.exports=ti;var qo=et();(ti.prototype=Object.create(qo.EventEmitter.prototype)).constructor=ti;function ti(n,t,e){if(typeof n!="function")throw TypeError("rpcImpl must be a function");qo.EventEmitter.call(this),this.rpcImpl=n,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(e)}ti.prototype.rpcCall=function n(t,e,i,r,o){if(!r)throw TypeError("request must be specified");var a=this;if(!o)return qo.asPromise(n,a,t,e,i,r);if(!a.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return a.rpcImpl(t,e[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(l,c){if(l)return a.emit("error",l,t),o(l);if(c===null){a.end(!0);return}if(!(c instanceof i))try{c=i[a.responseDelimited?"decodeDelimited":"decode"](c)}catch(p){return a.emit("error",p,t),o(p)}return a.emit("data",c,t),o(null,c)})}catch(s){a.emit("error",s,t),setTimeout(function(){o(s)},0);return}};ti.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Wo=Y(vc=>{"use strict";var uh=vc;uh.Service=wc()});var Zo=Y((Bx,Ec)=>{"use strict";Ec.exports={}});var Ac=Y(Tc=>{"use strict";var Oe=Tc;Oe.build="minimal";Oe.Writer=Ki();Oe.BufferWriter=cc();Oe.Reader=Ji();Oe.BufferReader=bc();Oe.util=et();Oe.rpc=Wo();Oe.roots=Zo();Oe.configure=_c;function _c(){Oe.util._configure(),Oe.Writer._configure(Oe.BufferWriter),Oe.Reader._configure(Oe.BufferReader)}_c()});var Nc=Y((jx,kc)=>{"use strict";kc.exports=Yo;function Yo(n,t){typeof n=="string"&&(t=n,n=void 0);var e=[];function i(o){if(typeof o!="string"){var a=r();if(Yo.verbose&&console.log("codegen: "+a),a="return "+a,o){for(var s=Object.keys(o),l=new Array(s.length+1),c=new Array(s.length),p=0;p()=>(t||n((t={exports:{}}).exports,t),t.exports),Se=(n,t)=>{for(var e in t)vi(n,e,{get:t[e],enumerable:!0})},ts=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of dd(t))!hd.call(n,r)&&r!==e&&vi(n,r,{get:()=>t[r],enumerable:!(i=fd(t,r))||i.enumerable});return n};var ns=(n,t,e)=>(e=n!=null?ud(md(n)):{},ts(t||!n||!n.__esModule?vi(e,"default",{value:n,enumerable:!0}):e,n)),gd=n=>ts(vi({},"__esModule",{value:!0}),n);var Do=Y((Ax,Ll)=>{"use strict";Ll.exports=ih;function ih(n,t){for(var e=new Array(arguments.length-1),i=0,r=2,o=!0;r{"use strict";var zi=$l;zi.length=function(t){var e=t.length;if(!e)return 0;for(var i=0;--e%4>1&&t.charAt(e)==="=";)++i;return Math.ceil(t.length*3)/4-i};var wn=new Array(64),Ml=new Array(123);for(Ye=0;Ye<64;)Ml[wn[Ye]=Ye<26?Ye+65:Ye<52?Ye+71:Ye<62?Ye-4:Ye-59|43]=Ye++;var Ye;zi.encode=function(t,e,i){for(var r=null,o=[],a=0,s=0,l;e>2],l=(c&3)<<4,s=1;break;case 1:o[a++]=wn[l|c>>4],l=(c&15)<<2,s=2;break;case 2:o[a++]=wn[l|c>>6],o[a++]=wn[c&63],s=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),a=0)}return s&&(o[a++]=wn[l],o[a++]=61,s===1&&(o[a++]=61)),r?(a&&r.push(String.fromCharCode.apply(String,o.slice(0,a))),r.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var Pl="invalid encoding";zi.decode=function(t,e,i){for(var r=i,o=0,a,s=0;s1)break;if((l=Ml[l])===void 0)throw Error(Pl);switch(o){case 0:a=l,o=1;break;case 1:e[i++]=a<<2|(l&48)>>4,a=l,o=2;break;case 2:e[i++]=(a&15)<<4|(l&60)>>2,a=l,o=3;break;case 3:e[i++]=(a&3)<<6|l,o=0;break}}if(o===1)throw Error(Pl);return i-r};zi.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var jl=Y((Nx,Ul)=>{"use strict";Ul.exports=Gi;function Gi(){this._listeners={}}Gi.prototype.on=function(t,e,i){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:i||this}),this};Gi.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var i=this._listeners[t],r=0;r{"use strict";zl.exports=Hl(Hl);function Hl(n){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),i=e[3]===128;function r(l,c,p){t[0]=l,c[p]=e[0],c[p+1]=e[1],c[p+2]=e[2],c[p+3]=e[3]}function o(l,c,p){t[0]=l,c[p]=e[3],c[p+1]=e[2],c[p+2]=e[1],c[p+3]=e[0]}n.writeFloatLE=i?r:o,n.writeFloatBE=i?o:r;function a(l,c){return e[0]=l[c],e[1]=l[c+1],e[2]=l[c+2],e[3]=l[c+3],t[0]}function s(l,c){return e[3]=l[c],e[2]=l[c+1],e[1]=l[c+2],e[0]=l[c+3],t[0]}n.readFloatLE=i?a:s,n.readFloatBE=i?s:a}():function(){function t(i,r,o,a){var s=r<0?1:0;if(s&&(r=-r),r===0)i(1/r>0?0:2147483648,o,a);else if(isNaN(r))i(2143289344,o,a);else if(r>34028234663852886e22)i((s<<31|2139095040)>>>0,o,a);else if(r<11754943508222875e-54)i((s<<31|Math.round(r/1401298464324817e-60))>>>0,o,a);else{var l=Math.floor(Math.log(r)/Math.LN2),c=Math.round(r*Math.pow(2,-l)*8388608)&8388607;i((s<<31|l+127<<23|c)>>>0,o,a)}}n.writeFloatLE=t.bind(null,ql),n.writeFloatBE=t.bind(null,Wl);function e(i,r,o){var a=i(r,o),s=(a>>31)*2+1,l=a>>>23&255,c=a&8388607;return l===255?c?NaN:s*(1/0):l===0?s*1401298464324817e-60*c:s*Math.pow(2,l-150)*(c+8388608)}n.readFloatLE=e.bind(null,Zl),n.readFloatBE=e.bind(null,Yl)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),i=e[7]===128;function r(l,c,p){t[0]=l,c[p]=e[0],c[p+1]=e[1],c[p+2]=e[2],c[p+3]=e[3],c[p+4]=e[4],c[p+5]=e[5],c[p+6]=e[6],c[p+7]=e[7]}function o(l,c,p){t[0]=l,c[p]=e[7],c[p+1]=e[6],c[p+2]=e[5],c[p+3]=e[4],c[p+4]=e[3],c[p+5]=e[2],c[p+6]=e[1],c[p+7]=e[0]}n.writeDoubleLE=i?r:o,n.writeDoubleBE=i?o:r;function a(l,c){return e[0]=l[c],e[1]=l[c+1],e[2]=l[c+2],e[3]=l[c+3],e[4]=l[c+4],e[5]=l[c+5],e[6]=l[c+6],e[7]=l[c+7],t[0]}function s(l,c){return e[7]=l[c],e[6]=l[c+1],e[5]=l[c+2],e[4]=l[c+3],e[3]=l[c+4],e[2]=l[c+5],e[1]=l[c+6],e[0]=l[c+7],t[0]}n.readDoubleLE=i?a:s,n.readDoubleBE=i?s:a}():function(){function t(i,r,o,a,s,l){var c=a<0?1:0;if(c&&(a=-a),a===0)i(0,s,l+r),i(1/a>0?0:2147483648,s,l+o);else if(isNaN(a))i(0,s,l+r),i(2146959360,s,l+o);else if(a>17976931348623157e292)i(0,s,l+r),i((c<<31|2146435072)>>>0,s,l+o);else{var p;if(a<22250738585072014e-324)p=a/5e-324,i(p>>>0,s,l+r),i((c<<31|p/4294967296)>>>0,s,l+o);else{var m=Math.floor(Math.log(a)/Math.LN2);m===1024&&(m=1023),p=a*Math.pow(2,-m),i(p*4503599627370496>>>0,s,l+r),i((c<<31|m+1023<<20|p*1048576&1048575)>>>0,s,l+o)}}}n.writeDoubleLE=t.bind(null,ql,0,4),n.writeDoubleBE=t.bind(null,Wl,4,0);function e(i,r,o,a,s){var l=i(a,s+r),c=i(a,s+o),p=(c>>31)*2+1,m=c>>>20&2047,y=4294967296*(c&1048575)+l;return m===2047?y?NaN:p*(1/0):m===0?p*5e-324*y:p*Math.pow(2,m-1075)*(y+4503599627370496)}n.readDoubleLE=e.bind(null,Zl,0,4),n.readDoubleBE=e.bind(null,Yl,4,0)}(),n}function ql(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}function Wl(n,t,e){t[e]=n>>>24,t[e+1]=n>>>16&255,t[e+2]=n>>>8&255,t[e+3]=n&255}function Zl(n,t){return(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0}function Yl(n,t){return(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0}});var Co=Y((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(n){}return null}});var Kl=Y(Vl=>{"use strict";var Io=Vl;Io.length=function(t){for(var e=0,i=0,r=0;r191&&l<224?a[s++]=(l&31)<<6|t[e++]&63:l>239&&l<365?(l=((l&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,a[s++]=55296+(l>>10),a[s++]=56320+(l&1023)):a[s++]=(l&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};Io.write=function(t,e,i){for(var r=i,o,a,s=0;s>6|192,e[i++]=o&63|128):(o&64512)===55296&&((a=t.charCodeAt(s+1))&64512)===56320?(o=65536+((o&1023)<<10)+(a&1023),++s,e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=o&63|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=o&63|128);return i-r}});var Jl=Y((Ox,Xl)=>{"use strict";Xl.exports=rh;function rh(n,t,e){var i=e||8192,r=i>>>1,o=null,a=i;return function(l){if(l<1||l>r)return n(l);a+l>i&&(o=n(i),a=0);var c=t.call(o,a,a+=l);return a&7&&(a=(a|7)+1),c}}});var ec=Y((Dx,Ql)=>{"use strict";Ql.exports=ge;var ei=et();function ge(n,t){this.lo=n>>>0,this.hi=t>>>0}var Jt=ge.zero=new ge(0,0);Jt.toNumber=function(){return 0};Jt.zzEncode=Jt.zzDecode=function(){return this};Jt.length=function(){return 1};var oh=ge.zeroHash="\0\0\0\0\0\0\0\0";ge.fromNumber=function(t){if(t===0)return Jt;var e=t<0;e&&(t=-t);var i=t>>>0,r=(t-i)/4294967296>>>0;return e&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new ge(i,r)};ge.from=function(t){if(typeof t=="number")return ge.fromNumber(t);if(ei.isString(t))if(ei.Long)t=ei.Long.fromString(t);else return ge.fromNumber(parseInt(t,10));return t.low||t.high?new ge(t.low>>>0,t.high>>>0):Jt};ge.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,i=~this.hi>>>0;return e||(i=i+1>>>0),-(e+i*4294967296)}return this.lo+this.hi*4294967296};ge.prototype.toLong=function(t){return ei.Long?new ei.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var Ot=String.prototype.charCodeAt;ge.fromHash=function(t){return t===oh?Jt:new ge((Ot.call(t,0)|Ot.call(t,1)<<8|Ot.call(t,2)<<16|Ot.call(t,3)<<24)>>>0,(Ot.call(t,4)|Ot.call(t,5)<<8|Ot.call(t,6)<<16|Ot.call(t,7)<<24)>>>0)};ge.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};ge.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};ge.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};ge.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}});var et=Y(Fo=>{"use strict";var H=Fo;H.asPromise=Do();H.base64=Bl();H.EventEmitter=jl();H.float=Gl();H.inquire=Co();H.utf8=Kl();H.pool=Jl();H.LongBits=ec();H.isNode=Boolean(typeof global!="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node);H.global=H.isNode&&global||typeof window!="undefined"&&window||typeof self!="undefined"&&self||Fo;H.emptyArray=Object.freeze?Object.freeze([]):[];H.emptyObject=Object.freeze?Object.freeze({}):{};H.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};H.isString=function(t){return typeof t=="string"||t instanceof String};H.isObject=function(t){return t&&typeof t=="object"};H.isset=H.isSet=function(t,e){var i=t[e];return i!=null&&t.hasOwnProperty(e)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};H.Buffer=function(){try{var n=H.inquire("buffer").Buffer;return n.prototype.utf8Write?n:null}catch(t){return null}}();H._Buffer_from=null;H._Buffer_allocUnsafe=null;H.newBuffer=function(t){return typeof t=="number"?H.Buffer?H._Buffer_allocUnsafe(t):new H.Array(t):H.Buffer?H._Buffer_from(t):typeof Uint8Array=="undefined"?t:new Uint8Array(t)};H.Array=typeof Uint8Array!="undefined"?Uint8Array:Array;H.Long=H.global.dcodeIO&&H.global.dcodeIO.Long||H.global.Long||H.inquire("long");H.key2Re=/^true|false|0|1$/;H.key32Re=/^-?(?:0|[1-9][0-9]*)$/;H.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;H.longToHash=function(t){return t?H.LongBits.from(t).toHash():H.LongBits.zeroHash};H.longFromHash=function(t,e){var i=H.LongBits.fromHash(t);return H.Long?H.Long.fromBits(i.lo,i.hi,e):i.toNumber(Boolean(e))};function tc(n,t,e){for(var i=Object.keys(t),r=0;r-1;--o)if(e[r[o]]===1&&this[r[o]]!==void 0&&this[r[o]]!==null)return r[o]}};H.oneOfSetter=function(t){return function(e){for(var i=0;i{"use strict";ac.exports=X;var $e=et(),Lo,Vi=$e.LongBits,ic=$e.base64,rc=$e.utf8;function ti(n,t,e){this.fn=n,this.len=t,this.next=void 0,this.val=e}function Mo(){}function ah(n){this.head=n.head,this.tail=n.tail,this.len=n.len,this.next=n.states}function X(){this.len=0,this.head=new ti(Mo,0,0),this.tail=this.head,this.states=null}var oc=function(){return $e.Buffer?function(){return(X.create=function(){return new Lo})()}:function(){return new X}};X.create=oc();X.alloc=function(t){return new $e.Array(t)};$e.Array!==Array&&(X.alloc=$e.pool(X.alloc,$e.Array.prototype.subarray));X.prototype._push=function(t,e,i){return this.tail=this.tail.next=new ti(t,e,i),this.len+=e,this};function $o(n,t,e){t[e]=n&255}function sh(n,t,e){for(;n>127;)t[e++]=n&127|128,n>>>=7;t[e]=n}function Bo(n,t){this.len=n,this.next=void 0,this.val=t}Bo.prototype=Object.create(ti.prototype);Bo.prototype.fn=sh;X.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Bo((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};X.prototype.int32=function(t){return t<0?this._push(Uo,10,Vi.fromNumber(t)):this.uint32(t)};X.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Uo(n,t,e){for(;n.hi;)t[e++]=n.lo&127|128,n.lo=(n.lo>>>7|n.hi<<25)>>>0,n.hi>>>=7;for(;n.lo>127;)t[e++]=n.lo&127|128,n.lo=n.lo>>>7;t[e++]=n.lo}X.prototype.uint64=function(t){var e=Vi.from(t);return this._push(Uo,e.length(),e)};X.prototype.int64=X.prototype.uint64;X.prototype.sint64=function(t){var e=Vi.from(t).zzEncode();return this._push(Uo,e.length(),e)};X.prototype.bool=function(t){return this._push($o,1,t?1:0)};function Po(n,t,e){t[e]=n&255,t[e+1]=n>>>8&255,t[e+2]=n>>>16&255,t[e+3]=n>>>24}X.prototype.fixed32=function(t){return this._push(Po,4,t>>>0)};X.prototype.sfixed32=X.prototype.fixed32;X.prototype.fixed64=function(t){var e=Vi.from(t);return this._push(Po,4,e.lo)._push(Po,4,e.hi)};X.prototype.sfixed64=X.prototype.fixed64;X.prototype.float=function(t){return this._push($e.float.writeFloatLE,4,t)};X.prototype.double=function(t){return this._push($e.float.writeDoubleLE,8,t)};var lh=$e.Array.prototype.set?function(t,e,i){e.set(t,i)}:function(t,e,i){for(var r=0;r>>0;if(!e)return this._push($o,1,0);if($e.isString(t)){var i=X.alloc(e=ic.length(t));ic.decode(t,i,0),t=i}return this.uint32(e)._push(lh,e,t)};X.prototype.string=function(t){var e=rc.length(t);return e?this.uint32(e)._push(rc.write,e,t):this._push($o,1,0)};X.prototype.fork=function(){return this.states=new ah(this),this.head=this.tail=new ti(Mo,0,0),this.len=0,this};X.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ti(Mo,0,0),this.len=0),this};X.prototype.ldelim=function(){var t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=t.next,this.tail=e,this.len+=i),this};X.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e};X._configure=function(n){Lo=n,X.create=oc(),Lo._configure()}});var cc=Y((Fx,lc)=>{"use strict";lc.exports=tt;var sc=Ki();(tt.prototype=Object.create(sc.prototype)).constructor=tt;var Dt=et();function tt(){sc.call(this)}tt._configure=function(){tt.alloc=Dt._Buffer_allocUnsafe,tt.writeBytesBuffer=Dt.Buffer&&Dt.Buffer.prototype instanceof Uint8Array&&Dt.Buffer.prototype.set.name==="set"?function(t,e,i){e.set(t,i)}:function(t,e,i){if(t.copy)t.copy(e,i,0,t.length);else for(var r=0;r>>0;return this.uint32(e),e&&this._push(tt.writeBytesBuffer,e,t),this};function ch(n,t,e){n.length<40?Dt.utf8.write(n,t,e):t.utf8Write?t.utf8Write(n,e):t.write(n,e)}tt.prototype.string=function(t){var e=Dt.Buffer.byteLength(t);return this.uint32(e),e&&this._push(ch,e,t),this};tt._configure()});var Ji=Y((Lx,mc)=>{"use strict";mc.exports=se;var ze=et(),Ho,fc=ze.LongBits,ph=ze.utf8;function Ge(n,t){return RangeError("index out of range: "+n.pos+" + "+(t||1)+" > "+n.len)}function se(n){this.buf=n,this.pos=0,this.len=n.length}var pc=typeof Uint8Array!="undefined"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new se(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new se(t);throw Error("illegal buffer")},dc=function(){return ze.Buffer?function(e){return(se.create=function(r){return ze.Buffer.isBuffer(r)?new Ho(r):pc(r)})(e)}:pc};se.create=dc();se.prototype._slice=ze.Array.prototype.subarray||ze.Array.prototype.slice;se.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Ge(this,10);return t}}();se.prototype.int32=function(){return this.uint32()|0};se.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function jo(){var n=new fc(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(n.lo=(n.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n;if(n.lo=(n.lo|(this.buf[this.pos]&127)<<28)>>>0,n.hi=(n.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return n;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Ge(this);if(n.lo=(n.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n}return n.lo=(n.lo|(this.buf[this.pos++]&127)<>>0,n}if(this.len-this.pos>4){for(;t<5;++t)if(n.hi=(n.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n}else for(;t<5;++t){if(this.pos>=this.len)throw Ge(this);if(n.hi=(n.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return n}throw Error("invalid varint encoding")}se.prototype.bool=function(){return this.uint32()!==0};function Xi(n,t){return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0}se.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return Xi(this.buf,this.pos+=4)};se.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return Xi(this.buf,this.pos+=4)|0};function uc(){if(this.pos+8>this.len)throw Ge(this,8);return new fc(Xi(this.buf,this.pos+=4),Xi(this.buf,this.pos+=4))}se.prototype.float=function(){if(this.pos+4>this.len)throw Ge(this,4);var t=ze.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};se.prototype.double=function(){if(this.pos+8>this.len)throw Ge(this,4);var t=ze.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};se.prototype.bytes=function(){var t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw Ge(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,i);if(e===i){var r=ze.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,i)};se.prototype.string=function(){var t=this.bytes();return ph.read(t,0,t.length)};se.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Ge(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Ge(this);while(this.buf[this.pos++]&128);return this};se.prototype.skipType=function(n){switch(n){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(n=this.uint32()&7)!==4;)this.skipType(n);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+n+" at offset "+this.pos)}return this};se._configure=function(n){Ho=n,se.create=dc(),Ho._configure();var t=ze.Long?"toLong":"toNumber";ze.merge(se.prototype,{int64:function(){return jo.call(this)[t](!1)},uint64:function(){return jo.call(this)[t](!0)},sint64:function(){return jo.call(this).zzDecode()[t](!1)},fixed64:function(){return uc.call(this)[t](!0)},sfixed64:function(){return uc.call(this)[t](!1)}})}});var bc=Y((Px,yc)=>{"use strict";yc.exports=Qt;var gc=Ji();(Qt.prototype=Object.create(gc.prototype)).constructor=Qt;var hc=et();function Qt(n){gc.call(this,n)}Qt._configure=function(){hc.Buffer&&(Qt.prototype._slice=hc.Buffer.prototype.slice)};Qt.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};Qt._configure()});var wc=Y((Mx,xc)=>{"use strict";xc.exports=ni;var qo=et();(ni.prototype=Object.create(qo.EventEmitter.prototype)).constructor=ni;function ni(n,t,e){if(typeof n!="function")throw TypeError("rpcImpl must be a function");qo.EventEmitter.call(this),this.rpcImpl=n,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(e)}ni.prototype.rpcCall=function n(t,e,i,r,o){if(!r)throw TypeError("request must be specified");var a=this;if(!o)return qo.asPromise(n,a,t,e,i,r);if(!a.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return a.rpcImpl(t,e[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(l,c){if(l)return a.emit("error",l,t),o(l);if(c===null){a.end(!0);return}if(!(c instanceof i))try{c=i[a.responseDelimited?"decodeDelimited":"decode"](c)}catch(p){return a.emit("error",p,t),o(p)}return a.emit("data",c,t),o(null,c)})}catch(s){a.emit("error",s,t),setTimeout(function(){o(s)},0);return}};ni.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Wo=Y(vc=>{"use strict";var uh=vc;uh.Service=wc()});var Zo=Y((Bx,Ec)=>{"use strict";Ec.exports={}});var Ac=Y(Tc=>{"use strict";var Oe=Tc;Oe.build="minimal";Oe.Writer=Ki();Oe.BufferWriter=cc();Oe.Reader=Ji();Oe.BufferReader=bc();Oe.util=et();Oe.rpc=Wo();Oe.roots=Zo();Oe.configure=_c;function _c(){Oe.util._configure(),Oe.Writer._configure(Oe.BufferWriter),Oe.Reader._configure(Oe.BufferReader)}_c()});var Nc=Y((jx,kc)=>{"use strict";kc.exports=Yo;function Yo(n,t){typeof n=="string"&&(t=n,n=void 0);var e=[];function i(o){if(typeof o!="string"){var a=r();if(Yo.verbose&&console.log("codegen: "+a),a="return "+a,o){for(var s=Object.keys(o),l=new Array(s.length+1),c=new Array(s.length),p=0;p{"use strict";Sc.exports=ni;var fh=Do(),dh=Co(),zo=dh("fs");function ni(n,t,e){return typeof t=="function"?(e=t,t={}):t||(t={}),e?!t.xhr&&zo&&zo.readFile?zo.readFile(n,function(r,o){return r&&typeof XMLHttpRequest!="undefined"?ni.xhr(n,t,e):r?e(r):e(null,t.binary?o:o.toString("utf8"))}):ni.xhr(n,t,e):fh(ni,this,n,t)}ni.xhr=function(t,e,i){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(r.readyState===4){if(r.status!==0&&r.status!==200)return i(Error("status "+r.status));if(e.binary){var a=r.response;if(!a){a=[];for(var s=0;s{"use strict";var Vo=Dc,Oc=Vo.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},Go=Vo.normalize=function(t){t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var e=t.split("/"),i=Oc(t),r="";i&&(r=e.shift()+"/");for(var o=0;o0&&e[o-1]!==".."?e.splice(--o,2):i?e.splice(o,1):++o:e[o]==="."?e.splice(o,1):++o;return r+e.join("/")};Vo.resolve=function(t,e,i){return i||(e=Go(e)),Oc(e)?e:(i||(t=Go(t)),(t=t.replace(/(?:\/|^)[^/]+$/,"")).length?Go(t+"/"+e):e)}});var en=Y(Ic=>{"use strict";var ii=Ic,mh=ye(),hh=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function ri(n,t){var e=0,i={};for(t|=0;e{"use strict";Pc.exports=Be;var Qi=tn();((Be.prototype=Object.create(Qi.prototype)).constructor=Be).className="Field";var Fc=Ve(),Lc=en(),pe=ye(),Ko,gh=/^required|optional|repeated$/;Be.fromJSON=function(t,e){return new Be(t,e.id,e.type,e.rule,e.extend,e.options,e.comment)};function Be(n,t,e,i,r,o,a){if(pe.isObject(i)?(a=r,o=i,i=r=void 0):pe.isObject(r)&&(a=o,o=r,r=void 0),Qi.call(this,n,o),!pe.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!pe.isString(e))throw TypeError("type must be a string");if(i!==void 0&&!gh.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(r!==void 0&&!pe.isString(r))throw TypeError("extend must be a string");i==="proto3_optional"&&(i="optional"),this.rule=i&&i!=="optional"?i:void 0,this.type=e,this.id=t,this.extend=r||void 0,this.required=i==="required",this.optional=!this.required,this.repeated=i==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=pe.Long?Lc.long[e]!==void 0:!1,this.bytes=e==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=a}Object.defineProperty(Be.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}});Be.prototype.setOption=function(t,e,i){return t==="packed"&&(this._packed=null),Qi.prototype.setOption.call(this,t,e,i)};Be.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return pe.toObject(["rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])};Be.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=Lc.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Ko?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof Fc&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof Fc))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=pe.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var t;pe.base64.test(this.typeDefault)?pe.base64.decode(this.typeDefault,t=pe.newBuffer(pe.base64.length(this.typeDefault)),0):pe.utf8.write(this.typeDefault,t=pe.newBuffer(pe.utf8.length(this.typeDefault)),0),this.typeDefault=t}return this.map?this.defaultValue=pe.emptyObject:this.repeated?this.defaultValue=pe.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof Ko&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Qi.prototype.resolve.call(this)};Be.d=function(t,e,i,r){return typeof e=="function"?e=pe.decorateType(e).name:e&&typeof e=="object"&&(e=pe.decorateEnum(e).name),function(a,s){pe.decorateType(a.constructor).add(new Be(s,t,e,i,{default:r}))}};Be._configure=function(t){Ko=t}});var vn=Y((Yx,Bc)=>{"use strict";Bc.exports=Ue;var tr=tn();((Ue.prototype=Object.create(tr.prototype)).constructor=Ue).className="OneOf";var Mc=Ct(),er=ye();function Ue(n,t,e,i){if(Array.isArray(t)||(e=t,t=void 0),tr.call(this,n,e),!(t===void 0||Array.isArray(t)))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}Ue.fromJSON=function(t,e){return new Ue(t,e.oneof,e.options,e.comment)};Ue.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return er.toObject(["options",this.options,"oneof",this.oneof,"comment",e?this.comment:void 0])};function $c(n){if(n.parent)for(var t=0;t-1&&this.oneof.splice(e,1),t.partOf=null,this};Ue.prototype.onAdd=function(t){tr.prototype.onAdd.call(this,t);for(var e=this,i=0;i{"use strict";qc.exports=J;var Xo=tn();((J.prototype=Object.create(Xo.prototype)).constructor=J).className="Namespace";var Uc=Ct(),nr=ye(),yh=vn(),En,oi,_n;J.fromJSON=function(t,e){return new J(t,e.options).addJSON(e.nested)};function jc(n,t){if(n&&n.length){for(var e={},i=0;ie)return!0}return!1};J.isReservedName=function(t,e){if(t){for(var i=0;i0;){var r=t.shift();if(i.nested&&i.nested[r]){if(i=i.nested[r],!(i instanceof J))throw Error("path conflicts with non-namespace objects")}else i.add(i=new J(r))}return e&&i.addJSON(e),i};J.prototype.resolveAll=function(){for(var t=this.nestedArray,e=0;e-1)return r}else if(r instanceof J&&(r=r.lookup(t.slice(1),e,!0)))return r}else for(var o=0;o{"use strict";Wc.exports=dt;var Jo=Ct();((dt.prototype=Object.create(Jo.prototype)).constructor=dt).className="MapField";var bh=en(),ai=ye();function dt(n,t,e,i,r,o){if(Jo.call(this,n,t,i,void 0,void 0,r,o),!ai.isString(e))throw TypeError("keyType must be a string");this.keyType=e,this.resolvedKeyType=null,this.map=!0}dt.fromJSON=function(t,e){return new dt(t,e.id,e.keyType,e.type,e.options,e.comment)};dt.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return ai.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])};dt.prototype.resolve=function(){if(this.resolved)return this;if(bh.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return Jo.prototype.resolve.call(this)};dt.d=function(t,e,i){return typeof i=="function"?i=ai.decorateType(i).name:i&&typeof i=="object"&&(i=ai.decorateEnum(i).name),function(o,a){ai.decorateType(o.constructor).add(new dt(a,t,e,i))}}});var rr=Y((Vx,Zc)=>{"use strict";Zc.exports=nn;var Qo=tn();((nn.prototype=Object.create(Qo.prototype)).constructor=nn).className="Method";var An=ye();function nn(n,t,e,i,r,o,a,s,l){if(An.isObject(r)?(a=r,r=o=void 0):An.isObject(o)&&(a=o,o=void 0),!(t===void 0||An.isString(t)))throw TypeError("type must be a string");if(!An.isString(e))throw TypeError("requestType must be a string");if(!An.isString(i))throw TypeError("responseType must be a string");Qo.call(this,n,a),this.type=t||"rpc",this.requestType=e,this.requestStream=r?!0:void 0,this.responseType=i,this.responseStream=o?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=s,this.parsedOptions=l}nn.fromJSON=function(t,e){return new nn(t,e.type,e.requestType,e.responseType,e.requestStream,e.responseStream,e.options,e.comment,e.parsedOptions)};nn.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return An.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",e?this.comment:void 0,"parsedOptions",this.parsedOptions])};nn.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),Qo.prototype.resolve.call(this))}});var or=Y((Kx,zc)=>{"use strict";zc.exports=je;var It=Tn();((je.prototype=Object.create(It.prototype)).constructor=je).className="Service";var ea=rr(),si=ye(),xh=Wo();function je(n,t){It.call(this,n,t),this.methods={},this._methodsArray=null}je.fromJSON=function(t,e){var i=new je(t,e.options);if(e.methods)for(var r=Object.keys(e.methods),o=0;o{"use strict";Gc.exports=nt;var wh=et();function nt(n){if(n)for(var t=Object.keys(n),e=0;e{"use strict";Kc.exports=_h;var vh=Ve(),mt=en(),Vc=ye();function Eh(n){return"missing required '"+n.name+"'"}function _h(n){var t=Vc.codegen(["r","l"],n.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(n.fieldsArray.filter(function(s){return s.map}).length?",k,value":""))("while(r.pos>>3){");for(var e=0;e>>3){")("case 1: k=r.%s(); break",i.keyType)("case 2:"),mt.basic[r]===void 0?t("value=types[%i].decode(r,r.uint32())",e):t("value=r.%s()",r),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),mt.long[i.keyType]!==void 0?t('%s[typeof k==="object"?util.longToHash(k):k]=value',o):t("%s[k]=value",o)):i.repeated?(t("if(!(%s&&%s.length))",o,o)("%s=[]",o),mt.packed[r]!==void 0&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";Xc.exports=kh;var Th=Ve(),na=ye();function He(n,t){return n.name+": "+t+(n.repeated&&t!=="array"?"[]":n.map&&t!=="object"?"{k:"+n.keyType+"}":"")+" expected"}function ia(n,t,e,i){if(t.resolvedType)if(t.resolvedType instanceof Th){n("switch(%s){",i)("default:")("return%j",He(t,"enum value"));for(var r=Object.keys(t.resolvedType.values),o=0;o{"use strict";var Jc=Qc,li=Ve(),it=ye();function oa(n,t,e,i){var r=!1;if(t.resolvedType)if(t.resolvedType instanceof li){n("switch(d%s){",i);for(var o=t.resolvedType.values,a=Object.keys(o),s=0;s>>0",i,i);break;case"int32":case"sint32":case"sfixed32":n("m%s=d%s|0",i,i);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":n("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",i,i,l)('else if(typeof d%s==="string")',i)("m%s=parseInt(d%s,10)",i,i)('else if(typeof d%s==="number")',i)("m%s=d%s",i,i)('else if(typeof d%s==="object")',i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",i,i,i,l?"true":"");break;case"bytes":n('if(typeof d%s==="string")',i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",i,i,i)("else if(d%s.length >= 0)",i)("m%s=d%s",i,i);break;case"string":n("m%s=String(d%s)",i,i);break;case"bool":n("m%s=Boolean(d%s)",i,i);break}}return n}Jc.fromObject=function(t){var e=t.fieldsArray,i=it.codegen(["d"],t.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!e.length)return i("return new this.ctor");i("var m=new this.ctor");for(var r=0;r>>0,m%s.high>>>0).toNumber(%s):m%s",i,i,i,i,r?"true":"",i);break;case"bytes":n("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",i,i,i,i,i);break;default:n("d%s=m%s",i,i);break}}return n}Jc.toObject=function(t){var e=t.fieldsArray.slice().sort(it.compareFieldsById);if(!e.length)return it.codegen()("return {}");for(var i=it.codegen(["m","o"],t.name+"$toObject")("if(!o)")("o={}")("var d={}"),r=[],o=[],a=[],s=0;s{"use strict";var Nh=ep,Sh=ar();Nh[".google.protobuf.Any"]={fromObject:function(n){if(n&&n["@type"]){var t=n["@type"].substring(n["@type"].lastIndexOf("/")+1),e=this.lookup(t);if(e){var i=n["@type"].charAt(0)==="."?n["@type"].slice(1):n["@type"];return i.indexOf("/")===-1&&(i="/"+i),this.create({type_url:i,value:e.encode(e.fromObject(n)).finish()})}}return this.fromObject(n)},toObject:function(n,t){var e="type.googleapis.com/",i="",r="";if(t&&t.json&&n.type_url&&n.value){r=n.type_url.substring(n.type_url.lastIndexOf("/")+1),i=n.type_url.substring(0,n.type_url.lastIndexOf("/")+1);var o=this.lookup(r);o&&(n=o.decode(n.value))}if(!(n instanceof this.ctor)&&n instanceof Sh){var a=n.$type.toObject(n,t),s=n.$type.fullName[0]==="."?n.$type.fullName.slice(1):n.$type.fullName;return i===""&&(i=e),r=i+s,a["@type"]=r,a}return this.toObject(n,t)}}});var cr=Y((nw,np)=>{"use strict";np.exports=ne;var Ke=Tn();((ne.prototype=Object.create(Ke.prototype)).constructor=ne).className="Type";var Rh=Ve(),ua=vn(),sr=Ct(),Oh=ir(),Dh=or(),ca=ar(),pa=Ji(),Ch=Ki(),we=ye(),Ih=fa(),Fh=ta(),Lh=ra(),tp=sa(),Ph=la();function ne(n,t){Ke.call(this,n,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(ne.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var n=Object.keys(this.fields),t=0;t{"use strict";sp.exports=Ce;var ur=Tn();((Ce.prototype=Object.create(ur.prototype)).constructor=Ce).className="Root";var ma=Ct(),rp=Ve(),Mh=vn(),Ft=ye(),op,da,ci;function Ce(n){ur.call(this,"",n),this.deferred=[],this.files=[]}Ce.fromJSON=function(t,e){return e||(e=new Ce),t.options&&e.setOptions(t.options),e.addJSON(t.nested)};Ce.prototype.resolvePath=Ft.path.resolve;Ce.prototype.fetch=Ft.fetch;function ap(){}Ce.prototype.load=function n(t,e,i){typeof e=="function"&&(i=e,e=void 0);var r=this;if(!i)return Ft.asPromise(n,r,t,e);var o=i===ap;function a(E,v){if(i){var d=i;if(i=null,o)throw E;d(E,v)}}function s(E){var v=E.lastIndexOf("google/protobuf/");if(v>-1){var d=E.substring(v);if(d in ci)return d}return null}function l(E,v){try{if(Ft.isString(v)&&v.charAt(0)==="{"&&(v=JSON.parse(v)),!Ft.isString(v))r.setOptions(v.options).addJSON(v.nested);else{da.filename=E;var d=da(v,r,e),f,g=0;if(d.imports)for(;g-1)){if(r.files.push(E),E in ci){o?l(E,ci[E]):(++p,setTimeout(function(){--p,l(E,ci[E])}));return}if(o){var d;try{d=Ft.fs.readFileSync(E).toString("utf8")}catch(f){v||a(f);return}l(E,d)}else++p,r.fetch(E,function(f,g){if(--p,!!i){if(f){v?p||a(null,r):a(f);return}l(E,g)}})}}var p=0;Ft.isString(t)&&(t=[t]);for(var m=0,y;m-1&&this.deferred.splice(e,1)}}else if(t instanceof rp)pr.test(t.name)&&delete t.parent[t.name];else if(t instanceof ur){for(var i=0;i{"use strict";var le=cp.exports=et(),lp=Zo(),ha,ga;le.codegen=Nc();le.fetch=Rc();le.path=Cc();le.fs=le.inquire("fs");le.toArray=function(t){if(t){for(var e=Object.keys(t),i=new Array(e.length),r=0;r0)o[l]=r(o[l]||{},a,s);else{var c=o[l];c&&(s=[].concat(c).concat(s)),o[l]=s}return o}if(typeof t!="object")throw TypeError("dst must be an object");if(!e)throw TypeError("path must be specified");return e=e.split("."),r(t,e,i)};Object.defineProperty(le,"decorateRoot",{get:function(){return lp.decorated||(lp.decorated=new(fr()))}})});var tn=Y((ow,pp)=>{"use strict";pp.exports=Ie;Ie.className="ReflectionObject";var dr=ye(),mr;function Ie(n,t){if(!dr.isString(n))throw TypeError("name must be a string");if(t&&!dr.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=n,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(Ie.prototype,{root:{get:function(){for(var n=this;n.parent!==null;)n=n.parent;return n}},fullName:{get:function(){for(var n=[this.name],t=this.parent;t;)n.unshift(t.name),t=t.parent;return n.join(".")}}});Ie.prototype.toJSON=function(){throw Error()};Ie.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var e=t.root;e instanceof mr&&e._handleAdd(this)};Ie.prototype.onRemove=function(t){var e=t.root;e instanceof mr&&e._handleRemove(this),this.parent=null,this.resolved=!1};Ie.prototype.resolve=function(){return this.resolved?this:(this.root instanceof mr&&(this.resolved=!0),this)};Ie.prototype.getOption=function(t){if(this.options)return this.options[t]};Ie.prototype.setOption=function(t,e,i){return(!i||!this.options||this.options[t]===void 0)&&((this.options||(this.options={}))[t]=e),this};Ie.prototype.setParsedOption=function(t,e,i){this.parsedOptions||(this.parsedOptions=[]);var r=this.parsedOptions;if(i){var o=r.find(function(l){return Object.prototype.hasOwnProperty.call(l,t)});if(o){var a=o[t];dr.setProperty(a,i,e)}else o={},o[t]=dr.setProperty({},i,e),r.push(o)}else{var s={};s[t]=e,r.push(s)}return this};Ie.prototype.setOptions=function(t,e){if(t)for(var i=Object.keys(t),r=0;r{"use strict";dp.exports=rt;var up=tn();((rt.prototype=Object.create(up.prototype)).constructor=rt).className="Enum";var fp=Tn(),hr=ye();function rt(n,t,e,i,r,o){if(up.call(this,n,e),t&&typeof t!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=r||{},this.valuesOptions=o,this.reserved=void 0,t)for(var a=Object.keys(t),s=0;s{"use strict";hp.exports=qh;var Hh=Ve(),ya=en(),ba=ye();function mp(n,t,e,i){return t.resolvedType.group?n("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",e,i,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):n("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",e,i,(t.id<<3|2)>>>0)}function qh(n){for(var t=ba.codegen(["m","w"],n.name+"$encode")("if(!w)")("w=Writer.create()"),e,i,r=n.fieldsArray.slice().sort(ba.compareFieldsById),e=0;e>>0,8|ya.mapKey[o.keyType],o.keyType),l===void 0?t("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",a,i):t(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|l,s,i),t("}")("}")):o.repeated?(t("if(%s!=null&&%s.length){",i,i),o.packed&&ya.packed[s]!==void 0?t("w.uint32(%i).fork()",(o.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",s,i)("w.ldelim()"):(t("for(var i=0;i<%s.length;++i)",i),l===void 0?mp(t,o,a,i+"[i]"):t("w.uint32(%i).%s(%s[i])",(o.id<<3|l)>>>0,s,i)),t("}")):(o.optional&&t("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,o.name),l===void 0?mp(t,o,a,i):t("w.uint32(%i).%s(%s)",(o.id<<3|l)>>>0,s,i))}return t("return w")}});var yp=Y((lw,gp)=>{"use strict";var V=gp.exports=Ac();V.build="light";function Wh(n,t,e){return typeof t=="function"?(e=t,t=new V.Root):t||(t=new V.Root),t.load(n,e)}V.load=Wh;function Zh(n,t){return t||(t=new V.Root),t.loadSync(n)}V.loadSync=Zh;V.encoder=fa();V.decoder=ta();V.verifier=ra();V.converter=sa();V.ReflectionObject=tn();V.Namespace=Tn();V.Root=fr();V.Enum=Ve();V.Type=cr();V.Field=Ct();V.OneOf=vn();V.MapField=ir();V.Service=or();V.Method=rr();V.Message=ar();V.wrappers=la();V.types=en();V.util=ye();V.ReflectionObject._configure(V.Root);V.Namespace._configure(V.Type,V.Service,V.Enum);V.Root._configure(V.Type);V.Field._configure(V.Type)});var wa=Y((cw,wp)=>{"use strict";wp.exports=xp;var xa=/[\s{}=;:[\],'"()<>]/g,Yh=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,zh=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,Gh=/^ *[*/]+ */,Vh=/^\s*\*?\/*/,Kh=/\n/g,Xh=/\s/,Jh=/\\(.?)/g,Qh={0:"\0",r:"\r",n:` -`,t:" "};function bp(n){return n.replace(Jh,function(t,e){switch(e){case"\\":case"":return e;default:return Qh[e]||""}})}xp.unescape=bp;function xp(n,t){n=n.toString();var e=0,i=n.length,r=1,o=0,a={},s=[],l=null;function c(A){return Error("illegal "+A+" (line "+r+")")}function p(){var A=l==="'"?zh:Yh;A.lastIndex=e-1;var D=A.exec(n);if(!D)throw c("string");return e=A.lastIndex,f(l),l=null,bp(D[1])}function m(A){return n.charAt(A)}function y(A,D,_){var S={type:n.charAt(A++),lineEmpty:!1,leading:_},x;t?x=2:x=3;var C=A-x,O;do if(--C<0||(O=n.charAt(C))===` -`){S.lineEmpty=!0;break}while(O===" "||O===" ");for(var R=n.substring(A,D).split(Kh),M=0;M0)return s.shift();if(l)return p();var A,D,_,S,x,C=e===0;do{if(e===i)return null;for(A=!1;Xh.test(_=m(e));)if(_===` -`&&(C=!0,++r),++e===i)return null;if(m(e)==="/"){if(++e===i)throw c("comment");if(m(e)==="/")if(t){if(S=e,x=!1,E(e-1)){x=!0;do if(e=v(e),e===i||(e++,!C))break;while(E(e))}else e=Math.min(i,v(e)+1);x&&(y(S,e,C),C=!0),r++,A=!0}else{for(x=m(S=e+1)==="/";m(++e)!==` -`;)if(e===i)return null;++e,x&&(y(S,e-1,C),C=!0),++r,A=!0}else if((_=m(e))==="*"){S=e+1,x=t||m(S)==="*";do{if(_===` -`&&++r,++e===i)throw c("comment");D=_,_=m(e)}while(D!=="*"||_!=="/");++e,x&&(y(S,e-2,C),C=!0),A=!0}else return"/"}}while(A);var O=e;xa.lastIndex=0;var R=xa.test(m(O++));if(!R)for(;O{"use strict";Ap.exports=ht;ht.filename=null;ht.defaults={keepCase:!1};var eg=wa(),vp=fr(),Ep=cr(),_p=Ct(),tg=ir(),Tp=vn(),ng=Ve(),ig=or(),rg=rr(),va=en(),Ea=ye(),og=/^[1-9][0-9]*$/,ag=/^-?[1-9][0-9]*$/,sg=/^0[x][0-9a-fA-F]+$/,lg=/^-?0[x][0-9a-fA-F]+$/,cg=/^0[0-7]+$/,pg=/^-?0[0-7]+$/,ug=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,ot=/^[a-zA-Z_][a-zA-Z_0-9]*$/,at=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,fg=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function ht(n,t,e){t instanceof vp||(e=t,t=new vp),e||(e=ht.defaults);var i=e.preferTrailingComment||!1,r=eg(n,e.alternateCommentMode||!1),o=r.next,a=r.push,s=r.peek,l=r.skip,c=r.cmnt,p=!0,m,y,E,v,d=!1,f=t,g=e.keepCase?function(b){return b}:Ea.camelCase;function w(b,k,I){var L=ht.filename;return I||(ht.filename=null),Error("illegal "+(k||"token")+" '"+b+"' ("+(L?L+", ":"")+"line "+r.line+")")}function T(){var b=[],k;do{if((k=o())!=='"'&&k!=="'")throw w(k);b.push(o()),l(k),k=s()}while(k==='"'||k==="'");return b.join("")}function A(b){var k=o();switch(k){case"'":case'"':return a(k),T();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return _(k,!0)}catch(I){if(b&&at.test(k))return k;throw w(k,"value")}}function D(b,k){var I,L;do k&&((I=s())==='"'||I==="'")?b.push(T()):b.push([L=S(o()),l("to",!0)?S(o()):L]);while(l(",",!0));l(";")}function _(b,k){var I=1;switch(b.charAt(0)==="-"&&(I=-1,b=b.substring(1)),b){case"inf":case"INF":case"Inf":return I*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(og.test(b))return I*parseInt(b,10);if(sg.test(b))return I*parseInt(b,16);if(cg.test(b))return I*parseInt(b,8);if(ug.test(b))return I*parseFloat(b);throw w(b,"number",k)}function S(b,k){switch(b){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!k&&b.charAt(0)==="-")throw w(b,"id");if(ag.test(b))return parseInt(b,10);if(lg.test(b))return parseInt(b,16);if(pg.test(b))return parseInt(b,8);throw w(b,"id")}function x(){if(m!==void 0)throw w("package");if(m=o(),!at.test(m))throw w(m,"name");f=f.define(m),l(";")}function C(){var b=s(),k;switch(b){case"weak":k=E||(E=[]),o();break;case"public":o();default:k=y||(y=[]);break}b=T(),l(";"),k.push(b)}function O(){if(l("="),v=T(),d=v==="proto3",!d&&v!=="proto2")throw w(v,"syntax");l(";")}function R(b,k){switch(k){case"option":return U(b,k),l(";"),!0;case"message":return P(b,k),!0;case"enum":return z(b,k),!0;case"service":return pn(b,k),!0;case"extend":return u(b,k),!0}return!1}function M(b,k,I){var L=r.line;if(b&&(typeof b.comment!="string"&&(b.comment=c()),b.filename=ht.filename),l("{",!0)){for(var $;($=o())!=="}";)k($);l(";",!0)}else I&&I(),l(";"),b&&(typeof b.comment!="string"||i)&&(b.comment=c(L)||b.comment)}function P(b,k){if(!ot.test(k=o()))throw w(k,"type name");var I=new Ep(k);M(I,function($){if(!R(I,$))switch($){case"map":F(I,$);break;case"required":case"repeated":H(I,$);break;case"optional":d?H(I,"proto3_optional"):H(I,"optional");break;case"oneof":ee(I,$);break;case"extensions":D(I.extensions||(I.extensions=[]));break;case"reserved":D(I.reserved||(I.reserved=[]),!0);break;default:if(!d||!at.test($))throw w($);a($),H(I,"optional");break}}),b.add(I)}function H(b,k,I){var L=o();if(L==="group"){Z(b,k);return}for(;L.endsWith(".")||s().startsWith(".");)L+=o();if(!at.test(L))throw w(L,"type");var $=o();if(!ot.test($))throw w($,"name");$=g($),l("=");var W=new _p($,S(o()),L,k,I);if(M(W,function(re){if(re==="option")U(W,re),l(";");else throw w(re)},function(){lt(W)}),k==="proto3_optional"){var ie=new Tp("_"+$);W.setOption("proto3_optional",!0),ie.add(W),b.add(ie)}else b.add(W);!d&&W.repeated&&(va.packed[L]!==void 0||va.basic[L]===void 0)&&W.setOption("packed",!1,!0)}function Z(b,k){var I=o();if(!ot.test(I))throw w(I,"name");var L=Ea.lcFirst(I);I===L&&(I=Ea.ucFirst(I)),l("=");var $=S(o()),W=new Ep(I);W.group=!0;var ie=new _p(L,$,I,k);ie.filename=ht.filename,M(W,function(re){switch(re){case"option":U(W,re),l(";");break;case"required":case"repeated":H(W,re);break;case"optional":d?H(W,"proto3_optional"):H(W,"optional");break;case"message":P(W,re);break;case"enum":z(W,re);break;default:throw w(re)}}),b.add(W).add(ie)}function F(b){l("<");var k=o();if(va.mapKey[k]===void 0)throw w(k,"type");l(",");var I=o();if(!at.test(I))throw w(I,"type");l(">");var L=o();if(!ot.test(L))throw w(L,"name");l("=");var $=new tg(g(L),S(o()),k,I);M($,function(ie){if(ie==="option")U($,ie),l(";");else throw w(ie)},function(){lt($)}),b.add($)}function ee(b,k){if(!ot.test(k=o()))throw w(k,"name");var I=new Tp(g(k));M(I,function($){$==="option"?(U(I,$),l(";")):(a($),H(I,"optional"))}),b.add(I)}function z(b,k){if(!ot.test(k=o()))throw w(k,"name");var I=new ng(k);M(I,function($){switch($){case"option":U(I,$),l(";");break;case"reserved":D(I.reserved||(I.reserved=[]),!0);break;default:We(I,$)}}),b.add(I)}function We(b,k){if(!ot.test(k))throw w(k,"name");l("=");var I=S(o(),!0),L={options:void 0};L.setOption=function($,W){this.options===void 0&&(this.options={}),this.options[$]=W},M(L,function(W){if(W==="option")U(L,W),l(";");else throw w(W)},function(){lt(L)}),b.add(k,I,L.comment,L.options)}function U(b,k){var I=l("(",!0);if(!at.test(k=o()))throw w(k,"name");var L=k,$=L,W;I&&(l(")"),L="("+L+")",$=L,k=s(),fg.test(k)&&(W=k.slice(1),L+=k,o())),l("=");var ie=Ne(b,L);Q(b,$,ie,W)}function Ne(b,k){if(l("{",!0)){for(var I={};!l("}",!0);){if(!ot.test(N=o()))throw w(N,"name");if(N===null)throw w(N,"end of input");var L,$=N;if(l(":",!0),s()==="{")L=Ne(b,k+"."+N);else if(s()==="["){L=[];var W;if(l("[",!0)){do W=A(!0),L.push(W);while(l(",",!0));l("]"),typeof W!="undefined"&&G(b,k+"."+N,W)}}else L=A(!0),G(b,k+"."+N,L);var ie=I[$];ie&&(L=[].concat(ie).concat(L)),I[$]=L,l(",",!0),l(";",!0)}return I}var te=A(!0);return G(b,k,te),te}function G(b,k,I){b.setOption&&b.setOption(k,I)}function Q(b,k,I,L){b.setParsedOption&&b.setParsedOption(k,I,L)}function lt(b){if(l("[",!0)){do U(b,"option");while(l(",",!0));l("]")}return b}function pn(b,k){if(!ot.test(k=o()))throw w(k,"service name");var I=new ig(k);M(I,function($){if(!R(I,$))if($==="rpc")h(I,$);else throw w($)}),b.add(I)}function h(b,k){var I=c(),L=k;if(!ot.test(k=o()))throw w(k,"name");var $=k,W,ie,te,re;if(l("("),l("stream",!0)&&(ie=!0),!at.test(k=o())||(W=k,l(")"),l("returns"),l("("),l("stream",!0)&&(re=!0),!at.test(k=o())))throw w(k);te=k,l(")");var un=new rg($,L,W,te,ie,re);un.comment=I,M(un,function(qt){if(qt==="option")U(un,qt),l(";");else throw w(qt)}),b.add(un)}function u(b,k){if(!at.test(k=o()))throw w(k,"reference");var I=k;M(null,function($){switch($){case"required":case"repeated":H(b,$,I);break;case"optional":d?H(b,"proto3_optional",I):H(b,"optional",I);break;default:if(!d||!at.test($))throw w($);a($),H(b,"optional",I);break}})}for(var N;(N=o())!==null;)switch(N){case"package":if(!p)throw w(N);x();break;case"import":if(!p)throw w(N);C();break;case"syntax":if(!p)throw w(N);O();break;case"option":U(f,N),l(";");break;default:if(R(f,N)){p=!1;continue}throw w(N)}return ht.filename=null,{package:m,imports:y,weakImports:E,syntax:v,root:t}}});var Rp=Y((uw,Sp)=>{"use strict";Sp.exports=Xe;var dg=/\/|\./;function Xe(n,t){dg.test(n)||(n="google/protobuf/"+n+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),Xe[n]=t}Xe("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var Np;Xe("duration",{Duration:Np={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});Xe("timestamp",{Timestamp:Np});Xe("empty",{Empty:{fields:{}}});Xe("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});Xe("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});Xe("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});Xe.get=function(t){return Xe[t]||null}});var Dp=Y((fw,Op)=>{"use strict";var Lt=Op.exports=yp();Lt.build="full";Lt.tokenize=wa();Lt.parse=kp();Lt.common=Rp();Lt.Root._configure(Lt.Type,Lt.parse,Lt.common)});var Ip=Y((dw,Cp)=>{"use strict";Cp.exports=Dp()});var Rf=Y(Rr=>{(function(n){n.parser=function(h,u){return new e(h,u)},n.SAXParser=e,n.SAXStream=c,n.createStream=l,n.MAX_BUFFER_LENGTH=64*1024;var t=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];n.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function e(h,u){if(!(this instanceof e))return new e(h,u);var N=this;r(N),N.q=N.c="",N.bufferCheckPosition=n.MAX_BUFFER_LENGTH,N.opt=u||{},N.opt.lowercase=N.opt.lowercase||N.opt.lowercasetags,N.looseCase=N.opt.lowercase?"toLowerCase":"toUpperCase",N.tags=[],N.closed=N.closedRoot=N.sawRoot=!1,N.tag=N.error=null,N.strict=!!h,N.noscript=!!(h||N.opt.noscript),N.state=x.BEGIN,N.strictEntities=N.opt.strictEntities,N.ENTITIES=N.strictEntities?Object.create(n.XML_ENTITIES):Object.create(n.ENTITIES),N.attribList=[],N.opt.xmlns&&(N.ns=Object.create(v)),N.trackPosition=N.opt.position!==!1,N.trackPosition&&(N.position=N.line=N.column=0),O(N,"onready")}Object.create||(Object.create=function(h){function u(){}u.prototype=h;var N=new u;return N}),Object.keys||(Object.keys=function(h){var u=[];for(var N in h)h.hasOwnProperty(N)&&u.push(N);return u});function i(h){for(var u=Math.max(n.MAX_BUFFER_LENGTH,10),N=0,b=0,k=t.length;bu)switch(t[b]){case"textNode":M(h);break;case"cdata":R(h,"oncdata",h.cdata),h.cdata="";break;case"script":R(h,"onscript",h.script),h.script="";break;default:H(h,"Max buffer length exceeded: "+t[b])}N=Math.max(N,I)}var L=n.MAX_BUFFER_LENGTH-N;h.bufferCheckPosition=L+h.position}function r(h){for(var u=0,N=t.length;u"||T(h)}function _(h,u){return h.test(u)}function S(h,u){return!_(h,u)}var x=0;n.STATE={BEGIN:x++,BEGIN_WHITESPACE:x++,TEXT:x++,TEXT_ENTITY:x++,OPEN_WAKA:x++,SGML_DECL:x++,SGML_DECL_QUOTED:x++,DOCTYPE:x++,DOCTYPE_QUOTED:x++,DOCTYPE_DTD:x++,DOCTYPE_DTD_QUOTED:x++,COMMENT_STARTING:x++,COMMENT:x++,COMMENT_ENDING:x++,COMMENT_ENDED:x++,CDATA:x++,CDATA_ENDING:x++,CDATA_ENDING_2:x++,PROC_INST:x++,PROC_INST_BODY:x++,PROC_INST_ENDING:x++,OPEN_TAG:x++,OPEN_TAG_SLASH:x++,ATTRIB:x++,ATTRIB_NAME:x++,ATTRIB_NAME_SAW_WHITE:x++,ATTRIB_VALUE:x++,ATTRIB_VALUE_QUOTED:x++,ATTRIB_VALUE_CLOSED:x++,ATTRIB_VALUE_UNQUOTED:x++,ATTRIB_VALUE_ENTITY_Q:x++,ATTRIB_VALUE_ENTITY_U:x++,CLOSE_TAG:x++,CLOSE_TAG_SAW_WHITE:x++,SCRIPT:x++,SCRIPT_ENDING:x++},n.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},n.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(n.ENTITIES).forEach(function(h){var u=n.ENTITIES[h],N=typeof u=="number"?String.fromCharCode(u):u;n.ENTITIES[h]=N});for(var C in n.STATE)n.STATE[n.STATE[C]]=C;x=n.STATE;function O(h,u,N){h[u]&&h[u](N)}function R(h,u,N){h.textNode&&M(h),O(h,u,N)}function M(h){h.textNode=P(h.opt,h.textNode),h.textNode&&O(h,"ontext",h.textNode),h.textNode=""}function P(h,u){return h.trim&&(u=u.trim()),h.normalize&&(u=u.replace(/\s+/g," ")),u}function H(h,u){return M(h),h.trackPosition&&(u+=` +}`}return i.toString=r,i}Yo.verbose=!1});var Rc=Y((Hx,Sc)=>{"use strict";Sc.exports=ii;var fh=Do(),dh=Co(),zo=dh("fs");function ii(n,t,e){return typeof t=="function"?(e=t,t={}):t||(t={}),e?!t.xhr&&zo&&zo.readFile?zo.readFile(n,function(r,o){return r&&typeof XMLHttpRequest!="undefined"?ii.xhr(n,t,e):r?e(r):e(null,t.binary?o:o.toString("utf8"))}):ii.xhr(n,t,e):fh(ii,this,n,t)}ii.xhr=function(t,e,i){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(r.readyState===4){if(r.status!==0&&r.status!==200)return i(Error("status "+r.status));if(e.binary){var a=r.response;if(!a){a=[];for(var s=0;s{"use strict";var Vo=Dc,Oc=Vo.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},Go=Vo.normalize=function(t){t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var e=t.split("/"),i=Oc(t),r="";i&&(r=e.shift()+"/");for(var o=0;o0&&e[o-1]!==".."?e.splice(--o,2):i?e.splice(o,1):++o:e[o]==="."?e.splice(o,1):++o;return r+e.join("/")};Vo.resolve=function(t,e,i){return i||(e=Go(e)),Oc(e)?e:(i||(t=Go(t)),(t=t.replace(/(?:\/|^)[^/]+$/,"")).length?Go(t+"/"+e):e)}});var en=Y(Ic=>{"use strict";var ri=Ic,mh=ye(),hh=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function oi(n,t){var e=0,i={};for(t|=0;e{"use strict";Pc.exports=Be;var Qi=tn();((Be.prototype=Object.create(Qi.prototype)).constructor=Be).className="Field";var Fc=Ve(),Lc=en(),pe=ye(),Ko,gh=/^required|optional|repeated$/;Be.fromJSON=function(t,e){return new Be(t,e.id,e.type,e.rule,e.extend,e.options,e.comment)};function Be(n,t,e,i,r,o,a){if(pe.isObject(i)?(a=r,o=i,i=r=void 0):pe.isObject(r)&&(a=o,o=r,r=void 0),Qi.call(this,n,o),!pe.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!pe.isString(e))throw TypeError("type must be a string");if(i!==void 0&&!gh.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(r!==void 0&&!pe.isString(r))throw TypeError("extend must be a string");i==="proto3_optional"&&(i="optional"),this.rule=i&&i!=="optional"?i:void 0,this.type=e,this.id=t,this.extend=r||void 0,this.required=i==="required",this.optional=!this.required,this.repeated=i==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=pe.Long?Lc.long[e]!==void 0:!1,this.bytes=e==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=a}Object.defineProperty(Be.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}});Be.prototype.setOption=function(t,e,i){return t==="packed"&&(this._packed=null),Qi.prototype.setOption.call(this,t,e,i)};Be.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return pe.toObject(["rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])};Be.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=Lc.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Ko?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof Fc&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof Fc))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=pe.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var t;pe.base64.test(this.typeDefault)?pe.base64.decode(this.typeDefault,t=pe.newBuffer(pe.base64.length(this.typeDefault)),0):pe.utf8.write(this.typeDefault,t=pe.newBuffer(pe.utf8.length(this.typeDefault)),0),this.typeDefault=t}return this.map?this.defaultValue=pe.emptyObject:this.repeated?this.defaultValue=pe.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof Ko&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Qi.prototype.resolve.call(this)};Be.d=function(t,e,i,r){return typeof e=="function"?e=pe.decorateType(e).name:e&&typeof e=="object"&&(e=pe.decorateEnum(e).name),function(a,s){pe.decorateType(a.constructor).add(new Be(s,t,e,i,{default:r}))}};Be._configure=function(t){Ko=t}});var vn=Y((Yx,Bc)=>{"use strict";Bc.exports=Ue;var tr=tn();((Ue.prototype=Object.create(tr.prototype)).constructor=Ue).className="OneOf";var Mc=Ct(),er=ye();function Ue(n,t,e,i){if(Array.isArray(t)||(e=t,t=void 0),tr.call(this,n,e),!(t===void 0||Array.isArray(t)))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}Ue.fromJSON=function(t,e){return new Ue(t,e.oneof,e.options,e.comment)};Ue.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return er.toObject(["options",this.options,"oneof",this.oneof,"comment",e?this.comment:void 0])};function $c(n){if(n.parent)for(var t=0;t-1&&this.oneof.splice(e,1),t.partOf=null,this};Ue.prototype.onAdd=function(t){tr.prototype.onAdd.call(this,t);for(var e=this,i=0;i{"use strict";qc.exports=J;var Xo=tn();((J.prototype=Object.create(Xo.prototype)).constructor=J).className="Namespace";var Uc=Ct(),nr=ye(),yh=vn(),En,ai,_n;J.fromJSON=function(t,e){return new J(t,e.options).addJSON(e.nested)};function jc(n,t){if(n&&n.length){for(var e={},i=0;ie)return!0}return!1};J.isReservedName=function(t,e){if(t){for(var i=0;i0;){var r=t.shift();if(i.nested&&i.nested[r]){if(i=i.nested[r],!(i instanceof J))throw Error("path conflicts with non-namespace objects")}else i.add(i=new J(r))}return e&&i.addJSON(e),i};J.prototype.resolveAll=function(){for(var t=this.nestedArray,e=0;e-1)return r}else if(r instanceof J&&(r=r.lookup(t.slice(1),e,!0)))return r}else for(var o=0;o{"use strict";Wc.exports=dt;var Jo=Ct();((dt.prototype=Object.create(Jo.prototype)).constructor=dt).className="MapField";var bh=en(),si=ye();function dt(n,t,e,i,r,o){if(Jo.call(this,n,t,i,void 0,void 0,r,o),!si.isString(e))throw TypeError("keyType must be a string");this.keyType=e,this.resolvedKeyType=null,this.map=!0}dt.fromJSON=function(t,e){return new dt(t,e.id,e.keyType,e.type,e.options,e.comment)};dt.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return si.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])};dt.prototype.resolve=function(){if(this.resolved)return this;if(bh.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return Jo.prototype.resolve.call(this)};dt.d=function(t,e,i){return typeof i=="function"?i=si.decorateType(i).name:i&&typeof i=="object"&&(i=si.decorateEnum(i).name),function(o,a){si.decorateType(o.constructor).add(new dt(a,t,e,i))}}});var rr=Y((Vx,Zc)=>{"use strict";Zc.exports=nn;var Qo=tn();((nn.prototype=Object.create(Qo.prototype)).constructor=nn).className="Method";var An=ye();function nn(n,t,e,i,r,o,a,s,l){if(An.isObject(r)?(a=r,r=o=void 0):An.isObject(o)&&(a=o,o=void 0),!(t===void 0||An.isString(t)))throw TypeError("type must be a string");if(!An.isString(e))throw TypeError("requestType must be a string");if(!An.isString(i))throw TypeError("responseType must be a string");Qo.call(this,n,a),this.type=t||"rpc",this.requestType=e,this.requestStream=r?!0:void 0,this.responseType=i,this.responseStream=o?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=s,this.parsedOptions=l}nn.fromJSON=function(t,e){return new nn(t,e.type,e.requestType,e.responseType,e.requestStream,e.responseStream,e.options,e.comment,e.parsedOptions)};nn.prototype.toJSON=function(t){var e=t?Boolean(t.keepComments):!1;return An.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",e?this.comment:void 0,"parsedOptions",this.parsedOptions])};nn.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),Qo.prototype.resolve.call(this))}});var or=Y((Kx,zc)=>{"use strict";zc.exports=je;var It=Tn();((je.prototype=Object.create(It.prototype)).constructor=je).className="Service";var ea=rr(),li=ye(),xh=Wo();function je(n,t){It.call(this,n,t),this.methods={},this._methodsArray=null}je.fromJSON=function(t,e){var i=new je(t,e.options);if(e.methods)for(var r=Object.keys(e.methods),o=0;o{"use strict";Gc.exports=nt;var wh=et();function nt(n){if(n)for(var t=Object.keys(n),e=0;e{"use strict";Kc.exports=_h;var vh=Ve(),mt=en(),Vc=ye();function Eh(n){return"missing required '"+n.name+"'"}function _h(n){var t=Vc.codegen(["r","l"],n.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(n.fieldsArray.filter(function(s){return s.map}).length?",k,value":""))("while(r.pos>>3){");for(var e=0;e>>3){")("case 1: k=r.%s(); break",i.keyType)("case 2:"),mt.basic[r]===void 0?t("value=types[%i].decode(r,r.uint32())",e):t("value=r.%s()",r),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),mt.long[i.keyType]!==void 0?t('%s[typeof k==="object"?util.longToHash(k):k]=value',o):t("%s[k]=value",o)):i.repeated?(t("if(!(%s&&%s.length))",o,o)("%s=[]",o),mt.packed[r]!==void 0&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";Xc.exports=kh;var Th=Ve(),na=ye();function He(n,t){return n.name+": "+t+(n.repeated&&t!=="array"?"[]":n.map&&t!=="object"?"{k:"+n.keyType+"}":"")+" expected"}function ia(n,t,e,i){if(t.resolvedType)if(t.resolvedType instanceof Th){n("switch(%s){",i)("default:")("return%j",He(t,"enum value"));for(var r=Object.keys(t.resolvedType.values),o=0;o{"use strict";var Jc=Qc,ci=Ve(),it=ye();function oa(n,t,e,i){var r=!1;if(t.resolvedType)if(t.resolvedType instanceof ci){n("switch(d%s){",i);for(var o=t.resolvedType.values,a=Object.keys(o),s=0;s>>0",i,i);break;case"int32":case"sint32":case"sfixed32":n("m%s=d%s|0",i,i);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":n("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",i,i,l)('else if(typeof d%s==="string")',i)("m%s=parseInt(d%s,10)",i,i)('else if(typeof d%s==="number")',i)("m%s=d%s",i,i)('else if(typeof d%s==="object")',i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",i,i,i,l?"true":"");break;case"bytes":n('if(typeof d%s==="string")',i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",i,i,i)("else if(d%s.length >= 0)",i)("m%s=d%s",i,i);break;case"string":n("m%s=String(d%s)",i,i);break;case"bool":n("m%s=Boolean(d%s)",i,i);break}}return n}Jc.fromObject=function(t){var e=t.fieldsArray,i=it.codegen(["d"],t.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!e.length)return i("return new this.ctor");i("var m=new this.ctor");for(var r=0;r>>0,m%s.high>>>0).toNumber(%s):m%s",i,i,i,i,r?"true":"",i);break;case"bytes":n("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",i,i,i,i,i);break;default:n("d%s=m%s",i,i);break}}return n}Jc.toObject=function(t){var e=t.fieldsArray.slice().sort(it.compareFieldsById);if(!e.length)return it.codegen()("return {}");for(var i=it.codegen(["m","o"],t.name+"$toObject")("if(!o)")("o={}")("var d={}"),r=[],o=[],a=[],s=0;s{"use strict";var Nh=ep,Sh=ar();Nh[".google.protobuf.Any"]={fromObject:function(n){if(n&&n["@type"]){var t=n["@type"].substring(n["@type"].lastIndexOf("/")+1),e=this.lookup(t);if(e){var i=n["@type"].charAt(0)==="."?n["@type"].slice(1):n["@type"];return i.indexOf("/")===-1&&(i="/"+i),this.create({type_url:i,value:e.encode(e.fromObject(n)).finish()})}}return this.fromObject(n)},toObject:function(n,t){var e="type.googleapis.com/",i="",r="";if(t&&t.json&&n.type_url&&n.value){r=n.type_url.substring(n.type_url.lastIndexOf("/")+1),i=n.type_url.substring(0,n.type_url.lastIndexOf("/")+1);var o=this.lookup(r);o&&(n=o.decode(n.value))}if(!(n instanceof this.ctor)&&n instanceof Sh){var a=n.$type.toObject(n,t),s=n.$type.fullName[0]==="."?n.$type.fullName.slice(1):n.$type.fullName;return i===""&&(i=e),r=i+s,a["@type"]=r,a}return this.toObject(n,t)}}});var cr=Y((nw,np)=>{"use strict";np.exports=ne;var Ke=Tn();((ne.prototype=Object.create(Ke.prototype)).constructor=ne).className="Type";var Rh=Ve(),ua=vn(),sr=Ct(),Oh=ir(),Dh=or(),ca=ar(),pa=Ji(),Ch=Ki(),we=ye(),Ih=fa(),Fh=ta(),Lh=ra(),tp=sa(),Ph=la();function ne(n,t){Ke.call(this,n,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(ne.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var n=Object.keys(this.fields),t=0;t{"use strict";sp.exports=Ce;var ur=Tn();((Ce.prototype=Object.create(ur.prototype)).constructor=Ce).className="Root";var ma=Ct(),rp=Ve(),Mh=vn(),Ft=ye(),op,da,pi;function Ce(n){ur.call(this,"",n),this.deferred=[],this.files=[]}Ce.fromJSON=function(t,e){return e||(e=new Ce),t.options&&e.setOptions(t.options),e.addJSON(t.nested)};Ce.prototype.resolvePath=Ft.path.resolve;Ce.prototype.fetch=Ft.fetch;function ap(){}Ce.prototype.load=function n(t,e,i){typeof e=="function"&&(i=e,e=void 0);var r=this;if(!i)return Ft.asPromise(n,r,t,e);var o=i===ap;function a(E,v){if(i){var d=i;if(i=null,o)throw E;d(E,v)}}function s(E){var v=E.lastIndexOf("google/protobuf/");if(v>-1){var d=E.substring(v);if(d in pi)return d}return null}function l(E,v){try{if(Ft.isString(v)&&v.charAt(0)==="{"&&(v=JSON.parse(v)),!Ft.isString(v))r.setOptions(v.options).addJSON(v.nested);else{da.filename=E;var d=da(v,r,e),f,g=0;if(d.imports)for(;g-1)){if(r.files.push(E),E in pi){o?l(E,pi[E]):(++p,setTimeout(function(){--p,l(E,pi[E])}));return}if(o){var d;try{d=Ft.fs.readFileSync(E).toString("utf8")}catch(f){v||a(f);return}l(E,d)}else++p,r.fetch(E,function(f,g){if(--p,!!i){if(f){v?p||a(null,r):a(f);return}l(E,g)}})}}var p=0;Ft.isString(t)&&(t=[t]);for(var m=0,y;m-1&&this.deferred.splice(e,1)}}else if(t instanceof rp)pr.test(t.name)&&delete t.parent[t.name];else if(t instanceof ur){for(var i=0;i{"use strict";var le=cp.exports=et(),lp=Zo(),ha,ga;le.codegen=Nc();le.fetch=Rc();le.path=Cc();le.fs=le.inquire("fs");le.toArray=function(t){if(t){for(var e=Object.keys(t),i=new Array(e.length),r=0;r0)o[l]=r(o[l]||{},a,s);else{var c=o[l];c&&(s=[].concat(c).concat(s)),o[l]=s}return o}if(typeof t!="object")throw TypeError("dst must be an object");if(!e)throw TypeError("path must be specified");return e=e.split("."),r(t,e,i)};Object.defineProperty(le,"decorateRoot",{get:function(){return lp.decorated||(lp.decorated=new(fr()))}})});var tn=Y((ow,pp)=>{"use strict";pp.exports=Ie;Ie.className="ReflectionObject";var dr=ye(),mr;function Ie(n,t){if(!dr.isString(n))throw TypeError("name must be a string");if(t&&!dr.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=n,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(Ie.prototype,{root:{get:function(){for(var n=this;n.parent!==null;)n=n.parent;return n}},fullName:{get:function(){for(var n=[this.name],t=this.parent;t;)n.unshift(t.name),t=t.parent;return n.join(".")}}});Ie.prototype.toJSON=function(){throw Error()};Ie.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var e=t.root;e instanceof mr&&e._handleAdd(this)};Ie.prototype.onRemove=function(t){var e=t.root;e instanceof mr&&e._handleRemove(this),this.parent=null,this.resolved=!1};Ie.prototype.resolve=function(){return this.resolved?this:(this.root instanceof mr&&(this.resolved=!0),this)};Ie.prototype.getOption=function(t){if(this.options)return this.options[t]};Ie.prototype.setOption=function(t,e,i){return(!i||!this.options||this.options[t]===void 0)&&((this.options||(this.options={}))[t]=e),this};Ie.prototype.setParsedOption=function(t,e,i){this.parsedOptions||(this.parsedOptions=[]);var r=this.parsedOptions;if(i){var o=r.find(function(l){return Object.prototype.hasOwnProperty.call(l,t)});if(o){var a=o[t];dr.setProperty(a,i,e)}else o={},o[t]=dr.setProperty({},i,e),r.push(o)}else{var s={};s[t]=e,r.push(s)}return this};Ie.prototype.setOptions=function(t,e){if(t)for(var i=Object.keys(t),r=0;r{"use strict";dp.exports=rt;var up=tn();((rt.prototype=Object.create(up.prototype)).constructor=rt).className="Enum";var fp=Tn(),hr=ye();function rt(n,t,e,i,r,o){if(up.call(this,n,e),t&&typeof t!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=r||{},this.valuesOptions=o,this.reserved=void 0,t)for(var a=Object.keys(t),s=0;s{"use strict";hp.exports=qh;var Hh=Ve(),ya=en(),ba=ye();function mp(n,t,e,i){return t.resolvedType.group?n("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",e,i,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):n("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",e,i,(t.id<<3|2)>>>0)}function qh(n){for(var t=ba.codegen(["m","w"],n.name+"$encode")("if(!w)")("w=Writer.create()"),e,i,r=n.fieldsArray.slice().sort(ba.compareFieldsById),e=0;e>>0,8|ya.mapKey[o.keyType],o.keyType),l===void 0?t("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",a,i):t(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|l,s,i),t("}")("}")):o.repeated?(t("if(%s!=null&&%s.length){",i,i),o.packed&&ya.packed[s]!==void 0?t("w.uint32(%i).fork()",(o.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",s,i)("w.ldelim()"):(t("for(var i=0;i<%s.length;++i)",i),l===void 0?mp(t,o,a,i+"[i]"):t("w.uint32(%i).%s(%s[i])",(o.id<<3|l)>>>0,s,i)),t("}")):(o.optional&&t("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,o.name),l===void 0?mp(t,o,a,i):t("w.uint32(%i).%s(%s)",(o.id<<3|l)>>>0,s,i))}return t("return w")}});var yp=Y((lw,gp)=>{"use strict";var V=gp.exports=Ac();V.build="light";function Wh(n,t,e){return typeof t=="function"?(e=t,t=new V.Root):t||(t=new V.Root),t.load(n,e)}V.load=Wh;function Zh(n,t){return t||(t=new V.Root),t.loadSync(n)}V.loadSync=Zh;V.encoder=fa();V.decoder=ta();V.verifier=ra();V.converter=sa();V.ReflectionObject=tn();V.Namespace=Tn();V.Root=fr();V.Enum=Ve();V.Type=cr();V.Field=Ct();V.OneOf=vn();V.MapField=ir();V.Service=or();V.Method=rr();V.Message=ar();V.wrappers=la();V.types=en();V.util=ye();V.ReflectionObject._configure(V.Root);V.Namespace._configure(V.Type,V.Service,V.Enum);V.Root._configure(V.Type);V.Field._configure(V.Type)});var wa=Y((cw,wp)=>{"use strict";wp.exports=xp;var xa=/[\s{}=;:[\],'"()<>]/g,Yh=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,zh=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,Gh=/^ *[*/]+ */,Vh=/^\s*\*?\/*/,Kh=/\n/g,Xh=/\s/,Jh=/\\(.?)/g,Qh={0:"\0",r:"\r",n:` +`,t:" "};function bp(n){return n.replace(Jh,function(t,e){switch(e){case"\\":case"":return e;default:return Qh[e]||""}})}xp.unescape=bp;function xp(n,t){n=n.toString();var e=0,i=n.length,r=1,o=0,a={},s=[],l=null;function c(A){return Error("illegal "+A+" (line "+r+")")}function p(){var A=l==="'"?zh:Yh;A.lastIndex=e-1;var D=A.exec(n);if(!D)throw c("string");return e=A.lastIndex,f(l),l=null,bp(D[1])}function m(A){return n.charAt(A)}function y(A,D,T){var k={type:n.charAt(A++),lineEmpty:!1,leading:T},b;t?b=2:b=3;var C=A-b,O;do if(--C<0||(O=n.charAt(C))===` +`){k.lineEmpty=!0;break}while(O===" "||O===" ");for(var S=n.substring(A,D).split(Kh),M=0;M0)return s.shift();if(l)return p();var A,D,T,k,b,C=e===0;do{if(e===i)return null;for(A=!1;Xh.test(T=m(e));)if(T===` +`&&(C=!0,++r),++e===i)return null;if(m(e)==="/"){if(++e===i)throw c("comment");if(m(e)==="/")if(t){if(k=e,b=!1,E(e-1)){b=!0;do if(e=v(e),e===i||(e++,!C))break;while(E(e))}else e=Math.min(i,v(e)+1);b&&(y(k,e,C),C=!0),r++,A=!0}else{for(b=m(k=e+1)==="/";m(++e)!==` +`;)if(e===i)return null;++e,b&&(y(k,e-1,C),C=!0),++r,A=!0}else if((T=m(e))==="*"){k=e+1,b=t||m(k)==="*";do{if(T===` +`&&++r,++e===i)throw c("comment");D=T,T=m(e)}while(D!=="*"||T!=="/");++e,b&&(y(k,e-2,C),C=!0),A=!0}else return"/"}}while(A);var O=e;xa.lastIndex=0;var S=xa.test(m(O++));if(!S)for(;O{"use strict";Ap.exports=ht;ht.filename=null;ht.defaults={keepCase:!1};var eg=wa(),vp=fr(),Ep=cr(),_p=Ct(),tg=ir(),Tp=vn(),ng=Ve(),ig=or(),rg=rr(),va=en(),Ea=ye(),og=/^[1-9][0-9]*$/,ag=/^-?[1-9][0-9]*$/,sg=/^0[x][0-9a-fA-F]+$/,lg=/^-?0[x][0-9a-fA-F]+$/,cg=/^0[0-7]+$/,pg=/^-?0[0-7]+$/,ug=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,ot=/^[a-zA-Z_][a-zA-Z_0-9]*$/,at=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,fg=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function ht(n,t,e){t instanceof vp||(e=t,t=new vp),e||(e=ht.defaults);var i=e.preferTrailingComment||!1,r=eg(n,e.alternateCommentMode||!1),o=r.next,a=r.push,s=r.peek,l=r.skip,c=r.cmnt,p=!0,m,y,E,v,d=!1,f=t,g=e.keepCase?function(x){return x}:Ea.camelCase;function w(x,N,I){var P=ht.filename;return I||(ht.filename=null),Error("illegal "+(N||"token")+" '"+x+"' ("+(P?P+", ":"")+"line "+r.line+")")}function _(){var x=[],N;do{if((N=o())!=='"'&&N!=="'")throw w(N);x.push(o()),l(N),N=s()}while(N==='"'||N==="'");return x.join("")}function A(x){var N=o();switch(N){case"'":case'"':return a(N),_();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return T(N,!0)}catch(I){if(x&&at.test(N))return N;throw w(N,"value")}}function D(x,N){var I,P;do N&&((I=s())==='"'||I==="'")?x.push(_()):x.push([P=k(o()),l("to",!0)?k(o()):P]);while(l(",",!0));l(";")}function T(x,N){var I=1;switch(x.charAt(0)==="-"&&(I=-1,x=x.substring(1)),x){case"inf":case"INF":case"Inf":return I*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(og.test(x))return I*parseInt(x,10);if(sg.test(x))return I*parseInt(x,16);if(cg.test(x))return I*parseInt(x,8);if(ug.test(x))return I*parseFloat(x);throw w(x,"number",N)}function k(x,N){switch(x){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!N&&x.charAt(0)==="-")throw w(x,"id");if(ag.test(x))return parseInt(x,10);if(lg.test(x))return parseInt(x,16);if(pg.test(x))return parseInt(x,8);throw w(x,"id")}function b(){if(m!==void 0)throw w("package");if(m=o(),!at.test(m))throw w(m,"name");f=f.define(m),l(";")}function C(){var x=s(),N;switch(x){case"weak":N=E||(E=[]),o();break;case"public":o();default:N=y||(y=[]);break}x=_(),l(";"),N.push(x)}function O(){if(l("="),v=_(),d=v==="proto3",!d&&v!=="proto2")throw w(v,"syntax");l(";")}function S(x,N){switch(N){case"option":return U(x,N),l(";"),!0;case"message":return L(x,N),!0;case"enum":return z(x,N),!0;case"service":return pn(x,N),!0;case"extend":return u(x,N),!0}return!1}function M(x,N,I){var P=r.line;if(x&&(typeof x.comment!="string"&&(x.comment=c()),x.filename=ht.filename),l("{",!0)){for(var $;($=o())!=="}";)N($);l(";",!0)}else I&&I(),l(";"),x&&(typeof x.comment!="string"||i)&&(x.comment=c(P)||x.comment)}function L(x,N){if(!ot.test(N=o()))throw w(N,"type name");var I=new Ep(N);M(I,function($){if(!S(I,$))switch($){case"map":F(I,$);break;case"required":case"repeated":j(I,$);break;case"optional":d?j(I,"proto3_optional"):j(I,"optional");break;case"oneof":ee(I,$);break;case"extensions":D(I.extensions||(I.extensions=[]));break;case"reserved":D(I.reserved||(I.reserved=[]),!0);break;default:if(!d||!at.test($))throw w($);a($),j(I,"optional");break}}),x.add(I)}function j(x,N,I){var P=o();if(P==="group"){Z(x,N);return}for(;P.endsWith(".")||s().startsWith(".");)P+=o();if(!at.test(P))throw w(P,"type");var $=o();if(!ot.test($))throw w($,"name");$=g($),l("=");var W=new _p($,k(o()),P,N,I);if(M(W,function(oe){if(oe==="option")U(W,oe),l(";");else throw w(oe)},function(){lt(W)}),N==="proto3_optional"){var ie=new Tp("_"+$);W.setOption("proto3_optional",!0),ie.add(W),x.add(ie)}else x.add(W);!d&&W.repeated&&(va.packed[P]!==void 0||va.basic[P]===void 0)&&W.setOption("packed",!1,!0)}function Z(x,N){var I=o();if(!ot.test(I))throw w(I,"name");var P=Ea.lcFirst(I);I===P&&(I=Ea.ucFirst(I)),l("=");var $=k(o()),W=new Ep(I);W.group=!0;var ie=new _p(P,$,I,N);ie.filename=ht.filename,M(W,function(oe){switch(oe){case"option":U(W,oe),l(";");break;case"required":case"repeated":j(W,oe);break;case"optional":d?j(W,"proto3_optional"):j(W,"optional");break;case"message":L(W,oe);break;case"enum":z(W,oe);break;default:throw w(oe)}}),x.add(W).add(ie)}function F(x){l("<");var N=o();if(va.mapKey[N]===void 0)throw w(N,"type");l(",");var I=o();if(!at.test(I))throw w(I,"type");l(">");var P=o();if(!ot.test(P))throw w(P,"name");l("=");var $=new tg(g(P),k(o()),N,I);M($,function(ie){if(ie==="option")U($,ie),l(";");else throw w(ie)},function(){lt($)}),x.add($)}function ee(x,N){if(!ot.test(N=o()))throw w(N,"name");var I=new Tp(g(N));M(I,function($){$==="option"?(U(I,$),l(";")):(a($),j(I,"optional"))}),x.add(I)}function z(x,N){if(!ot.test(N=o()))throw w(N,"name");var I=new ng(N);M(I,function($){switch($){case"option":U(I,$),l(";");break;case"reserved":D(I.reserved||(I.reserved=[]),!0);break;default:We(I,$)}}),x.add(I)}function We(x,N){if(!ot.test(N))throw w(N,"name");l("=");var I=k(o(),!0),P={options:void 0};P.setOption=function($,W){this.options===void 0&&(this.options={}),this.options[$]=W},M(P,function(W){if(W==="option")U(P,W),l(";");else throw w(W)},function(){lt(P)}),x.add(N,I,P.comment,P.options)}function U(x,N){var I=l("(",!0);if(!at.test(N=o()))throw w(N,"name");var P=N,$=P,W;I&&(l(")"),P="("+P+")",$=P,N=s(),fg.test(N)&&(W=N.slice(1),P+=N,o())),l("=");var ie=Ne(x,P);Q(x,$,ie,W)}function Ne(x,N){if(l("{",!0)){for(var I={};!l("}",!0);){if(!ot.test(R=o()))throw w(R,"name");if(R===null)throw w(R,"end of input");var P,$=R;if(l(":",!0),s()==="{")P=Ne(x,N+"."+R);else if(s()==="["){P=[];var W;if(l("[",!0)){do W=A(!0),P.push(W);while(l(",",!0));l("]"),typeof W!="undefined"&&G(x,N+"."+R,W)}}else P=A(!0),G(x,N+"."+R,P);var ie=I[$];ie&&(P=[].concat(ie).concat(P)),I[$]=P,l(",",!0),l(";",!0)}return I}var te=A(!0);return G(x,N,te),te}function G(x,N,I){x.setOption&&x.setOption(N,I)}function Q(x,N,I,P){x.setParsedOption&&x.setParsedOption(N,I,P)}function lt(x){if(l("[",!0)){do U(x,"option");while(l(",",!0));l("]")}return x}function pn(x,N){if(!ot.test(N=o()))throw w(N,"service name");var I=new ig(N);M(I,function($){if(!S(I,$))if($==="rpc")h(I,$);else throw w($)}),x.add(I)}function h(x,N){var I=c(),P=N;if(!ot.test(N=o()))throw w(N,"name");var $=N,W,ie,te,oe;if(l("("),l("stream",!0)&&(ie=!0),!at.test(N=o())||(W=N,l(")"),l("returns"),l("("),l("stream",!0)&&(oe=!0),!at.test(N=o())))throw w(N);te=N,l(")");var un=new rg($,P,W,te,ie,oe);un.comment=I,M(un,function(qt){if(qt==="option")U(un,qt),l(";");else throw w(qt)}),x.add(un)}function u(x,N){if(!at.test(N=o()))throw w(N,"reference");var I=N;M(null,function($){switch($){case"required":case"repeated":j(x,$,I);break;case"optional":d?j(x,"proto3_optional",I):j(x,"optional",I);break;default:if(!d||!at.test($))throw w($);a($),j(x,"optional",I);break}})}for(var R;(R=o())!==null;)switch(R){case"package":if(!p)throw w(R);b();break;case"import":if(!p)throw w(R);C();break;case"syntax":if(!p)throw w(R);O();break;case"option":U(f,R),l(";");break;default:if(S(f,R)){p=!1;continue}throw w(R)}return ht.filename=null,{package:m,imports:y,weakImports:E,syntax:v,root:t}}});var Rp=Y((uw,Sp)=>{"use strict";Sp.exports=Xe;var dg=/\/|\./;function Xe(n,t){dg.test(n)||(n="google/protobuf/"+n+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),Xe[n]=t}Xe("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var Np;Xe("duration",{Duration:Np={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});Xe("timestamp",{Timestamp:Np});Xe("empty",{Empty:{fields:{}}});Xe("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});Xe("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});Xe("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});Xe.get=function(t){return Xe[t]||null}});var Dp=Y((fw,Op)=>{"use strict";var Lt=Op.exports=yp();Lt.build="full";Lt.tokenize=wa();Lt.parse=kp();Lt.common=Rp();Lt.Root._configure(Lt.Type,Lt.parse,Lt.common)});var Ip=Y((dw,Cp)=>{"use strict";Cp.exports=Dp()});var Rf=Y(Rr=>{(function(n){n.parser=function(h,u){return new e(h,u)},n.SAXParser=e,n.SAXStream=c,n.createStream=l,n.MAX_BUFFER_LENGTH=64*1024;var t=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];n.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function e(h,u){if(!(this instanceof e))return new e(h,u);var R=this;r(R),R.q=R.c="",R.bufferCheckPosition=n.MAX_BUFFER_LENGTH,R.opt=u||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!h,R.noscript=!!(h||R.opt.noscript),R.state=b.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(n.XML_ENTITIES):Object.create(n.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(v)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),O(R,"onready")}Object.create||(Object.create=function(h){function u(){}u.prototype=h;var R=new u;return R}),Object.keys||(Object.keys=function(h){var u=[];for(var R in h)h.hasOwnProperty(R)&&u.push(R);return u});function i(h){for(var u=Math.max(n.MAX_BUFFER_LENGTH,10),R=0,x=0,N=t.length;xu)switch(t[x]){case"textNode":M(h);break;case"cdata":S(h,"oncdata",h.cdata),h.cdata="";break;case"script":S(h,"onscript",h.script),h.script="";break;default:j(h,"Max buffer length exceeded: "+t[x])}R=Math.max(R,I)}var P=n.MAX_BUFFER_LENGTH-R;h.bufferCheckPosition=P+h.position}function r(h){for(var u=0,R=t.length;u"||_(h)}function T(h,u){return h.test(u)}function k(h,u){return!T(h,u)}var b=0;n.STATE={BEGIN:b++,BEGIN_WHITESPACE:b++,TEXT:b++,TEXT_ENTITY:b++,OPEN_WAKA:b++,SGML_DECL:b++,SGML_DECL_QUOTED:b++,DOCTYPE:b++,DOCTYPE_QUOTED:b++,DOCTYPE_DTD:b++,DOCTYPE_DTD_QUOTED:b++,COMMENT_STARTING:b++,COMMENT:b++,COMMENT_ENDING:b++,COMMENT_ENDED:b++,CDATA:b++,CDATA_ENDING:b++,CDATA_ENDING_2:b++,PROC_INST:b++,PROC_INST_BODY:b++,PROC_INST_ENDING:b++,OPEN_TAG:b++,OPEN_TAG_SLASH:b++,ATTRIB:b++,ATTRIB_NAME:b++,ATTRIB_NAME_SAW_WHITE:b++,ATTRIB_VALUE:b++,ATTRIB_VALUE_QUOTED:b++,ATTRIB_VALUE_CLOSED:b++,ATTRIB_VALUE_UNQUOTED:b++,ATTRIB_VALUE_ENTITY_Q:b++,ATTRIB_VALUE_ENTITY_U:b++,CLOSE_TAG:b++,CLOSE_TAG_SAW_WHITE:b++,SCRIPT:b++,SCRIPT_ENDING:b++},n.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},n.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(n.ENTITIES).forEach(function(h){var u=n.ENTITIES[h],R=typeof u=="number"?String.fromCharCode(u):u;n.ENTITIES[h]=R});for(var C in n.STATE)n.STATE[n.STATE[C]]=C;b=n.STATE;function O(h,u,R){h[u]&&h[u](R)}function S(h,u,R){h.textNode&&M(h),O(h,u,R)}function M(h){h.textNode=L(h.opt,h.textNode),h.textNode&&O(h,"ontext",h.textNode),h.textNode=""}function L(h,u){return h.trim&&(u=u.trim()),h.normalize&&(u=u.replace(/\s+/g," ")),u}function j(h,u){return M(h),h.trackPosition&&(u+=` Line: `+h.line+` Column: `+h.column+` -Char: `+h.c),u=new Error(u),h.error=u,O(h,"onerror",u),h}function Z(h){return h.sawRoot&&!h.closedRoot&&F(h,"Unclosed root tag"),h.state!==x.BEGIN&&h.state!==x.BEGIN_WHITESPACE&&h.state!==x.TEXT&&H(h,"Unexpected end"),M(h),h.c="",h.closed=!0,O(h,"onend"),e.call(h,h.strict,h.opt),h}function F(h,u){if(typeof h!="object"||!(h instanceof e))throw new Error("bad call to strictFail");h.strict&&H(h,u)}function ee(h){h.strict||(h.tagName=h.tagName[h.looseCase]());var u=h.tags[h.tags.length-1]||h,N=h.tag={name:h.tagName,attributes:{}};h.opt.xmlns&&(N.ns=u.ns),h.attribList.length=0,R(h,"onopentagstart",N)}function z(h,u){var N=h.indexOf(":"),b=N<0?["",h]:h.split(":"),k=b[0],I=b[1];return u&&h==="xmlns"&&(k="xmlns",I=""),{prefix:k,local:I}}function We(h){if(h.strict||(h.attribName=h.attribName[h.looseCase]()),h.attribList.indexOf(h.attribName)!==-1||h.tag.attributes.hasOwnProperty(h.attribName)){h.attribName=h.attribValue="";return}if(h.opt.xmlns){var u=z(h.attribName,!0),N=u.prefix,b=u.local;if(N==="xmlns")if(b==="xml"&&h.attribValue!==y)F(h,"xml: prefix must be bound to "+y+` -Actual: `+h.attribValue);else if(b==="xmlns"&&h.attribValue!==E)F(h,"xmlns: prefix must be bound to "+E+` -Actual: `+h.attribValue);else{var k=h.tag,I=h.tags[h.tags.length-1]||h;k.ns===I.ns&&(k.ns=Object.create(I.ns)),k.ns[b]=h.attribValue}h.attribList.push([h.attribName,h.attribValue])}else h.tag.attributes[h.attribName]=h.attribValue,R(h,"onattribute",{name:h.attribName,value:h.attribValue});h.attribName=h.attribValue=""}function U(h,u){if(h.opt.xmlns){var N=h.tag,b=z(h.tagName);N.prefix=b.prefix,N.local=b.local,N.uri=N.ns[b.prefix]||"",N.prefix&&!N.uri&&(F(h,"Unbound namespace prefix: "+JSON.stringify(h.tagName)),N.uri=b.prefix);var k=h.tags[h.tags.length-1]||h;N.ns&&k.ns!==N.ns&&Object.keys(N.ns).forEach(function(es){R(h,"onopennamespace",{prefix:es,uri:N.ns[es]})});for(var I=0,L=h.attribList.length;I",h.tagName="",h.state=x.SCRIPT;return}R(h,"onscript",h.script),h.script=""}var u=h.tags.length,N=h.tagName;h.strict||(N=N[h.looseCase]());for(var b=N;u--;){var k=h.tags[u];if(k.name!==b)F(h,"Unexpected close tag");else break}if(u<0){F(h,"Unmatched closing tag: "+h.tagName),h.textNode+="",h.state=x.TEXT;return}h.tagName=N;for(var I=h.tags.length;I-- >u;){var L=h.tag=h.tags.pop();h.tagName=h.tag.name,R(h,"onclosetag",h.tagName);var $={};for(var W in L.ns)$[W]=L.ns[W];var ie=h.tags[h.tags.length-1]||h;h.opt.xmlns&&L.ns!==ie.ns&&Object.keys(L.ns).forEach(function(te){var re=L.ns[te];R(h,"onclosenamespace",{prefix:te,uri:re})})}u===0&&(h.closedRoot=!0),h.tagName=h.attribValue=h.attribName="",h.attribList.length=0,h.state=x.TEXT}function G(h){var u=h.entity,N=u.toLowerCase(),b,k="";return h.ENTITIES[u]?h.ENTITIES[u]:h.ENTITIES[N]?h.ENTITIES[N]:(u=N,u.charAt(0)==="#"&&(u.charAt(1)==="x"?(u=u.slice(2),b=parseInt(u,16),k=b.toString(16)):(u=u.slice(1),b=parseInt(u,10),k=b.toString(10))),u=u.replace(/^0+/,""),isNaN(b)||k.toLowerCase()!==u?(F(h,"Invalid character entity"),"&"+h.entity+";"):String.fromCodePoint(b))}function Q(h,u){u==="<"?(h.state=x.OPEN_WAKA,h.startTagPosition=h.position):T(u)||(F(h,"Non-whitespace before first tag."),h.textNode=u,h.state=x.TEXT)}function lt(h,u){var N="";return u"?(R(u,"onsgmldeclaration",u.sgmlDecl),u.sgmlDecl="",u.state=x.TEXT):(A(b)&&(u.state=x.SGML_DECL_QUOTED),u.sgmlDecl+=b);continue;case x.SGML_DECL_QUOTED:b===u.q&&(u.state=x.SGML_DECL,u.q=""),u.sgmlDecl+=b;continue;case x.DOCTYPE:b===">"?(u.state=x.TEXT,R(u,"ondoctype",u.doctype),u.doctype=!0):(u.doctype+=b,b==="["?u.state=x.DOCTYPE_DTD:A(b)&&(u.state=x.DOCTYPE_QUOTED,u.q=b));continue;case x.DOCTYPE_QUOTED:u.doctype+=b,b===u.q&&(u.q="",u.state=x.DOCTYPE);continue;case x.DOCTYPE_DTD:u.doctype+=b,b==="]"?u.state=x.DOCTYPE:A(b)&&(u.state=x.DOCTYPE_DTD_QUOTED,u.q=b);continue;case x.DOCTYPE_DTD_QUOTED:u.doctype+=b,b===u.q&&(u.state=x.DOCTYPE_DTD,u.q="");continue;case x.COMMENT:b==="-"?u.state=x.COMMENT_ENDING:u.comment+=b;continue;case x.COMMENT_ENDING:b==="-"?(u.state=x.COMMENT_ENDED,u.comment=P(u.opt,u.comment),u.comment&&R(u,"oncomment",u.comment),u.comment=""):(u.comment+="-"+b,u.state=x.COMMENT);continue;case x.COMMENT_ENDED:b!==">"?(F(u,"Malformed comment"),u.comment+="--"+b,u.state=x.COMMENT):u.state=x.TEXT;continue;case x.CDATA:b==="]"?u.state=x.CDATA_ENDING:u.cdata+=b;continue;case x.CDATA_ENDING:b==="]"?u.state=x.CDATA_ENDING_2:(u.cdata+="]"+b,u.state=x.CDATA);continue;case x.CDATA_ENDING_2:b===">"?(u.cdata&&R(u,"oncdata",u.cdata),R(u,"onclosecdata"),u.cdata="",u.state=x.TEXT):b==="]"?u.cdata+="]":(u.cdata+="]]"+b,u.state=x.CDATA);continue;case x.PROC_INST:b==="?"?u.state=x.PROC_INST_ENDING:T(b)?u.state=x.PROC_INST_BODY:u.procInstName+=b;continue;case x.PROC_INST_BODY:if(!u.procInstBody&&T(b))continue;b==="?"?u.state=x.PROC_INST_ENDING:u.procInstBody+=b;continue;case x.PROC_INST_ENDING:b===">"?(R(u,"onprocessinginstruction",{name:u.procInstName,body:u.procInstBody}),u.procInstName=u.procInstBody="",u.state=x.TEXT):(u.procInstBody+="?"+b,u.state=x.PROC_INST_BODY);continue;case x.OPEN_TAG:_(f,b)?u.tagName+=b:(ee(u),b===">"?U(u):b==="/"?u.state=x.OPEN_TAG_SLASH:(T(b)||F(u,"Invalid character in tag name"),u.state=x.ATTRIB));continue;case x.OPEN_TAG_SLASH:b===">"?(U(u,!0),Ne(u)):(F(u,"Forward-slash in opening tag not followed by >"),u.state=x.ATTRIB);continue;case x.ATTRIB:if(T(b))continue;b===">"?U(u):b==="/"?u.state=x.OPEN_TAG_SLASH:_(d,b)?(u.attribName=b,u.attribValue="",u.state=x.ATTRIB_NAME):F(u,"Invalid attribute name");continue;case x.ATTRIB_NAME:b==="="?u.state=x.ATTRIB_VALUE:b===">"?(F(u,"Attribute without value"),u.attribValue=u.attribName,We(u),U(u)):T(b)?u.state=x.ATTRIB_NAME_SAW_WHITE:_(f,b)?u.attribName+=b:F(u,"Invalid attribute name");continue;case x.ATTRIB_NAME_SAW_WHITE:if(b==="=")u.state=x.ATTRIB_VALUE;else{if(T(b))continue;F(u,"Attribute without value"),u.tag.attributes[u.attribName]="",u.attribValue="",R(u,"onattribute",{name:u.attribName,value:""}),u.attribName="",b===">"?U(u):_(d,b)?(u.attribName=b,u.state=x.ATTRIB_NAME):(F(u,"Invalid attribute name"),u.state=x.ATTRIB)}continue;case x.ATTRIB_VALUE:if(T(b))continue;A(b)?(u.q=b,u.state=x.ATTRIB_VALUE_QUOTED):(F(u,"Unquoted attribute value"),u.state=x.ATTRIB_VALUE_UNQUOTED,u.attribValue=b);continue;case x.ATTRIB_VALUE_QUOTED:if(b!==u.q){b==="&"?u.state=x.ATTRIB_VALUE_ENTITY_Q:u.attribValue+=b;continue}We(u),u.q="",u.state=x.ATTRIB_VALUE_CLOSED;continue;case x.ATTRIB_VALUE_CLOSED:T(b)?u.state=x.ATTRIB:b===">"?U(u):b==="/"?u.state=x.OPEN_TAG_SLASH:_(d,b)?(F(u,"No whitespace between attributes"),u.attribName=b,u.attribValue="",u.state=x.ATTRIB_NAME):F(u,"Invalid attribute name");continue;case x.ATTRIB_VALUE_UNQUOTED:if(!D(b)){b==="&"?u.state=x.ATTRIB_VALUE_ENTITY_U:u.attribValue+=b;continue}We(u),b===">"?U(u):u.state=x.ATTRIB;continue;case x.CLOSE_TAG:if(u.tagName)b===">"?Ne(u):_(f,b)?u.tagName+=b:u.script?(u.script+=""?Ne(u):F(u,"Invalid characters in closing tag");continue;case x.TEXT_ENTITY:case x.ATTRIB_VALUE_ENTITY_Q:case x.ATTRIB_VALUE_ENTITY_U:var L,$;switch(u.state){case x.TEXT_ENTITY:L=x.TEXT,$="textNode";break;case x.ATTRIB_VALUE_ENTITY_Q:L=x.ATTRIB_VALUE_QUOTED,$="attribValue";break;case x.ATTRIB_VALUE_ENTITY_U:L=x.ATTRIB_VALUE_UNQUOTED,$="attribValue";break}if(b===";")if(u.opt.unparsedEntities){var W=G(u);u.entity="",u.state=L,u.write(W)}else u[$]+=G(u),u.entity="",u.state=L;else _(u.entity.length?w:g,b)?u.entity+=b:(F(u,"Invalid character in entity name"),u[$]+="&"+u.entity+b,u.entity="",u.state=L);continue;default:throw new Error(u,"Unknown state: "+u.state)}return u.position>=u.bufferCheckPosition&&i(u),u}String.fromCodePoint||function(){var h=String.fromCharCode,u=Math.floor,N=function(){var b=16384,k=[],I,L,$=-1,W=arguments.length;if(!W)return"";for(var ie="";++$1114111||u(te)!==te)throw RangeError("Invalid code point: "+te);te<=65535?k.push(te):(te-=65536,I=(te>>10)+55296,L=te%1024+56320,k.push(I,L)),($+1===W||k.length>b)&&(ie+=h.apply(null,k),k.length=0)}return ie};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:N,configurable:!0,writable:!0}):String.fromCodePoint=N}()})(typeof Rr=="undefined"?Rr.sax={}:Rr)});var If=Y((z2,Cf)=>{var Of=/[&<>"]/g,dy=RegExp(Of.source),my={"&":"&","<":"<",">":">",'"':"""},hy=n=>{let t=String(n);return t&&dy.test(t)?t.replace(Of,e=>my[e]):t},gy=(n,t)=>typeof n=="string"&&typeof t=="string"||n&&n[0].$name===t.$name,yy=(n,t)=>typeof n=="string"?n+t:n.concat(t),by=n=>n.reduce((t,e)=>{let i=t.length-1,r=t[i];return gy(r,e)?t[i]=yy(r,e):t.push(typeof e=="string"?e:[e]),t},[]),xy=(n,t,e)=>{let i=null,r={};return Object.keys(n).forEach(o=>{let a=Or(n[o])?n[o]:null;if(a)switch(o){case"$name":!t&&a&&(r.$name=a);break;case"$attrs":i=a;break;case"$markup":r.$markup=Df(a);break;default:a&&(r[o]=e(a))}}),{stripped:r,$attrs:i}},wy=n=>Array.isArray(n)&&n.length===1?n[0]:n,vy=(n,t)=>Or(t)?n?Object.keys(t).length===1&&t.$name?Object.assign(t,n):Object.assign(t,{$attrs:n}):t:n,Ey=n=>{if(!n)return;let t=Object.keys(n),[e]=t;return t.length===1&&e!=="$name"&&e!=="id"?n[t[0]]:n},Za=(n,t,e)=>{let i=e?l=>l:wy,r=i(n);if(!Or(r))return null;if(typeof r!="object"||Array.isArray(r))return r;let{$attrs:o,stripped:a}=xy(r,t,i),s=vy(o,a);return Ey(s)},_y=n=>{let t,e={},i=!0;return n.every(r=>(typeof r=="string"?t="$text":t=r[0].$name,e[t]?(i=!1,!1):(e[t]=!0,!0))),i},Ya=(n=[],t=[],e=!1)=>{let i=Array.isArray(n)?n:[n],r=Array.isArray(t)?t:[t],o=i.concat(r);return o.length===1&&!e?o[0]:o},Df=(n,t)=>{let e=[];return n!==null&&typeof n=="object"&&n.constructor===Array?(n.forEach(i=>{e.push(Za(i,t))}),e):Za(n,t)},Ty=(n,t)=>{let e,i={};return Object.keys(n).forEach(r=>{r!=="$markup"&&(i[r]=n[r])}),n.$markup&&n.$markup.forEach(r=>{typeof r=="string"?i.$text=Ya(i.$text,r,t):typeof r=="object"&&(r.constructor===Array?e=r[0].$name:e=r.$name,i[e]=Ya(i[e],Df(r,!0),t))}),i},Or=n=>n!=null&&(n.length==null||n.length!==0)&&(typeof n!="object"||Object.keys(n).length!==0);Cf.exports={condenseArray:by,escape:hy,isSomething:Or,moosh:Ya,objectifyMarkup:Ty,shouldObjectifyMarkup:_y,simplifyNode:Za}});var Pf=Y((G2,Lf)=>{var{EventEmitter:Ay}=require("events"),ky=Rf(),$t=If(),Ny=1,Cn=0,Bt=-1,Ff={preserveMarkup:Cn,simplifyNodes:!0,useArrays:Cn,lowercase:!0,trim:!0,normalize:!0,cdataAsText:!1,strict:!1},bi=function(t,e=Ff){let i=new Ay,r=[],o=Object.assign({},Ff,e),{preserveMarkup:a,simplifyNodes:s,useArrays:l,lowercase:c,trim:p,normalize:m,cdataAsText:y,strict:E}=o,v=null,d=null,f=ky.createStream(E,{lowercase:c,trim:p,normalize:m,cdataAsText:y});return f.on("opentag",g=>{r.length===0&&!i.listeners(`tag:${g.name}`).length||(v={$name:g.name,$attrs:g.attributes},l>Bt&&(v.$markup=[]),r.push(v))}),f.on("text",g=>{v&&(l>Bt?v.$markup.push(g):v.$text?v.$text+=g:v.$text=g)}),f.on("opencdata",()=>{v&&(y||(d={$name:"$cdata",text:""},l>Bt?v.$markup.push(d):v.$cdata=d))}),f.on("cdata",g=>{v&&(d!==null?d.text+=g:l>Bt?v.$markup.push(g):v.$text?v.$text+=g:v.$text=g)}),f.on("closecdata",()=>{d=null}),f.on("script",g=>{v&&(v.$script=g)}),f.on("closetag",g=>{let w,T=null,A=l>Cn;r.length!==0&&(l>Bt&&(a<=Bt?(v.$markup=$t.condenseArray(v.$markup),v=$t.objectifyMarkup(v,A)):a===Cn&&(w=$t.condenseArray(v.$markup),$t.shouldObjectifyMarkup(w)&&(v.$markup=w,v=$t.objectifyMarkup(v,A)))),i.listeners(`tag:${g}`).length&&i.emit(`tag:${g}`,s?$t.simplifyNode(v,!1,l>Cn):v),r.pop(),r.length>0&&(T=r[r.length-1],l>Bt?T.$markup.push(v):T[g]||(T[g]=$t.simplifyNode(v,!0))),v=T)}),f.on("end",()=>{i.emit("end")}),f.on("error",g=>{i.emit("error",g)}),t.pipe(f),i.pause=function(){t.pause()},i.resume=function(){t.resume()},i};bi.ALWAYS=Ny;bi.SOMETIMES=Cn;bi.NEVER=Bt;bi.toXml=function(t,{indent:e="",selfClosing:i=!0,escape:r=$t.escape,nodeName:o}={}){let a=e?` -`:"";function s(l,c,p){let m="",y,E=c,v=p?a+p:"",d=p+e,f="";return l=l||"",l.constructor===Array?(l.forEach(g=>{m+=s(g,E,p)}),m):(!E&&l.$name&&(E=l.$name),E&&(m=`${v}<${E}`,l.$attrs&&typeof l.$attrs=="object"&&(y=Object.keys(l.$attrs),y.forEach(g=>{m+=` ${g}=${JSON.stringify(String(l.$attrs[g]))}`}))),l==null||l===""||(typeof l=="object"?(y=Object.keys(l),y.forEach(g=>{let w=l[g];switch(g){case"$name":case"$attrs":break;case"$text":case"$markup":f+=s(w,null,d);break;case"$script":f+=s(w,"script",d);break;case"$cdata":f+=`${v}`;break;default:f+=s(w,g,d)}})):f+=v+r(l)),E?f?m+=`>${f}${a}${p}`:i?m+="/>":m+=`>`:m+=f,m)}return s(t,o,"")};Lf.exports=bi});var v1={};Se(v1,{ATTACHMENT_EXTS:()=>Fn,AUTH_REDIRECT_URI:()=>$r,ImportContext:()=>Wr,ImporterModal:()=>wi,default:()=>Zr});module.exports=gd(v1);var Ht=require("obsidian");var st=require("obsidian");var wt=class{constructor(t){this.importer=t,this.app=t.app}};var Pn=class extends wt{constructor(e,i){super(e);this.scan=i.mergableDataObject,this.objects=this.scan.mergeableDataObjectData.mergeableDataObjectEntry}async format(){let e=[];for(let i of this.objects){if(!i.customMap)continue;let r=i.customMap.mapEntry[0].value.stringValue,o=await this.importer.database.get` +Char: `+h.c),u=new Error(u),h.error=u,O(h,"onerror",u),h}function Z(h){return h.sawRoot&&!h.closedRoot&&F(h,"Unclosed root tag"),h.state!==b.BEGIN&&h.state!==b.BEGIN_WHITESPACE&&h.state!==b.TEXT&&j(h,"Unexpected end"),M(h),h.c="",h.closed=!0,O(h,"onend"),e.call(h,h.strict,h.opt),h}function F(h,u){if(typeof h!="object"||!(h instanceof e))throw new Error("bad call to strictFail");h.strict&&j(h,u)}function ee(h){h.strict||(h.tagName=h.tagName[h.looseCase]());var u=h.tags[h.tags.length-1]||h,R=h.tag={name:h.tagName,attributes:{}};h.opt.xmlns&&(R.ns=u.ns),h.attribList.length=0,S(h,"onopentagstart",R)}function z(h,u){var R=h.indexOf(":"),x=R<0?["",h]:h.split(":"),N=x[0],I=x[1];return u&&h==="xmlns"&&(N="xmlns",I=""),{prefix:N,local:I}}function We(h){if(h.strict||(h.attribName=h.attribName[h.looseCase]()),h.attribList.indexOf(h.attribName)!==-1||h.tag.attributes.hasOwnProperty(h.attribName)){h.attribName=h.attribValue="";return}if(h.opt.xmlns){var u=z(h.attribName,!0),R=u.prefix,x=u.local;if(R==="xmlns")if(x==="xml"&&h.attribValue!==y)F(h,"xml: prefix must be bound to "+y+` +Actual: `+h.attribValue);else if(x==="xmlns"&&h.attribValue!==E)F(h,"xmlns: prefix must be bound to "+E+` +Actual: `+h.attribValue);else{var N=h.tag,I=h.tags[h.tags.length-1]||h;N.ns===I.ns&&(N.ns=Object.create(I.ns)),N.ns[x]=h.attribValue}h.attribList.push([h.attribName,h.attribValue])}else h.tag.attributes[h.attribName]=h.attribValue,S(h,"onattribute",{name:h.attribName,value:h.attribValue});h.attribName=h.attribValue=""}function U(h,u){if(h.opt.xmlns){var R=h.tag,x=z(h.tagName);R.prefix=x.prefix,R.local=x.local,R.uri=R.ns[x.prefix]||"",R.prefix&&!R.uri&&(F(h,"Unbound namespace prefix: "+JSON.stringify(h.tagName)),R.uri=x.prefix);var N=h.tags[h.tags.length-1]||h;R.ns&&N.ns!==R.ns&&Object.keys(R.ns).forEach(function(es){S(h,"onopennamespace",{prefix:es,uri:R.ns[es]})});for(var I=0,P=h.attribList.length;I",h.tagName="",h.state=b.SCRIPT;return}S(h,"onscript",h.script),h.script=""}var u=h.tags.length,R=h.tagName;h.strict||(R=R[h.looseCase]());for(var x=R;u--;){var N=h.tags[u];if(N.name!==x)F(h,"Unexpected close tag");else break}if(u<0){F(h,"Unmatched closing tag: "+h.tagName),h.textNode+="",h.state=b.TEXT;return}h.tagName=R;for(var I=h.tags.length;I-- >u;){var P=h.tag=h.tags.pop();h.tagName=h.tag.name,S(h,"onclosetag",h.tagName);var $={};for(var W in P.ns)$[W]=P.ns[W];var ie=h.tags[h.tags.length-1]||h;h.opt.xmlns&&P.ns!==ie.ns&&Object.keys(P.ns).forEach(function(te){var oe=P.ns[te];S(h,"onclosenamespace",{prefix:te,uri:oe})})}u===0&&(h.closedRoot=!0),h.tagName=h.attribValue=h.attribName="",h.attribList.length=0,h.state=b.TEXT}function G(h){var u=h.entity,R=u.toLowerCase(),x,N="";return h.ENTITIES[u]?h.ENTITIES[u]:h.ENTITIES[R]?h.ENTITIES[R]:(u=R,u.charAt(0)==="#"&&(u.charAt(1)==="x"?(u=u.slice(2),x=parseInt(u,16),N=x.toString(16)):(u=u.slice(1),x=parseInt(u,10),N=x.toString(10))),u=u.replace(/^0+/,""),isNaN(x)||N.toLowerCase()!==u?(F(h,"Invalid character entity"),"&"+h.entity+";"):String.fromCodePoint(x))}function Q(h,u){u==="<"?(h.state=b.OPEN_WAKA,h.startTagPosition=h.position):_(u)||(F(h,"Non-whitespace before first tag."),h.textNode=u,h.state=b.TEXT)}function lt(h,u){var R="";return u"?(S(u,"onsgmldeclaration",u.sgmlDecl),u.sgmlDecl="",u.state=b.TEXT):(A(x)&&(u.state=b.SGML_DECL_QUOTED),u.sgmlDecl+=x);continue;case b.SGML_DECL_QUOTED:x===u.q&&(u.state=b.SGML_DECL,u.q=""),u.sgmlDecl+=x;continue;case b.DOCTYPE:x===">"?(u.state=b.TEXT,S(u,"ondoctype",u.doctype),u.doctype=!0):(u.doctype+=x,x==="["?u.state=b.DOCTYPE_DTD:A(x)&&(u.state=b.DOCTYPE_QUOTED,u.q=x));continue;case b.DOCTYPE_QUOTED:u.doctype+=x,x===u.q&&(u.q="",u.state=b.DOCTYPE);continue;case b.DOCTYPE_DTD:u.doctype+=x,x==="]"?u.state=b.DOCTYPE:A(x)&&(u.state=b.DOCTYPE_DTD_QUOTED,u.q=x);continue;case b.DOCTYPE_DTD_QUOTED:u.doctype+=x,x===u.q&&(u.state=b.DOCTYPE_DTD,u.q="");continue;case b.COMMENT:x==="-"?u.state=b.COMMENT_ENDING:u.comment+=x;continue;case b.COMMENT_ENDING:x==="-"?(u.state=b.COMMENT_ENDED,u.comment=L(u.opt,u.comment),u.comment&&S(u,"oncomment",u.comment),u.comment=""):(u.comment+="-"+x,u.state=b.COMMENT);continue;case b.COMMENT_ENDED:x!==">"?(F(u,"Malformed comment"),u.comment+="--"+x,u.state=b.COMMENT):u.state=b.TEXT;continue;case b.CDATA:x==="]"?u.state=b.CDATA_ENDING:u.cdata+=x;continue;case b.CDATA_ENDING:x==="]"?u.state=b.CDATA_ENDING_2:(u.cdata+="]"+x,u.state=b.CDATA);continue;case b.CDATA_ENDING_2:x===">"?(u.cdata&&S(u,"oncdata",u.cdata),S(u,"onclosecdata"),u.cdata="",u.state=b.TEXT):x==="]"?u.cdata+="]":(u.cdata+="]]"+x,u.state=b.CDATA);continue;case b.PROC_INST:x==="?"?u.state=b.PROC_INST_ENDING:_(x)?u.state=b.PROC_INST_BODY:u.procInstName+=x;continue;case b.PROC_INST_BODY:if(!u.procInstBody&&_(x))continue;x==="?"?u.state=b.PROC_INST_ENDING:u.procInstBody+=x;continue;case b.PROC_INST_ENDING:x===">"?(S(u,"onprocessinginstruction",{name:u.procInstName,body:u.procInstBody}),u.procInstName=u.procInstBody="",u.state=b.TEXT):(u.procInstBody+="?"+x,u.state=b.PROC_INST_BODY);continue;case b.OPEN_TAG:T(f,x)?u.tagName+=x:(ee(u),x===">"?U(u):x==="/"?u.state=b.OPEN_TAG_SLASH:(_(x)||F(u,"Invalid character in tag name"),u.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:x===">"?(U(u,!0),Ne(u)):(F(u,"Forward-slash in opening tag not followed by >"),u.state=b.ATTRIB);continue;case b.ATTRIB:if(_(x))continue;x===">"?U(u):x==="/"?u.state=b.OPEN_TAG_SLASH:T(d,x)?(u.attribName=x,u.attribValue="",u.state=b.ATTRIB_NAME):F(u,"Invalid attribute name");continue;case b.ATTRIB_NAME:x==="="?u.state=b.ATTRIB_VALUE:x===">"?(F(u,"Attribute without value"),u.attribValue=u.attribName,We(u),U(u)):_(x)?u.state=b.ATTRIB_NAME_SAW_WHITE:T(f,x)?u.attribName+=x:F(u,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(x==="=")u.state=b.ATTRIB_VALUE;else{if(_(x))continue;F(u,"Attribute without value"),u.tag.attributes[u.attribName]="",u.attribValue="",S(u,"onattribute",{name:u.attribName,value:""}),u.attribName="",x===">"?U(u):T(d,x)?(u.attribName=x,u.state=b.ATTRIB_NAME):(F(u,"Invalid attribute name"),u.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(_(x))continue;A(x)?(u.q=x,u.state=b.ATTRIB_VALUE_QUOTED):(F(u,"Unquoted attribute value"),u.state=b.ATTRIB_VALUE_UNQUOTED,u.attribValue=x);continue;case b.ATTRIB_VALUE_QUOTED:if(x!==u.q){x==="&"?u.state=b.ATTRIB_VALUE_ENTITY_Q:u.attribValue+=x;continue}We(u),u.q="",u.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:_(x)?u.state=b.ATTRIB:x===">"?U(u):x==="/"?u.state=b.OPEN_TAG_SLASH:T(d,x)?(F(u,"No whitespace between attributes"),u.attribName=x,u.attribValue="",u.state=b.ATTRIB_NAME):F(u,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!D(x)){x==="&"?u.state=b.ATTRIB_VALUE_ENTITY_U:u.attribValue+=x;continue}We(u),x===">"?U(u):u.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(u.tagName)x===">"?Ne(u):T(f,x)?u.tagName+=x:u.script?(u.script+=""?Ne(u):F(u,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var P,$;switch(u.state){case b.TEXT_ENTITY:P=b.TEXT,$="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:P=b.ATTRIB_VALUE_QUOTED,$="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:P=b.ATTRIB_VALUE_UNQUOTED,$="attribValue";break}if(x===";")if(u.opt.unparsedEntities){var W=G(u);u.entity="",u.state=P,u.write(W)}else u[$]+=G(u),u.entity="",u.state=P;else T(u.entity.length?w:g,x)?u.entity+=x:(F(u,"Invalid character in entity name"),u[$]+="&"+u.entity+x,u.entity="",u.state=P);continue;default:throw new Error(u,"Unknown state: "+u.state)}return u.position>=u.bufferCheckPosition&&i(u),u}String.fromCodePoint||function(){var h=String.fromCharCode,u=Math.floor,R=function(){var x=16384,N=[],I,P,$=-1,W=arguments.length;if(!W)return"";for(var ie="";++$1114111||u(te)!==te)throw RangeError("Invalid code point: "+te);te<=65535?N.push(te):(te-=65536,I=(te>>10)+55296,P=te%1024+56320,N.push(I,P)),($+1===W||N.length>x)&&(ie+=h.apply(null,N),N.length=0)}return ie};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R}()})(typeof Rr=="undefined"?Rr.sax={}:Rr)});var If=Y((z2,Cf)=>{var Of=/[&<>"]/g,dy=RegExp(Of.source),my={"&":"&","<":"<",">":">",'"':"""},hy=n=>{let t=String(n);return t&&dy.test(t)?t.replace(Of,e=>my[e]):t},gy=(n,t)=>typeof n=="string"&&typeof t=="string"||n&&n[0].$name===t.$name,yy=(n,t)=>typeof n=="string"?n+t:n.concat(t),by=n=>n.reduce((t,e)=>{let i=t.length-1,r=t[i];return gy(r,e)?t[i]=yy(r,e):t.push(typeof e=="string"?e:[e]),t},[]),xy=(n,t,e)=>{let i=null,r={};return Object.keys(n).forEach(o=>{let a=Or(n[o])?n[o]:null;if(a)switch(o){case"$name":!t&&a&&(r.$name=a);break;case"$attrs":i=a;break;case"$markup":r.$markup=Df(a);break;default:a&&(r[o]=e(a))}}),{stripped:r,$attrs:i}},wy=n=>Array.isArray(n)&&n.length===1?n[0]:n,vy=(n,t)=>Or(t)?n?Object.keys(t).length===1&&t.$name?Object.assign(t,n):Object.assign(t,{$attrs:n}):t:n,Ey=n=>{if(!n)return;let t=Object.keys(n),[e]=t;return t.length===1&&e!=="$name"&&e!=="id"?n[t[0]]:n},Za=(n,t,e)=>{let i=e?l=>l:wy,r=i(n);if(!Or(r))return null;if(typeof r!="object"||Array.isArray(r))return r;let{$attrs:o,stripped:a}=xy(r,t,i),s=vy(o,a);return Ey(s)},_y=n=>{let t,e={},i=!0;return n.every(r=>(typeof r=="string"?t="$text":t=r[0].$name,e[t]?(i=!1,!1):(e[t]=!0,!0))),i},Ya=(n=[],t=[],e=!1)=>{let i=Array.isArray(n)?n:[n],r=Array.isArray(t)?t:[t],o=i.concat(r);return o.length===1&&!e?o[0]:o},Df=(n,t)=>{let e=[];return n!==null&&typeof n=="object"&&n.constructor===Array?(n.forEach(i=>{e.push(Za(i,t))}),e):Za(n,t)},Ty=(n,t)=>{let e,i={};return Object.keys(n).forEach(r=>{r!=="$markup"&&(i[r]=n[r])}),n.$markup&&n.$markup.forEach(r=>{typeof r=="string"?i.$text=Ya(i.$text,r,t):typeof r=="object"&&(r.constructor===Array?e=r[0].$name:e=r.$name,i[e]=Ya(i[e],Df(r,!0),t))}),i},Or=n=>n!=null&&(n.length==null||n.length!==0)&&(typeof n!="object"||Object.keys(n).length!==0);Cf.exports={condenseArray:by,escape:hy,isSomething:Or,moosh:Ya,objectifyMarkup:Ty,shouldObjectifyMarkup:_y,simplifyNode:Za}});var Pf=Y((G2,Lf)=>{var{EventEmitter:Ay}=require("events"),ky=Rf(),$t=If(),Ny=1,In=0,Bt=-1,Ff={preserveMarkup:In,simplifyNodes:!0,useArrays:In,lowercase:!0,trim:!0,normalize:!0,cdataAsText:!1,strict:!1},bi=function(t,e=Ff){let i=new Ay,r=[],o=Object.assign({},Ff,e),{preserveMarkup:a,simplifyNodes:s,useArrays:l,lowercase:c,trim:p,normalize:m,cdataAsText:y,strict:E}=o,v=null,d=null,f=ky.createStream(E,{lowercase:c,trim:p,normalize:m,cdataAsText:y});return f.on("opentag",g=>{r.length===0&&!i.listeners(`tag:${g.name}`).length||(v={$name:g.name,$attrs:g.attributes},l>Bt&&(v.$markup=[]),r.push(v))}),f.on("text",g=>{v&&(l>Bt?v.$markup.push(g):v.$text?v.$text+=g:v.$text=g)}),f.on("opencdata",()=>{v&&(y||(d={$name:"$cdata",text:""},l>Bt?v.$markup.push(d):v.$cdata=d))}),f.on("cdata",g=>{v&&(d!==null?d.text+=g:l>Bt?v.$markup.push(g):v.$text?v.$text+=g:v.$text=g)}),f.on("closecdata",()=>{d=null}),f.on("script",g=>{v&&(v.$script=g)}),f.on("closetag",g=>{let w,_=null,A=l>In;r.length!==0&&(l>Bt&&(a<=Bt?(v.$markup=$t.condenseArray(v.$markup),v=$t.objectifyMarkup(v,A)):a===In&&(w=$t.condenseArray(v.$markup),$t.shouldObjectifyMarkup(w)&&(v.$markup=w,v=$t.objectifyMarkup(v,A)))),i.listeners(`tag:${g}`).length&&i.emit(`tag:${g}`,s?$t.simplifyNode(v,!1,l>In):v),r.pop(),r.length>0&&(_=r[r.length-1],l>Bt?_.$markup.push(v):_[g]||(_[g]=$t.simplifyNode(v,!0))),v=_)}),f.on("end",()=>{i.emit("end")}),f.on("error",g=>{i.emit("error",g)}),t.pipe(f),i.pause=function(){t.pause()},i.resume=function(){t.resume()},i};bi.ALWAYS=Ny;bi.SOMETIMES=In;bi.NEVER=Bt;bi.toXml=function(t,{indent:e="",selfClosing:i=!0,escape:r=$t.escape,nodeName:o}={}){let a=e?` +`:"";function s(l,c,p){let m="",y,E=c,v=p?a+p:"",d=p+e,f="";return l=l||"",l.constructor===Array?(l.forEach(g=>{m+=s(g,E,p)}),m):(!E&&l.$name&&(E=l.$name),E&&(m=`${v}<${E}`,l.$attrs&&typeof l.$attrs=="object"&&(y=Object.keys(l.$attrs),y.forEach(g=>{m+=` ${g}=${JSON.stringify(String(l.$attrs[g]))}`}))),l==null||l===""||(typeof l=="object"?(y=Object.keys(l),y.forEach(g=>{let w=l[g];switch(g){case"$name":case"$attrs":break;case"$text":case"$markup":f+=s(w,null,d);break;case"$script":f+=s(w,"script",d);break;case"$cdata":f+=`${v}`;break;default:f+=s(w,g,d)}})):f+=v+r(l)),E?f?m+=`>${f}${a}${p}`:i?m+="/>":m+=`>`:m+=f,m)}return s(t,o,"")};Lf.exports=bi});var v1={};Se(v1,{ATTACHMENT_EXTS:()=>Ln,AUTH_REDIRECT_URI:()=>$r,ImportContext:()=>Wr,ImporterModal:()=>wi,default:()=>Zr});module.exports=gd(v1);var Ht=require("obsidian");var st=require("obsidian");var wt=class{constructor(t){this.importer=t,this.app=t.app}};var Mn=class extends wt{constructor(e,i){super(e);this.scan=i.mergableDataObject,this.objects=this.scan.mergeableDataObjectData.mergeableDataObjectEntry}async format(){let e=[];for(let i of this.objects){if(!i.customMap)continue;let r=i.customMap.mapEntry[0].value.stringValue,o=await this.importer.database.get` SELECT z_pk, zmedia, ztypeuti FROM ziccloudsyncingobject WHERE zidentifier = ${r}`,a=await this.importer.resolveAttachment(o.Z_PK,"com.apple.notes.gallery");if(a||(a=await this.importer.resolveAttachment(o.ZMEDIA,o.ZTYPEUTI)),a)e.push(this.importer.app.fileManager.generateMarkdownLink(a,"/"));else return"**Cannot decode scan**"}return` ${e.join(` `)} -`}};Pn.protobufType="ciofecaforensics.MergableDataProto";var Mn=class extends wt{constructor(e,i){super(e);this.rowLocations={};this.columnLocations={};this.table=i.mergableDataObject;let r=this.table.mergeableDataObjectData;this.keys=r.mergeableDataObjectKeyItem,this.types=r.mergeableDataObjectTypeItem,this.uuids=r.mergeableDataObjectUuidItem.map(this.uuidToString),this.objects=r.mergeableDataObjectEntry}async parse(){let e=this.objects.find(r=>r.customMap&&this.types[r.customMap.type]=="com.apple.notes.ICTable");if(!e)return null;let i=null;for(let r of e.customMap.mapEntry){let o=this.objects[r.value.objectIndex];switch(this.keys[r.key]){case"crRows":[this.rowLocations,this.rowCount]=this.findLocations(o);break;case"crColumns":[this.columnLocations,this.columnCount]=this.findLocations(o);break;case"cellColumns":i=o;break}}return i?await this.computeCells(i):null}findLocations(e){let i=[],r={};for(let o of e.orderedSet.ordering.array.attachment)i.push(this.uuidToString(o.uuid));for(let o of e.orderedSet.ordering.contents.element){let a=this.getTargetUuid(o.key),s=this.getTargetUuid(o.value);r[s]=i.indexOf(a)}return[r,i.length]}async computeCells(e){let i=Array(this.rowCount).fill(0).map(()=>Array(this.columnCount));for(let r of e.dictionary.element){let o=this.columnLocations[this.getTargetUuid(r.key)],a=this.objects[r.value.objectIndex];for(let s of a.dictionary.element){let l=this.rowLocations[this.getTargetUuid(s.key)],c=this.objects[s.value.objectIndex];if(!(l in i)||!c)continue;let p=new Wt(this.importer,c);i[l][o]=await p.format(!0)}}return i}async format(){let e=await this.parse();if(!e)return"";let i=` +`}};Mn.protobufType="ciofecaforensics.MergableDataProto";var $n=class extends wt{constructor(e,i){super(e);this.rowLocations={};this.columnLocations={};this.table=i.mergableDataObject;let r=this.table.mergeableDataObjectData;this.keys=r.mergeableDataObjectKeyItem,this.types=r.mergeableDataObjectTypeItem,this.uuids=r.mergeableDataObjectUuidItem.map(this.uuidToString),this.objects=r.mergeableDataObjectEntry}async parse(){let e=this.objects.find(r=>r.customMap&&this.types[r.customMap.type]=="com.apple.notes.ICTable");if(!e)return null;let i=null;for(let r of e.customMap.mapEntry){let o=this.objects[r.value.objectIndex];switch(this.keys[r.key]){case"crRows":[this.rowLocations,this.rowCount]=this.findLocations(o);break;case"crColumns":[this.columnLocations,this.columnCount]=this.findLocations(o);break;case"cellColumns":i=o;break}}return i?await this.computeCells(i):null}findLocations(e){let i=[],r={};for(let o of e.orderedSet.ordering.array.attachment)i.push(this.uuidToString(o.uuid));for(let o of e.orderedSet.ordering.contents.element){let a=this.getTargetUuid(o.key),s=this.getTargetUuid(o.value);r[s]=i.indexOf(a)}return[r,i.length]}async computeCells(e){let i=Array(this.rowCount).fill(0).map(()=>Array(this.columnCount));for(let r of e.dictionary.element){let o=this.columnLocations[this.getTargetUuid(r.key)],a=this.objects[r.value.objectIndex];for(let s of a.dictionary.element){let l=this.rowLocations[this.getTargetUuid(s.key)],c=this.objects[s.value.objectIndex];if(!(l in i)||!c)continue;let p=new Wt(this.importer,c);i[l][o]=await p.format(!0)}}return i}async format(){let e=await this.parse();if(!e)return"";let i=` `;for(let r=0;r `)}${s}`),s}async getInternalLink(e,i=void 0){let r=e.match(zr)[1],o=await this.importer.database.get` SELECT z_pk FROM ziccloudsyncingobject - WHERE zidentifier = ${r.toUpperCase()}`,a=await this.importer.resolveNote(o.Z_PK);return a?this.app.fileManager.generateMarkdownLink(a,this.importer.rootFolder.path,void 0,i):"(unknown file link)"}convertColor(e){let i="#";for(let r of Object.values(e))i+=Math.floor(r*255).toString(16);return i}convertAlign(e){switch(e){default:return"left";case 1:return"center";case 2:return"right";case 3:return"justify"}}};Wt.protobufType="ciofecaforensics.Document";function xd(n){return n.attachmentInfo?!n.attachmentInfo.typeUti.includes("com.apple.notes.inlinetextattachment"):!1}function os(n,t){var e,i;if(!t||n.$type!=t.$type)return!1;for(let r of n.$type.fieldsArray)if(r.name!="length"){if((e=n[r.name])!=null&&e.$type&&((i=t[r.name])!=null&&i.$type)){if(!os(n[r.name],t[r.name]))return!1}else if(n[r.name]!=t[r.name])return!1}return!0}var as={nested:{ciofecaforensics:{nested:{Color:{fields:{red:{type:"float",id:1},green:{type:"float",id:2},blue:{type:"float",id:3},alpha:{type:"float",id:4}}},AttachmentInfo:{fields:{attachmentIdentifier:{type:"string",id:1},typeUti:{type:"string",id:2}}},Font:{fields:{fontName:{type:"string",id:1},pointSize:{type:"float",id:2},fontHints:{type:"int32",id:3}}},ParagraphStyle:{fields:{styleType:{type:"int32",id:1,options:{default:-1}},alignment:{type:"int32",id:2},indentAmount:{type:"int32",id:4},checklist:{type:"Checklist",id:5},blockquote:{type:"int32",id:8}}},Checklist:{fields:{uuid:{type:"bytes",id:1},done:{type:"int32",id:2}}},DictionaryElement:{fields:{key:{type:"ObjectID",id:1},value:{type:"ObjectID",id:2}}},Dictionary:{fields:{element:{rule:"repeated",type:"DictionaryElement",id:1,options:{packed:!1}}}},ObjectID:{fields:{unsignedIntegerValue:{type:"uint64",id:2},stringValue:{type:"string",id:4},objectIndex:{type:"int32",id:6}}},RegisterLatest:{fields:{contents:{type:"ObjectID",id:2}}},MapEntry:{fields:{key:{type:"int32",id:1},value:{type:"ObjectID",id:2}}},AttributeRun:{fields:{length:{type:"int32",id:1},paragraphStyle:{type:"ParagraphStyle",id:2},font:{type:"Font",id:3},fontWeight:{type:"int32",id:5},underlined:{type:"int32",id:6},strikethrough:{type:"int32",id:7},superscript:{type:"int32",id:8},link:{type:"string",id:9},color:{type:"Color",id:10},attachmentInfo:{type:"AttachmentInfo",id:12}}},NoteStoreProto:{fields:{document:{type:"Document",id:2}}},Document:{fields:{version:{type:"int32",id:2},note:{type:"Note",id:3}}},Note:{fields:{noteText:{type:"string",id:2},attributeRun:{rule:"repeated",type:"AttributeRun",id:5,options:{packed:!1}}}},MergableDataProto:{fields:{mergableDataObject:{type:"MergableDataObject",id:2}}},MergableDataObject:{fields:{version:{type:"int32",id:2},mergeableDataObjectData:{type:"MergeableDataObjectData",id:3}}},MergeableDataObjectData:{fields:{mergeableDataObjectEntry:{rule:"repeated",type:"MergeableDataObjectEntry",id:3,options:{packed:!1}},mergeableDataObjectKeyItem:{rule:"repeated",type:"string",id:4},mergeableDataObjectTypeItem:{rule:"repeated",type:"string",id:5},mergeableDataObjectUuidItem:{rule:"repeated",type:"bytes",id:6}}},MergeableDataObjectEntry:{fields:{registerLatest:{type:"RegisterLatest",id:1},list:{type:"List",id:5},dictionary:{type:"Dictionary",id:6},unknownMessage:{type:"UnknownMergeableDataObjectEntryMessage",id:9},note:{type:"Note",id:10},customMap:{type:"MergeableDataObjectMap",id:13},orderedSet:{type:"OrderedSet",id:16}}},UnknownMergeableDataObjectEntryMessage:{fields:{unknownEntry:{type:"UnknownMergeableDataObjectEntryMessageEntry",id:1}}},UnknownMergeableDataObjectEntryMessageEntry:{fields:{unknownInt1:{type:"int32",id:1},unknownInt2:{type:"int64",id:2}}},MergeableDataObjectMap:{fields:{type:{type:"int32",id:1},mapEntry:{rule:"repeated",type:"MapEntry",id:3,options:{packed:!1}}}},OrderedSet:{fields:{ordering:{type:"OrderedSetOrdering",id:1},elements:{type:"Dictionary",id:2}}},OrderedSetOrdering:{fields:{array:{type:"OrderedSetOrderingArray",id:1},contents:{type:"Dictionary",id:2}}},OrderedSetOrderingArray:{fields:{contents:{type:"Note",id:1},attachment:{rule:"repeated",type:"OrderedSetOrderingArrayAttachment",id:2,options:{packed:!1}}}},OrderedSetOrderingArrayAttachment:{fields:{index:{type:"int32",id:1},uuid:{type:"bytes",id:2}}},List:{fields:{listEntry:{rule:"repeated",type:"ListEntry",id:1,options:{packed:!1}}}},ListEntry:{fields:{id:{type:"ObjectID",id:2},details:{type:"ListEntryDetails",id:3},additionalDetails:{type:"ListEntryDetails",id:4}}},ListEntryDetails:{fields:{listEntryDetailsKey:{type:"ListEntryDetailsKey",id:1},id:{type:"ObjectID",id:2}}},ListEntryDetailsKey:{fields:{listEntryDetailsTypeIndex:{type:"int32",id:1},listEntryDetailsKey:{type:"int32",id:2}}}}}}};var De=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],ks=1440,wd=0,vd=4,Ed=9,_d=5,Td=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],Ad=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],kd=[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],Nd=[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,112,112],Sd=[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],Rd=[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],vt=15;function Xr(){let n=this,t,e,i,r,o,a;function s(c,p,m,y,E,v,d,f,g,w,T){let A,D,_,S,x,C,O,R,M,P,H,Z,F,ee,z;P=0,x=m;do i[c[p+P]]++,P++,x--;while(x!==0);if(i[0]==m)return d[0]=-1,f[0]=0,0;for(R=f[0],C=1;C<=vt&&i[C]===0;C++);for(O=C,Rx&&(R=x),f[0]=R,ee=1<Z+R;){if(S++,Z+=R,z=_-Z,z=z>R?R:z,(D=1<<(C=O-Z))>A+1&&(D-=A+1,F=O,Cks)return-3;o[S]=H=w[0],w[0]+=z,S!==0?(a[S]=x,r[0]=C,r[1]=R,C=x>>>Z-R,r[2]=H-o[S-1]-C,g.set(r,(o[S-1]+C)*3)):d[0]=H}for(r[1]=O-Z,P>=m?r[0]=128+64:T[P]>>Z;C>>=1)x^=C;for(x^=C,M=(1<257?(w==-3?g.msg="oversubscribed distance tree":w==-5?(g.msg="incomplete distance tree",w=-3):w!=-4&&(g.msg="empty distance tree with lengths",w=-3),w):0)}}Xr.inflate_trees_fixed=function(n,t,e,i){return n[0]=Ed,t[0]=_d,e[0]=Td,i[0]=Ad,0};var Ei=0,ss=1,ls=2,cs=3,ps=4,us=5,fs=6,Gr=7,ds=8,_i=9;function Od(){let n=this,t,e=0,i,r=0,o=0,a=0,s=0,l=0,c=0,p=0,m,y=0,E,v=0;function d(f,g,w,T,A,D,_,S){let x,C,O,R,M,P,H,Z,F,ee,z,We,U,Ne,G,Q;H=S.next_in_index,Z=S.avail_in,M=_.bitb,P=_.bitk,F=_.write,ee=F<_.read?_.read-F-1:_.end-F,z=De[f],We=De[g];do{for(;P<20;)Z--,M|=(S.read_byte(H++)&255)<>=C[Q+1],P-=C[Q+1],_.win[F++]=C[Q+2],ee--;continue}do{if(M>>=C[Q+1],P-=C[Q+1],R&16){for(R&=15,U=C[Q+2]+(M&De[R]),M>>=R,P-=R;P<15;)Z--,M|=(S.read_byte(H++)&255)<>=C[Q+1],P-=C[Q+1],R&16){for(R&=15;P>=R,P-=R,ee-=U,F>=Ne)G=F-Ne,F-G>0&&2>F-G?(_.win[F++]=_.win[G++],_.win[F++]=_.win[G++],U-=2):(_.win.set(_.win.subarray(G,G+2),F),F+=2,G+=2,U-=2);else{G=F-Ne;do G+=_.end;while(G<0);if(R=_.end-G,U>R){if(U-=R,F-G>0&&R>F-G)do _.win[F++]=_.win[G++];while(--R!==0);else _.win.set(_.win.subarray(G,G+R),F),F+=R,G+=R,R=0;G=0}}if(F-G>0&&U>F-G)do _.win[F++]=_.win[G++];while(--U!==0);else _.win.set(_.win.subarray(G,G+U),F),F+=U,G+=U,U=0;break}else if(!(R&64))x+=C[Q+2],x+=M&De[R],Q=(O+x)*3,R=C[Q];else return S.msg="invalid distance code",U=S.avail_in-Z,U=P>>3>3:U,Z+=U,H-=U,P-=U<<3,_.bitb=M,_.bitk=P,S.avail_in=Z,S.total_in+=H-S.next_in_index,S.next_in_index=H,_.write=F,-3;while(!0);break}if(R&64)return R&32?(U=S.avail_in-Z,U=P>>3>3:U,Z+=U,H-=U,P-=U<<3,_.bitb=M,_.bitk=P,S.avail_in=Z,S.total_in+=H-S.next_in_index,S.next_in_index=H,_.write=F,1):(S.msg="invalid literal/length code",U=S.avail_in-Z,U=P>>3>3:U,Z+=U,H-=U,P-=U<<3,_.bitb=M,_.bitk=P,S.avail_in=Z,S.total_in+=H-S.next_in_index,S.next_in_index=H,_.write=F,-3);if(x+=C[Q+2],x+=M&De[R],Q=(O+x)*3,(R=C[Q])===0){M>>=C[Q+1],P-=C[Q+1],_.win[F++]=C[Q+2],ee--;break}}while(!0)}while(ee>=258&&Z>=10);return U=S.avail_in-Z,U=P>>3>3:U,Z+=U,H-=U,P-=U<<3,_.bitb=M,_.bitk=P,S.avail_in=Z,S.total_in+=H-S.next_in_index,S.next_in_index=H,_.write=F,0}n.init=function(f,g,w,T,A,D){t=Ei,c=f,p=g,m=w,y=T,E=A,v=D,i=null},n.proc=function(f,g,w){let T,A,D,_=0,S=0,x=0,C,O,R,M;for(x=g.next_in_index,C=g.avail_in,_=f.bitb,S=f.bitk,O=f.write,R=O=258&&C>=10&&(f.bitb=_,f.bitk=S,g.avail_in=C,g.total_in+=x-g.next_in_index,g.next_in_index=x,f.write=O,w=d(c,p,m,y,E,v,f,g),x=g.next_in_index,C=g.avail_in,_=f.bitb,S=f.bitk,O=f.write,R=O>>=i[A+1],S-=i[A+1],D=i[A],D===0){a=i[A+2],t=fs;break}if(D&16){s=D&15,e=i[A+2],t=ls;break}if(!(D&64)){o=D,r=A/3+i[A+2];break}if(D&32){t=Gr;break}return t=_i,g.msg="invalid literal/length code",w=-3,f.bitb=_,f.bitk=S,g.avail_in=C,g.total_in+=x-g.next_in_index,g.next_in_index=x,f.write=O,f.inflate_flush(g,w);case ls:for(T=s;S>=T,S-=T,o=p,i=E,r=v,t=cs;case cs:for(T=o;S>=i[A+1],S-=i[A+1],D=i[A],D&16){s=D&15,l=i[A+2],t=ps;break}if(!(D&64)){o=D,r=A/3+i[A+2];break}return t=_i,g.msg="invalid distance code",w=-3,f.bitb=_,f.bitk=S,g.avail_in=C,g.total_in+=x-g.next_in_index,g.next_in_index=x,f.write=O,f.inflate_flush(g,w);case ps:for(T=s;S>=T,S-=T,t=us;case us:for(M=O-l;M<0;)M+=f.end;for(;e!==0;){if(R===0&&(O==f.end&&f.read!==0&&(O=0,R=O7&&(S-=8,C++,x--),f.write=O,w=f.inflate_flush(g,w),O=f.write,R=Od.avail_out&&(g=d.avail_out),g!==0&&f==-5&&(f=0),d.avail_out-=g,d.total_out+=g,d.next_out.set(e.win.subarray(T,T+g),w),w+=g,T+=g,T==e.end&&(T=0,e.write==e.end&&(e.write=0),g=e.write-T,g>d.avail_out&&(g=d.avail_out),g!==0&&f==-5&&(f=0),d.avail_out-=g,d.total_out+=g,d.next_out.set(e.win.subarray(T,T+g),w),w+=g,T+=g),d.next_out_index=w,e.read=T,f},e.proc=function(d,f){let g,w,T,A,D,_,S,x;for(A=d.next_in_index,D=d.avail_in,w=e.bitb,T=e.bitk,_=e.write,S=_>>1){case 0:w>>>=3,T-=3,g=T&7,w>>>=g,T-=g,i=Vr;break;case 1:C=[],O=[],R=[[]],M=[[]],Xr.inflate_trees_fixed(C,O,R,M),p.init(C[0],O[0],R[0],0,M[0],0),w>>>=3,T-=3,i=Ti;break;case 2:w>>>=3,T-=3,i=gs;break;case 3:return w>>>=3,T-=3,i=Zt,d.msg="invalid block type",f=-3,e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f)}break;case Vr:for(;T<32;){if(D!==0)f=0;else return e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);D--,w|=(d.read_byte(A++)&255)<>>16&65535)!=(w&65535))return i=Zt,d.msg="invalid stored block lengths",f=-3,e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);r=w&65535,w=T=0,i=r!==0?hs:m!==0?Ai:fn;break;case hs:if(D===0||S===0&&(_==e.end&&e.read!==0&&(_=0,S=_D&&(g=D),g>S&&(g=S),e.win.set(d.read_buf(A,g),_),A+=g,D-=g,_+=g,S-=g,(r-=g)!==0)break;i=m!==0?Ai:fn;break;case gs:for(;T<14;){if(D!==0)f=0;else return e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);D--,w|=(d.read_byte(A++)&255)<29||(g>>5&31)>29)return i=Zt,d.msg="too many length or distance symbols",f=-3,e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);if(g=258+(g&31)+(g>>5&31),!s||s.length>>=14,T-=14,a=0,i=ys;case ys:for(;a<4+(o>>>10);){for(;T<3;){if(D!==0)f=0;else return e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);D--,w|=(d.read_byte(A++)&255)<>>=3,T-=3}for(;a<19;)s[ms[a++]]=0;if(l[0]=7,g=v.inflate_trees_bits(s,l,c,y,d),g!=0)return f=g,f==-3&&(s=null,i=Zt),e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);a=0,i=bs;case bs:for(;g=o,!(a>=258+(g&31)+(g>>5&31));){let ee,z;for(g=l[0];T>>=g,T-=g,s[a++]=z;else{for(x=z==18?7:z-14,ee=z==18?11:3;T>>=g,T-=g,ee+=w&De[x],w>>>=x,T-=x,x=a,g=o,x+ee>258+(g&31)+(g>>5&31)||z==16&&x<1)return s=null,i=Zt,d.msg="invalid bit length repeat",f=-3,e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);z=z==16?s[x-1]:0;do s[x++]=z;while(--ee!==0);a=x}}if(c[0]=-1,P=[],H=[],Z=[],F=[],P[0]=9,H[0]=6,g=o,g=v.inflate_trees_dynamic(257+(g&31),1+(g>>5&31),s,P,H,Z,F,y,d),g!=0)return g==-3&&(s=null,i=Zt),f=g,e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,e.inflate_flush(d,f);p.init(P[0],H[0],y,Z[0],y,F[0]),i=Ti;case Ti:if(e.bitb=w,e.bitk=T,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=_,(f=p.proc(e,d,f))!=1)return e.inflate_flush(d,f);if(f=0,p.free(d),A=d.next_in_index,D=d.avail_in,w=e.bitb,T=e.bitk,_=e.write,S=_15?(n.inflateEnd(e),-2):(n.wbits=i,e.istate.blocks=new Dd(e,1<>4)+8>a.wbits){a.mode=Et,e.msg="invalid win size",a.marker=5;break}a.mode=ws;case ws:if(e.avail_in===0)return r;if(r=i,e.avail_in--,e.total_in++,o=e.read_byte(e.next_in_index++)&255,((a.method<<8)+o)%31!==0){a.mode=Et,e.msg="incorrect header check",a.marker=5;break}if(!(o&Cd)){a.mode=$n;break}a.mode=vs;case vs:if(e.avail_in===0)return r;r=i,e.avail_in--,e.total_in++,a.need=(e.read_byte(e.next_in_index++)&255)<<24&4278190080,a.mode=Es;case Es:if(e.avail_in===0)return r;r=i,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<16&16711680,a.mode=_s;case _s:if(e.avail_in===0)return r;r=i,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<8&65280,a.mode=Ts;case Ts:return e.avail_in===0?r:(r=i,e.avail_in--,e.total_in++,a.need+=e.read_byte(e.next_in_index++)&255,a.mode=Kr,2);case Kr:return a.mode=Et,e.msg="need dictionary",a.marker=0,-2;case $n:if(r=a.blocks.proc(e,r),r==-3){a.mode=Et,a.marker=0;break}if(r==0&&(r=i),r!=1)return r;r=i,a.blocks.reset(e,a.was),a.mode=As;case As:return e.avail_in=0,1;case Et:return-3;default:return-2}},n.inflateSetDictionary=function(e,i,r){let o=0,a=r;if(!e||!e.istate||e.istate.mode!=Kr)return-2;let s=e.istate;return a>=1<0&&e.next_in_index!=y&&(l(e.next_in_index),y=e.next_in_index)}while(e.avail_in>0||e.avail_out===0);return c.length>1?(m=new Uint8Array(v),c.forEach(function(d){m.set(d,E),E+=d.length})):m=c[0]?new Uint8Array(c[0]):new Uint8Array,m}},t.flush=function(){e.inflateEnd()}}var Rs="/",tb=new Date(2107,11,31),nb=new Date(1980,0,1),_e=void 0,dn="undefined",ki="function";var Bn=class{constructor(t){return class extends TransformStream{constructor(e,i){let r=new t(i);super({transform(o,a){a.enqueue(r.append(o))},flush(o){let a=r.flush();a&&o.enqueue(a)}})}}}};var Md=64,Os=2;try{typeof navigator!=dn&&navigator.hardwareConcurrency&&(Os=navigator.hardwareConcurrency)}catch(n){}var $d={chunkSize:512*1024,maxWorkers:Os,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:_e,CompressionStreamNative:typeof CompressionStream!=dn&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=dn&&DecompressionStream},Tt=Object.assign({},$d);function Jr(){return Tt}function Ds(n){return Math.max(n.chunkSize,Md)}function Ni(n){let{baseURL:t,chunkSize:e,maxWorkers:i,terminateWorkerTimeout:r,useCompressionStream:o,useWebWorkers:a,Deflate:s,Inflate:l,CompressionStream:c,DecompressionStream:p,workerScripts:m}=n;if(_t("baseURL",t),_t("chunkSize",e),_t("maxWorkers",i),_t("terminateWorkerTimeout",r),_t("useCompressionStream",o),_t("useWebWorkers",a),s&&(Tt.CompressionStream=new Bn(s)),l&&(Tt.DecompressionStream=new Bn(l)),_t("CompressionStream",c),_t("DecompressionStream",p),m!==_e){let{deflate:y,inflate:E}=m;if((y||E)&&(Tt.workerScripts||(Tt.workerScripts={})),y){if(!Array.isArray(y))throw new Error("workerScripts.deflate must be an array");Tt.workerScripts.deflate=y}if(E){if(!Array.isArray(E))throw new Error("workerScripts.inflate must be an array");Tt.workerScripts.inflate=E}}}function _t(n,t){t!==_e&&(Tt[n]=t)}var Cs=[];for(let n=0;n<256;n++){let t=n;for(let e=0;e<8;e++)t&1?t=t>>>1^3988292384:t=t>>>1;Cs[n]=t}var ct=class{constructor(t){this.crc=t||-1}append(t){let e=this.crc|0;for(let i=0,r=t.length|0;i>>8^Cs[(e^t[i])&255];this.crc=e}get(){return~this.crc}};var Un=class extends TransformStream{constructor(){let t,e=new ct;super({transform(i,r){e.append(i),r.enqueue(i)},flush(){let i=new Uint8Array(4);new DataView(i.buffer).setUint32(0,e.get()),t.value=i}}),t=this}};function Is(n){if(typeof TextEncoder=="undefined"){n=unescape(encodeURIComponent(n));let t=new Uint8Array(n.length);for(let e=0;e0&&t&&(n[e-1]=Te.partial(t,n[e-1]&2147483648>>t-1,1)),n},partial(n,t,e){return n===32?t:(e?t|0:t<<32-n)+n*1099511627776},getPartial(n){return Math.round(n/1099511627776)||32},_shiftRight(n,t,e,i){for(i===void 0&&(i=[]);t>=32;t-=32)i.push(e),e=0;if(t===0)return i.concat(n);for(let a=0;a>>t),e=n[a]<<32-t;let r=n.length?n[n.length-1]:0,o=Te.getPartial(r);return i.push(Te.partial(t+o&31,t+o>32?e:i.pop(),1)),i}},jn={bytes:{fromBits(n){let e=Te.bitLength(n)/8,i=new Uint8Array(e),r;for(let o=0;o>>24,r<<=8;return i},toBits(n){let t=[],e,i=0;for(e=0;e9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");let o=new Uint32Array(e),a=0;for(let s=t.blockSize+i-(t.blockSize+i&t.blockSize-1);s<=r;s+=t.blockSize)t._block(o.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),t}finalize(){let n=this,t=n._buffer,e=n._h;t=Te.concat(t,[Te.partial(1,1)]);for(let i=t.length+2;i&15;i++)t.push(0);for(t.push(Math.floor(n._length/4294967296)),t.push(n._length|0);t.length;)n._block(t.splice(0,16));return n.reset(),e}_f(n,t,e,i){if(n<=19)return t&e|~t&i;if(n<=39)return t^e^i;if(n<=59)return t&e|t&i|e&i;if(n<=79)return t^e^i}_S(n,t){return t<>>32-n}_block(n){let t=this,e=t._h,i=Array(80);for(let c=0;c<16;c++)i[c]=n[c];let r=e[0],o=e[1],a=e[2],s=e[3],l=e[4];for(let c=0;c<=79;c++){c>=16&&(i[c]=t._S(1,i[c-3]^i[c-8]^i[c-14]^i[c-16]));let p=t._S(5,r)+t._f(c,o,a,s)+l+i[c]+t._key[Math.floor(c/20)]|0;l=s,s=a,a=t._S(30,o),o=r,r=p}e[0]=e[0]+r|0,e[1]=e[1]+o|0,e[2]=e[2]+a|0,e[3]=e[3]+s|0,e[4]=e[4]+l|0}};var Qr={};Qr.aes=class{constructor(n){let t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();let e=t._tables[0][4],i=t._tables[1],r=n.length,o,a,s,l=1;if(r!==4&&r!==6&&r!==8)throw new Error("invalid aes key size");for(t._key=[a=n.slice(0),s=[]],o=r;o<4*r+28;o++){let c=a[o-1];(o%r===0||r===8&&o%r===4)&&(c=e[c>>>24]<<24^e[c>>16&255]<<16^e[c>>8&255]<<8^e[c&255],o%r===0&&(c=c<<8^c>>>24^l<<24,l=l<<1^(l>>7)*283)),a[o]=a[o-r]^c}for(let c=0;o;c++,o--){let p=a[c&3?o:o-4];o<=4||c<4?s[c]=p:s[c]=i[0][e[p>>>24]]^i[1][e[p>>16&255]]^i[2][e[p>>8&255]]^i[3][e[p&255]]}}encrypt(n){return this._crypt(n,0)}decrypt(n){return this._crypt(n,1)}_precompute(){let n=this._tables[0],t=this._tables[1],e=n[4],i=t[4],r=[],o=[],a,s,l,c;for(let p=0;p<256;p++)o[(r[p]=p<<1^(p>>7)*283)^p]=p;for(let p=a=0;!e[p];p^=s||1,a=o[a]||1){let m=a^a<<1^a<<2^a<<3^a<<4;m=m>>8^m&255^99,e[p]=m,i[m]=p,c=r[l=r[s=r[p]]];let y=c*16843009^l*65537^s*257^p*16843008,E=r[m]*257^m*16843008;for(let v=0;v<4;v++)n[v][p]=E=E<<24^E>>>8,t[v][m]=y=y<<24^y>>>8}for(let p=0;p<5;p++)n[p]=n[p].slice(0),t[p]=t[p].slice(0)}_crypt(n,t){if(n.length!==4)throw new Error("invalid aes block size");let e=this._key[t],i=e.length/4-2,r=[0,0,0,0],o=this._tables[t],a=o[0],s=o[1],l=o[2],c=o[3],p=o[4],m=n[0]^e[0],y=n[t?3:1]^e[1],E=n[2]^e[2],v=n[t?1:3]^e[3],d=4,f,g,w;for(let T=0;T>>24]^s[y>>16&255]^l[E>>8&255]^c[v&255]^e[d],g=a[y>>>24]^s[E>>16&255]^l[v>>8&255]^c[m&255]^e[d+1],w=a[E>>>24]^s[v>>16&255]^l[m>>8&255]^c[y&255]^e[d+2],v=a[v>>>24]^s[m>>16&255]^l[y>>8&255]^c[E&255]^e[d+3],d+=4,m=f,y=g,E=w;for(let T=0;T<4;T++)r[t?3&-T:T]=p[m>>>24]<<24^p[y>>16&255]<<16^p[E>>8&255]<<8^p[v&255]^e[d++],f=m,m=y,y=E,E=v,v=f;return r}};var Ls={getRandomValues(n){let t=new Uint32Array(n.buffer),e=i=>{let r=987654321,o=4294967295;return function(){return r=36969*(r&65535)+(r>>16)&o,i=18e3*(i&65535)+(i>>16)&o,(((r<<16)+i&o)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let i=0,r;i>24&255)===255){let t=n>>16&255,e=n>>8&255,i=n&255;t===255?(t=0,e===255?(e=0,i===255?i=0:++i):++e):++t,n=0,n+=t<<16,n+=e<<8,n+=i}else n+=1<<24;return n}incCounter(n){(n[0]=this.incWord(n[0]))===0&&(n[1]=this.incWord(n[1]))}calculate(n,t,e){let i;if(!(i=t.length))return[];let r=Te.bitLength(t);for(let o=0;o>5)+1<<2,o,a,s,l,c,p=new ArrayBuffer(r),m=new DataView(p),y=0,E=Te;for(t=jn.bytes.toBits(t),c=1;y<(r||1);c++){for(o=a=n.encrypt(E.concat(t,[c])),s=1;sr&&(n=new e().update(n).finalize());for(let o=0;othis.resolveReady=o),password:t,signed:e,strength:i-1,pending:new Uint8Array})},async transform(o,a){let s=this,{password:l,strength:c,resolveReady:p,ready:m}=s;l?(await Vd(s,c,l,Fe(o,0,qn[c]+2)),o=Fe(o,qn[c]+2),r?a.error(new Error(pt)):p()):await m;let y=new Uint8Array(o.length-Nt-(o.length-Nt)%mn);a.enqueue(Hs(s,o,y,0,Nt,!0))},async flush(o){let{signed:a,ctr:s,hmac:l,pending:c,ready:p}=this;await p;let m=Fe(c,0,c.length-Nt),y=Fe(c,c.length-Nt),E=new Uint8Array;if(m.length){let v=Zn(Je,m);l.update(v);let d=s.update(v);E=Wn(Je,d)}if(a){let v=Fe(Wn(Je,l.digest()),0,Nt);for(let d=0;dthis.resolveReady=r),password:t,strength:e-1,pending:new Uint8Array})},async transform(r,o){let a=this,{password:s,strength:l,resolveReady:c,ready:p}=a,m=new Uint8Array;s?(m=await Kd(a,l,s),c()):await p;let y=new Uint8Array(m.length+r.length-r.length%mn);y.set(m,0),o.enqueue(Hs(a,r,y,m.length,0))},async flush(r){let{ctr:o,hmac:a,pending:s,ready:l}=this;await l;let c=new Uint8Array;if(s.length){let p=o.update(Zn(Je,s));a.update(p),c=Wn(Je,p)}i.signature=Wn(Je,a.digest()).slice(0,Nt),r.enqueue(no(c,i.signature))}}),i=this}};function Hs(n,t,e,i,r,o){let{ctr:a,hmac:s,pending:l}=n,c=t.length-r;l.length&&(t=no(l,t),e=Qd(e,c-c%mn));let p;for(p=0;p<=c-mn;p+=mn){let m=Zn(Je,Fe(t,p,p+mn));o&&s.update(m);let y=a.update(m);o||s.update(y),e.set(Wn(Je,y),p+i)}return n.pending=Fe(t,p),e}async function Vd(n,t,e,i){let r=await qs(n,t,e,Fe(i,0,qn[t])),o=Fe(i,qn[t]);if(r[0]!=o[0]||r[1]!=o[1])throw new Error(kt)}async function Kd(n,t,e){let i=Si(new Uint8Array(qn[t])),r=await qs(n,t,e,i);return no(i,r)}async function qs(n,t,e,i){n.password=null;let r=Is(e),o=await Xd(Ud,r,qd,!1,Wd),a=await Jd(Object.assign({salt:i},to),o,8*(Hn[t]*2+2)),s=new Uint8Array(a),l=Zn(Je,Fe(s,0,Hn[t])),c=Zn(Je,Fe(s,Hn[t],Hn[t]*2)),p=Fe(s,Hn[t]*2);return Object.assign(n,{keys:{key:l,authentication:c,passwordVerification:p},ctr:new zd(new Yd(l),Array.from(Zd)),hmac:new Gd(c)}),p}async function Xd(n,t,e,i,r){if(Ps)try{return await Yn.importKey(n,t,e,i,r)}catch(o){return Ps=!1,At.importKey(t)}else return At.importKey(t)}async function Jd(n,t,e){if(Ms)try{return await Yn.deriveBits(n,t,e)}catch(i){return Ms=!1,At.pbkdf2(t,n.salt,to.iterations,e)}else return At.pbkdf2(t,n.salt,to.iterations,e)}function no(n,t){let e=n;return n.length+t.length&&(e=new Uint8Array(n.length+t.length),e.set(n,0),e.set(t,n.length)),e}function Qd(n,t){if(t&&t>n.length){let e=n;n=new Uint8Array(t),n.set(e,0)}return n}function Fe(n,t,e){return n.subarray(t,e)}function Wn(n,t){return n.fromBits(t)}function Zn(n,t){return n.toBits(t)}var hn=12,Ci=class extends TransformStream{constructor({password:t,passwordVerification:e,checkPasswordOnly:i}){super({start(){Object.assign(this,{password:t,passwordVerification:e}),zs(this,t)},transform(r,o){let a=this;if(a.password){let s=Ws(a,r.subarray(0,hn));if(a.password=null,s[hn-1]!=a.passwordVerification)throw new Error(kt);r=r.subarray(hn)}i?o.error(new Error(pt)):o.enqueue(Ws(a,r))}})}},Ii=class extends TransformStream{constructor({password:t,passwordVerification:e}){super({start(){Object.assign(this,{password:t,passwordVerification:e}),zs(this,t)},transform(i,r){let o=this,a,s;if(o.password){o.password=null;let l=Si(new Uint8Array(hn));l[hn-1]=o.passwordVerification,a=new Uint8Array(i.length+l.length),a.set(Zs(o,l),0),s=hn}else a=new Uint8Array(i.length),s=0;a.set(Zs(o,i),s),r.enqueue(a)}})}};function Ws(n,t){let e=new Uint8Array(t.length);for(let i=0;i>>24]),r=~n.crcKey2.get(),n.keys=[e,i,r]}function Gs(n){let t=n.keys[2]|2;return Vs(Math.imul(t,t^1)>>>8)}function Vs(n){return n&255}function Ys(n){return n&4294967295}var Ks="deflate-raw",Fi=class extends TransformStream{constructor(t,{chunkSize:e,CompressionStream:i,CompressionStreamNative:r}){super({});let{compressed:o,encrypted:a,useCompressionStream:s,zipCrypto:l,signed:c,level:p}=t,m=this,y,E,v=Xs(super.readable);(!a||l)&&c&&(y=new Un,v=Qe(v,y)),o&&(v=Qs(v,s,{level:p,chunkSize:e},r,i)),a&&(l?v=Qe(v,new Ii(t)):(E=new Oi(t),v=Qe(v,E))),Js(m,v,async()=>{let d;a&&!l&&(d=E.signature),(!a||l)&&c&&(d=new DataView(y.value.buffer).getUint32(0)),m.signature=d})}},Li=class extends TransformStream{constructor(t,{chunkSize:e,DecompressionStream:i,DecompressionStreamNative:r}){super({});let{zipCrypto:o,encrypted:a,signed:s,signature:l,compressed:c,useCompressionStream:p}=t,m,y,E=Xs(super.readable);a&&(o?E=Qe(E,new Ci(t)):(y=new Ri(t),E=Qe(E,y))),c&&(E=Qs(E,p,{chunkSize:e},r,i)),(!a||o)&&s&&(m=new Un,E=Qe(E,m)),Js(this,E,async()=>{if((!a||o)&&s){let v=new DataView(m.value.buffer);if(l!=v.getUint32(0,!1))throw new Error(Yt)}})}};function Xs(n){return Qe(n,new TransformStream({transform(t,e){t&&t.length&&e.enqueue(t)}}))}function Js(n,t,e){t=Qe(t,new TransformStream({flush:e})),Object.defineProperty(n,"readable",{get(){return t}})}function Qs(n,t,e,i,r){try{let o=t&&i?i:r;n=Qe(n,new o(Ks,e))}catch(o){if(t)n=Qe(n,new r(Ks,e));else throw o}return n}function Qe(n,t){return n.pipeThrough(t)}var el="message",tl="start",nl="pull",ro="data",il="ack",rl="close",ol="deflate",Mi="inflate";var Pi=class extends TransformStream{constructor(t,e){super({});let i=this,{codecType:r}=t,o;r.startsWith(ol)?o=Fi:r.startsWith(Mi)&&(o=Li);let a=0,s=new o(t,e),l=super.readable,c=new TransformStream({transform(p,m){p&&p.length&&(a+=p.length,m.enqueue(p))},flush(){let{signature:p}=s;Object.assign(i,{signature:p,size:a})}});Object.defineProperty(i,"readable",{get(){return l.pipeThrough(s).pipeThrough(c)}})}};var em=typeof Worker!=dn;var gn=class{constructor(t,{readable:e,writable:i},{options:r,config:o,streamOptions:a,useWebWorkers:s,transferStreams:l,scripts:c},p){let{signal:m}=a;return Object.assign(t,{busy:!0,readable:e.pipeThrough(new ao(e,a,o),{signal:m}),writable:i,options:Object.assign({},r),scripts:c,transferStreams:l,terminate(){let{worker:y,busy:E}=t;y&&!E&&(y.terminate(),t.interface=null)},onTaskFinished(){t.busy=!1,p(t)}}),(s&&em?nm:tm)(t,o)}},ao=class extends TransformStream{constructor(t,{onstart:e,onprogress:i,size:r,onend:o},{chunkSize:a}){let s=0;super({start(){e&&oo(e,r)},async transform(l,c){s+=l.length,i&&await oo(i,s,r),c.enqueue(l)},flush(){t.size=s,o&&oo(o,s)}},{highWaterMark:1,size:()=>a})}};async function oo(n,...t){try{await n(...t)}catch(e){}}function tm(n,t){return{run:()=>im(n,t)}}function nm(n,{baseURL:t,chunkSize:e}){return n.interface||Object.assign(n,{worker:am(n.scripts[0],t,n),interface:{run:()=>rm(n,{chunkSize:e})}}),n.interface}async function im({options:n,readable:t,writable:e,onTaskFinished:i},r){let o=new Pi(n,r);try{await t.pipeThrough(o).pipeTo(e,{preventClose:!0,preventAbort:!0});let{signature:a,size:s}=o;return{signature:a,size:s}}finally{i()}}async function rm(n,t){let e,i,r=new Promise((y,E)=>{e=y,i=E});Object.assign(n,{reader:null,writer:null,resolveResult:e,rejectResult:i,result:r});let{readable:o,options:a,scripts:s}=n,{writable:l,closed:c}=om(n.writable);so({type:tl,scripts:s.slice(1),options:a,config:t,readable:o,writable:l},n)||Object.assign(n,{reader:o.getReader(),writer:l.getWriter()});let m=await r;try{await l.getWriter().close()}catch(y){}return await c,m}function om(n){let t=n.getWriter(),e,i=new Promise(o=>e=o);return{writable:new WritableStream({async write(o){await t.ready,await t.write(o)},close(){t.releaseLock(),e()},abort(o){return t.abort(o)}}),closed:i}}var al=!0,sl=!0;function am(n,t,e){let i={type:"module"},r,o;typeof n==ki&&(n=n());try{r=new URL(n,t)}catch(a){r=n}if(al)try{o=new Worker(r)}catch(a){al=!1,o=new Worker(r,i)}else o=new Worker(r,i);return o.addEventListener(el,a=>sm(a,e)),o}function so(n,{worker:t,writer:e,onTaskFinished:i,transferStreams:r}){try{let{value:o,readable:a,writable:s}=n,l=[];if(o&&(n.value=o.buffer,l.push(n.value)),r&&sl?(a&&l.push(a),s&&l.push(s)):n.readable=n.writable=null,l.length)try{return t.postMessage(n,l),!0}catch(c){sl=!1,n.readable=n.writable=null,t.postMessage(n)}else t.postMessage(n)}catch(o){throw e&&e.releaseLock(),i(),o}}async function sm({data:n},t){let{type:e,value:i,messageId:r,result:o,error:a}=n,{reader:s,writer:l,resolveResult:c,rejectResult:p,onTaskFinished:m}=t;try{if(a){let{message:E,stack:v,code:d,name:f}=a,g=new Error(E);Object.assign(g,{stack:v,code:d,name:f}),y(g)}else{if(e==nl){let{value:E,done:v}=await s.read();so({type:ro,value:E,done:v,messageId:r},t)}e==ro&&(await l.ready,await l.write(new Uint8Array(i)),so({type:il,messageId:r},t)),e==rl&&y(null,o)}}catch(E){y(E)}function y(E,v){E?p(E):c(v),l&&l.releaseLock(),m()}}var zt=[],lo=[];var ll=0;async function pl(n,t){let{options:e,config:i}=t,{transferStreams:r,useWebWorkers:o,useCompressionStream:a,codecType:s,compressed:l,signed:c,encrypted:p}=e,{workerScripts:m,maxWorkers:y,terminateWorkerTimeout:E}=i;t.transferStreams=r||r===_e;let v=!l&&!c&&!p&&!t.transferStreams;t.useWebWorkers=!v&&(o||o===_e&&i.useWebWorkers),t.scripts=t.useWebWorkers&&m?m[s]:[],e.useCompressionStream=a||a===_e&&i.useCompressionStream;let d,f=zt.find(w=>!w.busy);if(f)cl(f),d=new gn(f,n,t,g);else if(zt.lengthlo.push({resolve:w,stream:n,workerOptions:t}));return d.run();function g(w){if(lo.length){let[{resolve:T,stream:A,workerOptions:D}]=lo.splice(0,1);T(new gn(w,A,D,g))}else w.worker?(cl(w),Number.isFinite(E)&&E>=0&&(w.terminateTimeout=setTimeout(()=>{zt=zt.filter(T=>T!=w),w.terminate()},E))):zt=zt.filter(T=>T!=w)}}function cl(n){let{terminateTimeout:t}=n;t&&(clearTimeout(t),n.terminateTimeout=null)}var lm="Writer iterator completed too soon";var cm="Content-Type";var pm=64*1024,ul="writable",zn=class{constructor(){this.size=0}init(){this.initialized=!0}},yn=class extends zn{get readable(){let t=this,{chunkSize:e=pm}=t,i=new ReadableStream({start(){this.chunkOffset=0},async pull(r){let{offset:o=0,size:a,diskNumberStart:s}=i,{chunkOffset:l}=this;r.enqueue(await be(t,o+l,Math.min(e,a-l),s)),l+e>a?r.close():this.chunkOffset+=e}});return i}};var St=class extends yn{constructor(t){super(),Object.assign(this,{blob:t,size:t.size})}async readUint8Array(t,e){let i=this,r=t+e,a=await(t||re&&(a=a.slice(t,r)),new Uint8Array(a)}},Gn=class extends zn{constructor(t){super();let e=this,i=new TransformStream,r=[];t&&r.push([cm,t]),Object.defineProperty(e,ul,{get(){return i.writable}}),e.blob=new Response(i.readable,{headers:r}).blob()}getData(){return this.blob}};var $i=class extends Gn{constructor(t){super(t),Object.assign(this,{encoding:t,utf8:!t||t.toLowerCase()=="utf-8"})}async getData(){let{encoding:t,utf8:e}=this,i=await super.getData();if(i.text&&e)return i.text();{let r=new FileReader;return new Promise((o,a)=>{Object.assign(r,{onload:({target:s})=>o(s.result),onerror:()=>a(r.error)}),r.readAsText(i,t)})}}};var co=class extends yn{constructor(t){super(),this.readers=t}async init(){let t=this,{readers:e}=t;t.lastDiskNumber=0,t.lastDiskOffset=0,await Promise.all(e.map(async(i,r)=>{await i.init(),r!=e.length-1&&(t.lastDiskOffset+=i.size),t.size+=i.size})),super.init()}async readUint8Array(t,e,i=0){let r=this,{readers:o}=this,a,s=i;s==-1&&(s=o.length-1);let l=t;for(;l>=o[s].size;)l-=o[s].size,s++;let c=o[s],p=c.size;if(l+e<=p)a=await be(c,l,e);else{let m=p-l;a=new Uint8Array(e),a.set(await be(c,l,m)),a.set(await r.readUint8Array(t+m,e-m,i),m)}return r.lastDiskNumber=Math.max(s,r.lastDiskNumber),a}},Bi=class extends zn{constructor(t,e=4294967295){super();let i=this;Object.assign(i,{diskNumber:0,diskOffset:0,size:0,maxSize:e,availableSize:e});let r,o,a,s=new WritableStream({async write(p){let{availableSize:m}=i;if(a)p.length>=m?(await l(p.slice(0,m)),await c(),i.diskOffset+=r.size,i.diskNumber++,a=null,await this.write(p.slice(m))):await l(p);else{let{value:y,done:E}=await t.next();if(E&&!y)throw new Error(lm);r=y,r.size=0,r.maxSize&&(i.maxSize=r.maxSize),i.availableSize=i.maxSize,await Vn(r),o=y.writable,a=o.getWriter(),await this.write(p)}},async close(){await a.ready,await c()}});Object.defineProperty(i,ul,{get(){return s}});async function l(p){let m=p.length;m&&(await a.ready,await a.write(p),r.size+=m,i.size+=m,i.availableSize-=m)}async function c(){o.size=r.size,await a.close()}}};async function Vn(n,t){n.init&&!n.initialized&&await n.init(t)}function fl(n){return Array.isArray(n)&&(n=new co(n)),n instanceof ReadableStream&&(n={readable:n}),n}function dl(n){n.writable===_e&&typeof n.next==ki&&(n=new Bi(n)),n instanceof WritableStream&&(n={writable:n});let{writable:t}=n;return t.size===_e&&(t.size=0),n instanceof Bi||Object.assign(n,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),n}function be(n,t,e,i){return n.readUint8Array(t,e,i)}var ml="\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0 ".split(""),um=ml.length==256;function hl(n){if(um){let t="";for(let e=0;ethis[e]=t[e])}};var To="File format is not recognized",Cm="End of central directory not found",Im="End of Zip64 central directory not found",Fm="End of Zip64 central directory locator not found",Lm="Central directory header not found",Pm="Local file header not found",Mm="Zip64 extra field not found",$m="File contains encrypted entry",Bm="Encryption method not supported",Tl="Compression method not supported",Al="Split zip file",kl="utf-8",Nl="cp437",Um=[[ho,4294967295],[go,4294967295],[yo,4294967295],[ji,65535]],jm={[65535]:{getValue:ae,bytes:4},[4294967295]:{getValue:qi,bytes:8}},Vt=class{constructor(t,e={}){Object.assign(this,{reader:fl(t),options:e,config:Jr()})}async*getEntriesGenerator(t={}){let e=this,{reader:i}=e,{config:r}=e;if(await Vn(i),(i.size===_e||!i.readUint8Array)&&(i=new St(await new Response(i.readable).blob()),await Vn(i)),i.size<22)throw new Error(To);i.chunkSize=Ds(r);let o=await Ym(i,101010256,i.size,22,65535*16);if(!o){let O=await be(i,0,4),R=he(O);throw ae(R)==134695760?new Error(Al):new Error(Cm)}let a=he(o),s=ae(a,12),l=ae(a,16),c=o.offset,p=me(a,20),m=c+22+p,y=me(a,4),E=i.lastDiskNumber||0,v=me(a,6),d=me(a,8),f=0,g=0;if(l==4294967295||s==4294967295||d==65535||v==65535){let O=await be(i,o.offset-20,20),R=he(O);if(ae(R,0)!=117853008)throw new Error(Im);l=qi(R,8);let M=await be(i,l,56,-1),P=he(M),H=o.offset-20-56;if(ae(P,0)!=101075792&&l!=H){let Z=l;l=H,f=l-Z,M=await be(i,l,56,-1),P=he(M)}if(ae(P,0)!=101075792)throw new Error(Fm);y==65535&&(y=ae(P,16)),v==65535&&(v=ae(P,20)),d==65535&&(d=qi(P,32)),s==4294967295&&(s=qi(P,40)),l-=s}if(E!=y)throw new Error(Al);if(l<0||l>=i.size)throw new Error(To);let w=0,T=await be(i,l,s,v),A=he(T);if(s){let O=o.offset-s;if(ae(A,w)!=33639248&&l!=O){let R=l;l=O,f=l-R,T=await be(i,l,s,v),A=he(T)}}let D=o.offset-l-(i.lastDiskOffset||0);if(s!=D&&D>=0&&(s=D,T=await be(i,l,s,v),A=he(T)),l<0||l>=i.size)throw new Error(To);let _=Le(e,t,"filenameEncoding"),S=Le(e,t,"commentEncoding");for(let O=0;OR.getData(k,N,I),w=U;let{onprogress:b}=t;if(b)try{await b(O+1,d,new Kn(R))}catch(k){}yield N}let x=Le(e,t,"extractPrependedData"),C=Le(e,t,"extractAppendedData");return x&&(e.prependedData=g>0?await be(i,0,g):new Uint8Array),e.comment=p?await be(i,c+22,p):new Uint8Array,C&&(e.appendedData=m>>8&255:y>>>24&255),signature:y,compressed:c!=0,encrypted:A,useWebWorkers:Le(r,i,"useWebWorkers"),useCompressionStream:Le(r,i,"useCompressionStream"),transferStreams:Le(r,i,"transferStreams"),checkPasswordOnly:O},config:p,streamOptions:{signal:C,size:S,onstart:M,onprogress:P,onend:H}},F=0;try{({outputSize:F}=await pl({readable:x,writable:R},Z))}catch(ee){if(!O||ee.message!=pt)throw ee}finally{let ee=Le(r,i,"preventClose");R.size+=F,!ee&&!R.locked&&await R.getWriter().close()}return O?void 0:t.getData?t.getData():R}};function Rl(n,t,e){let i=n.rawBitFlag=me(t,e+2),r=(i&1)==1,o=ae(t,e+6);Object.assign(n,{encrypted:r,version:me(t,e),bitFlag:{level:(i&6)>>1,dataDescriptor:(i&8)==8,languageEncodingFlag:(i&2048)==2048},rawLastModDate:o,lastModDate:zm(o),filenameLength:me(t,e+22),extraFieldLength:me(t,e+24)})}async function Ol(n,t,e,i){let{rawExtraField:r}=t,o=t.extraField=new Map,a=he(new Uint8Array(r)),s=0;try{for(;st[r]==o);for(let r=0,o=0;r{if(n.data.length>=a+4){let c=ae(e,a);t[s]=n[s]=new Date(c*1e3);let p=o[l];n[p]=c}a+=4})}async function Ym(n,t,e,i,r){let o=new Uint8Array(4),a=he(o);Gm(a,0,t);let s=i+r;return await l(i)||await l(Math.min(s,e));async function l(c){let p=e-c,m=await be(n,p,c);for(let y=m.length-i;y>=0;y--)if(m[y]==o[0]&&m[y+1]==o[1]&&m[y+2]==o[2]&&m[y+3]==o[3])return{offset:p+y,buffer:m.slice(y,y+i).buffer}}}function Le(n,t,e){return t[e]===_e?n.options[e]:t[e]}function zm(n){let t=(n&4294901760)>>16,e=n&65535;try{return new Date(1980+((t&65024)>>9),((t&480)>>5)-1,t&31,(e&63488)>>11,(e&2016)>>5,(e&31)*2,0)}catch(i){}}function Ao(n){return new Date(Number(n/BigInt(1e4)-BigInt(116444736e5)))}function bn(n,t){return n.getUint8(t)}function me(n,t){return n.getUint16(t,!0)}function ae(n,t){return n.getUint32(t,!0)}function qi(n,t){return Number(n.getBigUint64(t,!0))}function Gm(n,t,e){n.setUint32(t,e,!0)}function he(n){return new DataView(n.buffer)}Ni({Inflate:Ss});var Kt=require("obsidian");function Dl(n){let t=()=>URL.createObjectURL(new Blob([`const{Array:e,Object:t,Number:n,Math:r,Error:s,Uint8Array:i,Uint16Array:o,Uint32Array:c,Int32Array:f,Map:a,DataView:l,Promise:u,TextEncoder:w,crypto:h,postMessage:d,TransformStream:p,ReadableStream:y,WritableStream:m,CompressionStream:b,DecompressionStream:g}=self;class k{constructor(e){return class extends p{constructor(t,n){const r=new e(n);super({transform(e,t){t.enqueue(r.append(e))},flush(e){const t=r.flush();t&&e.enqueue(t)}})}}}}const v=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;v[e]=t}class S{constructor(e){this.t=e||-1}append(e){let t=0|this.t;for(let n=0,r=0|e.length;r>n;n++)t=t>>>8^v[255&(t^e[n])];this.t=t}get(){return~this.t}}class z extends p{constructor(){let e;const t=new S;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new i(4);new l(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const C={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],r=C.i(n);return 32===r?e.concat(t):C.o(t,r,0|n,e.slice(0,e.length-1))},l(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+C.i(n)},u(e,t){if(32*e.length0&&t&&(e[n-1]=C.h(t,e[n-1]&2147483648>>t-1,1)),e},h:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,i:e=>r.round(e/1099511627776)||32,o(e,t,n,r){for(void 0===r&&(r=[]);t>=32;t-=32)r.push(n),n=0;if(0===t)return r.concat(e);for(let s=0;s>>t),n=e[s]<<32-t;const s=e.length?e[e.length-1]:0,i=C.i(s);return r.push(C.h(t+i&31,t+i>32?n:r.pop(),1)),r}},x={p:{m(e){const t=C.l(e)/8,n=new i(t);let r;for(let s=0;t>s;s++)0==(3&s)&&(r=e[s/4]),n[s]=r>>>24,r<<=8;return n},g(e){const t=[];let n,r=0;for(n=0;n9007199254740991)throw new s("Cannot hash more than 2^53 - 1 bits");const o=new c(n);let f=0;for(let e=t.blockSize+r-(t.blockSize+r&t.blockSize-1);i>=e;e+=t.blockSize)t.I(o.subarray(16*f,16*(f+1))),f+=1;return n.splice(0,16*f),t}D(){const e=this;let t=e.C;const n=e.S;t=C.concat(t,[C.h(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(r.floor(e._/4294967296)),t.push(0|e._);t.length;)e.I(t.splice(0,16));return e.reset(),n}V(e,t,n,r){return e>19?e>39?e>59?e>79?void 0:t^n^r:t&n|t&r|n&r:t^n^r:t&n|~t&r}P(e,t){return t<>>32-e}I(t){const n=this,s=n.S,i=e(80);for(let e=0;16>e;e++)i[e]=t[e];let o=s[0],c=s[1],f=s[2],a=s[3],l=s[4];for(let e=0;79>=e;e++){16>e||(i[e]=n.P(1,i[e-3]^i[e-8]^i[e-14]^i[e-16]));const t=n.P(5,o)+n.V(e,c,f,a)+l+i[e]+n.v[r.floor(e/20)]|0;l=a,a=f,f=n.P(30,c),c=o,o=t}s[0]=s[0]+o|0,s[1]=s[1]+c|0,s[2]=s[2]+f|0,s[3]=s[3]+a|0,s[4]=s[4]+l|0}},A={getRandomValues(e){const t=new c(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(r.random()>.5?1:-1))};for(let s,i=0;inew I.R(x.p.g(e)),B(e,t,n,r){if(n=n||1e4,0>r||0>n)throw new s("invalid params to pbkdf2");const i=1+(r>>5)<<2;let o,c,f,a,u;const w=new ArrayBuffer(i),h=new l(w);let d=0;const p=C;for(t=x.p.g(t),u=1;(i||1)>d;u++){for(o=c=e.encrypt(p.concat(t,[u])),f=1;n>f;f++)for(c=e.encrypt(c),a=0;ad&&fs&&(e=(new n).update(e).D());for(let t=0;s>t;t++)r[0][t]=909522486^e[t],r[1][t]=1549556828^e[t];t.K[0].update(r[0]),t.K[1].update(r[1]),t.U=new n(t.K[0])}reset(){const e=this;e.U=new e.M(e.K[0]),e.N=!1}update(e){this.N=!0,this.U.update(e)}digest(){const e=this,t=e.U.D(),n=new e.M(e.K[1]).update(t).D();return e.reset(),n}encrypt(e){if(this.N)throw new s("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},D=void 0!==h&&"function"==typeof h.getRandomValues,V="Invalid password",P="Invalid signature",R="zipjs-abort-check-password";function B(e){return D?h.getRandomValues(e):A.getRandomValues(e)}const E=16,M={name:"PBKDF2"},K=t.assign({hash:{name:"HMAC"}},M),U=t.assign({iterations:1e3,hash:{name:"SHA-1"}},M),N=["deriveBits"],O=[8,12,16],T=[16,24,32],W=10,j=[0,0,0,0],H="undefined",L="function",F=typeof h!=H,q=F&&h.subtle,G=F&&typeof q!=H,J=x.p,Q=class{constructor(e){const t=this;t.O=[[[],[],[],[],[]],[[],[],[],[],[]]],t.O[0][0][0]||t.T();const n=t.O[0][4],r=t.O[1],i=e.length;let o,c,f,a=1;if(4!==i&&6!==i&&8!==i)throw new s("invalid aes key size");for(t.v=[c=e.slice(0),f=[]],o=i;4*i+28>o;o++){let e=c[o-1];(o%i==0||8===i&&o%i==4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],o%i==0&&(e=e<<8^e>>>24^a<<24,a=a<<1^283*(a>>7))),c[o]=c[o-i]^e}for(let e=0;o;e++,o--){const t=c[3&e?o:o-4];f[e]=4>=o||4>e?t:r[0][n[t>>>24]]^r[1][n[t>>16&255]]^r[2][n[t>>8&255]]^r[3][n[255&t]]}}encrypt(e){return this.W(e,0)}decrypt(e){return this.W(e,1)}T(){const e=this.O[0],t=this.O[1],n=e[4],r=t[4],s=[],i=[];let o,c,f,a;for(let e=0;256>e;e++)i[(s[e]=e<<1^283*(e>>7))^e]=e;for(let l=o=0;!n[l];l^=c||1,o=i[o]||1){let i=o^o<<1^o<<2^o<<3^o<<4;i=i>>8^255&i^99,n[l]=i,r[i]=l,a=s[f=s[c=s[l]]];let u=16843009*a^65537*f^257*c^16843008*l,w=257*s[i]^16843008*i;for(let n=0;4>n;n++)e[n][l]=w=w<<24^w>>>8,t[n][i]=u=u<<24^u>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}W(e,t){if(4!==e.length)throw new s("invalid aes block size");const n=this.v[t],r=n.length/4-2,i=[0,0,0,0],o=this.O[t],c=o[0],f=o[1],a=o[2],l=o[3],u=o[4];let w,h,d,p=e[0]^n[0],y=e[t?3:1]^n[1],m=e[2]^n[2],b=e[t?1:3]^n[3],g=4;for(let e=0;r>e;e++)w=c[p>>>24]^f[y>>16&255]^a[m>>8&255]^l[255&b]^n[g],h=c[y>>>24]^f[m>>16&255]^a[b>>8&255]^l[255&p]^n[g+1],d=c[m>>>24]^f[b>>16&255]^a[p>>8&255]^l[255&y]^n[g+2],b=c[b>>>24]^f[p>>16&255]^a[y>>8&255]^l[255&m]^n[g+3],g+=4,p=w,y=h,m=d;for(let e=0;4>e;e++)i[t?3&-e:e]=u[p>>>24]<<24^u[y>>16&255]<<16^u[m>>8&255]<<8^u[255&b]^n[g++],w=p,p=y,y=m,m=b,b=w;return i}},X=class{constructor(e,t){this.j=e,this.H=t,this.L=t}reset(){this.L=this.H}update(e){return this.F(this.j,e,this.L)}q(e){if(255==(e>>24&255)){let t=e>>16&255,n=e>>8&255,r=255&e;255===t?(t=0,255===n?(n=0,255===r?r=0:++r):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=r}else e+=1<<24;return e}G(e){0===(e[0]=this.q(e[0]))&&(e[1]=this.q(e[1]))}F(e,t,n){let r;if(!(r=t.length))return[];const s=C.l(t);for(let s=0;r>s;s+=4){this.G(n);const r=e.encrypt(n);t[s]^=r[0],t[s+1]^=r[1],t[s+2]^=r[2],t[s+3]^=r[3]}return C.u(t,s)}},Y=I.R;let Z=F&&G&&typeof q.importKey==L,$=F&&G&&typeof q.deriveBits==L;class ee extends p{constructor({password:e,signed:n,encryptionStrength:r,checkPasswordOnly:o}){super({start(){t.assign(this,{ready:new u((e=>this.J=e)),password:e,signed:n,X:r-1,pending:new i})},async transform(e,t){const n=this,{password:r,X:c,J:f,ready:a}=n;r?(await(async(e,t,n,r)=>{const i=await re(e,t,n,ie(r,0,O[t])),o=ie(r,O[t]);if(i[0]!=o[0]||i[1]!=o[1])throw new s(V)})(n,c,r,ie(e,0,O[c]+2)),e=ie(e,O[c]+2),o?t.error(new s(R)):f()):await a;const l=new i(e.length-W-(e.length-W)%E);t.enqueue(ne(n,e,l,0,W,!0))},async flush(e){const{signed:t,Y:n,Z:r,pending:o,ready:c}=this;await c;const f=ie(o,0,o.length-W),a=ie(o,o.length-W);let l=new i;if(f.length){const e=ce(J,f);r.update(e);const t=n.update(e);l=oe(J,t)}if(t){const e=ie(oe(J,r.digest()),0,W);for(let t=0;W>t;t++)if(e[t]!=a[t])throw new s(P)}e.enqueue(l)}})}}class te extends p{constructor({password:e,encryptionStrength:n}){let r;super({start(){t.assign(this,{ready:new u((e=>this.J=e)),password:e,X:n-1,pending:new i})},async transform(e,t){const n=this,{password:r,X:s,J:o,ready:c}=n;let f=new i;r?(f=await(async(e,t,n)=>{const r=B(new i(O[t]));return se(r,await re(e,t,n,r))})(n,s,r),o()):await c;const a=new i(f.length+e.length-e.length%E);a.set(f,0),t.enqueue(ne(n,e,a,f.length,0))},async flush(e){const{Y:t,Z:n,pending:s,ready:o}=this;await o;let c=new i;if(s.length){const e=t.update(ce(J,s));n.update(e),c=oe(J,e)}r.signature=oe(J,n.digest()).slice(0,W),e.enqueue(se(c,r.signature))}}),r=this}}function ne(e,t,n,r,s,o){const{Y:c,Z:f,pending:a}=e,l=t.length-s;let u;for(a.length&&(t=se(a,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new i(t)).set(n,0)}return e})(n,l-l%E)),u=0;l-E>=u;u+=E){const e=ce(J,ie(t,u,u+E));o&&f.update(e);const s=c.update(e);o||f.update(s),n.set(oe(J,s),u+r)}return e.pending=ie(t,u),n}async function re(n,r,s,o){n.password=null;const c=(e=>{if(void 0===w){const t=new i((e=unescape(encodeURIComponent(e))).length);for(let n=0;n{if(!Z)return I.importKey(t);try{return await q.importKey("raw",t,n,!1,s)}catch(e){return Z=!1,I.importKey(t)}})(0,c,K,0,N),a=await(async(e,t,n)=>{if(!$)return I.B(t,e.salt,U.iterations,n);try{return await q.deriveBits(e,t,n)}catch(r){return $=!1,I.B(t,e.salt,U.iterations,n)}})(t.assign({salt:o},U),f,8*(2*T[r]+2)),l=new i(a),u=ce(J,ie(l,0,T[r])),h=ce(J,ie(l,T[r],2*T[r])),d=ie(l,2*T[r]);return t.assign(n,{keys:{key:u,$:h,passwordVerification:d},Y:new X(new Q(u),e.from(j)),Z:new Y(h)}),d}function se(e,t){let n=e;return e.length+t.length&&(n=new i(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ie(e,t,n){return e.subarray(t,n)}function oe(e,t){return e.m(t)}function ce(e,t){return e.g(t)}class fe extends p{constructor({password:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){t.assign(this,{password:e,passwordVerification:n}),we(this,e)},transform(e,t){const n=this;if(n.password){const t=le(n,e.subarray(0,12));if(n.password=null,t[11]!=n.passwordVerification)throw new s(V);e=e.subarray(12)}r?t.error(new s(R)):t.enqueue(le(n,e))}})}}class ae extends p{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),we(this,e)},transform(e,t){const n=this;let r,s;if(n.password){n.password=null;const t=B(new i(12));t[11]=n.passwordVerification,r=new i(e.length+t.length),r.set(ue(n,t),0),s=12}else r=new i(e.length),s=0;r.set(ue(n,e),s),t.enqueue(r)}})}}function le(e,t){const n=new i(t.length);for(let r=0;r>>24]),i=~e.te.get(),e.keys=[n,s,i]}function de(e){const t=2|e.keys[2];return pe(r.imul(t,1^t)>>>8)}function pe(e){return 255&e}function ye(e){return 4294967295&e}const me="deflate-raw";class be extends p{constructor(e,{chunkSize:t,CompressionStream:n,CompressionStreamNative:r}){super({});const{compressed:s,encrypted:i,useCompressionStream:o,zipCrypto:c,signed:f,level:a}=e,u=this;let w,h,d=ke(super.readable);i&&!c||!f||(w=new z,d=ze(d,w)),s&&(d=Se(d,o,{level:a,chunkSize:t},r,n)),i&&(c?d=ze(d,new ae(e)):(h=new te(e),d=ze(d,h))),ve(u,d,(async()=>{let e;i&&!c&&(e=h.signature),i&&!c||!f||(e=new l(w.value.buffer).getUint32(0)),u.signature=e}))}}class ge extends p{constructor(e,{chunkSize:t,DecompressionStream:n,DecompressionStreamNative:r}){super({});const{zipCrypto:i,encrypted:o,signed:c,signature:f,compressed:a,useCompressionStream:u}=e;let w,h,d=ke(super.readable);o&&(i?d=ze(d,new fe(e)):(h=new ee(e),d=ze(d,h))),a&&(d=Se(d,u,{chunkSize:t},r,n)),o&&!i||!c||(w=new z,d=ze(d,w)),ve(this,d,(async()=>{if((!o||i)&&c){const e=new l(w.value.buffer);if(f!=e.getUint32(0,!1))throw new s(P)}}))}}function ke(e){return ze(e,new p({transform(e,t){e&&e.length&&t.enqueue(e)}}))}function ve(e,n,r){n=ze(n,new p({flush:r})),t.defineProperty(e,"readable",{get:()=>n})}function Se(e,t,n,r,s){try{e=ze(e,new(t&&r?r:s)(me,n))}catch(r){if(!t)throw r;e=ze(e,new s(me,n))}return e}function ze(e,t){return e.pipeThrough(t)}const Ce="data";class xe extends p{constructor(e,n){super({});const r=this,{codecType:s}=e;let i;s.startsWith("deflate")?i=be:s.startsWith("inflate")&&(i=ge);let o=0;const c=new i(e,n),f=super.readable,a=new p({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){const{signature:e}=c;t.assign(r,{signature:e,size:o})}});t.defineProperty(r,"readable",{get:()=>f.pipeThrough(c).pipeThrough(a)})}}const _e=new a,Ae=new a;let Ie=0;async function De(e){try{const{options:t,scripts:r,config:s}=e;r&&r.length&&importScripts.apply(void 0,r),self.initCodec&&self.initCodec(),s.CompressionStreamNative=self.CompressionStream,s.DecompressionStreamNative=self.DecompressionStream,self.Deflate&&(s.CompressionStream=new k(self.Deflate)),self.Inflate&&(s.DecompressionStream=new k(self.Inflate));const i={highWaterMark:1,size:()=>s.chunkSize},o=e.readable||new y({async pull(e){const t=new u((e=>_e.set(Ie,e)));Ve({type:"pull",messageId:Ie}),Ie=(Ie+1)%n.MAX_SAFE_INTEGER;const{value:r,done:s}=await t;e.enqueue(r),s&&e.close()}},i),c=e.writable||new m({async write(e){let t;const r=new u((e=>t=e));Ae.set(Ie,t),Ve({type:Ce,value:e,messageId:Ie}),Ie=(Ie+1)%n.MAX_SAFE_INTEGER,await r}},i),f=new xe(t,s);await o.pipeThrough(f).pipeTo(c,{preventClose:!0,preventAbort:!0});try{await c.getWriter().close()}catch(e){}const{signature:a,size:l}=f;Ve({type:"close",result:{signature:a,size:l}})}catch(e){Pe(e)}}function Ve(e){let{value:t}=e;if(t)if(t.length)try{t=new i(t),e.value=t.buffer,d(e,[e.value])}catch(t){d(e)}else d(e);else d(e)}function Pe(e){const{message:t,stack:n,code:r,name:s}=e;d({error:{message:t,stack:n,code:r,name:s}})}addEventListener("message",(({data:e})=>{const{type:t,messageId:n,value:r,done:s}=e;try{if("start"==t&&De(e),t==Ce){const e=_e.get(n);_e.delete(n),e({value:new i(r),done:s})}if("ack"==t){const e=Ae.get(n);Ae.delete(n),e()}}catch(e){Pe(e)}}));const Re=-2;function Be(t){return Ee(t.map((([t,n])=>new e(t).fill(n,0,t))))}function Ee(t){return t.reduce(((t,n)=>t.concat(e.isArray(n)?Ee(n):n)),[])}const Me=[0,1,2,3].concat(...Be([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function Ke(){const e=this;function t(e,t){let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}e.ne=n=>{const s=e.re,i=e.ie.se,o=e.ie.oe;let c,f,a,l=-1;for(n.ce=0,n.fe=573,c=0;o>c;c++)0!==s[2*c]?(n.ae[++n.ce]=l=c,n.le[c]=0):s[2*c+1]=0;for(;2>n.ce;)a=n.ae[++n.ce]=2>l?++l:0,s[2*a]=1,n.le[a]=0,n.ue--,i&&(n.we-=i[2*a+1]);for(e.he=l,c=r.floor(n.ce/2);c>=1;c--)n.de(s,c);a=o;do{c=n.ae[1],n.ae[1]=n.ae[n.ce--],n.de(s,1),f=n.ae[1],n.ae[--n.fe]=c,n.ae[--n.fe]=f,s[2*a]=s[2*c]+s[2*f],n.le[a]=r.max(n.le[c],n.le[f])+1,s[2*c+1]=s[2*f+1]=a,n.ae[1]=a++,n.de(s,1)}while(n.ce>=2);n.ae[--n.fe]=n.ae[1],(t=>{const n=e.re,r=e.ie.se,s=e.ie.pe,i=e.ie.ye,o=e.ie.me;let c,f,a,l,u,w,h=0;for(l=0;15>=l;l++)t.be[l]=0;for(n[2*t.ae[t.fe]+1]=0,c=t.fe+1;573>c;c++)f=t.ae[c],l=n[2*n[2*f+1]+1]+1,l>o&&(l=o,h++),n[2*f+1]=l,f>e.he||(t.be[l]++,u=0,i>f||(u=s[f-i]),w=n[2*f],t.ue+=w*(l+u),r&&(t.we+=w*(r[2*f+1]+u)));if(0!==h){do{for(l=o-1;0===t.be[l];)l--;t.be[l]--,t.be[l+1]+=2,t.be[o]--,h-=2}while(h>0);for(l=o;0!==l;l--)for(f=t.be[l];0!==f;)a=t.ae[--c],a>e.he||(n[2*a+1]!=l&&(t.ue+=(l-n[2*a+1])*n[2*a],n[2*a+1]=l),f--)}})(n),((e,n,r)=>{const s=[];let i,o,c,f=0;for(i=1;15>=i;i++)s[i]=f=f+r[i-1]<<1;for(o=0;n>=o;o++)c=e[2*o+1],0!==c&&(e[2*o]=t(s[c]++,c))})(s,e.he,n.be)}}function Ue(e,t,n,r,s){const i=this;i.se=e,i.pe=t,i.ye=n,i.oe=r,i.me=s}Ke.ge=[0,1,2,3,4,5,6,7].concat(...Be([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),Ke.ke=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],Ke.ve=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],Ke.Se=e=>256>e?Me[e]:Me[256+(e>>>7)],Ke.ze=[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],Ke.Ce=[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],Ke.xe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Ke._e=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];const Ne=Be([[144,8],[112,9],[24,7],[8,8]]);Ue.Ae=Ee([12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,167,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227].map(((e,t)=>[e,Ne[t]])));const Oe=Be([[30,5]]);function Te(e,t,n,r,s){const i=this;i.Ie=e,i.De=t,i.Ve=n,i.Pe=r,i.Re=s}Ue.Be=Ee([0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23].map(((e,t)=>[e,Oe[t]]))),Ue.Ee=new Ue(Ue.Ae,Ke.ze,257,286,15),Ue.Me=new Ue(Ue.Be,Ke.Ce,0,30,15),Ue.Ke=new Ue(null,Ke.xe,0,19,7);const We=[new Te(0,0,0,0,0),new Te(4,4,8,4,1),new Te(4,5,16,8,1),new Te(4,6,32,32,1),new Te(4,4,16,16,2),new Te(8,16,32,32,2),new Te(8,16,128,128,2),new Te(8,32,128,256,2),new Te(32,128,258,1024,2),new Te(32,258,258,4096,2)],je=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],He=113,Le=666,Fe=262;function qe(e,t,n,r){const s=e[2*t],i=e[2*n];return i>s||s==i&&r[t]<=r[n]}function Ge(){const e=this;let t,n,s,c,f,a,l,u,w,h,d,p,y,m,b,g,k,v,S,z,C,x,_,A,I,D,V,P,R,B,E,M,K;const U=new Ke,N=new Ke,O=new Ke;let T,W,j,H,L,F;function q(){let t;for(t=0;286>t;t++)E[2*t]=0;for(t=0;30>t;t++)M[2*t]=0;for(t=0;19>t;t++)K[2*t]=0;E[512]=1,e.ue=e.we=0,W=j=0}function G(e,t){let n,r=-1,s=e[1],i=0,o=7,c=4;0===s&&(o=138,c=3),e[2*(t+1)+1]=65535;for(let f=0;t>=f;f++)n=s,s=e[2*(f+1)+1],++ii?K[2*n]+=i:0!==n?(n!=r&&K[2*n]++,K[32]++):i>10?K[36]++:K[34]++,i=0,r=n,0===s?(o=138,c=3):n==s?(o=6,c=3):(o=7,c=4))}function J(t){e.Ue[e.pending++]=t}function Q(e){J(255&e),J(e>>>8&255)}function X(e,t){let n;const r=t;F>16-r?(n=e,L|=n<>>16-F,F+=r-16):(L|=e<=n;n++)if(r=i,i=e[2*(n+1)+1],++o>=c||r!=i){if(f>o)do{Y(r,K)}while(0!=--o);else 0!==r?(r!=s&&(Y(r,K),o--),Y(16,K),X(o-3,2)):o>10?(Y(18,K),X(o-11,7)):(Y(17,K),X(o-3,3));o=0,s=r,0===i?(c=138,f=3):r==i?(c=6,f=3):(c=7,f=4)}}function $(){16==F?(Q(L),L=0,F=0):8>F||(J(255&L),L>>>=8,F-=8)}function ee(t,n){let s,i,o;if(e.Ne[W]=t,e.Oe[W]=255&n,W++,0===t?E[2*n]++:(j++,t--,E[2*(Ke.ge[n]+256+1)]++,M[2*Ke.Se(t)]++),0==(8191&W)&&V>2){for(s=8*W,i=C-k,o=0;30>o;o++)s+=M[2*o]*(5+Ke.Ce[o]);if(s>>>=3,jc);Y(256,t),H=t[513]}function ne(){F>8?Q(L):F>0&&J(255&L),L=0,F=0}function re(t,n,r){X(0+(r?1:0),3),((t,n)=>{ne(),H=8,Q(n),Q(~n),e.Ue.set(u.subarray(t,t+n),e.pending),e.pending+=n})(t,n)}function se(n){((t,n,r)=>{let s,i,o=0;V>0?(U.ne(e),N.ne(e),o=(()=>{let t;for(G(E,U.he),G(M,N.he),O.ne(e),t=18;t>=3&&0===K[2*Ke._e[t]+1];t--);return e.ue+=14+3*(t+1),t})(),s=e.ue+3+7>>>3,i=e.we+3+7>>>3,i>s||(s=i)):s=i=n+5,n+4>s||-1==t?i==s?(X(2+(r?1:0),3),te(Ue.Ae,Ue.Be)):(X(4+(r?1:0),3),((e,t,n)=>{let r;for(X(e-257,5),X(t-1,5),X(n-4,4),r=0;n>r;r++)X(K[2*Ke._e[r]+1],3);Z(E,e-1),Z(M,t-1)})(U.he+1,N.he+1,o+1),te(E,M)):re(t,n,r),q(),r&&ne()})(0>k?-1:k,C-k,n),k=C,t.Te()}function ie(){let e,n,r,s;do{if(s=w-_-C,0===s&&0===C&&0===_)s=f;else if(-1==s)s--;else if(C>=f+f-Fe){u.set(u.subarray(f,f+f),0),x-=f,C-=f,k-=f,e=y,r=e;do{n=65535&d[--r],d[r]=f>n?0:n-f}while(0!=--e);e=f,r=e;do{n=65535&h[--r],h[r]=f>n?0:n-f}while(0!=--e);s+=f}if(0===t.We)return;e=t.je(u,C+_,s),_+=e,3>_||(p=255&u[C],p=(p<_&&0!==t.We)}function oe(e){let t,n,r=I,s=C,i=A;const o=C>f-Fe?C-(f-Fe):0;let c=B;const a=l,w=C+258;let d=u[s+i-1],p=u[s+i];R>A||(r>>=2),c>_&&(c=_);do{if(t=e,u[t+i]==p&&u[t+i-1]==d&&u[t]==u[s]&&u[++t]==u[s+1]){s+=2,t++;do{}while(u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&w>s);if(n=258-(w-s),s=w-258,n>i){if(x=e,i=n,n>=c)break;d=u[s+i-1],p=u[s+i]}}}while((e=65535&h[e&a])>o&&0!=--r);return i>_?_:i}e.le=[],e.be=[],e.ae=[],E=[],M=[],K=[],e.de=(t,n)=>{const r=e.ae,s=r[n];let i=n<<1;for(;i<=e.ce&&(i(W||(W=8),j||(j=8),G||(G=0),t.Le=null,-1==S&&(S=6),1>j||j>9||8!=W||9>x||x>15||0>S||S>9||0>G||G>2?Re:(t.Fe=e,a=x,f=1<(t.qe=t.Ge=0,t.Le=null,e.pending=0,e.Je=0,n=He,c=0,U.re=E,U.ie=Ue.Ee,N.re=M,N.ie=Ue.Me,O.re=K,O.ie=Ue.Ke,L=0,F=0,H=8,q(),(()=>{w=2*f,d[y-1]=0;for(let e=0;y-1>e;e++)d[e]=0;D=We[V].De,R=We[V].Ie,B=We[V].Ve,I=We[V].Pe,C=0,k=0,_=0,v=A=2,z=0,p=0})(),0))(t))),e.Qe=()=>42!=n&&n!=He&&n!=Le?Re:(e.Oe=null,e.Ne=null,e.Ue=null,d=null,h=null,u=null,e.Fe=null,n==He?-3:0),e.Xe=(e,t,n)=>{let r=0;return-1==t&&(t=6),0>t||t>9||0>n||n>2?Re:(We[V].Re!=We[t].Re&&0!==e.qe&&(r=e.Ye(1)),V!=t&&(V=t,D=We[V].De,R=We[V].Ie,B=We[V].Ve,I=We[V].Pe),P=n,r)},e.Ze=(e,t,r)=>{let s,i=r,o=0;if(!t||42!=n)return Re;if(3>i)return 0;for(i>f-Fe&&(i=f-Fe,o=r-i),u.set(t.subarray(o,o+i),0),C=i,k=i,p=255&u[0],p=(p<=s;s++)p=(p<{let o,w,m,I,R;if(i>4||0>i)return Re;if(!r.$e||!r.et&&0!==r.We||n==Le&&4!=i)return r.Le=je[4],Re;if(0===r.tt)return r.Le=je[7],-5;var B;if(t=r,I=c,c=i,42==n&&(w=8+(a-8<<4)<<8,m=(V-1&255)>>1,m>3&&(m=3),w|=m<<6,0!==C&&(w|=32),w+=31-w%31,n=He,J((B=w)>>8&255),J(255&B)),0!==e.pending){if(t.Te(),0===t.tt)return c=-1,0}else if(0===t.We&&I>=i&&4!=i)return t.Le=je[7],-5;if(n==Le&&0!==t.We)return r.Le=je[7],-5;if(0!==t.We||0!==_||0!=i&&n!=Le){switch(R=-1,We[V].Re){case 0:R=(e=>{let n,r=65535;for(r>s-5&&(r=s-5);;){if(1>=_){if(ie(),0===_&&0==e)return 0;if(0===_)break}if(C+=_,_=0,n=k+r,(0===C||C>=n)&&(_=C-n,C=n,se(!1),0===t.tt))return 0;if(C-k>=f-Fe&&(se(!1),0===t.tt))return 0}return se(4==e),0===t.tt?4==e?2:0:4==e?3:1})(i);break;case 1:R=(e=>{let n,r=0;for(;;){if(Fe>_){if(ie(),Fe>_&&0==e)return 0;if(0===_)break}if(3>_||(p=(p<f-Fe||2!=P&&(v=oe(r)),3>v)n=ee(0,255&u[C]),_--,C++;else if(n=ee(C-x,v-3),_-=v,v>D||3>_)C+=v,v=0,p=255&u[C],p=(p<{let n,r,s=0;for(;;){if(Fe>_){if(ie(),Fe>_&&0==e)return 0;if(0===_)break}if(3>_||(p=(p<A&&f-Fe>=(C-s&65535)&&(2!=P&&(v=oe(s)),5>=v&&(1==P||3==v&&C-x>4096)&&(v=2)),3>A||v>A)if(0!==z){if(n=ee(0,255&u[C-1]),n&&se(!1),C++,_--,0===t.tt)return 0}else z=1,C++,_--;else{r=C+_-3,n=ee(C-1-S,A-3),_-=A-1,A-=2;do{++C>r||(p=(p<1+H+10-F&&(X(2,3),Y(256,Ue.Ae),$()),H=7;else if(re(0,0,!1),3==i)for(o=0;y>o;o++)d[o]=0;if(t.Te(),0===t.tt)return c=-1,0}}return 4!=i?0:1}}function Je(){const e=this;e.nt=0,e.rt=0,e.We=0,e.qe=0,e.tt=0,e.Ge=0}function Qe(e){const t=new Je,n=(o=e&&e.chunkSize?e.chunkSize:65536)+5*(r.floor(o/16383)+1);var o;const c=new i(n);let f=e?e.level:-1;void 0===f&&(f=-1),t.He(f),t.$e=c,this.append=(e,r)=>{let o,f,a=0,l=0,u=0;const w=[];if(e.length){t.nt=0,t.et=e,t.We=e.length;do{if(t.rt=0,t.tt=n,o=t.Ye(0),0!=o)throw new s("deflating: "+t.Le);t.rt&&(t.rt==n?w.push(new i(c)):w.push(c.subarray(0,t.rt))),u+=t.rt,r&&t.nt>0&&t.nt!=a&&(r(t.nt),a=t.nt)}while(t.We>0||0===t.tt);return w.length>1?(f=new i(u),w.forEach((e=>{f.set(e,l),l+=e.length}))):f=w[0]?new i(w[0]):new i,f}},this.flush=()=>{let e,r,o=0,f=0;const a=[];do{if(t.rt=0,t.tt=n,e=t.Ye(4),1!=e&&0!=e)throw new s("deflating: "+t.Le);n-t.tt>0&&a.push(c.slice(0,t.rt)),f+=t.rt}while(t.We>0||0===t.tt);return t.Qe(),r=new i(f),a.forEach((e=>{r.set(e,o),o+=e.length})),r}}Je.prototype={He(e,t){const n=this;return n.Fe=new Ge,t||(t=15),n.Fe.He(n,e,t)},Ye(e){const t=this;return t.Fe?t.Fe.Ye(t,e):Re},Qe(){const e=this;if(!e.Fe)return Re;const t=e.Fe.Qe();return e.Fe=null,t},Xe(e,t){const n=this;return n.Fe?n.Fe.Xe(n,e,t):Re},Ze(e,t){const n=this;return n.Fe?n.Fe.Ze(n,e,t):Re},je(e,t,n){const r=this;let s=r.We;return s>n&&(s=n),0===s?0:(r.We-=s,e.set(r.et.subarray(r.nt,r.nt+s),t),r.nt+=s,r.qe+=s,s)},Te(){const e=this;let t=e.Fe.pending;t>e.tt&&(t=e.tt),0!==t&&(e.$e.set(e.Fe.Ue.subarray(e.Fe.Je,e.Fe.Je+t),e.rt),e.rt+=t,e.Fe.Je+=t,e.Ge+=t,e.tt-=t,e.Fe.pending-=t,0===e.Fe.pending&&(e.Fe.Je=0))}};const Xe=-2,Ye=-3,Ze=-5,$e=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],et=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],tt=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],nt=[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],rt=[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,112,112],st=[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],it=[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];function ot(){let e,t,n,r,s,i;function o(e,t,o,c,f,a,l,u,w,h,d){let p,y,m,b,g,k,v,S,z,C,x,_,A,I,D;C=0,g=o;do{n[e[t+C]]++,C++,g--}while(0!==g);if(n[0]==o)return l[0]=-1,u[0]=0,0;for(S=u[0],k=1;15>=k&&0===n[k];k++);for(v=k,k>S&&(S=k),g=15;0!==g&&0===n[g];g--);for(m=g,S>g&&(S=g),u[0]=S,I=1<k;k++,I<<=1)if(0>(I-=n[k]))return Ye;if(0>(I-=n[g]))return Ye;for(n[g]+=I,i[1]=k=0,C=1,A=2;0!=--g;)i[A]=k+=n[C],A++,C++;g=0,C=0;do{0!==(k=e[t+C])&&(d[i[k]++]=g),C++}while(++g=v;v++)for(p=n[v];0!=p--;){for(;v>_+S;){if(b++,_+=S,D=m-_,D=D>S?S:D,(y=1<<(k=v-_))>p+1&&(y-=p+1,A=v,D>k))for(;++kn[++A];)y-=n[A];if(D=1<1440)return Ye;s[b]=x=h[0],h[0]+=D,0!==b?(i[b]=g,r[0]=k,r[1]=S,k=g>>>_-S,r[2]=x-s[b-1]-k,w.set(r,3*(s[b-1]+k))):l[0]=x}for(r[1]=v-_,o>C?d[C]d[C]?0:96,r[2]=d[C++]):(r[0]=a[d[C]-c]+16+64,r[2]=f[d[C++]-c]):r[0]=192,y=1<>>_;D>k;k+=y)w.set(r,3*(x+k));for(k=1<>>=1)g^=k;for(g^=k,z=(1<<_)-1;(g&z)!=i[b];)b--,_-=S,z=(1<<_)-1}return 0!==I&&1!=m?Ze:0}function c(o){let c;for(e||(e=[],t=[],n=new f(16),r=[],s=new f(15),i=new f(16)),t.lengthc;c++)t[c]=0;for(c=0;16>c;c++)n[c]=0;for(c=0;3>c;c++)r[c]=0;s.set(n.subarray(0,15),0),i.set(n.subarray(0,16),0)}this.st=(n,r,s,i,f)=>{let a;return c(19),e[0]=0,a=o(n,0,19,19,null,null,s,r,i,e,t),a==Ye?f.Le="oversubscribed dynamic bit lengths tree":a!=Ze&&0!==r[0]||(f.Le="incomplete dynamic bit lengths tree",a=Ye),a},this.it=(n,r,s,i,f,a,l,u,w)=>{let h;return c(288),e[0]=0,h=o(s,0,n,257,nt,rt,a,i,u,e,t),0!=h||0===i[0]?(h==Ye?w.Le="oversubscribed literal/length tree":-4!=h&&(w.Le="incomplete literal/length tree",h=Ye),h):(c(288),h=o(s,n,r,0,st,it,l,f,u,e,t),0!=h||0===f[0]&&n>257?(h==Ye?w.Le="oversubscribed distance tree":h==Ze?(w.Le="incomplete distance tree",h=Ye):-4!=h&&(w.Le="empty distance tree with lengths",h=Ye),h):0)}}function ct(){const e=this;let t,n,r,s,i=0,o=0,c=0,f=0,a=0,l=0,u=0,w=0,h=0,d=0;function p(e,t,n,r,s,i,o,c){let f,a,l,u,w,h,d,p,y,m,b,g,k,v,S,z;d=c.nt,p=c.We,w=o.ot,h=o.ct,y=o.write,m=yh;)p--,w|=(255&c.ft(d++))<>=a[z+1],h-=a[z+1],0!=(16&u)){for(u&=15,k=a[z+2]+(w&$e[u]),w>>=u,h-=u;15>h;)p--,w|=(255&c.ft(d++))<>=a[z+1],h-=a[z+1],0!=(16&u)){for(u&=15;u>h;)p--,w|=(255&c.ft(d++))<>=u,h-=u,m-=k,v>y){S=y-v;do{S+=o.end}while(0>S);if(u=o.end-S,k>u){if(k-=u,y-S>0&&u>y-S)do{o.lt[y++]=o.lt[S++]}while(0!=--u);else o.lt.set(o.lt.subarray(S,S+u),y),y+=u,S+=u,u=0;S=0}}else S=y-v,y-S>0&&2>y-S?(o.lt[y++]=o.lt[S++],o.lt[y++]=o.lt[S++],k-=2):(o.lt.set(o.lt.subarray(S,S+2),y),y+=2,S+=2,k-=2);if(y-S>0&&k>y-S)do{o.lt[y++]=o.lt[S++]}while(0!=--k);else o.lt.set(o.lt.subarray(S,S+k),y),y+=k,S+=k,k=0;break}if(0!=(64&u))return c.Le="invalid distance code",k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,Ye;f+=a[z+2],f+=w&$e[u],z=3*(l+f),u=a[z]}break}if(0!=(64&u))return 0!=(32&u)?(k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,1):(c.Le="invalid literal/length code",k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,Ye);if(f+=a[z+2],f+=w&$e[u],z=3*(l+f),0===(u=a[z])){w>>=a[z+1],h-=a[z+1],o.lt[y++]=a[z+2],m--;break}}else w>>=a[z+1],h-=a[z+1],o.lt[y++]=a[z+2],m--}while(m>=258&&p>=10);return k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,0}e.init=(e,i,o,c,f,a)=>{t=0,u=e,w=i,r=o,h=c,s=f,d=a,n=null},e.ut=(e,y,m)=>{let b,g,k,v,S,z,C,x=0,_=0,A=0;for(A=y.nt,v=y.We,x=e.ot,_=e.ct,S=e.write,z=S=258&&v>=10&&(e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,m=p(u,w,r,h,s,d,e,y),A=y.nt,v=y.We,x=e.ot,_=e.ct,S=e.write,z=S_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}if(g=3*(o+(x&$e[b])),x>>>=n[g+1],_-=n[g+1],k=n[g],0===k){f=n[g+2],t=6;break}if(0!=(16&k)){a=15&k,i=n[g+2],t=2;break}if(0==(64&k)){c=k,o=g/3+n[g+2];break}if(0!=(32&k)){t=7;break}return t=9,y.Le="invalid literal/length code",m=Ye,e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);case 2:for(b=a;b>_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}i+=x&$e[b],x>>=b,_-=b,c=w,n=s,o=d,t=3;case 3:for(b=c;b>_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}if(g=3*(o+(x&$e[b])),x>>=n[g+1],_-=n[g+1],k=n[g],0!=(16&k)){a=15&k,l=n[g+2],t=4;break}if(0==(64&k)){c=k,o=g/3+n[g+2];break}return t=9,y.Le="invalid distance code",m=Ye,e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);case 4:for(b=a;b>_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}l+=x&$e[b],x>>=b,_-=b,t=5;case 5:for(C=S-l;0>C;)C+=e.end;for(;0!==i;){if(0===z&&(S==e.end&&0!==e.read&&(S=0,z=S7&&(_-=8,v++,A--),e.write=S,m=e.wt(y,m),S=e.write,z=S{}}ot.dt=(e,t,n,r)=>(e[0]=9,t[0]=5,n[0]=et,r[0]=tt,0);const ft=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function at(e,t){const n=this;let r,s=0,o=0,c=0,a=0;const l=[0],u=[0],w=new ct;let h=0,d=new f(4320);const p=new ot;n.ct=0,n.ot=0,n.lt=new i(t),n.end=t,n.read=0,n.write=0,n.reset=(e,t)=>{t&&(t[0]=0),6==s&&w.ht(e),s=0,n.ct=0,n.ot=0,n.read=n.write=0},n.reset(e,null),n.wt=(e,t)=>{let r,s,i;return s=e.rt,i=n.read,r=(i>n.write?n.end:n.write)-i,r>e.tt&&(r=e.tt),0!==r&&t==Ze&&(t=0),e.tt-=r,e.Ge+=r,e.$e.set(n.lt.subarray(i,i+r),s),s+=r,i+=r,i==n.end&&(i=0,n.write==n.end&&(n.write=0),r=n.write-i,r>e.tt&&(r=e.tt),0!==r&&t==Ze&&(t=0),e.tt-=r,e.Ge+=r,e.$e.set(n.lt.subarray(i,i+r),s),s+=r,i+=r),e.rt=s,n.read=i,t},n.ut=(e,t)=>{let i,f,y,m,b,g,k,v;for(m=e.nt,b=e.We,f=n.ot,y=n.ct,g=n.write,k=gy;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>1){case 0:f>>>=3,y-=3,i=7&y,f>>>=i,y-=i,s=1;break;case 1:S=[],z=[],C=[[]],x=[[]],ot.dt(S,z,C,x),w.init(S[0],z[0],C[0],0,x[0],0),f>>>=3,y-=3,s=6;break;case 2:f>>>=3,y-=3,s=3;break;case 3:return f>>>=3,y-=3,s=9,e.Le="invalid block type",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t)}break;case 1:for(;32>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>16&65535)!=(65535&f))return s=9,e.Le="invalid stored block lengths",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);o=65535&f,f=y=0,s=0!==o?2:0!==h?7:0;break;case 2:if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);if(0===k&&(g==n.end&&0!==n.read&&(g=0,k=gb&&(i=b),i>k&&(i=k),n.lt.set(e.je(m,i),g),m+=i,b-=i,g+=i,k-=i,0!=(o-=i))break;s=0!==h?7:0;break;case 3:for(;14>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<29||(i>>5&31)>29)return s=9,e.Le="too many length or distance symbols",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);if(i=258+(31&i)+(i>>5&31),!r||r.lengthv;v++)r[v]=0;f>>>=14,y-=14,a=0,s=4;case 4:for(;4+(c>>>10)>a;){for(;3>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>=3,y-=3}for(;19>a;)r[ft[a++]]=0;if(l[0]=7,i=p.st(r,l,u,d,e),0!=i)return(t=i)==Ye&&(r=null,s=9),n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);a=0,s=5;case 5:for(;i=c,258+(31&i)+(i>>5&31)>a;){let o,w;for(i=l[0];i>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<w)f>>>=i,y-=i,r[a++]=w;else{for(v=18==w?7:w-14,o=18==w?11:3;i+v>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>=i,y-=i,o+=f&$e[v],f>>>=v,y-=v,v=a,i=c,v+o>258+(31&i)+(i>>5&31)||16==w&&1>v)return r=null,s=9,e.Le="invalid bit length repeat",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);w=16==w?r[v-1]:0;do{r[v++]=w}while(0!=--o);a=v}}if(u[0]=-1,_=[],A=[],I=[],D=[],_[0]=9,A[0]=6,i=c,i=p.it(257+(31&i),1+(i>>5&31),r,_,A,I,D,d,e),0!=i)return i==Ye&&(r=null,s=9),t=i,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);w.init(_[0],A[0],d,I[0],d,D[0]),s=6;case 6:if(n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,1!=(t=w.ut(n,e,t)))return n.wt(e,t);if(t=0,w.ht(e),m=e.nt,b=e.We,f=n.ot,y=n.ct,g=n.write,k=g{n.reset(e,null),n.lt=null,d=null},n.yt=(e,t,r)=>{n.lt.set(e.subarray(t,t+r),0),n.read=n.write=r},n.bt=()=>1==s?1:0}const lt=13,ut=[0,0,255,255];function wt(){const e=this;function t(e){return e&&e.gt?(e.qe=e.Ge=0,e.Le=null,e.gt.mode=7,e.gt.kt.reset(e,null),0):Xe}e.mode=0,e.method=0,e.vt=[0],e.St=0,e.marker=0,e.zt=0,e.Ct=t=>(e.kt&&e.kt.ht(t),e.kt=null,0),e.xt=(n,r)=>(n.Le=null,e.kt=null,8>r||r>15?(e.Ct(n),Xe):(e.zt=r,n.gt.kt=new at(n,1<{let n,r;if(!e||!e.gt||!e.et)return Xe;const s=e.gt;for(t=4==t?Ze:0,n=Ze;;)switch(s.mode){case 0:if(0===e.We)return n;if(n=t,e.We--,e.qe++,8!=(15&(s.method=e.ft(e.nt++)))){s.mode=lt,e.Le="unknown compression method",s.marker=5;break}if(8+(s.method>>4)>s.zt){s.mode=lt,e.Le="invalid win size",s.marker=5;break}s.mode=1;case 1:if(0===e.We)return n;if(n=t,e.We--,e.qe++,r=255&e.ft(e.nt++),((s.method<<8)+r)%31!=0){s.mode=lt,e.Le="incorrect header check",s.marker=5;break}if(0==(32&r)){s.mode=7;break}s.mode=2;case 2:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St=(255&e.ft(e.nt++))<<24&4278190080,s.mode=3;case 3:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St+=(255&e.ft(e.nt++))<<16&16711680,s.mode=4;case 4:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St+=(255&e.ft(e.nt++))<<8&65280,s.mode=5;case 5:return 0===e.We?n:(n=t,e.We--,e.qe++,s.St+=255&e.ft(e.nt++),s.mode=6,2);case 6:return s.mode=lt,e.Le="need dictionary",s.marker=0,Xe;case 7:if(n=s.kt.ut(e,n),n==Ye){s.mode=lt,s.marker=0;break}if(0==n&&(n=t),1!=n)return n;n=t,s.kt.reset(e,s.vt),s.mode=12;case 12:return e.We=0,1;case lt:return Ye;default:return Xe}},e.At=(e,t,n)=>{let r=0,s=n;if(!e||!e.gt||6!=e.gt.mode)return Xe;const i=e.gt;return s<1<{let n,r,s,i,o;if(!e||!e.gt)return Xe;const c=e.gt;if(c.mode!=lt&&(c.mode=lt,c.marker=0),0===(n=e.We))return Ze;for(r=e.nt,s=c.marker;0!==n&&4>s;)e.ft(r)==ut[s]?s++:s=0!==e.ft(r)?0:4-s,r++,n--;return e.qe+=r-e.nt,e.nt=r,e.We=n,c.marker=s,4!=s?Ye:(i=e.qe,o=e.Ge,t(e),e.qe=i,e.Ge=o,c.mode=7,0)},e.Dt=e=>e&&e.gt&&e.gt.kt?e.gt.kt.bt():Xe}function ht(){}function dt(e){const t=new ht,n=e&&e.chunkSize?r.floor(2*e.chunkSize):131072,o=new i(n);let c=!1;t.xt(),t.$e=o,this.append=(e,r)=>{const f=[];let a,l,u=0,w=0,h=0;if(0!==e.length){t.nt=0,t.et=e,t.We=e.length;do{if(t.rt=0,t.tt=n,0!==t.We||c||(t.nt=0,c=!0),a=t._t(0),c&&a===Ze){if(0!==t.We)throw new s("inflating: bad input")}else if(0!==a&&1!==a)throw new s("inflating: "+t.Le);if((c||1===a)&&t.We===e.length)throw new s("inflating: bad input");t.rt&&(t.rt===n?f.push(new i(o)):f.push(o.subarray(0,t.rt))),h+=t.rt,r&&t.nt>0&&t.nt!=u&&(r(t.nt),u=t.nt)}while(t.We>0||0===t.tt);return f.length>1?(l=new i(h),f.forEach((e=>{l.set(e,w),w+=e.length}))):l=f[0]?new i(f[0]):new i,l}},this.flush=()=>{t.Ct()}}ht.prototype={xt(e){const t=this;return t.gt=new wt,e||(e=15),t.gt.xt(t,e)},_t(e){const t=this;return t.gt?t.gt._t(t,e):Xe},Ct(){const e=this;if(!e.gt)return Xe;const t=e.gt.Ct(e);return e.gt=null,t},It(){const e=this;return e.gt?e.gt.It(e):Xe},At(e,t){const n=this;return n.gt?n.gt.At(n,e,t):Xe},ft(e){return this.et[e]},je(e,t){return this.et.subarray(e,e+t)}},self.initCodec=()=>{self.Deflate=Qe,self.Inflate=dt}; -`],{type:"text/javascript"}));n({workerScripts:{inflate:[t],deflate:[t]}})}Dl(Ni);var K=Kt.Platform.isDesktopApp?window.require("node:original-fs"):null,Pe=Kt.Platform.isDesktopApp?K.promises:null,Xt=Kt.Platform.isDesktopApp?window.require("node:os"):null,q=Kt.Platform.isDesktopApp?window.require("node:path"):null,Xn=Kt.Platform.isDesktopApp?window.require("node:url"):null,Cl=Kt.Platform.isDesktopApp?window.require("node:zlib"):null;function Zi(n,t=0,e=n.byteLength){return n.buffer.slice(n.byteOffset+t,n.byteOffset+t+e)}var Me=class{constructor(t){this.type="file";this.filepath=t;let e=this.name=q.basename(t);this.fullpath=e;let i=q.extname(e);this.extension=i.substring(1).toLowerCase(),this.basename=q.basename(e,i)}async readText(){return Pe.readFile(this.filepath,"utf8")}async read(){let t=await Pe.readFile(this.filepath);return Zi(t)}async readZip(t){let e=null;try{e=await Pe.open(this.filepath,"r");let i=await e.stat();return await t(new Vt(new No(e,i.size)))}finally{await(e==null?void 0:e.close())}}createReadStream(){return K.createReadStream(this.filepath)}toString(){return this.filepath}},ut=class{constructor(t){this.type="folder";this.filepath=t,this.name=q.basename(t)}async list(){let{filepath:t}=this,e=await Pe.readdir(t,{withFileTypes:!0}),i=[];for(let r of e)r.isFile()?i.push(new Me(q.join(t,r.name))):r.isDirectory()&&i.push(new ut(q.join(t,r.name)));return i}toString(){return this.filepath}},Wi=class{constructor(t){this.type="file";this.file=t;let e=this.name=t.name;this.fullpath=e;let{basename:i,extension:r}=oe(e);this.basename=i,this.extension=r}readText(){let{file:t}=this;return t.text?t.text():new Promise((e,i)=>{let r=new FileReader;r.addEventListener("load",()=>e(r.result)),r.addEventListener("error",i),r.readAsText(this.file)})}async read(){let{file:t}=this;return t.arrayBuffer?t.arrayBuffer():new Promise((e,i)=>{let r=new FileReader;r.addEventListener("load",()=>e(r.result)),r.addEventListener("error",i),r.readAsArrayBuffer(this.file)})}async readZip(t){return t(new Vt(new St(this.file)))}toString(){return this.file.toString()}};async function So(n,t){let e=[];for(let i of n)try{i.type==="folder"?e.push(...await So(await i.list(),t)):i.type==="file"&&(!t||t(i))&&e.push(i)}catch(r){console.log("Skipping path: ",i.name,r)}return e}function oe(n){let t=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\")),e=n,i="";t>=0&&(e=n.substring(t+1),i=n.substring(0,t));let[r,o]=Ro(e);return{parent:i,name:e,basename:r,extension:o}}function Ro(n){let t=n.lastIndexOf("."),e=n,i="";return t>0&&(e=n.substring(0,t),i=n.substring(t+1).toLowerCase()),[e,i]}var No=class extends yn{constructor(e,i){super(e);this.fd=e,this.size=i}async readUint8Array(e,i){let r=Buffer.alloc(i),o=await this.fd.read(r,0,i,e);return new Uint8Array(Zi(r,0,o.bytesRead))}};var Il=require("obsidian"),Vm=/[\/\?<>\\:\*\|"]/g,Km=/[\x00-\x1f\x80-\x9f]/g,Xm=/^\.+$/,Jm=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Qm=/[\. ]+$/,eh=/^\./,th=/[\[\]#|^]/g;function Ze(n){return n.replace(Vm,"").replace(Km,"").replace(Xm,"").replace(Jm,"").replace(Qm,"").replace(eh,"").replace(th,"")}function xn(n){let t=[];for(let e=0;eb&&(S=b),f[0]=S,ee=1<Z+S;){if(k++,Z+=S,z=T-Z,z=z>S?S:z,(D=1<<(C=O-Z))>A+1&&(D-=A+1,F=O,Cks)return-3;o[k]=j=w[0],w[0]+=z,k!==0?(a[k]=b,r[0]=C,r[1]=S,C=b>>>Z-S,r[2]=j-o[k-1]-C,g.set(r,(o[k-1]+C)*3)):d[0]=j}for(r[1]=O-Z,L>=m?r[0]=128+64:_[L]>>Z;C>>=1)b^=C;for(b^=C,M=(1<257?(w==-3?g.msg="oversubscribed distance tree":w==-5?(g.msg="incomplete distance tree",w=-3):w!=-4&&(g.msg="empty distance tree with lengths",w=-3),w):0)}}Xr.inflate_trees_fixed=function(n,t,e,i){return n[0]=Ed,t[0]=_d,e[0]=Td,i[0]=Ad,0};var Ei=0,ss=1,ls=2,cs=3,ps=4,us=5,fs=6,Gr=7,ds=8,_i=9;function Od(){let n=this,t,e=0,i,r=0,o=0,a=0,s=0,l=0,c=0,p=0,m,y=0,E,v=0;function d(f,g,w,_,A,D,T,k){let b,C,O,S,M,L,j,Z,F,ee,z,We,U,Ne,G,Q;j=k.next_in_index,Z=k.avail_in,M=T.bitb,L=T.bitk,F=T.write,ee=F>=C[Q+1],L-=C[Q+1],T.win[F++]=C[Q+2],ee--;continue}do{if(M>>=C[Q+1],L-=C[Q+1],S&16){for(S&=15,U=C[Q+2]+(M&De[S]),M>>=S,L-=S;L<15;)Z--,M|=(k.read_byte(j++)&255)<>=C[Q+1],L-=C[Q+1],S&16){for(S&=15;L>=S,L-=S,ee-=U,F>=Ne)G=F-Ne,F-G>0&&2>F-G?(T.win[F++]=T.win[G++],T.win[F++]=T.win[G++],U-=2):(T.win.set(T.win.subarray(G,G+2),F),F+=2,G+=2,U-=2);else{G=F-Ne;do G+=T.end;while(G<0);if(S=T.end-G,U>S){if(U-=S,F-G>0&&S>F-G)do T.win[F++]=T.win[G++];while(--S!==0);else T.win.set(T.win.subarray(G,G+S),F),F+=S,G+=S,S=0;G=0}}if(F-G>0&&U>F-G)do T.win[F++]=T.win[G++];while(--U!==0);else T.win.set(T.win.subarray(G,G+U),F),F+=U,G+=U,U=0;break}else if(!(S&64))b+=C[Q+2],b+=M&De[S],Q=(O+b)*3,S=C[Q];else return k.msg="invalid distance code",U=k.avail_in-Z,U=L>>3>3:U,Z+=U,j-=U,L-=U<<3,T.bitb=M,T.bitk=L,k.avail_in=Z,k.total_in+=j-k.next_in_index,k.next_in_index=j,T.write=F,-3;while(!0);break}if(S&64)return S&32?(U=k.avail_in-Z,U=L>>3>3:U,Z+=U,j-=U,L-=U<<3,T.bitb=M,T.bitk=L,k.avail_in=Z,k.total_in+=j-k.next_in_index,k.next_in_index=j,T.write=F,1):(k.msg="invalid literal/length code",U=k.avail_in-Z,U=L>>3>3:U,Z+=U,j-=U,L-=U<<3,T.bitb=M,T.bitk=L,k.avail_in=Z,k.total_in+=j-k.next_in_index,k.next_in_index=j,T.write=F,-3);if(b+=C[Q+2],b+=M&De[S],Q=(O+b)*3,(S=C[Q])===0){M>>=C[Q+1],L-=C[Q+1],T.win[F++]=C[Q+2],ee--;break}}while(!0)}while(ee>=258&&Z>=10);return U=k.avail_in-Z,U=L>>3>3:U,Z+=U,j-=U,L-=U<<3,T.bitb=M,T.bitk=L,k.avail_in=Z,k.total_in+=j-k.next_in_index,k.next_in_index=j,T.write=F,0}n.init=function(f,g,w,_,A,D){t=Ei,c=f,p=g,m=w,y=_,E=A,v=D,i=null},n.proc=function(f,g,w){let _,A,D,T=0,k=0,b=0,C,O,S,M;for(b=g.next_in_index,C=g.avail_in,T=f.bitb,k=f.bitk,O=f.write,S=O=258&&C>=10&&(f.bitb=T,f.bitk=k,g.avail_in=C,g.total_in+=b-g.next_in_index,g.next_in_index=b,f.write=O,w=d(c,p,m,y,E,v,f,g),b=g.next_in_index,C=g.avail_in,T=f.bitb,k=f.bitk,O=f.write,S=O>>=i[A+1],k-=i[A+1],D=i[A],D===0){a=i[A+2],t=fs;break}if(D&16){s=D&15,e=i[A+2],t=ls;break}if(!(D&64)){o=D,r=A/3+i[A+2];break}if(D&32){t=Gr;break}return t=_i,g.msg="invalid literal/length code",w=-3,f.bitb=T,f.bitk=k,g.avail_in=C,g.total_in+=b-g.next_in_index,g.next_in_index=b,f.write=O,f.inflate_flush(g,w);case ls:for(_=s;k<_;){if(C!==0)w=0;else return f.bitb=T,f.bitk=k,g.avail_in=C,g.total_in+=b-g.next_in_index,g.next_in_index=b,f.write=O,f.inflate_flush(g,w);C--,T|=(g.read_byte(b++)&255)<>=_,k-=_,o=p,i=E,r=v,t=cs;case cs:for(_=o;k<_;){if(C!==0)w=0;else return f.bitb=T,f.bitk=k,g.avail_in=C,g.total_in+=b-g.next_in_index,g.next_in_index=b,f.write=O,f.inflate_flush(g,w);C--,T|=(g.read_byte(b++)&255)<>=i[A+1],k-=i[A+1],D=i[A],D&16){s=D&15,l=i[A+2],t=ps;break}if(!(D&64)){o=D,r=A/3+i[A+2];break}return t=_i,g.msg="invalid distance code",w=-3,f.bitb=T,f.bitk=k,g.avail_in=C,g.total_in+=b-g.next_in_index,g.next_in_index=b,f.write=O,f.inflate_flush(g,w);case ps:for(_=s;k<_;){if(C!==0)w=0;else return f.bitb=T,f.bitk=k,g.avail_in=C,g.total_in+=b-g.next_in_index,g.next_in_index=b,f.write=O,f.inflate_flush(g,w);C--,T|=(g.read_byte(b++)&255)<>=_,k-=_,t=us;case us:for(M=O-l;M<0;)M+=f.end;for(;e!==0;){if(S===0&&(O==f.end&&f.read!==0&&(O=0,S=O7&&(k-=8,C++,b--),f.write=O,w=f.inflate_flush(g,w),O=f.write,S=Od.avail_out&&(g=d.avail_out),g!==0&&f==-5&&(f=0),d.avail_out-=g,d.total_out+=g,d.next_out.set(e.win.subarray(_,_+g),w),w+=g,_+=g,_==e.end&&(_=0,e.write==e.end&&(e.write=0),g=e.write-_,g>d.avail_out&&(g=d.avail_out),g!==0&&f==-5&&(f=0),d.avail_out-=g,d.total_out+=g,d.next_out.set(e.win.subarray(_,_+g),w),w+=g,_+=g),d.next_out_index=w,e.read=_,f},e.proc=function(d,f){let g,w,_,A,D,T,k,b;for(A=d.next_in_index,D=d.avail_in,w=e.bitb,_=e.bitk,T=e.write,k=T>>1){case 0:w>>>=3,_-=3,g=_&7,w>>>=g,_-=g,i=Vr;break;case 1:C=[],O=[],S=[[]],M=[[]],Xr.inflate_trees_fixed(C,O,S,M),p.init(C[0],O[0],S[0],0,M[0],0),w>>>=3,_-=3,i=Ti;break;case 2:w>>>=3,_-=3,i=gs;break;case 3:return w>>>=3,_-=3,i=Zt,d.msg="invalid block type",f=-3,e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f)}break;case Vr:for(;_<32;){if(D!==0)f=0;else return e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);D--,w|=(d.read_byte(A++)&255)<<_,_+=8}if((~w>>>16&65535)!=(w&65535))return i=Zt,d.msg="invalid stored block lengths",f=-3,e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);r=w&65535,w=_=0,i=r!==0?hs:m!==0?Ai:fn;break;case hs:if(D===0||k===0&&(T==e.end&&e.read!==0&&(T=0,k=TD&&(g=D),g>k&&(g=k),e.win.set(d.read_buf(A,g),T),A+=g,D-=g,T+=g,k-=g,(r-=g)!==0)break;i=m!==0?Ai:fn;break;case gs:for(;_<14;){if(D!==0)f=0;else return e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);D--,w|=(d.read_byte(A++)&255)<<_,_+=8}if(o=g=w&16383,(g&31)>29||(g>>5&31)>29)return i=Zt,d.msg="too many length or distance symbols",f=-3,e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);if(g=258+(g&31)+(g>>5&31),!s||s.length>>=14,_-=14,a=0,i=ys;case ys:for(;a<4+(o>>>10);){for(;_<3;){if(D!==0)f=0;else return e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);D--,w|=(d.read_byte(A++)&255)<<_,_+=8}s[ms[a++]]=w&7,w>>>=3,_-=3}for(;a<19;)s[ms[a++]]=0;if(l[0]=7,g=v.inflate_trees_bits(s,l,c,y,d),g!=0)return f=g,f==-3&&(s=null,i=Zt),e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);a=0,i=bs;case bs:for(;g=o,!(a>=258+(g&31)+(g>>5&31));){let ee,z;for(g=l[0];_>>=g,_-=g,s[a++]=z;else{for(b=z==18?7:z-14,ee=z==18?11:3;_>>=g,_-=g,ee+=w&De[b],w>>>=b,_-=b,b=a,g=o,b+ee>258+(g&31)+(g>>5&31)||z==16&&b<1)return s=null,i=Zt,d.msg="invalid bit length repeat",f=-3,e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);z=z==16?s[b-1]:0;do s[b++]=z;while(--ee!==0);a=b}}if(c[0]=-1,L=[],j=[],Z=[],F=[],L[0]=9,j[0]=6,g=o,g=v.inflate_trees_dynamic(257+(g&31),1+(g>>5&31),s,L,j,Z,F,y,d),g!=0)return g==-3&&(s=null,i=Zt),f=g,e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,e.inflate_flush(d,f);p.init(L[0],j[0],y,Z[0],y,F[0]),i=Ti;case Ti:if(e.bitb=w,e.bitk=_,d.avail_in=D,d.total_in+=A-d.next_in_index,d.next_in_index=A,e.write=T,(f=p.proc(e,d,f))!=1)return e.inflate_flush(d,f);if(f=0,p.free(d),A=d.next_in_index,D=d.avail_in,w=e.bitb,_=e.bitk,T=e.write,k=T15?(n.inflateEnd(e),-2):(n.wbits=i,e.istate.blocks=new Dd(e,1<>4)+8>a.wbits){a.mode=Et,e.msg="invalid win size",a.marker=5;break}a.mode=ws;case ws:if(e.avail_in===0)return r;if(r=i,e.avail_in--,e.total_in++,o=e.read_byte(e.next_in_index++)&255,((a.method<<8)+o)%31!==0){a.mode=Et,e.msg="incorrect header check",a.marker=5;break}if(!(o&Cd)){a.mode=Bn;break}a.mode=vs;case vs:if(e.avail_in===0)return r;r=i,e.avail_in--,e.total_in++,a.need=(e.read_byte(e.next_in_index++)&255)<<24&4278190080,a.mode=Es;case Es:if(e.avail_in===0)return r;r=i,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<16&16711680,a.mode=_s;case _s:if(e.avail_in===0)return r;r=i,e.avail_in--,e.total_in++,a.need+=(e.read_byte(e.next_in_index++)&255)<<8&65280,a.mode=Ts;case Ts:return e.avail_in===0?r:(r=i,e.avail_in--,e.total_in++,a.need+=e.read_byte(e.next_in_index++)&255,a.mode=Kr,2);case Kr:return a.mode=Et,e.msg="need dictionary",a.marker=0,-2;case Bn:if(r=a.blocks.proc(e,r),r==-3){a.mode=Et,a.marker=0;break}if(r==0&&(r=i),r!=1)return r;r=i,a.blocks.reset(e,a.was),a.mode=As;case As:return e.avail_in=0,1;case Et:return-3;default:return-2}},n.inflateSetDictionary=function(e,i,r){let o=0,a=r;if(!e||!e.istate||e.istate.mode!=Kr)return-2;let s=e.istate;return a>=1<0&&e.next_in_index!=y&&(l(e.next_in_index),y=e.next_in_index)}while(e.avail_in>0||e.avail_out===0);return c.length>1?(m=new Uint8Array(v),c.forEach(function(d){m.set(d,E),E+=d.length})):m=c[0]?new Uint8Array(c[0]):new Uint8Array,m}},t.flush=function(){e.inflateEnd()}}var Rs="/",tb=new Date(2107,11,31),nb=new Date(1980,0,1),Ee=void 0,dn="undefined",ki="function";var Un=class{constructor(t){return class extends TransformStream{constructor(e,i){let r=new t(i);super({transform(o,a){a.enqueue(r.append(o))},flush(o){let a=r.flush();a&&o.enqueue(a)}})}}}};var Md=64,Os=2;try{typeof navigator!=dn&&navigator.hardwareConcurrency&&(Os=navigator.hardwareConcurrency)}catch(n){}var $d={chunkSize:512*1024,maxWorkers:Os,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:Ee,CompressionStreamNative:typeof CompressionStream!=dn&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=dn&&DecompressionStream},Tt=Object.assign({},$d);function Jr(){return Tt}function Ds(n){return Math.max(n.chunkSize,Md)}function Ni(n){let{baseURL:t,chunkSize:e,maxWorkers:i,terminateWorkerTimeout:r,useCompressionStream:o,useWebWorkers:a,Deflate:s,Inflate:l,CompressionStream:c,DecompressionStream:p,workerScripts:m}=n;if(_t("baseURL",t),_t("chunkSize",e),_t("maxWorkers",i),_t("terminateWorkerTimeout",r),_t("useCompressionStream",o),_t("useWebWorkers",a),s&&(Tt.CompressionStream=new Un(s)),l&&(Tt.DecompressionStream=new Un(l)),_t("CompressionStream",c),_t("DecompressionStream",p),m!==Ee){let{deflate:y,inflate:E}=m;if((y||E)&&(Tt.workerScripts||(Tt.workerScripts={})),y){if(!Array.isArray(y))throw new Error("workerScripts.deflate must be an array");Tt.workerScripts.deflate=y}if(E){if(!Array.isArray(E))throw new Error("workerScripts.inflate must be an array");Tt.workerScripts.inflate=E}}}function _t(n,t){t!==Ee&&(Tt[n]=t)}var Cs=[];for(let n=0;n<256;n++){let t=n;for(let e=0;e<8;e++)t&1?t=t>>>1^3988292384:t=t>>>1;Cs[n]=t}var ct=class{constructor(t){this.crc=t||-1}append(t){let e=this.crc|0;for(let i=0,r=t.length|0;i>>8^Cs[(e^t[i])&255];this.crc=e}get(){return~this.crc}};var jn=class extends TransformStream{constructor(){let t,e=new ct;super({transform(i,r){e.append(i),r.enqueue(i)},flush(){let i=new Uint8Array(4);new DataView(i.buffer).setUint32(0,e.get()),t.value=i}}),t=this}};function Is(n){if(typeof TextEncoder=="undefined"){n=unescape(encodeURIComponent(n));let t=new Uint8Array(n.length);for(let e=0;e0&&t&&(n[e-1]=_e.partial(t,n[e-1]&2147483648>>t-1,1)),n},partial(n,t,e){return n===32?t:(e?t|0:t<<32-n)+n*1099511627776},getPartial(n){return Math.round(n/1099511627776)||32},_shiftRight(n,t,e,i){for(i===void 0&&(i=[]);t>=32;t-=32)i.push(e),e=0;if(t===0)return i.concat(n);for(let a=0;a>>t),e=n[a]<<32-t;let r=n.length?n[n.length-1]:0,o=_e.getPartial(r);return i.push(_e.partial(t+o&31,t+o>32?e:i.pop(),1)),i}},Hn={bytes:{fromBits(n){let e=_e.bitLength(n)/8,i=new Uint8Array(e),r;for(let o=0;o>>24,r<<=8;return i},toBits(n){let t=[],e,i=0;for(e=0;e9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");let o=new Uint32Array(e),a=0;for(let s=t.blockSize+i-(t.blockSize+i&t.blockSize-1);s<=r;s+=t.blockSize)t._block(o.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),t}finalize(){let n=this,t=n._buffer,e=n._h;t=_e.concat(t,[_e.partial(1,1)]);for(let i=t.length+2;i&15;i++)t.push(0);for(t.push(Math.floor(n._length/4294967296)),t.push(n._length|0);t.length;)n._block(t.splice(0,16));return n.reset(),e}_f(n,t,e,i){if(n<=19)return t&e|~t&i;if(n<=39)return t^e^i;if(n<=59)return t&e|t&i|e&i;if(n<=79)return t^e^i}_S(n,t){return t<>>32-n}_block(n){let t=this,e=t._h,i=Array(80);for(let c=0;c<16;c++)i[c]=n[c];let r=e[0],o=e[1],a=e[2],s=e[3],l=e[4];for(let c=0;c<=79;c++){c>=16&&(i[c]=t._S(1,i[c-3]^i[c-8]^i[c-14]^i[c-16]));let p=t._S(5,r)+t._f(c,o,a,s)+l+i[c]+t._key[Math.floor(c/20)]|0;l=s,s=a,a=t._S(30,o),o=r,r=p}e[0]=e[0]+r|0,e[1]=e[1]+o|0,e[2]=e[2]+a|0,e[3]=e[3]+s|0,e[4]=e[4]+l|0}};var Qr={};Qr.aes=class{constructor(n){let t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();let e=t._tables[0][4],i=t._tables[1],r=n.length,o,a,s,l=1;if(r!==4&&r!==6&&r!==8)throw new Error("invalid aes key size");for(t._key=[a=n.slice(0),s=[]],o=r;o<4*r+28;o++){let c=a[o-1];(o%r===0||r===8&&o%r===4)&&(c=e[c>>>24]<<24^e[c>>16&255]<<16^e[c>>8&255]<<8^e[c&255],o%r===0&&(c=c<<8^c>>>24^l<<24,l=l<<1^(l>>7)*283)),a[o]=a[o-r]^c}for(let c=0;o;c++,o--){let p=a[c&3?o:o-4];o<=4||c<4?s[c]=p:s[c]=i[0][e[p>>>24]]^i[1][e[p>>16&255]]^i[2][e[p>>8&255]]^i[3][e[p&255]]}}encrypt(n){return this._crypt(n,0)}decrypt(n){return this._crypt(n,1)}_precompute(){let n=this._tables[0],t=this._tables[1],e=n[4],i=t[4],r=[],o=[],a,s,l,c;for(let p=0;p<256;p++)o[(r[p]=p<<1^(p>>7)*283)^p]=p;for(let p=a=0;!e[p];p^=s||1,a=o[a]||1){let m=a^a<<1^a<<2^a<<3^a<<4;m=m>>8^m&255^99,e[p]=m,i[m]=p,c=r[l=r[s=r[p]]];let y=c*16843009^l*65537^s*257^p*16843008,E=r[m]*257^m*16843008;for(let v=0;v<4;v++)n[v][p]=E=E<<24^E>>>8,t[v][m]=y=y<<24^y>>>8}for(let p=0;p<5;p++)n[p]=n[p].slice(0),t[p]=t[p].slice(0)}_crypt(n,t){if(n.length!==4)throw new Error("invalid aes block size");let e=this._key[t],i=e.length/4-2,r=[0,0,0,0],o=this._tables[t],a=o[0],s=o[1],l=o[2],c=o[3],p=o[4],m=n[0]^e[0],y=n[t?3:1]^e[1],E=n[2]^e[2],v=n[t?1:3]^e[3],d=4,f,g,w;for(let _=0;_>>24]^s[y>>16&255]^l[E>>8&255]^c[v&255]^e[d],g=a[y>>>24]^s[E>>16&255]^l[v>>8&255]^c[m&255]^e[d+1],w=a[E>>>24]^s[v>>16&255]^l[m>>8&255]^c[y&255]^e[d+2],v=a[v>>>24]^s[m>>16&255]^l[y>>8&255]^c[E&255]^e[d+3],d+=4,m=f,y=g,E=w;for(let _=0;_<4;_++)r[t?3&-_:_]=p[m>>>24]<<24^p[y>>16&255]<<16^p[E>>8&255]<<8^p[v&255]^e[d++],f=m,m=y,y=E,E=v,v=f;return r}};var Ls={getRandomValues(n){let t=new Uint32Array(n.buffer),e=i=>{let r=987654321,o=4294967295;return function(){return r=36969*(r&65535)+(r>>16)&o,i=18e3*(i&65535)+(i>>16)&o,(((r<<16)+i&o)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let i=0,r;i>24&255)===255){let t=n>>16&255,e=n>>8&255,i=n&255;t===255?(t=0,e===255?(e=0,i===255?i=0:++i):++e):++t,n=0,n+=t<<16,n+=e<<8,n+=i}else n+=1<<24;return n}incCounter(n){(n[0]=this.incWord(n[0]))===0&&(n[1]=this.incWord(n[1]))}calculate(n,t,e){let i;if(!(i=t.length))return[];let r=_e.bitLength(t);for(let o=0;o>5)+1<<2,o,a,s,l,c,p=new ArrayBuffer(r),m=new DataView(p),y=0,E=_e;for(t=Hn.bytes.toBits(t),c=1;y<(r||1);c++){for(o=a=n.encrypt(E.concat(t,[c])),s=1;sr&&(n=new e().update(n).finalize());for(let o=0;othis.resolveReady=o),password:t,signed:e,strength:i-1,pending:new Uint8Array})},async transform(o,a){let s=this,{password:l,strength:c,resolveReady:p,ready:m}=s;l?(await Vd(s,c,l,Fe(o,0,Wn[c]+2)),o=Fe(o,Wn[c]+2),r?a.error(new Error(pt)):p()):await m;let y=new Uint8Array(o.length-Nt-(o.length-Nt)%mn);a.enqueue(Hs(s,o,y,0,Nt,!0))},async flush(o){let{signed:a,ctr:s,hmac:l,pending:c,ready:p}=this;await p;let m=Fe(c,0,c.length-Nt),y=Fe(c,c.length-Nt),E=new Uint8Array;if(m.length){let v=Yn(Je,m);l.update(v);let d=s.update(v);E=Zn(Je,d)}if(a){let v=Fe(Zn(Je,l.digest()),0,Nt);for(let d=0;dthis.resolveReady=r),password:t,strength:e-1,pending:new Uint8Array})},async transform(r,o){let a=this,{password:s,strength:l,resolveReady:c,ready:p}=a,m=new Uint8Array;s?(m=await Kd(a,l,s),c()):await p;let y=new Uint8Array(m.length+r.length-r.length%mn);y.set(m,0),o.enqueue(Hs(a,r,y,m.length,0))},async flush(r){let{ctr:o,hmac:a,pending:s,ready:l}=this;await l;let c=new Uint8Array;if(s.length){let p=o.update(Yn(Je,s));a.update(p),c=Zn(Je,p)}i.signature=Zn(Je,a.digest()).slice(0,Nt),r.enqueue(no(c,i.signature))}}),i=this}};function Hs(n,t,e,i,r,o){let{ctr:a,hmac:s,pending:l}=n,c=t.length-r;l.length&&(t=no(l,t),e=Qd(e,c-c%mn));let p;for(p=0;p<=c-mn;p+=mn){let m=Yn(Je,Fe(t,p,p+mn));o&&s.update(m);let y=a.update(m);o||s.update(y),e.set(Zn(Je,y),p+i)}return n.pending=Fe(t,p),e}async function Vd(n,t,e,i){let r=await qs(n,t,e,Fe(i,0,Wn[t])),o=Fe(i,Wn[t]);if(r[0]!=o[0]||r[1]!=o[1])throw new Error(kt)}async function Kd(n,t,e){let i=Si(new Uint8Array(Wn[t])),r=await qs(n,t,e,i);return no(i,r)}async function qs(n,t,e,i){n.password=null;let r=Is(e),o=await Xd(Ud,r,qd,!1,Wd),a=await Jd(Object.assign({salt:i},to),o,8*(qn[t]*2+2)),s=new Uint8Array(a),l=Yn(Je,Fe(s,0,qn[t])),c=Yn(Je,Fe(s,qn[t],qn[t]*2)),p=Fe(s,qn[t]*2);return Object.assign(n,{keys:{key:l,authentication:c,passwordVerification:p},ctr:new zd(new Yd(l),Array.from(Zd)),hmac:new Gd(c)}),p}async function Xd(n,t,e,i,r){if(Ps)try{return await zn.importKey(n,t,e,i,r)}catch(o){return Ps=!1,At.importKey(t)}else return At.importKey(t)}async function Jd(n,t,e){if(Ms)try{return await zn.deriveBits(n,t,e)}catch(i){return Ms=!1,At.pbkdf2(t,n.salt,to.iterations,e)}else return At.pbkdf2(t,n.salt,to.iterations,e)}function no(n,t){let e=n;return n.length+t.length&&(e=new Uint8Array(n.length+t.length),e.set(n,0),e.set(t,n.length)),e}function Qd(n,t){if(t&&t>n.length){let e=n;n=new Uint8Array(t),n.set(e,0)}return n}function Fe(n,t,e){return n.subarray(t,e)}function Zn(n,t){return n.fromBits(t)}function Yn(n,t){return n.toBits(t)}var hn=12,Ci=class extends TransformStream{constructor({password:t,passwordVerification:e,checkPasswordOnly:i}){super({start(){Object.assign(this,{password:t,passwordVerification:e}),zs(this,t)},transform(r,o){let a=this;if(a.password){let s=Ws(a,r.subarray(0,hn));if(a.password=null,s[hn-1]!=a.passwordVerification)throw new Error(kt);r=r.subarray(hn)}i?o.error(new Error(pt)):o.enqueue(Ws(a,r))}})}},Ii=class extends TransformStream{constructor({password:t,passwordVerification:e}){super({start(){Object.assign(this,{password:t,passwordVerification:e}),zs(this,t)},transform(i,r){let o=this,a,s;if(o.password){o.password=null;let l=Si(new Uint8Array(hn));l[hn-1]=o.passwordVerification,a=new Uint8Array(i.length+l.length),a.set(Zs(o,l),0),s=hn}else a=new Uint8Array(i.length),s=0;a.set(Zs(o,i),s),r.enqueue(a)}})}};function Ws(n,t){let e=new Uint8Array(t.length);for(let i=0;i>>24]),r=~n.crcKey2.get(),n.keys=[e,i,r]}function Gs(n){let t=n.keys[2]|2;return Vs(Math.imul(t,t^1)>>>8)}function Vs(n){return n&255}function Ys(n){return n&4294967295}var Ks="deflate-raw",Fi=class extends TransformStream{constructor(t,{chunkSize:e,CompressionStream:i,CompressionStreamNative:r}){super({});let{compressed:o,encrypted:a,useCompressionStream:s,zipCrypto:l,signed:c,level:p}=t,m=this,y,E,v=Xs(super.readable);(!a||l)&&c&&(y=new jn,v=Qe(v,y)),o&&(v=Qs(v,s,{level:p,chunkSize:e},r,i)),a&&(l?v=Qe(v,new Ii(t)):(E=new Oi(t),v=Qe(v,E))),Js(m,v,async()=>{let d;a&&!l&&(d=E.signature),(!a||l)&&c&&(d=new DataView(y.value.buffer).getUint32(0)),m.signature=d})}},Li=class extends TransformStream{constructor(t,{chunkSize:e,DecompressionStream:i,DecompressionStreamNative:r}){super({});let{zipCrypto:o,encrypted:a,signed:s,signature:l,compressed:c,useCompressionStream:p}=t,m,y,E=Xs(super.readable);a&&(o?E=Qe(E,new Ci(t)):(y=new Ri(t),E=Qe(E,y))),c&&(E=Qs(E,p,{chunkSize:e},r,i)),(!a||o)&&s&&(m=new jn,E=Qe(E,m)),Js(this,E,async()=>{if((!a||o)&&s){let v=new DataView(m.value.buffer);if(l!=v.getUint32(0,!1))throw new Error(Yt)}})}};function Xs(n){return Qe(n,new TransformStream({transform(t,e){t&&t.length&&e.enqueue(t)}}))}function Js(n,t,e){t=Qe(t,new TransformStream({flush:e})),Object.defineProperty(n,"readable",{get(){return t}})}function Qs(n,t,e,i,r){try{let o=t&&i?i:r;n=Qe(n,new o(Ks,e))}catch(o){if(t)n=Qe(n,new r(Ks,e));else throw o}return n}function Qe(n,t){return n.pipeThrough(t)}var el="message",tl="start",nl="pull",ro="data",il="ack",rl="close",ol="deflate",Mi="inflate";var Pi=class extends TransformStream{constructor(t,e){super({});let i=this,{codecType:r}=t,o;r.startsWith(ol)?o=Fi:r.startsWith(Mi)&&(o=Li);let a=0,s=new o(t,e),l=super.readable,c=new TransformStream({transform(p,m){p&&p.length&&(a+=p.length,m.enqueue(p))},flush(){let{signature:p}=s;Object.assign(i,{signature:p,size:a})}});Object.defineProperty(i,"readable",{get(){return l.pipeThrough(s).pipeThrough(c)}})}};var em=typeof Worker!=dn;var gn=class{constructor(t,{readable:e,writable:i},{options:r,config:o,streamOptions:a,useWebWorkers:s,transferStreams:l,scripts:c},p){let{signal:m}=a;return Object.assign(t,{busy:!0,readable:e.pipeThrough(new ao(e,a,o),{signal:m}),writable:i,options:Object.assign({},r),scripts:c,transferStreams:l,terminate(){let{worker:y,busy:E}=t;y&&!E&&(y.terminate(),t.interface=null)},onTaskFinished(){t.busy=!1,p(t)}}),(s&&em?nm:tm)(t,o)}},ao=class extends TransformStream{constructor(t,{onstart:e,onprogress:i,size:r,onend:o},{chunkSize:a}){let s=0;super({start(){e&&oo(e,r)},async transform(l,c){s+=l.length,i&&await oo(i,s,r),c.enqueue(l)},flush(){t.size=s,o&&oo(o,s)}},{highWaterMark:1,size:()=>a})}};async function oo(n,...t){try{await n(...t)}catch(e){}}function tm(n,t){return{run:()=>im(n,t)}}function nm(n,{baseURL:t,chunkSize:e}){return n.interface||Object.assign(n,{worker:am(n.scripts[0],t,n),interface:{run:()=>rm(n,{chunkSize:e})}}),n.interface}async function im({options:n,readable:t,writable:e,onTaskFinished:i},r){let o=new Pi(n,r);try{await t.pipeThrough(o).pipeTo(e,{preventClose:!0,preventAbort:!0});let{signature:a,size:s}=o;return{signature:a,size:s}}finally{i()}}async function rm(n,t){let e,i,r=new Promise((y,E)=>{e=y,i=E});Object.assign(n,{reader:null,writer:null,resolveResult:e,rejectResult:i,result:r});let{readable:o,options:a,scripts:s}=n,{writable:l,closed:c}=om(n.writable);so({type:tl,scripts:s.slice(1),options:a,config:t,readable:o,writable:l},n)||Object.assign(n,{reader:o.getReader(),writer:l.getWriter()});let m=await r;try{await l.getWriter().close()}catch(y){}return await c,m}function om(n){let t=n.getWriter(),e,i=new Promise(o=>e=o);return{writable:new WritableStream({async write(o){await t.ready,await t.write(o)},close(){t.releaseLock(),e()},abort(o){return t.abort(o)}}),closed:i}}var al=!0,sl=!0;function am(n,t,e){let i={type:"module"},r,o;typeof n==ki&&(n=n());try{r=new URL(n,t)}catch(a){r=n}if(al)try{o=new Worker(r)}catch(a){al=!1,o=new Worker(r,i)}else o=new Worker(r,i);return o.addEventListener(el,a=>sm(a,e)),o}function so(n,{worker:t,writer:e,onTaskFinished:i,transferStreams:r}){try{let{value:o,readable:a,writable:s}=n,l=[];if(o&&(n.value=o.buffer,l.push(n.value)),r&&sl?(a&&l.push(a),s&&l.push(s)):n.readable=n.writable=null,l.length)try{return t.postMessage(n,l),!0}catch(c){sl=!1,n.readable=n.writable=null,t.postMessage(n)}else t.postMessage(n)}catch(o){throw e&&e.releaseLock(),i(),o}}async function sm({data:n},t){let{type:e,value:i,messageId:r,result:o,error:a}=n,{reader:s,writer:l,resolveResult:c,rejectResult:p,onTaskFinished:m}=t;try{if(a){let{message:E,stack:v,code:d,name:f}=a,g=new Error(E);Object.assign(g,{stack:v,code:d,name:f}),y(g)}else{if(e==nl){let{value:E,done:v}=await s.read();so({type:ro,value:E,done:v,messageId:r},t)}e==ro&&(await l.ready,await l.write(new Uint8Array(i)),so({type:il,messageId:r},t)),e==rl&&y(null,o)}}catch(E){y(E)}function y(E,v){E?p(E):c(v),l&&l.releaseLock(),m()}}var zt=[],lo=[];var ll=0;async function pl(n,t){let{options:e,config:i}=t,{transferStreams:r,useWebWorkers:o,useCompressionStream:a,codecType:s,compressed:l,signed:c,encrypted:p}=e,{workerScripts:m,maxWorkers:y,terminateWorkerTimeout:E}=i;t.transferStreams=r||r===Ee;let v=!l&&!c&&!p&&!t.transferStreams;t.useWebWorkers=!v&&(o||o===Ee&&i.useWebWorkers),t.scripts=t.useWebWorkers&&m?m[s]:[],e.useCompressionStream=a||a===Ee&&i.useCompressionStream;let d,f=zt.find(w=>!w.busy);if(f)cl(f),d=new gn(f,n,t,g);else if(zt.lengthlo.push({resolve:w,stream:n,workerOptions:t}));return d.run();function g(w){if(lo.length){let[{resolve:_,stream:A,workerOptions:D}]=lo.splice(0,1);_(new gn(w,A,D,g))}else w.worker?(cl(w),Number.isFinite(E)&&E>=0&&(w.terminateTimeout=setTimeout(()=>{zt=zt.filter(_=>_!=w),w.terminate()},E))):zt=zt.filter(_=>_!=w)}}function cl(n){let{terminateTimeout:t}=n;t&&(clearTimeout(t),n.terminateTimeout=null)}var lm="Writer iterator completed too soon";var cm="Content-Type";var pm=64*1024,ul="writable",Gn=class{constructor(){this.size=0}init(){this.initialized=!0}},yn=class extends Gn{get readable(){let t=this,{chunkSize:e=pm}=t,i=new ReadableStream({start(){this.chunkOffset=0},async pull(r){let{offset:o=0,size:a,diskNumberStart:s}=i,{chunkOffset:l}=this;r.enqueue(await be(t,o+l,Math.min(e,a-l),s)),l+e>a?r.close():this.chunkOffset+=e}});return i}};var St=class extends yn{constructor(t){super(),Object.assign(this,{blob:t,size:t.size})}async readUint8Array(t,e){let i=this,r=t+e,a=await(t||re&&(a=a.slice(t,r)),new Uint8Array(a)}},Vn=class extends Gn{constructor(t){super();let e=this,i=new TransformStream,r=[];t&&r.push([cm,t]),Object.defineProperty(e,ul,{get(){return i.writable}}),e.blob=new Response(i.readable,{headers:r}).blob()}getData(){return this.blob}};var $i=class extends Vn{constructor(t){super(t),Object.assign(this,{encoding:t,utf8:!t||t.toLowerCase()=="utf-8"})}async getData(){let{encoding:t,utf8:e}=this,i=await super.getData();if(i.text&&e)return i.text();{let r=new FileReader;return new Promise((o,a)=>{Object.assign(r,{onload:({target:s})=>o(s.result),onerror:()=>a(r.error)}),r.readAsText(i,t)})}}};var co=class extends yn{constructor(t){super(),this.readers=t}async init(){let t=this,{readers:e}=t;t.lastDiskNumber=0,t.lastDiskOffset=0,await Promise.all(e.map(async(i,r)=>{await i.init(),r!=e.length-1&&(t.lastDiskOffset+=i.size),t.size+=i.size})),super.init()}async readUint8Array(t,e,i=0){let r=this,{readers:o}=this,a,s=i;s==-1&&(s=o.length-1);let l=t;for(;l>=o[s].size;)l-=o[s].size,s++;let c=o[s],p=c.size;if(l+e<=p)a=await be(c,l,e);else{let m=p-l;a=new Uint8Array(e),a.set(await be(c,l,m)),a.set(await r.readUint8Array(t+m,e-m,i),m)}return r.lastDiskNumber=Math.max(s,r.lastDiskNumber),a}},Bi=class extends Gn{constructor(t,e=4294967295){super();let i=this;Object.assign(i,{diskNumber:0,diskOffset:0,size:0,maxSize:e,availableSize:e});let r,o,a,s=new WritableStream({async write(p){let{availableSize:m}=i;if(a)p.length>=m?(await l(p.slice(0,m)),await c(),i.diskOffset+=r.size,i.diskNumber++,a=null,await this.write(p.slice(m))):await l(p);else{let{value:y,done:E}=await t.next();if(E&&!y)throw new Error(lm);r=y,r.size=0,r.maxSize&&(i.maxSize=r.maxSize),i.availableSize=i.maxSize,await Kn(r),o=y.writable,a=o.getWriter(),await this.write(p)}},async close(){await a.ready,await c()}});Object.defineProperty(i,ul,{get(){return s}});async function l(p){let m=p.length;m&&(await a.ready,await a.write(p),r.size+=m,i.size+=m,i.availableSize-=m)}async function c(){o.size=r.size,await a.close()}}};async function Kn(n,t){n.init&&!n.initialized&&await n.init(t)}function fl(n){return Array.isArray(n)&&(n=new co(n)),n instanceof ReadableStream&&(n={readable:n}),n}function dl(n){n.writable===Ee&&typeof n.next==ki&&(n=new Bi(n)),n instanceof WritableStream&&(n={writable:n});let{writable:t}=n;return t.size===Ee&&(t.size=0),n instanceof Bi||Object.assign(n,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),n}function be(n,t,e,i){return n.readUint8Array(t,e,i)}var ml="\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0 ".split(""),um=ml.length==256;function hl(n){if(um){let t="";for(let e=0;ethis[e]=t[e])}};var To="File format is not recognized",Cm="End of central directory not found",Im="End of Zip64 central directory not found",Fm="End of Zip64 central directory locator not found",Lm="Central directory header not found",Pm="Local file header not found",Mm="Zip64 extra field not found",$m="File contains encrypted entry",Bm="Encryption method not supported",Tl="Compression method not supported",Al="Split zip file",kl="utf-8",Nl="cp437",Um=[[ho,4294967295],[go,4294967295],[yo,4294967295],[ji,65535]],jm={[65535]:{getValue:ae,bytes:4},[4294967295]:{getValue:qi,bytes:8}},Vt=class{constructor(t,e={}){Object.assign(this,{reader:fl(t),options:e,config:Jr()})}async*getEntriesGenerator(t={}){let e=this,{reader:i}=e,{config:r}=e;if(await Kn(i),(i.size===Ee||!i.readUint8Array)&&(i=new St(await new Response(i.readable).blob()),await Kn(i)),i.size<22)throw new Error(To);i.chunkSize=Ds(r);let o=await Ym(i,101010256,i.size,22,65535*16);if(!o){let O=await be(i,0,4),S=he(O);throw ae(S)==134695760?new Error(Al):new Error(Cm)}let a=he(o),s=ae(a,12),l=ae(a,16),c=o.offset,p=me(a,20),m=c+22+p,y=me(a,4),E=i.lastDiskNumber||0,v=me(a,6),d=me(a,8),f=0,g=0;if(l==4294967295||s==4294967295||d==65535||v==65535){let O=await be(i,o.offset-20,20),S=he(O);if(ae(S,0)!=117853008)throw new Error(Im);l=qi(S,8);let M=await be(i,l,56,-1),L=he(M),j=o.offset-20-56;if(ae(L,0)!=101075792&&l!=j){let Z=l;l=j,f=l-Z,M=await be(i,l,56,-1),L=he(M)}if(ae(L,0)!=101075792)throw new Error(Fm);y==65535&&(y=ae(L,16)),v==65535&&(v=ae(L,20)),d==65535&&(d=qi(L,32)),s==4294967295&&(s=qi(L,40)),l-=s}if(E!=y)throw new Error(Al);if(l<0||l>=i.size)throw new Error(To);let w=0,_=await be(i,l,s,v),A=he(_);if(s){let O=o.offset-s;if(ae(A,w)!=33639248&&l!=O){let S=l;l=O,f=l-S,_=await be(i,l,s,v),A=he(_)}}let D=o.offset-l-(i.lastDiskOffset||0);if(s!=D&&D>=0&&(s=D,_=await be(i,l,s,v),A=he(_)),l<0||l>=i.size)throw new Error(To);let T=Le(e,t,"filenameEncoding"),k=Le(e,t,"commentEncoding");for(let O=0;OS.getData(N,R,I),w=U;let{onprogress:x}=t;if(x)try{await x(O+1,d,new Xn(S))}catch(N){}yield R}let b=Le(e,t,"extractPrependedData"),C=Le(e,t,"extractAppendedData");return b&&(e.prependedData=g>0?await be(i,0,g):new Uint8Array),e.comment=p?await be(i,c+22,p):new Uint8Array,C&&(e.appendedData=m>>8&255:y>>>24&255),signature:y,compressed:c!=0,encrypted:A,useWebWorkers:Le(r,i,"useWebWorkers"),useCompressionStream:Le(r,i,"useCompressionStream"),transferStreams:Le(r,i,"transferStreams"),checkPasswordOnly:O},config:p,streamOptions:{signal:C,size:k,onstart:M,onprogress:L,onend:j}},F=0;try{({outputSize:F}=await pl({readable:b,writable:S},Z))}catch(ee){if(!O||ee.message!=pt)throw ee}finally{let ee=Le(r,i,"preventClose");S.size+=F,!ee&&!S.locked&&await S.getWriter().close()}return O?void 0:t.getData?t.getData():S}};function Rl(n,t,e){let i=n.rawBitFlag=me(t,e+2),r=(i&1)==1,o=ae(t,e+6);Object.assign(n,{encrypted:r,version:me(t,e),bitFlag:{level:(i&6)>>1,dataDescriptor:(i&8)==8,languageEncodingFlag:(i&2048)==2048},rawLastModDate:o,lastModDate:zm(o),filenameLength:me(t,e+22),extraFieldLength:me(t,e+24)})}async function Ol(n,t,e,i){let{rawExtraField:r}=t,o=t.extraField=new Map,a=he(new Uint8Array(r)),s=0;try{for(;st[r]==o);for(let r=0,o=0;r{if(n.data.length>=a+4){let c=ae(e,a);t[s]=n[s]=new Date(c*1e3);let p=o[l];n[p]=c}a+=4})}async function Ym(n,t,e,i,r){let o=new Uint8Array(4),a=he(o);Gm(a,0,t);let s=i+r;return await l(i)||await l(Math.min(s,e));async function l(c){let p=e-c,m=await be(n,p,c);for(let y=m.length-i;y>=0;y--)if(m[y]==o[0]&&m[y+1]==o[1]&&m[y+2]==o[2]&&m[y+3]==o[3])return{offset:p+y,buffer:m.slice(y,y+i).buffer}}}function Le(n,t,e){return t[e]===Ee?n.options[e]:t[e]}function zm(n){let t=(n&4294901760)>>16,e=n&65535;try{return new Date(1980+((t&65024)>>9),((t&480)>>5)-1,t&31,(e&63488)>>11,(e&2016)>>5,(e&31)*2,0)}catch(i){}}function Ao(n){return new Date(Number(n/BigInt(1e4)-BigInt(116444736e5)))}function bn(n,t){return n.getUint8(t)}function me(n,t){return n.getUint16(t,!0)}function ae(n,t){return n.getUint32(t,!0)}function qi(n,t){return Number(n.getBigUint64(t,!0))}function Gm(n,t,e){n.setUint32(t,e,!0)}function he(n){return new DataView(n.buffer)}Ni({Inflate:Ss});var Kt=require("obsidian");function Dl(n){let t=()=>URL.createObjectURL(new Blob([`const{Array:e,Object:t,Number:n,Math:r,Error:s,Uint8Array:i,Uint16Array:o,Uint32Array:c,Int32Array:f,Map:a,DataView:l,Promise:u,TextEncoder:w,crypto:h,postMessage:d,TransformStream:p,ReadableStream:y,WritableStream:m,CompressionStream:b,DecompressionStream:g}=self;class k{constructor(e){return class extends p{constructor(t,n){const r=new e(n);super({transform(e,t){t.enqueue(r.append(e))},flush(e){const t=r.flush();t&&e.enqueue(t)}})}}}}const v=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;v[e]=t}class S{constructor(e){this.t=e||-1}append(e){let t=0|this.t;for(let n=0,r=0|e.length;r>n;n++)t=t>>>8^v[255&(t^e[n])];this.t=t}get(){return~this.t}}class z extends p{constructor(){let e;const t=new S;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new i(4);new l(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const C={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],r=C.i(n);return 32===r?e.concat(t):C.o(t,r,0|n,e.slice(0,e.length-1))},l(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+C.i(n)},u(e,t){if(32*e.length0&&t&&(e[n-1]=C.h(t,e[n-1]&2147483648>>t-1,1)),e},h:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,i:e=>r.round(e/1099511627776)||32,o(e,t,n,r){for(void 0===r&&(r=[]);t>=32;t-=32)r.push(n),n=0;if(0===t)return r.concat(e);for(let s=0;s>>t),n=e[s]<<32-t;const s=e.length?e[e.length-1]:0,i=C.i(s);return r.push(C.h(t+i&31,t+i>32?n:r.pop(),1)),r}},x={p:{m(e){const t=C.l(e)/8,n=new i(t);let r;for(let s=0;t>s;s++)0==(3&s)&&(r=e[s/4]),n[s]=r>>>24,r<<=8;return n},g(e){const t=[];let n,r=0;for(n=0;n9007199254740991)throw new s("Cannot hash more than 2^53 - 1 bits");const o=new c(n);let f=0;for(let e=t.blockSize+r-(t.blockSize+r&t.blockSize-1);i>=e;e+=t.blockSize)t.I(o.subarray(16*f,16*(f+1))),f+=1;return n.splice(0,16*f),t}D(){const e=this;let t=e.C;const n=e.S;t=C.concat(t,[C.h(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(r.floor(e._/4294967296)),t.push(0|e._);t.length;)e.I(t.splice(0,16));return e.reset(),n}V(e,t,n,r){return e>19?e>39?e>59?e>79?void 0:t^n^r:t&n|t&r|n&r:t^n^r:t&n|~t&r}P(e,t){return t<>>32-e}I(t){const n=this,s=n.S,i=e(80);for(let e=0;16>e;e++)i[e]=t[e];let o=s[0],c=s[1],f=s[2],a=s[3],l=s[4];for(let e=0;79>=e;e++){16>e||(i[e]=n.P(1,i[e-3]^i[e-8]^i[e-14]^i[e-16]));const t=n.P(5,o)+n.V(e,c,f,a)+l+i[e]+n.v[r.floor(e/20)]|0;l=a,a=f,f=n.P(30,c),c=o,o=t}s[0]=s[0]+o|0,s[1]=s[1]+c|0,s[2]=s[2]+f|0,s[3]=s[3]+a|0,s[4]=s[4]+l|0}},A={getRandomValues(e){const t=new c(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(r.random()>.5?1:-1))};for(let s,i=0;inew I.R(x.p.g(e)),B(e,t,n,r){if(n=n||1e4,0>r||0>n)throw new s("invalid params to pbkdf2");const i=1+(r>>5)<<2;let o,c,f,a,u;const w=new ArrayBuffer(i),h=new l(w);let d=0;const p=C;for(t=x.p.g(t),u=1;(i||1)>d;u++){for(o=c=e.encrypt(p.concat(t,[u])),f=1;n>f;f++)for(c=e.encrypt(c),a=0;ad&&fs&&(e=(new n).update(e).D());for(let t=0;s>t;t++)r[0][t]=909522486^e[t],r[1][t]=1549556828^e[t];t.K[0].update(r[0]),t.K[1].update(r[1]),t.U=new n(t.K[0])}reset(){const e=this;e.U=new e.M(e.K[0]),e.N=!1}update(e){this.N=!0,this.U.update(e)}digest(){const e=this,t=e.U.D(),n=new e.M(e.K[1]).update(t).D();return e.reset(),n}encrypt(e){if(this.N)throw new s("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},D=void 0!==h&&"function"==typeof h.getRandomValues,V="Invalid password",P="Invalid signature",R="zipjs-abort-check-password";function B(e){return D?h.getRandomValues(e):A.getRandomValues(e)}const E=16,M={name:"PBKDF2"},K=t.assign({hash:{name:"HMAC"}},M),U=t.assign({iterations:1e3,hash:{name:"SHA-1"}},M),N=["deriveBits"],O=[8,12,16],T=[16,24,32],W=10,j=[0,0,0,0],H="undefined",L="function",F=typeof h!=H,q=F&&h.subtle,G=F&&typeof q!=H,J=x.p,Q=class{constructor(e){const t=this;t.O=[[[],[],[],[],[]],[[],[],[],[],[]]],t.O[0][0][0]||t.T();const n=t.O[0][4],r=t.O[1],i=e.length;let o,c,f,a=1;if(4!==i&&6!==i&&8!==i)throw new s("invalid aes key size");for(t.v=[c=e.slice(0),f=[]],o=i;4*i+28>o;o++){let e=c[o-1];(o%i==0||8===i&&o%i==4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],o%i==0&&(e=e<<8^e>>>24^a<<24,a=a<<1^283*(a>>7))),c[o]=c[o-i]^e}for(let e=0;o;e++,o--){const t=c[3&e?o:o-4];f[e]=4>=o||4>e?t:r[0][n[t>>>24]]^r[1][n[t>>16&255]]^r[2][n[t>>8&255]]^r[3][n[255&t]]}}encrypt(e){return this.W(e,0)}decrypt(e){return this.W(e,1)}T(){const e=this.O[0],t=this.O[1],n=e[4],r=t[4],s=[],i=[];let o,c,f,a;for(let e=0;256>e;e++)i[(s[e]=e<<1^283*(e>>7))^e]=e;for(let l=o=0;!n[l];l^=c||1,o=i[o]||1){let i=o^o<<1^o<<2^o<<3^o<<4;i=i>>8^255&i^99,n[l]=i,r[i]=l,a=s[f=s[c=s[l]]];let u=16843009*a^65537*f^257*c^16843008*l,w=257*s[i]^16843008*i;for(let n=0;4>n;n++)e[n][l]=w=w<<24^w>>>8,t[n][i]=u=u<<24^u>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}W(e,t){if(4!==e.length)throw new s("invalid aes block size");const n=this.v[t],r=n.length/4-2,i=[0,0,0,0],o=this.O[t],c=o[0],f=o[1],a=o[2],l=o[3],u=o[4];let w,h,d,p=e[0]^n[0],y=e[t?3:1]^n[1],m=e[2]^n[2],b=e[t?1:3]^n[3],g=4;for(let e=0;r>e;e++)w=c[p>>>24]^f[y>>16&255]^a[m>>8&255]^l[255&b]^n[g],h=c[y>>>24]^f[m>>16&255]^a[b>>8&255]^l[255&p]^n[g+1],d=c[m>>>24]^f[b>>16&255]^a[p>>8&255]^l[255&y]^n[g+2],b=c[b>>>24]^f[p>>16&255]^a[y>>8&255]^l[255&m]^n[g+3],g+=4,p=w,y=h,m=d;for(let e=0;4>e;e++)i[t?3&-e:e]=u[p>>>24]<<24^u[y>>16&255]<<16^u[m>>8&255]<<8^u[255&b]^n[g++],w=p,p=y,y=m,m=b,b=w;return i}},X=class{constructor(e,t){this.j=e,this.H=t,this.L=t}reset(){this.L=this.H}update(e){return this.F(this.j,e,this.L)}q(e){if(255==(e>>24&255)){let t=e>>16&255,n=e>>8&255,r=255&e;255===t?(t=0,255===n?(n=0,255===r?r=0:++r):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=r}else e+=1<<24;return e}G(e){0===(e[0]=this.q(e[0]))&&(e[1]=this.q(e[1]))}F(e,t,n){let r;if(!(r=t.length))return[];const s=C.l(t);for(let s=0;r>s;s+=4){this.G(n);const r=e.encrypt(n);t[s]^=r[0],t[s+1]^=r[1],t[s+2]^=r[2],t[s+3]^=r[3]}return C.u(t,s)}},Y=I.R;let Z=F&&G&&typeof q.importKey==L,$=F&&G&&typeof q.deriveBits==L;class ee extends p{constructor({password:e,signed:n,encryptionStrength:r,checkPasswordOnly:o}){super({start(){t.assign(this,{ready:new u((e=>this.J=e)),password:e,signed:n,X:r-1,pending:new i})},async transform(e,t){const n=this,{password:r,X:c,J:f,ready:a}=n;r?(await(async(e,t,n,r)=>{const i=await re(e,t,n,ie(r,0,O[t])),o=ie(r,O[t]);if(i[0]!=o[0]||i[1]!=o[1])throw new s(V)})(n,c,r,ie(e,0,O[c]+2)),e=ie(e,O[c]+2),o?t.error(new s(R)):f()):await a;const l=new i(e.length-W-(e.length-W)%E);t.enqueue(ne(n,e,l,0,W,!0))},async flush(e){const{signed:t,Y:n,Z:r,pending:o,ready:c}=this;await c;const f=ie(o,0,o.length-W),a=ie(o,o.length-W);let l=new i;if(f.length){const e=ce(J,f);r.update(e);const t=n.update(e);l=oe(J,t)}if(t){const e=ie(oe(J,r.digest()),0,W);for(let t=0;W>t;t++)if(e[t]!=a[t])throw new s(P)}e.enqueue(l)}})}}class te extends p{constructor({password:e,encryptionStrength:n}){let r;super({start(){t.assign(this,{ready:new u((e=>this.J=e)),password:e,X:n-1,pending:new i})},async transform(e,t){const n=this,{password:r,X:s,J:o,ready:c}=n;let f=new i;r?(f=await(async(e,t,n)=>{const r=B(new i(O[t]));return se(r,await re(e,t,n,r))})(n,s,r),o()):await c;const a=new i(f.length+e.length-e.length%E);a.set(f,0),t.enqueue(ne(n,e,a,f.length,0))},async flush(e){const{Y:t,Z:n,pending:s,ready:o}=this;await o;let c=new i;if(s.length){const e=t.update(ce(J,s));n.update(e),c=oe(J,e)}r.signature=oe(J,n.digest()).slice(0,W),e.enqueue(se(c,r.signature))}}),r=this}}function ne(e,t,n,r,s,o){const{Y:c,Z:f,pending:a}=e,l=t.length-s;let u;for(a.length&&(t=se(a,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new i(t)).set(n,0)}return e})(n,l-l%E)),u=0;l-E>=u;u+=E){const e=ce(J,ie(t,u,u+E));o&&f.update(e);const s=c.update(e);o||f.update(s),n.set(oe(J,s),u+r)}return e.pending=ie(t,u),n}async function re(n,r,s,o){n.password=null;const c=(e=>{if(void 0===w){const t=new i((e=unescape(encodeURIComponent(e))).length);for(let n=0;n{if(!Z)return I.importKey(t);try{return await q.importKey("raw",t,n,!1,s)}catch(e){return Z=!1,I.importKey(t)}})(0,c,K,0,N),a=await(async(e,t,n)=>{if(!$)return I.B(t,e.salt,U.iterations,n);try{return await q.deriveBits(e,t,n)}catch(r){return $=!1,I.B(t,e.salt,U.iterations,n)}})(t.assign({salt:o},U),f,8*(2*T[r]+2)),l=new i(a),u=ce(J,ie(l,0,T[r])),h=ce(J,ie(l,T[r],2*T[r])),d=ie(l,2*T[r]);return t.assign(n,{keys:{key:u,$:h,passwordVerification:d},Y:new X(new Q(u),e.from(j)),Z:new Y(h)}),d}function se(e,t){let n=e;return e.length+t.length&&(n=new i(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ie(e,t,n){return e.subarray(t,n)}function oe(e,t){return e.m(t)}function ce(e,t){return e.g(t)}class fe extends p{constructor({password:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){t.assign(this,{password:e,passwordVerification:n}),we(this,e)},transform(e,t){const n=this;if(n.password){const t=le(n,e.subarray(0,12));if(n.password=null,t[11]!=n.passwordVerification)throw new s(V);e=e.subarray(12)}r?t.error(new s(R)):t.enqueue(le(n,e))}})}}class ae extends p{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),we(this,e)},transform(e,t){const n=this;let r,s;if(n.password){n.password=null;const t=B(new i(12));t[11]=n.passwordVerification,r=new i(e.length+t.length),r.set(ue(n,t),0),s=12}else r=new i(e.length),s=0;r.set(ue(n,e),s),t.enqueue(r)}})}}function le(e,t){const n=new i(t.length);for(let r=0;r>>24]),i=~e.te.get(),e.keys=[n,s,i]}function de(e){const t=2|e.keys[2];return pe(r.imul(t,1^t)>>>8)}function pe(e){return 255&e}function ye(e){return 4294967295&e}const me="deflate-raw";class be extends p{constructor(e,{chunkSize:t,CompressionStream:n,CompressionStreamNative:r}){super({});const{compressed:s,encrypted:i,useCompressionStream:o,zipCrypto:c,signed:f,level:a}=e,u=this;let w,h,d=ke(super.readable);i&&!c||!f||(w=new z,d=ze(d,w)),s&&(d=Se(d,o,{level:a,chunkSize:t},r,n)),i&&(c?d=ze(d,new ae(e)):(h=new te(e),d=ze(d,h))),ve(u,d,(async()=>{let e;i&&!c&&(e=h.signature),i&&!c||!f||(e=new l(w.value.buffer).getUint32(0)),u.signature=e}))}}class ge extends p{constructor(e,{chunkSize:t,DecompressionStream:n,DecompressionStreamNative:r}){super({});const{zipCrypto:i,encrypted:o,signed:c,signature:f,compressed:a,useCompressionStream:u}=e;let w,h,d=ke(super.readable);o&&(i?d=ze(d,new fe(e)):(h=new ee(e),d=ze(d,h))),a&&(d=Se(d,u,{chunkSize:t},r,n)),o&&!i||!c||(w=new z,d=ze(d,w)),ve(this,d,(async()=>{if((!o||i)&&c){const e=new l(w.value.buffer);if(f!=e.getUint32(0,!1))throw new s(P)}}))}}function ke(e){return ze(e,new p({transform(e,t){e&&e.length&&t.enqueue(e)}}))}function ve(e,n,r){n=ze(n,new p({flush:r})),t.defineProperty(e,"readable",{get:()=>n})}function Se(e,t,n,r,s){try{e=ze(e,new(t&&r?r:s)(me,n))}catch(r){if(!t)throw r;e=ze(e,new s(me,n))}return e}function ze(e,t){return e.pipeThrough(t)}const Ce="data";class xe extends p{constructor(e,n){super({});const r=this,{codecType:s}=e;let i;s.startsWith("deflate")?i=be:s.startsWith("inflate")&&(i=ge);let o=0;const c=new i(e,n),f=super.readable,a=new p({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){const{signature:e}=c;t.assign(r,{signature:e,size:o})}});t.defineProperty(r,"readable",{get:()=>f.pipeThrough(c).pipeThrough(a)})}}const _e=new a,Ae=new a;let Ie=0;async function De(e){try{const{options:t,scripts:r,config:s}=e;r&&r.length&&importScripts.apply(void 0,r),self.initCodec&&self.initCodec(),s.CompressionStreamNative=self.CompressionStream,s.DecompressionStreamNative=self.DecompressionStream,self.Deflate&&(s.CompressionStream=new k(self.Deflate)),self.Inflate&&(s.DecompressionStream=new k(self.Inflate));const i={highWaterMark:1,size:()=>s.chunkSize},o=e.readable||new y({async pull(e){const t=new u((e=>_e.set(Ie,e)));Ve({type:"pull",messageId:Ie}),Ie=(Ie+1)%n.MAX_SAFE_INTEGER;const{value:r,done:s}=await t;e.enqueue(r),s&&e.close()}},i),c=e.writable||new m({async write(e){let t;const r=new u((e=>t=e));Ae.set(Ie,t),Ve({type:Ce,value:e,messageId:Ie}),Ie=(Ie+1)%n.MAX_SAFE_INTEGER,await r}},i),f=new xe(t,s);await o.pipeThrough(f).pipeTo(c,{preventClose:!0,preventAbort:!0});try{await c.getWriter().close()}catch(e){}const{signature:a,size:l}=f;Ve({type:"close",result:{signature:a,size:l}})}catch(e){Pe(e)}}function Ve(e){let{value:t}=e;if(t)if(t.length)try{t=new i(t),e.value=t.buffer,d(e,[e.value])}catch(t){d(e)}else d(e);else d(e)}function Pe(e){const{message:t,stack:n,code:r,name:s}=e;d({error:{message:t,stack:n,code:r,name:s}})}addEventListener("message",(({data:e})=>{const{type:t,messageId:n,value:r,done:s}=e;try{if("start"==t&&De(e),t==Ce){const e=_e.get(n);_e.delete(n),e({value:new i(r),done:s})}if("ack"==t){const e=Ae.get(n);Ae.delete(n),e()}}catch(e){Pe(e)}}));const Re=-2;function Be(t){return Ee(t.map((([t,n])=>new e(t).fill(n,0,t))))}function Ee(t){return t.reduce(((t,n)=>t.concat(e.isArray(n)?Ee(n):n)),[])}const Me=[0,1,2,3].concat(...Be([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function Ke(){const e=this;function t(e,t){let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}e.ne=n=>{const s=e.re,i=e.ie.se,o=e.ie.oe;let c,f,a,l=-1;for(n.ce=0,n.fe=573,c=0;o>c;c++)0!==s[2*c]?(n.ae[++n.ce]=l=c,n.le[c]=0):s[2*c+1]=0;for(;2>n.ce;)a=n.ae[++n.ce]=2>l?++l:0,s[2*a]=1,n.le[a]=0,n.ue--,i&&(n.we-=i[2*a+1]);for(e.he=l,c=r.floor(n.ce/2);c>=1;c--)n.de(s,c);a=o;do{c=n.ae[1],n.ae[1]=n.ae[n.ce--],n.de(s,1),f=n.ae[1],n.ae[--n.fe]=c,n.ae[--n.fe]=f,s[2*a]=s[2*c]+s[2*f],n.le[a]=r.max(n.le[c],n.le[f])+1,s[2*c+1]=s[2*f+1]=a,n.ae[1]=a++,n.de(s,1)}while(n.ce>=2);n.ae[--n.fe]=n.ae[1],(t=>{const n=e.re,r=e.ie.se,s=e.ie.pe,i=e.ie.ye,o=e.ie.me;let c,f,a,l,u,w,h=0;for(l=0;15>=l;l++)t.be[l]=0;for(n[2*t.ae[t.fe]+1]=0,c=t.fe+1;573>c;c++)f=t.ae[c],l=n[2*n[2*f+1]+1]+1,l>o&&(l=o,h++),n[2*f+1]=l,f>e.he||(t.be[l]++,u=0,i>f||(u=s[f-i]),w=n[2*f],t.ue+=w*(l+u),r&&(t.we+=w*(r[2*f+1]+u)));if(0!==h){do{for(l=o-1;0===t.be[l];)l--;t.be[l]--,t.be[l+1]+=2,t.be[o]--,h-=2}while(h>0);for(l=o;0!==l;l--)for(f=t.be[l];0!==f;)a=t.ae[--c],a>e.he||(n[2*a+1]!=l&&(t.ue+=(l-n[2*a+1])*n[2*a],n[2*a+1]=l),f--)}})(n),((e,n,r)=>{const s=[];let i,o,c,f=0;for(i=1;15>=i;i++)s[i]=f=f+r[i-1]<<1;for(o=0;n>=o;o++)c=e[2*o+1],0!==c&&(e[2*o]=t(s[c]++,c))})(s,e.he,n.be)}}function Ue(e,t,n,r,s){const i=this;i.se=e,i.pe=t,i.ye=n,i.oe=r,i.me=s}Ke.ge=[0,1,2,3,4,5,6,7].concat(...Be([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),Ke.ke=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],Ke.ve=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],Ke.Se=e=>256>e?Me[e]:Me[256+(e>>>7)],Ke.ze=[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],Ke.Ce=[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],Ke.xe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Ke._e=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];const Ne=Be([[144,8],[112,9],[24,7],[8,8]]);Ue.Ae=Ee([12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,167,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227].map(((e,t)=>[e,Ne[t]])));const Oe=Be([[30,5]]);function Te(e,t,n,r,s){const i=this;i.Ie=e,i.De=t,i.Ve=n,i.Pe=r,i.Re=s}Ue.Be=Ee([0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23].map(((e,t)=>[e,Oe[t]]))),Ue.Ee=new Ue(Ue.Ae,Ke.ze,257,286,15),Ue.Me=new Ue(Ue.Be,Ke.Ce,0,30,15),Ue.Ke=new Ue(null,Ke.xe,0,19,7);const We=[new Te(0,0,0,0,0),new Te(4,4,8,4,1),new Te(4,5,16,8,1),new Te(4,6,32,32,1),new Te(4,4,16,16,2),new Te(8,16,32,32,2),new Te(8,16,128,128,2),new Te(8,32,128,256,2),new Te(32,128,258,1024,2),new Te(32,258,258,4096,2)],je=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],He=113,Le=666,Fe=262;function qe(e,t,n,r){const s=e[2*t],i=e[2*n];return i>s||s==i&&r[t]<=r[n]}function Ge(){const e=this;let t,n,s,c,f,a,l,u,w,h,d,p,y,m,b,g,k,v,S,z,C,x,_,A,I,D,V,P,R,B,E,M,K;const U=new Ke,N=new Ke,O=new Ke;let T,W,j,H,L,F;function q(){let t;for(t=0;286>t;t++)E[2*t]=0;for(t=0;30>t;t++)M[2*t]=0;for(t=0;19>t;t++)K[2*t]=0;E[512]=1,e.ue=e.we=0,W=j=0}function G(e,t){let n,r=-1,s=e[1],i=0,o=7,c=4;0===s&&(o=138,c=3),e[2*(t+1)+1]=65535;for(let f=0;t>=f;f++)n=s,s=e[2*(f+1)+1],++ii?K[2*n]+=i:0!==n?(n!=r&&K[2*n]++,K[32]++):i>10?K[36]++:K[34]++,i=0,r=n,0===s?(o=138,c=3):n==s?(o=6,c=3):(o=7,c=4))}function J(t){e.Ue[e.pending++]=t}function Q(e){J(255&e),J(e>>>8&255)}function X(e,t){let n;const r=t;F>16-r?(n=e,L|=n<>>16-F,F+=r-16):(L|=e<=n;n++)if(r=i,i=e[2*(n+1)+1],++o>=c||r!=i){if(f>o)do{Y(r,K)}while(0!=--o);else 0!==r?(r!=s&&(Y(r,K),o--),Y(16,K),X(o-3,2)):o>10?(Y(18,K),X(o-11,7)):(Y(17,K),X(o-3,3));o=0,s=r,0===i?(c=138,f=3):r==i?(c=6,f=3):(c=7,f=4)}}function $(){16==F?(Q(L),L=0,F=0):8>F||(J(255&L),L>>>=8,F-=8)}function ee(t,n){let s,i,o;if(e.Ne[W]=t,e.Oe[W]=255&n,W++,0===t?E[2*n]++:(j++,t--,E[2*(Ke.ge[n]+256+1)]++,M[2*Ke.Se(t)]++),0==(8191&W)&&V>2){for(s=8*W,i=C-k,o=0;30>o;o++)s+=M[2*o]*(5+Ke.Ce[o]);if(s>>>=3,jc);Y(256,t),H=t[513]}function ne(){F>8?Q(L):F>0&&J(255&L),L=0,F=0}function re(t,n,r){X(0+(r?1:0),3),((t,n)=>{ne(),H=8,Q(n),Q(~n),e.Ue.set(u.subarray(t,t+n),e.pending),e.pending+=n})(t,n)}function se(n){((t,n,r)=>{let s,i,o=0;V>0?(U.ne(e),N.ne(e),o=(()=>{let t;for(G(E,U.he),G(M,N.he),O.ne(e),t=18;t>=3&&0===K[2*Ke._e[t]+1];t--);return e.ue+=14+3*(t+1),t})(),s=e.ue+3+7>>>3,i=e.we+3+7>>>3,i>s||(s=i)):s=i=n+5,n+4>s||-1==t?i==s?(X(2+(r?1:0),3),te(Ue.Ae,Ue.Be)):(X(4+(r?1:0),3),((e,t,n)=>{let r;for(X(e-257,5),X(t-1,5),X(n-4,4),r=0;n>r;r++)X(K[2*Ke._e[r]+1],3);Z(E,e-1),Z(M,t-1)})(U.he+1,N.he+1,o+1),te(E,M)):re(t,n,r),q(),r&&ne()})(0>k?-1:k,C-k,n),k=C,t.Te()}function ie(){let e,n,r,s;do{if(s=w-_-C,0===s&&0===C&&0===_)s=f;else if(-1==s)s--;else if(C>=f+f-Fe){u.set(u.subarray(f,f+f),0),x-=f,C-=f,k-=f,e=y,r=e;do{n=65535&d[--r],d[r]=f>n?0:n-f}while(0!=--e);e=f,r=e;do{n=65535&h[--r],h[r]=f>n?0:n-f}while(0!=--e);s+=f}if(0===t.We)return;e=t.je(u,C+_,s),_+=e,3>_||(p=255&u[C],p=(p<_&&0!==t.We)}function oe(e){let t,n,r=I,s=C,i=A;const o=C>f-Fe?C-(f-Fe):0;let c=B;const a=l,w=C+258;let d=u[s+i-1],p=u[s+i];R>A||(r>>=2),c>_&&(c=_);do{if(t=e,u[t+i]==p&&u[t+i-1]==d&&u[t]==u[s]&&u[++t]==u[s+1]){s+=2,t++;do{}while(u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&u[++s]==u[++t]&&w>s);if(n=258-(w-s),s=w-258,n>i){if(x=e,i=n,n>=c)break;d=u[s+i-1],p=u[s+i]}}}while((e=65535&h[e&a])>o&&0!=--r);return i>_?_:i}e.le=[],e.be=[],e.ae=[],E=[],M=[],K=[],e.de=(t,n)=>{const r=e.ae,s=r[n];let i=n<<1;for(;i<=e.ce&&(i(W||(W=8),j||(j=8),G||(G=0),t.Le=null,-1==S&&(S=6),1>j||j>9||8!=W||9>x||x>15||0>S||S>9||0>G||G>2?Re:(t.Fe=e,a=x,f=1<(t.qe=t.Ge=0,t.Le=null,e.pending=0,e.Je=0,n=He,c=0,U.re=E,U.ie=Ue.Ee,N.re=M,N.ie=Ue.Me,O.re=K,O.ie=Ue.Ke,L=0,F=0,H=8,q(),(()=>{w=2*f,d[y-1]=0;for(let e=0;y-1>e;e++)d[e]=0;D=We[V].De,R=We[V].Ie,B=We[V].Ve,I=We[V].Pe,C=0,k=0,_=0,v=A=2,z=0,p=0})(),0))(t))),e.Qe=()=>42!=n&&n!=He&&n!=Le?Re:(e.Oe=null,e.Ne=null,e.Ue=null,d=null,h=null,u=null,e.Fe=null,n==He?-3:0),e.Xe=(e,t,n)=>{let r=0;return-1==t&&(t=6),0>t||t>9||0>n||n>2?Re:(We[V].Re!=We[t].Re&&0!==e.qe&&(r=e.Ye(1)),V!=t&&(V=t,D=We[V].De,R=We[V].Ie,B=We[V].Ve,I=We[V].Pe),P=n,r)},e.Ze=(e,t,r)=>{let s,i=r,o=0;if(!t||42!=n)return Re;if(3>i)return 0;for(i>f-Fe&&(i=f-Fe,o=r-i),u.set(t.subarray(o,o+i),0),C=i,k=i,p=255&u[0],p=(p<=s;s++)p=(p<{let o,w,m,I,R;if(i>4||0>i)return Re;if(!r.$e||!r.et&&0!==r.We||n==Le&&4!=i)return r.Le=je[4],Re;if(0===r.tt)return r.Le=je[7],-5;var B;if(t=r,I=c,c=i,42==n&&(w=8+(a-8<<4)<<8,m=(V-1&255)>>1,m>3&&(m=3),w|=m<<6,0!==C&&(w|=32),w+=31-w%31,n=He,J((B=w)>>8&255),J(255&B)),0!==e.pending){if(t.Te(),0===t.tt)return c=-1,0}else if(0===t.We&&I>=i&&4!=i)return t.Le=je[7],-5;if(n==Le&&0!==t.We)return r.Le=je[7],-5;if(0!==t.We||0!==_||0!=i&&n!=Le){switch(R=-1,We[V].Re){case 0:R=(e=>{let n,r=65535;for(r>s-5&&(r=s-5);;){if(1>=_){if(ie(),0===_&&0==e)return 0;if(0===_)break}if(C+=_,_=0,n=k+r,(0===C||C>=n)&&(_=C-n,C=n,se(!1),0===t.tt))return 0;if(C-k>=f-Fe&&(se(!1),0===t.tt))return 0}return se(4==e),0===t.tt?4==e?2:0:4==e?3:1})(i);break;case 1:R=(e=>{let n,r=0;for(;;){if(Fe>_){if(ie(),Fe>_&&0==e)return 0;if(0===_)break}if(3>_||(p=(p<f-Fe||2!=P&&(v=oe(r)),3>v)n=ee(0,255&u[C]),_--,C++;else if(n=ee(C-x,v-3),_-=v,v>D||3>_)C+=v,v=0,p=255&u[C],p=(p<{let n,r,s=0;for(;;){if(Fe>_){if(ie(),Fe>_&&0==e)return 0;if(0===_)break}if(3>_||(p=(p<A&&f-Fe>=(C-s&65535)&&(2!=P&&(v=oe(s)),5>=v&&(1==P||3==v&&C-x>4096)&&(v=2)),3>A||v>A)if(0!==z){if(n=ee(0,255&u[C-1]),n&&se(!1),C++,_--,0===t.tt)return 0}else z=1,C++,_--;else{r=C+_-3,n=ee(C-1-S,A-3),_-=A-1,A-=2;do{++C>r||(p=(p<1+H+10-F&&(X(2,3),Y(256,Ue.Ae),$()),H=7;else if(re(0,0,!1),3==i)for(o=0;y>o;o++)d[o]=0;if(t.Te(),0===t.tt)return c=-1,0}}return 4!=i?0:1}}function Je(){const e=this;e.nt=0,e.rt=0,e.We=0,e.qe=0,e.tt=0,e.Ge=0}function Qe(e){const t=new Je,n=(o=e&&e.chunkSize?e.chunkSize:65536)+5*(r.floor(o/16383)+1);var o;const c=new i(n);let f=e?e.level:-1;void 0===f&&(f=-1),t.He(f),t.$e=c,this.append=(e,r)=>{let o,f,a=0,l=0,u=0;const w=[];if(e.length){t.nt=0,t.et=e,t.We=e.length;do{if(t.rt=0,t.tt=n,o=t.Ye(0),0!=o)throw new s("deflating: "+t.Le);t.rt&&(t.rt==n?w.push(new i(c)):w.push(c.subarray(0,t.rt))),u+=t.rt,r&&t.nt>0&&t.nt!=a&&(r(t.nt),a=t.nt)}while(t.We>0||0===t.tt);return w.length>1?(f=new i(u),w.forEach((e=>{f.set(e,l),l+=e.length}))):f=w[0]?new i(w[0]):new i,f}},this.flush=()=>{let e,r,o=0,f=0;const a=[];do{if(t.rt=0,t.tt=n,e=t.Ye(4),1!=e&&0!=e)throw new s("deflating: "+t.Le);n-t.tt>0&&a.push(c.slice(0,t.rt)),f+=t.rt}while(t.We>0||0===t.tt);return t.Qe(),r=new i(f),a.forEach((e=>{r.set(e,o),o+=e.length})),r}}Je.prototype={He(e,t){const n=this;return n.Fe=new Ge,t||(t=15),n.Fe.He(n,e,t)},Ye(e){const t=this;return t.Fe?t.Fe.Ye(t,e):Re},Qe(){const e=this;if(!e.Fe)return Re;const t=e.Fe.Qe();return e.Fe=null,t},Xe(e,t){const n=this;return n.Fe?n.Fe.Xe(n,e,t):Re},Ze(e,t){const n=this;return n.Fe?n.Fe.Ze(n,e,t):Re},je(e,t,n){const r=this;let s=r.We;return s>n&&(s=n),0===s?0:(r.We-=s,e.set(r.et.subarray(r.nt,r.nt+s),t),r.nt+=s,r.qe+=s,s)},Te(){const e=this;let t=e.Fe.pending;t>e.tt&&(t=e.tt),0!==t&&(e.$e.set(e.Fe.Ue.subarray(e.Fe.Je,e.Fe.Je+t),e.rt),e.rt+=t,e.Fe.Je+=t,e.Ge+=t,e.tt-=t,e.Fe.pending-=t,0===e.Fe.pending&&(e.Fe.Je=0))}};const Xe=-2,Ye=-3,Ze=-5,$e=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],et=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],tt=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],nt=[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],rt=[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,112,112],st=[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],it=[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];function ot(){let e,t,n,r,s,i;function o(e,t,o,c,f,a,l,u,w,h,d){let p,y,m,b,g,k,v,S,z,C,x,_,A,I,D;C=0,g=o;do{n[e[t+C]]++,C++,g--}while(0!==g);if(n[0]==o)return l[0]=-1,u[0]=0,0;for(S=u[0],k=1;15>=k&&0===n[k];k++);for(v=k,k>S&&(S=k),g=15;0!==g&&0===n[g];g--);for(m=g,S>g&&(S=g),u[0]=S,I=1<k;k++,I<<=1)if(0>(I-=n[k]))return Ye;if(0>(I-=n[g]))return Ye;for(n[g]+=I,i[1]=k=0,C=1,A=2;0!=--g;)i[A]=k+=n[C],A++,C++;g=0,C=0;do{0!==(k=e[t+C])&&(d[i[k]++]=g),C++}while(++g=v;v++)for(p=n[v];0!=p--;){for(;v>_+S;){if(b++,_+=S,D=m-_,D=D>S?S:D,(y=1<<(k=v-_))>p+1&&(y-=p+1,A=v,D>k))for(;++kn[++A];)y-=n[A];if(D=1<1440)return Ye;s[b]=x=h[0],h[0]+=D,0!==b?(i[b]=g,r[0]=k,r[1]=S,k=g>>>_-S,r[2]=x-s[b-1]-k,w.set(r,3*(s[b-1]+k))):l[0]=x}for(r[1]=v-_,o>C?d[C]d[C]?0:96,r[2]=d[C++]):(r[0]=a[d[C]-c]+16+64,r[2]=f[d[C++]-c]):r[0]=192,y=1<>>_;D>k;k+=y)w.set(r,3*(x+k));for(k=1<>>=1)g^=k;for(g^=k,z=(1<<_)-1;(g&z)!=i[b];)b--,_-=S,z=(1<<_)-1}return 0!==I&&1!=m?Ze:0}function c(o){let c;for(e||(e=[],t=[],n=new f(16),r=[],s=new f(15),i=new f(16)),t.lengthc;c++)t[c]=0;for(c=0;16>c;c++)n[c]=0;for(c=0;3>c;c++)r[c]=0;s.set(n.subarray(0,15),0),i.set(n.subarray(0,16),0)}this.st=(n,r,s,i,f)=>{let a;return c(19),e[0]=0,a=o(n,0,19,19,null,null,s,r,i,e,t),a==Ye?f.Le="oversubscribed dynamic bit lengths tree":a!=Ze&&0!==r[0]||(f.Le="incomplete dynamic bit lengths tree",a=Ye),a},this.it=(n,r,s,i,f,a,l,u,w)=>{let h;return c(288),e[0]=0,h=o(s,0,n,257,nt,rt,a,i,u,e,t),0!=h||0===i[0]?(h==Ye?w.Le="oversubscribed literal/length tree":-4!=h&&(w.Le="incomplete literal/length tree",h=Ye),h):(c(288),h=o(s,n,r,0,st,it,l,f,u,e,t),0!=h||0===f[0]&&n>257?(h==Ye?w.Le="oversubscribed distance tree":h==Ze?(w.Le="incomplete distance tree",h=Ye):-4!=h&&(w.Le="empty distance tree with lengths",h=Ye),h):0)}}function ct(){const e=this;let t,n,r,s,i=0,o=0,c=0,f=0,a=0,l=0,u=0,w=0,h=0,d=0;function p(e,t,n,r,s,i,o,c){let f,a,l,u,w,h,d,p,y,m,b,g,k,v,S,z;d=c.nt,p=c.We,w=o.ot,h=o.ct,y=o.write,m=yh;)p--,w|=(255&c.ft(d++))<>=a[z+1],h-=a[z+1],0!=(16&u)){for(u&=15,k=a[z+2]+(w&$e[u]),w>>=u,h-=u;15>h;)p--,w|=(255&c.ft(d++))<>=a[z+1],h-=a[z+1],0!=(16&u)){for(u&=15;u>h;)p--,w|=(255&c.ft(d++))<>=u,h-=u,m-=k,v>y){S=y-v;do{S+=o.end}while(0>S);if(u=o.end-S,k>u){if(k-=u,y-S>0&&u>y-S)do{o.lt[y++]=o.lt[S++]}while(0!=--u);else o.lt.set(o.lt.subarray(S,S+u),y),y+=u,S+=u,u=0;S=0}}else S=y-v,y-S>0&&2>y-S?(o.lt[y++]=o.lt[S++],o.lt[y++]=o.lt[S++],k-=2):(o.lt.set(o.lt.subarray(S,S+2),y),y+=2,S+=2,k-=2);if(y-S>0&&k>y-S)do{o.lt[y++]=o.lt[S++]}while(0!=--k);else o.lt.set(o.lt.subarray(S,S+k),y),y+=k,S+=k,k=0;break}if(0!=(64&u))return c.Le="invalid distance code",k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,Ye;f+=a[z+2],f+=w&$e[u],z=3*(l+f),u=a[z]}break}if(0!=(64&u))return 0!=(32&u)?(k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,1):(c.Le="invalid literal/length code",k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,Ye);if(f+=a[z+2],f+=w&$e[u],z=3*(l+f),0===(u=a[z])){w>>=a[z+1],h-=a[z+1],o.lt[y++]=a[z+2],m--;break}}else w>>=a[z+1],h-=a[z+1],o.lt[y++]=a[z+2],m--}while(m>=258&&p>=10);return k=c.We-p,k=k>h>>3?h>>3:k,p+=k,d-=k,h-=k<<3,o.ot=w,o.ct=h,c.We=p,c.qe+=d-c.nt,c.nt=d,o.write=y,0}e.init=(e,i,o,c,f,a)=>{t=0,u=e,w=i,r=o,h=c,s=f,d=a,n=null},e.ut=(e,y,m)=>{let b,g,k,v,S,z,C,x=0,_=0,A=0;for(A=y.nt,v=y.We,x=e.ot,_=e.ct,S=e.write,z=S=258&&v>=10&&(e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,m=p(u,w,r,h,s,d,e,y),A=y.nt,v=y.We,x=e.ot,_=e.ct,S=e.write,z=S_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}if(g=3*(o+(x&$e[b])),x>>>=n[g+1],_-=n[g+1],k=n[g],0===k){f=n[g+2],t=6;break}if(0!=(16&k)){a=15&k,i=n[g+2],t=2;break}if(0==(64&k)){c=k,o=g/3+n[g+2];break}if(0!=(32&k)){t=7;break}return t=9,y.Le="invalid literal/length code",m=Ye,e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);case 2:for(b=a;b>_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}i+=x&$e[b],x>>=b,_-=b,c=w,n=s,o=d,t=3;case 3:for(b=c;b>_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}if(g=3*(o+(x&$e[b])),x>>=n[g+1],_-=n[g+1],k=n[g],0!=(16&k)){a=15&k,l=n[g+2],t=4;break}if(0==(64&k)){c=k,o=g/3+n[g+2];break}return t=9,y.Le="invalid distance code",m=Ye,e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);case 4:for(b=a;b>_;){if(0===v)return e.ot=x,e.ct=_,y.We=v,y.qe+=A-y.nt,y.nt=A,e.write=S,e.wt(y,m);m=0,v--,x|=(255&y.ft(A++))<<_,_+=8}l+=x&$e[b],x>>=b,_-=b,t=5;case 5:for(C=S-l;0>C;)C+=e.end;for(;0!==i;){if(0===z&&(S==e.end&&0!==e.read&&(S=0,z=S7&&(_-=8,v++,A--),e.write=S,m=e.wt(y,m),S=e.write,z=S{}}ot.dt=(e,t,n,r)=>(e[0]=9,t[0]=5,n[0]=et,r[0]=tt,0);const ft=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function at(e,t){const n=this;let r,s=0,o=0,c=0,a=0;const l=[0],u=[0],w=new ct;let h=0,d=new f(4320);const p=new ot;n.ct=0,n.ot=0,n.lt=new i(t),n.end=t,n.read=0,n.write=0,n.reset=(e,t)=>{t&&(t[0]=0),6==s&&w.ht(e),s=0,n.ct=0,n.ot=0,n.read=n.write=0},n.reset(e,null),n.wt=(e,t)=>{let r,s,i;return s=e.rt,i=n.read,r=(i>n.write?n.end:n.write)-i,r>e.tt&&(r=e.tt),0!==r&&t==Ze&&(t=0),e.tt-=r,e.Ge+=r,e.$e.set(n.lt.subarray(i,i+r),s),s+=r,i+=r,i==n.end&&(i=0,n.write==n.end&&(n.write=0),r=n.write-i,r>e.tt&&(r=e.tt),0!==r&&t==Ze&&(t=0),e.tt-=r,e.Ge+=r,e.$e.set(n.lt.subarray(i,i+r),s),s+=r,i+=r),e.rt=s,n.read=i,t},n.ut=(e,t)=>{let i,f,y,m,b,g,k,v;for(m=e.nt,b=e.We,f=n.ot,y=n.ct,g=n.write,k=gy;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>1){case 0:f>>>=3,y-=3,i=7&y,f>>>=i,y-=i,s=1;break;case 1:S=[],z=[],C=[[]],x=[[]],ot.dt(S,z,C,x),w.init(S[0],z[0],C[0],0,x[0],0),f>>>=3,y-=3,s=6;break;case 2:f>>>=3,y-=3,s=3;break;case 3:return f>>>=3,y-=3,s=9,e.Le="invalid block type",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t)}break;case 1:for(;32>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>16&65535)!=(65535&f))return s=9,e.Le="invalid stored block lengths",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);o=65535&f,f=y=0,s=0!==o?2:0!==h?7:0;break;case 2:if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);if(0===k&&(g==n.end&&0!==n.read&&(g=0,k=gb&&(i=b),i>k&&(i=k),n.lt.set(e.je(m,i),g),m+=i,b-=i,g+=i,k-=i,0!=(o-=i))break;s=0!==h?7:0;break;case 3:for(;14>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<29||(i>>5&31)>29)return s=9,e.Le="too many length or distance symbols",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);if(i=258+(31&i)+(i>>5&31),!r||r.lengthv;v++)r[v]=0;f>>>=14,y-=14,a=0,s=4;case 4:for(;4+(c>>>10)>a;){for(;3>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>=3,y-=3}for(;19>a;)r[ft[a++]]=0;if(l[0]=7,i=p.st(r,l,u,d,e),0!=i)return(t=i)==Ye&&(r=null,s=9),n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);a=0,s=5;case 5:for(;i=c,258+(31&i)+(i>>5&31)>a;){let o,w;for(i=l[0];i>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<w)f>>>=i,y-=i,r[a++]=w;else{for(v=18==w?7:w-14,o=18==w?11:3;i+v>y;){if(0===b)return n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);t=0,b--,f|=(255&e.ft(m++))<>>=i,y-=i,o+=f&$e[v],f>>>=v,y-=v,v=a,i=c,v+o>258+(31&i)+(i>>5&31)||16==w&&1>v)return r=null,s=9,e.Le="invalid bit length repeat",t=Ye,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);w=16==w?r[v-1]:0;do{r[v++]=w}while(0!=--o);a=v}}if(u[0]=-1,_=[],A=[],I=[],D=[],_[0]=9,A[0]=6,i=c,i=p.it(257+(31&i),1+(i>>5&31),r,_,A,I,D,d,e),0!=i)return i==Ye&&(r=null,s=9),t=i,n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,n.wt(e,t);w.init(_[0],A[0],d,I[0],d,D[0]),s=6;case 6:if(n.ot=f,n.ct=y,e.We=b,e.qe+=m-e.nt,e.nt=m,n.write=g,1!=(t=w.ut(n,e,t)))return n.wt(e,t);if(t=0,w.ht(e),m=e.nt,b=e.We,f=n.ot,y=n.ct,g=n.write,k=g{n.reset(e,null),n.lt=null,d=null},n.yt=(e,t,r)=>{n.lt.set(e.subarray(t,t+r),0),n.read=n.write=r},n.bt=()=>1==s?1:0}const lt=13,ut=[0,0,255,255];function wt(){const e=this;function t(e){return e&&e.gt?(e.qe=e.Ge=0,e.Le=null,e.gt.mode=7,e.gt.kt.reset(e,null),0):Xe}e.mode=0,e.method=0,e.vt=[0],e.St=0,e.marker=0,e.zt=0,e.Ct=t=>(e.kt&&e.kt.ht(t),e.kt=null,0),e.xt=(n,r)=>(n.Le=null,e.kt=null,8>r||r>15?(e.Ct(n),Xe):(e.zt=r,n.gt.kt=new at(n,1<{let n,r;if(!e||!e.gt||!e.et)return Xe;const s=e.gt;for(t=4==t?Ze:0,n=Ze;;)switch(s.mode){case 0:if(0===e.We)return n;if(n=t,e.We--,e.qe++,8!=(15&(s.method=e.ft(e.nt++)))){s.mode=lt,e.Le="unknown compression method",s.marker=5;break}if(8+(s.method>>4)>s.zt){s.mode=lt,e.Le="invalid win size",s.marker=5;break}s.mode=1;case 1:if(0===e.We)return n;if(n=t,e.We--,e.qe++,r=255&e.ft(e.nt++),((s.method<<8)+r)%31!=0){s.mode=lt,e.Le="incorrect header check",s.marker=5;break}if(0==(32&r)){s.mode=7;break}s.mode=2;case 2:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St=(255&e.ft(e.nt++))<<24&4278190080,s.mode=3;case 3:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St+=(255&e.ft(e.nt++))<<16&16711680,s.mode=4;case 4:if(0===e.We)return n;n=t,e.We--,e.qe++,s.St+=(255&e.ft(e.nt++))<<8&65280,s.mode=5;case 5:return 0===e.We?n:(n=t,e.We--,e.qe++,s.St+=255&e.ft(e.nt++),s.mode=6,2);case 6:return s.mode=lt,e.Le="need dictionary",s.marker=0,Xe;case 7:if(n=s.kt.ut(e,n),n==Ye){s.mode=lt,s.marker=0;break}if(0==n&&(n=t),1!=n)return n;n=t,s.kt.reset(e,s.vt),s.mode=12;case 12:return e.We=0,1;case lt:return Ye;default:return Xe}},e.At=(e,t,n)=>{let r=0,s=n;if(!e||!e.gt||6!=e.gt.mode)return Xe;const i=e.gt;return s<1<{let n,r,s,i,o;if(!e||!e.gt)return Xe;const c=e.gt;if(c.mode!=lt&&(c.mode=lt,c.marker=0),0===(n=e.We))return Ze;for(r=e.nt,s=c.marker;0!==n&&4>s;)e.ft(r)==ut[s]?s++:s=0!==e.ft(r)?0:4-s,r++,n--;return e.qe+=r-e.nt,e.nt=r,e.We=n,c.marker=s,4!=s?Ye:(i=e.qe,o=e.Ge,t(e),e.qe=i,e.Ge=o,c.mode=7,0)},e.Dt=e=>e&&e.gt&&e.gt.kt?e.gt.kt.bt():Xe}function ht(){}function dt(e){const t=new ht,n=e&&e.chunkSize?r.floor(2*e.chunkSize):131072,o=new i(n);let c=!1;t.xt(),t.$e=o,this.append=(e,r)=>{const f=[];let a,l,u=0,w=0,h=0;if(0!==e.length){t.nt=0,t.et=e,t.We=e.length;do{if(t.rt=0,t.tt=n,0!==t.We||c||(t.nt=0,c=!0),a=t._t(0),c&&a===Ze){if(0!==t.We)throw new s("inflating: bad input")}else if(0!==a&&1!==a)throw new s("inflating: "+t.Le);if((c||1===a)&&t.We===e.length)throw new s("inflating: bad input");t.rt&&(t.rt===n?f.push(new i(o)):f.push(o.subarray(0,t.rt))),h+=t.rt,r&&t.nt>0&&t.nt!=u&&(r(t.nt),u=t.nt)}while(t.We>0||0===t.tt);return f.length>1?(l=new i(h),f.forEach((e=>{l.set(e,w),w+=e.length}))):l=f[0]?new i(f[0]):new i,l}},this.flush=()=>{t.Ct()}}ht.prototype={xt(e){const t=this;return t.gt=new wt,e||(e=15),t.gt.xt(t,e)},_t(e){const t=this;return t.gt?t.gt._t(t,e):Xe},Ct(){const e=this;if(!e.gt)return Xe;const t=e.gt.Ct(e);return e.gt=null,t},It(){const e=this;return e.gt?e.gt.It(e):Xe},At(e,t){const n=this;return n.gt?n.gt.At(n,e,t):Xe},ft(e){return this.et[e]},je(e,t){return this.et.subarray(e,e+t)}},self.initCodec=()=>{self.Deflate=Qe,self.Inflate=dt}; +`],{type:"text/javascript"}));n({workerScripts:{inflate:[t],deflate:[t]}})}Dl(Ni);var K=Kt.Platform.isDesktopApp?window.require("node:original-fs"):null,Pe=Kt.Platform.isDesktopApp?K.promises:null,Xt=Kt.Platform.isDesktopApp?window.require("node:os"):null,q=Kt.Platform.isDesktopApp?window.require("node:path"):null,Jn=Kt.Platform.isDesktopApp?window.require("node:url"):null,Cl=Kt.Platform.isDesktopApp?window.require("node:zlib"):null;function Zi(n,t=0,e=n.byteLength){return n.buffer.slice(n.byteOffset+t,n.byteOffset+t+e)}var Me=class{constructor(t){this.type="file";this.filepath=t;let e=this.name=q.basename(t);this.fullpath=e;let i=q.extname(e);this.extension=i.substring(1).toLowerCase(),this.basename=q.basename(e,i)}async readText(){return Pe.readFile(this.filepath,"utf8")}async read(){let t=await Pe.readFile(this.filepath);return Zi(t)}async readZip(t){let e=null;try{e=await Pe.open(this.filepath,"r");let i=await e.stat();return await t(new Vt(new No(e,i.size)))}finally{await(e==null?void 0:e.close())}}createReadStream(){return K.createReadStream(this.filepath)}toString(){return this.filepath}},ut=class{constructor(t){this.type="folder";this.filepath=t,this.name=q.basename(t)}async list(){let{filepath:t}=this,e=await Pe.readdir(t,{withFileTypes:!0}),i=[];for(let r of e)r.isFile()?i.push(new Me(q.join(t,r.name))):r.isDirectory()&&i.push(new ut(q.join(t,r.name)));return i}toString(){return this.filepath}},Wi=class{constructor(t){this.type="file";this.file=t;let e=this.name=t.name;this.fullpath=e;let{basename:i,extension:r}=re(e);this.basename=i,this.extension=r}readText(){let{file:t}=this;return t.text?t.text():new Promise((e,i)=>{let r=new FileReader;r.addEventListener("load",()=>e(r.result)),r.addEventListener("error",i),r.readAsText(this.file)})}async read(){let{file:t}=this;return t.arrayBuffer?t.arrayBuffer():new Promise((e,i)=>{let r=new FileReader;r.addEventListener("load",()=>e(r.result)),r.addEventListener("error",i),r.readAsArrayBuffer(this.file)})}async readZip(t){return t(new Vt(new St(this.file)))}toString(){return this.file.toString()}};async function So(n,t){let e=[];for(let i of n)try{i.type==="folder"?e.push(...await So(await i.list(),t)):i.type==="file"&&(!t||t(i))&&e.push(i)}catch(r){console.log("Skipping path: ",i.name,r)}return e}function re(n){let t=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\")),e=n,i="";t>=0&&(e=n.substring(t+1),i=n.substring(0,t));let[r,o]=Ro(e);return{parent:i,name:e,basename:r,extension:o}}function Ro(n){let t=n.lastIndexOf("."),e=n,i="";return t>0&&(e=n.substring(0,t),i=n.substring(t+1).toLowerCase()),[e,i]}var No=class extends yn{constructor(e,i){super(e);this.fd=e,this.size=i}async readUint8Array(e,i){let r=Buffer.alloc(i),o=await this.fd.read(r,0,i,e);return new Uint8Array(Zi(r,0,o.bytesRead))}};var Il=require("obsidian"),Vm=/[\/\?<>\\:\*\|"]/g,Km=/[\x00-\x1f\x80-\x9f]/g,Xm=/^\.+$/,Jm=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Qm=/[\. ]+$/,eh=/^\./,th=/[\[\]#|^]/g;function Ze(n){return n.replace(Vm,"").replace(Km,"").replace(Xm,"").replace(Jm,"").replace(Qm,"").replace(eh,"").replace(th,"")}function xn(n){let t=[];for(let e=0;ea.setButtonText(i?"Choose files":"Choose file").onClick(async()=>{if(Re.Platform.isDesktopApp){let s=["openFile","dontAddToRecent"];i&&s.push("multiSelections");let l=window.electron.remote.dialog.showOpenDialogSync({title:"Pick files to import",properties:s,filters:[{name:t,extensions:e}]});l&&l.length>0&&(this.files=l.map(c=>new Me(c)),o())}else{let s=createEl("input");s.type="file",s.accept=e.map(l=>"."+l.toLowerCase()).join(","),s.addEventListener("change",()=>{if(!s.files)return;let l=Array.from(s.files);l.length>0&&(this.files=l.map(c=>new Wi(c)).filter(c=>e.contains(c.extension)),o())}),s.click()}}));i&&Re.Platform.isDesktopApp&&r.addButton(a=>a.setButtonText("Choose folders").onClick(async()=>{if(Re.Platform.isDesktopApp){let s=window.electron.remote.dialog.showOpenDialogSync({title:"Pick folders to import",properties:["openDirectory","multiSelections","dontAddToRecent"]});if(s&&s.length>0){r.setDesc("Reading folders...");let l=s.map(c=>new ut(c));this.files=await So(l,c=>e.contains(c.extension)),o()}}}));let o=()=>{let a=document.createDocumentFragment(),s=this.files.length,l=this.files.map(c=>c.name).join(", ");l.length>Fl&&(l=l.substring(0,Fl)+"..."),a.createEl("span",{text:`These ${s} files will be imported: `}),a.createEl("br"),a.createEl("span",{cls:"u-pop",text:l}),r.setDesc(a)}}addOutputLocationSetting(t){this.outputLocation=t,new Re.Setting(this.modal.contentEl).setName("Output folder").setDesc("Choose a folder in the vault to put the imported files. Leave empty to output to vault root.").addText(e=>e.setValue(t).onChange(i=>this.outputLocation=i))}async getOutputFolder(){let{vault:t}=this.app,e=this.outputLocation;e===""&&(e="/");let i=t.getAbstractFileByPath(e);return(i===null||!(i instanceof Re.TFolder))&&(await t.createFolder(e),i=t.getAbstractFileByPath(e)),i instanceof Re.TFolder?i:null}async createFolders(t){let e=t.split("/").map(o=>o.replace(/^\.+/,"")).join("/"),i=(0,Re.normalizePath)(e),r=this.vault.getAbstractFileByPathInsensitive(i);if(r&&r instanceof Re.TFolder)return r;if(await this.vault.createFolder(i),r=this.vault.getAbstractFileByPathInsensitive(i),!(r instanceof Re.TFolder))throw new Error(`Failed to create folder at "${t}"`);return r}async saveAsMarkdownFile(t,e,i){let r=Ze(e);return await this.app.fileManager.createNewMarkdownFile(t,r,i)}};var qp=ns(Ip());var ka=require("obsidian");var Fp=n=>{let e=gr.execSync(`${n} --version`).toString().toString().match(/(\d+)\.(\d+).(\d+)/);return(e==null?void 0:e[1])>3||(e==null?void 0:e[2])>32},Lp=n=>{let t=[];if(!n)return t;let e=[],i=0,r=-1,o={};for(;ia.setButtonText(i?"Choose files":"Choose file").onClick(async()=>{if(Re.Platform.isDesktopApp){let s=["openFile","dontAddToRecent"];i&&s.push("multiSelections");let l=window.electron.remote.dialog.showOpenDialogSync({title:"Pick files to import",properties:s,filters:[{name:t,extensions:e}]});l&&l.length>0&&(this.files=l.map(c=>new Me(c)),o())}else{let s=createEl("input");s.type="file",s.accept=e.map(l=>"."+l.toLowerCase()).join(","),s.addEventListener("change",()=>{if(!s.files)return;let l=Array.from(s.files);l.length>0&&(this.files=l.map(c=>new Wi(c)).filter(c=>e.contains(c.extension)),o())}),s.click()}}));i&&Re.Platform.isDesktopApp&&r.addButton(a=>a.setButtonText("Choose folders").onClick(async()=>{if(Re.Platform.isDesktopApp){let s=window.electron.remote.dialog.showOpenDialogSync({title:"Pick folders to import",properties:["openDirectory","multiSelections","dontAddToRecent"]});if(s&&s.length>0){r.setDesc("Reading folders...");let l=s.map(c=>new ut(c));this.files=await So(l,c=>e.contains(c.extension)),o()}}}));let o=()=>{let a=document.createDocumentFragment(),s=this.files.length,l=this.files.map(c=>c.name).join(", ");l.length>Fl&&(l=l.substring(0,Fl)+"..."),a.createEl("span",{text:`These ${s} files will be imported: `}),a.createEl("br"),a.createEl("span",{cls:"u-pop",text:l}),r.setDesc(a)}}addOutputLocationSetting(t){this.outputLocation=t,new Re.Setting(this.modal.contentEl).setName("Output folder").setDesc("Choose a folder in the vault to put the imported files. Leave empty to output to vault root.").addText(e=>e.setValue(t).onChange(i=>{this.outputLocation=i,this.outputFolder=null}))}async getOutputFolder(){if(this.outputFolder)return this.outputFolder;let{vault:t}=this.app,e=this.outputLocation;e===""&&(e="/");let i=t.getAbstractFileByPath(e);return(i===null||!(i instanceof Re.TFolder))&&(await t.createFolder(e),i=t.getAbstractFileByPath(e)),i instanceof Re.TFolder?(this.outputFolder=i,i):null}async getAvailablePathForAttachment(t,e){let i=await this.getOutputFolder(),r=i?{parent:i}:null,{basename:o,extension:a}=re(t),s=await this.vault.getAvailablePathForAttachments(o,a,r),l=re(s),c=l.extension?"."+l.extension:"."+a,p=1,m=s;for(;e.includes(m)||this.vault.getAbstractFileByPath(m);)m=q.join(l.parent,`${l.name} ${p}${c}`),p++;return m}async createFolders(t){let e=t.split("/").map(o=>o.replace(/^\.+/,"")).join("/"),i=(0,Re.normalizePath)(e),r=this.vault.getAbstractFileByPathInsensitive(i);if(r&&r instanceof Re.TFolder)return r;if(await this.vault.createFolder(i),r=this.vault.getAbstractFileByPathInsensitive(i),!(r instanceof Re.TFolder))throw new Error(`Failed to create folder at "${t}"`);return r}async saveAsMarkdownFile(t,e,i){let r=Ze(e);return await this.app.fileManager.createNewMarkdownFile(t,r,i)}};var qp=ns(Ip());var ka=require("obsidian");var Fp=n=>{let e=gr.execSync(`${n} --version`).toString().toString().match(/(\d+)\.(\d+).(\d+)/);return(e==null?void 0:e[1])>3||(e==null?void 0:e[2])>32},Lp=n=>{let t=[];if(!n)return t;let e=[],i=0,r=-1,o={};for(;il>0),n.length-1);a=parseFloat(n.substring(i,s)),i=s}r==-1?e.push(a):(o[e[r]]=a,r++),(n[i]==` -`||e.length{let e=[n[0]],i=[e];for(let r=0;r",")),i.push(...t[r].length?t[r]:[""])):i.push(t[r]),e.push(n[r+1]));return i},$p=n=>new yr(n);var pi=(n,t)=>{let e="SQLITE_ERROR",i=new Error(e+": "+t);return i.code=e,n(i),""},Bp=(...n)=>$p(Pp(...n)),{from:hg}=Array,gg=/'/g,yg=n=>n.toString(16).padStart(2,"0"),bg=n=>`x'${hg(n,yg).join("")}'`,xg=n=>{switch(typeof n){case"string":return"'"+n.replace(gg,"''")+"'";case"number":if(!isFinite(n))return;case"boolean":return+n;case"object":case"undefined":switch(!0){case!n:return"NULL";case n instanceof Date:return"'"+n.toISOString()+"'";case n instanceof Buffer:case n instanceof ArrayBuffer:n=new Uint8Array(n);case n instanceof Uint8Array:case n instanceof Uint8ClampedArray:return bg(n)}}},_a=(n,t)=>{let[e,...i]=Mp(...t),r=[e[0]];for(let a=0;a{let e=[n[0]],i=[e];for(let r=0;r",")),i.push(...t[r].length?t[r]:[""])):i.push(t[r]),e.push(n[r+1]));return i},$p=n=>new yr(n);var ui=(n,t)=>{let e="SQLITE_ERROR",i=new Error(e+": "+t);return i.code=e,n(i),""},Bp=(...n)=>$p(Pp(...n)),{from:hg}=Array,gg=/'/g,yg=n=>n.toString(16).padStart(2,"0"),bg=n=>`x'${hg(n,yg).join("")}'`,xg=n=>{switch(typeof n){case"string":return"'"+n.replace(gg,"''")+"'";case"number":if(!isFinite(n))return;case"boolean":return+n;case"object":case"undefined":switch(!0){case!n:return"NULL";case n instanceof Date:return"'"+n.toISOString()+"'";case n instanceof Buffer:case n instanceof ArrayBuffer:n=new Uint8Array(n);case n instanceof Uint8Array:case n instanceof Uint8ClampedArray:return bg(n)}}},_a=(n,t)=>{let[e,...i]=Mp(...t),r=[e[0]];for(let a=0;a{},Ag=(n,t,e,i,r,o)=>{let a=[],{stdout:s,stderr:l}=gr.spawn(i,r,o).on("close",p=>{if(c||p!==0){p!==0&&pi(t,"busy DB or query too slow");return}let m=a.join("").trim();if(e==="query")n(m);else{let y=jp(m||"[]");n(e==="get"&&Eg(y)?y.shift():y)}});s.on("data",p=>{a.push(p)});let c=!1;l.on("data",p=>{c=!0,pi(t,"".trim.call(p))})},kg=(n,t,e)=>{let i=Fp(n),r=i?wg:vg,{stdin:o,stdout:a,stderr:s}=gr.spawn(n,t);i?o.write(`.mode json +`,{isArray:Eg}=Array,{parse:jp}=JSON,{defineProperty:_g}=Object,Tg=()=>{},Ag=(n,t,e,i,r,o)=>{let a=[],{stdout:s,stderr:l}=gr.spawn(i,r,o).on("close",p=>{if(c||p!==0){p!==0&&ui(t,"busy DB or query too slow");return}let m=a.join("").trim();if(e==="query")n(m);else{let y=jp(m||"[]");n(e==="get"&&Eg(y)?y.shift():y)}});s.on("data",p=>{a.push(p)});let c=!1;l.on("data",p=>{c=!0,ui(t,"".trim.call(p))})},kg=(n,t,e)=>{let i=Fp(n),r=i?wg:vg,{stdin:o,stdout:a,stderr:s}=gr.spawn(n,t);i?o.write(`.mode json `):o.write(`.mode quote .headers on `),e&&o.write(`.timeout ${e} `);let l=Promise.resolve();return(c,p,m,y,E)=>{m==="close"?(o.write(`.quit -`),l=null):l&&(l=l.then(()=>new Promise(v=>{let d="",f=T=>{d+=T;let A=!1;for(;d.endsWith(r);)A=!0,d=d.slice(0,-r.length);if(A){for(w();d.startsWith(r);)d=d.slice(r.length);if(m==="query")c(d);else{let D=i?jp(d||"[]"):Lp(d);c(m==="get"?D.shift():D)}}},g=T=>{w(),p(new Error(T))},w=()=>{v(),a.removeListener("data",f),s.removeListener("data",g)};a.on("data",f),s.once("data",g),o.write(`${E[E.length-1]}; +`),l=null):l&&(l=l.then(()=>new Promise(v=>{let d="",f=_=>{d+=_;let A=!1;for(;d.endsWith(r);)A=!0,d=d.slice(0,-r.length);if(A){for(w();d.startsWith(r);)d=d.slice(r.length);if(m==="query")c(d);else{let D=i?jp(d||"[]"):Lp(d);c(m==="get"?D.shift():D)}}},g=_=>{w(),p(new Error(_))},w=()=>{v(),a.removeListener("data",f),s.removeListener("data",g)};a.on("data",f),s.once("data",g),o.write(`${E[E.length-1]}; `),o.write(`SELECT '${Na}' as _; `)})))}},Aa=(n,t,e,i,r)=>(...o)=>new Promise((a,s)=>{let l=_a(s,o);l.length&&(n==="get"&&/^SELECT\s+/i.test(l)&&!/\s+LIMIT\s+\d+$/i.test(l)&&(l+=" LIMIT 1"),e(a,s,n,t,i.concat(l),r))}),Up="";function Sa(n,t={}){n===":memory:"&&(n=Up||(Up=q.join(Xt.tmpdir(),randomUUID())));let e=t.timeout||0,i=t.bin||"sqlite3",r=[n,"-bail"],o={timeout:e};t.readonly&&r.push("-readonly"),e&&r.push("-cmd",".timeout "+e);let a=r.concat("-json"),s=t.exec||(t.persistent?kg(i,r,e):Ag);return{transaction(){let l=[];return _g((...c)=>{l.push(c)},"commit",{value(){return new Promise((c,p)=>{let m=["BEGIN TRANSACTION"];for(let y of l){let E=_a(p,y);if(!E.length)return;m.push(E)}m.push("COMMIT"),s(c,p,"query",i,r.concat(m.join(";")),o)})}})},query:Aa("query",i,s,r,o),get:Aa("get",i,s,a,o),all:Aa("all",i,s,a,o),close:t.persistent?()=>s(null,null,"close"):Tg,raw:Bp}}var Ra="Library/Group Containers/group.com.apple.notes",Hp="NoteStore.sqlite",Ng=978307200,br=class extends ce{constructor(){super(...arguments);this.owners={};this.resolvedAccounts={};this.resolvedFiles={};this.resolvedFolders={};this.multiAccount=!1;this.noteCount=0;this.parsedNotes=0;this.omitFirstLine=!0;this.importTrashed=!1;this.includeHandwriting=!1;this.trashFolders=[]}init(){if(!st.Platform.isMacOS||!st.Platform.isDesktop){this.modal.contentEl.createEl("p",{text:"Due to platform limitations, Apple Notes cannot be exported from this device. Open your vault on a Mac to export from Apple Notes."}),this.notAvailable=!0;return}this.addOutputLocationSetting("Apple Notes"),new st.Setting(this.modal.contentEl).setName("Import recently deleted notes").setDesc('Import notes in the "Recently Deleted" folder. Unlike in Apple Notes, they will not be automatically removed after a set amount of time.').addToggle(e=>e.setValue(!1).onChange(async i=>this.importTrashed=i)),new st.Setting(this.modal.contentEl).setName("Omit first line").setDesc("Don't include the first line in the text, since Apple Notes uses it as the title. It will still be used as the note name.").addToggle(e=>e.setValue(!0).onChange(async i=>this.omitFirstLine=i)),new st.Setting(this.modal.contentEl).setName("Include handwriting text").setDesc("When Apple Notes has detected handwriting in drawings, include it as text before the drawing.").addToggle(e=>e.setValue(!1).onChange(async i=>this.includeHandwriting=i))}async getNotesDatabase(){let e=q.join(Xt.homedir(),Ra),i=window.electron.remote.dialog.showOpenDialogSync({defaultPath:e,properties:["openDirectory"],message:'Select the "group.com.apple.notes" folder to allow Obsidian to read Apple Notes data.'});if(!(i!=null&&i.includes(e)))return new st.Notice("Data import failed. Ensure you have selected the correct Apple Notes data folder."),null;let r=q.join(e,Hp),o=q.join(Xt.tmpdir(),Hp);return await Pe.copyFile(r,o),await Pe.copyFile(r+"-shm",o+"-shm"),await Pe.copyFile(r+"-wal",o+"-wal"),new Sa(o,{readonly:!0,persistent:!0})}async import(e){if(this.ctx=e,this.protobufRoot=qp.Root.fromJSON(as),this.rootFolder=await this.getOutputFolder(),!this.rootFolder){new st.Notice("Please select a location to export to.");return}if(this.database=await this.getNotesDatabase(),!this.database)return;this.keys=Object.fromEntries((await this.database.all`SELECT z_ent, z_name FROM z_primarykey`).map(a=>[a.Z_NAME,a.Z_ENT]));let i=await this.database.all` SELECT z_pk FROM ziccloudsyncingobject WHERE z_ent = ${this.keys.ICAccount} @@ -83,7 +83,7 @@ ${this.app.fileManager.generateMarkdownLink(a,"/")} SELECT z_pk, ztitle2 FROM ziccloudsyncingobject WHERE z_ent = ${this.keys.ICFolder} `;for(let a of i)await this.resolveAccount(a.Z_PK);for(let a of r)try{await this.resolveFolder(a.Z_PK)}catch(s){this.ctx.reportFailed(a.ZTITLE2,s==null?void 0:s.message),console.error(s)}let o=await this.database.all` SELECT - z_pk, zfolder, ztitle1 FROM ziccloudsyncingobject + z_pk, zfolder, ztitle1 FROM ziccloudsyncingobject WHERE z_ent = ${this.keys.ICNote} AND ztitle1 IS NOT NULL @@ -96,70 +96,70 @@ ${this.app.fileManager.generateMarkdownLink(a,"/")} FROM ziccloudsyncingobject WHERE z_ent = ${this.keys.ICFolder} AND z_pk = ${e} `,r;if(i.ZFOLDERTYPE==3)return null;if(!this.importTrashed&&i.ZFOLDERTYPE==1)return this.trashFolders.push(e),null;if(i.ZPARENT!==null)r=((a=await this.resolveFolder(i.ZPARENT))==null?void 0:a.path)+"/";else if(this.multiAccount){let s=this.resolvedAccounts[i.ZOWNER].name;r=`${this.rootFolder.path}/${s}/`}else r=`${this.rootFolder.path}/`;i.ZIDENTIFIER.startsWith("DefaultFolder")||(r+=Ze(i.ZTITLE2));let o=await this.createFolders(r);return this.resolvedFolders[e]=o,this.owners[e]=i.ZOWNER,o}async resolveNote(e){if(e in this.resolvedFiles)return this.resolvedFiles[e];let i=await this.database.get` - SELECT - nd.z_pk, hex(nd.zdata) as zhexdata, zcso.ztitle1, zfolder, + SELECT + nd.z_pk, hex(nd.zdata) as zhexdata, zcso.ztitle1, zfolder, zcreationdate1, zcreationdate2, zcreationdate3, zmodificationdate1, zispasswordprotected FROM - zicnotedata AS nd, - (SELECT + zicnotedata AS nd, + (SELECT *, NULL AS zcreationdate3, NULL AS zcreationdate2, NULL AS zispasswordprotected FROM ziccloudsyncingobject - ) AS zcso + ) AS zcso WHERE zcso.z_pk = nd.znote AND zcso.z_pk = ${e} - `;if(i.ZISPASSWORDPROTECTED)return this.ctx.reportSkipped(i.ZTITLE1,"note is password protected"),null;let r=this.resolvedFolders[i.ZFOLDER]||this.rootFolder,o=`${i.ZTITLE1}.md`,a=await this.saveAsMarkdownFile(r,o,"");this.ctx.status(`Importing note ${o}`),this.resolvedFiles[e]=a,this.owners[e]=this.owners[i.ZFOLDER];let s=this.decodeData(i.zhexdata,Wt);return this.vault.modify(a,await s.format(),{ctime:this.decodeTime(i.ZCREATIONDATE3||i.ZCREATIONDATE2||i.ZCREATIONDATE1),mtime:this.decodeTime(i.ZMODIFICATIONDATE1)}),this.parsedNotes++,this.ctx.reportProgress(this.parsedNotes,this.noteCount),a}async resolveAttachment(e,i){let r,o,a,s,l;switch(i){case"com.apple.paper.doc.scan":s=await this.database.get` + `;if(i.ZISPASSWORDPROTECTED)return this.ctx.reportSkipped(i.ZTITLE1,"note is password protected"),null;let r=this.resolvedFolders[i.ZFOLDER]||this.rootFolder,o=`${i.ZTITLE1}.md`,a=await this.saveAsMarkdownFile(r,o,"");this.ctx.status(`Importing note ${o}`),this.resolvedFiles[e]=a,this.owners[e]=this.owners[i.ZFOLDER];let s=this.decodeData(i.zhexdata,Wt);return this.vault.modify(a,await s.format(),{ctime:this.decodeTime(i.ZCREATIONDATE3||i.ZCREATIONDATE2||i.ZCREATIONDATE1),mtime:this.decodeTime(i.ZMODIFICATIONDATE1)}),this.parsedNotes++,this.ctx.reportProgress(this.parsedNotes,this.noteCount),a}async resolveAttachment(e,i){if(e in this.resolvedFiles)return this.resolvedFiles[e];let r,o,a,s,l;switch(i){case"com.apple.paper.doc.scan":s=await this.database.get` SELECT zidentifier, zfallbackpdfgeneration, zcreationdate, zmodificationdate, znote FROM (SELECT *, NULL AS zfallbackpdfgeneration FROM ziccloudsyncingobject) WHERE z_ent = ${this.keys.ICAttachment} - AND z_pk = ${e} + AND z_pk = ${e} `,r=q.join("FallbackPDFs",s.ZIDENTIFIER,s.ZFALLBACKPDFGENERATION||"","FallbackPDF.pdf"),o="Scan",a="pdf";break;case"com.apple.notes.gallery":s=await this.database.get` SELECT zidentifier, zsizeheight, zsizewidth, zcreationdate, zmodificationdate, znote FROM ziccloudsyncingobject WHERE z_ent = ${this.keys.ICAttachment} - AND z_pk = ${e} + AND z_pk = ${e} `,r=q.join("Previews",`${s.ZIDENTIFIER}-1-${s.ZSIZEWIDTH}x${s.ZSIZEHEIGHT}-0.jpeg`),o="Scan Page",a="jpg";break;case"com.apple.paper":s=await this.database.get` SELECT - zidentifier, zfallbackimagegeneration, zcreationdate, zmodificationdate, + zidentifier, zfallbackimagegeneration, zcreationdate, zmodificationdate, znote, zhandwritingsummary FROM (SELECT *, NULL AS zfallbackimagegeneration FROM ziccloudsyncingobject) WHERE z_ent = ${this.keys.ICAttachment} - AND z_pk = ${e} + AND z_pk = ${e} `,s.ZFALLBACKIMAGEGENERATION?r=q.join("FallbackImages",s.ZIDENTIFIER,s.ZFALLBACKIMAGEGENERATION,"FallbackImage.png"):r=q.join("FallbackImages",`${s.ZIDENTIFIER}.jpg`),o="Drawing",a="png";break;default:s=await this.database.get` SELECT - a.zidentifier, a.zfilename, + a.zidentifier, a.zfilename, a.zgeneration1, b.zcreationdate, b.zmodificationdate, b.znote FROM (SELECT *, NULL AS zgeneration1 FROM ziccloudsyncingobject) AS a, ziccloudsyncingobject AS b WHERE a.z_ent = ${this.keys.ICMedia} - AND a.z_pk = ${e} + AND a.z_pk = ${e} AND a.z_pk = b.zmedia - `,r=q.join("Media",s.ZIDENTIFIER,s.ZGENERATION1||"",s.ZFILENAME),[o,a]=Ro(s.ZFILENAME);break}try{let c=await this.getAttachmentSource(this.resolvedAccounts[this.owners[s.ZNOTE]],r),p=await this.getAttachmentFolder(this.resolvedFiles[s.ZNOTE]),m=this.app.vault.getAvailablePath(`${p}/${o}`,a);l=await this.vault.createBinary(m,c,{ctime:this.decodeTime(s.ZCREATIONDATE),mtime:this.decodeTime(s.ZMODIFICATIONDATE)})}catch(c){return console.error(c),null}return this.resolvedFiles[e]=l,this.ctx.reportAttachmentSuccess(this.resolvedFiles[e].path),l}decodeData(e,i){let r=Cl.gunzipSync(Buffer.from(e,"hex")),o=this.protobufRoot.lookupType(i.protobufType).decode(r);return new i(this,o)}decodeTime(e){return!e||e<1?new Date().getTime():Math.floor((e+Ng)*1e3)}async getAttachmentSource(e,i){try{return await Pe.readFile(q.join(e.path,i))}catch(r){return await Pe.readFile(q.join(Xt.homedir(),Ra,i))}}async getAttachmentFolder(e){if(this.cachedAttachmentPath)return this.cachedAttachmentPath;let i=this.app.vault.getConfig("attachmentFolderPath"),r=oe(await this.app.vault.getAvailablePathForAttachments(e.basename,e.extension,e)).parent;return i.startsWith("./")||(r=q.join(i,`${this.outputLocation} Attachments`),this.cachedAttachmentPath=r),this.createFolders(r),r}};var fi=require("obsidian");var ui=class{constructor(t,e){this.type="file";this.entry=e,this.fullpath=t.fullpath+"/"+e.filename;let{parent:i,name:r,basename:o,extension:a}=oe(e.filename);this.parent=i,this.name=r,this.basename=o,this.extension=a}async readText(){return this.entry.getData(new $i)}async read(){return(await this.entry.getData(new Gn)).arrayBuffer()}get filepath(){return this.entry.filename}get size(){return this.entry.uncompressedSize}get ctime(){return this.entry.creationDate}get mtime(){return this.entry.lastModDate}async readZip(t){return t(new Vt(new St(new Blob([await this.read()]))))}};async function gt(n,t){await n.readZip(async e=>{let r=(await e.getEntries()).filter(o=>!o.directory&&!!o.getData).map(o=>new ui(n,o));return t(e,r)})}var xr=class extends ce{init(){this.addFileChooserSetting("Bear2bk",["bear2bk"]),this.addOutputLocationSetting("Bear")}async import(t){let{files:e}=this;if(e.length===0){new fi.Notice("Please pick at least one file to import.");return}let i=await this.getOutputFolder();if(!i){new fi.Notice("Please select a location to export to.");return}let r=i,o=await this.createFolders(`${i.path}/assets`),a=/!\[\]\(assets\//g,s=await this.createFolders(`${i.path}/archive`),l=await this.createFolders(`${i.path}/trash`);for(let c of e){if(t.isCancelled())return;t.status("Processing "+c.name),await gt(c,async(p,m)=>{let y=await this.collectMetadata(m);for(let E of m){if(t.isCancelled())return;let{fullpath:v,filepath:d,parent:f,name:g,extension:w}=E;if(g!=="info.json"){t.status("Processing "+g);try{if(w==="md"||w==="markdown"){let T=oe(f).basename;t.status("Importing note "+T);let A=await E.readText();A=this.removeMarkdownHeader(T,A),A.match(a)&&(A=A.replace(a,`![](${o.path}/`));let D=(0,fi.normalizePath)(T),_=y[f],S=r;_!=null&&_.archived?S=s:_!=null&&_.trashed&&(S=l);let x=await this.saveAsMarkdownFile(S,D,A);_!=null&&_.ctime&&(_!=null&&_.mtime)&&await this.modifFileTimestamps(_,x),t.reportNoteSuccess(T)}else if(d.match(/\/assets\//g)){t.status("Importing asset "+g);let T=`${o.path}/${g}`;if(this.vault.getAbstractFileByPath(T))t.reportSkipped(v,"asset with filename already exists");else{let D=await E.read();await this.vault.createBinary(T,D),t.reportAttachmentSuccess(v)}}else t.reportSkipped(v,"unknown type of file")}catch(T){t.reportFailed(v,T)}}}})}}async modifFileTimestamps(t,e){let i={ctime:t.ctime,mtime:t.mtime};await this.vault.append(e,"",i)}async collectMetadata(t){let e={};for(let i of t){if(i.name!=="info.json")continue;let r=await i.readText(),a=JSON.parse(r)["net.shinyfrog.bear"],s=Date.parse(a.creationDate),l=Date.parse(a.modificationDate);e[i.parent]={ctime:isNaN(s)?void 0:s,mtime:isNaN(l)?void 0:l,archived:a.archived===1,trashed:a.trashed===1}}return e}removeMarkdownHeader(t,e){if(!e.startsWith("# "))return e;let i=e.indexOf(` -`),r=i>0?e.substring(2,i):e.substring(2);return r=r.trim(),r!==t.trim()&&r!==""?e:i>0?e.substring(i+1):""}};var xi=require("obsidian");var Mf=require("obsidian");var Wp=require("obsidian");var Zp=n=>({...n,created:di(n.created),statusupdated:di(n.statusupdated),updated:di(n.updated),duedate:di(n.duedate),taskflag:n.taskflag==="true",reminderdate:n.reminder?di(n.reminder.reminderdate):void 0,sortweight:n.sortweight}),di=n=>n?(0,Wp.moment)(n,"YYYYMMDDThhmmssZ").toDate():void 0;var Yp=/highlight-(?:text|source)-([a-z0-9]+)/;function Sg(n){n.addRule("highlightedCodeBlock",{filter:function(t){var e=t.firstChild;return t.nodeName==="DIV"&&Yp.test(t.className)&&e&&e.nodeName==="PRE"},replacement:function(t,e,i){var r=e.className||"",o=(r.match(Yp)||[null,""])[1];return` + `,r=q.join("Media",s.ZIDENTIFIER,s.ZGENERATION1||"",s.ZFILENAME),[o,a]=Ro(s.ZFILENAME);break}try{let c=await this.getAttachmentSource(this.resolvedAccounts[this.owners[s.ZNOTE]],r),p=await this.getAvailablePathForAttachment(`${o}.${a}`,[]);l=await this.vault.createBinary(p,c,{ctime:this.decodeTime(s.ZCREATIONDATE),mtime:this.decodeTime(s.ZMODIFICATIONDATE)})}catch(c){return this.ctx.reportFailed(r),console.error(c),null}return this.resolvedFiles[e]=l,this.ctx.reportAttachmentSuccess(this.resolvedFiles[e].path),l}decodeData(e,i){let r=Cl.gunzipSync(Buffer.from(e,"hex")),o=this.protobufRoot.lookupType(i.protobufType).decode(r);return new i(this,o)}decodeTime(e){return!e||e<1?new Date().getTime():Math.floor((e+Ng)*1e3)}async getAttachmentSource(e,i){try{return await Pe.readFile(q.join(e.path,i))}catch(r){return await Pe.readFile(q.join(Xt.homedir(),Ra,i))}}};var kn=require("obsidian");var fi=class{constructor(t,e){this.type="file";this.entry=e,this.fullpath=t.fullpath+"/"+e.filename;let{parent:i,name:r,basename:o,extension:a}=re(e.filename);this.parent=i,this.name=r,this.basename=o,this.extension=a}async readText(){return this.entry.getData(new $i)}async read(){return(await this.entry.getData(new Vn)).arrayBuffer()}get filepath(){return this.entry.filename}get size(){return this.entry.uncompressedSize}get ctime(){return this.entry.creationDate}get mtime(){return this.entry.lastModDate}async readZip(t){return t(new Vt(new St(new Blob([await this.read()]))))}};async function gt(n,t){await n.readZip(async e=>{let r=(await e.getEntries()).filter(o=>!o.directory&&!!o.getData).map(o=>new fi(n,o));return t(e,r)})}var xr=class extends ce{constructor(){super(...arguments);this.attachmentMap={}}init(){this.addFileChooserSetting("Bear2bk",["bear2bk"]),this.addOutputLocationSetting("Bear")}async import(e){let{files:i}=this;if(i.length===0){new kn.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new kn.Notice("Please select a location to export to.");return}let o=r,a=new RegExp("\\[[^\\]]*\\]\\((assets/[^\\)]+)\\)","gm"),s=await this.createFolders(`${r.path}/archive`),l=await this.createFolders(`${r.path}/trash`);for(let c of i){if(e.isCancelled())return;e.status("Processing "+c.name),await gt(c,async(p,m)=>{let y=await this.collectMetadata(e,m);for(let E of m){if(e.isCancelled())return;let{fullpath:v,filepath:d,parent:f,name:g,extension:w}=E;if(!(g==="info.json"||g==="tags.json")){e.status("Processing "+g);try{if(w==="md"||w==="markdown"){let _=re(f).basename;e.status("Importing note "+_);let A=await E.readText();A=this.removeMarkdownHeader(_,A);let D=[...A.matchAll(a)];if(D.length>0)for(let O of D){let[S,M]=O,L=q.join(f,M),j=await this.getAttachmentStoragePath(L);j=encodeURI(j);let Z=S.replace(M,j);A=A.replace(S,Z)}let T=(0,kn.normalizePath)(_),k=y[f],b=o;k!=null&&k.archived?b=s:k!=null&&k.trashed&&(b=l);let C=await this.saveAsMarkdownFile(b,T,A);k!=null&&k.ctime&&(k!=null&&k.mtime)&&await this.modifFileTimestamps(k,C),e.reportNoteSuccess(_)}else if(d.match(/\/assets\//g)){e.status("Importing asset "+E.name);let _=await this.getAttachmentStoragePath(E.filepath),A=await E.read();await this.vault.createBinary(_,A),e.reportAttachmentSuccess(E.fullpath)}else e.reportSkipped(v,"unknown type of file")}catch(_){e.reportFailed(v,_)}}}})}}async modifFileTimestamps(e,i){let r={ctime:e.ctime,mtime:e.mtime};await this.vault.append(i,"",r)}async collectMetadata(e,i){let r={};for(let o of i){if(e.isCancelled())return r;if(o.name!=="info.json")continue;let a=await o.readText(),l=JSON.parse(a)["net.shinyfrog.bear"],c=Date.parse(l.creationDate),p=Date.parse(l.modificationDate);r[o.parent]={ctime:isNaN(c)?void 0:c,mtime:isNaN(p)?void 0:p,archived:l.archived===1,trashed:l.trashed===1}}return r}async getAttachmentStoragePath(e){let i=(0,kn.normalizePath)(e);if(this.attachmentMap[i])return this.attachmentMap[i];let r=Object.values(this.attachmentMap),o=await this.getAvailablePathForAttachment(i,r);return this.attachmentMap[i]=o,o}removeMarkdownHeader(e,i){if(!i.startsWith("# "))return i;let r=i.indexOf(` +`),o=r>0?i.substring(2,r):i.substring(2);return o=o.trim(),o!==e.trim()&&o!==""?i:r>0?i.substring(r+1):""}};var xi=require("obsidian");var Mf=require("obsidian");var Wp=require("obsidian");var Zp=n=>({...n,created:di(n.created),statusupdated:di(n.statusupdated),updated:di(n.updated),duedate:di(n.duedate),taskflag:n.taskflag==="true",reminderdate:n.reminder?di(n.reminder.reminderdate):void 0,sortweight:n.sortweight}),di=n=>n?(0,Wp.moment)(n,"YYYYMMDDThhmmssZ").toDate():void 0;var Yp=/highlight-(?:text|source)-([a-z0-9]+)/;function Sg(n){n.addRule("highlightedCodeBlock",{filter:function(t){var e=t.firstChild;return t.nodeName==="DIV"&&Yp.test(t.className)&&e&&e.nodeName==="PRE"},replacement:function(t,e,i){var r=e.className||"",o=(r.match(Yp)||[null,""])[1];return` `+i.fence+o+` `+e.firstChild.textContent+` `+i.fence+` -`}})}function Rg(n){n.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var Og=Array.prototype.indexOf,Dg=Array.prototype.every,kn={};kn.tableCell={filter:["th","td"],replacement:function(n,t){return Da(Gp(t))?n:Oa(n,t)}};kn.tableRow={filter:"tr",replacement:function(n,t){let e=Gp(t);if(Da(e))return n;var i="",r={left:":--",right:"--:",center:":-:"};if(Cg(t)){let l=Vp(e);for(var o=0;o=t.childNodes.length?null:t.childNodes[o];var a="---",s=c?(c.getAttribute("align")||"").toLowerCase():"";s&&(a=r[s]||a),c?i+=Oa(a,t.childNodes[o]):i+=Oa(a,null,o)}}return` +`}})}function Rg(n){n.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var Og=Array.prototype.indexOf,Dg=Array.prototype.every,Nn={};Nn.tableCell={filter:["th","td"],replacement:function(n,t){return Da(Gp(t))?n:Oa(n,t)}};Nn.tableRow={filter:"tr",replacement:function(n,t){let e=Gp(t);if(Da(e))return n;var i="",r={left:":--",right:"--:",center:":-:"};if(Cg(t)){let l=Vp(e);for(var o=0;o=t.childNodes.length?null:t.childNodes[o];var a="---",s=c?(c.getAttribute("align")||"").toLowerCase():"";s&&(a=r[s]||a),c?i+=Oa(a,t.childNodes[o]):i+=Oa(a,null,o)}}return` `+n+(i?` -`+i:"")}};kn.table={filter:function(n){return n.nodeName==="TABLE"},replacement:function(n,t){if(Da(t))return n;n=n.replace(/\n+/g,` +`+i:"")}};Nn.table={filter:function(n){return n.nodeName==="TABLE"},replacement:function(n,t){if(Da(t))return n;n=n.replace(/\n+/g,` `);var e=n.trim().split(` `);e.length>=2&&(e=e[1]);var i=e.indexOf("| ---")===0,r=Vp(t),o="";return r&&!i&&(o="|"+" |".repeat(r)+` |`+" --- |".repeat(r)),` `+o+n+` -`}};kn.tableSection={filter:["thead","tbody","tfoot"],replacement:function(n){return n}};function Cg(n){var t=n.parentNode;return t.nodeName==="THEAD"||t.firstChild===n&&(t.nodeName==="TABLE"||Ig(t))&&Dg.call(n.childNodes,function(e){return e.nodeName==="TH"})}function Ig(n){var t=n.previousSibling;return n.nodeName==="TBODY"&&(!t||t.nodeName==="THEAD"&&/^\s*$/i.test(t.textContent))}function Oa(n,t=null,e=null){e===null&&(e=Og.call(t.parentNode.childNodes,t));var i=" ";e===0&&(i="| ");let r=n.trim().replace(/\n\r/g,"
    ").replace(/\n/g,"
    ");for(r=r.replace(/\|+/g,"\\|");r.length<3;)r+=" ";return t&&(r=Fg(r,t," ")),i+r+" |"}function zp(n){if(!n.childNodes)return!1;for(let t=0;tt&&(t=r)}return t}function Lg(n){n.keep(function(e){return e.nodeName==="TABLE"});for(var t in kn)n.addRule(t,kn[t])}function Pg(n){n.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,e){return(e.checked?"[x]":"[ ]")+" "}})}function Kp(n){n.use([Sg,Rg,Lg,Pg])}var ue=n=>{let t={get(e,i){return e[i]}};return new Proxy(n.attributes,t)};var Xp="\n```\n",Ca=n=>{let t=ue(n),e="-en-codeblock:true";return t.style&&t.style.value.indexOf(e)>=0},Mg=n=>{let t=ue(n),e="padding-left:",i=0;return t.style&&t.style.value.indexOf(e)>=0&&(i=Math.floor(t.style.value.split(e)[1].split("px")[0]/20)),i},Ia=n=>n.replace(/\\(.)/g,"$1"),Jp=(n,t)=>{let e=Mg(t);return n=`${" ".repeat(e)}${n}`,Ca(t)?(n=Ia(n),`${Xp}${n}${Xp}`):t.parentElement&&Ca(t.parentElement)&&t.parentElement.firstElementChild===t?`${n}`:t.parentElement&&Ca(t.parentElement)?` +`}};Nn.tableSection={filter:["thead","tbody","tfoot"],replacement:function(n){return n}};function Cg(n){var t=n.parentNode;return t.nodeName==="THEAD"||t.firstChild===n&&(t.nodeName==="TABLE"||Ig(t))&&Dg.call(n.childNodes,function(e){return e.nodeName==="TH"})}function Ig(n){var t=n.previousSibling;return n.nodeName==="TBODY"&&(!t||t.nodeName==="THEAD"&&/^\s*$/i.test(t.textContent))}function Oa(n,t=null,e=null){e===null&&(e=Og.call(t.parentNode.childNodes,t));var i=" ";e===0&&(i="| ");let r=n.trim().replace(/\n\r/g,"
    ").replace(/\n/g,"
    ");for(r=r.replace(/\|+/g,"\\|");r.length<3;)r+=" ";return t&&(r=Fg(r,t," ")),i+r+" |"}function zp(n){if(!n.childNodes)return!1;for(let t=0;tt&&(t=r)}return t}function Lg(n){n.keep(function(e){return e.nodeName==="TABLE"});for(var t in Nn)n.addRule(t,Nn[t])}function Pg(n){n.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,e){return(e.checked?"[x]":"[ ]")+" "}})}function Kp(n){n.use([Sg,Rg,Lg,Pg])}var ue=n=>{let t={get(e,i){return e[i]}};return new Proxy(n.attributes,t)};var Xp="\n```\n",Ca=n=>{let t=ue(n),e="-en-codeblock:true";return t.style&&t.style.value.indexOf(e)>=0},Mg=n=>{let t=ue(n),e="padding-left:",i=0;return t.style&&t.style.value.indexOf(e)>=0&&(i=Math.floor(t.style.value.split(e)[1].split("px")[0]/20)),i},Ia=n=>n.replace(/\\(.)/g,"$1"),Jp=(n,t)=>{let e=Mg(t);return n=`${" ".repeat(e)}${n}`,Ca(t)?(n=Ia(n),`${Xp}${n}${Xp}`):t.parentElement&&Ca(t.parentElement)&&t.parentElement.firstElementChild===t?`${n}`:t.parentElement&&Ca(t.parentElement)?` ${n}`:t.isBlock?` ${n} `:n};var wr="\n```\n",$g="-en-codeblock:true",Bg=/\b(Courier|Mono|Consolas|Console|Inconsolata|Pitch|Monaco|monospace)\b/,Qp=n=>{var o,a;if(n.nodeType!==1)return null;let t=n.childNodes,e=t.length;if(e>1)return"mixed";if(e===1){let s=Qp(t[0]);if(s)return s}let i=ue(n);if(n.tagName==="FONT")return(o=i.face)==null?void 0:o.value;let r=(a=i.style)==null?void 0:a.value;if(r){let s=r.match(/font-family:([^;]+)/);if(s)return s[1]}return null},mi=n=>{var r;let e=(r=ue(n).style)==null?void 0:r.value;if(e&&e.includes($g))return!0;let i=Qp(n);return!!i&&Bg.test(i)},eu=(n,t)=>{if(mi(t)){let e=t.previousSibling,i=e&&e.tagName===t.tagName&&mi(e),r=t.nextSibling,o=r&&r.tagName===t.tagName&&mi(r);return i||o?(n=i?` @@ -167,7 +167,7 @@ ${n}`:`${wr}${n}`,n=o?`${n} `:`${n}${wr}`,n):(n=Ia(n),n.trim()?`${wr}${n}${wr}`:n)}return t.parentElement&&mi(t.parentElement)&&t.parentElement.firstElementChild===t?n:t.parentElement&&mi(t.parentElement)?` ${n}`:t.isBlock?` ${n} -`:n};var qe=n=>t=>t.nodeName===n||t.nodeName.toLowerCase()===n;var tu={filter:qe("IMG"),replacement:(n,t)=>{let e=ue(t);if(!e.src)return"";let i=e.src.value,r=t.width||"",o=t.height||"",a=i;B.sanitizeResourceNameSpaces?a=a.replace(/ /g,B.replacementChar):B.urlEncodeFileNamesAndLinks&&(a=encodeURI(a));let s=r||o?` =${r}x${o}`:"";if(B.keepImageSize)return s=r||o?`|${r||0}x${o||0}`:"",a.startsWith("./")?`![[${a}${s}]]`:`![${s}](${a})`;if(!i.match(/^[a-z]+:/))return`![[${a}]]`;let l=e.src.value.split("/");return`![${l[l.length-1]}](${a})`}};var fe=class{constructor(){this.noteIdNameMap={},this.noteIdNameTOCMap={}}static getInstance(){return fe.instance||(fe.instance=new fe),fe.instance}addItemToMap(t){this.noteIdNameMap[t.url]={...this.noteIdNameMap[t.url],title:t.title,noteName:this.currentNoteName,notebookName:this.currentNotebookName,uniqueEnd:t.uniqueEnd}}addItemToTOCMap(t){this.noteIdNameTOCMap[t.url]={...this.noteIdNameMap[t.url],title:t.title,noteName:this.currentNoteName,notebookName:this.currentNotebookName,uniqueEnd:t.uniqueEnd}}getNoteIdNameMap(){return this.noteIdNameMap}getNoteIdNameTOCMap(){return this.noteIdNameTOCMap}getAllNoteIdNameMap(){return{...this.noteIdNameMap,...this.noteIdNameTOCMap}}getNoteIdNameMapByNoteTitle(t){return Object.values(this.getAllNoteIdNameMap()).filter(e=>e.title===t)}setCurrentNotebookName(t){this.currentNotebookName=t}getCurrentNotebookName(){return this.currentNotebookName}setCurrentNotebookFullpath(t){this.currentNotebookFullpath=t}setCurrentNoteName(t){this.currentNoteName=t}getCurrentNoteName(){return this.currentNoteName}getCurrentNotePath(){return this.currentNotePath}setCurrentNotePath(t){this.currentNotePath=t}getCurrentNotebookFullpath(){return this.currentNotebookFullpath}};var nu=require("obsidian");var Nn=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Ug={"application/andrew-inset":"ez","application/applixware":"aw","application/atom+xml":"atom","application/atomcat+xml":"atomcat","application/atomdeleted+xml":"atomdeleted","application/atomsvc+xml":"atomsvc","application/atsc-dwd+xml":"dwd","application/atsc-held+xml":"held","application/atsc-rsat+xml":"rsat","application/bdoc":"bdoc","application/calendar+xml":"xcs","application/ccxml+xml":"ccxml","application/cdfx+xml":"cdfx","application/cdmi-capability":"cdmia","application/cdmi-container":"cdmic","application/cdmi-domain":"cdmid","application/cdmi-object":"cdmio","application/cdmi-queue":"cdmiq","application/cpl+xml":"cpl","application/cu-seeme":"cu","application/dash+xml":"mpd","application/dash-patch+xml":"mpp","application/davmount+xml":"davmount","application/docbook+xml":"dbk","application/dssc+der":"dssc","application/dssc+xml":"xdssc","application/ecmascript":"es","application/emma+xml":"emma","application/emotionml+xml":"emotionml","application/epub+zip":"epub","application/exi":"exi","application/express":"exp","application/fdt+xml":"fdt","application/font-tdpfr":"pfr","application/geo+json":"geojson","application/gml+xml":"gml","application/gpx+xml":"gpx","application/gxf":"gxf","application/gzip":"gz","application/hjson":"hjson","application/hyperstudio":"stk","application/inkml+xml":"ink","application/ipfix":"ipfix","application/its+xml":"its","application/java-archive":"jar","application/java-serialized-object":"ser","application/java-vm":"class","application/javascript":"js","application/json":"json","application/json5":"json5","application/jsonml+json":"jsonml","application/ld+json":"jsonld","application/lgr+xml":"lgr","application/lost+xml":"lostxml","application/mac-binhex40":"hqx","application/mac-compactpro":"cpt","application/mads+xml":"mads","application/manifest+json":"webmanifest","application/marc":"mrc","application/marcxml+xml":"mrcx","application/mathematica":"ma","application/mathml+xml":"mathml","application/mbox":"mbox","application/media-policy-dataset+xml":"mpf","application/mediaservercontrol+xml":"mscml","application/metalink+xml":"metalink","application/metalink4+xml":"meta4","application/mets+xml":"mets","application/mmt-aei+xml":"maei","application/mmt-usd+xml":"musd","application/mods+xml":"mods","application/mp21":"m21","application/mp4":"mp4s","application/msword":"doc","application/mxf":"mxf","application/n-quads":"nq","application/n-triples":"nt","application/node":"cjs","application/octet-stream":"bin","application/oda":"oda","application/oebps-package+xml":"opf","application/ogg":"ogx","application/omdoc+xml":"omdoc","application/onenote":"onetoc","application/oxps":"oxps","application/p2p-overlay+xml":"relo","application/patch-ops-error+xml":"xer","application/pdf":"pdf","application/pgp-encrypted":"pgp","application/pgp-keys":"asc","application/pgp-signature":"asc","application/pics-rules":"prf","application/pkcs10":"p10","application/pkcs7-mime":"p7m","application/pkcs7-signature":"p7s","application/pkcs8":"p8","application/pkix-attr-cert":"ac","application/pkix-cert":"cer","application/pkix-crl":"crl","application/pkix-pkipath":"pkipath","application/pkixcmp":"pki","application/pls+xml":"pls","application/postscript":"ai","application/provenance+xml":"provx","application/prs.cww":"cww","application/pskc+xml":"pskcxml","application/raml+yaml":"raml","application/rdf+xml":"rdf","application/reginfo+xml":"rif","application/relax-ng-compact-syntax":"rnc","application/resource-lists+xml":"rl","application/resource-lists-diff+xml":"rld","application/rls-services+xml":"rs","application/route-apd+xml":"rapd","application/route-s-tsid+xml":"sls","application/route-usd+xml":"rusd","application/rpki-ghostbusters":"gbr","application/rpki-manifest":"mft","application/rpki-roa":"roa","application/rsd+xml":"rsd","application/rss+xml":"rss","application/rtf":"rtf","application/sbml+xml":"sbml","application/scvp-cv-request":"scq","application/scvp-cv-response":"scs","application/scvp-vp-request":"spq","application/scvp-vp-response":"spp","application/sdp":"sdp","application/senml+xml":"senmlx","application/sensml+xml":"sensmlx","application/set-payment-initiation":"setpay","application/set-registration-initiation":"setreg","application/shf+xml":"shf","application/sieve":"siv","application/smil+xml":"smi","application/sparql-query":"rq","application/sparql-results+xml":"srx","application/srgs":"gram","application/srgs+xml":"grxml","application/sru+xml":"sru","application/ssdl+xml":"ssdl","application/ssml+xml":"ssml","application/swid+xml":"swidtag","application/tei+xml":"tei","application/thraud+xml":"tfi","application/timestamped-data":"tsd","application/toml":"toml","application/trig":"trig","application/ttml+xml":"ttml","application/ubjson":"ubj","application/urc-ressheet+xml":"rsheet","application/urc-targetdesc+xml":"td","application/vnd.1000minds.decision-model+xml":"1km","application/vnd.3gpp.pic-bw-large":"plb","application/vnd.3gpp.pic-bw-small":"psb","application/vnd.3gpp.pic-bw-var":"pvb","application/vnd.3gpp2.tcap":"tcap","application/vnd.3m.post-it-notes":"pwn","application/vnd.accpac.simply.aso":"aso","application/vnd.accpac.simply.imp":"imp","application/vnd.acucobol":"acu","application/vnd.acucorp":"atc","application/vnd.adobe.air-application-installer-package+zip":"air","application/vnd.adobe.formscentral.fcdt":"fcdt","application/vnd.adobe.fxp":"fxp","application/vnd.adobe.xdp+xml":"xdp","application/vnd.adobe.xfdf":"xfdf","application/vnd.age":"age","application/vnd.ahead.space":"ahead","application/vnd.airzip.filesecure.azf":"azf","application/vnd.airzip.filesecure.azs":"azs","application/vnd.amazon.ebook":"azw","application/vnd.americandynamics.acc":"acc","application/vnd.amiga.ami":"ami","application/vnd.android.package-archive":"apk","application/vnd.anser-web-certificate-issue-initiation":"cii","application/vnd.anser-web-funds-transfer-initiation":"fti","application/vnd.antix.game-component":"atx","application/vnd.apple.installer+xml":"mpkg","application/vnd.apple.keynote":"key","application/vnd.apple.mpegurl":"m3u8","application/vnd.apple.numbers":"numbers","application/vnd.apple.pages":"pages","application/vnd.apple.pkpass":"pkpass","application/vnd.aristanetworks.swi":"swi","application/vnd.astraea-software.iota":"iota","application/vnd.audiograph":"aep","application/vnd.balsamiq.bmml+xml":"bmml","application/vnd.blueice.multipass":"mpm","application/vnd.bmi":"bmi","application/vnd.businessobjects":"rep","application/vnd.chemdraw+xml":"cdxml","application/vnd.chipnuts.karaoke-mmd":"mmd","application/vnd.cinderella":"cdy","application/vnd.citationstyles.style+xml":"csl","application/vnd.claymore":"cla","application/vnd.cloanto.rp9":"rp9","application/vnd.clonk.c4group":"c4g","application/vnd.cluetrust.cartomobile-config":"c11amc","application/vnd.cluetrust.cartomobile-config-pkg":"c11amz","application/vnd.commonspace":"csp","application/vnd.contact.cmsg":"cdbcmsg","application/vnd.cosmocaller":"cmc","application/vnd.crick.clicker":"clkx","application/vnd.crick.clicker.keyboard":"clkk","application/vnd.crick.clicker.palette":"clkp","application/vnd.crick.clicker.template":"clkt","application/vnd.crick.clicker.wordbank":"clkw","application/vnd.criticaltools.wbs+xml":"wbs","application/vnd.ctc-posml":"pml","application/vnd.cups-ppd":"ppd","application/vnd.curl.car":"car","application/vnd.curl.pcurl":"pcurl","application/vnd.dart":"dart","application/vnd.data-vision.rdz":"rdz","application/vnd.dbf":"dbf","application/vnd.dece.data":"uvf","application/vnd.dece.ttml+xml":"uvt","application/vnd.dece.unspecified":"uvx","application/vnd.dece.zip":"uvz","application/vnd.denovo.fcselayout-link":"fe_launch","application/vnd.dna":"dna","application/vnd.dolby.mlp":"mlp","application/vnd.dpgraph":"dpg","application/vnd.dreamfactory":"dfac","application/vnd.ds-keypoint":"kpxx","application/vnd.dvb.ait":"ait","application/vnd.dvb.service":"svc","application/vnd.dynageo":"geo","application/vnd.ecowin.chart":"mag","application/vnd.enliven":"nml","application/vnd.epson.esf":"esf","application/vnd.epson.msf":"msf","application/vnd.epson.quickanime":"qam","application/vnd.epson.salt":"slt","application/vnd.epson.ssf":"ssf","application/vnd.eszigno3+xml":"es3","application/vnd.ezpix-album":"ez2","application/vnd.ezpix-package":"ez3","application/vnd.fdf":"fdf","application/vnd.fdsn.mseed":"mseed","application/vnd.fdsn.seed":"seed","application/vnd.flographit":"gph","application/vnd.fluxtime.clip":"ftc","application/vnd.framemaker":"fm","application/vnd.frogans.fnc":"fnc","application/vnd.frogans.ltf":"ltf","application/vnd.fsc.weblaunch":"fsc","application/vnd.fujitsu.oasys":"oas","application/vnd.fujitsu.oasys2":"oa2","application/vnd.fujitsu.oasys3":"oa3","application/vnd.fujitsu.oasysgp":"fg5","application/vnd.fujitsu.oasysprs":"bh2","application/vnd.fujixerox.ddd":"ddd","application/vnd.fujixerox.docuworks":"xdw","application/vnd.fujixerox.docuworks.binder":"xbd","application/vnd.fuzzysheet":"fzs","application/vnd.genomatix.tuxedo":"txd","application/vnd.geogebra.file":"ggb","application/vnd.geogebra.tool":"ggt","application/vnd.geometry-explorer":"gex","application/vnd.geonext":"gxt","application/vnd.geoplan":"g2w","application/vnd.geospace":"g3w","application/vnd.gmx":"gmx","application/vnd.google-apps.document":"gdoc","application/vnd.google-apps.presentation":"gslides","application/vnd.google-apps.spreadsheet":"gsheet","application/vnd.google-earth.kml+xml":"kml","application/vnd.google-earth.kmz":"kmz","application/vnd.grafeq":"gqf","application/vnd.groove-account":"gac","application/vnd.groove-help":"ghf","application/vnd.groove-identity-message":"gim","application/vnd.groove-injector":"grv","application/vnd.groove-tool-message":"gtm","application/vnd.groove-tool-template":"tpl","application/vnd.groove-vcard":"vcg","application/vnd.hal+xml":"hal","application/vnd.handheld-entertainment+xml":"zmm","application/vnd.hbci":"hbci","application/vnd.hhe.lesson-player":"les","application/vnd.hp-hpgl":"hpgl","application/vnd.hp-hpid":"hpid","application/vnd.hp-hps":"hps","application/vnd.hp-jlyt":"jlt","application/vnd.hp-pcl":"pcl","application/vnd.hp-pclxl":"pclxl","application/vnd.hydrostatix.sof-data":"sfd-hdstx","application/vnd.ibm.minipay":"mpy","application/vnd.ibm.modcap":"afp","application/vnd.ibm.rights-management":"irm","application/vnd.ibm.secure-container":"sc","application/vnd.iccprofile":"icc","application/vnd.igloader":"igl","application/vnd.immervision-ivp":"ivp","application/vnd.immervision-ivu":"ivu","application/vnd.insors.igm":"igm","application/vnd.intercon.formnet":"xpw","application/vnd.intergeo":"i2g","application/vnd.intu.qbo":"qbo","application/vnd.intu.qfx":"qfx","application/vnd.ipunplugged.rcprofile":"rcprofile","application/vnd.irepository.package+xml":"irp","application/vnd.is-xpr":"xpr","application/vnd.isac.fcs":"fcs","application/vnd.jam":"jam","application/vnd.jcp.javame.midlet-rms":"rms","application/vnd.jisp":"jisp","application/vnd.joost.joda-archive":"joda","application/vnd.kahootz":"ktz","application/vnd.kde.karbon":"karbon","application/vnd.kde.kchart":"chrt","application/vnd.kde.kformula":"kfo","application/vnd.kde.kivio":"flw","application/vnd.kde.kontour":"kon","application/vnd.kde.kpresenter":"kpr","application/vnd.kde.kspread":"ksp","application/vnd.kde.kword":"kwd","application/vnd.kenameaapp":"htke","application/vnd.kidspiration":"kia","application/vnd.kinar":"kne","application/vnd.koan":"skp","application/vnd.kodak-descriptor":"sse","application/vnd.las.las+xml":"lasxml","application/vnd.llamagraphics.life-balance.desktop":"lbd","application/vnd.llamagraphics.life-balance.exchange+xml":"lbe","application/vnd.lotus-1-2-3":"123","application/vnd.lotus-approach":"apr","application/vnd.lotus-freelance":"pre","application/vnd.lotus-notes":"nsf","application/vnd.lotus-organizer":"org","application/vnd.lotus-screencam":"scm","application/vnd.lotus-wordpro":"lwp","application/vnd.macports.portpkg":"portpkg","application/vnd.mapbox-vector-tile":"mvt","application/vnd.mcd":"mcd","application/vnd.medcalcdata":"mc1","application/vnd.mediastation.cdkey":"cdkey","application/vnd.mfer":"mwf","application/vnd.mfmp":"mfm","application/vnd.micrografx.flo":"flo","application/vnd.micrografx.igx":"igx","application/vnd.mif":"mif","application/vnd.mobius.daf":"daf","application/vnd.mobius.dis":"dis","application/vnd.mobius.mbk":"mbk","application/vnd.mobius.mqy":"mqy","application/vnd.mobius.msl":"msl","application/vnd.mobius.plc":"plc","application/vnd.mobius.txf":"txf","application/vnd.mophun.application":"mpn","application/vnd.mophun.certificate":"mpc","application/vnd.mozilla.xul+xml":"xul","application/vnd.ms-artgalry":"cil","application/vnd.ms-cab-compressed":"cab","application/vnd.ms-excel":"xls","application/vnd.ms-excel.addin.macroenabled.12":"xlam","application/vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","application/vnd.ms-excel.sheet.macroenabled.12":"xlsm","application/vnd.ms-excel.template.macroenabled.12":"xltm","application/vnd.ms-fontobject":"eot","application/vnd.ms-htmlhelp":"chm","application/vnd.ms-ims":"ims","application/vnd.ms-lrm":"lrm","application/vnd.ms-officetheme":"thmx","application/vnd.ms-outlook":"msg","application/vnd.ms-pki.seccat":"cat","application/vnd.ms-pki.stl":"stl","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-powerpoint.addin.macroenabled.12":"ppam","application/vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","application/vnd.ms-powerpoint.slide.macroenabled.12":"sldm","application/vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","application/vnd.ms-powerpoint.template.macroenabled.12":"potm","application/vnd.ms-project":"mpp","application/vnd.ms-word.document.macroenabled.12":"docm","application/vnd.ms-word.template.macroenabled.12":"dotm","application/vnd.ms-works":"wps","application/vnd.ms-wpl":"wpl","application/vnd.ms-xpsdocument":"xps","application/vnd.mseq":"mseq","application/vnd.musician":"mus","application/vnd.muvee.style":"msty","application/vnd.mynfc":"taglet","application/vnd.neurolanguage.nlu":"nlu","application/vnd.nitf":"ntf","application/vnd.noblenet-directory":"nnd","application/vnd.noblenet-sealer":"nns","application/vnd.noblenet-web":"nnw","application/vnd.nokia.n-gage.ac+xml":"ac","application/vnd.nokia.n-gage.data":"ngdat","application/vnd.nokia.n-gage.symbian.install":"n-gage","application/vnd.nokia.radio-preset":"rpst","application/vnd.nokia.radio-presets":"rpss","application/vnd.novadigm.edm":"edm","application/vnd.novadigm.edx":"edx","application/vnd.novadigm.ext":"ext","application/vnd.oasis.opendocument.chart":"odc","application/vnd.oasis.opendocument.chart-template":"otc","application/vnd.oasis.opendocument.database":"odb","application/vnd.oasis.opendocument.formula":"odf","application/vnd.oasis.opendocument.formula-template":"odft","application/vnd.oasis.opendocument.graphics":"odg","application/vnd.oasis.opendocument.graphics-template":"otg","application/vnd.oasis.opendocument.image":"odi","application/vnd.oasis.opendocument.image-template":"oti","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.presentation-template":"otp","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.spreadsheet-template":"ots","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.text-master":"odm","application/vnd.oasis.opendocument.text-template":"ott","application/vnd.oasis.opendocument.text-web":"oth","application/vnd.olpc-sugar":"xo","application/vnd.oma.dd2+xml":"dd2","application/vnd.openblox.game+xml":"obgx","application/vnd.openofficeorg.extension":"oxt","application/vnd.openstreetmap.data+xml":"osm","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.openxmlformats-officedocument.presentationml.slide":"sldx","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","application/vnd.openxmlformats-officedocument.presentationml.template":"potx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","application/vnd.osgeo.mapguide.package":"mgp","application/vnd.osgi.dp":"dp","application/vnd.osgi.subsystem":"esa","application/vnd.palm":"pdb","application/vnd.pawaafile":"paw","application/vnd.pg.format":"str","application/vnd.pg.osasli":"ei6","application/vnd.picsel":"efif","application/vnd.pmi.widget":"wg","application/vnd.pocketlearn":"plf","application/vnd.powerbuilder6":"pbd","application/vnd.previewsystems.box":"box","application/vnd.proteus.magazine":"mgz","application/vnd.publishare-delta-tree":"qps","application/vnd.pvi.ptid1":"ptid","application/vnd.quark.quarkxpress":"qxd","application/vnd.rar":"rar","application/vnd.realvnc.bed":"bed","application/vnd.recordare.musicxml":"mxl","application/vnd.recordare.musicxml+xml":"musicxml","application/vnd.rig.cryptonote":"cryptonote","application/vnd.rim.cod":"cod","application/vnd.rn-realmedia":"rm","application/vnd.rn-realmedia-vbr":"rmvb","application/vnd.route66.link66+xml":"link66","application/vnd.sailingtracker.track":"st","application/vnd.seemail":"see","application/vnd.sema":"sema","application/vnd.semd":"semd","application/vnd.semf":"semf","application/vnd.shana.informed.formdata":"ifm","application/vnd.shana.informed.formtemplate":"itp","application/vnd.shana.informed.interchange":"iif","application/vnd.shana.informed.package":"ipk","application/vnd.simtech-mindmapper":"twd","application/vnd.smaf":"mmf","application/vnd.smart.teacher":"teacher","application/vnd.software602.filler.form+xml":"fo","application/vnd.solent.sdkm+xml":"sdkm","application/vnd.spotfire.dxp":"dxp","application/vnd.spotfire.sfs":"sfs","application/vnd.stardivision.calc":"sdc","application/vnd.stardivision.draw":"sda","application/vnd.stardivision.impress":"sdd","application/vnd.stardivision.math":"smf","application/vnd.stardivision.writer":"sdw","application/vnd.stardivision.writer-global":"sgl","application/vnd.stepmania.package":"smzip","application/vnd.stepmania.stepchart":"sm","application/vnd.sun.wadl+xml":"wadl","application/vnd.sun.xml.calc":"sxc","application/vnd.sun.xml.calc.template":"stc","application/vnd.sun.xml.draw":"sxd","application/vnd.sun.xml.draw.template":"std","application/vnd.sun.xml.impress":"sxi","application/vnd.sun.xml.impress.template":"sti","application/vnd.sun.xml.math":"sxm","application/vnd.sun.xml.writer":"sxw","application/vnd.sun.xml.writer.global":"sxg","application/vnd.sun.xml.writer.template":"stw","application/vnd.sus-calendar":"sus","application/vnd.svd":"svd","application/vnd.symbian.install":"sis","application/vnd.syncml+xml":"xsm","application/vnd.syncml.dm+wbxml":"bdm","application/vnd.syncml.dm+xml":"xdm","application/vnd.syncml.dmddf+xml":"ddf","application/vnd.tao.intent-module-archive":"tao","application/vnd.tcpdump.pcap":"pcap","application/vnd.tmobile-livetv":"tmo","application/vnd.trid.tpt":"tpt","application/vnd.triscape.mxs":"mxs","application/vnd.trueapp":"tra","application/vnd.ufdl":"ufd","application/vnd.uiq.theme":"utz","application/vnd.umajin":"umj","application/vnd.unity":"unityweb","application/vnd.uoml+xml":"uoml","application/vnd.vcx":"vcx","application/vnd.visio":"vsd","application/vnd.visionary":"vis","application/vnd.vsf":"vsf","application/vnd.wap.wbxml":"wbxml","application/vnd.wap.wmlc":"wmlc","application/vnd.wap.wmlscriptc":"wmlsc","application/vnd.webturbo":"wtb","application/vnd.wolfram.player":"nbp","application/vnd.wordperfect":"wpd","application/vnd.wqd":"wqd","application/vnd.wt.stf":"stf","application/vnd.xara":"xar","application/vnd.xfdl":"xfdl","application/vnd.yamaha.hv-dic":"hvd","application/vnd.yamaha.hv-script":"hvs","application/vnd.yamaha.hv-voice":"hvp","application/vnd.yamaha.openscoreformat":"osf","application/vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","application/vnd.yamaha.smaf-audio":"saf","application/vnd.yamaha.smaf-phrase":"spf","application/vnd.yellowriver-custom-menu":"cmp","application/vnd.zul":"zir","application/vnd.zzazz.deck+xml":"zaz","application/voicexml+xml":"vxml","application/wasm":"wasm","application/watcherinfo+xml":"wif","application/widget":"wgt","application/winhlp":"hlp","application/wsdl+xml":"wsdl","application/wspolicy+xml":"wspolicy","application/x-7z-compressed":"7z","application/x-abiword":"abw","application/x-ace-compressed":"ace","application/x-apple-diskimage":"dmg","application/x-arj":"arj","application/x-authorware-bin":"aab","application/x-authorware-map":"aam","application/x-authorware-seg":"aas","application/x-bcpio":"bcpio","application/x-bdoc":"bdoc","application/x-bittorrent":"torrent","application/x-blorb":"blb","application/x-bzip":"bz","application/x-bzip2":"bz2","application/x-cbr":"cbr","application/x-cdlink":"vcd","application/x-cfs-compressed":"cfs","application/x-chat":"chat","application/x-chess-pgn":"pgn","application/x-chrome-extension":"crx","application/x-cocoa":"cco","application/x-conference":"nsc","application/x-cpio":"cpio","application/x-csh":"csh","application/x-debian-package":"deb","application/x-dgc-compressed":"dgc","application/x-director":"dir","application/x-doom":"wad","application/x-dtbncx+xml":"ncx","application/x-dtbook+xml":"dtb","application/x-dtbresource+xml":"res","application/x-dvi":"dvi","application/x-envoy":"evy","application/x-eva":"eva","application/x-font-bdf":"bdf","application/x-font-ghostscript":"gsf","application/x-font-linux-psf":"psf","application/x-font-pcf":"pcf","application/x-font-snf":"snf","application/x-font-type1":"pfa","application/x-freearc":"arc","application/x-futuresplash":"spl","application/x-gca-compressed":"gca","application/x-glulx":"ulx","application/x-gnumeric":"gnumeric","application/x-gramps-xml":"gramps","application/x-gtar":"gtar","application/x-hdf":"hdf","application/x-httpd-php":"php","application/x-install-instructions":"install","application/x-iso9660-image":"iso","application/x-iwork-keynote-sffkey":"key","application/x-iwork-numbers-sffnumbers":"numbers","application/x-iwork-pages-sffpages":"pages","application/x-java-archive-diff":"jardiff","application/x-java-jnlp-file":"jnlp","application/x-keepass2":"kdbx","application/x-latex":"latex","application/x-lua-bytecode":"luac","application/x-lzh-compressed":"lzh","application/x-makeself":"run","application/x-mie":"mie","application/x-mobipocket-ebook":"prc","application/x-ms-application":"application","application/x-ms-shortcut":"lnk","application/x-ms-wmd":"wmd","application/x-ms-wmz":"wmz","application/x-ms-xbap":"xbap","application/x-msaccess":"mdb","application/x-msbinder":"obd","application/x-mscardfile":"crd","application/x-msclip":"clp","application/x-msdos-program":"exe","application/x-msdownload":"exe","application/x-msmediaview":"mvb","application/x-msmetafile":"wmf","application/x-msmoney":"mny","application/x-mspublisher":"pub","application/x-msschedule":"scd","application/x-msterminal":"trm","application/x-mswrite":"wri","application/x-netcdf":"nc","application/x-ns-proxy-autoconfig":"pac","application/x-nzb":"nzb","application/x-perl":"pl","application/x-pilot":"prc","application/x-pkcs12":"p12","application/x-pkcs7-certificates":"p7b","application/x-pkcs7-certreqresp":"p7r","application/x-rar-compressed":"rar","application/x-redhat-package-manager":"rpm","application/x-research-info-systems":"ris","application/x-sea":"sea","application/x-sh":"sh","application/x-shar":"shar","application/x-shockwave-flash":"swf","application/x-silverlight-app":"xap","application/x-sql":"sql","application/x-stuffit":"sit","application/x-stuffitx":"sitx","application/x-subrip":"srt","application/x-sv4cpio":"sv4cpio","application/x-sv4crc":"sv4crc","application/x-t3vm-image":"t3","application/x-tads":"gam","application/x-tar":"tar","application/x-tcl":"tcl","application/x-tex":"tex","application/x-tex-tfm":"tfm","application/x-texinfo":"texinfo","application/x-tgif":"obj","application/x-ustar":"ustar","application/x-virtualbox-hdd":"hdd","application/x-virtualbox-ova":"ova","application/x-virtualbox-ovf":"ovf","application/x-virtualbox-vbox":"vbox","application/x-virtualbox-vbox-extpack":"vbox-extpack","application/x-virtualbox-vdi":"vdi","application/x-virtualbox-vhd":"vhd","application/x-virtualbox-vmdk":"vmdk","application/x-wais-source":"src","application/x-web-app-manifest+json":"webapp","application/x-x509-ca-cert":"der","application/x-xfig":"fig","application/x-xliff+xml":"xlf","application/x-xpinstall":"xpi","application/x-xz":"xz","application/x-zmachine":"z1","application/xaml+xml":"xaml","application/xcap-att+xml":"xav","application/xcap-caps+xml":"xca","application/xcap-diff+xml":"xdf","application/xcap-el+xml":"xel","application/xcap-ns+xml":"xns","application/xenc+xml":"xenc","application/xhtml+xml":"xhtml","application/xliff+xml":"xlf","application/xml":"xml","application/xml-dtd":"dtd","application/xop+xml":"xop","application/xproc+xml":"xpl","application/xslt+xml":"xsl","application/xspf+xml":"xspf","application/xv+xml":"mxml","application/yang":"yang","application/yin+xml":"yin","application/zip":"zip","audio/3gpp":"3gpp","audio/adpcm":"adp","audio/amr":"amr","audio/basic":"au","audio/midi":"mid","audio/mobile-xmf":"mxmf","audio/mp3":"mp3","audio/mp4":"m4a","audio/mpeg":"mpga","audio/ogg":"oga","audio/s3m":"s3m","audio/silk":"sil","audio/vnd.dece.audio":"uva","audio/vnd.digital-winds":"eol","audio/vnd.dra":"dra","audio/vnd.dts":"dts","audio/vnd.dts.hd":"dtshd","audio/vnd.lucent.voice":"lvp","audio/vnd.ms-playready.media.pya":"pya","audio/vnd.nuera.ecelp4800":"ecelp4800","audio/vnd.nuera.ecelp7470":"ecelp7470","audio/vnd.nuera.ecelp9600":"ecelp9600","audio/vnd.rip":"rip","audio/wav":"wav","audio/wave":"wav","audio/webm":"weba","audio/x-aac":"aac","audio/x-aiff":"aif","audio/x-caf":"caf","audio/x-flac":"flac","audio/x-m4a":"m4a","audio/x-matroska":"mka","audio/x-mpegurl":"m3u","audio/x-ms-wax":"wax","audio/x-ms-wma":"wma","audio/x-pn-realaudio":"ram","audio/x-pn-realaudio-plugin":"rmp","audio/x-realaudio":"ra","audio/x-wav":"wav","audio/xm":"xm","chemical/x-cdx":"cdx","chemical/x-cif":"cif","chemical/x-cmdf":"cmdf","chemical/x-cml":"cml","chemical/x-csml":"csml","chemical/x-xyz":"xyz","font/collection":"ttc","font/otf":"otf","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","image/aces":"exr","image/apng":"apng","image/avci":"avci","image/avcs":"avcs","image/avif":"avif","image/bmp":"bmp","image/cgm":"cgm","image/dicom-rle":"drle","image/emf":"emf","image/fits":"fits","image/g3fax":"g3","image/gif":"gif","image/heic":"heic","image/heic-sequence":"heics","image/heif":"heif","image/heif-sequence":"heifs","image/hej2k":"hej2","image/hsj2":"hsj2","image/ief":"ief","image/jls":"jls","image/jp2":"jp2","image/jpeg":"jpeg","image/jph":"jph","image/jphc":"jhc","image/jpm":"jpm","image/jpx":"jpx","image/jxr":"jxr","image/jxra":"jxra","image/jxrs":"jxrs","image/jxs":"jxs","image/jxsc":"jxsc","image/jxsi":"jxsi","image/jxss":"jxss","image/ktx":"ktx","image/ktx2":"ktx2","image/png":"png","image/prs.btif":"btif","image/prs.pti":"pti","image/sgi":"sgi","image/svg+xml":"svg","image/t38":"t38","image/tiff":"tif","image/tiff-fx":"tfx","image/vnd.adobe.photoshop":"psd","image/vnd.airzip.accelerator.azv":"azv","image/vnd.dece.graphic":"uvi","image/vnd.djvu":"djvu","image/vnd.dvb.subtitle":"sub","image/vnd.dwg":"dwg","image/vnd.dxf":"dxf","image/vnd.fastbidsheet":"fbs","image/vnd.fpx":"fpx","image/vnd.fst":"fst","image/vnd.fujixerox.edmics-mmr":"mmr","image/vnd.fujixerox.edmics-rlc":"rlc","image/vnd.microsoft.icon":"ico","image/vnd.ms-dds":"dds","image/vnd.ms-modi":"mdi","image/vnd.ms-photo":"wdp","image/vnd.net-fpx":"npx","image/vnd.pco.b16":"b16","image/vnd.tencent.tap":"tap","image/vnd.valve.source.texture":"vtf","image/vnd.wap.wbmp":"wbmp","image/vnd.xiff":"xif","image/vnd.zbrush.pcx":"pcx","image/webp":"webp","image/wmf":"wmf","image/x-3ds":"3ds","image/x-cmu-raster":"ras","image/x-cmx":"cmx","image/x-freehand":"fh","image/x-icon":"ico","image/x-jng":"jng","image/x-mrsid-image":"sid","image/x-ms-bmp":"bmp","image/x-pcx":"pcx","image/x-pict":"pic","image/x-portable-anymap":"pnm","image/x-portable-bitmap":"pbm","image/x-portable-graymap":"pgm","image/x-portable-pixmap":"ppm","image/x-rgb":"rgb","image/x-tga":"tga","image/x-xbitmap":"xbm","image/x-xpixmap":"xpm","image/x-xwindowdump":"xwd","message/disposition-notification":"disposition-notification","message/global":"u8msg","message/global-delivery-status":"u8dsn","message/global-disposition-notification":"u8mdn","message/global-headers":"u8hdr","message/rfc822":"eml","message/vnd.wfa.wsc":"wsc","model/3mf":"3mf","model/gltf+json":"gltf","model/gltf-binary":"glb","model/iges":"igs","model/mesh":"msh","model/mtl":"mtl","model/obj":"obj","model/step+xml":"stpx","model/step+zip":"stpz","model/step-xml+zip":"stpxz","model/stl":"stl","model/vnd.collada+xml":"dae","model/vnd.dwf":"dwf","model/vnd.gdl":"gdl","model/vnd.gtw":"gtw","model/vnd.mts":"mts","model/vnd.opengex":"ogex","model/vnd.parasolid.transmit.binary":"x_b","model/vnd.parasolid.transmit.text":"x_t","model/vnd.sap.vds":"vds","model/vnd.usdz+zip":"usdz","model/vnd.valve.source.compiled-map":"bsp","model/vnd.vtu":"vtu","model/vrml":"wrl","model/x3d+binary":"x3db","model/x3d+fastinfoset":"x3db","model/x3d+vrml":"x3dv","model/x3d+xml":"x3d","model/x3d-vrml":"x3dv","text/cache-manifest":"appcache","text/calendar":"ics","text/coffeescript":"coffee","text/css":"css","text/csv":"csv","text/html":"html","text/jade":"jade","text/jsx":"jsx","text/less":"less","text/markdown":"markdown","text/mathml":"mml","text/mdx":"mdx","text/n3":"n3","text/plain":"txt","text/prs.lines.tag":"dsc","text/richtext":"rtx","text/rtf":"rtf","text/sgml":"sgml","text/shex":"shex","text/slim":"slim","text/spdx":"spdx","text/stylus":"stylus","text/tab-separated-values":"tsv","text/troff":"t","text/turtle":"ttl","text/uri-list":"uri","text/vcard":"vcard","text/vnd.curl":"curl","text/vnd.curl.dcurl":"dcurl","text/vnd.curl.mcurl":"mcurl","text/vnd.curl.scurl":"scurl","text/vnd.dvb.subtitle":"sub","text/vnd.familysearch.gedcom":"ged","text/vnd.fly":"fly","text/vnd.fmi.flexstor":"flx","text/vnd.graphviz":"gv","text/vnd.in3d.3dml":"3dml","text/vnd.in3d.spot":"spot","text/vnd.sun.j2me.app-descriptor":"jad","text/vnd.wap.wml":"wml","text/vnd.wap.wmlscript":"wmls","text/vtt":"vtt","text/x-asm":"s","text/x-c":"c","text/x-component":"htc","text/x-fortran":"f","text/x-handlebars-template":"hbs","text/x-java-source":"java","text/x-lua":"lua","text/x-markdown":"mkd","text/x-nfo":"nfo","text/x-opml":"opml","text/x-org":"org","text/x-pascal":"p","text/x-processing":"pde","text/x-sass":"sass","text/x-scss":"scss","text/x-setext":"etx","text/x-sfv":"sfv","text/x-suse-ymp":"ymp","text/x-uuencode":"uu","text/x-vcalendar":"vcs","text/x-vcard":"vcf","text/xml":"xml","text/yaml":"yaml","video/3gpp":"3gp","video/3gpp2":"3g2","video/h261":"h261","video/h263":"h263","video/h264":"h264","video/iso.segment":"m4s","video/jpeg":"jpgv","video/jpm":"jpm","video/mj2":"mj2","video/mp2t":"ts","video/mp4":"mp4","video/mpeg":"mpeg","video/ogg":"ogv","video/quicktime":"qt","video/vnd.dece.hd":"uvh","video/vnd.dece.mobile":"uvm","video/vnd.dece.pd":"uvp","video/vnd.dece.sd":"uvs","video/vnd.dece.video":"uvv","video/vnd.dvb.file":"dvb","video/vnd.fvt":"fvt","video/vnd.mpegurl":"mxu","video/vnd.ms-playready.media.pyv":"pyv","video/vnd.uvvu.mp4":"uvu","video/vnd.vivo":"viv","video/webm":"webm","video/x-f4v":"f4v","video/x-fli":"fli","video/x-flv":"flv","video/x-m4v":"m4v","video/x-matroska":"mkv","video/x-mng":"mng","video/x-ms-asf":"asf","video/x-ms-vob":"vob","video/x-ms-wm":"wm","video/x-ms-wmv":"wmv","video/x-ms-wmx":"wmx","video/x-ms-wvx":"wvx","video/x-msvideo":"avi","video/x-sgi-movie":"movie","video/x-smv":"smv","x-conference/x-cooltalk":"ice"},jg=/^\s*([^;\s]*)(?:;|\s|$)/;function vr(n){if(!n||typeof n!="string")return"";let t=jg.exec(n);return t&&Ug[t[1].toLowerCase()]||""}var Sn=n=>Ze(n).replace(/[\[\]\#\^]/g,""),hi=(n,t)=>K.readdirSync(n).filter(i=>{let r=i.split(".").slice(0,-1).join("."),o=Nn(t),a=r.match(new RegExp(`${o}\\.\\d+`));return r===t||a}).length,iu=(n,t)=>{let e=B.useUniqueUnknownFileNames?"unknown_filename"+(Math.random().toString(16)+"0000000").slice(2,10):"unknown_filename",i=Wg(t),r=e;if(t["resource-attributes"]&&t["resource-attributes"]["file-name"]){let s=t["resource-attributes"]["file-name"].substr(0,50);r=oe(s).basename}r=r.replace(/[/\\?%*:|"<>\[\]\+]/g,"-"),B.sanitizeResourceNameSpaces&&(r=r.replace(/ /g,B.replacementChar));let o=hi(n,r);return{fileName:`${o>0?`${r}.${o}`:r}.${i}`,extension:i,index:o}},Fa=n=>Sn(n.title?`${n.title.toString()}`:"Untitled"),ru=(n,t,e="md")=>`${La(n,t)}.${e}`,Hg=n=>{if(!(n["resource-attributes"]&&n["resource-attributes"]["file-name"]))return"";let t=n["resource-attributes"]["file-name"].split(".");return t.length>1?t[t.length-1]:void 0},qg=n=>{let t=n.mime;return t&&vr(t)||""},Wg=n=>{let t="dat";return Hg(n)||qg(n)||t},Zg=(n,t)=>(0,nu.moment)(n.created).format("YYYYMMDDHHmm"),La=(n,t)=>{let e;if(B.isZettelkastenNeeded||B.useZettelIdAsFilename){let i=Zg(t,n),r=hi(n,i),o=" ";e=r!==0?`${i}.${r}`:i,B.useZettelIdAsFilename||(e+=Fa(t)!=="Untitled"?`${o}${Fa(t)}`:"")}else{let i=Fa(t),r=hi(n,i);e=r===0?i:`${i}.${r}`}return e};var ou=n=>n==="Table of Contents";var Yg=n=>n.replace(/\[|\]/g,""),zg=n=>n.replace(/\\/g,""),su={filter:qe("A"),replacement:(n,t)=>{let e=ue(t);if(!e.href)return"";let i=Er(B).turndown(Yg(t.innerHTML));i=zg(i);let r="",o=i.match(/^(#{1,6} )(.*)/);o&&(r=o[1],i=o[2]);let a=e.href.value,s=e.type?e.type.value:void 0,l=B.urlEncodeFileNamesAndLinks?encodeURI(a):a;if(s==="file")return`![[${l}]]`;if(a.match(/^(https?:|www\.|file:|ftp:|mailto:)/))return r+Kg(i,a);if(a.startsWith("evernote://")){let c=Sn(i),p=fe.getInstance(),m=xn(6);return ou(p.getCurrentNoteName())?p.addItemToTOCMap({url:a,title:c,uniqueEnd:m}):p.addItemToMap({url:a,title:c,uniqueEnd:m}),r+`[[${a}]]`}return r+`[[${l}${i===l?"":`|${i}`}]]`}},Gg={"&":"&","<":"<",">":">",""":'"',"'":"'"},lu=/&(?:amp|lt|gt|quot|#39);/g,Vg=RegExp(lu.source);function au(n){return n&&Vg.test(n)?n.replace(lu,t=>Gg[t]):n}var Kg=(n,t)=>!n||au(n)===au(t)?B.generateNakedUrls?t:`<${t}>`:`[${n}](${t})`;var xe={bold:"**",italic:"_",highlight:"==",strikethrough:"~~"};var Xg="-evernote-highlight:true;",Jg="--en-highlight",Qg="bold",e0="italic",cu={filter:qe("SPAN"),replacement:(n,t)=>{let e=ue(t);if(e.style&&n.trim()!==""){let i=e.style.value;if(n!==""){let r=i.includes(Qg),o=i.includes(e0);if(r&&!o)return`${xe.bold}${n}${xe.bold}`;if(!r&&o)return`${xe.italic}${n}${xe.italic}`;if(r&&o)return`${xe.italic}${xe.bold}${n}${xe.bold}${xe.italic}`}return i.includes(Xg)||i.includes(Jg)?`${xe.highlight}${n}${xe.highlight}`:n}return n}};var pu={filter:["del","s","strike"],replacement:n=>`${xe.strikethrough}${n}${xe.strikethrough}`};var uu={filter:qe("EN-TODO"),replacement:(n,t)=>{var r,o;let e=ue(t);return`${((o=(r=t.parentElement)==null?void 0:r.nodeName)==null?void 0:o.toUpperCase())==="LI"?"":"- "}${e.checked&&e.checked.value==="true"?"[x]":"[ ]"} ${n}`}};var fu={filter:qe("BR"),replacement:(n,t)=>""};var t0=n=>{let t=ue(n),e="--en-task-group:true";return t.style&&t.style.value.indexOf(e)>=0},n0=n=>{let t=ue(n),e="--en-id:";return t.style.value.split(e)[1].split(";")[0]},du={filter:qe("DIV"),replacement:(n,t)=>t0(t)?`${n0(t)}`:B.monospaceIsCodeBlock?eu(n,t):Jp(n,t)};var mu={filter:["i"],replacement:n=>n.trim()!==""?`${xe.italic}${n}${xe.italic}`:n};var _r="- [ ]",Tr="- [x]";var hu=" ",gu={filter:"li",replacement:(n,t,e)=>{let i=m=>{let y=ue(m),E="--en-checked:true;";return y.style&&y.style.value.indexOf(E)>=0},r=m=>{let y=ue(m),E="--en-checked:false;";return y.style&&y.style.value.indexOf(E)>=0},o=n.match(/^\n*/)[0].length||0,a=hu.repeat(o),s=n.replace(/^\n+/,"").replace(/\n+$/,` +`:n};var qe=n=>t=>t.nodeName===n||t.nodeName.toLowerCase()===n;var tu={filter:qe("IMG"),replacement:(n,t)=>{let e=ue(t);if(!e.src)return"";let i=e.src.value,r=t.width||"",o=t.height||"",a=i;B.sanitizeResourceNameSpaces?a=a.replace(/ /g,B.replacementChar):B.urlEncodeFileNamesAndLinks&&(a=encodeURI(a));let s=r||o?` =${r}x${o}`:"";if(B.keepImageSize)return s=r||o?`|${r||0}x${o||0}`:"",a.startsWith("./")?`![[${a}${s}]]`:`![${s}](${a})`;if(!i.match(/^[a-z]+:/))return`![[${a}]]`;let l=e.src.value.split("/");return`![${l[l.length-1]}](${a})`}};var fe=class{constructor(){this.noteIdNameMap={},this.noteIdNameTOCMap={}}static getInstance(){return fe.instance||(fe.instance=new fe),fe.instance}addItemToMap(t){this.noteIdNameMap[t.url]={...this.noteIdNameMap[t.url],title:t.title,noteName:this.currentNoteName,notebookName:this.currentNotebookName,uniqueEnd:t.uniqueEnd}}addItemToTOCMap(t){this.noteIdNameTOCMap[t.url]={...this.noteIdNameMap[t.url],title:t.title,noteName:this.currentNoteName,notebookName:this.currentNotebookName,uniqueEnd:t.uniqueEnd}}getNoteIdNameMap(){return this.noteIdNameMap}getNoteIdNameTOCMap(){return this.noteIdNameTOCMap}getAllNoteIdNameMap(){return{...this.noteIdNameMap,...this.noteIdNameTOCMap}}getNoteIdNameMapByNoteTitle(t){return Object.values(this.getAllNoteIdNameMap()).filter(e=>e.title===t)}setCurrentNotebookName(t){this.currentNotebookName=t}getCurrentNotebookName(){return this.currentNotebookName}setCurrentNotebookFullpath(t){this.currentNotebookFullpath=t}setCurrentNoteName(t){this.currentNoteName=t}getCurrentNoteName(){return this.currentNoteName}getCurrentNotePath(){return this.currentNotePath}setCurrentNotePath(t){this.currentNotePath=t}getCurrentNotebookFullpath(){return this.currentNotebookFullpath}};var nu=require("obsidian");var Sn=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Ug={"application/andrew-inset":"ez","application/applixware":"aw","application/atom+xml":"atom","application/atomcat+xml":"atomcat","application/atomdeleted+xml":"atomdeleted","application/atomsvc+xml":"atomsvc","application/atsc-dwd+xml":"dwd","application/atsc-held+xml":"held","application/atsc-rsat+xml":"rsat","application/bdoc":"bdoc","application/calendar+xml":"xcs","application/ccxml+xml":"ccxml","application/cdfx+xml":"cdfx","application/cdmi-capability":"cdmia","application/cdmi-container":"cdmic","application/cdmi-domain":"cdmid","application/cdmi-object":"cdmio","application/cdmi-queue":"cdmiq","application/cpl+xml":"cpl","application/cu-seeme":"cu","application/dash+xml":"mpd","application/dash-patch+xml":"mpp","application/davmount+xml":"davmount","application/docbook+xml":"dbk","application/dssc+der":"dssc","application/dssc+xml":"xdssc","application/ecmascript":"es","application/emma+xml":"emma","application/emotionml+xml":"emotionml","application/epub+zip":"epub","application/exi":"exi","application/express":"exp","application/fdt+xml":"fdt","application/font-tdpfr":"pfr","application/geo+json":"geojson","application/gml+xml":"gml","application/gpx+xml":"gpx","application/gxf":"gxf","application/gzip":"gz","application/hjson":"hjson","application/hyperstudio":"stk","application/inkml+xml":"ink","application/ipfix":"ipfix","application/its+xml":"its","application/java-archive":"jar","application/java-serialized-object":"ser","application/java-vm":"class","application/javascript":"js","application/json":"json","application/json5":"json5","application/jsonml+json":"jsonml","application/ld+json":"jsonld","application/lgr+xml":"lgr","application/lost+xml":"lostxml","application/mac-binhex40":"hqx","application/mac-compactpro":"cpt","application/mads+xml":"mads","application/manifest+json":"webmanifest","application/marc":"mrc","application/marcxml+xml":"mrcx","application/mathematica":"ma","application/mathml+xml":"mathml","application/mbox":"mbox","application/media-policy-dataset+xml":"mpf","application/mediaservercontrol+xml":"mscml","application/metalink+xml":"metalink","application/metalink4+xml":"meta4","application/mets+xml":"mets","application/mmt-aei+xml":"maei","application/mmt-usd+xml":"musd","application/mods+xml":"mods","application/mp21":"m21","application/mp4":"mp4s","application/msword":"doc","application/mxf":"mxf","application/n-quads":"nq","application/n-triples":"nt","application/node":"cjs","application/octet-stream":"bin","application/oda":"oda","application/oebps-package+xml":"opf","application/ogg":"ogx","application/omdoc+xml":"omdoc","application/onenote":"onetoc","application/oxps":"oxps","application/p2p-overlay+xml":"relo","application/patch-ops-error+xml":"xer","application/pdf":"pdf","application/pgp-encrypted":"pgp","application/pgp-keys":"asc","application/pgp-signature":"asc","application/pics-rules":"prf","application/pkcs10":"p10","application/pkcs7-mime":"p7m","application/pkcs7-signature":"p7s","application/pkcs8":"p8","application/pkix-attr-cert":"ac","application/pkix-cert":"cer","application/pkix-crl":"crl","application/pkix-pkipath":"pkipath","application/pkixcmp":"pki","application/pls+xml":"pls","application/postscript":"ai","application/provenance+xml":"provx","application/prs.cww":"cww","application/pskc+xml":"pskcxml","application/raml+yaml":"raml","application/rdf+xml":"rdf","application/reginfo+xml":"rif","application/relax-ng-compact-syntax":"rnc","application/resource-lists+xml":"rl","application/resource-lists-diff+xml":"rld","application/rls-services+xml":"rs","application/route-apd+xml":"rapd","application/route-s-tsid+xml":"sls","application/route-usd+xml":"rusd","application/rpki-ghostbusters":"gbr","application/rpki-manifest":"mft","application/rpki-roa":"roa","application/rsd+xml":"rsd","application/rss+xml":"rss","application/rtf":"rtf","application/sbml+xml":"sbml","application/scvp-cv-request":"scq","application/scvp-cv-response":"scs","application/scvp-vp-request":"spq","application/scvp-vp-response":"spp","application/sdp":"sdp","application/senml+xml":"senmlx","application/sensml+xml":"sensmlx","application/set-payment-initiation":"setpay","application/set-registration-initiation":"setreg","application/shf+xml":"shf","application/sieve":"siv","application/smil+xml":"smi","application/sparql-query":"rq","application/sparql-results+xml":"srx","application/srgs":"gram","application/srgs+xml":"grxml","application/sru+xml":"sru","application/ssdl+xml":"ssdl","application/ssml+xml":"ssml","application/swid+xml":"swidtag","application/tei+xml":"tei","application/thraud+xml":"tfi","application/timestamped-data":"tsd","application/toml":"toml","application/trig":"trig","application/ttml+xml":"ttml","application/ubjson":"ubj","application/urc-ressheet+xml":"rsheet","application/urc-targetdesc+xml":"td","application/vnd.1000minds.decision-model+xml":"1km","application/vnd.3gpp.pic-bw-large":"plb","application/vnd.3gpp.pic-bw-small":"psb","application/vnd.3gpp.pic-bw-var":"pvb","application/vnd.3gpp2.tcap":"tcap","application/vnd.3m.post-it-notes":"pwn","application/vnd.accpac.simply.aso":"aso","application/vnd.accpac.simply.imp":"imp","application/vnd.acucobol":"acu","application/vnd.acucorp":"atc","application/vnd.adobe.air-application-installer-package+zip":"air","application/vnd.adobe.formscentral.fcdt":"fcdt","application/vnd.adobe.fxp":"fxp","application/vnd.adobe.xdp+xml":"xdp","application/vnd.adobe.xfdf":"xfdf","application/vnd.age":"age","application/vnd.ahead.space":"ahead","application/vnd.airzip.filesecure.azf":"azf","application/vnd.airzip.filesecure.azs":"azs","application/vnd.amazon.ebook":"azw","application/vnd.americandynamics.acc":"acc","application/vnd.amiga.ami":"ami","application/vnd.android.package-archive":"apk","application/vnd.anser-web-certificate-issue-initiation":"cii","application/vnd.anser-web-funds-transfer-initiation":"fti","application/vnd.antix.game-component":"atx","application/vnd.apple.installer+xml":"mpkg","application/vnd.apple.keynote":"key","application/vnd.apple.mpegurl":"m3u8","application/vnd.apple.numbers":"numbers","application/vnd.apple.pages":"pages","application/vnd.apple.pkpass":"pkpass","application/vnd.aristanetworks.swi":"swi","application/vnd.astraea-software.iota":"iota","application/vnd.audiograph":"aep","application/vnd.balsamiq.bmml+xml":"bmml","application/vnd.blueice.multipass":"mpm","application/vnd.bmi":"bmi","application/vnd.businessobjects":"rep","application/vnd.chemdraw+xml":"cdxml","application/vnd.chipnuts.karaoke-mmd":"mmd","application/vnd.cinderella":"cdy","application/vnd.citationstyles.style+xml":"csl","application/vnd.claymore":"cla","application/vnd.cloanto.rp9":"rp9","application/vnd.clonk.c4group":"c4g","application/vnd.cluetrust.cartomobile-config":"c11amc","application/vnd.cluetrust.cartomobile-config-pkg":"c11amz","application/vnd.commonspace":"csp","application/vnd.contact.cmsg":"cdbcmsg","application/vnd.cosmocaller":"cmc","application/vnd.crick.clicker":"clkx","application/vnd.crick.clicker.keyboard":"clkk","application/vnd.crick.clicker.palette":"clkp","application/vnd.crick.clicker.template":"clkt","application/vnd.crick.clicker.wordbank":"clkw","application/vnd.criticaltools.wbs+xml":"wbs","application/vnd.ctc-posml":"pml","application/vnd.cups-ppd":"ppd","application/vnd.curl.car":"car","application/vnd.curl.pcurl":"pcurl","application/vnd.dart":"dart","application/vnd.data-vision.rdz":"rdz","application/vnd.dbf":"dbf","application/vnd.dece.data":"uvf","application/vnd.dece.ttml+xml":"uvt","application/vnd.dece.unspecified":"uvx","application/vnd.dece.zip":"uvz","application/vnd.denovo.fcselayout-link":"fe_launch","application/vnd.dna":"dna","application/vnd.dolby.mlp":"mlp","application/vnd.dpgraph":"dpg","application/vnd.dreamfactory":"dfac","application/vnd.ds-keypoint":"kpxx","application/vnd.dvb.ait":"ait","application/vnd.dvb.service":"svc","application/vnd.dynageo":"geo","application/vnd.ecowin.chart":"mag","application/vnd.enliven":"nml","application/vnd.epson.esf":"esf","application/vnd.epson.msf":"msf","application/vnd.epson.quickanime":"qam","application/vnd.epson.salt":"slt","application/vnd.epson.ssf":"ssf","application/vnd.eszigno3+xml":"es3","application/vnd.ezpix-album":"ez2","application/vnd.ezpix-package":"ez3","application/vnd.fdf":"fdf","application/vnd.fdsn.mseed":"mseed","application/vnd.fdsn.seed":"seed","application/vnd.flographit":"gph","application/vnd.fluxtime.clip":"ftc","application/vnd.framemaker":"fm","application/vnd.frogans.fnc":"fnc","application/vnd.frogans.ltf":"ltf","application/vnd.fsc.weblaunch":"fsc","application/vnd.fujitsu.oasys":"oas","application/vnd.fujitsu.oasys2":"oa2","application/vnd.fujitsu.oasys3":"oa3","application/vnd.fujitsu.oasysgp":"fg5","application/vnd.fujitsu.oasysprs":"bh2","application/vnd.fujixerox.ddd":"ddd","application/vnd.fujixerox.docuworks":"xdw","application/vnd.fujixerox.docuworks.binder":"xbd","application/vnd.fuzzysheet":"fzs","application/vnd.genomatix.tuxedo":"txd","application/vnd.geogebra.file":"ggb","application/vnd.geogebra.tool":"ggt","application/vnd.geometry-explorer":"gex","application/vnd.geonext":"gxt","application/vnd.geoplan":"g2w","application/vnd.geospace":"g3w","application/vnd.gmx":"gmx","application/vnd.google-apps.document":"gdoc","application/vnd.google-apps.presentation":"gslides","application/vnd.google-apps.spreadsheet":"gsheet","application/vnd.google-earth.kml+xml":"kml","application/vnd.google-earth.kmz":"kmz","application/vnd.grafeq":"gqf","application/vnd.groove-account":"gac","application/vnd.groove-help":"ghf","application/vnd.groove-identity-message":"gim","application/vnd.groove-injector":"grv","application/vnd.groove-tool-message":"gtm","application/vnd.groove-tool-template":"tpl","application/vnd.groove-vcard":"vcg","application/vnd.hal+xml":"hal","application/vnd.handheld-entertainment+xml":"zmm","application/vnd.hbci":"hbci","application/vnd.hhe.lesson-player":"les","application/vnd.hp-hpgl":"hpgl","application/vnd.hp-hpid":"hpid","application/vnd.hp-hps":"hps","application/vnd.hp-jlyt":"jlt","application/vnd.hp-pcl":"pcl","application/vnd.hp-pclxl":"pclxl","application/vnd.hydrostatix.sof-data":"sfd-hdstx","application/vnd.ibm.minipay":"mpy","application/vnd.ibm.modcap":"afp","application/vnd.ibm.rights-management":"irm","application/vnd.ibm.secure-container":"sc","application/vnd.iccprofile":"icc","application/vnd.igloader":"igl","application/vnd.immervision-ivp":"ivp","application/vnd.immervision-ivu":"ivu","application/vnd.insors.igm":"igm","application/vnd.intercon.formnet":"xpw","application/vnd.intergeo":"i2g","application/vnd.intu.qbo":"qbo","application/vnd.intu.qfx":"qfx","application/vnd.ipunplugged.rcprofile":"rcprofile","application/vnd.irepository.package+xml":"irp","application/vnd.is-xpr":"xpr","application/vnd.isac.fcs":"fcs","application/vnd.jam":"jam","application/vnd.jcp.javame.midlet-rms":"rms","application/vnd.jisp":"jisp","application/vnd.joost.joda-archive":"joda","application/vnd.kahootz":"ktz","application/vnd.kde.karbon":"karbon","application/vnd.kde.kchart":"chrt","application/vnd.kde.kformula":"kfo","application/vnd.kde.kivio":"flw","application/vnd.kde.kontour":"kon","application/vnd.kde.kpresenter":"kpr","application/vnd.kde.kspread":"ksp","application/vnd.kde.kword":"kwd","application/vnd.kenameaapp":"htke","application/vnd.kidspiration":"kia","application/vnd.kinar":"kne","application/vnd.koan":"skp","application/vnd.kodak-descriptor":"sse","application/vnd.las.las+xml":"lasxml","application/vnd.llamagraphics.life-balance.desktop":"lbd","application/vnd.llamagraphics.life-balance.exchange+xml":"lbe","application/vnd.lotus-1-2-3":"123","application/vnd.lotus-approach":"apr","application/vnd.lotus-freelance":"pre","application/vnd.lotus-notes":"nsf","application/vnd.lotus-organizer":"org","application/vnd.lotus-screencam":"scm","application/vnd.lotus-wordpro":"lwp","application/vnd.macports.portpkg":"portpkg","application/vnd.mapbox-vector-tile":"mvt","application/vnd.mcd":"mcd","application/vnd.medcalcdata":"mc1","application/vnd.mediastation.cdkey":"cdkey","application/vnd.mfer":"mwf","application/vnd.mfmp":"mfm","application/vnd.micrografx.flo":"flo","application/vnd.micrografx.igx":"igx","application/vnd.mif":"mif","application/vnd.mobius.daf":"daf","application/vnd.mobius.dis":"dis","application/vnd.mobius.mbk":"mbk","application/vnd.mobius.mqy":"mqy","application/vnd.mobius.msl":"msl","application/vnd.mobius.plc":"plc","application/vnd.mobius.txf":"txf","application/vnd.mophun.application":"mpn","application/vnd.mophun.certificate":"mpc","application/vnd.mozilla.xul+xml":"xul","application/vnd.ms-artgalry":"cil","application/vnd.ms-cab-compressed":"cab","application/vnd.ms-excel":"xls","application/vnd.ms-excel.addin.macroenabled.12":"xlam","application/vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","application/vnd.ms-excel.sheet.macroenabled.12":"xlsm","application/vnd.ms-excel.template.macroenabled.12":"xltm","application/vnd.ms-fontobject":"eot","application/vnd.ms-htmlhelp":"chm","application/vnd.ms-ims":"ims","application/vnd.ms-lrm":"lrm","application/vnd.ms-officetheme":"thmx","application/vnd.ms-outlook":"msg","application/vnd.ms-pki.seccat":"cat","application/vnd.ms-pki.stl":"stl","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-powerpoint.addin.macroenabled.12":"ppam","application/vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","application/vnd.ms-powerpoint.slide.macroenabled.12":"sldm","application/vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","application/vnd.ms-powerpoint.template.macroenabled.12":"potm","application/vnd.ms-project":"mpp","application/vnd.ms-word.document.macroenabled.12":"docm","application/vnd.ms-word.template.macroenabled.12":"dotm","application/vnd.ms-works":"wps","application/vnd.ms-wpl":"wpl","application/vnd.ms-xpsdocument":"xps","application/vnd.mseq":"mseq","application/vnd.musician":"mus","application/vnd.muvee.style":"msty","application/vnd.mynfc":"taglet","application/vnd.neurolanguage.nlu":"nlu","application/vnd.nitf":"ntf","application/vnd.noblenet-directory":"nnd","application/vnd.noblenet-sealer":"nns","application/vnd.noblenet-web":"nnw","application/vnd.nokia.n-gage.ac+xml":"ac","application/vnd.nokia.n-gage.data":"ngdat","application/vnd.nokia.n-gage.symbian.install":"n-gage","application/vnd.nokia.radio-preset":"rpst","application/vnd.nokia.radio-presets":"rpss","application/vnd.novadigm.edm":"edm","application/vnd.novadigm.edx":"edx","application/vnd.novadigm.ext":"ext","application/vnd.oasis.opendocument.chart":"odc","application/vnd.oasis.opendocument.chart-template":"otc","application/vnd.oasis.opendocument.database":"odb","application/vnd.oasis.opendocument.formula":"odf","application/vnd.oasis.opendocument.formula-template":"odft","application/vnd.oasis.opendocument.graphics":"odg","application/vnd.oasis.opendocument.graphics-template":"otg","application/vnd.oasis.opendocument.image":"odi","application/vnd.oasis.opendocument.image-template":"oti","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.presentation-template":"otp","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.spreadsheet-template":"ots","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.text-master":"odm","application/vnd.oasis.opendocument.text-template":"ott","application/vnd.oasis.opendocument.text-web":"oth","application/vnd.olpc-sugar":"xo","application/vnd.oma.dd2+xml":"dd2","application/vnd.openblox.game+xml":"obgx","application/vnd.openofficeorg.extension":"oxt","application/vnd.openstreetmap.data+xml":"osm","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.openxmlformats-officedocument.presentationml.slide":"sldx","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","application/vnd.openxmlformats-officedocument.presentationml.template":"potx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","application/vnd.osgeo.mapguide.package":"mgp","application/vnd.osgi.dp":"dp","application/vnd.osgi.subsystem":"esa","application/vnd.palm":"pdb","application/vnd.pawaafile":"paw","application/vnd.pg.format":"str","application/vnd.pg.osasli":"ei6","application/vnd.picsel":"efif","application/vnd.pmi.widget":"wg","application/vnd.pocketlearn":"plf","application/vnd.powerbuilder6":"pbd","application/vnd.previewsystems.box":"box","application/vnd.proteus.magazine":"mgz","application/vnd.publishare-delta-tree":"qps","application/vnd.pvi.ptid1":"ptid","application/vnd.quark.quarkxpress":"qxd","application/vnd.rar":"rar","application/vnd.realvnc.bed":"bed","application/vnd.recordare.musicxml":"mxl","application/vnd.recordare.musicxml+xml":"musicxml","application/vnd.rig.cryptonote":"cryptonote","application/vnd.rim.cod":"cod","application/vnd.rn-realmedia":"rm","application/vnd.rn-realmedia-vbr":"rmvb","application/vnd.route66.link66+xml":"link66","application/vnd.sailingtracker.track":"st","application/vnd.seemail":"see","application/vnd.sema":"sema","application/vnd.semd":"semd","application/vnd.semf":"semf","application/vnd.shana.informed.formdata":"ifm","application/vnd.shana.informed.formtemplate":"itp","application/vnd.shana.informed.interchange":"iif","application/vnd.shana.informed.package":"ipk","application/vnd.simtech-mindmapper":"twd","application/vnd.smaf":"mmf","application/vnd.smart.teacher":"teacher","application/vnd.software602.filler.form+xml":"fo","application/vnd.solent.sdkm+xml":"sdkm","application/vnd.spotfire.dxp":"dxp","application/vnd.spotfire.sfs":"sfs","application/vnd.stardivision.calc":"sdc","application/vnd.stardivision.draw":"sda","application/vnd.stardivision.impress":"sdd","application/vnd.stardivision.math":"smf","application/vnd.stardivision.writer":"sdw","application/vnd.stardivision.writer-global":"sgl","application/vnd.stepmania.package":"smzip","application/vnd.stepmania.stepchart":"sm","application/vnd.sun.wadl+xml":"wadl","application/vnd.sun.xml.calc":"sxc","application/vnd.sun.xml.calc.template":"stc","application/vnd.sun.xml.draw":"sxd","application/vnd.sun.xml.draw.template":"std","application/vnd.sun.xml.impress":"sxi","application/vnd.sun.xml.impress.template":"sti","application/vnd.sun.xml.math":"sxm","application/vnd.sun.xml.writer":"sxw","application/vnd.sun.xml.writer.global":"sxg","application/vnd.sun.xml.writer.template":"stw","application/vnd.sus-calendar":"sus","application/vnd.svd":"svd","application/vnd.symbian.install":"sis","application/vnd.syncml+xml":"xsm","application/vnd.syncml.dm+wbxml":"bdm","application/vnd.syncml.dm+xml":"xdm","application/vnd.syncml.dmddf+xml":"ddf","application/vnd.tao.intent-module-archive":"tao","application/vnd.tcpdump.pcap":"pcap","application/vnd.tmobile-livetv":"tmo","application/vnd.trid.tpt":"tpt","application/vnd.triscape.mxs":"mxs","application/vnd.trueapp":"tra","application/vnd.ufdl":"ufd","application/vnd.uiq.theme":"utz","application/vnd.umajin":"umj","application/vnd.unity":"unityweb","application/vnd.uoml+xml":"uoml","application/vnd.vcx":"vcx","application/vnd.visio":"vsd","application/vnd.visionary":"vis","application/vnd.vsf":"vsf","application/vnd.wap.wbxml":"wbxml","application/vnd.wap.wmlc":"wmlc","application/vnd.wap.wmlscriptc":"wmlsc","application/vnd.webturbo":"wtb","application/vnd.wolfram.player":"nbp","application/vnd.wordperfect":"wpd","application/vnd.wqd":"wqd","application/vnd.wt.stf":"stf","application/vnd.xara":"xar","application/vnd.xfdl":"xfdl","application/vnd.yamaha.hv-dic":"hvd","application/vnd.yamaha.hv-script":"hvs","application/vnd.yamaha.hv-voice":"hvp","application/vnd.yamaha.openscoreformat":"osf","application/vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","application/vnd.yamaha.smaf-audio":"saf","application/vnd.yamaha.smaf-phrase":"spf","application/vnd.yellowriver-custom-menu":"cmp","application/vnd.zul":"zir","application/vnd.zzazz.deck+xml":"zaz","application/voicexml+xml":"vxml","application/wasm":"wasm","application/watcherinfo+xml":"wif","application/widget":"wgt","application/winhlp":"hlp","application/wsdl+xml":"wsdl","application/wspolicy+xml":"wspolicy","application/x-7z-compressed":"7z","application/x-abiword":"abw","application/x-ace-compressed":"ace","application/x-apple-diskimage":"dmg","application/x-arj":"arj","application/x-authorware-bin":"aab","application/x-authorware-map":"aam","application/x-authorware-seg":"aas","application/x-bcpio":"bcpio","application/x-bdoc":"bdoc","application/x-bittorrent":"torrent","application/x-blorb":"blb","application/x-bzip":"bz","application/x-bzip2":"bz2","application/x-cbr":"cbr","application/x-cdlink":"vcd","application/x-cfs-compressed":"cfs","application/x-chat":"chat","application/x-chess-pgn":"pgn","application/x-chrome-extension":"crx","application/x-cocoa":"cco","application/x-conference":"nsc","application/x-cpio":"cpio","application/x-csh":"csh","application/x-debian-package":"deb","application/x-dgc-compressed":"dgc","application/x-director":"dir","application/x-doom":"wad","application/x-dtbncx+xml":"ncx","application/x-dtbook+xml":"dtb","application/x-dtbresource+xml":"res","application/x-dvi":"dvi","application/x-envoy":"evy","application/x-eva":"eva","application/x-font-bdf":"bdf","application/x-font-ghostscript":"gsf","application/x-font-linux-psf":"psf","application/x-font-pcf":"pcf","application/x-font-snf":"snf","application/x-font-type1":"pfa","application/x-freearc":"arc","application/x-futuresplash":"spl","application/x-gca-compressed":"gca","application/x-glulx":"ulx","application/x-gnumeric":"gnumeric","application/x-gramps-xml":"gramps","application/x-gtar":"gtar","application/x-hdf":"hdf","application/x-httpd-php":"php","application/x-install-instructions":"install","application/x-iso9660-image":"iso","application/x-iwork-keynote-sffkey":"key","application/x-iwork-numbers-sffnumbers":"numbers","application/x-iwork-pages-sffpages":"pages","application/x-java-archive-diff":"jardiff","application/x-java-jnlp-file":"jnlp","application/x-keepass2":"kdbx","application/x-latex":"latex","application/x-lua-bytecode":"luac","application/x-lzh-compressed":"lzh","application/x-makeself":"run","application/x-mie":"mie","application/x-mobipocket-ebook":"prc","application/x-ms-application":"application","application/x-ms-shortcut":"lnk","application/x-ms-wmd":"wmd","application/x-ms-wmz":"wmz","application/x-ms-xbap":"xbap","application/x-msaccess":"mdb","application/x-msbinder":"obd","application/x-mscardfile":"crd","application/x-msclip":"clp","application/x-msdos-program":"exe","application/x-msdownload":"exe","application/x-msmediaview":"mvb","application/x-msmetafile":"wmf","application/x-msmoney":"mny","application/x-mspublisher":"pub","application/x-msschedule":"scd","application/x-msterminal":"trm","application/x-mswrite":"wri","application/x-netcdf":"nc","application/x-ns-proxy-autoconfig":"pac","application/x-nzb":"nzb","application/x-perl":"pl","application/x-pilot":"prc","application/x-pkcs12":"p12","application/x-pkcs7-certificates":"p7b","application/x-pkcs7-certreqresp":"p7r","application/x-rar-compressed":"rar","application/x-redhat-package-manager":"rpm","application/x-research-info-systems":"ris","application/x-sea":"sea","application/x-sh":"sh","application/x-shar":"shar","application/x-shockwave-flash":"swf","application/x-silverlight-app":"xap","application/x-sql":"sql","application/x-stuffit":"sit","application/x-stuffitx":"sitx","application/x-subrip":"srt","application/x-sv4cpio":"sv4cpio","application/x-sv4crc":"sv4crc","application/x-t3vm-image":"t3","application/x-tads":"gam","application/x-tar":"tar","application/x-tcl":"tcl","application/x-tex":"tex","application/x-tex-tfm":"tfm","application/x-texinfo":"texinfo","application/x-tgif":"obj","application/x-ustar":"ustar","application/x-virtualbox-hdd":"hdd","application/x-virtualbox-ova":"ova","application/x-virtualbox-ovf":"ovf","application/x-virtualbox-vbox":"vbox","application/x-virtualbox-vbox-extpack":"vbox-extpack","application/x-virtualbox-vdi":"vdi","application/x-virtualbox-vhd":"vhd","application/x-virtualbox-vmdk":"vmdk","application/x-wais-source":"src","application/x-web-app-manifest+json":"webapp","application/x-x509-ca-cert":"der","application/x-xfig":"fig","application/x-xliff+xml":"xlf","application/x-xpinstall":"xpi","application/x-xz":"xz","application/x-zmachine":"z1","application/xaml+xml":"xaml","application/xcap-att+xml":"xav","application/xcap-caps+xml":"xca","application/xcap-diff+xml":"xdf","application/xcap-el+xml":"xel","application/xcap-ns+xml":"xns","application/xenc+xml":"xenc","application/xhtml+xml":"xhtml","application/xliff+xml":"xlf","application/xml":"xml","application/xml-dtd":"dtd","application/xop+xml":"xop","application/xproc+xml":"xpl","application/xslt+xml":"xsl","application/xspf+xml":"xspf","application/xv+xml":"mxml","application/yang":"yang","application/yin+xml":"yin","application/zip":"zip","audio/3gpp":"3gpp","audio/adpcm":"adp","audio/amr":"amr","audio/basic":"au","audio/midi":"mid","audio/mobile-xmf":"mxmf","audio/mp3":"mp3","audio/mp4":"m4a","audio/mpeg":"mpga","audio/ogg":"oga","audio/s3m":"s3m","audio/silk":"sil","audio/vnd.dece.audio":"uva","audio/vnd.digital-winds":"eol","audio/vnd.dra":"dra","audio/vnd.dts":"dts","audio/vnd.dts.hd":"dtshd","audio/vnd.lucent.voice":"lvp","audio/vnd.ms-playready.media.pya":"pya","audio/vnd.nuera.ecelp4800":"ecelp4800","audio/vnd.nuera.ecelp7470":"ecelp7470","audio/vnd.nuera.ecelp9600":"ecelp9600","audio/vnd.rip":"rip","audio/wav":"wav","audio/wave":"wav","audio/webm":"weba","audio/x-aac":"aac","audio/x-aiff":"aif","audio/x-caf":"caf","audio/x-flac":"flac","audio/x-m4a":"m4a","audio/x-matroska":"mka","audio/x-mpegurl":"m3u","audio/x-ms-wax":"wax","audio/x-ms-wma":"wma","audio/x-pn-realaudio":"ram","audio/x-pn-realaudio-plugin":"rmp","audio/x-realaudio":"ra","audio/x-wav":"wav","audio/xm":"xm","chemical/x-cdx":"cdx","chemical/x-cif":"cif","chemical/x-cmdf":"cmdf","chemical/x-cml":"cml","chemical/x-csml":"csml","chemical/x-xyz":"xyz","font/collection":"ttc","font/otf":"otf","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","image/aces":"exr","image/apng":"apng","image/avci":"avci","image/avcs":"avcs","image/avif":"avif","image/bmp":"bmp","image/cgm":"cgm","image/dicom-rle":"drle","image/emf":"emf","image/fits":"fits","image/g3fax":"g3","image/gif":"gif","image/heic":"heic","image/heic-sequence":"heics","image/heif":"heif","image/heif-sequence":"heifs","image/hej2k":"hej2","image/hsj2":"hsj2","image/ief":"ief","image/jls":"jls","image/jp2":"jp2","image/jpeg":"jpeg","image/jph":"jph","image/jphc":"jhc","image/jpm":"jpm","image/jpx":"jpx","image/jxr":"jxr","image/jxra":"jxra","image/jxrs":"jxrs","image/jxs":"jxs","image/jxsc":"jxsc","image/jxsi":"jxsi","image/jxss":"jxss","image/ktx":"ktx","image/ktx2":"ktx2","image/png":"png","image/prs.btif":"btif","image/prs.pti":"pti","image/sgi":"sgi","image/svg+xml":"svg","image/t38":"t38","image/tiff":"tif","image/tiff-fx":"tfx","image/vnd.adobe.photoshop":"psd","image/vnd.airzip.accelerator.azv":"azv","image/vnd.dece.graphic":"uvi","image/vnd.djvu":"djvu","image/vnd.dvb.subtitle":"sub","image/vnd.dwg":"dwg","image/vnd.dxf":"dxf","image/vnd.fastbidsheet":"fbs","image/vnd.fpx":"fpx","image/vnd.fst":"fst","image/vnd.fujixerox.edmics-mmr":"mmr","image/vnd.fujixerox.edmics-rlc":"rlc","image/vnd.microsoft.icon":"ico","image/vnd.ms-dds":"dds","image/vnd.ms-modi":"mdi","image/vnd.ms-photo":"wdp","image/vnd.net-fpx":"npx","image/vnd.pco.b16":"b16","image/vnd.tencent.tap":"tap","image/vnd.valve.source.texture":"vtf","image/vnd.wap.wbmp":"wbmp","image/vnd.xiff":"xif","image/vnd.zbrush.pcx":"pcx","image/webp":"webp","image/wmf":"wmf","image/x-3ds":"3ds","image/x-cmu-raster":"ras","image/x-cmx":"cmx","image/x-freehand":"fh","image/x-icon":"ico","image/x-jng":"jng","image/x-mrsid-image":"sid","image/x-ms-bmp":"bmp","image/x-pcx":"pcx","image/x-pict":"pic","image/x-portable-anymap":"pnm","image/x-portable-bitmap":"pbm","image/x-portable-graymap":"pgm","image/x-portable-pixmap":"ppm","image/x-rgb":"rgb","image/x-tga":"tga","image/x-xbitmap":"xbm","image/x-xpixmap":"xpm","image/x-xwindowdump":"xwd","message/disposition-notification":"disposition-notification","message/global":"u8msg","message/global-delivery-status":"u8dsn","message/global-disposition-notification":"u8mdn","message/global-headers":"u8hdr","message/rfc822":"eml","message/vnd.wfa.wsc":"wsc","model/3mf":"3mf","model/gltf+json":"gltf","model/gltf-binary":"glb","model/iges":"igs","model/mesh":"msh","model/mtl":"mtl","model/obj":"obj","model/step+xml":"stpx","model/step+zip":"stpz","model/step-xml+zip":"stpxz","model/stl":"stl","model/vnd.collada+xml":"dae","model/vnd.dwf":"dwf","model/vnd.gdl":"gdl","model/vnd.gtw":"gtw","model/vnd.mts":"mts","model/vnd.opengex":"ogex","model/vnd.parasolid.transmit.binary":"x_b","model/vnd.parasolid.transmit.text":"x_t","model/vnd.sap.vds":"vds","model/vnd.usdz+zip":"usdz","model/vnd.valve.source.compiled-map":"bsp","model/vnd.vtu":"vtu","model/vrml":"wrl","model/x3d+binary":"x3db","model/x3d+fastinfoset":"x3db","model/x3d+vrml":"x3dv","model/x3d+xml":"x3d","model/x3d-vrml":"x3dv","text/cache-manifest":"appcache","text/calendar":"ics","text/coffeescript":"coffee","text/css":"css","text/csv":"csv","text/html":"html","text/jade":"jade","text/jsx":"jsx","text/less":"less","text/markdown":"markdown","text/mathml":"mml","text/mdx":"mdx","text/n3":"n3","text/plain":"txt","text/prs.lines.tag":"dsc","text/richtext":"rtx","text/rtf":"rtf","text/sgml":"sgml","text/shex":"shex","text/slim":"slim","text/spdx":"spdx","text/stylus":"stylus","text/tab-separated-values":"tsv","text/troff":"t","text/turtle":"ttl","text/uri-list":"uri","text/vcard":"vcard","text/vnd.curl":"curl","text/vnd.curl.dcurl":"dcurl","text/vnd.curl.mcurl":"mcurl","text/vnd.curl.scurl":"scurl","text/vnd.dvb.subtitle":"sub","text/vnd.familysearch.gedcom":"ged","text/vnd.fly":"fly","text/vnd.fmi.flexstor":"flx","text/vnd.graphviz":"gv","text/vnd.in3d.3dml":"3dml","text/vnd.in3d.spot":"spot","text/vnd.sun.j2me.app-descriptor":"jad","text/vnd.wap.wml":"wml","text/vnd.wap.wmlscript":"wmls","text/vtt":"vtt","text/x-asm":"s","text/x-c":"c","text/x-component":"htc","text/x-fortran":"f","text/x-handlebars-template":"hbs","text/x-java-source":"java","text/x-lua":"lua","text/x-markdown":"mkd","text/x-nfo":"nfo","text/x-opml":"opml","text/x-org":"org","text/x-pascal":"p","text/x-processing":"pde","text/x-sass":"sass","text/x-scss":"scss","text/x-setext":"etx","text/x-sfv":"sfv","text/x-suse-ymp":"ymp","text/x-uuencode":"uu","text/x-vcalendar":"vcs","text/x-vcard":"vcf","text/xml":"xml","text/yaml":"yaml","video/3gpp":"3gp","video/3gpp2":"3g2","video/h261":"h261","video/h263":"h263","video/h264":"h264","video/iso.segment":"m4s","video/jpeg":"jpgv","video/jpm":"jpm","video/mj2":"mj2","video/mp2t":"ts","video/mp4":"mp4","video/mpeg":"mpeg","video/ogg":"ogv","video/quicktime":"qt","video/vnd.dece.hd":"uvh","video/vnd.dece.mobile":"uvm","video/vnd.dece.pd":"uvp","video/vnd.dece.sd":"uvs","video/vnd.dece.video":"uvv","video/vnd.dvb.file":"dvb","video/vnd.fvt":"fvt","video/vnd.mpegurl":"mxu","video/vnd.ms-playready.media.pyv":"pyv","video/vnd.uvvu.mp4":"uvu","video/vnd.vivo":"viv","video/webm":"webm","video/x-f4v":"f4v","video/x-fli":"fli","video/x-flv":"flv","video/x-m4v":"m4v","video/x-matroska":"mkv","video/x-mng":"mng","video/x-ms-asf":"asf","video/x-ms-vob":"vob","video/x-ms-wm":"wm","video/x-ms-wmv":"wmv","video/x-ms-wmx":"wmx","video/x-ms-wvx":"wvx","video/x-msvideo":"avi","video/x-sgi-movie":"movie","video/x-smv":"smv","x-conference/x-cooltalk":"ice"},jg=/^\s*([^;\s]*)(?:;|\s|$)/;function vr(n){if(!n||typeof n!="string")return"";let t=jg.exec(n);return t&&Ug[t[1].toLowerCase()]||""}var Rn=n=>Ze(n).replace(/[\[\]\#\^]/g,""),hi=(n,t)=>K.readdirSync(n).filter(i=>{let r=i.split(".").slice(0,-1).join("."),o=Sn(t),a=r.match(new RegExp(`${o}\\.\\d+`));return r===t||a}).length,iu=(n,t)=>{let e=B.useUniqueUnknownFileNames?"unknown_filename"+(Math.random().toString(16)+"0000000").slice(2,10):"unknown_filename",i=Wg(t),r=e;if(t["resource-attributes"]&&t["resource-attributes"]["file-name"]){let s=t["resource-attributes"]["file-name"].substr(0,50);r=re(s).basename}r=r.replace(/[/\\?%*:|"<>\[\]\+]/g,"-"),B.sanitizeResourceNameSpaces&&(r=r.replace(/ /g,B.replacementChar));let o=hi(n,r);return{fileName:`${o>0?`${r}.${o}`:r}.${i}`,extension:i,index:o}},Fa=n=>Rn(n.title?`${n.title.toString()}`:"Untitled"),ru=(n,t,e="md")=>`${La(n,t)}.${e}`,Hg=n=>{if(!(n["resource-attributes"]&&n["resource-attributes"]["file-name"]))return"";let t=n["resource-attributes"]["file-name"].split(".");return t.length>1?t[t.length-1]:void 0},qg=n=>{let t=n.mime;return t&&vr(t)||""},Wg=n=>{let t="dat";return Hg(n)||qg(n)||t},Zg=(n,t)=>(0,nu.moment)(n.created).format("YYYYMMDDHHmm"),La=(n,t)=>{let e;if(B.isZettelkastenNeeded||B.useZettelIdAsFilename){let i=Zg(t,n),r=hi(n,i),o=" ";e=r!==0?`${i}.${r}`:i,B.useZettelIdAsFilename||(e+=Fa(t)!=="Untitled"?`${o}${Fa(t)}`:"")}else{let i=Fa(t),r=hi(n,i);e=r===0?i:`${i}.${r}`}return e};var ou=n=>n==="Table of Contents";var Yg=n=>n.replace(/\[|\]/g,""),zg=n=>n.replace(/\\/g,""),su={filter:qe("A"),replacement:(n,t)=>{let e=ue(t);if(!e.href)return"";let i=Er(B).turndown(Yg(t.innerHTML));i=zg(i);let r="",o=i.match(/^(#{1,6} )(.*)/);o&&(r=o[1],i=o[2]);let a=e.href.value,s=e.type?e.type.value:void 0,l=B.urlEncodeFileNamesAndLinks?encodeURI(a):a;if(s==="file")return`![[${l}]]`;if(a.match(/^(https?:|www\.|file:|ftp:|mailto:)/))return r+Kg(i,a);if(a.startsWith("evernote://")){let c=Rn(i),p=fe.getInstance(),m=xn(6);return ou(p.getCurrentNoteName())?p.addItemToTOCMap({url:a,title:c,uniqueEnd:m}):p.addItemToMap({url:a,title:c,uniqueEnd:m}),r+`[[${a}]]`}return r+`[[${l}${i===l?"":`|${i}`}]]`}},Gg={"&":"&","<":"<",">":">",""":'"',"'":"'"},lu=/&(?:amp|lt|gt|quot|#39);/g,Vg=RegExp(lu.source);function au(n){return n&&Vg.test(n)?n.replace(lu,t=>Gg[t]):n}var Kg=(n,t)=>!n||au(n)===au(t)?B.generateNakedUrls?t:`<${t}>`:`[${n}](${t})`;var xe={bold:"**",italic:"_",highlight:"==",strikethrough:"~~"};var Xg="-evernote-highlight:true;",Jg="--en-highlight",Qg="bold",e0="italic",cu={filter:qe("SPAN"),replacement:(n,t)=>{let e=ue(t);if(e.style&&n.trim()!==""){let i=e.style.value;if(n!==""){let r=i.includes(Qg),o=i.includes(e0);if(r&&!o)return`${xe.bold}${n}${xe.bold}`;if(!r&&o)return`${xe.italic}${n}${xe.italic}`;if(r&&o)return`${xe.italic}${xe.bold}${n}${xe.bold}${xe.italic}`}return i.includes(Xg)||i.includes(Jg)?`${xe.highlight}${n}${xe.highlight}`:n}return n}};var pu={filter:["del","s","strike"],replacement:n=>`${xe.strikethrough}${n}${xe.strikethrough}`};var uu={filter:qe("EN-TODO"),replacement:(n,t)=>{var r,o;let e=ue(t);return`${((o=(r=t.parentElement)==null?void 0:r.nodeName)==null?void 0:o.toUpperCase())==="LI"?"":"- "}${e.checked&&e.checked.value==="true"?"[x]":"[ ]"} ${n}`}};var fu={filter:qe("BR"),replacement:(n,t)=>""};var t0=n=>{let t=ue(n),e="--en-task-group:true";return t.style&&t.style.value.indexOf(e)>=0},n0=n=>{let t=ue(n),e="--en-id:";return t.style.value.split(e)[1].split(";")[0]},du={filter:qe("DIV"),replacement:(n,t)=>t0(t)?`${n0(t)}`:B.monospaceIsCodeBlock?eu(n,t):Jp(n,t)};var mu={filter:["i"],replacement:n=>n.trim()!==""?`${xe.italic}${n}${xe.italic}`:n};var _r="- [ ]",Tr="- [x]";var hu=" ",gu={filter:"li",replacement:(n,t,e)=>{let i=m=>{let y=ue(m),E="--en-checked:true;";return y.style&&y.style.value.indexOf(E)>=0},r=m=>{let y=ue(m),E="--en-checked:false;";return y.style&&y.style.value.indexOf(E)>=0},o=n.match(/^\n*/)[0].length||0,a=hu.repeat(o),s=n.replace(/^\n+/,"").replace(/\n+$/,` `).replace(/\n/gm,` ${hu}`),l=o>0?a:i(t)?`${Tr} `:r(t)?`${_r} `:"* ",c=t.parentNode;if(c.nodeName==="OL"){let m=c.getAttribute("start"),y=Array.prototype.indexOf.call(c.children,t);l=`${m?Number(m)+y:y+1}. `}let p;return p=l+s+(t.nextSibling&&!/\n$/.test(s)?` `:""),p}};var Er=n=>{let t=new window.TurndownService({br:"",...n.turndownOptions,blankReplacement:(e,i)=>i.isBlock?` @@ -176,31 +176,31 @@ ${hu}`),l=o>0?a:i(t)?`${Tr} `:r(t)?`${_r} `:"* ",c=t.parentNode;if(c.nodeName=== ${i.outerHTML} `:i.outerHTML,defaultReplacement:(e,i)=>i.isBlock?` ${e} -`:e});return t.use(Kp),t.addRule("span",cu),t.addRule("strikethrough",pu),t.addRule("evernote task items",uu),t.addRule("wikistyle links",su),t.addRule("images",tu),t.addRule("list",gu),t.addRule("italic",mu),n.keepMDCharactersOfENNotes&&(t.escape=e=>e),t.addRule("divBlock",du),n.keepOriginalAmountOfNewlines&&t.addRule("newline",fu),t};var yu=n=>{n.replaceWith(...Array.from(n.children))},bu=n=>{let t=n.parentElement;t.replaceWith(...Array.from(t.childNodes)),t.append(...Array.from(n.childNodes)),n.appendChild(t)},i0=n=>(Array.from(n.querySelectorAll("span>en-todo")).forEach(bu),Array.from(n.querySelectorAll("a>en-todo")).forEach(bu),n),r0=n=>{let t=n.replace(/
  • /g,"
  • ");return t=t.replace(/<\/li>/g,"
  • "),t=t.replace(/
  • (\s)*
    /g,"
  • "),t=t.replace(/<\/div>(\s)*<\/div><\/li>/g,"
  • "),t},o0=n=>{var o;let t=Array.from(n.getElementsByTagName("ul")),e=Array.from(n.getElementsByTagName("ol")),i=t.concat(e);i.forEach(a=>{a.parentElement.tagName==="LI"&&a.parentElement.replaceWith(a),a.previousElementSibling&&a.previousElementSibling.tagName==="LI"&&a.previousElementSibling.appendChild(a)});for(let a of i){let s=a.parentElement;(s==null?void 0:s.tagName)==="DIV"&&((o=s==null?void 0:s.parentElement)==null?void 0:o.tagName)==="UL"&&yu(s),((s==null?void 0:s.tagName)==="UL"||(s==null?void 0:s.tagName)==="OL")&&(s==null?void 0:s.childNodes.length)===1&&yu(s)}let r=Array.from(n.getElementsByTagName("li"));for(let a of r){let s=a.firstElementChild;if(s&&s.tagName==="DIV"){let l=Array.from(s.childNodes);s.replaceWith(...l)}}return n},xu=(n,{htmlContent:t})=>{let e=t.replace(/]*>/,"").replace(/(]*)\/>/,"$1>").replace(//g,""),i=new DOMParser().parseFromString(r0(e),"text/html").getElementsByTagName("en-note").item(0),r=Er(n).turndown(i0(o0(i))),o=new RegExp("","g");return r=r.replace(o,""),r&&r!=="undefined"?{content:r}:{content:""}};var uf=ns(require("crypto"));var yt=require("obsidian");var wu=(n,t)=>({createdAt:a0(n),updatedAt:s0(n),sourceUrl:l0(n),location:c0(n),reminderTime:p0(n),reminderOrder:u0(n),reminderDoneTime:f0(n),notebookName:t});var a0=n=>!B.skipCreationTime&&n.created?(0,yt.moment)(n.created).format(B.dateFormat):"",s0=n=>!B.skipUpdateTime&&n.updated?(0,yt.moment)(n.updated).format(B.dateFormat):"",l0=n=>!B.skipSourceUrl&&n["note-attributes"]?n["note-attributes"]["source-url"]:"",c0=n=>!B.skipLocation&&n["note-attributes"]&&n["note-attributes"].longitude?`${n["note-attributes"].latitude},${n["note-attributes"].longitude}`:"",p0=n=>!B.skipReminderTime&&n["note-attributes"]&&n["note-attributes"]["reminder-time"]?(0,yt.moment)(n["note-attributes"]["reminder-time"]).format(B.dateFormat):"",u0=n=>!B.skipReminderOrder&&n["note-attributes"]&&n["note-attributes"]["reminder-order"]?n["note-attributes"]["reminder-order"]:"",f0=n=>!B.skipReminderDoneTime&&n["note-attributes"]&&n["note-attributes"]["reminder-done-time"]?(0,yt.moment)(n["note-attributes"]["reminder-done-time"]).format(B.dateFormat):"",vu=n=>({tags:d0(n)}),d0=n=>{if(!B.skipTags&&n.tag){let t=Array.isArray(n.tag)?n.tag:[n.tag],e=B.nestedTags;return t.map(r=>{let o=r.toString().replace(/^#/,"");e&&(o=o.replace(new RegExp(Nn(e.separatorInEN),"g"),e.replaceSeparatorWith));let a=e&&e.replaceSpaceWith||"-";return o=o.replace(/ /g,a),`${B.useHashTags?"#":""}${o}`}).join(" ")}return""},Pa;try{Pa=window.require("btime")}catch(n){}var Ar=(n,t)=>{let e=(0,yt.moment)(t.created).valueOf();e>0&&Pa&&Pa.btime(n,e);let r=(0,yt.moment)(t.updated).valueOf()/1e3;try{K.utimesSync(n,r,r)}catch(o){}},Eu=n=>n["resource-attributes"]&&n["resource-attributes"].timestamp?(0,yt.moment)(n["resource-attributes"].timestamp):(0,yt.moment)();var _u=(n,t,e)=>{let i=n.lastIndexOf(t);return i<0?n:n.substring(0,i)+e+n.substring(i+t.length)};var Ae={mdPath:"",resourcePath:""},Nr=249,Tu=(n,t)=>La(n,t).replace(/\s/g,"_"),Au=(n,t)=>{if(n.length<=11)throw Error("FATAL: note folder directory path exceeds the OS limitation. Please pick a destination closer to the root folder.");return`${$a()}${q.sep}${n}`.length{let r=fe.getInstance().getNoteIdNameMapByNoteTitle(Sn(n.title))[0]||{uniqueEnd:xn(6)};if(t.length<=11)throw Error("FATAL: note folder directory path exceeds the OS limitation. Please pick a destination closer to the root folder.");return`${e.slice(0,Nr-11)}_${r.uniqueEnd}.md`},h0=(n,t,e)=>{let i=ru(n,t,e),r=`${n}${q.sep}${Sn(i)}`;return r.lengthh0(Ae.mdPath,n,"md");var g0=n=>{K.existsSync(n)&&(K.rmSync?K.rmSync(n,{recursive:!0,force:!0}):K.rmdirSync(n,{recursive:!0})),K.mkdirSync(n)},Nu=n=>{let t=`${q.sep}${B.resourcesDir}`;return B.haveGlobalResources?`..${t}`:B.haveEnexLevelResources?`.${t}`:`.${t}${q.sep}${Tu(Ae.mdPath,n)}.resources`},Ma=n=>B.haveGlobalResources?q.resolve(Ae.resourcePath,"..","..",B.resourcesDir):B.haveEnexLevelResources?Ae.resourcePath:`${Ae.resourcePath}${q.sep}${Tu(Ae.mdPath,n)}.resources`,kr=new Map,Su=n=>{let t=Ma(n);kr.has(t)||kr.set(t,0);let e=kr.get(t)||0;(B.haveEnexLevelResources||B.haveGlobalResources)&&e>=1||(g0(t),kr.set(t,e+1))},Ru=n=>{let t=n.split("@@@"),e=t.pop();return e||(e=n),{notebookName:e,notebookFolderNames:t}},Ou=n=>{if(!(n instanceof Me))throw new Error("Evernote import currently only works on desktop");let{notebookName:t}=Ru(n.basename);return{fullpath:_u(n.fullpath,n.basename,t||n.basename),basename:t}},Du=(n,t)=>{let{notebookFolderNames:e}=Ru(n.basename);return K.mkdirSync(q.join(t.outputDir,...e),{recursive:!0}),[t.outputDir,...e].join(t.pathSeparator)},Cu=(n,t)=>{let e=n.basename;Fu(e,t)},Iu=(n,t)=>{let e=n.basename;Fu(e,t)},Fu=(n,t)=>{let e=q.isAbsolute(t.outputDir)?t.outputDir:`${process.cwd()}${q.sep}${t.outputDir}`;Ae.mdPath=`${e}${q.sep}`,Ae.resourcePath=`${e}${q.sep}${t.resourcesDir}`,t.skipEnexFileNameFromOutputPath||(Ae.mdPath=`${Ae.mdPath}${n}`,Ae.resourcePath=`${e}${q.sep}${n}${q.sep}${t.resourcesDir}`),K.mkdirSync(Ae.mdPath,{recursive:!0}),!t.haveEnexLevelResources&&!t.haveGlobalResources&&K.mkdirSync(Ae.resourcePath,{recursive:!0}),console.log(`path ${Ae.mdPath} created`)},$a=()=>Ae.mdPath;var Lu=n=>!!n.resource,Pu=n=>n["note-attributes"]&&(n["note-attributes"]["source-application"]==="webclipper.evernote"||n["note-attributes"].source==="web.clip7");var Ba={};Se(Ba,{CONTENT_PLACEHOLDER:()=>y0,END_BLOCK:()=>x0,START_BLOCK:()=>b0});var y0="{content}",b0="{content-block}",x0="{end-content-block}";var Pt=({template:n,check:t,startBlockPlaceholder:e,endBlockPlaceholder:i,valuePlaceholder:r,value:o})=>{if(o&&t())return n.replace(new RegExp(`${e}`,"g"),"").replace(new RegExp(`${i}`,"g"),"").replace(new RegExp(`${r}`,"g"),o);let a=`${e}([\\d\\D])(?:.|(\r +`:e});return t.use(Kp),t.addRule("span",cu),t.addRule("strikethrough",pu),t.addRule("evernote task items",uu),t.addRule("wikistyle links",su),t.addRule("images",tu),t.addRule("list",gu),t.addRule("italic",mu),n.keepMDCharactersOfENNotes&&(t.escape=e=>e),t.addRule("divBlock",du),n.keepOriginalAmountOfNewlines&&t.addRule("newline",fu),t};var yu=n=>{n.replaceWith(...Array.from(n.children))},bu=n=>{let t=n.parentElement;t.replaceWith(...Array.from(t.childNodes)),t.append(...Array.from(n.childNodes)),n.appendChild(t)},i0=n=>(Array.from(n.querySelectorAll("span>en-todo")).forEach(bu),Array.from(n.querySelectorAll("a>en-todo")).forEach(bu),n),r0=n=>{let t=n.replace(/
  • /g,"
  • ");return t=t.replace(/<\/li>/g,"
  • "),t=t.replace(/
  • (\s)*
    /g,"
  • "),t=t.replace(/<\/div>(\s)*<\/div><\/li>/g,"
  • "),t},o0=n=>{var o;let t=Array.from(n.getElementsByTagName("ul")),e=Array.from(n.getElementsByTagName("ol")),i=t.concat(e);i.forEach(a=>{a.parentElement.tagName==="LI"&&a.parentElement.replaceWith(a),a.previousElementSibling&&a.previousElementSibling.tagName==="LI"&&a.previousElementSibling.appendChild(a)});for(let a of i){let s=a.parentElement;(s==null?void 0:s.tagName)==="DIV"&&((o=s==null?void 0:s.parentElement)==null?void 0:o.tagName)==="UL"&&yu(s),((s==null?void 0:s.tagName)==="UL"||(s==null?void 0:s.tagName)==="OL")&&(s==null?void 0:s.childNodes.length)===1&&yu(s)}let r=Array.from(n.getElementsByTagName("li"));for(let a of r){let s=a.firstElementChild;if(s&&s.tagName==="DIV"){let l=Array.from(s.childNodes);s.replaceWith(...l)}}return n},xu=(n,{htmlContent:t})=>{let e=t.replace(/]*>/,"").replace(/(]*)\/>/,"$1>").replace(//g,""),i=new DOMParser().parseFromString(r0(e),"text/html").getElementsByTagName("en-note").item(0),r=Er(n).turndown(i0(o0(i))),o=new RegExp("","g");return r=r.replace(o,""),r&&r!=="undefined"?{content:r}:{content:""}};var uf=ns(require("crypto"));var yt=require("obsidian");var wu=(n,t)=>({createdAt:a0(n),updatedAt:s0(n),sourceUrl:l0(n),location:c0(n),reminderTime:p0(n),reminderOrder:u0(n),reminderDoneTime:f0(n),notebookName:t});var a0=n=>!B.skipCreationTime&&n.created?(0,yt.moment)(n.created).format(B.dateFormat):"",s0=n=>!B.skipUpdateTime&&n.updated?(0,yt.moment)(n.updated).format(B.dateFormat):"",l0=n=>!B.skipSourceUrl&&n["note-attributes"]?n["note-attributes"]["source-url"]:"",c0=n=>!B.skipLocation&&n["note-attributes"]&&n["note-attributes"].longitude?`${n["note-attributes"].latitude},${n["note-attributes"].longitude}`:"",p0=n=>!B.skipReminderTime&&n["note-attributes"]&&n["note-attributes"]["reminder-time"]?(0,yt.moment)(n["note-attributes"]["reminder-time"]).format(B.dateFormat):"",u0=n=>!B.skipReminderOrder&&n["note-attributes"]&&n["note-attributes"]["reminder-order"]?n["note-attributes"]["reminder-order"]:"",f0=n=>!B.skipReminderDoneTime&&n["note-attributes"]&&n["note-attributes"]["reminder-done-time"]?(0,yt.moment)(n["note-attributes"]["reminder-done-time"]).format(B.dateFormat):"",vu=n=>({tags:d0(n)}),d0=n=>{if(!B.skipTags&&n.tag){let t=Array.isArray(n.tag)?n.tag:[n.tag],e=B.nestedTags;return t.map(r=>{let o=r.toString().replace(/^#/,"");e&&(o=o.replace(new RegExp(Sn(e.separatorInEN),"g"),e.replaceSeparatorWith));let a=e&&e.replaceSpaceWith||"-";return o=o.replace(/ /g,a),`${B.useHashTags?"#":""}${o}`}).join(" ")}return""},Pa;try{Pa=window.require("btime")}catch(n){}var Ar=(n,t)=>{let e=(0,yt.moment)(t.created).valueOf();e>0&&Pa&&Pa.btime(n,e);let r=(0,yt.moment)(t.updated).valueOf()/1e3;try{K.utimesSync(n,r,r)}catch(o){}},Eu=n=>n["resource-attributes"]&&n["resource-attributes"].timestamp?(0,yt.moment)(n["resource-attributes"].timestamp):(0,yt.moment)();var _u=(n,t,e)=>{let i=n.lastIndexOf(t);return i<0?n:n.substring(0,i)+e+n.substring(i+t.length)};var Te={mdPath:"",resourcePath:""},Nr=249,Tu=(n,t)=>La(n,t).replace(/\s/g,"_"),Au=(n,t)=>{if(n.length<=11)throw Error("FATAL: note folder directory path exceeds the OS limitation. Please pick a destination closer to the root folder.");return`${$a()}${q.sep}${n}`.length{let r=fe.getInstance().getNoteIdNameMapByNoteTitle(Rn(n.title))[0]||{uniqueEnd:xn(6)};if(t.length<=11)throw Error("FATAL: note folder directory path exceeds the OS limitation. Please pick a destination closer to the root folder.");return`${e.slice(0,Nr-11)}_${r.uniqueEnd}.md`},h0=(n,t,e)=>{let i=ru(n,t,e),r=`${n}${q.sep}${Rn(i)}`;return r.lengthh0(Te.mdPath,n,"md");var g0=n=>{K.existsSync(n)&&(K.rmSync?K.rmSync(n,{recursive:!0,force:!0}):K.rmdirSync(n,{recursive:!0})),K.mkdirSync(n)},Nu=n=>{let t=`${q.sep}${B.resourcesDir}`;return B.haveGlobalResources?`..${t}`:B.haveEnexLevelResources?`.${t}`:`.${t}${q.sep}${Tu(Te.mdPath,n)}.resources`},Ma=n=>B.haveGlobalResources?q.resolve(Te.resourcePath,"..","..",B.resourcesDir):B.haveEnexLevelResources?Te.resourcePath:`${Te.resourcePath}${q.sep}${Tu(Te.mdPath,n)}.resources`,kr=new Map,Su=n=>{let t=Ma(n);kr.has(t)||kr.set(t,0);let e=kr.get(t)||0;(B.haveEnexLevelResources||B.haveGlobalResources)&&e>=1||(g0(t),kr.set(t,e+1))},Ru=n=>{let t=n.split("@@@"),e=t.pop();return e||(e=n),{notebookName:e,notebookFolderNames:t}},Ou=n=>{if(!(n instanceof Me))throw new Error("Evernote import currently only works on desktop");let{notebookName:t}=Ru(n.basename);return{fullpath:_u(n.fullpath,n.basename,t||n.basename),basename:t}},Du=(n,t)=>{let{notebookFolderNames:e}=Ru(n.basename);return K.mkdirSync(q.join(t.outputDir,...e),{recursive:!0}),[t.outputDir,...e].join(t.pathSeparator)},Cu=(n,t)=>{let e=n.basename;Fu(e,t)},Iu=(n,t)=>{let e=n.basename;Fu(e,t)},Fu=(n,t)=>{let e=q.isAbsolute(t.outputDir)?t.outputDir:`${process.cwd()}${q.sep}${t.outputDir}`;Te.mdPath=`${e}${q.sep}`,Te.resourcePath=`${e}${q.sep}${t.resourcesDir}`,t.skipEnexFileNameFromOutputPath||(Te.mdPath=`${Te.mdPath}${n}`,Te.resourcePath=`${e}${q.sep}${n}${q.sep}${t.resourcesDir}`),K.mkdirSync(Te.mdPath,{recursive:!0}),!t.haveEnexLevelResources&&!t.haveGlobalResources&&K.mkdirSync(Te.resourcePath,{recursive:!0}),console.log(`path ${Te.mdPath} created`)},$a=()=>Te.mdPath;var Lu=n=>!!n.resource,Pu=n=>n["note-attributes"]&&(n["note-attributes"]["source-application"]==="webclipper.evernote"||n["note-attributes"].source==="web.clip7");var Ba={};Se(Ba,{CONTENT_PLACEHOLDER:()=>y0,END_BLOCK:()=>x0,START_BLOCK:()=>b0});var y0="{content}",b0="{content-block}",x0="{end-content-block}";var Pt=({template:n,check:t,startBlockPlaceholder:e,endBlockPlaceholder:i,valuePlaceholder:r,value:o})=>{if(o&&t())return n.replace(new RegExp(`${e}`,"g"),"").replace(new RegExp(`${i}`,"g"),"").replace(new RegExp(`${r}`,"g"),o);let a=`${e}([\\d\\D])(?:.|(\r |\r| -))*?(?=${i})${i}`;return n.replace(new RegExp(a,"g"),"")};var Mt=(n,t,e,i)=>({template:n,check:t,startBlockPlaceholder:e.START_BLOCK,endBlockPlaceholder:e.END_BLOCK,valuePlaceholder:e.CONTENT_PLACEHOLDER,value:i});var Mu=(n,t,e)=>{let i=Mt(t,e,Ba,n.content);return Pt(i)};var gi={};Se(gi,{CONTENT_PLACEHOLDER:()=>w0,END_BLOCK:()=>E0,START_BLOCK:()=>v0});var w0="{tags}",v0="{tags-block}",E0="{end-tags-block}";var $u=(n,t,e)=>{let i=Mt(t,e,gi,n.tags);return Pt(i)};var Ua={};Se(Ua,{CONTENT_PLACEHOLDER:()=>_0,END_BLOCK:()=>A0,START_BLOCK:()=>T0});var _0="{title}",T0="{title-block}",A0="{end-title-block}";var Bu=(n,t,e)=>{let i=Mt(t,e,Ua,n.title);return Pt(i)};var rn={};Se(rn,{CONTENT_PLACEHOLDER:()=>k0,END_BLOCK:()=>S0,START_BLOCK:()=>N0});var k0="{created-at}",N0="{created-at-block}",S0="{end-created-at-block}";var ve=(n,t,e)=>n.replace(new RegExp(`${t.CONTENT_PLACEHOLDER}`,"g"),e||"").replace(new RegExp(`${t.START_BLOCK}`,"g"),"").replace(new RegExp(`${t.END_BLOCK}`,"g"),"");var Uu=(n,t)=>ve(t,rn,n.createdAt);var on={};Se(on,{CONTENT_PLACEHOLDER:()=>R0,END_BLOCK:()=>D0,START_BLOCK:()=>O0});var R0="{updated-at}",O0="{updated-at-block}",D0="{end-updated-at-block}";var ju=(n,t)=>ve(t,on,n.updatedAt);var an={};Se(an,{CONTENT_PLACEHOLDER:()=>C0,END_BLOCK:()=>F0,START_BLOCK:()=>I0});var C0="{source-url}",I0="{source-url-block}",F0="{end-source-url-block}";var Hu=(n,t)=>ve(t,an,n.sourceUrl);var sn={};Se(sn,{CONTENT_PLACEHOLDER:()=>L0,END_BLOCK:()=>M0,START_BLOCK:()=>P0});var L0="{location}",P0="{location-block}",M0="{end-location-block}";var qu=(n,t)=>ve(t,sn,n.location);var ln={};Se(ln,{CONTENT_PLACEHOLDER:()=>$0,END_BLOCK:()=>U0,START_BLOCK:()=>B0});var $0="{notebook}",B0="{notebook-block}",U0="{end-notebook-block}";var Wu=(n,t)=>ve(t,ln,n.notebookName);var Rn={};Se(Rn,{CONTENT_PLACEHOLDER:()=>j0,END_BLOCK:()=>q0,START_BLOCK:()=>H0});var j0="{reminder-time}",H0="{reminder-time-block}",q0="{end-reminder-time-block}";var Zu=(n,t)=>ve(t,Rn,n.reminderTime);var On={};Se(On,{CONTENT_PLACEHOLDER:()=>W0,END_BLOCK:()=>Y0,START_BLOCK:()=>Z0});var W0="{reminder-order}",Z0="{reminder-order-block}",Y0="{end-reminder-order-block}";var Yu=(n,t)=>ve(t,On,n.reminderOrder);var Dn={};Se(Dn,{CONTENT_PLACEHOLDER:()=>z0,END_BLOCK:()=>V0,START_BLOCK:()=>G0});var z0="{reminder-done-time}",G0="{reminder-done-time-block}",V0="{end-reminder-done-time-block}";var zu=(n,t)=>ve(t,Dn,n.reminderDoneTime);var yi={};Se(yi,{CONTENT_PLACEHOLDER:()=>K0,END_BLOCK:()=>J0,START_BLOCK:()=>X0});var K0="{tags-yaml-list}",X0="{tags-yaml-list-block}",J0="{end-tags-yaml-list-block}";var Gu=(n,t,e)=>{let i;n.tags&&(i=` +))*?(?=${i})${i}`;return n.replace(new RegExp(a,"g"),"")};var Mt=(n,t,e,i)=>({template:n,check:t,startBlockPlaceholder:e.START_BLOCK,endBlockPlaceholder:e.END_BLOCK,valuePlaceholder:e.CONTENT_PLACEHOLDER,value:i});var Mu=(n,t,e)=>{let i=Mt(t,e,Ba,n.content);return Pt(i)};var gi={};Se(gi,{CONTENT_PLACEHOLDER:()=>w0,END_BLOCK:()=>E0,START_BLOCK:()=>v0});var w0="{tags}",v0="{tags-block}",E0="{end-tags-block}";var $u=(n,t,e)=>{let i=Mt(t,e,gi,n.tags);return Pt(i)};var Ua={};Se(Ua,{CONTENT_PLACEHOLDER:()=>_0,END_BLOCK:()=>A0,START_BLOCK:()=>T0});var _0="{title}",T0="{title-block}",A0="{end-title-block}";var Bu=(n,t,e)=>{let i=Mt(t,e,Ua,n.title);return Pt(i)};var rn={};Se(rn,{CONTENT_PLACEHOLDER:()=>k0,END_BLOCK:()=>S0,START_BLOCK:()=>N0});var k0="{created-at}",N0="{created-at-block}",S0="{end-created-at-block}";var ve=(n,t,e)=>n.replace(new RegExp(`${t.CONTENT_PLACEHOLDER}`,"g"),e||"").replace(new RegExp(`${t.START_BLOCK}`,"g"),"").replace(new RegExp(`${t.END_BLOCK}`,"g"),"");var Uu=(n,t)=>ve(t,rn,n.createdAt);var on={};Se(on,{CONTENT_PLACEHOLDER:()=>R0,END_BLOCK:()=>D0,START_BLOCK:()=>O0});var R0="{updated-at}",O0="{updated-at-block}",D0="{end-updated-at-block}";var ju=(n,t)=>ve(t,on,n.updatedAt);var an={};Se(an,{CONTENT_PLACEHOLDER:()=>C0,END_BLOCK:()=>F0,START_BLOCK:()=>I0});var C0="{source-url}",I0="{source-url-block}",F0="{end-source-url-block}";var Hu=(n,t)=>ve(t,an,n.sourceUrl);var sn={};Se(sn,{CONTENT_PLACEHOLDER:()=>L0,END_BLOCK:()=>M0,START_BLOCK:()=>P0});var L0="{location}",P0="{location-block}",M0="{end-location-block}";var qu=(n,t)=>ve(t,sn,n.location);var ln={};Se(ln,{CONTENT_PLACEHOLDER:()=>$0,END_BLOCK:()=>U0,START_BLOCK:()=>B0});var $0="{notebook}",B0="{notebook-block}",U0="{end-notebook-block}";var Wu=(n,t)=>ve(t,ln,n.notebookName);var On={};Se(On,{CONTENT_PLACEHOLDER:()=>j0,END_BLOCK:()=>q0,START_BLOCK:()=>H0});var j0="{reminder-time}",H0="{reminder-time-block}",q0="{end-reminder-time-block}";var Zu=(n,t)=>ve(t,On,n.reminderTime);var Dn={};Se(Dn,{CONTENT_PLACEHOLDER:()=>W0,END_BLOCK:()=>Y0,START_BLOCK:()=>Z0});var W0="{reminder-order}",Z0="{reminder-order-block}",Y0="{end-reminder-order-block}";var Yu=(n,t)=>ve(t,Dn,n.reminderOrder);var Cn={};Se(Cn,{CONTENT_PLACEHOLDER:()=>z0,END_BLOCK:()=>V0,START_BLOCK:()=>G0});var z0="{reminder-done-time}",G0="{reminder-done-time-block}",V0="{end-reminder-done-time-block}";var zu=(n,t)=>ve(t,Cn,n.reminderDoneTime);var yi={};Se(yi,{CONTENT_PLACEHOLDER:()=>K0,END_BLOCK:()=>J0,START_BLOCK:()=>X0});var K0="{tags-yaml-list}",X0="{tags-yaml-list-block}",J0="{end-tags-yaml-list-block}";var Gu=(n,t,e)=>{let i;n.tags&&(i=` `+n.tags.split(" ").map(o=>` - ${o.replace(/^#/,"")}`).join(` `));let r=Mt(t,e,yi,i);return Pt(r)};var ja="{metadata-block}",Ha="{end-metadata-block}";var Vu=`\r? -?`;var de=(n,t)=>n.replace(new RegExp(`${t.START_BLOCK}(?<=${t.START_BLOCK})(.*)(?=${t.END_BLOCK})${t.END_BLOCK}${Vu}`,"g"),"");var Ku=n=>de(n,rn);var Xu=n=>de(n,on);var Ju=n=>de(n,an);var Qu=n=>de(n,ln);var ef=n=>de(n,sn);var Sr={};Se(Sr,{CONTENT_PLACEHOLDER:()=>ey,END_BLOCK:()=>ny,START_BLOCK:()=>ty});var ey="{link-to-original}",ty="{link-to-original-block}",ny="{end-link-to-original-block}";var tf=n=>de(n,Sr);var nf=n=>de(n,Rn);var rf=n=>de(n,Dn);var of=n=>de(n,On);var af=(n,t)=>{let e=t.currentTemplate;return e=Bu(n,e,()=>n.title),e=$u(n,e,()=>!t.skipTags),e=Gu(n,e,()=>!t.skipTags),e=Mu(n,e,()=>n.content),e=tf(e),e=!t.skipCreationTime&&n.createdAt?Uu(n,e):Ku(e),e=!t.skipUpdateTime&&n.updatedAt?ju(n,e):Xu(e),e=!t.skipSourceUrl&&n.sourceUrl?Hu(n,e):Ju(e),e=!t.skipLocation&&n.location?qu(n,e):ef(e),e=t.isNotebookNameNeeded&&n.notebookName?Wu(n,e):Qu(e),e=!t.skipReminderTime&&n.reminderTime?Zu(n,e):nf(e),e=!t.skipReminderOrder&&n.reminderOrder?Yu(n,e):of(e),e=!t.skipReminderDoneTime&&n.reminderDoneTime?zu(n,e):rf(e),e=e.replace(ja,"").replace(Ha,""),e};var sf=(n,t,e)=>{try{K.writeFileSync(n,t),Ar(n,e)}catch(i){throw console.error("Cannot write file ",i),i}};var lf=(n,t)=>{let e=ku(t);fe.getInstance().setCurrentNotePath(e),sf(e,n,t),console.log(`Note saved to ${e}`)};var ff=n=>{let t=new RegExp(`\\${q.sep}`,"g"),e=Nu(n).replace(t,B.pathSeparator||"/");return{absoluteResourceWorkDir:Ma(n),relativeResourceWorkDir:e}},df=n=>{let t={},e=n.content,{absoluteResourceWorkDir:i,relativeResourceWorkDir:r}=ff(n);if(console.log(`relative resource work dir: ${r}`),console.log(`absolute resource work dir: ${i}`),Su(n),Array.isArray(n.resource))for(let o of n.resource)t={...t,...pf(i,o)};else t={...t,...pf(i,n.resource)};for(let o of Object.keys(t))e=iy(e,t,o,r);return e},iy=(n,t,e,i)=>{let r=`${i}${B.pathSeparator}${t[e].fileName.replace(/ /g," ")}`;console.log(`mediaReference src ${r} added`);let o,a=`]*)hash="${e}".([^>]*)>`,s=new RegExp(a,"g"),l=n.match(s),c=l&&l.length>0&&l[0].split("type=");if(c&&c.length>1&&c[1].startsWith('"image')){let p=l[0].match(/width="(\w+)"/),m=p?` width="${p[1]}"`:"",y=l[0].match(/height="(\w+)"/),E=y?` height="${y[1]}"`:"";o=n.replace(s,`${t[e].fileName}`)}else o=n.replace(s,`${t[e].fileName}`);return o},pf=(n,t)=>{let e={},i=t.data.$text,r=Eu(t),a=iu(n,t).fileName,s=`${n}${q.sep}${a}`;console.log(t),console.log(i);let l=Buffer.from(i,"base64");K.writeFileSync(s,l);let c=r.valueOf()/1e3;try{K.utimesSync(s,c,c)}catch(p){}if(t.recognition&&a){let p=t.recognition.match(/[a-f0-9]{32}/);console.log(`resource ${a} added with hash ${p}`),e[p]={fileName:a,alreadyUsed:!1}}else{let p=uf.default.createHash("md5");p.update(l);let m=p.digest("hex");e[m]={fileName:a,alreadyUsed:!1}}return e},mf=(n,t)=>{if(t.indexOf('src="data:')<0)return t;let{absoluteResourceWorkDir:e,relativeResourceWorkDir:i}=ff(n);return K.mkdirSync(e,{recursive:!0}),t.replace(/src="data:([^;,]*)(;base64)?,([^"]*)"/g,(r,o,a,s)=>{let l=ry(o,a===";base64",s,e,n);return`src="${`${i}${B.pathSeparator}${l}`}"`})},ry=(n,t,e,i,r)=>{let o="embedded",a=oy(n)||".dat",s=hi(i,o),l=s<1?`${o}.${a}`:`${o}.${s}.${a}`,c=`${i}${q.sep}${l}`;return t||(e=decodeURIComponent(e)),K.writeFileSync(c,e,t?"base64":void 0),Ar(c,r),console.log(`data url resource ${l} added`),l},oy=n=>n.split("/").pop().split("+")[0];var hf=(n,t)=>{let e=new Date;fe.getInstance().setCurrentNoteName(n.title),Array.isArray(n.content)&&(n.content=n.content.join(""));let r={title:n.title,content:n.content,htmlContent:n.content,originalContent:n.content};console.log(`Converting for note "${r.title}" started at ${e}...`);try{Lu(n)&&(r.htmlContent=df(n)),r.htmlContent=mf(n,r.htmlContent),r={...r,...xu(B,r)},r={...r,...wu(n,t)},r={...r,...vu(n)};let o=af(r,B);lf(o,n)}catch(o){throw console.error(`Failed to convert note: ${r.title}`,o),o}finally{let o=new Date,a=(o.getTime()-e.getTime())/1e3;console.log(`Conversion for note "${r.title}" finished at ${o}. Took ${a} seconds`)}};var bf=require("obsidian");var gf=n=>n.taskstatus==="open"?_r:Tr;var ay="\u{1F53C}",sy="\u{1F53D}",ly="\u{1F4C5}",cy="\u23F3",xf=(n,t)=>{let e=gf(n),i=n.title?` ${n.title}`:"",r=B.obsidianTaskTag!==""?` ${B.obsidianTaskTag}`:"",o=n.duedate&&!isNaN(n.duedate.getTime())?` ${ly} ${yf(n.duedate)}`:"",a=n.reminderdate?` ${cy} ${yf(n.reminderdate)}`:"",s=n.taskflag?` ${ay}`:` ${sy}`;return`${e}${r}${i}${o}${a}${s}`},yf=n=>(0,bf.moment)(n).format("YYYY-MM-DD").toString();var Wa=(n,t,e)=>{let i=K.readdirSync(n);return t=t||[],i.forEach(r=>{K.statSync(`${n}${q.sep}${r}`).isDirectory()?t=Wa(`${n}${q.sep}${r}`,t,e):(e&&q.extname(r)==`.${e}`||!e)&&t.push(q.join(n,"/",r))}),t};var wf=(n,t)=>{let i=fe.getInstance().getAllNoteIdNameMap(),r=Object.entries(i);if(r.length===0)return;console.log("About to update links...");let o=[];for(let a of t)Wa(a,o,"");for(let a of t){console.log(`Notebook: ${a}`);let l=K.readdirSync(a).filter(c=>q.extname(c).toLowerCase()===".md");console.log(`${l.length} files to check for links`);for(let c of l){let p=q.join(a,c),m=K.readFileSync(p,"utf8"),y=m;for(let[E,v]of r){let d=v.uniqueEnd,f=v.title;o.find(D=>D.includes(d))&&(f=Au(f,d));let g=v.notebookName,w=n.urlEncodeFileNamesAndLinks?encodeURI(f):f,T=w;g&&!a.endsWith(g)&&(T=`${g}/${w}`);let A=new RegExp(Nn(E),"g");y=y.replace(A,T)}m!==y&&(console.log(`File written: ${p}`),K.writeFileSync(p,y))}}console.log("Link update complete.")};var vf=n=>cn(rn,n);var Ef=n=>cn(sn,n),_f=n=>cn(ln,n);var Tf=n=>cn(an,n),Af=n=>cn(gi,n)||cn(yi,n);var kf=n=>cn(on,n),cn=(n,t)=>t.includes(n.START_BLOCK)&&t.includes(n.CONTENT_PLACEHOLDER)&&t.includes(n.END_BLOCK);var Nf=`--- +?`;var de=(n,t)=>n.replace(new RegExp(`${t.START_BLOCK}(?<=${t.START_BLOCK})(.*)(?=${t.END_BLOCK})${t.END_BLOCK}${Vu}`,"g"),"");var Ku=n=>de(n,rn);var Xu=n=>de(n,on);var Ju=n=>de(n,an);var Qu=n=>de(n,ln);var ef=n=>de(n,sn);var Sr={};Se(Sr,{CONTENT_PLACEHOLDER:()=>ey,END_BLOCK:()=>ny,START_BLOCK:()=>ty});var ey="{link-to-original}",ty="{link-to-original-block}",ny="{end-link-to-original-block}";var tf=n=>de(n,Sr);var nf=n=>de(n,On);var rf=n=>de(n,Cn);var of=n=>de(n,Dn);var af=(n,t)=>{let e=t.currentTemplate;return e=Bu(n,e,()=>n.title),e=$u(n,e,()=>!t.skipTags),e=Gu(n,e,()=>!t.skipTags),e=Mu(n,e,()=>n.content),e=tf(e),e=!t.skipCreationTime&&n.createdAt?Uu(n,e):Ku(e),e=!t.skipUpdateTime&&n.updatedAt?ju(n,e):Xu(e),e=!t.skipSourceUrl&&n.sourceUrl?Hu(n,e):Ju(e),e=!t.skipLocation&&n.location?qu(n,e):ef(e),e=t.isNotebookNameNeeded&&n.notebookName?Wu(n,e):Qu(e),e=!t.skipReminderTime&&n.reminderTime?Zu(n,e):nf(e),e=!t.skipReminderOrder&&n.reminderOrder?Yu(n,e):of(e),e=!t.skipReminderDoneTime&&n.reminderDoneTime?zu(n,e):rf(e),e=e.replace(ja,"").replace(Ha,""),e};var sf=(n,t,e)=>{try{K.writeFileSync(n,t),Ar(n,e)}catch(i){throw console.error("Cannot write file ",i),i}};var lf=(n,t)=>{let e=ku(t);fe.getInstance().setCurrentNotePath(e),sf(e,n,t),console.log(`Note saved to ${e}`)};var ff=n=>{let t=new RegExp(`\\${q.sep}`,"g"),e=Nu(n).replace(t,B.pathSeparator||"/");return{absoluteResourceWorkDir:Ma(n),relativeResourceWorkDir:e}},df=n=>{let t={},e=n.content,{absoluteResourceWorkDir:i,relativeResourceWorkDir:r}=ff(n);if(console.log(`relative resource work dir: ${r}`),console.log(`absolute resource work dir: ${i}`),Su(n),Array.isArray(n.resource))for(let o of n.resource)t={...t,...pf(i,o)};else t={...t,...pf(i,n.resource)};for(let o of Object.keys(t))e=iy(e,t,o,r);return e},iy=(n,t,e,i)=>{let r=`${i}${B.pathSeparator}${t[e].fileName.replace(/ /g," ")}`;console.log(`mediaReference src ${r} added`);let o,a=`]*)hash="${e}".([^>]*)>`,s=new RegExp(a,"g"),l=n.match(s),c=l&&l.length>0&&l[0].split("type=");if(c&&c.length>1&&c[1].startsWith('"image')){let p=l[0].match(/width="(\w+)"/),m=p?` width="${p[1]}"`:"",y=l[0].match(/height="(\w+)"/),E=y?` height="${y[1]}"`:"";o=n.replace(s,`${t[e].fileName}`)}else o=n.replace(s,`${t[e].fileName}`);return o},pf=(n,t)=>{let e={},i=t.data.$text,r=Eu(t),a=iu(n,t).fileName,s=`${n}${q.sep}${a}`;console.log(t),console.log(i);let l=Buffer.from(i,"base64");K.writeFileSync(s,l);let c=r.valueOf()/1e3;try{K.utimesSync(s,c,c)}catch(p){}if(t.recognition&&a){let p=t.recognition.match(/[a-f0-9]{32}/);console.log(`resource ${a} added with hash ${p}`),e[p]={fileName:a,alreadyUsed:!1}}else{let p=uf.default.createHash("md5");p.update(l);let m=p.digest("hex");e[m]={fileName:a,alreadyUsed:!1}}return e},mf=(n,t)=>{if(t.indexOf('src="data:')<0)return t;let{absoluteResourceWorkDir:e,relativeResourceWorkDir:i}=ff(n);return K.mkdirSync(e,{recursive:!0}),t.replace(/src="data:([^;,]*)(;base64)?,([^"]*)"/g,(r,o,a,s)=>{let l=ry(o,a===";base64",s,e,n);return`src="${`${i}${B.pathSeparator}${l}`}"`})},ry=(n,t,e,i,r)=>{let o="embedded",a=oy(n)||".dat",s=hi(i,o),l=s<1?`${o}.${a}`:`${o}.${s}.${a}`,c=`${i}${q.sep}${l}`;return t||(e=decodeURIComponent(e)),K.writeFileSync(c,e,t?"base64":void 0),Ar(c,r),console.log(`data url resource ${l} added`),l},oy=n=>n.split("/").pop().split("+")[0];var hf=(n,t)=>{let e=new Date;fe.getInstance().setCurrentNoteName(n.title),Array.isArray(n.content)&&(n.content=n.content.join(""));let r={title:n.title,content:n.content,htmlContent:n.content,originalContent:n.content};console.log(`Converting for note "${r.title}" started at ${e}...`);try{Lu(n)&&(r.htmlContent=df(n)),r.htmlContent=mf(n,r.htmlContent),r={...r,...xu(B,r)},r={...r,...wu(n,t)},r={...r,...vu(n)};let o=af(r,B);lf(o,n)}catch(o){throw console.error(`Failed to convert note: ${r.title}`,o),o}finally{let o=new Date,a=(o.getTime()-e.getTime())/1e3;console.log(`Conversion for note "${r.title}" finished at ${o}. Took ${a} seconds`)}};var bf=require("obsidian");var gf=n=>n.taskstatus==="open"?_r:Tr;var ay="\u{1F53C}",sy="\u{1F53D}",ly="\u{1F4C5}",cy="\u23F3",xf=(n,t)=>{let e=gf(n),i=n.title?` ${n.title}`:"",r=B.obsidianTaskTag!==""?` ${B.obsidianTaskTag}`:"",o=n.duedate&&!isNaN(n.duedate.getTime())?` ${ly} ${yf(n.duedate)}`:"",a=n.reminderdate?` ${cy} ${yf(n.reminderdate)}`:"",s=n.taskflag?` ${ay}`:` ${sy}`;return`${e}${r}${i}${o}${a}${s}`},yf=n=>(0,bf.moment)(n).format("YYYY-MM-DD").toString();var Wa=(n,t,e)=>{let i=K.readdirSync(n);return t=t||[],i.forEach(r=>{K.statSync(`${n}${q.sep}${r}`).isDirectory()?t=Wa(`${n}${q.sep}${r}`,t,e):(e&&q.extname(r)==`.${e}`||!e)&&t.push(q.join(n,"/",r))}),t};var wf=(n,t)=>{let i=fe.getInstance().getAllNoteIdNameMap(),r=Object.entries(i);if(r.length===0)return;console.log("About to update links...");let o=[];for(let a of t)Wa(a,o,"");for(let a of t){console.log(`Notebook: ${a}`);let l=K.readdirSync(a).filter(c=>q.extname(c).toLowerCase()===".md");console.log(`${l.length} files to check for links`);for(let c of l){let p=q.join(a,c),m=K.readFileSync(p,"utf8"),y=m;for(let[E,v]of r){let d=v.uniqueEnd,f=v.title;o.find(D=>D.includes(d))&&(f=Au(f,d));let g=v.notebookName,w=n.urlEncodeFileNamesAndLinks?encodeURI(f):f,_=w;g&&!a.endsWith(g)&&(_=`${g}/${w}`);let A=new RegExp(Sn(E),"g");y=y.replace(A,_)}m!==y&&(console.log(`File written: ${p}`),K.writeFileSync(p,y))}}console.log("Link update complete.")};var vf=n=>cn(rn,n);var Ef=n=>cn(sn,n),_f=n=>cn(ln,n);var Tf=n=>cn(an,n),Af=n=>cn(gi,n)||cn(yi,n);var kf=n=>cn(on,n),cn=(n,t)=>t.includes(n.START_BLOCK)&&t.includes(n.CONTENT_PLACEHOLDER)&&t.includes(n.END_BLOCK);var Nf=`--- `,py=`{source-url-block}source: {source-url}{end-source-url-block} `,uy=`{tags-yaml-list-block} tags: {tags-yaml-list} {end-tags-yaml-list-block}`,fy=`{content-block}{content}{end-content-block} `,Sf=Nf+uy+py+Nf+fy;var Sy=Mf.Platform.isDesktopApp?Pf():null,Dr={enexSources:[],currentTemplate:"",outputDir:"./mdNotes",isMetadataNeeded:!1,isNotebookNameNeeded:!1,isZettelkastenNeeded:!1,useZettelIdAsFilename:!1,plainTextNotesOnly:!1,skipWebClips:!1,useHashTags:!0,nestedTags:{separatorInEN:"_",replaceSeparatorWith:"/",replaceSpaceWith:"-"},obsidianTaskTag:"",urlEncodeFileNamesAndLinks:!1,sanitizeResourceNameSpaces:!1,replacementChar:"_",pathSeparator:"/",resourcesDir:"_resources",turndownOptions:{headingStyle:"atx"}},Ry="@@@",B={...Dr};function Oy(n){return n==null?n:JSON.parse(JSON.stringify(n))}function $f(n,...t){for(let e of t)for(let i of Object.keys(e)){let r=e[i],o=n[i];!Array.isArray(r)&&typeof r=="object"&&!Array.isArray(o)&&typeof o=="object"?n[i]=$f({},o,r):n[i]=Oy(r)}return n}var Dy=n=>{B=$f({},Dr,n);let t=B.templateFile?K.readFileSync(B.templateFile,"utf-8"):Sf;t=B.currentTemplate?B.currentTemplate:t,B.skipCreationTime=!vf(t),B.skipLocation=!Ef(t),B.skipSourceUrl=!Tf(t),B.skipTags=!Af(t),B.skipUpdateTime=!kf(t),B.isNotebookNameNeeded=_f(t),B.currentTemplate=t,console.log(`Current config is: ${JSON.stringify(B,null,4)}`),console.log(`Path separator:${q.sep}`)},Cy=async(n,t,e)=>{if(!(t instanceof Me))throw new Error("Evernote import currently only works on desktop");let i=fe.getInstance();e.status("Processing "+t.name),console.log(`Getting stream from ${t}`);let r=t.createReadStream(),o={},a=i.getCurrentNotebookName();return new Promise((s,l)=>{let c=y=>(e.reportFailed(i.getCurrentNotebookFullpath(),y),l(y)),p=Sy(r),m=null;p.on("tag:note-attributes",y=>{m=y}),p.on("tag:note",y=>{if(e.isCancelled()){r.close();return}if(n.skipWebClips&&Pu(y))e.reportSkipped(y.title);else{e.status("Importing note "+y.title),m&&(y["note-attributes"]=m);try{hf(y,a),e.reportNoteSuccess(a+"/"+y.title)}catch(v){return e.reportFailed(y.title||t,v),s()}}m=null;let E=i.getCurrentNotePath();if(E)for(let v of Object.keys(o)){let d=`${v}`,f=K.readFileSync(E,"utf8"),g=new Map([...o[v]].sort()),w=f.replace(d,[...g.values()].join(` -`));K.writeFileSync(E,w)}}),p.on("tag:task",y=>{let E=Zp(y);o[E.taskgroupnotelevelid]||(o[E.taskgroupnotelevelid]=new Map),o[E.taskgroupnotelevelid].set(E.sortweight,xf(E,a))}),p.on("end",s),p.on("error",c),r.on("error",c)})};async function Bf(n,t){Dy(n);let e=[],i=n.outputDir;for(let r of n.enexSources){if(t.isCancelled())return;let o,a=fe.getInstance();r.basename.includes(Ry)?(n.outputDir=Du(r,n),o=Ou(r),Iu(o,n),a.setCurrentNotebookName(o.basename),a.setCurrentNotebookFullpath(o.fullpath)):(Cu(r,n),a.setCurrentNotebookName(r.basename),a.setCurrentNotebookFullpath(r.fullpath)),await Cy(n,r,t),e.push($a()),n.outputDir=i}t.isCancelled()||await wf(n,e)}var Cr=class extends ce{init(){this.addFileChooserSetting("Evernote",["enex"],!0),this.addOutputLocationSetting("Evernote")}async import(t){let{files:e}=this;if(e.length===0){new xi.Notice("Please pick at least one file to import.");return}let i=await this.getOutputFolder();if(!i){new xi.Notice("Please select a location to export to.");return}let{app:r}=this,o=r.vault.adapter;if(!(o instanceof xi.FileSystemAdapter))return;let a={...Dr,enexSources:e,outputDir:q.join(o.getBasePath(),i.path)};await Bf(a,t)}};var ke=require("obsidian");var Ir=class extends ce{init(){this.addFileChooserSetting("HTML",["htm","html"],!0),this.addAttachmentSizeLimit(0),this.addMinimumImageSize(65),this.addOutputLocationSetting("HTML import")}addAttachmentSizeLimit(e){this.attachmentSizeLimit=e*10**6,new ke.Setting(this.modal.contentEl).setName("Attachment size limit (MB)").setDesc("Set 0 to disable.").addText(i=>i.then(({inputEl:r})=>{r.type="number",r.step="0.1"}).setValue(e.toString()).onChange(r=>{let o=["+","-"].includes(r)?0:Number(r);if(Number.isNaN(o)||o<0){i.setValue((this.attachmentSizeLimit/10**6).toString());return}this.attachmentSizeLimit=o*10**6}))}addMinimumImageSize(e){this.minimumImageSize=e,new ke.Setting(this.modal.contentEl).setName("Minimum image size (px)").setDesc("Set 0 to disable.").addText(i=>i.then(({inputEl:r})=>r.type="number").setValue(e.toString()).onChange(r=>{let o=["+","-"].includes(r)?0:Number(r);if(!Number.isInteger(o)||o<0){i.setValue(this.minimumImageSize.toString());return}this.minimumImageSize=o}))}async import(e){let{files:i}=this;if(i.length===0){new ke.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new ke.Notice("Please select a location to export to.");return}let o=new Map;e.reportProgress(0,i.length);for(let c=0;c{s=c});a.onCleanCache(async()=>{for(let[c,{file:p,tFile:m}]of o){if(e.isCancelled())break;try{let y=await this.app.vault.cachedRead(m),E=a.computeMetadataAsync?await a.computeMetadataAsync(Oo(y)):a.getFileCache(m);if(!E)continue;let v=[];if(E.links)for(let{link:d,position:f,displayText:g}of E.links){let{path:w,subpath:T}=(0,ke.parseLinktext)(d),A;if(Xn){let _=new URL(encodeURI(w),c);_.hash="",_.search="",A=decodeURIComponent(_.href)}else A=oe(w.replace(/#/gu,"%23")).name;let D=o.get(A);if(D){let _=this.app.fileManager.generateMarkdownLink(D.tFile,m.path,T,g);v.push({from:f.start.offset,to:f.end.offset,text:_})}}v.sort((d,f)=>f.from-d.from);for(let d of v)y=y.substring(0,d.from)+d.text+y.substring(d.to);await this.vault.modify(m,y)}catch(y){e.reportFailed(p.fullpath,y)}}s()}),await l}async processFile(e,i,r){e.status("Processing "+r.name);try{let o=await r.readText(),a=ft(o);Iy(a);let s=r instanceof Me?Xn.pathToFileURL(r.filepath):void 0,l=new Map,c=new Map;for(let y of a.findAll("img, audio, video")){if(e.isCancelled())return;let E=y.getAttribute("src");if(E)try{let v=new URL(E.startsWith("//")?`https:${E}`:E,s),d=v.href,f=l.get(d);l.has(d)||(e.status("Downloading attachment for "+r.name),f=await this.downloadAttachment(i,y,v),l.set(d,f),f?(c.set(f.path,f),e.reportAttachmentSuccess(f.name)):e.reportSkipped(E)),f&&(y.setAttribute("src",f.path.replace(/ /g,"%20")),y instanceof HTMLImageElement||y.replaceWith(createEl("img",{attr:{src:f.path.replace(/ /g,"%20"),alt:y.getAttr("alt")}})))}catch(v){e.reportFailed(E,v)}}let p=(0,ke.htmlToMarkdown)(a),m=await this.saveAsMarkdownFile(i,r.basename,p);if(!Object.isEmpty(l)){let{metadataCache:y}=this.app,E;y.computeMetadataAsync?E=await y.computeMetadataAsync(Oo(p)):E=await new Promise(d=>{let f=y.getFileCache(m);if(f)return d(f);let g=y.on("changed",(w,T,A)=>{w===m&&(y.offref(g),d(A))})});let v=[];if(E.embeds){for(let{link:d,position:f}of E.embeds)if(c.has(d)){let g=this.app.fileManager.generateMarkdownLink(c.get(d),m.path);v.push({from:f.start.offset,to:f.end.offset,text:g})}}v.sort((d,f)=>f.from-d.from);for(let d of v)p=p.substring(0,d.from)+d.text+p.substring(d.to);await this.vault.modify(m,p)}return e.reportNoteSuccess(r.fullpath),m}catch(o){e.reportFailed(r.fullpath,o)}return null}async downloadAttachment(e,i,r){let o="",a="",s;switch(r.protocol){case"file:":let p=Xn.fileURLToPath(r.href);({basename:o,extension:a}=oe(p)),s=Zi(await Pe.readFile(p));break;case"https:":case"http:":let m=await Ly(r),y=Fy(r);o=y.basename,s=m.data,a=vr(m.mime)||y.extension;break;default:throw new Error(r.href)}if(!this.filterAttachmentSize(s)||i instanceof HTMLImageElement&&!await this.filterImageSize(s))return null;if(!a)if(i instanceof HTMLImageElement)a="png";else if(i instanceof HTMLAudioElement)a="mp3";else if(i instanceof HTMLVideoElement)a="mp4";else return null;let l=await this.createFolders((0,ke.normalizePath)(e.path+"/Attachments")),c=await this.vault.getAvailablePath(l.getParentPrefix()+o,a);return await this.vault.createBinary(c,s)}filterAttachmentSize(e){let{byteLength:i}=e;return!this.attachmentSizeLimit||i<=this.attachmentSizeLimit}async filterImageSize(e){if(!this.minimumImageSize)return!0;let i;try{i=await Py(e)}catch(a){return!0}let{height:r,width:o}=i;return o>=this.minimumImageSize&&r>=this.minimumImageSize}};function Uf(n,t){let e=n.getAttribute(t);e!==null&&n.setAttribute(t,e.replace(/ /gu,"%20"))}function Iy(n){n.findAll("a").forEach(t=>Uf(t,"href")),n.findAll("audio, img, video").forEach(t=>Uf(t,"src"))}function Fy(n){return oe((0,ke.normalizePath)(decodeURIComponent(n.pathname)))}async function Ly(n){var e,i;try{let r=await fetch(n,{mode:"cors",referrerPolicy:"no-referrer"});if(r.ok)return{data:await r.arrayBuffer(),mime:(e=r.headers.get("Content-Type"))!=null?e:""}}catch(r){}let t=await(0,ke.requestUrl)(n.href);return{data:t.arrayBuffer,mime:(i=t.headers["Content-Type"])!=null?i:""}}async function Py(n){let t=new Image,e=URL.createObjectURL(new Blob([n]));try{return await new Promise((i,r)=>{t.addEventListener("error",({error:o})=>r(o),{once:!0,passive:!0}),t.addEventListener("load",()=>i({height:t.naturalHeight,width:t.naturalWidth}),{once:!0,passive:!0}),t.src=e})}finally{URL.revokeObjectURL(e)}}var In=require("obsidian");var My=/(#[^ ^#]*)/g,$y=/[\\:*?<>\"|!@#$%^&()+=\`\'~;,.]/g;function za(n){let t=n.replace($y,"");return t=t.split(" ").join("-"),isNaN(t[0])||(t="_"+t),t}function Ga(n){return n.replace(My,t=>"#"+za(t))}function jf(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}var By=["zip"],Uy=["json"],jy=["html","txt"],Fr=class extends ce{constructor(){super(...arguments);this.importArchived=!1;this.importTrashed=!1}init(){this.addFileChooserSetting("Notes & attachments",[...By,...Uy,...Fn],!0),this.importArchivedSetting=new In.Setting(this.modal.contentEl).setName("Import archived notes").setDesc("If imported, files archived in Google Keep will be tagged as archived.").addToggle(e=>{e.setValue(this.importArchived),e.onChange(async i=>{this.importArchived=i})}),this.importTrashedSetting=new In.Setting(this.modal.contentEl).setName("Import deleted notes").setDesc("If imported, files deleted in Google Keep will be tagged as deleted. Deleted notes will only exist in your Google export if deleted recently.").addToggle(e=>{e.setValue(this.importTrashed),e.onChange(async i=>{this.importTrashed=i})}),this.addOutputLocationSetting("Google Keep")}async import(e){let{files:i}=this;if(i.length===0){new In.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new In.Notice("Please select a location to import your files to.");return}let o=`${r.path}/Assets`;for(let a of i){if(e.isCancelled())return;await this.handleFile(a,r,o,e)}}async handleFile(e,i,r,o){let{fullpath:a,name:s,extension:l}=e;o.status("Processing "+s);try{l==="zip"?await this.readZipEntries(e,i,r,o):l==="json"?await this.importKeepNote(e,i,o):Fn.contains(l)?(o.status("Importing attachment "+s),await this.copyFile(e,r),o.reportAttachmentSuccess(a)):!(e instanceof ui)&&!jy.contains(l)&&o.reportSkipped(a)}catch(c){o.reportFailed(a,c)}}async readZipEntries(e,i,r,o){await gt(e,async(a,s)=>{for(let l of s){if(o.isCancelled())return;await this.handleFile(l,i,r,o)}})}async importKeepNote(e,i,r){let{fullpath:o,basename:a}=e;r.status("Importing note "+a);let s=await e.readText(),l=JSON.parse(s);if(!l||!l.userEditedTimestampUsec||!l.createdTimestampUsec){r.reportFailed(o,"Invalid Google Keep JSON");return}if(l.isArchived&&!this.importArchived){r.reportSkipped(o,"Archived note");return}if(l.isTrashed&&!this.importTrashed){r.reportSkipped(o,"Deleted note");return}await this.convertKeepJson(l,i,a),r.reportNoteSuccess(o)}async copyFile(e,i){let r=await this.createFolders(i),o=await e.read();await this.vault.createBinary(`${r.path}/${e.name}`,o)}async convertKeepJson(e,i,r){let o=[],a={};if(e.title){let c=e.title.split(` +`));K.writeFileSync(E,w)}}),p.on("tag:task",y=>{let E=Zp(y);o[E.taskgroupnotelevelid]||(o[E.taskgroupnotelevelid]=new Map),o[E.taskgroupnotelevelid].set(E.sortweight,xf(E,a))}),p.on("end",s),p.on("error",c),r.on("error",c)})};async function Bf(n,t){Dy(n);let e=[],i=n.outputDir;for(let r of n.enexSources){if(t.isCancelled())return;let o,a=fe.getInstance();r.basename.includes(Ry)?(n.outputDir=Du(r,n),o=Ou(r),Iu(o,n),a.setCurrentNotebookName(o.basename),a.setCurrentNotebookFullpath(o.fullpath)):(Cu(r,n),a.setCurrentNotebookName(r.basename),a.setCurrentNotebookFullpath(r.fullpath)),await Cy(n,r,t),e.push($a()),n.outputDir=i}t.isCancelled()||await wf(n,e)}var Cr=class extends ce{init(){this.addFileChooserSetting("Evernote",["enex"],!0),this.addOutputLocationSetting("Evernote")}async import(t){let{files:e}=this;if(e.length===0){new xi.Notice("Please pick at least one file to import.");return}let i=await this.getOutputFolder();if(!i){new xi.Notice("Please select a location to export to.");return}let{app:r}=this,o=r.vault.adapter;if(!(o instanceof xi.FileSystemAdapter))return;let a={...Dr,enexSources:e,outputDir:q.join(o.getBasePath(),i.path)};await Bf(a,t)}};var Ae=require("obsidian");var Ir=class extends ce{init(){this.addFileChooserSetting("HTML",["htm","html"],!0),this.addAttachmentSizeLimit(0),this.addMinimumImageSize(65),this.addOutputLocationSetting("HTML import")}addAttachmentSizeLimit(e){this.attachmentSizeLimit=e*10**6,new Ae.Setting(this.modal.contentEl).setName("Attachment size limit (MB)").setDesc("Set 0 to disable.").addText(i=>i.then(({inputEl:r})=>{r.type="number",r.step="0.1"}).setValue(e.toString()).onChange(r=>{let o=["+","-"].includes(r)?0:Number(r);if(Number.isNaN(o)||o<0){i.setValue((this.attachmentSizeLimit/10**6).toString());return}this.attachmentSizeLimit=o*10**6}))}addMinimumImageSize(e){this.minimumImageSize=e,new Ae.Setting(this.modal.contentEl).setName("Minimum image size (px)").setDesc("Set 0 to disable.").addText(i=>i.then(({inputEl:r})=>r.type="number").setValue(e.toString()).onChange(r=>{let o=["+","-"].includes(r)?0:Number(r);if(!Number.isInteger(o)||o<0){i.setValue(this.minimumImageSize.toString());return}this.minimumImageSize=o}))}async import(e){let{files:i}=this;if(i.length===0){new Ae.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new Ae.Notice("Please select a location to export to.");return}let o=new Map;e.reportProgress(0,i.length);for(let c=0;c{s=c});a.onCleanCache(async()=>{for(let[c,{file:p,tFile:m}]of o){if(e.isCancelled())break;try{let y=await this.app.vault.cachedRead(m),E=a.computeMetadataAsync?await a.computeMetadataAsync(Oo(y)):a.getFileCache(m);if(!E)continue;let v=[];if(E.links)for(let{link:d,position:f,displayText:g}of E.links){let{path:w,subpath:_}=(0,Ae.parseLinktext)(d),A;if(Jn){let T=new URL(encodeURI(w),c);T.hash="",T.search="",A=decodeURIComponent(T.href)}else A=re(w.replace(/#/gu,"%23")).name;let D=o.get(A);if(D){let T=this.app.fileManager.generateMarkdownLink(D.tFile,m.path,_,g);v.push({from:f.start.offset,to:f.end.offset,text:T})}}v.sort((d,f)=>f.from-d.from);for(let d of v)y=y.substring(0,d.from)+d.text+y.substring(d.to);await this.vault.modify(m,y)}catch(y){e.reportFailed(p.fullpath,y)}}s()}),await l}async processFile(e,i,r){e.status("Processing "+r.name);try{let o=await r.readText(),a=ft(o);Iy(a);let s=r instanceof Me?Jn.pathToFileURL(r.filepath):void 0,l=new Map,c=new Map;for(let y of a.findAll("img, audio, video")){if(e.isCancelled())return;let E=y.getAttribute("src");if(E)try{let v=new URL(E.startsWith("//")?`https:${E}`:E,s),d=v.href,f=l.get(d);l.has(d)||(e.status("Downloading attachment for "+r.name),f=await this.downloadAttachment(i,y,v),l.set(d,f),f?(c.set(f.path,f),e.reportAttachmentSuccess(f.name)):e.reportSkipped(E)),f&&(y.setAttribute("src",f.path.replace(/ /g,"%20")),y instanceof HTMLImageElement||y.replaceWith(createEl("img",{attr:{src:f.path.replace(/ /g,"%20"),alt:y.getAttr("alt")}})))}catch(v){e.reportFailed(E,v)}}let p=(0,Ae.htmlToMarkdown)(a),m=await this.saveAsMarkdownFile(i,r.basename,p);if(!Object.isEmpty(l)){let{metadataCache:y}=this.app,E;y.computeMetadataAsync?E=await y.computeMetadataAsync(Oo(p)):E=await new Promise(d=>{let f=y.getFileCache(m);if(f)return d(f);let g=y.on("changed",(w,_,A)=>{w===m&&(y.offref(g),d(A))})});let v=[];if(E.embeds){for(let{link:d,position:f}of E.embeds)if(c.has(d)){let g=this.app.fileManager.generateMarkdownLink(c.get(d),m.path);v.push({from:f.start.offset,to:f.end.offset,text:g})}}v.sort((d,f)=>f.from-d.from);for(let d of v)p=p.substring(0,d.from)+d.text+p.substring(d.to);await this.vault.modify(m,p)}return e.reportNoteSuccess(r.fullpath),m}catch(o){e.reportFailed(r.fullpath,o)}return null}async downloadAttachment(e,i,r){let o="",a="",s;switch(r.protocol){case"file:":let p=Jn.fileURLToPath(r.href);({basename:o,extension:a}=re(p)),s=Zi(await Pe.readFile(p));break;case"https:":case"http:":let m=await Ly(r),y=Fy(r);o=y.basename,s=m.data,a=vr(m.mime)||y.extension;break;default:throw new Error(r.href)}if(!this.filterAttachmentSize(s)||i instanceof HTMLImageElement&&!await this.filterImageSize(s))return null;if(!a)if(i instanceof HTMLImageElement)a="png";else if(i instanceof HTMLAudioElement)a="mp3";else if(i instanceof HTMLVideoElement)a="mp4";else return null;let l=await this.createFolders((0,Ae.normalizePath)(e.path+"/Attachments")),c=await this.vault.getAvailablePath(l.getParentPrefix()+o,a);return await this.vault.createBinary(c,s)}filterAttachmentSize(e){let{byteLength:i}=e;return!this.attachmentSizeLimit||i<=this.attachmentSizeLimit}async filterImageSize(e){if(!this.minimumImageSize)return!0;let i;try{i=await Py(e)}catch(a){return!0}let{height:r,width:o}=i;return o>=this.minimumImageSize&&r>=this.minimumImageSize}};function Uf(n,t){let e=n.getAttribute(t);e!==null&&n.setAttribute(t,e.replace(/ /gu,"%20"))}function Iy(n){n.findAll("a").forEach(t=>Uf(t,"href")),n.findAll("audio, img, video").forEach(t=>Uf(t,"src"))}function Fy(n){return re((0,Ae.normalizePath)(decodeURIComponent(n.pathname)))}async function Ly(n){var e,i;try{let r=await fetch(n,{mode:"cors",referrerPolicy:"no-referrer"});if(r.ok)return{data:await r.arrayBuffer(),mime:(e=r.headers.get("Content-Type"))!=null?e:""}}catch(r){}let t=await(0,Ae.requestUrl)(n.href);return{data:t.arrayBuffer,mime:(i=t.headers["Content-Type"])!=null?i:""}}async function Py(n){let t=new Image,e=URL.createObjectURL(new Blob([n]));try{return await new Promise((i,r)=>{t.addEventListener("error",({error:o})=>r(o),{once:!0,passive:!0}),t.addEventListener("load",()=>i({height:t.naturalHeight,width:t.naturalWidth}),{once:!0,passive:!0}),t.src=e})}finally{URL.revokeObjectURL(e)}}var Fn=require("obsidian");var My=/(#[^ ^#]*)/g,$y=/[\\:*?<>\"|!@#$%^&()+=\`\'~;,.]/g;function za(n){let t=n.replace($y,"");return t=t.split(" ").join("-"),isNaN(t[0])||(t="_"+t),t}function Ga(n){return n.replace(My,t=>"#"+za(t))}function jf(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}var By=["zip"],Uy=["json"],jy=["html","txt"],Fr=class extends ce{constructor(){super(...arguments);this.importArchived=!1;this.importTrashed=!1}init(){this.addFileChooserSetting("Notes & attachments",[...By,...Uy,...Ln],!0),this.importArchivedSetting=new Fn.Setting(this.modal.contentEl).setName("Import archived notes").setDesc("If imported, files archived in Google Keep will be tagged as archived.").addToggle(e=>{e.setValue(this.importArchived),e.onChange(async i=>{this.importArchived=i})}),this.importTrashedSetting=new Fn.Setting(this.modal.contentEl).setName("Import deleted notes").setDesc("If imported, files deleted in Google Keep will be tagged as deleted. Deleted notes will only exist in your Google export if deleted recently.").addToggle(e=>{e.setValue(this.importTrashed),e.onChange(async i=>{this.importTrashed=i})}),this.addOutputLocationSetting("Google Keep")}async import(e){let{files:i}=this;if(i.length===0){new Fn.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new Fn.Notice("Please select a location to import your files to.");return}let o=`${r.path}/Assets`;for(let a of i){if(e.isCancelled())return;await this.handleFile(a,r,o,e)}}async handleFile(e,i,r,o){let{fullpath:a,name:s,extension:l}=e;o.status("Processing "+s);try{l==="zip"?await this.readZipEntries(e,i,r,o):l==="json"?await this.importKeepNote(e,i,o):Ln.contains(l)?(o.status("Importing attachment "+s),await this.copyFile(e,r),o.reportAttachmentSuccess(a)):!(e instanceof fi)&&!jy.contains(l)&&o.reportSkipped(a)}catch(c){o.reportFailed(a,c)}}async readZipEntries(e,i,r,o){await gt(e,async(a,s)=>{for(let l of s){if(o.isCancelled())return;await this.handleFile(l,i,r,o)}})}async importKeepNote(e,i,r){let{fullpath:o,basename:a}=e;r.status("Importing note "+a);let s=await e.readText(),l=JSON.parse(s);if(!l||!l.userEditedTimestampUsec||!l.createdTimestampUsec){r.reportFailed(o,"Invalid Google Keep JSON");return}if(l.isArchived&&!this.importArchived){r.reportSkipped(o,"Archived note");return}if(l.isTrashed&&!this.importTrashed){r.reportSkipped(o,"Deleted note");return}await this.convertKeepJson(l,i,a),r.reportNoteSuccess(o)}async copyFile(e,i){let r=await this.createFolders(i),o=await e.read();await this.vault.createBinary(`${r.path}/${e.name}`,o)}async convertKeepJson(e,i,r){let o=[],a={};if(e.title){let c=e.title.split(` `).filter(p=>p!==r);c.length>0&&(a.aliases=c)}let s=[];if(e.color&&e.color!=="DEFAULT"){let c=e.color.toLowerCase();c=jf(c),s.push(`Keep/Color/${c}`)}if(e.isPinned&&s.push("Keep/Pinned"),e.attachments&&s.push("Keep/Attachment"),e.isArchived&&s.push("Keep/Archived"),e.isTrashed&&s.push("Keep/Deleted"),e.labels)for(let c of e.labels)s.push(`Keep/Label/${c.name}`);if(s.length>0&&(a.tags=s.map(c=>za(c))),o.push(Yi(a)),e.textContent&&(o.push(` `),o.push(Ga(e.textContent))),e.listContent){let c=[];for(let p of e.listContent){if(!p.text)continue;let m=`- [${p.isChecked?"X":" "}] ${p.text}`;c.push(Ga(m))}o.push(` `),o.push(c.join(` `))}if(e.attachments){o.push(` -`);for(let c of e.attachments)o.push(`![[${c.filePath}]]`)}let l=await this.saveAsMarkdownFile(i,r,o.join(""));await this.vault.append(l,"",{ctime:e.createdTimestampUsec/1e3,mtime:e.userEditedTimestampUsec/1e3})}};var xt=require("obsidian");var Va=require("obsidian");function Hf({info:n,vault:t,targetFolderPath:e,parentsInSubfolders:i}){let r=t.getAllLoadedFiles(),o=new Set,a=new Set(r.map(s=>s.name));i&&qy(n),Hy({info:n,pathDuplicateChecks:o,titleDuplicateChecks:a}),Wy({info:n,loadedFiles:r,titleDuplicateChecks:a,targetFolderPath:e})}function Hy({info:n,pathDuplicateChecks:t,titleDuplicateChecks:e}){for(let i of Object.values(n.idsToFileInfo)){let r=n.getPathForFile(i);if(t.has(`${r}${i.title}`)){let o=2;for(i.title=i.title+" "+o;t.has(`${r}${i.title}`);)o++,i.title=`${i.title.replace(/ \d+$/,"")} ${o}`}e.has(i.title+".md")&&(i.fullLinkPathNeeded=!0),t.add(`${r}${i.title}`),e.add(i.title+".md")}}function qy(n){let t=new Set(Object.values(n.idsToFileInfo).map(e=>e.parentIds).concat(Object.values(n.pathsToAttachmentInfo).map(e=>e.parentIds)).map(e=>e.length>0?e[e.length-1]:""));for(let e of Object.keys(n.idsToFileInfo))t.has(e)&&n.idsToFileInfo[e].parentIds.push(e)}function Wy({info:n,loadedFiles:t,titleDuplicateChecks:e,targetFolderPath:i}){var l;let r=new Set(t.filter(c=>!c.path.endsWith(".md")).map(c=>c.path)),o=n.attachmentPath,a=/^\.\//.test(o),s=(l=o.match(/\.\/(.*)/))==null?void 0:l[1];for(let c of Object.values(n.pathsToAttachmentInfo)){e.has(c.nameWithExtension)&&(c.fullLinkPathNeeded=!0);let p="";if(a?p=(0,Va.normalizePath)(`${i}${n.getPathForFile(c)}${s!=null?s:""}`):p=(0,Va.normalizePath)(o+"/"),p.endsWith("/")||(p+="/"),r.has(p+c.nameWithExtension)){let m=2,{basename:y,extension:E}=oe(c.path);for(;r.has(`${p}${y} ${m}.${E}`);)m++;c.nameWithExtension=`${y} ${m}.${E}`}c.targetParentFolder=p,r.add(p+c.nameWithExtension),e.add(c.nameWithExtension)}}var Ln=require("obsidian");var qf=n=>n.replace(/-/g,"").replace(/[ -]?[a-z0-9]{32}(\.|$)/,"$1"),bt=n=>{var t;return(t=n.replace(/-/g,"").match(/([a-z0-9]{32})(\?|\.|$)/))==null?void 0:t[1]},Ka=n=>{let{parent:t}=oe(n);return t.split("/").map(e=>bt(e)).filter(e=>e)};function Xa(n){return n.hour()===0&&n.minute()===0?n.format("YYYY-MM-DD"):n.format("YYYY-MM-DDTHH:mm")}function Wf(n){return n.replace(/^(\.\.\/)+/,"")}function Zf(n){let t=/#[a-z0-9\-]+/gi;if(!t.test(n))return n;let e=n.split(` +`);for(let c of e.attachments)o.push(`![[${c.filePath}]]`)}let l=await this.saveAsMarkdownFile(i,r,o.join(""));await this.vault.append(l,"",{ctime:e.createdTimestampUsec/1e3,mtime:e.userEditedTimestampUsec/1e3})}};var xt=require("obsidian");var Va=require("obsidian");function Hf({info:n,vault:t,targetFolderPath:e,parentsInSubfolders:i}){let r=t.getAllLoadedFiles(),o=new Set,a=new Set(r.map(s=>s.name));i&&qy(n),Hy({info:n,pathDuplicateChecks:o,titleDuplicateChecks:a}),Wy({info:n,loadedFiles:r,titleDuplicateChecks:a,targetFolderPath:e})}function Hy({info:n,pathDuplicateChecks:t,titleDuplicateChecks:e}){for(let i of Object.values(n.idsToFileInfo)){let r=n.getPathForFile(i);if(t.has(`${r}${i.title}`)){let o=2;for(i.title=i.title+" "+o;t.has(`${r}${i.title}`);)o++,i.title=`${i.title.replace(/ \d+$/,"")} ${o}`}e.has(i.title+".md")&&(i.fullLinkPathNeeded=!0),t.add(`${r}${i.title}`),e.add(i.title+".md")}}function qy(n){let t=new Set(Object.values(n.idsToFileInfo).map(e=>e.parentIds).concat(Object.values(n.pathsToAttachmentInfo).map(e=>e.parentIds)).map(e=>e.length>0?e[e.length-1]:""));for(let e of Object.keys(n.idsToFileInfo))t.has(e)&&n.idsToFileInfo[e].parentIds.push(e)}function Wy({info:n,loadedFiles:t,titleDuplicateChecks:e,targetFolderPath:i}){var l;let r=new Set(t.filter(c=>!c.path.endsWith(".md")).map(c=>c.path)),o=n.attachmentPath,a=/^\.\//.test(o),s=(l=o.match(/\.\/(.*)/))==null?void 0:l[1];for(let c of Object.values(n.pathsToAttachmentInfo)){e.has(c.nameWithExtension)&&(c.fullLinkPathNeeded=!0);let p="";if(a?p=(0,Va.normalizePath)(`${i}${n.getPathForFile(c)}${s!=null?s:""}`):p=(0,Va.normalizePath)(o+"/"),p.endsWith("/")||(p+="/"),r.has(p+c.nameWithExtension)){let m=2,{basename:y,extension:E}=re(c.path);for(;r.has(`${p}${y} ${m}.${E}`);)m++;c.nameWithExtension=`${y} ${m}.${E}`}c.targetParentFolder=p,r.add(p+c.nameWithExtension),e.add(c.nameWithExtension)}}var Pn=require("obsidian");var qf=n=>n.replace(/-/g,"").replace(/[ -]?[a-z0-9]{32}(\.|$)/,"$1"),bt=n=>{var t;return(t=n.replace(/-/g,"").match(/([a-z0-9]{32})(\?|\.|$)/))==null?void 0:t[1]},Ka=n=>{let{parent:t}=re(n);return t.split("/").map(e=>bt(e)).filter(e=>e)};function Xa(n){return n.hour()===0&&n.minute()===0?n.format("YYYY-MM-DD"):n.format("YYYY-MM-DDTHH:mm")}function Wf(n){return n.replace(/^(\.\.\/)+/,"")}function Zf(n){let t=/#[a-z0-9\-]+/gi;if(!t.test(n))return n;let e=n.split(` `);for(let i=0;i tbody");if(s){let y=zf(n,s);Qf(n,y,!1),i1(s);for(let E of Array.from(s.rows)){let v=Zy(E);v&&(v.title=="Tags"&&(v.title="tags",typeof v.content=="string"?v.content=v.content.replace(/ /g,"-"):v.content instanceof Array&&(v.content=v.content.map(d=>d.replace(/ /g,"-")))),a[v.title]=v.content)}}Gf(r,"strong"),Gf(r,"em"),Ky(r),Vy(r),e1(r),Qy(r),nd(r),zy(r),Xf(r,"div.indented"),Xf(r,"details"),t1(r),Jf(r,"ul"),Jf(r,"ol"),n1(r),Jy(r),Xy(r);let l=r.innerHTML;Vf(l,"strong"),Vf(l,"em");let c=(0,Ln.htmlToMarkdown)(l);n.singleLineBreaks&&(c=c.replace(/\n\n(?!>)/g,` +`),n}function Ja(n){n.replaceWith(...Array.from(n.childNodes))}async function ed(n,t){var m;let e=await t.readText(),i=ft(e),r=i.find("div[class=page-body]");if(r===null)throw new Error("page body was not found");let o=zf(n,r);Qf(n,o,!0);let a={},s=i.find("table[class=properties] > tbody");if(s){let y=zf(n,s);Qf(n,y,!1),i1(s);for(let E of Array.from(s.rows)){let v=Zy(E);v&&(v.title=="Tags"&&(v.title="tags",typeof v.content=="string"?v.content=v.content.replace(/ /g,"-"):v.content instanceof Array&&(v.content=v.content.map(d=>d.replace(/ /g,"-")))),a[v.title]=v.content)}}Gf(r,"strong"),Gf(r,"em"),Ky(r),Vy(r),e1(r),Qy(r),nd(r),zy(r),Xf(r,"div.indented"),Xf(r,"details"),t1(r),Jf(r,"ul"),Jf(r,"ol"),n1(r),Jy(r),Xy(r);let l=r.innerHTML;Vf(l,"strong"),Vf(l,"em");let c=(0,Pn.htmlToMarkdown)(l);n.singleLineBreaks&&(c=c.replace(/\n\n(?!>)/g,` `)),c=Zf(c),c=Yy(c);let p=(m=i.find("p[class*=page-description]"))==null?void 0:m.textContent;return p&&(c=p+` -`+c),Yi(a)+c}var Yf={checkbox:["checkbox"],date:["created_time","last_edited_time","date"],list:["file","multi_select","relation"],number:["number","auto_increment_id"],text:["email","person","phone_number","text","url","status","select","formula","rollup","last_edited_by","created_by"]};function Zy(n){var a,s,l,c,p,m;let t=(a=n.className.match(/property-row-(.*)/))==null?void 0:a[1];if(!t)throw new Error("property type not found for: "+n);let e=(0,Ln.htmlToMarkdown)((s=n.cells[0].textContent)!=null?s:""),i=n.cells[1],r=Object.keys(Yf).find(y=>Yf[y].includes(t));if(!r)throw new Error("type not found for: "+i);let o="";switch(r){case"checkbox":o=i.innerHTML.includes("checkbox-on");break;case"number":if(o=Number(i.textContent),isNaN(o))return;break;case"date":nd(i);let y=i.getElementsByTagName("time");if(y.length===0)o="";else if(y.length===1)o=Xa((0,Ln.moment)((l=y.item(0))==null?void 0:l.textContent));else{let d=[];for(let f=0;fl.includes(o));a&&o.endsWith(".html")?e.push({type:"relation",a:r,id:a}):s&&e.push({type:"attachment",a:r,path:s})}return e}function Yy(n){let t=/\[\[[^\]]*(\\\\)\|[^\]]*\]\]/,e=n.match(new RegExp(t,"g"));return e==null||e.forEach(i=>{n=n.replace(i,i.replace(/\\\\\|/g,"\\|"))}),n}function zy(n){let t=n.findAll(".katex");for(let e of t){let i=e.find("annotation");i&&(i.setText(`$${i.textContent}$`),e.replaceWith(i))}}function Gy(n){var e;let t=(e=n.match(/^[^\.\?\!\n]*[\.\?\!]?/))==null?void 0:e[0];return t!=null?t:""}function td(n){var t;return!!/callout|bookmark/.test((t=n.getAttribute("class"))!=null?t:"")}function Vy(n){for(let t of n.findAll("figure.callout")){let i=`> [!important] +`+c),Yi(a)+c}var Yf={checkbox:["checkbox"],date:["created_time","last_edited_time","date"],list:["file","multi_select","relation"],number:["number","auto_increment_id"],text:["email","person","phone_number","text","url","status","select","formula","rollup","last_edited_by","created_by"]};function Zy(n){var a,s,l,c,p,m;let t=(a=n.className.match(/property-row-(.*)/))==null?void 0:a[1];if(!t)throw new Error("property type not found for: "+n);let e=(0,Pn.htmlToMarkdown)((s=n.cells[0].textContent)!=null?s:""),i=n.cells[1],r=Object.keys(Yf).find(y=>Yf[y].includes(t));if(!r)throw new Error("type not found for: "+i);let o="";switch(r){case"checkbox":o=i.innerHTML.includes("checkbox-on");break;case"number":if(o=Number(i.textContent),isNaN(o))return;break;case"date":nd(i);let y=i.getElementsByTagName("time");if(y.length===0)o="";else if(y.length===1)o=Xa((0,Pn.moment)((l=y.item(0))==null?void 0:l.textContent));else{let d=[];for(let f=0;fl.includes(o));a&&o.endsWith(".html")?e.push({type:"relation",a:r,id:a}):s&&e.push({type:"attachment",a:r,path:s})}return e}function Yy(n){let t=/\[\[[^\]]*(\\\\)\|[^\]]*\]\]/,e=n.match(new RegExp(t,"g"));return e==null||e.forEach(i=>{n=n.replace(i,i.replace(/\\\\\|/g,"\\|"))}),n}function zy(n){let t=n.findAll(".katex");for(let e of t){let i=e.find("annotation");i&&(i.setText(`$${i.textContent}$`),e.replaceWith(i))}}function Gy(n){var e;let t=(e=n.match(/^[^\.\?\!\n]*[\.\?\!]?/))==null?void 0:e[0];return t!=null?t:""}function td(n){var t;return!!/callout|bookmark/.test((t=n.getAttribute("class"))!=null?t:"")}function Vy(n){for(let t of n.findAll("figure.callout")){let i=`> [!important] > ${t.children[1].textContent} `;t.nextElementSibling&&td(t.nextElementSibling)&&(i+=` `),t.replaceWith(i)}}function Ky(n){var t,e,i;for(let r of n.findAll("a.bookmark.source")){let o=r.getAttribute("href"),a=(t=r.find("div.bookmark-title"))==null?void 0:t.textContent,s=Gy((i=(e=r.find("div.bookmark-description"))==null?void 0:e.textContent)!=null?i:""),l=`> [!info] ${a} @@ -209,21 +209,23 @@ tags: {tags-yaml-list} `;r.nextElementSibling&&td(r.nextElementSibling)&&(l+=` `),r.replaceWith(l)}}function Xy(n){var t,e,i;for(let r of n.findAll("span[class=user]"))r.innerText=(t=r.textContent)!=null?t:"";for(let r of n.findAll("td div[class*=checkbox]")){let o=createSpan();o.setText(r.hasClass("checkbox-on")?"X":""),r.replaceWith(o)}for(let r of n.findAll("table span[class*=selected-value]"))((e=r.parentElement)==null?void 0:e.lastElementChild)!==r&&r.setText(r.textContent+", ");for(let r of n.findAll("a[href]"))if(!/^(https?:\/\/|www\.)/.test(r.href)){let o=createSpan();o.setText((i=r.textContent)!=null?i:""),r.replaceWith(o)}}function Gf(n,t){for(let e of n.findAll(t)){if(!e.parentElement||e.parentElement.tagName===t.toUpperCase())continue;let i=e.find(t);for(;i;)Ja(i),i=e.find(t)}}function Vf(n,t){let e=n.match(new RegExp(`<${t}>(.| )*`));if(e)for(let i of e.filter(r=>r.contains("
    ")))n=n.replace(i,i.split("
    ").join(`
    <${i}>`))}function Jy(n){var e;let t=n.findAll("a[href*=\\#]");for(let i of t)(e=i.getAttribute("href"))!=null&&e.startsWith("#")&&i.setAttribute("href","#"+i.textContent)}function Qy(n){n.innerHTML=n.innerHTML.replace(/\n/g,"
    ");for(let t of n.findAll("code"))for(let e of t.findAll("br"))e.replaceWith(` -`)}function e1(n){var t;for(let e of n.findAll("link"))e.innerText=(t=e.textContent)!=null?t:""}function nd(n){var t,e;for(let i of n.findAll("time"))i.textContent=(e=(t=i.textContent)==null?void 0:t.replace(/@/g,""))!=null?e:""}var Kf={"1.875em":"h1","1.5em":"h2","1.25em":"h3"};function t1(n){var e;let t=n.findAll("summary");for(let i of t){let r=i.getAttribute("style");if(r){for(let o of Object.keys(Kf))if(r.includes(o)){i.replaceWith(createEl(Kf[o],{text:(e=i.textContent)!=null?e:""}));break}}}}function Xf(n,t){let e=n.findAll(t);for(let i of e)Ja(i)}function Jf(n,t){for(let e of n.findAll(t)){let i=[],r=[],o=e;for(;o.tagName===t.toUpperCase();){i.push(o);for(let s=0;ss.remove())}}function n1(n){for(let t of n.findAll(".checkbox.checkbox-on"))t.replaceWith("[x] ");for(let t of n.findAll(".checkbox.checkbox-off"))t.replaceWith("[ ] ")}function i1(n){var e;let t=n.findAll("a");if(t.length===0)return n;for(let i of t){let r=createSpan();r.setText((e=i.getAttribute("href"))!=null?e:""),i.replaceWith(r)}}function Qf(n,t,e){var i;for(let r of t){let o=createSpan(),a;switch(r.type){case"relation":let s=n.idsToFileInfo[r.id];if(s){let c=r.a.closest("table");a=`[[${s.fullLinkPathNeeded?`${n.getPathForFile(s)}${s.title}${c?"\\":""}|${s.title}`:s.title}]]`}else{console.warn("missing relation data for id: "+r.id);let{basename:c}=oe(decodeURI((i=r.a.getAttribute("href"))!=null?i:""));a=`[[${qf(c)}]]`}break;case"attachment":let l=n.pathsToAttachmentInfo[r.path];if(!l){console.warn("missing attachment data for: "+r.path);continue}a=`${e?"!":""}[[${l.fullLinkPathNeeded?l.targetParentFolder+l.nameWithExtension+"|"+l.nameWithExtension:l.nameWithExtension}]]`;break}o.setText(a),r.a.replaceWith(o)}}var Lr=class{constructor(t,e){this.idsToFileInfo={};this.pathsToAttachmentInfo={};this.attachmentPath=t,this.singleLineBreaks=e}getPathForFile(t){let{idsToFileInfo:e}=this,i=t.path.split("/");return t.parentIds.map(r=>{var o,a,s;return(s=(o=e[r])==null?void 0:o.title)!=null?s:(a=i.find(l=>l.contains(r)))==null?void 0:a.replace(` ${r}`,"")}).filter(r=>r).map(r=>r.replace(/[\. ]+$/,"")).join("/")+"/"}};async function rd(n,t){var i,r;let{filepath:e}=t;if(t.extension==="html"){let o=await t.readText(),a=ft(o),l=a.find("body").children,c;for(let v=0;ve.setValue(this.parentsInSubfolders).onChange(i=>this.parentsInSubfolders=i)),new xt.Setting(this.modal.contentEl).setName("Single line breaks").setDesc("Separate Notion blocks with only one line break (default is 2).").addToggle(e=>e.setValue(this.singleLineBreaks).onChange(i=>{this.singleLineBreaks=i}))}async import(e){var E;let{vault:i,parentsInSubfolders:r,files:o}=this;if(o.length===0){new xt.Notice("Please pick at least one file to import.");return}let a=await this.getOutputFolder();if(!a){new xt.Notice("Please select a location to export to.");return}let s=a.path;s=(0,xt.normalizePath)(s),s!=null&&s.endsWith("/")||(s+="/");let l=new Lr((E=i.getConfig("attachmentFolderPath"))!=null?E:"",this.singleLineBreaks);e.status("Looking for files to import");let c=0;if(await Qa(e,o,async v=>{try{await rd(l,v),c=Object.keys(l.idsToFileInfo).length+Object.keys(l.pathsToAttachmentInfo).length,e.reportProgress(0,c)}catch(d){e.reportSkipped(v.fullpath)}}),e.isCancelled())return;e.status("Resolving links and de-duplicating files"),Hf({vault:i,info:l,targetFolderPath:s,parentsInSubfolders:r});let p=new Set([s]),m=Object.values(l.idsToFileInfo).map(v=>s+l.getPathForFile(v)).concat(Object.values(l.pathsToAttachmentInfo).map(v=>v.targetParentFolder));for(let v of m)p.add(v);for(let v of p){if(e.isCancelled())return;await this.createFolders(v)}let y=0;e.status("Starting import"),await Qa(e,o,async v=>{y++,e.reportProgress(y,c);try{if(v.extension==="html"){let d=bt(v.name);if(!d)throw new Error("ids not found for "+v.filepath);let f=l.idsToFileInfo[d];if(!f)throw new Error("file info not found for "+v.filepath);e.status(`Importing note ${f.title}`);let g=await ed(l,v),w={};f.ctime&&(w.ctime=f.ctime.getTime(),w.mtime=f.ctime.getTime()),f.mtime&&(w.mtime=f.mtime.getTime());let T=`${s}${l.getPathForFile(f)}${f.title}.md`;await i.create(T,g,w),e.reportNoteSuccess(v.fullpath)}else{let d=l.pathsToAttachmentInfo[v.filepath];if(!d)throw new Error("attachment info not found for "+v.filepath);e.status(`Importing attachment ${v.name}`);let f=await v.read();await i.createBinary(`${d.targetParentFolder}${d.nameWithExtension}`,f),e.reportAttachmentSuccess(v.fullpath)}}catch(d){if(d.message==="page body was not found"){e.reportSkipped(v.fullpath,"page body was not found");return}e.reportFailed(v.fullpath,d)}})}};async function Qa(n,t,e){for(let i of t){if(n.isCancelled())return;try{await gt(i,async(r,o)=>{for(let a of o){if(n.isCancelled())return;if(a.extension==="md"&&bt(a.name))throw new xt.Notice("Notion Markdown export detected. Please export Notion data to HTML instead."),n.cancel(),new Error("Notion importer uses only HTML exports. Please use the correct format.");if(!(a.extension==="csv"&&bt(a.name))&&a.name!=="index.html")if(a.extension==="zip"&&a.parent==="")try{await Qa(n,[a],e)}catch(s){n.reportFailed(a.fullpath)}else await e(a)}})}catch(r){n.reportFailed(i.fullpath)}}}var Ee=require("obsidian");var od="66553851-08fa-44f2-8bb1-1436f121a73d",ad=["user.read","notes.read"],a1=/<(object|iframe)([^>]*)\/>/g,sd=/(<\/p>)\s*(]*>)|\n \n/g,s1=5,Mr=class extends ce{constructor(){super(...arguments);this.useDefaultAttachmentFolder=!0;this.importIncompatibleAttachments=!1;this.selectedIds=[];this.notebooks=[];this.graphData={state:xn(32),accessToken:""}}init(){this.addOutputLocationSetting("OneNote"),new Ee.Setting(this.modal.contentEl).setName("Use the default attachment folder").setDesc("If disabled, attachments will be stored in the export folder in the OneNote Attachments folder.").addToggle(e=>e.setValue(!0).onChange(i=>this.useDefaultAttachmentFolder=i)),new Ee.Setting(this.modal.contentEl).setName("Import incompatible attachments").setDesc("Imports incompatible attachments which cannot be embedded in Obsidian, such as .exe files.").addToggle(e=>e.setValue(!1).onChange(i=>this.importIncompatibleAttachments=i)),this.microsoftAccountSetting=new Ee.Setting(this.modal.contentEl).setName("Sign in with your Microsoft account").setDesc("You need to sign in to import your OneNote data.").addButton(e=>e.setCta().setButtonText("Sign in").onClick(()=>{this.registerAuthCallback(this.authenticateUser.bind(this));let i=new URLSearchParams({client_id:od,scope:ad.join(" "),response_type:"code",redirect_uri:$r,response_mode:"query",state:this.graphData.state});window.open(`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?${i.toString()}`)})),this.contentArea=this.modal.contentEl.createEl("div")}async authenticateUser(e){try{if(e.state!==this.graphData.state)throw new Error(`An incorrect state was returned. +`)}function e1(n){var t;for(let e of n.findAll("link"))e.innerText=(t=e.textContent)!=null?t:""}function nd(n){var t,e;for(let i of n.findAll("time"))i.textContent=(e=(t=i.textContent)==null?void 0:t.replace(/@/g,""))!=null?e:""}var Kf={"1.875em":"h1","1.5em":"h2","1.25em":"h3"};function t1(n){var e;let t=n.findAll("summary");for(let i of t){let r=i.getAttribute("style");if(r){for(let o of Object.keys(Kf))if(r.includes(o)){i.replaceWith(createEl(Kf[o],{text:(e=i.textContent)!=null?e:""}));break}}}}function Xf(n,t){let e=n.findAll(t);for(let i of e)Ja(i)}function Jf(n,t){for(let e of n.findAll(t)){let i=[],r=[],o=e;for(;o.tagName===t.toUpperCase();){i.push(o);for(let s=0;ss.remove())}}function n1(n){for(let t of n.findAll(".checkbox.checkbox-on"))t.replaceWith("[x] ");for(let t of n.findAll(".checkbox.checkbox-off"))t.replaceWith("[ ] ")}function i1(n){var e;let t=n.findAll("a");if(t.length===0)return n;for(let i of t){let r=createSpan();r.setText((e=i.getAttribute("href"))!=null?e:""),i.replaceWith(r)}}function Qf(n,t,e){var i;for(let r of t){let o=createSpan(),a;switch(r.type){case"relation":let s=n.idsToFileInfo[r.id];if(s){let c=r.a.closest("table");a=`[[${s.fullLinkPathNeeded?`${n.getPathForFile(s)}${s.title}${c?"\\":""}|${s.title}`:s.title}]]`}else{console.warn("missing relation data for id: "+r.id);let{basename:c}=re(decodeURI((i=r.a.getAttribute("href"))!=null?i:""));a=`[[${qf(c)}]]`}break;case"attachment":let l=n.pathsToAttachmentInfo[r.path];if(!l){console.warn("missing attachment data for: "+r.path);continue}a=`${e?"!":""}[[${l.fullLinkPathNeeded?l.targetParentFolder+l.nameWithExtension+"|"+l.nameWithExtension:l.nameWithExtension}]]`;break}o.setText(a),r.a.replaceWith(o)}}var Lr=class{constructor(t,e){this.idsToFileInfo={};this.pathsToAttachmentInfo={};this.attachmentPath=t,this.singleLineBreaks=e}getPathForFile(t){let{idsToFileInfo:e}=this,i=t.path.split("/");return t.parentIds.map(r=>{var o,a,s;return(s=(o=e[r])==null?void 0:o.title)!=null?s:(a=i.find(l=>l.contains(r)))==null?void 0:a.replace(` ${r}`,"")}).filter(r=>r).map(r=>r.replace(/[\. ]+$/,"")).join("/")+"/"}};async function rd(n,t){var i,r;let{filepath:e}=t;if(t.extension==="html"){let o=await t.readText(),a=ft(o),l=a.find("body").children,c;for(let v=0;ve.setValue(this.parentsInSubfolders).onChange(i=>this.parentsInSubfolders=i)),new xt.Setting(this.modal.contentEl).setName("Single line breaks").setDesc("Separate Notion blocks with only one line break (default is 2).").addToggle(e=>e.setValue(this.singleLineBreaks).onChange(i=>{this.singleLineBreaks=i}))}async import(e){var E;let{vault:i,parentsInSubfolders:r,files:o}=this;if(o.length===0){new xt.Notice("Please pick at least one file to import.");return}let a=await this.getOutputFolder();if(!a){new xt.Notice("Please select a location to export to.");return}let s=a.path;s=(0,xt.normalizePath)(s),s!=null&&s.endsWith("/")||(s+="/");let l=new Lr((E=i.getConfig("attachmentFolderPath"))!=null?E:"",this.singleLineBreaks);e.status("Looking for files to import");let c=0;if(await Qa(e,o,async v=>{try{await rd(l,v),c=Object.keys(l.idsToFileInfo).length+Object.keys(l.pathsToAttachmentInfo).length,e.reportProgress(0,c)}catch(d){e.reportSkipped(v.fullpath)}}),e.isCancelled())return;e.status("Resolving links and de-duplicating files"),Hf({vault:i,info:l,targetFolderPath:s,parentsInSubfolders:r});let p=new Set([s]),m=Object.values(l.idsToFileInfo).map(v=>s+l.getPathForFile(v)).concat(Object.values(l.pathsToAttachmentInfo).map(v=>v.targetParentFolder));for(let v of m)p.add(v);for(let v of p){if(e.isCancelled())return;await this.createFolders(v)}let y=0;e.status("Starting import"),await Qa(e,o,async v=>{y++,e.reportProgress(y,c);try{if(v.extension==="html"){let d=bt(v.name);if(!d)throw new Error("ids not found for "+v.filepath);let f=l.idsToFileInfo[d];if(!f)throw new Error("file info not found for "+v.filepath);e.status(`Importing note ${f.title}`);let g=await ed(l,v),w={};f.ctime&&(w.ctime=f.ctime.getTime(),w.mtime=f.ctime.getTime()),f.mtime&&(w.mtime=f.mtime.getTime());let _=`${s}${l.getPathForFile(f)}${f.title}.md`;await i.create(_,g,w),e.reportNoteSuccess(v.fullpath)}else{let d=l.pathsToAttachmentInfo[v.filepath];if(!d)throw new Error("attachment info not found for "+v.filepath);e.status(`Importing attachment ${v.name}`);let f=await v.read();await i.createBinary(`${d.targetParentFolder}${d.nameWithExtension}`,f),e.reportAttachmentSuccess(v.fullpath)}}catch(d){if(d.message==="page body was not found"){e.reportSkipped(v.fullpath,"page body was not found");return}e.reportFailed(v.fullpath,d)}})}};async function Qa(n,t,e){for(let i of t){if(n.isCancelled())return;try{await gt(i,async(r,o)=>{for(let a of o){if(n.isCancelled())return;if(a.extension==="md"&&bt(a.name))throw new xt.Notice("Notion Markdown export detected. Please export Notion data to HTML instead."),n.cancel(),new Error("Notion importer uses only HTML exports. Please use the correct format.");if(!(a.extension==="csv"&&bt(a.name))&&a.name!=="index.html")if(a.extension==="zip"&&a.parent==="")try{await Qa(n,[a],e)}catch(s){n.reportFailed(a.fullpath)}else await e(a)}})}catch(r){n.reportFailed(i.fullpath)}}}var ke=require("obsidian");var od="66553851-08fa-44f2-8bb1-1436f121a73d",ad=["user.read","notes.read"],a1=/<(object|iframe)([^>]*)\/>/g,sd=/(<\/p>)\s*(]*>)|\n \n/g,s1=5,Mr=class extends ce{constructor(){super(...arguments);this.importIncompatibleAttachments=!1;this.selectedIds=[];this.notebooks=[];this.graphData={state:xn(32),accessToken:""};this.attachmentDownloadPauseCounter=0}init(){this.addOutputLocationSetting("OneNote"),new ke.Setting(this.modal.contentEl).setName("Import incompatible attachments").setDesc("Imports incompatible attachments which cannot be embedded in Obsidian, such as .exe files.").addToggle(e=>e.setValue(!1).onChange(i=>this.importIncompatibleAttachments=i)),this.microsoftAccountSetting=new ke.Setting(this.modal.contentEl).setName("Sign in with your Microsoft account").setDesc("You need to sign in to import your OneNote data.").addButton(e=>e.setCta().setButtonText("Sign in").onClick(()=>{this.registerAuthCallback(this.authenticateUser.bind(this));let i=new URLSearchParams({client_id:od,scope:ad.join(" "),response_type:"code",redirect_uri:$r,response_mode:"query",state:this.graphData.state});window.open(`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?${i.toString()}`)})),this.contentArea=this.modal.contentEl.createEl("div")}async authenticateUser(e){try{if(e.state!==this.graphData.state)throw new Error(`An incorrect state was returned. Expected state: ${this.graphData.state} -Returned state: ${e.state}`);let i=new URLSearchParams({client_id:od,scope:ad.join(" "),code:e.code,redirect_uri:$r,grant_type:"authorization_code"}),r=await(0,Ee.requestUrl)({method:"POST",url:"https://login.microsoftonline.com/common/oauth2/v2.0/token",contentType:"application/x-www-form-urlencoded",body:i.toString()}).json;if(!r.access_token)throw new Error(`Unexpected data was returned instead of an access token. Error details: ${r}`);this.graphData.accessToken=r.access_token,this.selectedIds=[];let o=await this.fetchResource("https://graph.microsoft.com/v1.0/me","json");this.microsoftAccountSetting.setDesc(`Signed in as ${o.displayName} (${o.mail}). If that's not the correct account, sign in again.`),await this.showSectionPickerUI()}catch(i){console.error("An error occurred while we were trying to sign you in. Error details: ",i),this.modal.contentEl.createEl("div",{text:"An error occurred while trying to sign you in."}).createEl("details",{text:i}).createEl("summary",{text:"Click here to show error details"})}}async showSectionPickerUI(){var o,a;let e="https://graph.microsoft.com/v1.0/me/onenote/notebooks",i=new URLSearchParams({$expand:"sections($select=id,displayName),sectionGroups($expand=sections,sectionGroups)",$select:"id,displayName,lastModifiedDateTime",$orderby:"lastModifiedDateTime DESC"}),r=`${e}?${i.toString()}`;this.notebooks=(await this.fetchResource(r,"json")).value,this.contentArea.empty(),this.contentArea.createEl("h4",{text:"Choose data to import"});for(let s of this.notebooks){if(((o=s.sectionGroups)==null?void 0:o.length)!==0)for(let c of s.sectionGroups)await this.fetchNestedSectionGroups(c);let l=this.contentArea.createDiv();new Ee.Setting(l).setName(s.displayName).setDesc(`Last edited on: ${Ee.moment.utc(s.lastModifiedDateTime).format("Do MMMM YYYY")}. Contains ${(a=s.sections)==null?void 0:a.length} sections.`).addButton(c=>c.setCta().setButtonText("Select all").onClick(()=>{l.querySelectorAll('input[type="checkbox"]:not(:checked)').forEach(p=>p.click())})),this.renderHierarchy(s,l)}}async fetchNestedSectionGroups(e){if(e.sectionGroups=(await this.fetchResource(e.sectionGroupsUrl+"?$expand=sectionGroups($expand=sections),sections","json")).value,e.sectionGroups)for(let i=0;i{if(l.checked)this.selectedIds.push(o.id);else{let c=this.selectedIds.findIndex(p=>p===o.id);c!==-1&&this.selectedIds.splice(c,1)}})}}}async import(e){if(this.outputFolder=await this.getOutputFolder(),!this.outputFolder){new Ee.Notice("Please select a location to export to.");return}if(!this.graphData.accessToken){new Ee.Notice("Please sign in to your Microsoft Account.");return}e.status("Starting OneNote import");let i=0,r=0;for(let o of this.selectedIds){e.reportProgress(r,i);let a=`https://graph.microsoft.com/v1.0/me/onenote/sections/${o}/pages`,s=new URLSearchParams({$select:"id,title,createdDateTime,lastModifiedDateTime,level,order,contentUrl",$orderby:"order",pagelevel:"true"}),l=`${a}?${s.toString()}`,c=(await this.fetchResource(l,"json")).value;i+=c.length,this.insertPagesToSection(c,o),e.reportProgress(r,i);for(let p=0;psetTimeout(y,7500)),this.processFile(e,await this.fetchResource(`https://graph.microsoft.com/v1.0/me/onenote/pages/${m.id}/content?includeInkML=true`,"text"),m),r++,e.reportProgress(r,i)}catch(y){e.reportFailed(m.title,y.toString())}}}}insertPagesToSection(e,i,r){if(!r){for(let o of this.notebooks)this.insertPagesToSection(e,i,o);return}if(r.sectionGroups){let o=r.sectionGroups;for(let a of o)this.insertPagesToSection(e,i,a)}if(r.sections){let o=r;for(let a of o.sections)a.id===i&&(a.pages=e)}}async processFile(e,i,r){try{let o=this.convertFormat(i),a=this.getEntityPathNoParent(r.id,this.outputFolder.name),s;await this.vault.adapter.exists(a)?s=this.vault.getAbstractFileByPath(a):s=await this.vault.createFolder(a);let l=this.convertTags(ft(o.html)),c=this.getAllAttachments(l.replace(sd,"
    ")),p=this.styledElementToHTML(c.html);p=this.convertInternalLinks(p),p=this.convertDrawings(p);let m=(0,Ee.htmlToMarkdown)(p).trim().replace(sd," "),y=await this.saveAsMarkdownFile(s,r.title,m);await this.fetchAttachmentQueue(e,y,this.outputFolder,c.queue);let E={ctime:r!=null&&r.lastModifiedDateTime?Date.parse(r.lastModifiedDateTime.toString()):r!=null&&r.createdDateTime?Date.parse(r.createdDateTime.toString()):Date.now(),mtime:r!=null&&r.lastModifiedDateTime?Date.parse(r.lastModifiedDateTime.toString()):r!=null&&r.createdDateTime?Date.parse(r.createdDateTime.toString()):Date.now()};await this.vault.append(y,"",E),e.reportNoteSuccess(r.title)}catch(o){e.reportFailed(r.title,o)}}convertFormat(e){let i={html:"",inkml:""},r=e.split(` +Returned state: ${e.state}`);let i=new URLSearchParams({client_id:od,scope:ad.join(" "),code:e.code,redirect_uri:$r,grant_type:"authorization_code"}),r=await(0,ke.requestUrl)({method:"POST",url:"https://login.microsoftonline.com/common/oauth2/v2.0/token",contentType:"application/x-www-form-urlencoded",body:i.toString()}).json;if(!r.access_token)throw new Error(`Unexpected data was returned instead of an access token. Error details: ${r}`);this.graphData.accessToken=r.access_token,this.selectedIds=[];let o=await this.fetchResource("https://graph.microsoft.com/v1.0/me","json");this.microsoftAccountSetting.setDesc(`Signed in as ${o.displayName} (${o.mail}). If that's not the correct account, sign in again.`),await this.showSectionPickerUI()}catch(i){console.error("An error occurred while we were trying to sign you in. Error details: ",i),this.modal.contentEl.createEl("div",{text:"An error occurred while trying to sign you in."}).createEl("details",{text:i}).createEl("summary",{text:"Click here to show error details"})}}async showSectionPickerUI(){var o,a;let e="https://graph.microsoft.com/v1.0/me/onenote/notebooks",i=new URLSearchParams({$expand:"sections($select=id,displayName),sectionGroups($expand=sections,sectionGroups)",$select:"id,displayName,lastModifiedDateTime",$orderby:"lastModifiedDateTime DESC"}),r=`${e}?${i.toString()}`;this.notebooks=(await this.fetchResource(r,"json")).value,this.contentArea.empty(),this.contentArea.createEl("h4",{text:"Choose data to import"});for(let s of this.notebooks){if(((o=s.sectionGroups)==null?void 0:o.length)!==0)for(let c of s.sectionGroups)await this.fetchNestedSectionGroups(c);let l=this.contentArea.createDiv();new ke.Setting(l).setName(s.displayName).setDesc(`Last edited on: ${ke.moment.utc(s.lastModifiedDateTime).format("Do MMMM YYYY")}. Contains ${(a=s.sections)==null?void 0:a.length} sections.`).addButton(c=>c.setCta().setButtonText("Select all").onClick(()=>{l.querySelectorAll('input[type="checkbox"]:not(:checked)').forEach(p=>p.click())})),this.renderHierarchy(s,l)}}async fetchNestedSectionGroups(e){if(e.sectionGroups=(await this.fetchResource(e.sectionGroupsUrl+"?$expand=sectionGroups($expand=sections),sections","json")).value,e.sectionGroups)for(let i=0;i{if(l.checked)this.selectedIds.push(o.id);else{let c=this.selectedIds.findIndex(p=>p===o.id);c!==-1&&this.selectedIds.splice(c,1)}})}}}async import(e){if(!await this.getOutputFolder()){new ke.Notice("Please select a location to export to.");return}if(!this.graphData.accessToken){new ke.Notice("Please sign in to your Microsoft Account.");return}e.status("Starting OneNote import");let r=0,o=0;for(let a of this.selectedIds){e.reportProgress(o,r);let s=`https://graph.microsoft.com/v1.0/me/onenote/sections/${a}/pages`,l=new URLSearchParams({$select:"id,title,createdDateTime,lastModifiedDateTime,level,order,contentUrl",$orderby:"order",pagelevel:"true"}),c=`${s}?${l.toString()}`,p=(await this.fetchResource(c,"json")).value;r+=p.length,this.insertPagesToSection(p,a),e.reportProgress(o,r);for(let m=0;msetTimeout(E,7500)),await this.processFile(e,await this.fetchResource(`https://graph.microsoft.com/v1.0/me/onenote/pages/${y.id}/content?includeInkML=true`,"text"),y),o++,e.reportProgress(o,r)}catch(E){e.reportFailed(y.title,E.toString())}}}}insertPagesToSection(e,i,r){if(!r){for(let o of this.notebooks)this.insertPagesToSection(e,i,o);return}if(r.sectionGroups){let o=r.sectionGroups;for(let a of o)this.insertPagesToSection(e,i,a)}if(r.sections){let o=r;for(let a of o.sections)a.id===i&&(a.pages=e)}}async processFile(e,i,r){var o,a;try{let s=this.convertFormat(i),l=await this.getOutputFolder(),c=this.getEntityPathNoParent(r.id,l.name),p;await this.vault.adapter.exists(c)?p=this.vault.getAbstractFileByPath(c):p=await this.vault.createFolder(c);let m=this.convertTags(ft(s.html)),y=await this.getAllAttachments(e,m.replace(sd,"
    ")),E=this.styledElementToHTML(y);E=this.convertInternalLinks(E),E=this.convertDrawings(E);let v=(0,ke.htmlToMarkdown)(E).trim().replace(sd," "),d=await this.saveAsMarkdownFile(p,r.title,v),f=r!=null&&r.lastModifiedDateTime?Date.parse(r.lastModifiedDateTime):null,g=r!=null&&r.createdDateTime?Date.parse(r.createdDateTime):null,w={ctime:(o=g!=null?g:f)!=null?o:Date.now(),mtime:(a=f!=null?f:g)!=null?a:Date.now()};await this.vault.append(d,"",w),e.reportNoteSuccess(r.title)}catch(s){e.reportFailed(r.title,s)}}convertFormat(e){let i={html:"",inkml:""},r=e.split(` `,1)[0];e.slice(0,-2);let o=e.split(r);if(o.shift(),o.length===2)for(let a of o){let l=a.split(` `).find(p=>p.includes("Content-Type")).split(";")[0].split(":")[1].trim(),c=a.split(` `).slice(2).join(` -`).trim();l==="text/html"?i.html=c:l==="application/inkml+xml"&&(i.inkml=c)}else throw new Error("The input string is incorrect and may be missing data. Inputted string: "+e);return i}convertTags(e){var r,o;let i=Array.from(e.querySelectorAll("[data-tag]"));for(let a of i)if((r=a.getAttribute("data-tag"))!=null&&r.contains("to-do")){let l=a.getAttribute("data-tag")==="to-do:completed"?"[x]":"[ ]";a.innerHTML=`- ${l} ${a.innerHTML}`}else{let s=(o=a.getAttribute("data-tag"))==null?void 0:o.split(",");s==null||s.forEach(l=>{a.innerHTML=a.innerHTML+` #${l.replace(":","-")} `})}return e.outerHTML}convertInternalLinks(e){let i=e.findAll("a");for(let r of i)if(r.href.startsWith("onenote:")){let o=r.href.indexOf("#")+1,a=r.href.indexOf("&",o);r.href=r.href.slice(o,a)}return e}getEntityPathNoParent(e,i){for(let r of this.notebooks){let o=this.getEntityPath(e,`${i}/${r.displayName}`,r);if(o)return o}return null}getEntityPath(e,i,r){let o=null;if("sectionGroups"in r&&r.sectionGroups){let a=this.searchSectionGroups(e,i,r.sectionGroups);a!==null&&(o=a)}if("sections"in r&&r.sections){let a=this.searchSectionGroups(e,i,r.sections);a!==null&&(o=a)}if("pages"in r&&r.pages){let a=this.searchPages(e,i,r);a!==null&&(o=a)}return o}searchPages(e,i,r){var a;let o=null;for(let s=0;s=0;p--)if(r.pages[p].level===l.level-1){o+="/"+r.pages[p].title;break}}break}}return o}searchSectionGroups(e,i,r){let o=null;for(let a of r)if(a.id===e)o=`${i}/${a.displayName}`;else{let s=this.getEntityPath(e,`${i}/${a.displayName}`,a);if(s){o=s;break}}return o}getAllAttachments(e){var l,c,p;let i=ft(e.replace(a1,"<$1$2>")),r=i.findAll("object"),o=i.findAll("img"),a=i.findAll("iframe"),s=[];for(let m of r){let y=m.getAttribute("data-attachment").split("."),E=y[y.length-1];if(!(!Fn.contains(E)&&!this.importIncompatibleAttachments)){s.push({name:m.getAttribute("data-attachment"),contentLocation:m.getAttribute("data")});let v=document.createElement("p");v.innerText=`![[${m.getAttribute("data-attachment")}]]`,(l=m.parentNode)==null||l.replaceChild(v,m)}}for(let m=0;m=1){let a=r.path+"/OneNote Attachments";this.useDefaultAttachmentFolder&&(a=await this.app.vault.getAvailablePathForAttachments(i.basename,i.extension,i));try{this.vault.createFolder(a)}catch(s){}for(let s=0;ssetTimeout(c,7500)),await this.vault.adapter.exists(`${a}/${l.name}`))e.reportSkipped(l.name);else{let c=await this.fetchResource(l.contentLocation,"file");await this.app.vault.createBinary(a+"/"+l.name,c)}}catch(c){e.reportFailed(l.name,c)}}}}styledElementToHTML(e){let i={"font-weight:bold":"b","font-style:italic":"i","text-decoration:underline":"u","text-decoration:line-through":"s","background-color":"mark"};e.findAll("cite").forEach(l=>l.innerHTML="> "+l.innerHTML+"
    ");let o=!1,a=document.createElement("pre");return e.querySelectorAll("*").forEach(l=>{let c=l.getAttribute("style")||"",p=Object.keys(i).find(m=>c.includes(m));if(c!=null&&c.contains("font-family:Consolas"))o?a.innerHTML=a.innerHTML.slice(0,-3)+l.innerHTML+"\n```":(o=!0,l.replaceWith(a),a.innerHTML="```\n"+l.innerHTML+"\n```");else if(l.nodeName==="BR"&&o)a.innerHTML=a.innerHTML.slice(0,-3)+"\n```";else if(p){let m=i[p],y=document.createElement(m);y.innerHTML=l.innerHTML,l.replaceWith(y)}}),e}convertDrawings(e){var o;let i=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),r=!1;for(;i.nextNode();)((o=i.currentNode.nodeValue)==null?void 0:o.trim())==="InkNode is not supported"&&(r=!0);if(r){let a=document.createTextNode("> [!caution] This page contained a drawing which was not converted.");e.insertBefore(a,e.firstChild)}else for(let a=0;asetTimeout(c,l)),this.fetchResource(e,i,r+1);throw new Error("Exceeded maximum retry attempts")}}return a}catch(o){throw console.error(`An internal error occurred while trying to fetch '${e}'. Error details: `,o),o}}};var Ut=require("obsidian");var ld=require("obsidian"),l1=/[\?<>\\:\*\|"]/g,c1=/[\x00-\x1f\x80-\x9f]/g,p1=/^\.+$/,u1=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,f1=/[\. ]+$/,d1=/^\./,m1=/\[/g,h1=/\]/g;function Br(n){return n.replace(l1,"").replace(c1,"").replace(p1,"").replace(u1,"").replace(f1,"").replace(m1,"").replace(h1,"").replace(d1,"")}function Ur(n,t){let e="MMMM Do, YYYY",i=(0,ld.moment)(n,e);return i.format(e)!==n?n:i.isValid()?i.format(t):n}var jr=require("obsidian"),g1=["POMO","word-count","date","slider","encrypt","TaoOfRoam","orphans","count","character-count","comment-button","query","streak","attr-table","mentions","search","roam/render","calc"],y1=new RegExp(`\\{\\{(\\[\\[)?(${g1.join("|")})(\\]\\])?.*?\\}\\}(\\})?`,"g"),b1=/{{pdf:|{{\[\[pdf|{{\[\[audio|{{audio:|{{video:|{{\[\[video/,cd=/https:\/\/firebasestorage(.*?)\?alt(.*?)\)/,x1=/https:\/\/firebasestorage(.*?)\?alt(.*?)/,w1=/(?<=\(\()\b(.*?)\b(?=\)\))/g,Hr=class extends ce{constructor(){super(...arguments);this.downloadAttachments=!1;this.fileDateYAML=!1;this.titleYAML=!1;this.newestTimestamp=0;this.oldestTimestamp=0}init(){this.addFileChooserSetting("Roam (.json)",["json"]),this.addOutputLocationSetting("Roam"),this.userDNPFormat=this.getUserDNPFormat(),new Ut.Setting(this.modal.contentEl).setName("Import settings").setHeading(),new Ut.Setting(this.modal.contentEl).setName("Download all attachments").setDesc("If enabled, all attachments uploaded to Roam will be downloaded to your attachments folder.").addToggle(e=>{e.setValue(this.downloadAttachments),e.onChange(async i=>{this.downloadAttachments=i})}),new Ut.Setting(this.modal.contentEl).setName("Add YAML created/update date").setDesc("If enabled, notes will have the create-time and edit-time from Roam added as properties.").addToggle(e=>{e.setValue(this.fileDateYAML),e.onChange(async i=>{this.fileDateYAML=i})}),new Ut.Setting(this.modal.contentEl).setName("Add YAML title").setDesc("If enabled, notes will have the full title added as a property (regardless of illegal file name characters).").addToggle(e=>{e.setValue(this.titleYAML),e.onChange(async i=>{this.titleYAML=i})})}async import(e){this.progress=e;let{files:i}=this;if(i.length===0){new Ut.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new Ut.Notice("Please select a location to export to.");return}for(let o of i){if(e.isCancelled())return;let a=Ze(o.basename),s=`${r.path}/${a}`,l=`${r.path}/${a}/Attachments`;await this.createFolders(s),await this.createFolders(l);let c=await o.readText(),p=JSON.parse(c),[m,y]=this.preprocess(p),E=new Map;for(let g in p){let w=p[g],T=Ur(Br(w.title),this.userDNPFormat).trim();if(T===""){e.reportFailed(w.uid,"Title is empty"),console.error("Cannot import data with an empty title",w);continue}let A=`${s}/${T}.md`,D=this.titleYAML?w.title:"",_=0,S=0;if(this.fileDateYAML){let C=w["create-time"],O=w["edit-time"];typeof C=="number"&&(_=C),typeof O=="number"&&(S=O)}let x=await this.jsonToMarkdown(s,l,w,"",!1,D,_,S);E.set(A,x)}for(let g of y.values()){let w=await this.roamMarkupScrubber(s,l,g.blockString,!0),T=await this.extractAndProcessBlockReferences(E,m,s,w),A=`${s}/${g.pageName}.md`,D=E.get(A);if(D){let _=D.split(` -`),S=_.findIndex(x=>x.contains("* "+w));S!==-1&&(_[S]=_[S].replace(w,T)),E.set(A,_.join(` -`))}}let{vault:v}=this,d=E.size,f=1;for(let[g,w]of E.entries()){if(e.isCancelled())return;try{let{parent:T}=oe(g);await this.createFolders(T);let A=v.getAbstractFileByPath(g);A?await v.modify(A,w):await v.create(g,w),e.reportNoteSuccess(g),e.reportProgress(f,d)}catch(T){console.error("Error saving Markdown to file:",g,T),e.reportFailed(g)}f++}}}getUserDNPFormat(){let e=this.app.internalPlugins.getPluginById("daily-notes").instance;return e?e.options.format||"YYYY-MM-DD":(console.log('Daily note plugin is not enabled. Roam import defaulting to "YYYY-MM-DD" format.'),"YYYY-MM-DD")}preprocess(e){let i=new Map,r=new Map,o=this.userDNPFormat;function a(s,l){if(l.uid){let c=new Date(s.uid);if(!isNaN(c.getTime())){let y=Ur(s.title,o);s.title=y}let p={pageName:Br(s.title),blockString:l.string};/.*?(\(\(.*?\)\)).*?/g.test(l.string)&&r.set(l.uid,p),i.set(l.uid,p)}if(l.children)for(let c of l.children)a(s,c)}for(let s of e)if(s.children)for(let l of s.children)a(s,l);return[i,r]}async roamMarkupScrubber(e,i,r,o=!1){return r=r.replace(y1,""),r.substring(0,8)==":hiccup "&&r.includes(":hr")?"---":(r=r.replace(/\[\[(.*?)\]\]/g,(a,s)=>`[[${Ur(Br(s),this.userDNPFormat)}]]`),r=r.replace(/\[\[(.*\/.*)\]\]/g,(a,s)=>`[[${e}/${s}|${s}]]`),r=r.replace(/\[.+?\]\((\(.+?\)\))\)/g,"$1"),r=r.replace(/\[(.+?)\]\(\[\[(.+?)\]\]\)/g,"[[$2|$1]]"),r=r.replace(/\[\[>\]\]/g,">"),r=r.replace(/{{TODO}}|{{\[\[TODO\]\]}}/g,"[ ]"),r=r.replace(/{{DONE}}|{{\[\[DONE\]\]}}/g,"[x]"),r=r.replace("::",":"),r=r.replace(/{{.*?\bvideo\b.*?(\bhttp.*?\byoutu.*?)}}/g,"![]($1)"),r=r.replace(/(https?:\/\/twitter\.com\/(?:#!\/)?\w+\/status\/\d+(?:\?[\w=&-]+)?)/g,"![]($1)"),r=r.replace(/\_\_(.+?)\_\_/g,"*$1*"),r=r.replace(/\^\^(.+?)\^\^/g,"==$1=="),r=r.replace(/{{\[{0,2}embed.*?(\(\(.*?\)\)).*?}}/g,"$1"),r=r.replace(/{{\[{0,2}embed.*?(\[\[.*?\]\]).*?}}/g,"$1"),this.downloadAttachments&&!o&&r.includes("firebasestorage")&&(r=await this.downloadFirebaseFile(r,i)),r)}async jsonToMarkdown(e,i,r,o="",a=!1,s,l,c){let p=[],m=[],y=r["edit-time"],E=r["create-time"];if(this.newestTimestampy?c:y,E!==void 0?l>10?this.oldestTimestamp=Math.min(l,E):this.oldestTimestamp=E:this.oldestTimestamp=l,"string"in r&&r.string){let v=r.heading?"#".repeat(r.heading)+" ":"",d=await this.roamMarkupScrubber(e,i,r.string);p.push(`${a?o+"* ":o}${v}${d}`)}if(r.children)for(let v of r.children)p.push(await this.jsonToMarkdown(e,i,v,o+" ",!0,"",this.oldestTimestamp,this.newestTimestamp));if((this.fileDateYAML||this.titleYAML)&&!a){let v=this.oldestTimestamp;if(m.push("---"),this.titleYAML&&m.push(`title: "${s}"`),this.fileDateYAML){let d="YYYY-MM-DD HH:mm:ss",f=this.newestTimestamp?(0,jr.moment)(this.newestTimestamp).format(d):(0,jr.moment)(new Date).format(d),g=v?(0,jr.moment)(v).format(d):f;m.push("created: "+g),m.push("updated: "+f)}m.push("---"),p.unshift(m.join(` +`).trim();l==="text/html"?i.html=c:l==="application/inkml+xml"&&(i.inkml=c)}else throw new Error("The input string is incorrect and may be missing data. Inputted string: "+e);return i}convertTags(e){var r,o;let i=Array.from(e.querySelectorAll("[data-tag]"));for(let a of i)if((r=a.getAttribute("data-tag"))!=null&&r.contains("to-do")){let l=a.getAttribute("data-tag")==="to-do:completed"?"[x]":"[ ]";a.innerHTML=`- ${l} ${a.innerHTML}`}else{let s=(o=a.getAttribute("data-tag"))==null?void 0:o.split(",");s==null||s.forEach(l=>{a.innerHTML=a.innerHTML+` #${l.replace(":","-")} `})}return e.outerHTML}convertInternalLinks(e){let i=e.findAll("a");for(let r of i)if(r.href.startsWith("onenote:")){let o=r.href.indexOf("#")+1,a=r.href.indexOf("&",o);r.href=r.href.slice(o,a)}return e}getEntityPathNoParent(e,i){for(let r of this.notebooks){let o=this.getEntityPath(e,`${i}/${r.displayName}`,r);if(o)return o}return null}getEntityPath(e,i,r){let o=null;if("sectionGroups"in r&&r.sectionGroups){let a=this.searchSectionGroups(e,i,r.sectionGroups);a!==null&&(o=a)}if("sections"in r&&r.sections){let a=this.searchSectionGroups(e,i,r.sections);a!==null&&(o=a)}if("pages"in r&&r.pages){let a=this.searchPages(e,i,r);a!==null&&(o=a)}return o}searchPages(e,i,r){var a;let o=null;for(let s=0;s=0;p--)if(r.pages[p].level===l.level-1){o+="/"+r.pages[p].title;break}}break}}return o}searchSectionGroups(e,i,r){let o=null;for(let a of r)if(a.id===e)o=`${i}/${a.displayName}`;else{let s=this.getEntityPath(e,`${i}/${a.displayName}`,a);if(s){o=s;break}}return o}async getAllAttachments(e,i){var l,c,p;let r=ft(i.replace(a1,"<$1$2>")),o=r.findAll("object"),a=r.findAll("img"),s=r.findAll("iframe");for(let m of o){let y=m.getAttribute("data-attachment").split("."),E=y[y.length-1];if(!(!Ln.contains(E)&&!this.importIncompatibleAttachments)){let v=m.getAttribute("data-attachment"),d=m.getAttribute("data"),f=await this.fetchAttachment(e,v,d),g=document.createElement("p");g.innerText=`![[${f}]]`,(l=m.parentNode)==null||l.replaceChild(g,m)}}for(let m=0;m{e.status("Pausing attachment download to avoid rate limiting."),this.attachmentDownloadPauseCounter=0,setTimeout(o,3e3)}),this.attachmentDownloadPauseCounter++,e.status("Downloading attachment "+i);try{let o=await this.getAvailablePathForAttachment(i,[]),a=await this.fetchResource(r,"file");return await this.app.vault.createBinary(o,a),e.reportAttachmentSuccess(i),o}catch(o){e.reportFailed(i),console.error(o)}}styledElementToHTML(e){let i={"font-weight:bold":"b","font-style:italic":"i","text-decoration:underline":"u","text-decoration:line-through":"s","background-color":"mark"};e.findAll("cite").forEach(l=>l.innerHTML="> "+l.innerHTML+"
    ");let o=!1,a=document.createElement("pre");return e.querySelectorAll("*").forEach(l=>{let c=l.getAttribute("style")||"",p=Object.keys(i).find(m=>c.includes(m));if(c!=null&&c.contains("font-family:Consolas"))o?a.innerHTML=a.innerHTML.slice(0,-3)+l.innerHTML+"\n```":(o=!0,l.replaceWith(a),a.innerHTML="```\n"+l.innerHTML+"\n```");else if(l.nodeName==="BR"&&o)a.innerHTML=a.innerHTML.slice(0,-3)+"\n```";else if(p){let m=i[p],y=document.createElement(m);y.innerHTML=l.innerHTML,l.replaceWith(y)}}),e}convertDrawings(e){var o;let i=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),r=!1;for(;i.nextNode();)((o=i.currentNode.nodeValue)==null?void 0:o.trim())==="InkNode is not supported"&&(r=!0);if(r){let a=document.createTextNode("> [!caution] This page contained a drawing which was not converted.");e.insertBefore(a,e.firstChild)}else for(let a=0;asetTimeout(c,l)),this.fetchResource(e,i,r+1);throw new Error("Exceeded maximum retry attempts")}}return a}catch(o){throw console.error(`An internal error occurred while trying to fetch '${e}'. Error details: `,o),o}}};var Ut=require("obsidian");var ld=require("obsidian"),l1=/[\?<>\\:\*\|"]/g,c1=/[\x00-\x1f\x80-\x9f]/g,p1=/^\.+$/,u1=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,f1=/[\. ]+$/,d1=/^\./,m1=/\[/g,h1=/\]/g;function Br(n){return n.replace(l1,"").replace(c1,"").replace(p1,"").replace(u1,"").replace(f1,"").replace(m1,"").replace(h1,"").replace(d1,"")}function Ur(n,t){let e="MMMM Do, YYYY",i=(0,ld.moment)(n,e);return i.format(e)!==n?n:i.isValid()?i.format(t):n}var jr=require("obsidian"),g1=["POMO","word-count","date","slider","encrypt","TaoOfRoam","orphans","count","character-count","comment-button","query","streak","attr-table","mentions","search","roam/render","calc"],y1=new RegExp(`\\{\\{(\\[\\[)?(${g1.join("|")})(\\]\\])?.*?\\}\\}(\\})?`,"g"),b1=/{{pdf:|{{\[\[pdf|{{\[\[audio|{{audio:|{{video:|{{\[\[video/,cd=/https:\/\/firebasestorage(.*?)\?alt(.*?)\)/,x1=/https:\/\/firebasestorage(.*?)\?alt(.*?)/,w1=/(?<=\(\()\b(.*?)\b(?=\)\))/g,Hr=class extends ce{constructor(){super(...arguments);this.downloadAttachments=!1;this.fileDateYAML=!1;this.titleYAML=!1;this.newestTimestamp=0;this.oldestTimestamp=0}init(){this.addFileChooserSetting("Roam (.json)",["json"]),this.addOutputLocationSetting("Roam"),this.userDNPFormat=this.getUserDNPFormat(),new Ut.Setting(this.modal.contentEl).setName("Import settings").setHeading(),new Ut.Setting(this.modal.contentEl).setName("Download all attachments").setDesc("If enabled, all attachments uploaded to Roam will be downloaded to your attachments folder.").addToggle(e=>{e.setValue(this.downloadAttachments),e.onChange(async i=>{this.downloadAttachments=i})}),new Ut.Setting(this.modal.contentEl).setName("Add YAML created/update date").setDesc("If enabled, notes will have the create-time and edit-time from Roam added as properties.").addToggle(e=>{e.setValue(this.fileDateYAML),e.onChange(async i=>{this.fileDateYAML=i})}),new Ut.Setting(this.modal.contentEl).setName("Add YAML title").setDesc("If enabled, notes will have the full title added as a property (regardless of illegal file name characters).").addToggle(e=>{e.setValue(this.titleYAML),e.onChange(async i=>{this.titleYAML=i})})}async import(e){this.progress=e;let{files:i}=this;if(i.length===0){new Ut.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new Ut.Notice("Please select a location to export to.");return}for(let o of i){if(e.isCancelled())return;let a=Ze(o.basename),s=`${r.path}/${a}`,l=`${r.path}/${a}/Attachments`;await this.createFolders(s),await this.createFolders(l);let c=await o.readText(),p=JSON.parse(c),[m,y]=this.preprocess(p),E=new Map;for(let g in p){let w=p[g],_=Ur(Br(w.title),this.userDNPFormat).trim();if(_===""){e.reportFailed(w.uid,"Title is empty"),console.error("Cannot import data with an empty title",w);continue}let A=`${s}/${_}.md`,D=this.titleYAML?w.title:"",T=0,k=0;if(this.fileDateYAML){let C=w["create-time"],O=w["edit-time"];typeof C=="number"&&(T=C),typeof O=="number"&&(k=O)}let b=await this.jsonToMarkdown(s,l,w,"",!1,D,T,k);E.set(A,b)}for(let g of y.values()){let w=await this.roamMarkupScrubber(s,l,g.blockString,!0),_=await this.extractAndProcessBlockReferences(E,m,s,w),A=`${s}/${g.pageName}.md`,D=E.get(A);if(D){let T=D.split(` +`),k=T.findIndex(b=>b.contains("* "+w));k!==-1&&(T[k]=T[k].replace(w,_)),E.set(A,T.join(` +`))}}let{vault:v}=this,d=E.size,f=1;for(let[g,w]of E.entries()){if(e.isCancelled())return;try{let{parent:_}=re(g);await this.createFolders(_);let A=v.getAbstractFileByPath(g);A?await v.modify(A,w):await v.create(g,w),e.reportNoteSuccess(g),e.reportProgress(f,d)}catch(_){console.error("Error saving Markdown to file:",g,_),e.reportFailed(g)}f++}}}getUserDNPFormat(){let e=this.app.internalPlugins.getPluginById("daily-notes").instance;return e?e.options.format||"YYYY-MM-DD":(console.log('Daily note plugin is not enabled. Roam import defaulting to "YYYY-MM-DD" format.'),"YYYY-MM-DD")}preprocess(e){let i=new Map,r=new Map,o=this.userDNPFormat;function a(s,l){if(l.uid){let c=new Date(s.uid);if(!isNaN(c.getTime())){let y=Ur(s.title,o);s.title=y}let p={pageName:Br(s.title),blockString:l.string};/.*?(\(\(.*?\)\)).*?/g.test(l.string)&&r.set(l.uid,p),i.set(l.uid,p)}if(l.children)for(let c of l.children)a(s,c)}for(let s of e)if(s.children)for(let l of s.children)a(s,l);return[i,r]}async roamMarkupScrubber(e,i,r,o=!1){return r=r.replace(y1,""),r.substring(0,8)==":hiccup "&&r.includes(":hr")?"---":(r=r.replace(/\[\[(.*?)\]\]/g,(a,s)=>`[[${Ur(Br(s),this.userDNPFormat)}]]`),r=r.replace(/\[\[(.*\/.*)\]\]/g,(a,s)=>`[[${e}/${s}|${s}]]`),r=r.replace(/\[.+?\]\((\(.+?\)\))\)/g,"$1"),r=r.replace(/\[(.+?)\]\(\[\[(.+?)\]\]\)/g,"[[$2|$1]]"),r=r.replace(/\[\[>\]\]/g,">"),r=r.replace(/{{TODO}}|{{\[\[TODO\]\]}}/g,"[ ]"),r=r.replace(/{{DONE}}|{{\[\[DONE\]\]}}/g,"[x]"),r=r.replace("::",":"),r=r.replace(/{{.*?\bvideo\b.*?(\bhttp.*?\byoutu.*?)}}/g,"![]($1)"),r=r.replace(/(https?:\/\/twitter\.com\/(?:#!\/)?\w+\/status\/\d+(?:\?[\w=&-]+)?)/g,"![]($1)"),r=r.replace(/\_\_(.+?)\_\_/g,"*$1*"),r=r.replace(/\^\^(.+?)\^\^/g,"==$1=="),r=r.replace(/{{\[{0,2}embed.*?(\(\(.*?\)\)).*?}}/g,"$1"),r=r.replace(/{{\[{0,2}embed.*?(\[\[.*?\]\]).*?}}/g,"$1"),this.downloadAttachments&&!o&&r.includes("firebasestorage")&&(r=await this.downloadFirebaseFile(r,i)),r)}async jsonToMarkdown(e,i,r,o="",a=!1,s,l,c){let p=[],m=[],y=r["edit-time"],E=r["create-time"];if(this.newestTimestampy?c:y,E!==void 0?l>10?this.oldestTimestamp=Math.min(l,E):this.oldestTimestamp=E:this.oldestTimestamp=l,"string"in r&&r.string){let v=r.heading?"#".repeat(r.heading)+" ":"",d=await this.roamMarkupScrubber(e,i,r.string);p.push(`${a?o+"* ":o}${v}${d}`)}if(r.children)for(let v of r.children)p.push(await this.jsonToMarkdown(e,i,v,o+" ",!0,"",this.oldestTimestamp,this.newestTimestamp));if((this.fileDateYAML||this.titleYAML)&&!a){let v=this.oldestTimestamp;if(m.push("---"),this.titleYAML&&m.push(`title: "${s}"`),this.fileDateYAML){let d="YYYY-MM-DD HH:mm:ss",f=this.newestTimestamp?(0,jr.moment)(this.newestTimestamp).format(d):(0,jr.moment)(new Date).format(d),g=v?(0,jr.moment)(v).format(d):f;m.push("created: "+g),m.push("updated: "+f)}m.push("---"),p.unshift(m.join(` `))}return p.join(` `)}async modifySourceBlockString(e,i,r,o){if(!i.blockString.endsWith("^"+o)){let a=`${r}/${i.pageName}.md`,s=e.get(a);if(s){let l=s.split(` `),c=l.findIndex(p=>p.contains("* "+i.blockString));if(c!==-1){let p=i.blockString+" ^"+o;l[c]=l[c].replace(i.blockString,p),i.blockString=i.blockString+" ^"+o}e.set(a,l.join(` -`))}}}async extractAndProcessBlockReferences(e,i,r,o){let a=o.match(w1);if(!a)return o;let s=[];for(let p of a)try{let m=i.get(p);if(!m){s.push(p);continue}let y=m.blockString.replace(/\[\[|\]\]/g,""),E=`[[${r}/${m.pageName}#^${p}|${y}]]`;await this.modifySourceBlockString(e,m,r,p),s.push(E)}catch(m){s.push(p)}let l=0;return o.replace(/\(\(\b.*?\b\)\)/g,()=>s[l++])}async downloadFirebaseFile(e,i){let{progress:r,vault:o}=this,a="";try{let s,l;if(b1.test(e)?(s=e.match(/https:\/\/firebasestorage(.*?)\?alt(.*?)\}/),l=e.match(/{{.*https:\/\/firebasestorage.*?alt=media&.*?(?=\s|$)/)):cd.test(e)?(s=e.match(cd),l=e.match(/!\[.*https:\/\/firebasestorage.*?alt=media&.*?(?=\s|$)/)):(s=e.match(x1),l=e.match(/https:\/\/firebasestorage.*?alt=media&.*?(?=\s|$)/)),s&&l){let c="https://firebasestorage"+s[1],p=decodeURIComponent(c.split("/").last()||"");if(p){let d=p.split("/");d.length>1&&(d.splice(-1,1),this.createFolders(`${i}/${d.join("/")}`))}else{let d=Math.floor(Date.now()/1e3),f=c.slice(-5).match(/(.*?)\.(.+)/);if(!f)return r.reportSkipped(s[1],"Unexpected file extension"),e;p=`${d}.${f[2]}`}let m=`${i}/${p}`;if(o.getAbstractFileByPath(m))return r.reportSkipped(s[1],"File already exists"),e;a=s[0].slice(0,-1);let v=await(await fetch(a,{})).arrayBuffer();return await o.createBinary(m,v),r.reportAttachmentSuccess(a),e.replace(l[0],`![[${m}]]`)}}catch(s){console.error(s),r.reportFailed(a,s)}return e}};var jt=require("obsidian");var pd=/!\[\]\(assets\/([^)]*)\)/g,qr=class extends ce{init(){jt.Platform.isMacOS||this.modal.contentEl.createEl("p",{text:"Due to platform limitations, only textpack and zip files can be imported from this device. Open your vault on a Mac to import textbundle files."});let e=jt.Platform.isMacOS?["textbundle","textpack","zip"]:["textpack","zip"];this.addFileChooserSetting("Textbundle",e,!0),this.addOutputLocationSetting("Textbundle")}async import(e){let{files:i}=this;if(i.length===0){new jt.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new jt.Notice("Please select a location to export to.");return}this.outputFolder=r,this.attachmentsFolderPath=await this.createFolders(`${r.path}/assets`);for(let o of i)if(o.extension==="textpack")await gt(o,async(a,s)=>{await this.process(e,o.name,s)});else if(o.extension==="zip")await gt(o,async(a,s)=>{let l=this.groupFilesByTextbundle(o.name,s);for(let c of l)await this.process(e,o.name,c)});else{let s=await new ut(`${o.toString()}/`).list();await this.process(e,o.name,s)}}groupFilesByTextbundle(e,i){let r={},o=e+"/",a=".textbundle";for(let s of i){if(!s.fullpath.startsWith(o)){console.log("Skipping",s.fullpath);continue}let l=s.fullpath.slice(o.length);if(l.startsWith("._")||l.startsWith("__MACOSX")){console.log("Skipping",s.fullpath);continue}let c=l.indexOf(a);if(c===-1){console.log("Skipping",s.fullpath);continue}let p=l.slice(0,c)+".textbundle";if(l.slice(c+a.length+1).startsWith("._")){console.log("Skipping",s.fullpath);continue}p in r?r[p].push(s):r[p]=[s]}return Object.values(r)}async process(e,i,r){let o=r.find(a=>a.name==="info.json");if(o){let a=await o.readText(),s=JSON.parse(a);if(s.hasOwnProperty("type")&&s.type!=="net.daringfireball.markdown"){e.reportSkipped(i,"The textbundle does not contain markdown");return}}for(let a of r)if(!a.name.startsWith("._"))try{if(a.type==="file"&&(a.extension==="md"||a.extension==="markdown")){let s="parent"in a?a.parent:i;s=s.replace(/.textbundle$/,"");let l=await a.readText();l.match(pd)&&(l=l.replace(pd,`![[${this.attachmentsFolderPath.path}/$1]]`));let c=(0,jt.normalizePath)(s);await this.saveAsMarkdownFile(this.outputFolder,c,l),e.reportNoteSuccess(s)}else if(a.type==="file"&&a.fullpath.contains("assets/"))await this.importAsset(e,a);else if(a.type==="folder"){let{basename:s}=oe(a.toString());if(s!=="assets")continue;let c=await new ut(`${a.toString()}/`).list();for(let p of c)await this.importAsset(e,p)}else a.name!=="info.json"&&e.reportSkipped(a.name,"the file is not a media or markdown file.")}catch(s){e.reportFailed(a.name,s)}}async importAsset(e,i){if(i.type==="folder"){e.reportSkipped(i.name);return}let r=`${this.attachmentsFolderPath.path}/${i.name}`;this.vault.getAbstractFileByPath(r)&&e.reportSkipped(i.name,"the file already exists.");let a=await i.read();await this.vault.createBinary(r,a),e.reportAttachmentSuccess(i.name)}};var $r="obsidian://importer-auth/",Fn=["png","webp","jpg","jpeg","gif","bmp","svg","mpg","m4a","webm","wav","ogv","3gp","mov","mp4","mkv","pdf"],Wr=class{constructor(t){this.notes=0;this.attachments=0;this.skipped=[];this.failed=[];this.maxFileNameLength=100;this.cancelled=!1;this.el=t,t.empty(),this.statusEl=t.createDiv("importer-status"),this.progressBarEl=t.createDiv("importer-progress-bar",e=>{this.progressBarInnerEl=e.createDiv("importer-progress-bar-inner")}),t.createDiv("importer-stats-container",e=>{e.createDiv("importer-stat mod-imported",i=>{this.importedCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"imported"})}),e.createDiv("importer-stat mod-attachments",i=>{this.attachmentCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"attachments"})}),e.createDiv("importer-stat mod-remaining",i=>{this.remainingCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"remaining"})}),e.createDiv("importer-stat mod-skipped",i=>{this.skippedCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"skipped"})}),e.createDiv("importer-stat mod-failed",i=>{this.failedCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"failed"})})}),this.importLogEl=t.createDiv("importer-log"),this.importLogEl.hide()}status(t){this.statusEl.setText(t.trim()+"...")}reportNoteSuccess(t){this.notes++,this.importedCountEl.setText(this.notes.toString())}reportAttachmentSuccess(t){this.attachments++,this.attachmentCountEl.setText(this.attachments.toString())}reportSkipped(t,e){let{importLogEl:i}=this;this.skipped.push(t),this.skippedCountEl.setText(this.skipped.length.toString()),console.log("Import skipped",t,e),this.importLogEl.createDiv("list-item",r=>{r.createSpan({cls:"importer-error",text:"Skipped: "}),r.createSpan({text:`"${Jn(t,this.maxFileNameLength)}"`+(e?` because ${Jn(String(e),this.maxFileNameLength)}`:"")})}),i.scrollTop=i.scrollHeight,i.show()}reportFailed(t,e){let{importLogEl:i}=this;this.failed.push(t),this.failedCountEl.setText(this.failed.length.toString()),console.log("Import failed",t,e),this.importLogEl.createDiv("list-item",r=>{r.createSpan({cls:"importer-error",text:"Failed: "}),r.createSpan({text:`"${Jn(t,this.maxFileNameLength)}"`+(e?` because ${Jn(String(e),this.maxFileNameLength)}`:"")})}),i.scrollTop=i.scrollHeight,i.show()}reportProgress(t,e){e<=0||(console.log("Current progress:",(100*t/e).toFixed(1)+"%"),this.remainingCountEl.setText((e-t).toString()),this.importedCountEl.setText(t.toString()),this.progressBarInnerEl.style.width=(100*t/e).toFixed(1)+"%")}cancel(){this.cancelled=!0,this.progressBarEl.hide(),this.statusEl.hide()}hideStatus(){this.progressBarEl.hide(),this.statusEl.hide()}isCancelled(){return this.cancelled}},Zr=class extends Ht.Plugin{async onload(){this.importers={"apple-notes":{name:"Apple Notes",optionText:"Apple Notes",importer:br,helpPermalink:"import/apple-notes"},bear:{name:"Bear",optionText:"Bear (.bear2bk)",importer:xr,helpPermalink:"import/bear"},evernote:{name:"Evernote",optionText:"Evernote (.enex)",importer:Cr,helpPermalink:"import/evernote"},keep:{name:"Google Keep",optionText:"Google Keep (.zip/.json)",importer:Fr,helpPermalink:"import/google-keep"},html:{name:"HTML files",optionText:"HTML (.html)",importer:Ir,helpPermalink:"import/html"},onenote:{name:"Microsoft OneNote",optionText:"Microsoft OneNote",importer:Mr,helpPermalink:"import/onenote"},notion:{name:"Notion",optionText:"Notion (.zip)",importer:Pr,helpPermalink:"import/notion",formatDescription:"Export your Notion workspace to HTML format."},"roam-json":{name:"Roam Research",optionText:"Roam Research (.json)",importer:Hr,helpPermalink:"import/roam",formatDescription:"Export your Roam Research workspace to JSON format."},textbundle:{name:"Textbundle files",optionText:"Textbundle (.textbundle, .textpack)",importer:qr,helpPermalink:"import/textbundle"}},this.addRibbonIcon("lucide-import","Open Importer",()=>{new wi(this.app,this).open()}),this.addCommand({id:"open-modal",name:"Open importer",callback:()=>{new wi(this.app,this).open()}}),this.registerObsidianProtocolHandler("importer-auth",e=>{if(this.authCallback){this.authCallback(e),this.authCallback=void 0;return}new Ht.Notice("Unexpected auth event. Please restart the auth process.")})}onunload(){}registerAuthCallback(e){this.authCallback=e}},wi=class extends Ht.Modal{constructor(e,i){super(e);this.current=null;this.plugin=i,this.titleEl.setText("Import data into Obsidian"),this.modalEl.addClass("mod-importer");let r=Object.keys(i.importers);r.length>0&&(this.selectedId=r[0],this.updateContent())}updateContent(){let{contentEl:e,selectedId:i}=this,r=this.plugin.importers,o=r[i];e.empty();let a=new DocumentFragment;if(a.createSpan({text:"The format to be imported."}),o.formatDescription&&(a.createEl("br"),a.createSpan({text:o.formatDescription})),a.createEl("br"),a.createEl("a",{text:`Learn more about importing from ${o.name}.`,href:`https://help.obsidian.md/${o.helpPermalink}`}),new Ht.Setting(e).setName("File format").setDesc(a).addDropdown(s=>{for(let l in r)r.hasOwnProperty(l)&&s.addOption(l,r[l].optionText);s.onChange(l=>{r.hasOwnProperty(l)&&(this.selectedId=l,this.updateContent())}),s.setValue(this.selectedId)}),i&&r.hasOwnProperty(i)){let s=this.importer=new o.importer(this.app,this);if(s.notAvailable)return;e.createDiv("modal-button-container",l=>{l.createEl("button",{cls:"mod-cta",text:"Import"},c=>{c.addEventListener("click",async()=>{this.current&&this.current.cancel(),e.empty();let p=e.createDiv(),m=this.current=new Wr(p),y=e.createDiv("modal-button-container"),E=y.createEl("button",{cls:"mod-danger",text:"Stop"},v=>{v.addEventListener("click",()=>{m.cancel(),E.detach()})});try{await s.import(m)}finally{this.current===m&&(this.current=null),E.detach(),y.createEl("button",{cls:"mod-cta",text:"Done"},v=>{v.addEventListener("click",()=>this.close())}),y.createEl("button",{text:"Back"},v=>{v.addEventListener("click",()=>this.updateContent())}),m.hideStatus()}})})})}}onClose(){let{contentEl:e,current:i}=this;e.empty(),i&&i.cancel()}}; +`))}}}async extractAndProcessBlockReferences(e,i,r,o){let a=o.match(w1);if(!a)return o;let s=[];for(let p of a)try{let m=i.get(p);if(!m){s.push(p);continue}let y=m.blockString.replace(/\[\[|\]\]/g,""),E=`[[${r}/${m.pageName}#^${p}|${y}]]`;await this.modifySourceBlockString(e,m,r,p),s.push(E)}catch(m){s.push(p)}let l=0;return o.replace(/\(\(\b.*?\b\)\)/g,()=>s[l++])}async downloadFirebaseFile(e,i){let{progress:r,vault:o}=this,a="";try{let s,l;if(b1.test(e)?(s=e.match(/https:\/\/firebasestorage(.*?)\?alt(.*?)\}/),l=e.match(/{{.*https:\/\/firebasestorage.*?alt=media&.*?(?=\s|$)/)):cd.test(e)?(s=e.match(cd),l=e.match(/!\[.*https:\/\/firebasestorage.*?alt=media&.*?(?=\s|$)/)):(s=e.match(x1),l=e.match(/https:\/\/firebasestorage.*?alt=media&.*?(?=\s|$)/)),s&&l){let c="https://firebasestorage"+s[1],p=decodeURIComponent(c.split("/").last()||"");if(p){let d=p.split("/");d.length>1&&(d.splice(-1,1),this.createFolders(`${i}/${d.join("/")}`))}else{let d=Math.floor(Date.now()/1e3),f=c.slice(-5).match(/(.*?)\.(.+)/);if(!f)return r.reportSkipped(s[1],"Unexpected file extension"),e;p=`${d}.${f[2]}`}let m=`${i}/${p}`;if(o.getAbstractFileByPath(m))return r.reportSkipped(s[1],"File already exists"),e;a=s[0].slice(0,-1);let v=await(await fetch(a,{})).arrayBuffer();return await o.createBinary(m,v),r.reportAttachmentSuccess(a),e.replace(l[0],`![[${m}]]`)}}catch(s){console.error(s),r.reportFailed(a,s)}return e}};var jt=require("obsidian");var pd=/!\[\]\(assets\/([^)]*)\)/g,qr=class extends ce{init(){jt.Platform.isMacOS||this.modal.contentEl.createEl("p",{text:"Due to platform limitations, only textpack and zip files can be imported from this device. Open your vault on a Mac to import textbundle files."});let e=jt.Platform.isMacOS?["textbundle","textpack","zip"]:["textpack","zip"];this.addFileChooserSetting("Textbundle",e,!0),this.addOutputLocationSetting("Textbundle")}async import(e){let{files:i}=this;if(i.length===0){new jt.Notice("Please pick at least one file to import.");return}let r=await this.getOutputFolder();if(!r){new jt.Notice("Please select a location to export to.");return}this.attachmentsFolderPath=await this.createFolders(`${r.path}/assets`);for(let o of i)if(o.extension==="textpack")await gt(o,async(a,s)=>{await this.process(e,o.name,s)});else if(o.extension==="zip")await gt(o,async(a,s)=>{let l=this.groupFilesByTextbundle(o.name,s);for(let c of l)await this.process(e,o.name,c)});else{let s=await new ut(`${o.toString()}/`).list();await this.process(e,o.name,s)}}groupFilesByTextbundle(e,i){let r={},o=e+"/",a=".textbundle";for(let s of i){if(!s.fullpath.startsWith(o)){console.log("Skipping",s.fullpath);continue}let l=s.fullpath.slice(o.length);if(l.startsWith("._")||l.startsWith("__MACOSX")){console.log("Skipping",s.fullpath);continue}let c=l.indexOf(a);if(c===-1){console.log("Skipping",s.fullpath);continue}let p=l.slice(0,c)+".textbundle";if(l.slice(c+a.length+1).startsWith("._")){console.log("Skipping",s.fullpath);continue}p in r?r[p].push(s):r[p]=[s]}return Object.values(r)}async process(e,i,r){let o=r.find(a=>a.name==="info.json");if(o){let a=await o.readText(),s=JSON.parse(a);if(s.hasOwnProperty("type")&&s.type!=="net.daringfireball.markdown"){e.reportSkipped(i,"The textbundle does not contain markdown");return}}for(let a of r)if(!a.name.startsWith("._"))try{if(a.type==="file"&&(a.extension==="md"||a.extension==="markdown")){let s="parent"in a?a.parent:i;s=s.replace(/.textbundle$/,"");let l=await a.readText();l.match(pd)&&(l=l.replace(pd,`![[${this.attachmentsFolderPath.path}/$1]]`));let c=(0,jt.normalizePath)(s),p=await this.getOutputFolder();await this.saveAsMarkdownFile(p,c,l),e.reportNoteSuccess(s)}else if(a.type==="file"&&a.fullpath.contains("assets/"))await this.importAsset(e,a);else if(a.type==="folder"){let{basename:s}=re(a.toString());if(s!=="assets")continue;let c=await new ut(`${a.toString()}/`).list();for(let p of c)await this.importAsset(e,p)}else a.name!=="info.json"&&e.reportSkipped(a.name,"the file is not a media or markdown file.")}catch(s){e.reportFailed(a.name,s)}}async importAsset(e,i){if(i.type==="folder"){e.reportSkipped(i.name);return}let r=`${this.attachmentsFolderPath.path}/${i.name}`;this.vault.getAbstractFileByPath(r)&&e.reportSkipped(i.name,"the file already exists.");let a=await i.read();await this.vault.createBinary(r,a),e.reportAttachmentSuccess(i.name)}};var $r="obsidian://importer-auth/",Ln=["png","webp","jpg","jpeg","gif","bmp","svg","mpg","m4a","webm","wav","ogv","3gp","mov","mp4","mkv","pdf"],Wr=class{constructor(t){this.notes=0;this.attachments=0;this.skipped=[];this.failed=[];this.maxFileNameLength=100;this.cancelled=!1;this.el=t,t.empty(),this.statusEl=t.createDiv("importer-status"),this.progressBarEl=t.createDiv("importer-progress-bar",e=>{this.progressBarInnerEl=e.createDiv("importer-progress-bar-inner")}),t.createDiv("importer-stats-container",e=>{e.createDiv("importer-stat mod-imported",i=>{this.importedCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"imported"})}),e.createDiv("importer-stat mod-attachments",i=>{this.attachmentCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"attachments"})}),e.createDiv("importer-stat mod-remaining",i=>{this.remainingCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"remaining"})}),e.createDiv("importer-stat mod-skipped",i=>{this.skippedCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"skipped"})}),e.createDiv("importer-stat mod-failed",i=>{this.failedCountEl=i.createDiv({cls:"importer-stat-count",text:"0"}),i.createDiv({cls:"importer-stat-name",text:"failed"})})}),this.importLogEl=t.createDiv("importer-log"),this.importLogEl.hide()}status(t){this.statusEl.setText(t.trim()+"...")}reportNoteSuccess(t){this.notes++,this.importedCountEl.setText(this.notes.toString())}reportAttachmentSuccess(t){this.attachments++,this.attachmentCountEl.setText(this.attachments.toString())}reportSkipped(t,e){let{importLogEl:i}=this;this.skipped.push(t),this.skippedCountEl.setText(this.skipped.length.toString()),console.log("Import skipped",t,e),this.importLogEl.createDiv("list-item",r=>{r.createSpan({cls:"importer-error",text:"Skipped: "}),r.createSpan({text:`"${Qn(t,this.maxFileNameLength)}"`+(e?` because ${Qn(String(e),this.maxFileNameLength)}`:"")})}),i.scrollTop=i.scrollHeight,i.show()}reportFailed(t,e){let{importLogEl:i}=this;this.failed.push(t),this.failedCountEl.setText(this.failed.length.toString()),console.log("Import failed",t,e),this.importLogEl.createDiv("list-item",r=>{r.createSpan({cls:"importer-error",text:"Failed: "}),r.createSpan({text:`"${Qn(t,this.maxFileNameLength)}"`+(e?` because ${Qn(String(e),this.maxFileNameLength)}`:"")})}),i.scrollTop=i.scrollHeight,i.show()}reportProgress(t,e){e<=0||(console.log("Current progress:",(100*t/e).toFixed(1)+"%"),this.remainingCountEl.setText((e-t).toString()),this.importedCountEl.setText(t.toString()),this.progressBarInnerEl.style.width=(100*t/e).toFixed(1)+"%")}cancel(){this.cancelled=!0,this.progressBarEl.hide(),this.statusEl.hide()}hideStatus(){this.progressBarEl.hide(),this.statusEl.hide()}isCancelled(){return this.cancelled}},Zr=class extends Ht.Plugin{async onload(){this.importers={"apple-notes":{name:"Apple Notes",optionText:"Apple Notes",importer:br,helpPermalink:"import/apple-notes"},bear:{name:"Bear",optionText:"Bear (.bear2bk)",importer:xr,helpPermalink:"import/bear"},evernote:{name:"Evernote",optionText:"Evernote (.enex)",importer:Cr,helpPermalink:"import/evernote"},keep:{name:"Google Keep",optionText:"Google Keep (.zip/.json)",importer:Fr,helpPermalink:"import/google-keep"},html:{name:"HTML files",optionText:"HTML (.html)",importer:Ir,helpPermalink:"import/html"},onenote:{name:"Microsoft OneNote",optionText:"Microsoft OneNote",importer:Mr,helpPermalink:"import/onenote"},notion:{name:"Notion",optionText:"Notion (.zip)",importer:Pr,helpPermalink:"import/notion",formatDescription:"Export your Notion workspace to HTML format."},"roam-json":{name:"Roam Research",optionText:"Roam Research (.json)",importer:Hr,helpPermalink:"import/roam",formatDescription:"Export your Roam Research workspace to JSON format."},textbundle:{name:"Textbundle files",optionText:"Textbundle (.textbundle, .textpack)",importer:qr,helpPermalink:"import/textbundle"}},this.addRibbonIcon("lucide-import","Open Importer",()=>{new wi(this.app,this).open()}),this.addCommand({id:"open-modal",name:"Open importer",callback:()=>{new wi(this.app,this).open()}}),this.registerObsidianProtocolHandler("importer-auth",e=>{if(this.authCallback){this.authCallback(e),this.authCallback=void 0;return}new Ht.Notice("Unexpected auth event. Please restart the auth process.")})}onunload(){}registerAuthCallback(e){this.authCallback=e}},wi=class extends Ht.Modal{constructor(e,i){super(e);this.current=null;this.plugin=i,this.titleEl.setText("Import data into Obsidian"),this.modalEl.addClass("mod-importer");let r=Object.keys(i.importers);r.length>0&&(this.selectedId=r[0],this.updateContent())}updateContent(){let{contentEl:e,selectedId:i}=this,r=this.plugin.importers,o=r[i];e.empty();let a=new DocumentFragment;if(a.createSpan({text:"The format to be imported."}),o.formatDescription&&(a.createEl("br"),a.createSpan({text:o.formatDescription})),a.createEl("br"),a.createEl("a",{text:`Learn more about importing from ${o.name}.`,href:`https://help.obsidian.md/${o.helpPermalink}`}),new Ht.Setting(e).setName("File format").setDesc(a).addDropdown(s=>{for(let l in r)r.hasOwnProperty(l)&&s.addOption(l,r[l].optionText);s.onChange(l=>{r.hasOwnProperty(l)&&(this.selectedId=l,this.updateContent())}),s.setValue(this.selectedId)}),i&&r.hasOwnProperty(i)){let s=this.importer=new o.importer(this.app,this);if(s.notAvailable)return;e.createDiv("modal-button-container",l=>{l.createEl("button",{cls:"mod-cta",text:"Import"},c=>{c.addEventListener("click",async()=>{this.current&&this.current.cancel(),e.empty();let p=e.createDiv(),m=this.current=new Wr(p),y=e.createDiv("modal-button-container"),E=y.createEl("button",{cls:"mod-danger",text:"Stop"},v=>{v.addEventListener("click",()=>{m.cancel(),E.detach()})});try{await s.import(m)}finally{this.current===m&&(this.current=null),y.createEl("button",{text:"Upload more"},v=>{v.addEventListener("click",()=>this.updateContent())}),E.detach(),y.createEl("button",{cls:"mod-cta",text:"Done"},v=>{v.addEventListener("click",()=>this.close())}),m.hideStatus()}})})})}}onClose(){let{contentEl:e,current:i}=this;e.empty(),i&&i.cancel()}}; /*! Bundled license information: sax/lib/sax.js: (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) */ + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-importer/manifest.json b/.obsidian/plugins/obsidian-importer/manifest.json index ee98996..ed3aeea 100644 --- a/.obsidian/plugins/obsidian-importer/manifest.json +++ b/.obsidian/plugins/obsidian-importer/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-importer", "name": "Importer", - "version": "1.6.4", + "version": "1.6.10", "minAppVersion": "0.15.0", "description": "Import data from Notion, Evernote, Apple Notes, Microsoft OneNote, Google Keep, Bear, Roam, and HTML files.", "author": "Obsidian", diff --git a/.obsidian/workspace-mobile(1).json b/.obsidian/workspace-mobile(1).json new file mode 100644 index 0000000..6bbea3e --- /dev/null +++ b/.obsidian/workspace-mobile(1).json @@ -0,0 +1,215 @@ +{ + "main": { + "id": "5dc09c3b67d5d692", + "type": "split", + "children": [ + { + "id": "ab48988ebb33fb42", + "type": "tabs", + "children": [ + { + "id": "737146975ad6b83a", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Prayer meeting.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Prayer meeting" + } + }, + { + "id": "672ec9fd574b78e4", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Prayer meeting 2024.09.25.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Prayer meeting 2024.09.25" + } + } + ], + "currentTab": 1 + } + ], + "direction": "vertical" + }, + "left": { + "id": "dc666222c4fb9f71", + "type": "mobile-drawer", + "children": [ + { + "id": "73a97c7f3fa9bacf", + "type": "leaf", + "state": { + "type": "file-explorer", + "state": { + "sortOrder": "alphabetical" + }, + "icon": "lucide-folder-closed", + "title": "Files" + } + }, + { + "id": "acb682182d29db46", + "type": "leaf", + "state": { + "type": "search", + "state": { + "query": "", + "matchingCase": false, + "explainSearch": false, + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical" + }, + "icon": "lucide-search", + "title": "Search" + } + }, + { + "id": "cba5a0c2cb28c0c0", + "type": "leaf", + "state": { + "type": "tag", + "state": { + "sortOrder": "frequency", + "useHierarchy": true + }, + "icon": "lucide-tags", + "title": "Tags" + } + }, + { + "id": "d49e84e05304afd3", + "type": "leaf", + "state": { + "type": "bookmarks", + "state": {}, + "icon": "lucide-bookmark", + "title": "Bookmarks" + } + } + ], + "currentTab": 0 + }, + "right": { + "id": "c7ec4fb9d4207ae7", + "type": "mobile-drawer", + "children": [ + { + "id": "3be9b060519e53e6", + "type": "leaf", + "state": { + "type": "backlink", + "state": { + "file": "Prayer meeting 2024.09.25.md", + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-coming-in", + "title": "Backlinks" + } + }, + { + "id": "2fcdb36d9b290185", + "type": "leaf", + "state": { + "type": "outgoing-link", + "state": { + "file": "Prayer meeting 2024.09.25.md", + "linksCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-going-out", + "title": "Outgoing links" + } + }, + { + "id": "33457e837096feb0", + "type": "leaf", + "state": { + "type": "outline", + "state": { + "file": "Prayer meeting 2024.09.25.md" + }, + "icon": "lucide-list", + "title": "Outline" + } + }, + { + "id": "f9d7b196da37c04e", + "type": "leaf", + "state": { + "type": "git-view", + "state": {}, + "icon": "git-pull-request", + "title": "Source Control" + } + } + ], + "currentTab": 3 + }, + "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, + "obsidian-git:Open Git source control": false + } + }, + "active": "672ec9fd574b78e4", + "lastOpenFiles": [ + "Reading/Book notes", + "Lenovo laptop model differences.md", + "Free icons sets.md", + "Daily Notes/2024/09/2024-09-25 (Wednesday).md", + "Camps/Good News Camp 2019/Preparation.md", + "People/Joe Caun.md", + "People/Christian Price.md", + "People/Nic Hoza.md", + "Daily Notes/2024/10/2024-10-26 (Saturday).md", + "Daily Notes/2024/10", + "Work/Training/Advanced Distributed Systems", + "Work/Logos book club notes", + "Work/Training", + "Work/Skeletor.md", + "Work", + "People/Caleb Nelson.md", + "_Templates/Person.md", + "Church/Homiletics/Homiletics Fall 2019/Final Message Part 1 - Kosei Miwata.md", + "Church/Homiletics/Homiletics Fall 2019", + "Church/Homiletics", + "Church", + "People/Simon Ruehl.md", + "People/Kate Neale.md", + "Reading/Read Later", + "Reading", + "People/Matthias Mangold.md", + "Bible Study/Topical studies/Vaccinations/Untitled note.md", + "LinqPad.md", + "People/Areti Mouralas.md", + "Quick Notes/Possible next five aspects study guys.md", + "Quick Notes/Tow of Ranger.md", + "Quick Notes/Q for Anthony.md", + "Shopping/Groceries.md", + "People/Bob Rockhold.md", + "People/Noah Price.md", + "People/Kyle Sletten.md" + ] +} \ No newline at end of file diff --git a/.obsidian/workspace-mobile.json b/.obsidian/workspace-mobile.json new file mode 100644 index 0000000..82fdd1c --- /dev/null +++ b/.obsidian/workspace-mobile.json @@ -0,0 +1,139 @@ +{ + "main": { + "id": "2e61daace6624717", + "type": "split", + "children": [ + { + "id": "9d5c9df1db59d503", + "type": "tabs", + "children": [ + { + "id": "154140c3bbd53a34", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Prayer meeting.md", + "mode": "source", + "source": false + } + } + } + ] + } + ], + "direction": "vertical" + }, + "left": { + "id": "ac7683df076f95dd", + "type": "mobile-drawer", + "children": [ + { + "id": "cd87c24569fedc68", + "type": "leaf", + "state": { + "type": "file-explorer", + "state": { + "sortOrder": "alphabetical" + } + } + }, + { + "id": "6e96e9de0f0022eb", + "type": "leaf", + "state": { + "type": "search", + "state": { + "query": "", + "matchingCase": false, + "explainSearch": false, + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical" + } + } + }, + { + "id": "807e3267f8fd81ba", + "type": "leaf", + "state": { + "type": "tag", + "state": { + "sortOrder": "frequency", + "useHierarchy": true + } + } + }, + { + "id": "4bbcdc87635fb557", + "type": "leaf", + "state": { + "type": "bookmarks", + "state": {} + } + } + ], + "currentTab": 0 + }, + "right": { + "id": "4449be3d3558eb8d", + "type": "mobile-drawer", + "children": [ + { + "id": "7c34bacd393d1c07", + "type": "leaf", + "state": { + "type": "backlink", + "state": { + "file": "Prayer meeting.md", + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + } + } + }, + { + "id": "3ba554976f5ef7e4", + "type": "leaf", + "state": { + "type": "outgoing-link", + "state": { + "file": "Prayer meeting.md", + "linksCollapsed": false, + "unlinkedCollapsed": true + } + } + }, + { + "id": "aefa47f65cd8c13d", + "type": "leaf", + "state": { + "type": "outline", + "state": { + "file": "Prayer meeting.md" + } + } + } + ], + "currentTab": 0 + }, + "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 + } + }, + "active": "154140c3bbd53a34", + "lastOpenFiles": [ + "Untitled.md", + "Prayer meeting.md" + ] +} \ No newline at end of file diff --git a/Church/Homiletics/Chapter 7 supplemental questions.md b/Church/Homiletics/Chapter 7 supplemental questions.md new file mode 100644 index 0000000..6193269 --- /dev/null +++ b/Church/Homiletics/Chapter 7 supplemental questions.md @@ -0,0 +1,94 @@ +# Question 1 +Given below are three illustrations. For each give a passage of Scripture in which you would use the illustration and state exactly ho you would use it. + +## Illustration A +Deep sea fishermen keep tanks in their boats so that the cod they catch can swim about alive until their return to harbor. It was discovered, however, that though the cod remained alive, they became flabby and limp. They were too content in such safe waters So, the fishermen introduce a catfish into the tanks to chase the code about and frighten them out of their ease. Cod now arrive at the market fresh and brisk. + +Scripture +``` +``` + +Use of illustration +``` + + + + + + + + + + + + + + + + +``` + +## Illustration B +Gibbon, the famous historian of the Roman Empire, tells us that, by a sudden change of fortune, one of the old Roman Emperors was suddenly brought one day from prison to receive the imperial crown. No smith could be found within the precincts of the palace, and so far several hours he stat on the throne of the Caesars with fetters still on his hands and feet. + +Scripture +``` +``` + +Use of illustration +``` + + + + + + + + + + + + + + + +``` + +## Illustration C +The word *Gospel* comes from the Greek word *euaggelion*. The verb literally means "to bring a message of good news" and the noun, simply "good news". The word *Gospel* itself is derived from the Anglo-Saxon word *gode-spell*, the word *gode* meaning "good" and *spell* meaning " a story, a tale". The word *euaggelion* was used as commonly in the first century as our words "good news" are used today. In ordinary conversation, in the first century the word did not have any of the religious connotations it would have today. However, it was adopted by the Caesar Cult where it acquired a religious significance. The Caesar Cult was the official religion of the Roman Empire in which the Caesar was worshipped as a god. When the announcement of the Caesar's birthday was made, or the accession of a new Caesar proclaimed it was called by the word *euaggelion*. Thus when the news of salvation is called *euaggelion* the word literally meant, to first century readers, "good news". + +Scripture +``` +``` + +Use of illustration +``` + + + + + + + + + + + + + + + + + +``` +# Question 2 +Submit an illustration for Proverbs 15:1. State the source of your illustration. +``` + + + + + + + +``` \ No newline at end of file diff --git a/Church/Homiletics/Homiletics course structure.md b/Church/Homiletics/Homiletics course structure.md index 9368de6..19ebaaa 100644 --- a/Church/Homiletics/Homiletics course structure.md +++ b/Church/Homiletics/Homiletics course structure.md @@ -1,12 +1,12 @@ -| | Assignment | -| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Meeting 1 | Read chapters 1 & 2
    Exams | -| Meeting 2 | Read chapters 3 & 4 & 5
    Exams
    Do supplemental questions from original book for chapters 3, 4 and 5 | -| Meeting 3 | Read chapter 6
    Do supplemental questions from original book for chapter 6
    Deliver introduction
    - Max 5 minutes
    - Tell us the theme of your message
    - Tell us the passage | -| Meeting 4 | Read chapter 7
    Deliver one main point
    - Tell us the theme, passage, other main points
    - Use at least one cross reference
    - Use at least one illustration
    - 5-10 minutes | -| Meeting 5 | Read chapter 8, first half of 9
    Deliver testimony
    - 5-10 minutes | -| Meeting 6 | Read chapter last half of 9, 10

    Deliver "let us" message from Hebrews? | -| Meeting 7 | Read chapter 11
    Deliver complete message
    - Target 15 minutes
    - Will be what you eventually delivery on a Wed. night prayer meeting | -| Meeting 8 | Read chapter 12
    Delivery complete message, part 2
    - Improve original message from feedback given | +| | Assignment | +| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Session 1 | Read chapters 1 & 2
    Exams | +| Session 2 | Read chapters 3 & 4 & 5
    Exams
    Do supplemental questions from original book for chapters 3, 4 and 5 | +| Session 3 | Read chapter 6
    Do supplemental questions from original book for chapter 6.
    Come up with an idea for a message. Tell the class your theme, Scripture text and list the main points for your message. Present just the introduction to this message. Target 3-5 minutes, but no longer than 10 minutes. | +| Session 4 | Read chapter 7
    Do supplemental questions from original book for chapter 7
    Come up with an idea for a message (can be completely different from previous session). Tell the class your theme, Scripture text and list the main points for your message. Present one of the main points. Include at least one cross-reference and at least one illustration. Target 5 minutes, but no longer than 10 minutes. | +| Session 5 | Read chapter 8, first half of 9
    Do supplemental questions from original book for chapter 8 and half of 9
    Deliver your personal testimony based on what you learned from chapter 8. Target 5 minutes, but no longer than 10 minutes. | +| Session 6 | Read chapter last half of 9, 10
    Do supplemental questions from original book for half of 9 and chapter 10
    Deliver a portion of your message based on one of the "let us" verses in Hebrews. Target 10 minutes, but no longer than 15 minutes. Include at least one cross-reference and at least one illustration. | +| Session 7 | Read chapter 11
    Prepare and present to the class a complete message on a topic and/or passage of your choosing. This will be the message you deliver again next session and to the chapel on a Wednesday night. Target 15 minutes. | +| Session 8 | Read chapter 12
    Delivery complete message. Improve original message from feedback given in session 7. | diff --git a/Church/Prayer meeting notes/Prayer meeting 2024.08.21.md b/Church/Prayer meeting notes/Prayer meeting 2024.08.21.md new file mode 100644 index 0000000..5ed3df2 --- /dev/null +++ b/Church/Prayer meeting notes/Prayer meeting 2024.08.21.md @@ -0,0 +1,15 @@ +[[2024-08-21 (Wednesday)]] + +Emily going to tepsi, +Steve: headed to indiapolis, Emily’s car had some trouble. Patricks fixed it +Mai expecting, quite ill, masashi’s mother passed away this morning, no more details +[[Ian Barnes]], Covid and pneumonia +Ezra and Joanna Brainerd in Brazil, boat fire, all safe but tragic +Phil Kleymann put on hospice +[[Thomas Price]] gone 7 of next 8 days +Carl speaking on Sunday +Kathy reddi, Iowa City, safe travels at research conference , paying out of state tuition now on fourth attempt have in state tuition +Ken: rose hill good news club, principal has not returned phone calls to arrange a start time +Carl: neighbor Karen, suspected of grand mal seizure, had to be revived, weak heart, salvation, is Jewish +Steve: folks from Brookfield, would like to attend here. Prau for children and wife to come as well. + diff --git a/Church/Prayer meeting notes/Prayer meeting 2024.09.25.md b/Church/Prayer meeting notes/Prayer meeting 2024.09.25.md new file mode 100644 index 0000000..2e29ce4 --- /dev/null +++ b/Church/Prayer meeting notes/Prayer meeting 2024.09.25.md @@ -0,0 +1,11 @@ +[[2024-09-25 (Wednesday)]] + +Israel-hezbollah +[[Thomas Price]] traveling +big storm heading for florida +former president trump, assassination attempts +Nicks grandpa in Oregon, thyroid cancer, gone now, but heart issues now, will try abrasion procedure +Barnes, Wortman families with Ian’s passing +Diane, walking today, heart rain sometimes high, need to find meaning + + diff --git a/Daily Notes/2024/11/2024-11-08 (Friday).md b/Daily Notes/2024/11/2024-11-08 (Friday).md index 6576ca6..529817e 100644 --- a/Daily Notes/2024/11/2024-11-08 (Friday).md +++ b/Daily Notes/2024/11/2024-11-08 (Friday).md @@ -6,3 +6,8 @@ - [ ] Search for specific causes of bad site performance on 11/1 FBOTM day https://faithlife.slack.com/archives/C03R1MQSR51/p1730821466045049?thread_ts=1730477236.809519&cid=C03R1MQSR51 # Summary +I closed on my circuit-consolidation PR to put in a new one to reduce its scope to just cases where using `ExecuteOrThrowOnBrokenCircuit` is effectively a no-op. I excluded the less clear cases. This should get us a majority of the way there to consistent circuit usage. + +Had a re-platform sync meeting with Kyle K. and several others. I'm still not convinced we are gaining anything by moving to Catalyst. +- The search is difficult to replicate correctly--especially if reuse the index we create from our code. +- Checkout appears to need further customization, it won't process $0 orders without requiring a payment method \ No newline at end of file diff --git a/Daily Notes/2024/11/2024-11-11 (Monday).md b/Daily Notes/2024/11/2024-11-11 (Monday).md new file mode 100644 index 0000000..8abe753 --- /dev/null +++ b/Daily Notes/2024/11/2024-11-11 (Monday).md @@ -0,0 +1,6 @@ +Start time: 09:23 +# To-dos + +- [ ] + +# Summary diff --git a/Prayer meeting 2024.09.25.md b/Prayer meeting 2024.09.25.md new file mode 100644 index 0000000..382d283 --- /dev/null +++ b/Prayer meeting 2024.09.25.md @@ -0,0 +1,9 @@ +Israel-hezbollah +Thomas Price traveling +big storm heading for florida +former president trump, assassination attempts +Nicks grandpa in Oregon, thyroid cancer, gone now, but heart issues now, will try abrasion procedure +Barnes, Wortman families with Ian’s passing +Diane, walking today, heart rain sometimes high, need to find meaning + + diff --git a/Prayer meeting.md b/Prayer meeting.md new file mode 100644 index 0000000..e3cba73 --- /dev/null +++ b/Prayer meeting.md @@ -0,0 +1,15 @@ +[[2024-08-21]] + +Emily going to tepsi, +Steve: headed to indiapolis, Emily’s car had some trouble. Patricks fixed it +Mai expecting, quite ill, masashi’s mother passed away this morning, no more details +Ian Barnes, Covid and pneumonia +Ezra and Joanna Brainerd in Brazil, boat fire, all safe but tragic +Phil Kleymann put on hospice +Thomas Price gone 7 of next 8 days +Carl speaking on Sunday +Kathy reddi, Iowa City, safe travels at research conference , paying out of state tuition now on fourth attempt have in state tuition +Ken: rose hill good news club, principal has not returned phone calls to arrange a start time +Carl: neighbor Karen, suspected of grand mal seizure, had to be revived, weak heart, salvation, is Jewish +Steve: folks from Brookfield, would like to attend here. Prau for children and wife to come as well. +