From 1dfbaa30b35db2b463a645e1b8ca2b33f6571a7b Mon Sep 17 00:00:00 2001 From: ScuroNeko Date: Sun, 25 Jan 2026 21:54:51 +0300 Subject: [PATCH] vault backup: 2026-01-25 21:54:51 --- .obsidian/app.json | 26 + .obsidian/appearance.json | 1 + .obsidian/community-plugins.json | 6 + .obsidian/core-plugins.json | 32 + .obsidian/plugins/obsidian-git/data.json | 68 + .obsidian/plugins/obsidian-git/main.js | 442 + .obsidian/plugins/obsidian-git/manifest.json | 10 + .obsidian/plugins/obsidian-git/styles.css | 705 ++ .../plugins/obsidian-icon-folder/data.json | 31 + .../plugins/obsidian-icon-folder/main.js | 7158 +++++++++++++++++ .../obsidian-icon-folder/manifest.json | 10 + .../plugins/obsidian-icon-folder/styles.css | 120 + .obsidian/plugins/obsidian-kanban/main.js | 153 + .../plugins/obsidian-kanban/manifest.json | 11 + .obsidian/plugins/obsidian-kanban/styles.css | 1 + .obsidian/plugins/remotely-save/.gitignore | 1 + .obsidian/plugins/remotely-save/main.js | 235 + .obsidian/plugins/remotely-save/manifest.json | 11 + .obsidian/plugins/remotely-save/styles.css | 244 + .obsidian/workspace-mobile.json | 185 + Вайфу/Основная инфа.md | 5 + РП сеттинг.md | 12 + 22 files changed, 9467 insertions(+) create mode 100644 .obsidian/app.json create mode 100644 .obsidian/appearance.json create mode 100644 .obsidian/community-plugins.json create mode 100644 .obsidian/core-plugins.json create mode 100644 .obsidian/plugins/obsidian-git/data.json create mode 100644 .obsidian/plugins/obsidian-git/main.js create mode 100644 .obsidian/plugins/obsidian-git/manifest.json create mode 100644 .obsidian/plugins/obsidian-git/styles.css create mode 100644 .obsidian/plugins/obsidian-icon-folder/data.json create mode 100644 .obsidian/plugins/obsidian-icon-folder/main.js create mode 100644 .obsidian/plugins/obsidian-icon-folder/manifest.json create mode 100644 .obsidian/plugins/obsidian-icon-folder/styles.css create mode 100644 .obsidian/plugins/obsidian-kanban/main.js create mode 100644 .obsidian/plugins/obsidian-kanban/manifest.json create mode 100644 .obsidian/plugins/obsidian-kanban/styles.css create mode 100644 .obsidian/plugins/remotely-save/.gitignore create mode 100644 .obsidian/plugins/remotely-save/main.js create mode 100644 .obsidian/plugins/remotely-save/manifest.json create mode 100644 .obsidian/plugins/remotely-save/styles.css create mode 100644 .obsidian/workspace-mobile.json create mode 100644 Вайфу/Основная инфа.md create mode 100644 РП сеттинг.md diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..b961be6 --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1,26 @@ +{ + "promptDelete": false, + "mobileToolbarCommands": [ + "editor:undo", + "editor:redo", + "editor:insert-wikilink", + "editor:insert-embed", + "editor:insert-tag", + "editor:attach-file", + "editor:set-heading", + "editor:toggle-bold", + "editor:toggle-italics", + "editor:toggle-strikethrough", + "editor:toggle-highlight", + "editor:toggle-code", + "editor:toggle-blockquote", + "editor:insert-link", + "editor:toggle-bullet-list", + "editor:toggle-numbered-list", + "editor:toggle-checklist-status", + "editor:indent-list", + "editor:unindent-list", + "editor:configure-toolbar", + "editor:insert-table" + ] +} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..3dbc650 --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,6 @@ +[ + "obsidian-icon-folder", + "obsidian-kanban", + "remotely-save", + "obsidian-git" +] \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..3f2ab43 --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,32 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "footnotes": false, + "properties": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "bases": true +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/data.json b/.obsidian/plugins/obsidian-git/data.json new file mode 100644 index 0000000..5bf0056 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/data.json @@ -0,0 +1,68 @@ +{ + "commitMessage": "vault backup: {{date}}", + "autoCommitMessage": "vault backup: {{date}}", + "commitMessageScript": "", + "commitDateFormat": "YYYY-MM-DD HH:mm:ss", + "autoSaveInterval": 0, + "autoPushInterval": 0, + "autoPullInterval": 0, + "autoPullOnBoot": false, + "autoCommitOnlyStaged": false, + "disablePush": false, + "pullBeforePush": true, + "disablePopups": false, + "showErrorNotices": true, + "disablePopupsForNoChanges": false, + "listChangedFilesInMessageBody": false, + "showStatusBar": true, + "updateSubmodules": false, + "syncMethod": "merge", + "mergeStrategy": "none", + "customMessageOnAutoBackup": false, + "autoBackupAfterFileChange": false, + "treeStructure": true, + "refreshSourceControl": false, + "basePath": "", + "differentIntervalCommitAndPush": false, + "changedFilesInStatusBar": false, + "showedMobileNotice": true, + "refreshSourceControlTimer": 7000, + "showBranchStatusBar": true, + "setLastSaveToLastCommit": false, + "submoduleRecurseCheckout": false, + "gitDir": "", + "showFileMenu": true, + "authorInHistoryView": "hide", + "dateInHistoryView": false, + "diffStyle": "split", + "hunks": { + "showSigns": false, + "hunkCommands": false, + "statusBar": "disabled" + }, + "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, + "lastShownAuthorDisplay": "initials", + "lastShownDateTimeFormatOptions": "date" + } +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/main.js b/.obsidian/plugins/obsidian-git/main.js new file mode 100644 index 0000000..b49e4e3 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/main.js @@ -0,0 +1,442 @@ +/* +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 zM=Object.create;var Rl=Object.defineProperty;var VM=Object.getOwnPropertyDescriptor;var WM=Object.getOwnPropertyNames;var YM=Object.getPrototypeOf,XM=Object.prototype.hasOwnProperty;var Jy=t=>{throw TypeError(t)};var ZM=(t,e,r)=>e in t?Rl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var KM=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),JM=(t,e)=>{for(var r in e)Rl(t,r,{get:e[r],enumerable:!0})},Qy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of WM(e))!XM.call(t,i)&&i!==r&&Rl(t,i,{get:()=>e[i],enumerable:!(n=VM(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?zM(YM(t)):{},Qy(e||!t||!t.__esModule?Rl(r,"default",{value:t,enumerable:!0}):r,t)),QM=t=>Qy(Rl({},"__esModule",{value:!0}),t);var vt=(t,e,r)=>ZM(t,typeof e!="symbol"?e+"":e,r),Gp=(t,e,r)=>e.has(t)||Jy("Cannot "+r);var le=(t,e,r)=>(Gp(t,e,"read from private field"),r?r.call(t):e.get(t)),wt=(t,e,r)=>e.has(t)?Jy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ot=(t,e,r,n)=>(Gp(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),vi=(t,e,r)=>(Gp(t,e,"access private method"),r);var rb=I(Wu=>{"use strict";p();Wu.byteLength=tD;Wu.toByteArray=nD;Wu.fromByteArray=sD;var Dn=[],Yr=[],eD=typeof Uint8Array!="undefined"?Uint8Array:Array,qp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(La=0,eb=qp.length;La0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function tD(t){var e=tb(t),r=e[0],n=e[1];return(r+n)*3/4-n}function rD(t,e,r){return(e+r)*3/4-r}function nD(t){var e,r=tb(t),n=r[0],i=r[1],a=new eD(rD(t,n,i)),s=0,o=i>0?n-4:n,l;for(l=0;l>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Yr[t.charCodeAt(l)]<<2|Yr[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Yr[t.charCodeAt(l)]<<10|Yr[t.charCodeAt(l+1)]<<4|Yr[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function iD(t){return Dn[t>>18&63]+Dn[t>>12&63]+Dn[t>>6&63]+Dn[t&63]}function aD(t,e,r){for(var n,i=[],a=e;ao?o:s+a));return n===1?(e=t[r-1],i.push(Dn[e>>2]+Dn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Dn[e>>10]+Dn[e>>4&63]+Dn[e<<2&63]+"=")),i.join("")}});var nb=I(zp=>{p();zp.read=function(t,e,r,n,i){var a,s,o=i*8-n-1,l=(1<>1,c=-7,f=r?i-1:0,d=r?-1:1,h=t[e+f];for(f+=d,a=h&(1<<-c)-1,h>>=-c,c+=o;c>0;a=a*256+t[e+f],f+=d,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=n;c>0;s=s*256+t[e+f],f+=d,c-=8);if(a===0)a=1-u;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-u}return(h?-1:1)*s*Math.pow(2,a-n)};zp.write=function(t,e,r,n,i,a){var s,o,l,u=a*8-i-1,c=(1<>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,m=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=c):(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>=c?(o=0,s=c):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[r+h]=o&255,h+=m,o/=256,i-=8);for(s=s<0;t[r+h]=s&255,h+=m,s/=256,u-=8);t[r+h-m]|=g*128}});var em=I(Ws=>{"use strict";p();var Vp=rb(),zs=nb(),ib=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ws.Buffer=$;Ws.SlowBuffer=dD;Ws.INSPECT_MAX_BYTES=50;var Yu=2147483647;Ws.kMaxLength=Yu;$.TYPED_ARRAY_SUPPORT=oD();!$.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 oD(){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($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function wi(t){if(t>Yu)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Zp(t)}return lb(t,e,r)}$.poolSize=8192;function lb(t,e,r){if(typeof t=="string")return cD(t,e);if(ArrayBuffer.isView(t))return uD(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ln(t,ArrayBuffer)||t&&Ln(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Ln(t,SharedArrayBuffer)||t&&Ln(t.buffer,SharedArrayBuffer)))return Yp(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return $.from(n,e,r);let i=fD(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}$.from=function(t,e,r){return lb(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function cb(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 lD(t,e,r){return cb(t),t<=0?wi(t):e!==void 0?typeof r=="string"?wi(t).fill(e,r):wi(t).fill(e):wi(t)}$.alloc=function(t,e,r){return lD(t,e,r)};function Zp(t){return cb(t),wi(t<0?0:Kp(t)|0)}$.allocUnsafe=function(t){return Zp(t)};$.allocUnsafeSlow=function(t){return Zp(t)};function cD(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ub(t,e)|0,n=wi(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Wp(t){let e=t.length<0?0:Kp(t.length)|0,r=wi(e);for(let n=0;n=Yu)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yu.toString(16)+" bytes");return t|0}function dD(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(Ln(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),Ln(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let a=0,s=Math.min(n,i);ai.length?($.isBuffer(s)||(s=$.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if($.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function ub(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ln(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Xp(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return yb(t).length;default:if(i)return n?-1:Xp(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=ub;function hD(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return SD(this,e,r);case"utf8":case"utf-8":return db(this,e,r);case"ascii":return _D(this,e,r);case"latin1":case"binary":return xD(this,e,r);case"base64":return yD(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ED(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Na(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}$.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};ib&&($.prototype[ib]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,a){if(Ln(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===e)return 0;let s=a-i,o=n-r,l=Math.min(s,o),u=this.slice(i,a),c=e.slice(r,n);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Qp(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:ab(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ab(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ab(t,e,r,n,i){let a=1,s=t.length,o=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;a=2,s/=2,o/=2,r/=2}function l(c,f){return a===1?c[f]:c.readUInt16BE(f*a)}let u;if(i){let c=-1;for(u=r;us&&(r=s-o),u=r;u>=0;u--){let c=!0;for(let f=0;fi&&(n=i)):n=i;let a=e.length;n>a/2&&(n=a/2);let s;for(s=0;s>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-r;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return pD(this,e,r,n);case"utf8":case"utf-8":return mD(this,e,r,n);case"ascii":case"latin1":case"binary":return gD(this,e,r,n);case"base64":return vD(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wD(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function yD(t,e,r){return e===0&&r===t.length?Vp.fromByteArray(t):Vp.fromByteArray(t.slice(e,r))}function db(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:a>223?3:a>191?2:1;if(i+o<=r){let l,u,c,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],u=t[i+2],(l&192)===128&&(u&192)===128&&(f=(a&15)<<12|(l&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(f=(a&15)<<18|(l&63)<<12|(u&63)<<6|c&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=o}return bD(n)}var sb=4096;function bD(t){let e=t.length;if(e<=sb)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let a=e;an&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||_t(e,r,this.length);let i=this[e],a=1,s=0;for(;++s>>0,r=r>>>0,n||_t(e,r,this.length);let i=this[e+--r],a=1;for(;r>0&&(a*=256);)i+=this[e+--r]*a;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||_t(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||_t(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||_t(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readBigUInt64LE=Zi(function(e){e=e>>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=r*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+n;return(BigInt(i)<>>0,r=r>>>0,n||_t(e,r,this.length);let i=this[e],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||_t(e,r,this.length);let i=r,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*r)),s};$.prototype.readInt8=function(e,r){return e=e>>>0,r||_t(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||_t(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||_t(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readBigInt64LE=Zi(function(e){e=e>>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||_t(e,4,this.length),zs.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),zs.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||_t(e,8,this.length),zs.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||_t(e,8,this.length),zs.read(this,e,!1,52,8)};function ur(t,e,r,n,i,a){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;ur(this,e,r,n,o,0)}let a=1,s=0;for(this[r]=e&255;++s>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;ur(this,e,r,n,o,0)}let a=n-1,s=1;for(this[r+a]=e&255;--a>=0&&(s*=256);)this[r+a]=e/s&255;return r+n};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function hb(t,e,r,n,i){wb(e,n,i,t,r,7);let a=Number(e&BigInt(4294967295));t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,r}function pb(t,e,r,n,i){wb(e,n,i,t,r,7);let a=Number(e&BigInt(4294967295));t[r+7]=a,a=a>>8,t[r+6]=a,a=a>>8,t[r+5]=a,a=a>>8,t[r+4]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s=s>>8,t[r+2]=s,s=s>>8,t[r+1]=s,s=s>>8,t[r]=s,r+8}$.prototype.writeBigUInt64LE=Zi(function(e,r=0){return hb(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeBigUInt64BE=Zi(function(e,r=0){return pb(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);ur(this,e,r,n,l-1,-l)}let a=0,s=1,o=0;for(this[r]=e&255;++a>0)-o&255;return r+n};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);ur(this,e,r,n,l-1,-l)}let a=n-1,s=1,o=0;for(this[r+a]=e&255;--a>=0&&(s*=256);)e<0&&o===0&&this[r+a+1]!==0&&(o=1),this[r+a]=(e/s>>0)-o&255;return r+n};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};$.prototype.writeBigInt64LE=Zi(function(e,r=0){return hb(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$.prototype.writeBigInt64BE=Zi(function(e,r=0){return pb(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mb(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function gb(t,e,r,n,i){return e=+e,r=r>>>0,i||mb(t,e,r,4,34028234663852886e22,-34028234663852886e22),zs.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return gb(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return gb(this,e,r,!1,n)};function vb(t,e,r,n,i){return e=+e,r=r>>>0,i||mb(t,e,r,8,17976931348623157e292,-17976931348623157e292),zs.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return vb(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return vb(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=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-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let a;if(typeof e=="number")for(a=r;a2**32?i=ob(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=ob(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function ob(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function kD(t,e,r){Vs(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Il(e,t.length-(r+1))}function wb(t,e,r,n,i,a){if(t>r||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 <= ${r}${s}`,new qs.ERR_OUT_OF_RANGE("value",o,t)}kD(n,i,a)}function Vs(t,e){if(typeof t!="number")throw new qs.ERR_INVALID_ARG_TYPE(e,"number",t)}function Il(t,e,r){throw Math.floor(t)!==t?(Vs(t,r),new qs.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new qs.ERR_BUFFER_OUT_OF_BOUNDS:new qs.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var AD=/[^+/0-9A-Za-z-_]/g;function TD(t){if(t=t.split("=")[0],t=t.trim().replace(AD,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Xp(t,e){e=e||1/0;let r,n=t.length,i=null,a=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function CD(t){let e=[];for(let r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function yb(t){return Vp.toByteArray(TD(t))}function Xu(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Ln(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Qp(t){return t!==t}var RD=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Zi(t){return typeof BigInt=="undefined"?ID:t}function ID(){throw new Error("BigInt not supported")}});var bb,tm,Buffer,p=KM(()=>{bb=require("obsidian");bb.Platform.isMobileApp?tm=em().Buffer:tm=global.Buffer;Buffer=tm});var xb=I((D9,_b)=>{"use strict";p();var Rr=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||Rr.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Rr.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Rr.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Rr.DEFAULT_MAX_PENDING};Rr.DEFAULT_TIMEOUT=0;Rr.DEFAULT_MAX_OCCUPATION_TIME=0;Rr.DEFAULT_MAX_EXECUTION_TIME=0;Rr.DEFAULT_MAX_PENDING=1e3;Rr.prototype.acquire=function(t,e,r,n){if(Array.isArray(t))return this._acquireBatch(t,e,r,n);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof r!="function"&&(n=r,r=null,s=new this.Promise(function(b,E){i=b,a=E})),n=n||{};var o=!1,l=null,u=null,c=null,f=this,d=function(b,E,x){u&&(clearTimeout(u),u=null),c&&(clearTimeout(c),c=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(s?E?a(E):i(x):typeof r=="function"&&r(E,x),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 E=n.maxExecutionTime||f.maxExecutionTime;if(E&&(c=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},E)),e.length===1){var x=!1;try{e(function(k,A){x||(x=!0,d(b,k,A))})}catch(k){x||(x=!0,d(b,k))}}else f._promiseTry(function(){return e()}).then(function(k){d(b,void 0,k)},function(k){d(b,k)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var m=n.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>=m)d(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){h(!0)};n.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var v=n.timeout||f.timeout;v&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},v))}var w=n.maxOccupationTime||f.maxOccupationTime;if(w&&(u=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),s)return s};Rr.prototype._acquireBatch=function(t,e,r,n){typeof r!="function"&&(n=r,r=null);var i=this,a=function(o,l){return function(u){i.acquire(o,l,u,n)}},s=t.reduceRight(function(o,l){return a(l,o)},e);if(typeof r=="function")s(r);else return new this.Promise(function(o,l){s.length===1?s(function(u,c){u?l(u):o(c)}):o(s())})};Rr.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Rr.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};_b.exports=Rr});var Eb=I((N9,Sb)=>{"use strict";p();Sb.exports=xb()});var kb=I((H9,rm)=>{p();typeof Object.create=="function"?rm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:rm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Ku=I((nm,Tb)=>{p();var Zu=em(),Nn=Zu.Buffer;function Ab(t,e){for(var r in t)e[r]=t[r]}Nn.from&&Nn.alloc&&Nn.allocUnsafe&&Nn.allocUnsafeSlow?Tb.exports=Zu:(Ab(Zu,nm),nm.Buffer=Ba);function Ba(t,e,r){return Nn(t,e,r)}Ba.prototype=Object.create(Nn.prototype);Ab(Nn,Ba);Ba.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Nn(t,e,r)};Ba.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Nn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ba.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Nn(t)};Ba.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Zu.SlowBuffer(t)}});var Ju=I((G9,Cb)=>{p();var $D={}.toString;Cb.exports=Array.isArray||function(t){return $D.call(t)=="[object Array]"}});var fr=I((z9,Pb)=>{"use strict";p();Pb.exports=TypeError});var Qu=I((W9,Rb)=>{"use strict";p();Rb.exports=Object});var im=I((X9,Ib)=>{"use strict";p();Ib.exports=Error});var Fb=I((K9,$b)=>{"use strict";p();$b.exports=EvalError});var Mb=I((Q9,Ob)=>{"use strict";p();Ob.exports=RangeError});var Lb=I((t7,Db)=>{"use strict";p();Db.exports=ReferenceError});var ef=I((n7,Nb)=>{"use strict";p();Nb.exports=SyntaxError});var Hb=I((a7,Bb)=>{"use strict";p();Bb.exports=URIError});var jb=I((o7,Ub)=>{"use strict";p();Ub.exports=Math.abs});var qb=I((c7,Gb)=>{"use strict";p();Gb.exports=Math.floor});var Vb=I((f7,zb)=>{"use strict";p();zb.exports=Math.max});var Yb=I((h7,Wb)=>{"use strict";p();Wb.exports=Math.min});var Zb=I((m7,Xb)=>{"use strict";p();Xb.exports=Math.pow});var Jb=I((v7,Kb)=>{"use strict";p();Kb.exports=Math.round});var e_=I((y7,Qb)=>{"use strict";p();Qb.exports=Number.isNaN||function(e){return e!==e}});var r_=I((_7,t_)=>{"use strict";p();var FD=e_();t_.exports=function(e){return FD(e)||e===0?e:e<0?-1:1}});var i_=I((S7,n_)=>{"use strict";p();n_.exports=Object.getOwnPropertyDescriptor});var Ki=I((k7,a_)=>{"use strict";p();var tf=i_();if(tf)try{tf([],"length")}catch(t){tf=null}a_.exports=tf});var $l=I((T7,s_)=>{"use strict";p();var rf=Object.defineProperty||!1;if(rf)try{rf({},"a",{value:1})}catch(t){rf=!1}s_.exports=rf});var Fl=I((P7,o_)=>{"use strict";p();o_.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var a 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 s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var nf=I((I7,c_)=>{"use strict";p();var l_=typeof Symbol!="undefined"&&Symbol,OD=Fl();c_.exports=function(){return typeof l_!="function"||typeof Symbol!="function"||typeof l_("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:OD()}});var am=I((F7,u_)=>{"use strict";p();u_.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var sm=I((M7,f_)=>{"use strict";p();var MD=Qu();f_.exports=MD.getPrototypeOf||null});var p_=I((L7,h_)=>{"use strict";p();var DD="Function.prototype.bind called on incompatible ",LD=Object.prototype.toString,ND=Math.max,BD="[object Function]",d_=function(e,r){for(var n=[],i=0;i{"use strict";p();var jD=p_();m_.exports=Function.prototype.bind||jD});var af=I((U7,g_)=>{"use strict";p();g_.exports=Function.prototype.call});var sf=I((G7,v_)=>{"use strict";p();v_.exports=Function.prototype.apply});var y_=I((z7,w_)=>{"use strict";p();w_.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var om=I((W7,b_)=>{"use strict";p();var GD=Ys(),qD=sf(),zD=af(),VD=y_();b_.exports=VD||GD.call(zD,qD)});var of=I((X7,__)=>{"use strict";p();var WD=Ys(),YD=fr(),XD=af(),ZD=om();__.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new YD("a function is required");return ZD(WD,XD,e)}});var T_=I((K7,A_)=>{"use strict";p();var KD=of(),x_=Ki(),E_;try{E_=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var lm=!!E_&&x_&&x_(Object.prototype,"__proto__"),k_=Object,S_=k_.getPrototypeOf;A_.exports=lm&&typeof lm.get=="function"?KD([lm.get]):typeof S_=="function"?function(e){return S_(e==null?e:k_(e))}:!1});var lf=I((Q7,I_)=>{"use strict";p();var C_=am(),P_=sm(),R_=T_();I_.exports=C_?function(e){return C_(e)}:P_?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return P_(e)}:R_?function(e){return R_(e)}:null});var cf=I((tY,$_)=>{"use strict";p();var JD=Function.prototype.call,QD=Object.prototype.hasOwnProperty,eL=Ys();$_.exports=eL.call(JD,QD)});var Bn=I((nY,N_)=>{"use strict";p();var be,tL=Qu(),rL=im(),nL=Fb(),iL=Mb(),aL=Lb(),Js=ef(),Ks=fr(),sL=Hb(),oL=jb(),lL=qb(),cL=Vb(),uL=Yb(),fL=Zb(),dL=Jb(),hL=r_(),D_=Function,cm=function(t){try{return D_('"use strict"; return ('+t+").constructor;")()}catch(e){}},Ol=Ki(),pL=$l(),um=function(){throw new Ks},mL=Ol?function(){try{return arguments.callee,um}catch(t){try{return Ol(arguments,"callee").get}catch(e){return um}}}():um,Xs=nf()(),xt=lf(),gL=sm(),vL=am(),L_=sf(),Ml=af(),Zs={},wL=typeof Uint8Array=="undefined"||!xt?be:xt(Uint8Array),Ha={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?be:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?be:ArrayBuffer,"%ArrayIteratorPrototype%":Xs&&xt?xt([][Symbol.iterator]()):be,"%AsyncFromSyncIteratorPrototype%":be,"%AsyncFunction%":Zs,"%AsyncGenerator%":Zs,"%AsyncGeneratorFunction%":Zs,"%AsyncIteratorPrototype%":Zs,"%Atomics%":typeof Atomics=="undefined"?be:Atomics,"%BigInt%":typeof BigInt=="undefined"?be:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?be:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?be:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?be:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":rL,"%eval%":eval,"%EvalError%":nL,"%Float16Array%":typeof Float16Array=="undefined"?be:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?be:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?be:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?be:FinalizationRegistry,"%Function%":D_,"%GeneratorFunction%":Zs,"%Int8Array%":typeof Int8Array=="undefined"?be:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?be:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?be:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Xs&&xt?xt(xt([][Symbol.iterator]())):be,"%JSON%":typeof JSON=="object"?JSON:be,"%Map%":typeof Map=="undefined"?be:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Xs||!xt?be:xt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":tL,"%Object.getOwnPropertyDescriptor%":Ol,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?be:Promise,"%Proxy%":typeof Proxy=="undefined"?be:Proxy,"%RangeError%":iL,"%ReferenceError%":aL,"%Reflect%":typeof Reflect=="undefined"?be:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?be:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Xs||!xt?be:xt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?be:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Xs&&xt?xt(""[Symbol.iterator]()):be,"%Symbol%":Xs?Symbol:be,"%SyntaxError%":Js,"%ThrowTypeError%":mL,"%TypedArray%":wL,"%TypeError%":Ks,"%Uint8Array%":typeof Uint8Array=="undefined"?be:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?be:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?be:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?be:Uint32Array,"%URIError%":sL,"%WeakMap%":typeof WeakMap=="undefined"?be:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?be:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?be:WeakSet,"%Function.prototype.call%":Ml,"%Function.prototype.apply%":L_,"%Object.defineProperty%":pL,"%Object.getPrototypeOf%":gL,"%Math.abs%":oL,"%Math.floor%":lL,"%Math.max%":cL,"%Math.min%":uL,"%Math.pow%":fL,"%Math.round%":dL,"%Math.sign%":hL,"%Reflect.getPrototypeOf%":vL};if(xt)try{null.error}catch(t){F_=xt(xt(t)),Ha["%Error.prototype%"]=F_}var F_,yL=function t(e){var r;if(e==="%AsyncFunction%")r=cm("async function () {}");else if(e==="%GeneratorFunction%")r=cm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=cm("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&xt&&(r=xt(i.prototype))}return Ha[e]=r,r},O_={__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"]},Dl=Ys(),uf=cf(),bL=Dl.call(Ml,Array.prototype.concat),_L=Dl.call(L_,Array.prototype.splice),M_=Dl.call(Ml,String.prototype.replace),ff=Dl.call(Ml,String.prototype.slice),xL=Dl.call(Ml,RegExp.prototype.exec),SL=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,EL=/\\(\\)?/g,kL=function(e){var r=ff(e,0,1),n=ff(e,-1);if(r==="%"&&n!=="%")throw new Js("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Js("invalid intrinsic syntax, expected opening `%`");var i=[];return M_(e,SL,function(a,s,o,l){i[i.length]=o?M_(l,EL,"$1"):s||a}),i},AL=function(e,r){var n=e,i;if(uf(O_,n)&&(i=O_[n],n="%"+i[0]+"%"),uf(Ha,n)){var a=Ha[n];if(a===Zs&&(a=yL(n)),typeof a=="undefined"&&!r)throw new Ks("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Js("intrinsic "+e+" does not exist!")};N_.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Ks("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ks('"allowMissing" argument must be a boolean');if(xL(/^%?[^%]*%?$/,e)===null)throw new Js("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=kL(e),i=n.length>0?n[0]:"",a=AL("%"+i+"%",r),s=a.name,o=a.value,l=!1,u=a.alias;u&&(i=u[0],_L(n,bL([0,1],u)));for(var c=1,f=!0;c=n.length){var g=Ol(o,d);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[d]}else f=uf(o,d),o=o[d];f&&!l&&(Ha[s]=o)}}return o}});var St=I((aY,U_)=>{"use strict";p();var B_=Bn(),H_=of(),TL=H_([B_("%String.prototype.indexOf%")]);U_.exports=function(e,r){var n=B_(e,!!r);return typeof n=="function"&&TL(e,".prototype.")>-1?H_([n]):n}});var z_=I((oY,q_)=>{"use strict";p();var G_=Function.prototype.toString,Qs=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,dm,df;if(typeof Qs=="function"&&typeof Object.defineProperty=="function")try{dm=Object.defineProperty({},"length",{get:function(){throw df}}),df={},Qs(function(){throw 42},null,dm)}catch(t){t!==df&&(Qs=null)}else Qs=null;var CL=/^\s*class\b/,hm=function(e){try{var r=G_.call(e);return CL.test(r)}catch(n){return!1}},fm=function(e){try{return hm(e)?!1:(G_.call(e),!0)}catch(r){return!1}},hf=Object.prototype.toString,PL="[object Object]",RL="[object Function]",IL="[object GeneratorFunction]",$L="[object HTMLAllCollection]",FL="[object HTML document.all class]",OL="[object HTMLCollection]",ML=typeof Symbol=="function"&&!!Symbol.toStringTag,DL=!(0 in[,]),pm=function(){return!1};typeof document=="object"&&(j_=document.all,hf.call(j_)===hf.call(document.all)&&(pm=function(e){if((DL||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var r=hf.call(e);return(r===$L||r===FL||r===OL||r===PL)&&e("")==null}catch(n){}return!1}));var j_;q_.exports=Qs?function(e){if(pm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Qs(e,null,dm)}catch(r){if(r!==df)return!1}return!hm(e)&&fm(e)}:function(e){if(pm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(ML)return fm(e);if(hm(e))return!1;var r=hf.call(e);return r!==RL&&r!==IL&&!/^\[object HTML/.test(r)?!1:fm(e)}});var Y_=I((cY,W_)=>{"use strict";p();var LL=z_(),NL=Object.prototype.toString,V_=Object.prototype.hasOwnProperty,BL=function(e,r,n){for(var i=0,a=e.length;i=3&&(i=n),jL(e)?BL(e,r,i):typeof e=="string"?HL(e,r,i):UL(e,r,i)}});var Z_=I((fY,X_)=>{"use strict";p();X_.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var J_=I((hY,K_)=>{"use strict";p();var mm=Z_(),GL=typeof globalThis=="undefined"?global:globalThis;K_.exports=function(){for(var e=[],r=0;r{"use strict";p();var Q_=$l(),qL=ef(),eo=fr(),ex=Ki();tx.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new eo("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new eo("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new eo("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new eo("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new eo("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new eo("`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=!!ex&&ex(e,r);if(Q_)Q_(e,r,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:a===null&&l?l.writable:!a});else if(o||!i&&!a&&!s)e[r]=n;else throw new qL("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var mf=I((vY,nx)=>{"use strict";p();var gm=$l(),rx=function(){return!!gm};rx.hasArrayLengthDefineBug=function(){if(!gm)return null;try{return gm([],"length",{value:1}).length!==1}catch(e){return!0}};nx.exports=rx});var lx=I((yY,ox)=>{"use strict";p();var zL=Bn(),ix=pf(),VL=mf()(),ax=Ki(),sx=fr(),WL=zL("%Math.floor%");ox.exports=function(e,r){if(typeof e!="function")throw new sx("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||WL(r)!==r)throw new sx("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&ax){var s=ax(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!n)&&(VL?ix(e,"length",r,!0,!0):ix(e,"length",r)),e}});var ux=I((_Y,cx)=>{"use strict";p();var YL=Ys(),XL=sf(),ZL=om();cx.exports=function(){return ZL(YL,XL,arguments)}});var Ua=I((SY,gf)=>{"use strict";p();var KL=lx(),fx=$l(),JL=of(),dx=ux();gf.exports=function(e){var r=JL(arguments),n=e.length-(arguments.length-1);return KL(r,1+(n>0?n:0),!0)};fx?fx(gf.exports,"apply",{value:dx}):gf.exports.apply=dx});var Ji=I((kY,hx)=>{"use strict";p();var QL=Fl();hx.exports=function(){return QL()&&!!Symbol.toStringTag}});var bm=I((TY,vx)=>{"use strict";p();var yf=Y_(),eN=J_(),px=Ua(),wm=St(),wf=Ki(),vf=lf(),tN=wm("Object.prototype.toString"),gx=Ji()(),mx=typeof globalThis=="undefined"?global:globalThis,vm=eN(),ym=wm("String.prototype.slice"),rN=wm("Array.prototype.indexOf",!0)||function(e,r){for(var n=0;n-1?r:r!=="Object"?!1:iN(e)}return wf?nN(e):null}});var yx=I((PY,wx)=>{"use strict";p();var aN=bm();wx.exports=function(e){return!!aN(e)}});var _x=I((IY,bx)=>{"use strict";p();var sN=fr(),oN=St(),lN=oN("TypedArray.prototype.buffer",!0),cN=yx();bx.exports=lN||function(e){if(!cN(e))throw new sN("Not a Typed Array");return e.buffer}});var Ex=I((FY,Sx)=>{"use strict";p();var Hn=Ku().Buffer,uN=Ju(),fN=_x(),dN=ArrayBuffer.isView||function(e){try{return fN(e),!0}catch(r){return!1}},hN=typeof Uint8Array!="undefined",xx=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",pN=xx&&(Hn.prototype instanceof Uint8Array||Hn.TYPED_ARRAY_SUPPORT);Sx.exports=function(e,r){if(e instanceof Hn)return e;if(typeof e=="string")return Hn.from(e,r);if(xx&&dN(e)){if(e.byteLength===0)return Hn.alloc(0);if(pN){var n=Hn.from(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength===e.byteLength)return n}var i=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=Hn.from(i);if(a.length===e.byteLength)return a}if(hN&&e instanceof Uint8Array)return Hn.from(e);var s=uN(e);if(s)for(var o=0;o255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(s||Hn.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Hn.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var Ax=I((MY,kx)=>{"use strict";p();var mN=Ku().Buffer,gN=Ex();function _f(t,e){this._block=mN.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}_f.prototype.update=function(t,e){t=gN(t,e||"utf8");for(var r=this._block,n=this._blockSize,i=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a};_f.prototype._update=function(){throw new Error("_update must be implemented by subclass")};kx.exports=_f});var Px=I((LY,Cx)=>{"use strict";p();var vN=kb(),Tx=Ax(),wN=Ku().Buffer,yN=[1518500249,1859775393,-1894007588,-899497514],bN=new Array(80);function Ll(){this.init(),this._w=bN,Tx.call(this,64,56)}vN(Ll,Tx);Ll.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function _N(t){return t<<1|t>>>31}function xN(t){return t<<5|t>>>27}function SN(t){return t<<30|t>>>2}function EN(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}Ll.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=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]=_N(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var u=~~(l/20),c=xN(r)+EN(u,n,i,a)+s+e[l]+yN[u]|0;s=a,a=i,i=SN(n),n=r,r=c}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Ll.prototype._hash=function(){var t=wN.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};Cx.exports=Ll});var $x=I((BY,Ix)=>{"use strict";p();function Un(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function Rx(t,e){for(var r="",n=0,i=-1,a=0,s,o=0;o<=t.length;++o){if(o2){var l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}}else if(r.length===2||r.length===1){r="",n=0,i=o,a=0;continue}}e&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,a=0}else s===46&&a!==-1?++a:a=-1}return r}function kN(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+t+n:n}var to={resolve:function(){for(var e="",r=!1,n,i=arguments.length-1;i>=-1&&!r;i--){var a;i>=0?a=arguments[i]:(n===void 0&&(n=process.cwd()),a=n),Un(a),a.length!==0&&(e=a+"/"+e,r=a.charCodeAt(0)===47)}return e=Rx(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Un(e),e.length===0)return".";var r=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Rx(e,!r),e.length===0&&!r&&(e="."),e.length>0&&n&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return Un(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,r=0;r0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":to.normalize(e)},relative:function(e,r){if(Un(e),Un(r),e===r||(e=to.resolve(e),r=to.resolve(r),e===r))return"";for(var n=1;nu){if(r.charCodeAt(s+f)===47)return r.slice(s+f+1);if(f===0)return r.slice(s+f)}else a>u&&(e.charCodeAt(n+f)===47?c=f:f===0&&(c=0));break}var d=e.charCodeAt(n+f),h=r.charCodeAt(s+f);if(d!==h)break;d===47&&(c=f)}var m="";for(f=n+c+1;f<=i;++f)(f===i||e.charCodeAt(f)===47)&&(m.length===0?m+="..":m+="/..");return m.length>0?m+r.slice(s+c):(s+=c,r.charCodeAt(s)===47&&++s,r.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(Un(e),e.length===0)return".";for(var r=e.charCodeAt(0),n=r===47,i=-1,a=!0,s=e.length-1;s>=1;--s)if(r=e.charCodeAt(s),r===47){if(!a){i=s;break}}else a=!1;return i===-1?n?"/":".":n&&i===1?"//":e.slice(0,i)},basename:function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Un(e);var n=0,i=-1,a=!0,s;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var o=r.length-1,l=-1;for(s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(u===47){if(!a){n=s+1;break}}else l===-1&&(a=!1,l=s+1),o>=0&&(u===r.charCodeAt(o)?--o===-1&&(i=s):(o=-1,i=l))}return n===i?i=l:i===-1&&(i=e.length),e.slice(n,i)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!a){n=s+1;break}}else i===-1&&(a=!1,i=s+1);return i===-1?"":e.slice(n,i)}},extname:function(e){Un(e);for(var r=-1,n=0,i=-1,a=!0,s=0,o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!a){n=o+1;break}continue}i===-1&&(a=!1,i=o+1),l===46?r===-1?r=o:s!==1&&(s=1):r!==-1&&(s=-1)}return r===-1||i===-1||s===0||s===1&&r===i-1&&r===n+1?"":e.slice(r,i)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return kN("/",e)},parse:function(e){Un(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var n=e.charCodeAt(0),i=n===47,a;i?(r.root="/",a=1):a=0;for(var s=-1,o=0,l=-1,u=!0,c=e.length-1,f=0;c>=a;--c){if(n=e.charCodeAt(c),n===47){if(!u){o=c+1;break}continue}l===-1&&(u=!1,l=c+1),n===46?s===-1?s=c:f!==1&&(f=1):s!==-1&&(f=-1)}return s===-1||l===-1||f===0||f===1&&s===l-1&&s===o+1?l!==-1&&(o===0&&i?r.base=r.name=e.slice(1,l):r.base=r.name=e.slice(o,l)):(o===0&&i?(r.name=e.slice(1,s),r.base=e.slice(1,l)):(r.name=e.slice(o,s),r.base=e.slice(o,l)),r.ext=e.slice(s,l)),o>0?r.dir=e.slice(0,o-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};to.posix=to;Ix.exports=to});var Ox=I(_m=>{p();var Fx;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof _m=="object"?t(_m):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(Fx={}):t(Fx={})})(function(t){t.version="1.2.2";function e(){for(var y=0,S=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,S[_]=y;return typeof Int32Array!="undefined"?new Int32Array(S):S}var r=e();function n(y){var S=0,_=0,T=0,P=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(T=0;T!=256;++T)P[T]=y[T];for(T=0;T!=256;++T)for(_=y[T],S=256+T;S<4096;S+=256)_=P[S]=_>>>8^y[_&255];var F=[];for(T=1;T!=16;++T)F[T-1]=typeof Int32Array!="undefined"?P.subarray(T*256,T*256+256):P.slice(T*256,T*256+256);return F}var i=n(r),a=i[0],s=i[1],o=i[2],l=i[3],u=i[4],c=i[5],f=i[6],d=i[7],h=i[8],m=i[9],g=i[10],v=i[11],w=i[12],b=i[13],E=i[14];function x(y,S){for(var _=S^-1,T=0,P=y.length;T>>8^r[(_^y.charCodeAt(T++))&255];return~_}function k(y,S){for(var _=S^-1,T=y.length-15,P=0;P>8&255]^w[y[P++]^_>>16&255]^v[y[P++]^_>>>24]^g[y[P++]]^m[y[P++]]^h[y[P++]]^d[y[P++]]^f[y[P++]]^c[y[P++]]^u[y[P++]]^l[y[P++]]^o[y[P++]]^s[y[P++]]^a[y[P++]]^r[y[P++]];for(T+=15;P>>8^r[(_^y[P++])&255];return~_}function A(y,S){for(var _=S^-1,T=0,P=y.length,F=0,D=0;T>>8^r[(_^F)&255]:F<2048?(_=_>>>8^r[(_^(192|F>>6&31))&255],_=_>>>8^r[(_^(128|F&63))&255]):F>=55296&&F<57344?(F=(F&1023)+64,D=y.charCodeAt(T++)&1023,_=_>>>8^r[(_^(240|F>>8&7))&255],_=_>>>8^r[(_^(128|F>>2&63))&255],_=_>>>8^r[(_^(128|D>>6&15|(F&3)<<4))&255],_=_>>>8^r[(_^(128|D&63))&255]):(_=_>>>8^r[(_^(224|F>>12&15))&255],_=_>>>8^r[(_^(128|F>>6&63))&255],_=_>>>8^r[(_^(128|F&63))&255]);return~_}t.table=r,t.bstr=x,t.buf=k,t.str=A})});var yi=I(er=>{"use strict";p();var AN=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function TN(t,e){return Object.prototype.hasOwnProperty.call(t,e)}er.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var n in r)TN(r,n)&&(t[n]=r[n])}}return t};er.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var CN={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+n),i);return}for(var a=0;a{"use strict";p();var RN=yi(),IN=4,Mx=0,Dx=1,$N=2;function no(t){for(var e=t.length;--e>=0;)t[e]=0}var FN=0,jx=1,ON=2,MN=3,DN=258,Cm=29,Gl=256,Bl=Gl+1+Cm,ro=30,Pm=19,Gx=2*Bl+1,ja=15,xm=16,LN=7,Rm=256,qx=16,zx=17,Vx=18,Am=[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],xf=[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],NN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Wx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],BN=512,bi=new Array((Bl+2)*2);no(bi);var Nl=new Array(ro*2);no(Nl);var Hl=new Array(BN);no(Hl);var Ul=new Array(DN-MN+1);no(Ul);var Im=new Array(Cm);no(Im);var Sf=new Array(ro);no(Sf);function Sm(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}var Yx,Xx,Zx;function Em(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Kx(t){return t<256?Hl[t]:Hl[256+(t>>>7)]}function jl(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function dr(t,e,r){t.bi_valid>xm-r?(t.bi_buf|=e<>xm-t.bi_valid,t.bi_valid+=r-xm):(t.bi_buf|=e<>>=1,r<<=1;while(--e>0);return r>>>1}function HN(t){t.bi_valid===16?(jl(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 UN(t,e){var r=e.dyn_tree,n=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,u,c,f,d,h,m,g=0;for(d=0;d<=ja;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;ul&&(d=l,g++),r[c*2+1]=d,!(c>n)&&(t.bl_count[d]++,h=0,c>=o&&(h=s[c-o]),m=r[c*2],t.opt_len+=m*(d+h),a&&(t.static_len+=m*(i[c*2+1]+h)));if(g!==0){do{for(d=l-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(d=l;d!==0;d--)for(c=t.bl_count[d];c!==0;)f=t.heap[--u],!(f>n)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),c--)}}function Qx(t,e,r){var n=new Array(ja+1),i=0,a,s;for(a=1;a<=ja;a++)n[a]=i=i+r[a-1]<<1;for(s=0;s<=e;s++){var o=t[s*2+1];o!==0&&(t[s*2]=Jx(n[o]++,o))}}function jN(){var t,e,r,n,i,a=new Array(ja+1);for(r=0,n=0;n>=7;n8?jl(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 GN(t,e,r,n){t1(t),n&&(jl(t,r),jl(t,~r)),RN.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function Lx(t,e,r,n){var i=e*2,a=r*2;return t[i]>1;s>=1;s--)km(t,r,s);u=a;do s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],km(t,r,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,r[u*2]=r[s*2]+r[o*2],t.depth[u]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,r[s*2+1]=r[o*2+1]=u,t.heap[1]=u++,km(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],UN(t,e),Qx(r,l,t.bl_count)}function Bx(t,e,r){var n,i=-1,a,s=e[0*2+1],o=0,l=7,u=4;for(s===0&&(l=138,u=3),e[(r+1)*2+1]=65535,n=0;n<=r;n++)a=s,s=e[(n+1)*2+1],!(++o=3&&t.bl_tree[Wx[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function zN(t,e,r,n){var i;for(dr(t,e-257,5),dr(t,r-1,5),dr(t,n-4,4),i=0;i>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Mx;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Dx;for(r=32;r0?(t.strm.data_type===$N&&(t.strm.data_type=VN(t)),Tm(t,t.l_desc),Tm(t,t.d_desc),s=qN(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?r1(t,e,r,n):t.strategy===IN||a===i?(dr(t,(jx<<1)+(n?1:0),3),Nx(t,bi,Nl)):(dr(t,(ON<<1)+(n?1:0),3),zN(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Nx(t,t.dyn_ltree,t.dyn_dtree)),e1(t),n&&t1(t)}function ZN(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Ul[r]+Gl+1)*2]++,t.dyn_dtree[Kx(e)*2]++),t.last_lit===t.lit_bufsize-1}io._tr_init=WN;io._tr_stored_block=r1;io._tr_flush_block=XN;io._tr_tally=ZN;io._tr_align=YN});var $m=I((WY,i1)=>{"use strict";p();function KN(t,e,r,n){for(var i=t&65535|0,a=t>>>16&65535|0,s=0;r!==0;){s=r>2e3?2e3:r,r-=s;do i=i+e[n++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}i1.exports=KN});var Fm=I((XY,a1)=>{"use strict";p();function JN(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var QN=JN();function eB(t,e,r,n){var i=QN,a=n+r;t^=-1;for(var s=n;s>>8^i[(t^e[s])&255];return t^-1}a1.exports=eB});var Ef=I((KY,s1)=>{"use strict";p();s1.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 m1=I(zn=>{"use strict";p();var tr=yi(),Xr=n1(),u1=$m(),Qi=Fm(),tB=Ef(),Va=0,rB=1,nB=3,ia=4,o1=5,qn=0,l1=1,Zr=-2,iB=-3,Om=-5,aB=-1,sB=1,kf=2,oB=3,lB=4,cB=0,uB=2,Pf=8,fB=9,dB=15,hB=8,pB=29,mB=256,Dm=mB+1+pB,gB=30,vB=19,wB=2*Dm+1,yB=15,ke=3,ra=258,mn=ra+ke+1,bB=32,Rf=42,Lm=69,Af=73,Tf=91,Cf=103,Ga=113,zl=666,yt=1,Vl=2,qa=3,oo=4,_B=3;function na(t,e){return t.msg=tB[e],e}function c1(t){return(t<<1)-(t>4?9:0)}function ta(t){for(var e=t.length;--e>=0;)t[e]=0}function ea(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(tr.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}function Mt(t,e){Xr._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,ea(t.strm)}function Pe(t,e){t.pending_buf[t.pending++]=e}function ql(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function xB(t,e,r,n){var i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,tr.arraySet(e,t.input,t.next_in,i,r),t.state.wrap===1?t.adler=u1(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Qi(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)}function f1(t,e){var r=t.max_chain_length,n=t.strstart,i,a,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-mn?t.strstart-(t.w_size-mn):0,u=t.window,c=t.w_mask,f=t.prev,d=t.strstart+ra,h=u[n+s-1],m=u[n+s];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(u[i+s]!==m||u[i+s-1]!==h||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&ns){if(t.match_start=e,s=a,a>=o)break;h=u[n+s-1],m=u[n+s]}}while((e=f[e&c])>l&&--r!==0);return s<=t.lookahead?s:t.lookahead}function za(t){var e=t.w_size,r,n,i,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-mn)){tr.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,n=t.hash_size,r=n;do i=t.head[--r],t.head[r]=i>=e?i-e:0;while(--n);n=e,r=n;do i=t.prev[--r],t.prev[r]=i>=e?i-e:0;while(--n);a+=e}if(t.strm.avail_in===0)break;if(n=xB(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=n,t.lookahead+t.insert>=ke)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(za(t),t.lookahead===0&&e===Va)return yt;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((t.strstart===0||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,Mt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-mn&&(Mt(t,!1),t.strm.avail_out===0))return yt}return t.insert=0,e===ia?(Mt(t,!0),t.strm.avail_out===0?qa:oo):(t.strstart>t.block_start&&(Mt(t,!1),t.strm.avail_out===0),yt)}function Mm(t,e){for(var r,n;;){if(t.lookahead=ke&&(t.ins_h=(t.ins_h<=ke)if(n=Xr._tr_tally(t,t.strstart-t.match_start,t.match_length-ke),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ke){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=ke&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=ke-1)),t.prev_length>=ke&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ke,n=Xr._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ke),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<=ke&&t.strstart>0&&(i=t.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){a=t.strstart+ra;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ke?(r=Xr._tr_tally(t,1,t.match_length-ke),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Xr._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Mt(t,!1),t.strm.avail_out===0))return yt}return t.insert=0,e===ia?(Mt(t,!0),t.strm.avail_out===0?qa:oo):t.last_lit&&(Mt(t,!1),t.strm.avail_out===0)?yt:Vl}function kB(t,e){for(var r;;){if(t.lookahead===0&&(za(t),t.lookahead===0)){if(e===Va)return yt;break}if(t.match_length=0,r=Xr._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Mt(t,!1),t.strm.avail_out===0))return yt}return t.insert=0,e===ia?(Mt(t,!0),t.strm.avail_out===0?qa:oo):t.last_lit&&(Mt(t,!1),t.strm.avail_out===0)?yt:Vl}function Gn(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var so;so=[new Gn(0,0,0,0,SB),new Gn(4,4,8,4,Mm),new Gn(4,5,16,8,Mm),new Gn(4,6,32,32,Mm),new Gn(4,4,16,16,ao),new Gn(8,16,32,32,ao),new Gn(8,16,128,128,ao),new Gn(8,32,128,256,ao),new Gn(32,128,258,1024,ao),new Gn(32,258,258,4096,ao)];function AB(t){t.window_size=2*t.w_size,ta(t.head),t.max_lazy_match=so[t.level].max_lazy,t.good_match=so[t.level].good_length,t.nice_match=so[t.level].nice_length,t.max_chain_length=so[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ke-1,t.match_available=0,t.ins_h=0}function TB(){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=Pf,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 tr.Buf16(wB*2),this.dyn_dtree=new tr.Buf16((2*gB+1)*2),this.bl_tree=new tr.Buf16((2*vB+1)*2),ta(this.dyn_ltree),ta(this.dyn_dtree),ta(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new tr.Buf16(yB+1),this.heap=new tr.Buf16(2*Dm+1),ta(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new tr.Buf16(2*Dm+1),ta(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 d1(t){var e;return!t||!t.state?na(t,Zr):(t.total_in=t.total_out=0,t.data_type=uB,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?Rf:Ga,t.adler=e.wrap===2?0:1,e.last_flush=Va,Xr._tr_init(e),qn)}function h1(t){var e=d1(t);return e===qn&&AB(t.state),e}function CB(t,e){return!t||!t.state||t.state.wrap!==2?Zr:(t.state.gzhead=e,qn)}function p1(t,e,r,n,i,a){if(!t)return Zr;var s=1;if(e===aB&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>fB||r!==Pf||n<8||n>15||e<0||e>9||a<0||a>lB)return na(t,Zr);n===8&&(n=9);var o=new TB;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<o1||e<0)return t?na(t,Zr):Zr;if(n=t.state,!t.output||!t.input&&t.avail_in!==0||n.status===zl&&e!==ia)return na(t,t.avail_out===0?Om:Zr);if(n.strm=t,r=n.last_flush,n.last_flush=e,n.status===Rf)if(n.wrap===2)t.adler=0,Pe(n,31),Pe(n,139),Pe(n,8),n.gzhead?(Pe(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Pe(n,n.gzhead.time&255),Pe(n,n.gzhead.time>>8&255),Pe(n,n.gzhead.time>>16&255),Pe(n,n.gzhead.time>>24&255),Pe(n,n.level===9?2:n.strategy>=kf||n.level<2?4:0),Pe(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Pe(n,n.gzhead.extra.length&255),Pe(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Qi(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Lm):(Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,n.level===9?2:n.strategy>=kf||n.level<2?4:0),Pe(n,_B),n.status=Ga);else{var s=Pf+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=kf||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=bB),s+=31-s%31,n.status=Ga,ql(n,s),n.strstart!==0&&(ql(n,t.adler>>>16),ql(n,t.adler&65535)),t.adler=1}if(n.status===Lm)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),ea(t),i=n.pending,n.pending===n.pending_buf_size));)Pe(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Af)}else n.status=Af;if(n.status===Af)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),ea(t),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindexi&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=Tf)}else n.status=Tf;if(n.status===Tf)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),ea(t),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindexi&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=Cf)}else n.status=Cf;if(n.status===Cf&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&ea(t),n.pending+2<=n.pending_buf_size&&(Pe(n,t.adler&255),Pe(n,t.adler>>8&255),t.adler=0,n.status=Ga)):n.status=Ga),n.pending!==0){if(ea(t),t.avail_out===0)return n.last_flush=-1,qn}else if(t.avail_in===0&&c1(e)<=c1(r)&&e!==ia)return na(t,Om);if(n.status===zl&&t.avail_in!==0)return na(t,Om);if(t.avail_in!==0||n.lookahead!==0||e!==Va&&n.status!==zl){var l=n.strategy===kf?kB(n,e):n.strategy===oB?EB(n,e):so[n.level].func(n,e);if((l===qa||l===oo)&&(n.status=zl),l===yt||l===qa)return t.avail_out===0&&(n.last_flush=-1),qn;if(l===Vl&&(e===rB?Xr._tr_align(n):e!==o1&&(Xr._tr_stored_block(n,0,0,!1),e===nB&&(ta(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),ea(t),t.avail_out===0))return n.last_flush=-1,qn}return e!==ia?qn:n.wrap<=0?l1:(n.wrap===2?(Pe(n,t.adler&255),Pe(n,t.adler>>8&255),Pe(n,t.adler>>16&255),Pe(n,t.adler>>24&255),Pe(n,t.total_in&255),Pe(n,t.total_in>>8&255),Pe(n,t.total_in>>16&255),Pe(n,t.total_in>>24&255)):(ql(n,t.adler>>>16),ql(n,t.adler&65535)),ea(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?qn:l1)}function IB(t){var e;return!t||!t.state?Zr:(e=t.state.status,e!==Rf&&e!==Lm&&e!==Af&&e!==Tf&&e!==Cf&&e!==Ga&&e!==zl?na(t,Zr):(t.state=null,e===Ga?na(t,iB):qn))}function $B(t,e){var r=e.length,n,i,a,s,o,l,u,c;if(!t||!t.state||(n=t.state,s=n.wrap,s===2||s===1&&n.status!==Rf||n.lookahead))return Zr;for(s===1&&(t.adler=u1(t.adler,e,r,0)),n.wrap=0,r>=n.w_size&&(s===0&&(ta(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new tr.Buf8(n.w_size),tr.arraySet(c,e,r-n.w_size,n.w_size,0),e=c,r=n.w_size),o=t.avail_in,l=t.next_in,u=t.input,t.avail_in=r,t.next_in=0,t.input=e,za(n);n.lookahead>=ke;){i=n.strstart,a=n.lookahead-(ke-1);do n.ins_h=(n.ins_h<{"use strict";p();var If=yi(),g1=!0,v1=!0;try{String.fromCharCode.apply(null,[0])}catch(t){g1=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){v1=!1}var Wl=new If.Buf8(256);for(_i=0;_i<256;_i++)Wl[_i]=_i>=252?6:_i>=248?5:_i>=240?4:_i>=224?3:_i>=192?2:1;var _i;Wl[254]=Wl[254]=1;lo.string2buf=function(t){var e,r,n,i,a,s=t.length,o=0;for(i=0;i>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e};function w1(t,e){if(e<65534&&(t.subarray&&v1||!t.subarray&&g1))return String.fromCharCode.apply(null,If.shrinkBuf(t,e));for(var r="",n=0;n4){o[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r1){o[n++]=65533;continue}i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|i&1023)}return w1(o,n)};lo.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Wl[t[r]]>e?r:e}});var Bm=I((nX,y1)=>{"use strict";p();function FB(){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}y1.exports=FB});var S1=I(Zl=>{"use strict";p();var Yl=m1(),Xl=yi(),Um=Nm(),jm=Ef(),OB=Bm(),x1=Object.prototype.toString,MB=0,Hm=4,co=0,b1=1,_1=2,DB=-1,LB=0,NB=8;function Wa(t){if(!(this instanceof Wa))return new Wa(t);this.options=Xl.assign({level:DB,method:NB,chunkSize:16384,windowBits:15,memLevel:8,strategy:LB,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 OB,this.strm.avail_out=0;var r=Yl.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==co)throw new Error(jm[r]);if(e.header&&Yl.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(typeof e.dictionary=="string"?n=Um.string2buf(e.dictionary):x1.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=Yl.deflateSetDictionary(this.strm,n),r!==co)throw new Error(jm[r]);this._dict_set=!0}}Wa.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=e===~~e?e:e===!0?Hm:MB,typeof t=="string"?r.input=Um.string2buf(t):x1.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Xl.Buf8(n),r.next_out=0,r.avail_out=n),i=Yl.deflate(r,a),i!==b1&&i!==co)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===Hm||a===_1))&&(this.options.to==="string"?this.onData(Um.buf2binstring(Xl.shrinkBuf(r.output,r.next_out))):this.onData(Xl.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==b1);return a===Hm?(i=Yl.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===co):(a===_1&&(this.onEnd(co),r.avail_out=0),!0)};Wa.prototype.onData=function(t){this.chunks.push(t)};Wa.prototype.onEnd=function(t){t===co&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Xl.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Gm(t,e){var r=new Wa(e);if(r.push(t,!0),r.err)throw r.msg||jm[r.err];return r.result}function BB(t,e){return e=e||{},e.raw=!0,Gm(t,e)}function HB(t,e){return e=e||{},e.gzip=!0,Gm(t,e)}Zl.Deflate=Wa;Zl.deflate=Gm;Zl.deflateRaw=BB;Zl.gzip=HB});var k1=I((oX,E1)=>{"use strict";p();var $f=30,UB=12;E1.exports=function(e,r){var n,i,a,s,o,l,u,c,f,d,h,m,g,v,w,b,E,x,k,A,y,S,_,T,P;n=e.state,i=e.next_in,T=e.input,a=i+(e.avail_in-5),s=e.next_out,P=e.output,o=s-(r-e.avail_out),l=s+(e.avail_out-257),u=n.dmax,c=n.wsize,f=n.whave,d=n.wnext,h=n.window,m=n.hold,g=n.bits,v=n.lencode,w=n.distcode,b=(1<>>24,m>>>=k,g-=k,k=x>>>16&255,k===0)P[s++]=x&65535;else if(k&16){A=x&65535,k&=15,k&&(g>>=k,g-=k),g<15&&(m+=T[i++]<>>24,m>>>=k,g-=k,k=x>>>16&255,k&16){if(y=x&65535,k&=15,gu){e.msg="invalid distance too far back",n.mode=$f;break e}if(m>>>=k,g-=k,k=s-o,y>k){if(k=y-k,k>f&&n.sane){e.msg="invalid distance too far back",n.mode=$f;break e}if(S=0,_=h,d===0){if(S+=c-k,k2;)P[s++]=_[S++],P[s++]=_[S++],P[s++]=_[S++],A-=3;A&&(P[s++]=_[S++],A>1&&(P[s++]=_[S++]))}else{S=s-y;do P[s++]=P[S++],P[s++]=P[S++],P[s++]=P[S++],A-=3;while(A>2);A&&(P[s++]=P[S++],A>1&&(P[s++]=P[S++]))}}else if(k&64){e.msg="invalid distance code",n.mode=$f;break e}else{x=w[(x&65535)+(m&(1<>3,i-=A,g-=A<<3,m&=(1<{"use strict";p();var A1=yi(),uo=15,T1=852,C1=592,P1=0,qm=1,R1=2,jB=[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],GB=[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],qB=[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],zB=[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];I1.exports=function(e,r,n,i,a,s,o,l){var u=l.bits,c=0,f=0,d=0,h=0,m=0,g=0,v=0,w=0,b=0,E=0,x,k,A,y,S,_=null,T=0,P,F=new A1.Buf16(uo+1),D=new A1.Buf16(uo+1),M=null,re=0,ye,me,fe;for(c=0;c<=uo;c++)F[c]=0;for(f=0;f=1&&F[h]===0;h--);if(m>h&&(m=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===P1||h!==1))return-1;for(D[1]=0,c=1;cT1||e===R1&&b>C1)return 1;for(;;){ye=c-v,o[f]P?(me=M[re+o[f]],fe=_[T+o[f]]):(me=96,fe=0),x=1<>v)+k]=ye<<24|me<<16|fe|0;while(k!==0);for(x=1<>=1;if(x!==0?(E&=x-1,E+=x):E=0,f++,--F[c]===0){if(c===h)break;c=r[n+o[f]]}if(c>m&&(E&y)!==A){for(v===0&&(v=m),S+=d,g=c-v,w=1<T1||e===R1&&b>C1)return 1;A=E&y,a[A]=m<<24|g<<16|S-s|0}}return E!==0&&(a[S+E]=c-v<<24|64<<16|0),l.bits=m,0}});var hS=I(gn=>{"use strict";p();var Ir=yi(),Zm=$m(),Vn=Fm(),VB=k1(),Kl=$1(),WB=0,iS=1,aS=2,F1=4,YB=5,Ff=6,Ya=0,XB=1,ZB=2,Kr=-2,sS=-3,Km=-4,KB=-5,O1=8,oS=1,M1=2,D1=3,L1=4,N1=5,B1=6,H1=7,U1=8,j1=9,G1=10,Df=11,xi=12,zm=13,q1=14,Vm=15,z1=16,V1=17,W1=18,Y1=19,Of=20,Mf=21,X1=22,Z1=23,K1=24,J1=25,Q1=26,Wm=27,eS=28,tS=29,Ye=30,Jm=31,JB=32,QB=852,eH=592,tH=15,rH=tH;function rS(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function nH(){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 Ir.Buf16(320),this.work=new Ir.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function lS(t){var e;return!t||!t.state?Kr:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=oS,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Ir.Buf32(QB),e.distcode=e.distdyn=new Ir.Buf32(eH),e.sane=1,e.back=-1,Ya)}function cS(t){var e;return!t||!t.state?Kr:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,lS(t))}function uS(t,e){var r,n;return!t||!t.state||(n=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Kr:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,cS(t))}function fS(t,e){var r,n;return t?(n=new nH,t.state=n,n.window=null,r=uS(t,e),r!==Ya&&(t.state=null),r):Kr}function iH(t){return fS(t,rH)}var nS=!0,Ym,Xm;function aH(t){if(nS){var e;for(Ym=new Ir.Buf32(512),Xm=new Ir.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(Kl(iS,t.lens,0,288,Ym,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Kl(aS,t.lens,0,32,Xm,0,t.work,{bits:5}),nS=!1}t.lencode=Ym,t.lenbits=9,t.distcode=Xm,t.distbits=5}function dS(t,e,r,n){var i,a=t.state;return a.window===null&&(a.wsize=1<=a.wsize?(Ir.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),Ir.arraySet(a.window,e,r-n,i,a.wnext),n-=i,n?(Ir.arraySet(a.window,e,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,r.check=Vn(r.check,_,2,0),u=0,c=0,r.mode=M1;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=Ye;break}if((u&15)!==O1){t.msg="unknown compression method",r.mode=Ye;break}if(u>>>=4,c-=4,y=(u&15)+8,r.wbits===0)r.wbits=y;else if(y>r.wbits){t.msg="invalid window size",r.mode=Ye;break}r.dmax=1<>8&1),r.flags&512&&(_[0]=u&255,_[1]=u>>>8&255,r.check=Vn(r.check,_,2,0)),u=0,c=0,r.mode=D1;case D1:for(;c<32;){if(o===0)break e;o--,u+=n[a++]<>>8&255,_[2]=u>>>16&255,_[3]=u>>>24&255,r.check=Vn(r.check,_,4,0)),u=0,c=0,r.mode=L1;case L1:for(;c<16;){if(o===0)break e;o--,u+=n[a++]<>8),r.flags&512&&(_[0]=u&255,_[1]=u>>>8&255,r.check=Vn(r.check,_,2,0)),u=0,c=0,r.mode=N1;case N1:if(r.flags&1024){for(;c<16;){if(o===0)break e;o--,u+=n[a++]<>>8&255,r.check=Vn(r.check,_,2,0)),u=0,c=0}else r.head&&(r.head.extra=null);r.mode=B1;case B1:if(r.flags&1024&&(h=r.length,h>o&&(h=o),h&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Ir.arraySet(r.head.extra,n,a,h,y)),r.flags&512&&(r.check=Vn(r.check,n,h,a)),o-=h,a+=h,r.length-=h),r.length))break e;r.length=0,r.mode=H1;case H1:if(r.flags&2048){if(o===0)break e;h=0;do y=n[a+h++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y));while(y&&h>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=xi;break;case G1:for(;c<32;){if(o===0)break e;o--,u+=n[a++]<>>=c&7,c-=c&7,r.mode=Wm;break}for(;c<3;){if(o===0)break e;o--,u+=n[a++]<>>=1,c-=1,u&3){case 0:r.mode=q1;break;case 1:if(aH(r),r.mode=Of,e===Ff){u>>>=2,c-=2;break e}break;case 2:r.mode=V1;break;case 3:t.msg="invalid block type",r.mode=Ye}u>>>=2,c-=2;break;case q1:for(u>>>=c&7,c-=c&7;c<32;){if(o===0)break e;o--,u+=n[a++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=Ye;break}if(r.length=u&65535,u=0,c=0,r.mode=Vm,e===Ff)break e;case Vm:r.mode=z1;case z1:if(h=r.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;Ir.arraySet(i,n,a,h,s),o-=h,a+=h,l-=h,s+=h,r.length-=h;break}r.mode=xi;break;case V1:for(;c<14;){if(o===0)break e;o--,u+=n[a++]<>>=5,c-=5,r.ndist=(u&31)+1,u>>>=5,c-=5,r.ncode=(u&15)+4,u>>>=4,c-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Ye;break}r.have=0,r.mode=W1;case W1:for(;r.have>>=3,c-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},S=Kl(WB,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid code lengths set",r.mode=Ye;break}r.have=0,r.mode=Y1;case Y1:for(;r.have>>24,b=v>>>16&255,E=v&65535,!(w<=c);){if(o===0)break e;o--,u+=n[a++]<>>=w,c-=w,r.lens[r.have++]=E;else{if(E===16){for(P=w+2;c>>=w,c-=w,r.have===0){t.msg="invalid bit length repeat",r.mode=Ye;break}y=r.lens[r.have-1],h=3+(u&3),u>>>=2,c-=2}else if(E===17){for(P=w+3;c>>=w,c-=w,y=0,h=3+(u&7),u>>>=3,c-=3}else{for(P=w+7;c>>=w,c-=w,y=0,h=11+(u&127),u>>>=7,c-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Ye;break}for(;h--;)r.lens[r.have++]=y}}if(r.mode===Ye)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Ye;break}if(r.lenbits=9,T={bits:r.lenbits},S=Kl(iS,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid literal/lengths set",r.mode=Ye;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},S=Kl(aS,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,S){t.msg="invalid distances set",r.mode=Ye;break}if(r.mode=Of,e===Ff)break e;case Of:r.mode=Mf;case Mf:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=a,t.avail_in=o,r.hold=u,r.bits=c,VB(t,d),s=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,n=t.input,o=t.avail_in,u=r.hold,c=r.bits,r.mode===xi&&(r.back=-1);break}for(r.back=0;v=r.lencode[u&(1<>>24,b=v>>>16&255,E=v&65535,!(w<=c);){if(o===0)break e;o--,u+=n[a++]<>x)],w=v>>>24,b=v>>>16&255,E=v&65535,!(x+w<=c);){if(o===0)break e;o--,u+=n[a++]<>>=x,c-=x,r.back+=x}if(u>>>=w,c-=w,r.back+=w,r.length=E,b===0){r.mode=Q1;break}if(b&32){r.back=-1,r.mode=xi;break}if(b&64){t.msg="invalid literal/length code",r.mode=Ye;break}r.extra=b&15,r.mode=X1;case X1:if(r.extra){for(P=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Z1;case Z1:for(;v=r.distcode[u&(1<>>24,b=v>>>16&255,E=v&65535,!(w<=c);){if(o===0)break e;o--,u+=n[a++]<>x)],w=v>>>24,b=v>>>16&255,E=v&65535,!(x+w<=c);){if(o===0)break e;o--,u+=n[a++]<>>=x,c-=x,r.back+=x}if(u>>>=w,c-=w,r.back+=w,b&64){t.msg="invalid distance code",r.mode=Ye;break}r.offset=E,r.extra=b&15,r.mode=K1;case K1:if(r.extra){for(P=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Ye;break}r.mode=J1;case J1:if(l===0)break e;if(h=d-l,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Ye;break}h>r.wnext?(h-=r.wnext,m=r.wsize-h):m=r.wnext-h,h>r.length&&(h=r.length),g=r.window}else g=i,m=s-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do i[s++]=g[m++];while(--h);r.length===0&&(r.mode=Mf);break;case Q1:if(l===0)break e;i[s++]=r.length,l--,r.mode=Mf;break;case Wm:if(r.wrap){for(;c<32;){if(o===0)break e;o--,u|=n[a++]<{"use strict";p();pS.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 gS=I((mX,mS)=>{"use strict";p();function uH(){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}mS.exports=uH});var wS=I(Ql=>{"use strict";p();var fo=hS(),Jl=yi(),Lf=Nm(),lt=Qm(),eg=Ef(),fH=Bm(),dH=gS(),vS=Object.prototype.toString;function Xa(t){if(!(this instanceof Xa))return new Xa(t);this.options=Jl.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 fH,this.strm.avail_out=0;var r=fo.inflateInit2(this.strm,e.windowBits);if(r!==lt.Z_OK)throw new Error(eg[r]);if(this.header=new dH,fo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Lf.string2buf(e.dictionary):vS.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=fo.inflateSetDictionary(this.strm,e.dictionary),r!==lt.Z_OK)))throw new Error(eg[r])}Xa.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,s,o,l,u,c=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?lt.Z_FINISH:lt.Z_NO_FLUSH,typeof t=="string"?r.input=Lf.binstring2buf(t):vS.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Jl.Buf8(n),r.next_out=0,r.avail_out=n),a=fo.inflate(r,lt.Z_NO_FLUSH),a===lt.Z_NEED_DICT&&i&&(a=fo.inflateSetDictionary(this.strm,i)),a===lt.Z_BUF_ERROR&&c===!0&&(a=lt.Z_OK,c=!1),a!==lt.Z_STREAM_END&&a!==lt.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===lt.Z_STREAM_END||r.avail_in===0&&(s===lt.Z_FINISH||s===lt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Lf.utf8border(r.output,r.next_out),l=r.next_out-o,u=Lf.buf2string(r.output,o),r.next_out=l,r.avail_out=n-l,l&&Jl.arraySet(r.output,r.output,o,l,0),this.onData(u)):this.onData(Jl.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(c=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==lt.Z_STREAM_END);return a===lt.Z_STREAM_END&&(s=lt.Z_FINISH),s===lt.Z_FINISH?(a=fo.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===lt.Z_OK):(s===lt.Z_SYNC_FLUSH&&(this.onEnd(lt.Z_OK),r.avail_out=0),!0)};Xa.prototype.onData=function(t){this.chunks.push(t)};Xa.prototype.onEnd=function(t){t===lt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Jl.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function tg(t,e){var r=new Xa(e);if(r.push(t,!0),r.err)throw r.msg||eg[r.err];return r.result}function hH(t,e){return e=e||{},e.raw=!0,tg(t,e)}Ql.Inflate=Xa;Ql.inflate=tg;Ql.inflateRaw=hH;Ql.ungzip=tg});var _S=I((yX,bS)=>{"use strict";p();var pH=yi().assign,mH=S1(),gH=wS(),vH=Qm(),yS={};pH(yS,mH,gH,vH);bS.exports=yS});var ES=I((_X,SS)=>{"use strict";p();var xS=(t,e)=>function(...r){let n=e.promiseModule;return new n((i,a)=>{e.multiArgs?r.push((...s)=>{e.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):e.errorFirst?r.push((s,o)=>{s?a(s):i(o)}):r.push(i),t.apply(this,r)})};SS.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let n=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return e.include?e.include.some(s):!e.exclude.some(s)},i;r==="function"?i=function(...a){return e.excludeMain?t(...a):xS(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"&&n(a)?xS(s,e):s}return i}});var FS=I((SX,$S)=>{p();function kS(t){return Array.isArray(t)?t:[t]}var ig="",AS=" ",rg="\\",wH=/^\s+$/,yH=/(?:[^\\]|^)\\$/,bH=/^\\!/,_H=/^\\#/,xH=/\r?\n/g,SH=/^\.*\/|^\.+$/,ng="/",PS="node-ignore";typeof Symbol!="undefined"&&(PS=Symbol.for("node-ignore"));var TS=PS,EH=(t,e,r)=>Object.defineProperty(t,e,{value:r}),kH=/([0-z])-([0-z])/g,RS=()=>!1,AH=t=>t.replace(kH,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:ig),TH=t=>{let{length:e}=t;return t.slice(0,e-e%2)},CH=[[/^\uFEFF/,()=>ig],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?AS:ig)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+AS}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>rg],[/\\\\/g,()=>rg],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===rg?`\\[${r}${TH(n)}${i}`:i==="]"&&n.length%2===0?`[${AH(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],CS=Object.create(null),PH=(t,e)=>{let r=CS[t];return r||(r=CH.reduce((n,[i,a])=>n.replace(i,a.bind(t)),t),CS[t]=r),e?new RegExp(r,"i"):new RegExp(r)},og=t=>typeof t=="string",RH=t=>t&&og(t)&&!wH.test(t)&&!yH.test(t)&&t.indexOf("#")!==0,IH=t=>t.split(xH),ag=class{constructor(e,r,n,i){this.origin=e,this.pattern=r,this.negative=n,this.regex=i}},$H=(t,e)=>{let r=t,n=!1;t.indexOf("!")===0&&(n=!0,t=t.substr(1)),t=t.replace(bH,"!").replace(_H,"#");let i=PH(t,e);return new ag(r,t,n,i)},FH=(t,e)=>{throw new e(t)},Si=(t,e,r)=>og(t)?t?Si.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),IS=t=>SH.test(t);Si.isNotRelative=IS;Si.convert=t=>t;var sg=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){EH(this,TS,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[TS]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(RH(e)){let r=$H(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,kS(og(e)?IH(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let n=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&n!==i||s&&!n&&!i&&!r)return;a.regex.test(e)&&(n=!s,i=s)}),{ignored:n,unignored:i}}_test(e,r,n,i){let a=e&&Si.convert(e);return Si(a,e,this._allowRelativePaths?RS:FH),this._t(a,r,n,i)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(ng)),i.pop(),!i.length)return r[e]=this._testOne(e,n);let a=this._t(i.join(ng)+ng,r,n,i);return r[e]=a.ignored?a:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return kS(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Nf=t=>new sg(t),OH=t=>Si(t&&Si.convert(t),t,RS);Nf.isPathValid=OH;Nf.default=Nf;$S.exports=Nf;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Si.convert=t;let e=/^[a-z]:\//i;Si.isNotRelative=r=>e.test(r)||IS(r)}});var MS=I((kX,OS)=>{"use strict";p();function MH(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Wn(t,e,r){return e=e instanceof RegExp?e:new RegExp(MH(e),"g"),t.replace(e,r)}var DH={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Wn(e,"./","/"),e=Wn(e,"..","."),e=Wn(e," ","-"),e=Wn(e,/^[~^:?*\\\-]/g,""),e=Wn(e,/[~^:?*\\]/g,"-"),e=Wn(e,/[~^:?*\\\-]$/g,""),e=Wn(e,"@{","-"),e=Wn(e,/\.$/g,""),e=Wn(e,/\/$/g,""),e=Wn(e,/\.lock$/g,""),e}};OS.exports=DH});var LS=I((TX,DS)=>{p();DS.exports=function(t,e){var r=t,n=e,i=r.length,a=n.length,s=!1,o=null,l=i+1,u=[],c=[],f=[],d="",h=-1,m=0,g=1,v,w,b=function(){i>=a&&(v=r,w=i,r=n,n=v,i=a,a=w,s=!0,l=i+1)},E=function(y,S,_){return{x:y,y:S,k:_}},x=function(y,S){return{elem:y,t:S}},k=function(y,S,_){var T,P,F;for(S>_?T=u[y-1+l]:T=u[y+1+l],F=Math.max(S,_),P=F-y;P=0;--F)for(;TP-T?(s?f[f.length]=new x(n[P],h):f[f.length]=new x(n[P],g),++_,++P):y[F].y-y[F].x=y+1;--M)_[M+l]=k(M,_[M-1+l]+1,_[M+1+l]);_[y+l]=k(y,_[y-1+l]+1,_[y+1+l])}while(_[y+l]!==a);for(o=y+2*T,P=u[y+l],F=[];P!==-1;)F[F.length]=new E(c[P].x,c[P].y,null),P=c[P].k;A(F)}}}});var HS=I((PX,BS)=>{p();var LH=LS();function NH(t,e){var r=new LH(t,e);r.compose();for(var n=r.getses(),i,a,s=t.length-1,o=e.length-1,l=n.length-1;l>=0;--l)n[l].t===r.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--):n[l].t===r.SES_DELETE?s--:n[l].t===r.SES_ADD&&o--;var u={file1index:-1,file2index:-1,chain:null};return a?(a.chain=u,i):u}function NS(t,e){for(var r=[],n=t.length,i=e.length,a=NH(t,e);a!==null;a=a.chain){var s=n-a.file1index-1,o=i-a.file2index-1;n=a.file1index,i=a.file2index,(s||o)&&r.push({file1:[n+1,s],file2:[i+1,o]})}return r.reverse(),r}function BH(t,e,r){var n,i=NS(e,t),a=NS(e,r),s=[];function o(D,M){s.push([D.file1[0],M,D.file1[1],D.file2[0],D.file2[1]])}for(n=0;nu&&(l.push([1,u,D-u]),u=D)}for(var f=0;fg)break;g=Math.max(g,w+v[2]),f++}if(c(m),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(n=d;n<=f;n++){h=s[n];var E=h[1],x=b[E],k=h[0],A=k+h[2],y=h[3],S=y+h[4];x[0]=Math.min(y,x[0]),x[1]=Math.max(S,x[1]),x[2]=Math.min(k,x[2]),x[3]=Math.max(A,x[3])}var _=b[0][0]+(m-b[0][2]),T=b[0][1]+(g-b[0][3]),P=b[2][0]+(m-b[2][2]),F=b[2][1]+(g-b[2][3]);l.push([-1,_,T-_,m,g-m,P,F-P])}u=g}return c(e.length),l}function HH(t,e,r){var n=[],i=[t,e,r],a=BH(t,e,r),s=[];function o(){s.length&&n.push({ok:s}),s=[]}function l(h){for(var m=0;m{"use strict";p();Object.defineProperty(W,"__esModule",{value:!0});function ha(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var tc=ha(Eb()),cE=ha(Px()),O=$x(),UH=ha(Ox()),Fg=ha(_S()),lg=ha(ES()),jH=ha(FS()),Xn=ha(MS()),GH=ha(HS()),Ae=class t extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new t(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}},rc=class t extends Ae{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}}};rc.code="UnmergedPathsError";var de=class t extends Ae{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}}};de.code="InternalError";var po=class t extends Ae{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};po.code="UnsafeFilepathError";var Jr=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let n=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,n}write(e,r,n){let i=this.buffer.write(e,this._start,r,n);return this._start+=r,i}copy(e,r,n){let i=e.copy(this.buffer,this._start,r,n);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function Kf(t,e){return-(te)}function uE(t,e){return Kf(t.path,e.path)}function fE(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var Yn=2**32;function US(t,e,r,n){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=n.valueOf());let i=Math.floor(r/1e3),a=(r-i*1e3)*1e6;return[i,a]}function mo(t){let[e,r]=US(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[n,i]=US(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%Yn,ctimeNanoseconds:r%Yn,mtimeSeconds:n%Yn,mtimeNanoseconds:i%Yn,dev:t.dev%Yn,ino:t.ino%Yn,mode:fE(t.mode%Yn),uid:t.uid%Yn,gid:t.gid%Yn,size:t.size>-1?t.size%Yn:0}}function qH(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var cg=null;async function ki(t){return cg===null&&(cg=await VH()),cg?dE(t):zH(t)}function zH(t){return new cE().update(t).digest("hex")}async function dE(t){let e=await crypto.subtle.digest("SHA-1",t);return qH(e)}async function VH(){try{if(await dE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch(t){}return!1}function WH(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function YH(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 _g=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new de("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new de("Index file is empty (.git/index)");let r=new t,n=new Jr(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new de(`Invalid dircache magic file number: ${i}`);let a=await ki(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new de(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=n.readUInt32BE();if(o!==2)throw new de(`Unsupported dircache version: ${o}`);let l=n.readUInt32BE(),u=0;for(;!n.eof()&&ue.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:n,stage:i=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=mo(r);let a=Buffer.from(e),s={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:n,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 r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(` +`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Jr(i),s=mo(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(YH(e)),a.write(e.path,r.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),r=new Jr(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&n.push(t._entryToBuffer(l));n=await Promise.all(n);let i=Buffer.concat(n),a=Buffer.concat([e,i]),s=await ki(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Uf(t,e,r=!0,n=!0){let i=mo(t),a=mo(e);return r&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||n&&i.ino!==a.ino||i.size!==a.size}var ug=null,fg=Symbol("IndexCache");function XH(){return{map:new Map,stats:new Map}}async function ZH(t,e,r){let[n,i]=await Promise.all([t.lstat(e),t.read(e)]),a=await _g.from(i);r.map.set(e,a),r.stats.set(e,n)}async function KH(t,e,r){let n=r.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await t.lstat(e);return i===null?!1:Uf(n,i)}var ct=class{static async acquire({fs:e,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[fg]||(n[fg]=XH());let s=`${r}/index`;ug===null&&(ug=new tc({maxPending:1/0}));let o,l=[];return await ug.acquire(s,async()=>{let u=n[fg];await KH(e,s,u)&&await ZH(e,s,u);let c=u.map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new rc(l);if(o=await a(c),c._dirty){let f=await c.toObject();await e.write(s,f),u.stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function jf(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function go(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function hE(t){let e=new Map,r=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:jf(i),metadata:{},children:[]};e.set(i,a),a.parent=r(go(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},n=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:jf(i),metadata:a,parent:r(go(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};r(".");for(let i of t)n(i.path,i);return e}function JH(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 de(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var xg=class{constructor({fs:e,gitdir:r,cache:n}){this.treePromise=ct.acquire({fs:e,gitdir:r,cache:n},async function(a){return hE(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 r=e._fullpath,i=(await this.treePromise).get(r);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let a=i.children.map(s=>s.fullpath);return a.sort(Kf),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 n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:mo(n.metadata);e._type=n.type==="tree"?"tree":JH(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},Jf=Symbol("GitWalkSymbol");function ts(){let t=Object.create(null);return Object.defineProperty(t,Jf,{value:function({fs:e,gitdir:r,cache:n}){return new xg({fs:e,gitdir:r,cache:n})}}),Object.freeze(t),t}var Le=class t extends Ae{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Le.code="NotFoundError";var rr=class t extends Ae{constructor(e,r,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:n,filepath:i}}};rr.code="ObjectTypeError";var oa=class t extends Ae{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};oa.code="InvalidOidError";var nc=class t extends Ae{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}}};nc.code="NoRefspecError";var Gf=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(` +`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let a=n.slice(1);return this.refs.set(r+"^{}",a),{line:n,ref:r,peeled:a}}else{let a=n.slice(0,i);return r=n.slice(i+1),this.refs.set(r,a),{line:n,ref:r,oid:a}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` +`)+` +`}},qf=class t{constructor({remotePath:e,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:r,force:n,matchPrefix:i})}static from(e){let[r,n,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=i==="*";if(l!==(s==="*"))throw new de("Invalid refspec");return new t({remotePath:n,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}},Sg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let n of e)r.push(qf.from(n));return new t(r)}add(e){let r=qf.from(e);this.rules.push(r)}translate(e){let r=[];for(let n of this.rules)for(let i of e){let a=n.translate(i);a&&r.push([i,a])}return r}translateOne(e){let r=null;for(let n of this.rules){let i=n.translate(e);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function QH(t,e){let r=t.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(rn);return i===0?t.endsWith("^{}")?1:-1:i}var e3=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},ec=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},jS={core:{filemode:ec,bare:ec,logallrefupdates:ec,symlinks:ec,ignorecase:ec,bigFileThreshold:e3}},t3=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,r3=/^[A-Za-z0-9-.]+$/,n3=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,i3=/^[A-Za-z][A-Za-z-]*$/,a3=/^(.*?)( *[#;].*)$/,s3=t=>{let e=t3.exec(t);if(e!=null){let[r,n]=e.slice(1);return[r,n]}return null},o3=t=>{let e=n3.exec(t);if(e!=null){let[r,n="true"]=e.slice(1),i=l3(n),a=c3(i);return[r,a]}return null},l3=t=>{let e=a3.exec(t);if(e==null)return t;let[r,n]=e.slice(1);return GS(r)&&GS(n)?`${r}${n}`:r},GS=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,c3=t=>t.split("").reduce((e,r,n,i)=>{let a=r==='"'&&i[n-1]!=="\\",s=r==="\\"&&i[n+1]==='"';return a||s?e:e+r},""),qS=t=>t!=null?t.toLowerCase():null,Eg=(t,e,r)=>[qS(t),e,qS(r)].filter(n=>n!=null).join("."),zS=t=>{let e=t.split("."),r=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:r,subsection:i,name:n,path:Eg(r,i,n),sectionPath:Eg(r,i,null),isSection:!!r}},u3=(t,e)=>t.reduce((r,n,i)=>e(n)?i:r,-1),kg=class t{constructor(e){let r=null,n=null;this.parsedConfig=e?e.split(` +`).map(i=>{let a=null,s=null,o=i.trim(),l=s3(o),u=l!=null;if(u)[r,n]=l;else{let f=o3(o);f!=null&&([a,s]=f)}let c=Eg(r,n,a);return{line:i,isSection:u,section:r,subsection:n,name:a,value:s,path:c}}):[]}static from(e){return new t(e)}async get(e,r=!1){let n=zS(e).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:s,value:o})=>{let l=jS[a]&&jS[a][s];return l?l(o):o});return r?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===e&&n.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,n=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l,isSection:u}=zS(e),c=u3(this.parsedConfig,f=>f.path===o);if(r==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let f=this.parsedConfig[c],d=Object.assign({},f,{name:s,value:r,modified:!0});n?this.parsedConfig.splice(c+1,0,d):this.parsedConfig[c]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:a,name:s,value:r,modified:!0,path:o};if(r3.test(i)&&i3.test(s))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:u,section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:n,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:n!=null?`[${r} "${n}"]`:`[${r}]`:e).join(` +`)}},nt=class{static async get({fs:e,gitdir:r}){let n=await e.read(`${r}/config`,{encoding:"utf8"});return kg.from(n)}static async save({fs:e,gitdir:r,config:n}){await e.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},Bf=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],f3=["config","description","index","shallow","commondir"],dg;async function aa(t,e){return dg===void 0&&(dg=new tc),dg.acquire(t,e)}var z=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:n,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:u=!1}){for(let v of i.values())if(!v.match(/[0-9a-f]{40}/))throw new oa(v);let c=await nt.get({fs:e,gitdir:r});if(!o){if(o=await c.getall(`remote.${n}.fetch`),o.length===0)throw new nc(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=Sg.from(o),d=new Map;if(u){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(w=>`refs/tags/${w}`)})}if(s){for(let v of i.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let w=i.get(v);d.set(v,w)}}let h=f.translate([...i.keys()]);for(let[v,w]of h){let b=i.get(v);d.set(w,b)}let m=f.translate([...a.keys()]);for(let[v,w]of m){let b=a.get(v),E=f.translateOne(b);E&&d.set(w,`ref: ${E}`)}let g=[];if(l){for(let v of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of w)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,w]of d)await aa(v,async()=>e.write(O.join(r,v),`${w.trim()} +`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new oa(i);await aa(n,async()=>e.write(O.join(r,n),`${i.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:n,value:i}){await aa(n,async()=>e.write(O.join(r,n),`ref: ${i.trim()} +`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:n}){return t.deleteRefs({fs:e,gitdir:r,refs:[n]})}static async deleteRefs({fs:e,gitdir:r,refs:n}){await Promise.all(n.map(o=>e.rm(O.join(r,o))));let i=await aa("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),a=Gf.from(i),s=a.refs.size;for(let o of n)a.refs.has(o)&&a.delete(o);a.refs.sizee.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:n,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),t.resolve({fs:e,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let a=await t.packedRefs({fs:e,gitdir:r}),s=Bf(n).filter(o=>!f3.includes(o));for(let o of s){let l=await aa(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:i})}throw new Le(n)}static async exists({fs:e,gitdir:r,ref:n}){try{return await t.expand({fs:e,gitdir:r,ref:n}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await t.packedRefs({fs:e,gitdir:r}),a=Bf(n);for(let s of a)if(await aa(s,async()=>e.exists(`${r}/${s}`))||i.has(s))return s;throw new Le(n)}static async expandAgainstMap({ref:e,map:r}){let n=Bf(e);for(let i of n)if(await r.has(i))return i;throw new Le(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let a=Bf(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:n,map:i})}throw new Le(e)}static async packedRefs({fs:e,gitdir:r}){let n=await aa("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Gf.from(n).refs}static async listRefs({fs:e,gitdir:r,filepath:n}){let i=t.packedRefs({fs:e,gitdir:r}),a=null;try{a=await e.readdirDeep(`${r}/${n}`),a=a.map(s=>s.replace(`${r}/${n}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(n)&&(s=s.replace(n+"/",""),a.includes(s)||a.push(s));return a.sort(QH),a}static async listBranches({fs:e,gitdir:r,remote:n}){return n?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${n}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function d3(t,e){return Kf(VS(t),VS(e))}function VS(t){return t.mode==="040000"?t.path+"/":t.path}function pE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new de(`Unexpected GitTree entry mode: ${t}`)}function h3(t){let e=[],r=0;for(;r`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(d3),Buffer.concat(e.map(r=>{let n=Buffer.from(r.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(r.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([n,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},la=class{static wrap({type:e,object:r}){return Buffer.concat([Buffer.from(`${e} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(e){let r=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,r).toString("utf8"),a=e.slice(r+1,n).toString("utf8"),s=e.length-(n+1);if(parseInt(a)!==s)throw new de(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(n+1))}}};async function mE({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await t.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function g3(t,e){let r=new Jr(t),n=WS(r);if(n!==e.byteLength)throw new de(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=WS(r),a,s=XS(r,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Jr(a);for(o.copy(s);!r.eof();)o.copy(XS(r,e));let l=o.tell();if(i!==l)throw new de(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function WS(t){let e=0,r=0,n=null;do n=t.readUInt8(),e|=(n&127)<>=1,i+=8;return n}function XS(t,e){let r=t.readUInt8(),n=128,i=15,a=112;if(r&n){let s=YS(t,r&i,4),o=YS(t,(r&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(r)}function v3(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function gE(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:v3(t)}var zf=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=gE(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>w3(r);){let n=await this._next();if(this._ended)break;r.push(n)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function w3(t){return t.reduce((e,r)=>e+r.length,0)}async function y3(t,e){let r=new zf(t),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new de(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new de(`Invalid packfile version: ${i}`);let a=await r.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!r.eof()&&a--;){let s=r.tell(),{type:o,length:l,ofs:u,reference:c}=await b3(r),f=new Fg.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new de(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new de("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:a,offset:s,end:h,reference:c,ofs:u})}}}}async function b3(t){let e=await t.byte(),r=e>>4&7,n=e&15;if(e&128){let s=4;do e=await t.byte(),n|=(e&127)<i+1<<7|a,-1)}function E3(t,e){let r=e,n=4,i=null;do i=t.readUInt8(),r|=(i&127)<2048*1024*1024)throw new de("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");n.seek(n.tell()+4*255);let s=n.readUInt32BE(),o=[];for(let c=0;c{c===null&&(c=x);let k=Math.floor((c-x)*100/c);k!==f&&n&&await n({phase:"Receiving objects",loaded:c-x,total:c}),f=k,w=i[w],["commit","tree","blob","tag"].includes(w)?a[E]={type:w,offset:E}:w==="ofs-delta"?a[E]={type:w,offset:E}:w==="ref-delta"&&(a[E]={type:w,offset:E})});let d=Object.keys(a).map(Number);for(let[v,w]of d.entries()){let b=v+1===d.length?e.byteLength-20:d[v+1],E=a[w],x=UH.buf(e.slice(w,b))>>>0;E.end=b,E.crc=x}let h=new t({pack:Promise.resolve(e),packfileSha:s,crcs:l,hashes:o,offsets:u,getExternalRefDelta:r});f=null;let m=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let v in a){v=Number(v);let w=Math.floor(m*100/c);w!==f&&n&&await n({phase:"Resolving deltas",loaded:m,total:c}),m++,f=w;let b=a[v];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:E,object:x}=await h.readSlice({start:v});g[h.readDepth]+=1;let k=await ki(la.wrap({type:E,object:x}));b.oid=k,o.push(k),u.set(k,v),l[k]=b.crc}catch(E){continue}}return o.sort(),h}async toBuffer(){let e=[],r=(u,c)=>{e.push(Buffer.from(u,c))};r("ff744f63","hex"),r("00000002","hex");let n=new Jr(Buffer.alloc(256*4));for(let u=0;u<256;u++){let c=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=u&&c++;n.writeUInt32BE(c)}e.push(n.buffer);for(let u of this.hashes)r(u,"hex");let i=new Jr(Buffer.alloc(this.hashes.length*4));for(let u of this.hashes)i.writeUInt32BE(this.crcs[u]);e.push(i.buffer);let a=new Jr(Buffer.alloc(this.hashes.length*4));for(let u of this.hashes)a.writeUInt32BE(this.offsets.get(u));e.push(a.buffer),r(this.packfileSha,"hex");let s=Buffer.concat(e),o=await ki(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 de(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new de("Tried to read from a GitPackIndex with no packfile loaded into memory");let n=(await this.pack).slice(e),i=new Jr(n),a=i.readUInt8(),s=a&112,o=r[s];if(o===void 0)throw new de("Unrecognized type: 0b"+s.toString(2));let l=a&15,u=l;a&128&&(u=E3(i,l));let f=null,d=null;if(o==="ofs_delta"){let m=S3(i),g=e-m;({object:f,type:o}=await this.readSlice({start:g}))}if(o==="ref_delta"){let m=i.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:m}))}let h=n.slice(i.tell());if(d=Buffer.from(await vE(h)),d.byteLength!==u)throw new de(`Packfile told us object would have length ${u} but it had length ${d.byteLength}`);return f&&(d=Buffer.from(g3(d,f))),this.readDepth>3&&(this.offsetCache[e]={type:o,object:d}),{type:o,format:"content",object:d}}},Hf=Symbol("PackfileCache");async function k3({fs:t,filename:e,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){let a=await t.read(e);return ic.fromIdx({idx:a,getExternalRefDelta:r})}function Og({fs:t,cache:e,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}){e[Hf]||(e[Hf]=new Map);let s=e[Hf].get(r);return s||(s=k3({fs:t,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}),e[Hf].set(r,s)),s}async function A3({fs:t,cache:e,gitdir:r,oid:n,format:i="content",getExternalRefDelta:a}){let s=await t.readdir(O.join(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,u=await Og({fs:t,cache:e,filename:l,getExternalRefDelta:a});if(u.error)throw new de(u.error);if(u.offsets.has(n)){if(!u.pack){let f=l.replace(/idx$/,"pack");u.pack=t.read(f)}let c=await u.read({oid:n,getExternalRefDelta:a});return c.format="content",c.source=`objects/pack/${o.replace(/idx$/,"pack")}`,c}}return null}async function qe({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let a=c=>qe({fs:t,cache:e,gitdir:r,oid:c}),s;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await mE({fs:t,gitdir:r,oid:n})),!s){if(s=await A3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a}),!s)throw new Le(n);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await vE(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await ki(s.object);if(o!==n)throw new de(`SHA check failed! Expected ${n}, computed ${o}`);let{object:l,type:u}=la.unwrap(s.object);if(s.type=u,s.object=l,s.format="content",i==="content")return s;throw new de(`invalid requested format "${i}"`)}var vn=class t extends Ae{constructor(e,r,n=!0){super(`Failed to create ${e} at ${r} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:n}}};vn.code="AlreadyExistsError";var ac=class t extends Ae{constructor(e,r,n){super(`Found multiple ${e} matching "${r}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:n}}};ac.code="AmbiguousError";var sc=class t extends Ae{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}}};sc.code="CheckoutConflictError";var oc=class t extends Ae{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=t.code,this.data={ref:e,oid:r}}};oc.code="CommitNotFetchedError";var lc=class t extends Ae{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};lc.code="EmptyServerResponseError";var cc=class t extends Ae{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};cc.code="FastForwardError";var uc=class t extends Ae{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};uc.code="GitPushError";var vo=class t extends Ae{constructor(e,r,n){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:n}}};vo.code="HttpError";var ca=class t extends Ae{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=t.code,this.data={reason:e}}};ca.code="InvalidFilepathError";var wn=class t extends Ae{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:r}}};wn.code="InvalidRefNameError";var fc=class t extends Ae{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};fc.code="MaxDepthError";var wo=class t extends Ae{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};wo.code="MergeNotSupportedError";var yo=class t extends Ae{constructor(e,r,n,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:r,deleteByUs:n,deleteByTheirs:i}}};yo.code="MergeConflictError";var zt=class t extends Ae{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}}};zt.code="MissingNameError";var hr=class t extends Ae{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};hr.code="MissingParameterError";var dc=class t extends Ae{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}};dc.code="MultipleGitError";var Ja=class t extends Ae{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};Ja.code="ParseError";var bo=class t extends Ae{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};bo.code="PushRejectedError";var sa=class t extends Ae{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:r}}};sa.code="RemoteCapabilityError";var hc=class t extends Ae{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=t.code,this.data={preview:e,response:r}}};hc.code="SmartHttpError";var pc=class t extends Ae{constructor(e,r,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:n}}};pc.code="UnknownTransportError";var mc=class t extends Ae{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};mc.code="UrlParseError";var _o=class t extends Ae{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};_o.code="UserCanceledError";var gc=class t extends Ae{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}}};gc.code="IndexResetError";var vc=class t extends Ae{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}}};vc.code="NoCommitError";var wE=Object.freeze({__proto__:null,AlreadyExistsError:vn,AmbiguousError:ac,CheckoutConflictError:sc,CommitNotFetchedError:oc,EmptyServerResponseError:lc,FastForwardError:cc,GitPushError:uc,HttpError:vo,InternalError:de,InvalidFilepathError:ca,InvalidOidError:oa,InvalidRefNameError:wn,MaxDepthError:fc,MergeNotSupportedError:wo,MergeConflictError:yo,MissingNameError:zt,MissingParameterError:hr,MultipleGitError:dc,NoRefspecError:nc,NotFoundError:Le,ObjectTypeError:rr,ParseError:Ja,PushRejectedError:bo,RemoteCapabilityError:sa,SmartHttpError:hc,UnknownTransportError:pc,UnsafeFilepathError:po,UrlParseError:mc,UserCanceledError:_o,UnmergedPathsError:rc,IndexResetError:gc,NoCommitError:vc});function Ag({name:t,email:e,timestamp:r,timezoneOffset:n}){return n=T3(n),`${t} <${e}> ${r} ${n}`}function T3(t){let e=C3(P3(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let n=String(r),i=String(t);return n.length<2&&(n="0"+n),i.length<2&&(i="0"+i),(e===-1?"-":"+")+n+i}function C3(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function P3(t){return t===0?t:-t}function Ei(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function Vf(t){let[,e,r,n,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(n),timezoneOffset:R3(i)}}function R3(t){let[,e,r,n]=t.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(r)*60+Number(n)),I3(n)}function I3(t){return t===0?t:-t}var Fr=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 de("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 ${Ag(e.tagger)} + +${e.message} +${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(` + +`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(` + +`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(` +`),r=[];for(let i of e)i[0]===" "?r[r.length-1]+=` +`+i.slice(1):r.push(i);let n={};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.tagger&&(n.tagger=Vf(n.tagger)),n.committer&&(n.committer=Vf(n.committer)),n}withoutSignature(){let e=Ei(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 Ei(e)}payload(){return this.withoutSignature()+` +`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,n){let i=e.payload(),{signature:a}=await r({payload:i,secretKey:n});a=Ei(a);let s=i+a;return t.from(s)}};function pg(t){return t.trim().split(` +`).map(e=>" "+e).join(` +`)+` +`}function $3(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var mr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new de("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let n=t.justHeaders(e),i=t.justMessage(e),a=Ei(n+` +gpgsig`+pg(r)+` +`+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 Ei(e.slice(e.indexOf(` + +`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` + +`))}parseHeaders(){let e=t.justHeaders(this._commit).split(` +`),r=[];for(let i of e)i[0]===" "?r[r.length-1]+=` +`+i.slice(1):r.push(i);let n={parent:[]};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.author&&(n.author=Vf(n.author)),n.committer&&(n.committer=Vf(n.committer)),n}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree} +`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 +`,e.parent){if(e.parent.length===void 0)throw new de("commit 'parent' property should be an array");for(let a of e.parent)r+=`parent ${a} +`}let n=e.author;r+=`author ${Ag(n)} +`;let i=e.committer||e.author;return r+=`committer ${Ag(i)} +`,e.gpgsig&&(r+="gpgsig"+pg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+` +`+Ei(e.message)}render(){return this._commit}withoutSignature(){let e=Ei(this._commit);if(e.indexOf(` +gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(` +gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE----- +`)+28);return Ei(r+` +`+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return $3(e)}static async sign(e,r,n){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await r({payload:i,secretKey:n});s=Ei(s);let l=t.justHeaders(e._commit)+` +gpgsig`+pg(s)+` +`+a;return t.from(l)}};async function xo({fs:t,cache:e,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:pr.from([]),oid:n};let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,xo({fs:t,cache:e,gitdir:r,oid:n});if(i==="commit")return n=mr.from(a).parse().tree,xo({fs:t,cache:e,gitdir:r,oid:n});if(i!=="tree")throw new rr(n,i,"tree");return{tree:pr.from(a),oid:n}}var Tg=class{constructor({fs:e,gitdir:r,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let s=new Map,o;try{o=await z.resolve({fs:e,gitdir:r,ref:n})}catch(u){u instanceof Le&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await xo({fs:e,cache:this.cache,gitdir:r,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 r=e._fullpath,{fs:n,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:u,object:c}=await qe({fs:n,cache:i,gitdir:a,oid:l});if(u!==o.type)throw new rr(l,u,o.type);let f=pr.from(c);for(let d of f)s.set(O.join(r,d.path),d);return f.entries().map(d=>O.join(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:n}=r.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:n}=r.get(e._fullpath);e._mode=fE(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,o=r.get(e._fullpath).oid,{type:l,object:u}=await qe({fs:n,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(u)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function $r({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Jf,{value:function({fs:r,gitdir:n,cache:i}){return new Tg({fs:r,gitdir:n,ref:t,cache:i})}}),Object.freeze(e),e}var Cg=class{constructor({fs:e,dir:r,gitdir:n,cache:i}){this.fs=e,this.cache=i,this.dir=r,this.gitdir=n,this.config=null;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 r=e._fullpath,{fs:n,dir:i}=this,a=await n.readdir(O.join(i,r));return a===null?null:a.map(s=>O.join(r,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:r,dir:n}=this,i=await r.lstat(`${n}/${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=mo(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:r,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await this._getGitConfig(r,i)).get("core.autocrlf"),o=await r.read(`${n}/${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 r=this,{fs:n,gitdir:i,cache:a}=this,s;await ct.acquire({fs:n,gitdir:i,cache:a},async function(o){let l=o.entriesMap.get(e._fullpath),u=await e.stat(),f=await(await r._getGitConfig(n,i)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Uf(u,l,f,d)){let h=await e.content();h===void 0?s=void 0:(s=await ki(la.wrap({type:"blob",object:h})),l&&s===l.oid&&(!f||u.mode===l.mode)&&Uf(u,l,f,d)&&o.insert({filepath:e._fullpath,stats:u,oid:s}))}else s=l.oid}),e._oid=s}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await nt.get({fs:e,gitdir:r}),this.config)}};function Co(){let t=Object.create(null);return Object.defineProperty(t,Jf,{value:function({fs:e,dir:r,gitdir:n,cache:i}){return new Cg({fs:e,dir:r,gitdir:n,cache:i})}}),Object.freeze(t),t}function F3(t,e){let r=e-t;return Array.from({length:r},(n,i)=>t+i)}var yE=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Pg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:eu,reduce:s=async(l,u)=>{let c=yE(u);return l!==void 0&&c.unshift(l),c},iterate:o=(l,u)=>Promise.all([...u].map(l))}){let l=i.map(h=>h[Jf]({fs:t,dir:r,gitdir:n,cache:e})),u=new Array(l.length).fill("."),c=F3(0,l.length),f=async h=>{c.map(v=>{let w=h[v];h[v]=w&&new l[v].ConstructEntry(w)});let g=(await Promise.all(c.map(v=>{let w=h[v];return w?l[v].readdir(w):[]}))).map(v=>(v===null?[]:v)[Symbol.iterator]());return{entries:h,children:O3(g)}},d=async h=>{let{entries:m,children:g}=await f(h),v=m.find(b=>b&&b._fullpath)._fullpath,w=await a(v,m);if(w!==null){let b=await o(d,g);return b=b.filter(E=>E!==void 0),s(w,b)}};return d(u)}async function Rg(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(n=>{let i=O.join(e,n);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?Rg(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function M3(t){return D3(t)&&ZS(t.then)&&ZS(t.catch)}function D3(t){return t&&typeof t=="object"}function ZS(t){return typeof t=="function"}function KS(t){return M3((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(t))}var JS=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function QS(t,e){if(KS(e))for(let r of JS)t[`_${r}`]=e[r].bind(e);else for(let r of JS)t[`_${r}`]=lg(e[r].bind(e));KS(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Rg.bind(null,t):e.rm?t._rm=lg(e.rm.bind(e)):e.rmdir.length>2?t._rm=lg(e.rmdir.bind(e)):t._rm=Rg.bind(null,t)}var J=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?QS(this,e.promises):QS(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(n){if(n.code==="ENOENT"||n.code==="ENOTDIR"||(n.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(e,r={}){try{let n=await this._readFile(e,r);if(r.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,` +`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=Buffer.from(n)),n}catch(n){return null}}async write(e,r,n={}){try{await this._writeFile(e,r,n);return}catch(i){await this.mkdir(go(e)),await this._writeFile(e,r,n)}}async mkdir(e,r=!1){try{await this._mkdir(e);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){let i=go(e);if(i==="."||i==="/"||i===e)throw n;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Kf),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.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(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let n=await this._readlink(e,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function C(t,e){if(e===void 0)throw new hr(t)}async function Wf(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 bE({fs:t,dir:e,gitdir:r=O.join(e,".git"),commit:n="HEAD",cache:i={}}){try{C("fs",t),C("dir",e),C("gitdir",r);let a=new J(t),s=[$r({ref:n}),Co(),ts()],o=[];await ct.acquire({fs:a,gitdir:r,cache:i},async function(u){o=u.unmergedPaths});let l=await ua({fs:a,cache:i,dir:e,gitdir:r,trees:s,map:async function(u,[c,f,d]){let h=!await Wf(f,d),m=o.includes(u),g=!await Wf(d,c);if(h||m)return c?{path:u,mode:await c.mode(),oid:await c.oid(),type:await c.type(),content:await c.content()}:void 0;if(g)return!1;throw new gc(u)}});await ct.acquire({fs:a,gitdir:r,cache:i},async function(u){for(let c of l)if(c!==!1){if(!c){await a.rmdir(`${e}/${c.path}`,{recursive:!0}),u.delete({filepath:c.path});continue}if(c.type==="blob"){let f=new TextDecoder().decode(c.content);await a.write(`${e}/${c.path}`,f,{mode:c.mode}),u.insert({filepath:c.path,oid:c.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var fa=class{static async isIgnored({fs:e,dir:r,gitdir:n=O.join(r,".git"),filepath:i}){if(jf(i)===".git")return!0;if(i===".")return!1;let a="",s=O.join(n,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:O.join(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let c=1;c{let c=await(await nt.get({fs:o,gitdir:r})).get("core.autocrlf");return Ig({dir:e,gitdir:r,fs:o,filepath:n,index:l,force:a,parallel:s,autocrlf:c})})}catch(o){throw o.caller="git.add",o}}async function Ig({dir:t,gitdir:e,fs:r,filepath:n,index:i,force:a,parallel:s,autocrlf:o}){n=Array.isArray(n)?n:[n];let l=n.map(async d=>{if(!a&&await fa.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(O.join(t,d));if(!h)throw new Le(d);if(h.isDirectory()){let m=await r.readdir(O.join(t,d));if(s){let g=m.map(v=>Ig({dir:t,gitdir:e,fs:r,filepath:[O.join(d,v)],index:i,force:a,parallel:s,autocrlf:o}));await Promise.all(g)}else for(let g of m)await Ig({dir:t,gitdir:e,fs:r,filepath:[O.join(d,g)],index:i,force:a,parallel:s,autocrlf:o})}else{let m=h.isSymbolicLink()?await r.readlink(O.join(t,d)).then(xE):await r.read(O.join(t,d),{autocrlf:o});if(m===null)throw new Le(d);let g=await gr({fs:r,gitdir:e,type:"blob",object:m});i.insert({filepath:d,stats:h,oid:g})}}),u=await Promise.allSettled(l),c=u.filter(d=>d.status==="rejected").map(d=>d.reason);if(c.length>1)throw new dc(c);if(c.length===1)throw c[0];return u.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function wc({fs:t,gitdir:e,path:r}){return(await nt.get({fs:t,gitdir:e})).get(r)}function EE(t,...e){for(let r of e)if(r)for(let n of Object.keys(r)){let i=r[n];i!==void 0&&(t[n]=i)}return t}async function da({fs:t,gitdir:e,author:r,commit:n}){let i=Math.floor(Date.now()/1e3),a={name:await wc({fs:t,gitdir:e,path:"user.name"}),email:await wc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=EE({},a,n?n.author:void 0,r);if(s.name!==void 0)return s}async function So({fs:t,gitdir:e,author:r,committer:n,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await wc({fs:t,gitdir:e,path:"user.name"}),email:await wc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=EE({},s,i?i.committer:void 0,r,n);if(o.name!==void 0)return o}async function kE({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,kE({fs:t,cache:e,gitdir:r,oid:n});if(i!=="commit")throw new rr(n,i,"commit");return{commit:mr.from(a),oid:n}}async function Eo({fs:t,cache:e,gitdir:r,oid:n}){let{commit:i,oid:a}=await kE({fs:t,cache:e,gitdir:r,oid:n});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function Qf({fs:t,cache:e,onSign:r,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:u=!1,noUpdateBranch:c=!1,ref:f,parent:d,tree:h}){let m=!1;f||(f=await z.resolve({fs:t,gitdir:n,ref:"HEAD",depth:2}));let g,v;try{g=await z.resolve({fs:t,gitdir:n,ref:f}),v=await Eo({fs:t,gitdir:n,oid:g,cache:{}})}catch(E){m=!0}if(l&&m)throw new vc(f);let w=l?await da({fs:t,gitdir:n,author:a,commit:v.commit}):await da({fs:t,gitdir:n,author:a});if(!w)throw new zt("author");let b=l?await So({fs:t,gitdir:n,author:w,committer:s,commit:v.commit}):await So({fs:t,gitdir:n,author:w,committer:s});if(!b)throw new zt("committer");return ct.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async function(E){let k=hE(E.entries).get(".");if(h||(h=await AE({fs:t,gitdir:n,inode:k,dryRun:u})),d?d=await Promise.all(d.map(S=>z.resolve({fs:t,gitdir:n,ref:S}))):l?d=v.commit.parent:d=g?[g]:[],!i)if(l)i=v.commit.message;else throw new hr("message");let A=mr.from({tree:h,parent:d,author:w,committer:b,message:i});o&&(A=await mr.sign(A,r,o));let y=await gr({fs:t,gitdir:n,type:"commit",object:A.toObject(),dryRun:u});return!c&&!u&&await z.writeRef({fs:t,gitdir:n,ref:f,value:y}),y})}async function AE({fs:t,gitdir:e,inode:r,dryRun:n}){let i=r.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await AE({fs:t,gitdir:e,inode:l,dryRun:n}));let a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),s=pr.from(a);return await gr({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:n})}async function yc({fs:t,cache:e,gitdir:r,oid:n,filepath:i}){if(i.startsWith("/"))throw new ca("leading-slash");if(i.endsWith("/"))throw new ca("trailing-slash");let a=n,s=await xo({fs:t,cache:e,gitdir:r,oid:n}),o=s.tree;if(i==="")n=s.oid;else{let l=i.split("/");n=await TE({fs:t,cache:e,gitdir:r,tree:o,pathArray:l,oid:a,filepath:i})}return n}async function TE({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let l of n)if(l.path===o){if(i.length===0)return l.oid;{let{type:u,object:c}=await qe({fs:t,cache:e,gitdir:r,oid:l.oid});if(u!=="tree")throw new rr(a,u,"tree",s);return n=pr.from(c),TE({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s})}}throw new Le(`file or directory found at "${a}:${s}"`)}async function Po({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){i!==void 0&&(n=await yc({fs:t,cache:e,gitdir:r,oid:n,filepath:i}));let{tree:a,oid:s}=await xo({fs:t,cache:e,gitdir:r,oid:n});return{oid:s,tree:a.entries()}}async function bc({fs:t,gitdir:e,tree:r}){let n=pr.from(r).toObject();return await gr({fs:t,gitdir:e,type:"tree",object:n,format:"content"})}async function H3({fs:t,cache:e,onSign:r,gitdir:n,ref:i,oid:a,note:s,force:o,author:l,committer:u,signingKey:c}){let f;try{f=await z.resolve({gitdir:n,fs:t,ref:i})}catch(w){if(!(w instanceof Le))throw w}let h=(await Po({fs:t,cache:e,gitdir:n,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 vn("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let m=await gr({fs:t,gitdir:n,type:"blob",object:s,format:"content"});h.push({mode:"100644",path:a,oid:m,type:"blob"});let g=await bc({fs:t,gitdir:n,tree:h});return await Qf({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:u,signingKey:c})}async function CE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:u,signingKey:c,cache:f={}}){try{C("fs",t),C("gitdir",n),C("oid",a),C("note",s),c&&C("onSign",e);let d=new J(t),h=await da({fs:d,gitdir:n,author:l});if(!h)throw new zt("author");let m=await So({fs:d,gitdir:n,author:h,committer:u});if(!m)throw new zt("committer");return await H3({fs:new J(d),cache:f,onSign:e,gitdir:n,ref:i,oid:a,note:s,force:o,author:h,committer:m,signingKey:c})}catch(d){throw d.caller="git.addNote",d}}async function PE({fs:t,gitdir:e,remote:r,url:n,force:i}){if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let a=await nt.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new vn("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await nt.save({fs:t,gitdir:e,config:a})}async function RE({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n,url:i,force:a=!1}){try{return C("fs",t),C("gitdir",r),C("remote",n),C("url",i),await PE({fs:new J(t),gitdir:r,remote:n,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function U3({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:u,force:c=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!c&&await z.exists({fs:t,gitdir:n,ref:i}))throw new vn("tag",i);let f=await z.resolve({fs:t,gitdir:n,ref:l||"HEAD"}),{type:d}=await qe({fs:t,cache:e,gitdir:n,oid:f}),h=Fr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});u&&(h=await Fr.sign(h,r,u));let m=await gr({fs:t,gitdir:n,type:"tag",object:h.toObject()});await z.writeRef({fs:t,gitdir:n,ref:i,value:m})}async function IE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:u,force:c=!1,cache:f={}}){try{C("fs",t),C("gitdir",n),C("ref",i),u&&C("onSign",e);let d=new J(t),h=await da({fs:d,gitdir:n,author:a});if(!h)throw new zt("tagger");return await U3({fs:d,cache:f,onSign:e,gitdir:n,ref:i,tagger:h,message:s,gpgsig:o,object:l,signingKey:u,force:c})}catch(d){throw d.caller="git.annotatedTag",d}}async function j3({fs:t,gitdir:e,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let s=`refs/heads/${r}`;if(!a&&await z.exists({fs:t,gitdir:e,ref:s}))throw new vn("branch",r,!1);let o;try{o=await z.resolve({fs:t,gitdir:e,ref:n||"HEAD"})}catch(l){}o&&await z.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await z.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function $E({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,object:i,checkout:a=!1,force:s=!1}){try{return C("fs",t),C("gitdir",r),C("ref",n),await j3({fs:new J(t),gitdir:r,ref:n,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var FE=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Mg({fs:t,cache:e,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:u,noUpdateHead:c,dryRun:f,force:d,track:h=!0,nonBlocking:m=!1,batchSize:g=100}){let v;if(n)try{v=await z.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let w;try{w=await z.resolve({fs:t,gitdir:a,ref:o})}catch(b){if(o==="HEAD")throw b;let E=`${s}/${o}`;if(w=await z.resolve({fs:t,gitdir:a,ref:E}),h){let x=await nt.get({fs:t,gitdir:a});await x.set(`branch.${o}.remote`,s),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await nt.save({fs:t,gitdir:a,config:x})}await z.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:w})}if(!u){let b;try{b=await G3({fs:t,cache:e,onProgress:r,dir:i,gitdir:a,ref:o,force:d,filepaths:l})}catch(y){throw y instanceof Le&&y.data.what===w?new oc(o,w):y}let E=b.filter(([y])=>y==="conflict").map(([y,S])=>S);if(E.length>0)throw new sc(E);let x=b.filter(([y])=>y==="error").map(([y,S])=>S);if(x.length>0)throw new de(x.join(", "));if(f){n&&await n({previousHead:v,newHead:w,type:l!=null&&l.length>0?"file":"branch"});return}let k=0,A=b.length;if(await ct.acquire({fs:t,gitdir:a,cache:e},async function(y){await Promise.all(b.filter(([S])=>S==="delete"||S==="delete-index").map(async function([S,_]){let T=`${i}/${_}`;S==="delete"&&await t.rm(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}))}),await ct.acquire({fs:t,gitdir:a,cache:e},async function(y){for(let[S,_]of b)if(S==="rmdir"||S==="rmdir-index"){let T=`${i}/${_}`;try{S==="rmdir"&&await t.rmdir(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}catch(P){if(P.code==="ENOTEMPTY")console.log(`Did not delete ${_} because directory is not empty`);else throw P}}}),await Promise.all(b.filter(([y])=>y==="mkdir"||y==="mkdir-index").map(async function([y,S]){let _=`${i}/${S}`;await t.mkdir(_),r&&await r({phase:"Updating workdir",loaded:++k,total:A})})),m){let y=b.filter(([_])=>_==="create"||_==="create-index"||_==="update"||_==="mkdir-index"),S=await eE("Update Working Dir",y.map(([_,T,P,F,D])=>()=>z3({fs:t,cache:e,gitdir:a,dir:i},[_,T,P,F,D])),r,g);await ct.acquire({fs:t,gitdir:a,cache:e,allowUnmerged:!0},async function(_){await eE("Update Index",S.map(([T,P,F])=>()=>q3({index:_,fullpath:T,oid:P,stats:F})),r,g)})}else await ct.acquire({fs:t,gitdir:a,cache:e,allowUnmerged:!0},async function(y){await Promise.all(b.filter(([S])=>S==="create"||S==="create-index"||S==="update"||S==="mkdir-index").map(async function([S,_,T,P,F]){let D=`${i}/${_}`;try{if(S!=="create-index"&&S!=="mkdir-index"){let{object:re}=await qe({fs:t,cache:e,gitdir:a,oid:T});if(F&&await t.rm(D),P===33188)await t.write(D,re);else if(P===33261)await t.write(D,re,{mode:511});else if(P===40960)await t.writelink(D,re);else throw new de(`Invalid mode 0o${P.toString(8)} detected in blob ${T}`)}let M=await t.lstat(D);P===33261&&(M.mode=493),S==="mkdir-index"&&(M.mode=57344),y.insert({filepath:_,stats:M,oid:T}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}catch(M){console.log(M)}}))});n&&await n({previousHead:v,newHead:w,type:l!=null&&l.length>0?"file":"branch"})}if(!c){let b=await z.expand({fs:t,gitdir:a,ref:o});b.startsWith("refs/heads")?await z.writeSymbolicRef({fs:t,gitdir:a,ref:"HEAD",value:b}):await z.writeRef({fs:t,gitdir:a,ref:"HEAD",value:w})}}async function G3({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,ref:a,force:s,filepaths:o}){let l=0;return ua({fs:t,cache:e,dir:n,gitdir:i,trees:[$r({ref:a}),Co(),ts()],map:async function(u,[c,f,d]){if(u===".")return;if(o&&!o.some(m=>FE(u,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!d,!!c,!!f].map(Number).join("")){case"000":return;case"001":return s&&o&&o.includes(u)?["delete",u]:void 0;case"010":switch(await c.type()){case"tree":return["mkdir",u];case"blob":return["create",u,await c.oid(),await c.mode()];case"commit":return["mkdir-index",u,await c.oid(),await c.mode()];default:return["error",`new entry Unhandled type ${await c.type()}`]}case"011":switch(`${await c.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",u];case"blob-blob":return await c.oid()!==await f.oid()?s?["update",u,await c.oid(),await c.mode(),await c.mode()!==await f.mode()]:["conflict",u]:await c.mode()!==await f.mode()?s?["update",u,await c.oid(),await c.mode(),!0]:["conflict",u]:["create-index",u,await c.oid(),await c.mode()];case"commit-tree":return;case"commit-blob":return["conflict",u];default:return["error",`new entry Unhandled type ${c.type}`]}case"100":return["delete-index",u];case"101":switch(await d.type()){case"tree":return["rmdir-index",u];case"blob":return await d.oid()!==await f.oid()?s?["delete",u]:["conflict",u]:["delete",u];case"commit":return["rmdir-index",u];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await c.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await c.oid()&&await d.mode()===await c.mode()&&!s)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await c.oid())return s?["update",u,await c.oid(),await c.mode(),await c.mode()!==await f.mode()]:["conflict",u]}else if(s)return["update",u,await c.oid(),await c.mode(),await c.mode()!==await d.mode()];return await c.mode()!==await d.mode()?["update",u,await c.oid(),await c.mode(),!0]:await c.oid()!==await d.oid()?["update",u,await c.oid(),await c.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",u,await c.oid()];case"blob-tree":return["update-blob-to-tree",u];case"commit-commit":return["mkdir-index",u,await c.oid(),await c.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await c.type()}`]}}},reduce:async function(u,c){return c=yE(c),u?u&&u[0]==="rmdir"?(c.push(u),c):(c.unshift(u),c):c}})}async function q3({index:t,fullpath:e,stats:r,oid:n}){try{t.insert({filepath:e,stats:r,oid:n})}catch(i){console.warn(`Error inserting ${e} into index:`,i)}}async function z3({fs:t,cache:e,gitdir:r,dir:n},[i,a,s,o,l]){let u=`${n}/${a}`;if(i!=="create-index"&&i!=="mkdir-index"){let{object:f}=await qe({fs:t,cache:e,gitdir:r,oid:s});if(l&&await t.rm(u),o===33188)await t.write(u,f);else if(o===33261)await t.write(u,f,{mode:511});else if(o===40960)await t.writelink(u,f);else throw new de(`Invalid mode 0o${o.toString(8)} detected in blob ${s}`)}let c=await t.lstat(u);return o===33261&&(c.mode=493),i==="mkdir-index"&&(c.mode=57344),[a,s,c]}async function eE(t,e,r,n){let i=[];try{for(let a=0;al());(await Promise.allSettled(s)).forEach(l=>{l.status==="fulfilled"&&i.push(l.value)}),r&&await r({phase:"Updating workdir",loaded:a+s.length,total:e.length})}return i}catch(a){console.error(`Error during ${t}: ${a}`)}return i}async function Dg({fs:t,onProgress:e,onPostCheckout:r,dir:n,gitdir:i=O.join(n,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:l=!1,noUpdateHead:u=s===void 0,dryRun:c=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:m=!1,batchSize:g=100}){try{C("fs",t),C("dir",n),C("gitdir",i);let v=s||"HEAD";return await Mg({fs:new J(t),cache:h,onProgress:e,onPostCheckout:r,dir:n,gitdir:i,remote:a,ref:v,filepaths:o,noCheckout:l,noUpdateHead:u,dryRun:c,force:f,track:d,nonBlocking:m,batchSize:g})}catch(v){throw v.caller="git.checkout",v}}var V3=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Ka(t){let e=V3.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function pa({fs:t,gitdir:e,fullname:r=!1,test:n=!1}){let i=await z.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(n)try{await z.resolve({fs:t,gitdir:e,ref:i})}catch(a){return}if(i.startsWith("refs/"))return r?i:Ka(i)}function W3(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function OE({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function _c(t,e){let r=gE(t);for(;;){let{value:n,done:i}=await r.next();if(n&&await e(n),i)break}r.return&&r.return()}async function Yf(t){let e=0,r=[];await _c(t,a=>{r.push(a),e+=a.byteLength});let n=new Uint8Array(e),i=0;for(let a of r)n.set(a,i),i+=a.byteLength;return n}function tE(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,n]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:n}}}function $g(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var Qe=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 r=e.length+4,n=$g(4,r);return Buffer.concat([Buffer.from(n,"utf8"),e])}static streamReader(e){let r=new zf(e);return async function(){try{let i=await r.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await r.read(i-4);return a==null?!0:a}catch(i){return e.error=i,!0}}}};async function rE(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let n=r.indexOf("=");if(n>-1){let i=r.slice(0,n),a=r.slice(n+1);e[i]=a}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function nE(t,{service:e}){let r=new Set,n=new Map,i=new Map,a=Qe.streamReader(t),s=await a();for(;s===null;)s=await a();if(s===!0)throw new lc;if(s.includes("version 2"))return rE(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Ja(`# service=${e}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:r,refs:n,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return rE(a);let[l,u]=gg(o,"\0","\\x00");if(u.split(" ").map(c=>r.add(c)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[c,f]=gg(l," "," ");for(n.set(f,c);;){let d=await a();if(d===!0)break;if(d!==null){let[h,m]=gg(d.toString("utf8")," "," ");n.set(m,h)}}}for(let c of r)if(c.startsWith("symref=")){let f=c.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:n,symrefs:i}}function gg(t,e,r){let n=t.trim().split(e);if(n.length!==2)throw new Ja(`Two strings separated by '${r}'`,t.toString("utf8"));return n}var iE=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,aE=(t,e)=>{(e.username||e.password)&&(t.Authorization=OE(e)),e.headers&&Object.assign(t,e.headers)},vg=async t=>{try{let e=Buffer.from(await Yf(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch(e){return{}}},ko=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:n,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:l,headers:u,protocolVersion:c}){let{url:f,auth:d}=tE(l),h=s?iE(s,f):f;(d.username||d.password)&&(u.Authorization=OE(d)),c===2&&(u["Git-Protocol"]="version=2");let m,g,v=!1;do if(m=await e.request({onProgress:r,method:"GET",url:`${h}/info/refs?service=${o}`,headers:u}),g=!1,m.statusCode===401||m.statusCode===203){let w=v?a:n;if(w){if(d=await w(f,{...d,headers:{...u}}),d&&d.cancel)throw new _o;d&&(aE(u,d),v=!0,g=!0)}}else m.statusCode===200&&v&&i&&await i(f,d);while(g);if(m.statusCode!==200){let{response:w}=await vg(m);throw new vo(m.statusCode,m.statusMessage,w)}if(m.headers["content-type"]===`application/x-${o}-advertisement`){let w=await nE(m.body,{service:o});return w.auth=d,w}else{let{preview:w,response:b,data:E}=await vg(m);try{let x=await nE([E],{service:o});return x.auth=d,x}catch(x){throw new hc(w,b)}}}static async connect({http:e,onProgress:r,corsProxy:n,service:i,url:a,auth:s,body:o,headers:l}){let u=tE(a);u&&(a=u.url),n&&(a=iE(n,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,aE(l,s);let c=await e.request({onProgress:r,method:"POST",url:`${a}/${i}`,body:o,headers:l});if(c.statusCode!==200){let{response:f}=vg(c);throw new vo(c.statusCode,c.statusMessage,f)}return c}};function Y3({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 Ao=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",ko),r.set("https",ko);let n=Y3({url:e});if(!n)throw new mc(e);if(r.has(n.transport))return r.get(n.transport);throw new pc(e,n.transport,n.transport==="ssh"?W3(e):void 0)}},Za=null,Qa=class{static async read({fs:e,gitdir:r}){Za===null&&(Za=new tc);let n=O.join(r,"shallow"),i=new Set;return await Za.acquire(n,async function(){let a=await e.read(n,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(` +`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:r,oids:n}){Za===null&&(Za=new tc);let i=O.join(r,"shallow");if(n.size>0){let a=[...n].join(` +`)+` +`;await Za.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Za.acquire(i,async function(){await e.rm(i)})}};async function X3({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${n}`)}async function Z3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await t.readdir(O.join(r,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${r}/objects/pack/${s}`,l=await Og({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new de(l.error);if(l.offsets.has(n))return!0}return!1}async function sE({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let a=o=>qe({fs:t,cache:e,gitdir:r,oid:o}),s=await X3({fs:t,gitdir:r,oid:n});return s||(s=await Z3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a})),s}function K3(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function ME(t,e){let r=t.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return r.includes(i)})}var td={name:"isomorphic-git",version:"1.32.2",agent:"git/isomorphic-git@1.32.2"},ho=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function J3(t){let e=t.indexOf("\r"),r=t.indexOf(` +`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function DE(t){let e=new ho,r="";return(async()=>(await _c(t,n=>{for(n=n.toString("utf8"),r+=n;;){let i=J3(r);if(i===-1)break;e.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&e.write(r),e.end()))(),e}var Xf=class{static demux(e){let r=Qe.streamReader(e),n=new ho,i=new ho,a=new ho,s=async function(){let o=await r();if(o===null)return s();if(o===!0){n.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),n.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(o)}s()};return s(),{packetlines:n,packfile:i,progress:a}}};async function Q3(t){let{packetlines:e,packfile:r,progress:n}=Xf.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((u,c)=>{_c(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&c(new oa(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&c(new oa(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,m]=d.split(" ");s.push({oid:h,status:m}),m||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?c(t.error):u({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))}).finally(()=>{l||(t.error?c(t.error):u({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))})})}function e8({capabilities:t=[],wants:e=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let u of e)o.push(Qe.encode(`want ${u}${l} +`)),l="";for(let u of n)o.push(Qe.encode(`shallow ${u} +`));i!==null&&o.push(Qe.encode(`deepen ${i} +`)),a!==null&&o.push(Qe.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)} +`));for(let u of s)o.push(Qe.encode(`deepen-not ${u} +`));o.push(Qe.flush());for(let u of r)o.push(Qe.encode(`have ${u} +`));return o.push(Qe.encode(`done +`)),o}async function Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:u,remoteRef:c,remote:f,url:d,corsProxy:h,depth:m=null,since:g=null,exclude:v=[],relative:w=!1,tags:b=!1,singleBranch:E=!1,headers:x={},prune:k=!1,pruneTags:A=!1}){let y=u||await pa({fs:t,gitdir:l,test:!0}),S=await nt.get({fs:t,gitdir:l}),_=f||y&&await S.get(`branch.${y}.remote`)||"origin",T=d||await S.get(`remote.${_}.url`);if(typeof T=="undefined")throw new hr("remote OR url");let P=c||y&&await S.get(`branch.${y}.merge`)||u||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let F=Ao.getRemoteHelperFor({url:T}),D=await F.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:T,headers:x,protocolVersion:1}),M=D.auth,re=D.refs;if(re.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!D.capabilities.has("shallow"))throw new sa("shallow","depth");if(g!==null&&!D.capabilities.has("deepen-since"))throw new sa("deepen-since","since");if(v.length>0&&!D.capabilities.has("deepen-not"))throw new sa("deepen-not","exclude");if(w===!0&&!D.capabilities.has("deepen-relative"))throw new sa("deepen-relative","relative");let{oid:ye,fullref:me}=z.resolveAgainstMap({ref:P,map:re});for(let G of re.keys())G===me||G==="HEAD"||G.startsWith("refs/heads/")||b&&G.startsWith("refs/tags/")||re.delete(G);let fe=ME([...D.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${td.agent}`]);w&&fe.push("deepen-relative");let Ge=E?[ye]:re.values(),oe=E?[y]:await z.listRefs({fs:t,gitdir:l,filepath:"refs"}),B=[];for(let G of oe)try{G=await z.expand({fs:t,gitdir:l,ref:G});let Je=await z.resolve({fs:t,gitdir:l,ref:G});await sE({fs:t,cache:e,gitdir:l,oid:Je})&&B.push(Je)}catch(Je){}B=[...new Set(B)];let Z=await Qa.read({fs:t,gitdir:l}),H=D.capabilities.has("shallow")?[...Z]:[],Oe=e8({capabilities:fe,wants:Ge,haves:B,shallows:H,depth:m,since:g,exclude:v}),cr=Buffer.from(await Yf(Oe)),Gt=await F.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:T,auth:M,body:[cr],headers:x}),Y=await Q3(Gt.body);Gt.headers&&(Y.headers=Gt.headers);for(let G of Y.shallows)if(!Z.has(G))try{let{object:Je}=await qe({fs:t,cache:e,gitdir:l,oid:G}),N=new mr(Je),X=await Promise.all(N.headers().parent.map(We=>sE({fs:t,cache:e,gitdir:l,oid:We})));X.length===0||X.every(We=>We)||Z.add(G)}catch(Je){Z.add(G)}for(let G of Y.unshallows)Z.delete(G);if(await Qa.write({fs:t,gitdir:l,oids:Z}),E){let G=new Map([[me,ye]]),Je=new Map,N=10,X=me;for(;N--;){let $t=D.symrefs.get(X);if($t===void 0)break;Je.set(X,$t),X=$t}let Ee=re.get(X);Ee&&G.set(X,Ee);let{pruned:We}=await z.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:G,symrefs:Je,tags:b,prune:k});k&&(Y.pruned=We)}else{let{pruned:G}=await z.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:re,symrefs:D.symrefs,tags:b,prune:k,pruneTags:A});k&&(Y.pruned=G)}if(Y.HEAD=D.symrefs.get("HEAD"),Y.HEAD===void 0){let{oid:G}=z.resolveAgainstMap({ref:"HEAD",map:re});for(let[Je,N]of re.entries())if(Je!=="HEAD"&&N===G){Y.HEAD=Je;break}}let Ie=me.startsWith("refs/tags")?"tag":"branch";if(Y.FETCH_HEAD={oid:ye,description:`${Ie} '${Ka(me)}' of ${T}`},n||i){let G=DE(Y.progress);_c(G,async Je=>{if(i&&await i(Je),n){let N=Je.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);N&&await n({phase:N[1].trim(),loaded:parseInt(N[2],10),total:parseInt(N[3],10)})}})}let Me=Buffer.from(await Yf(Y.packfile));if(Gt.body.error)throw Gt.body.error;let It=Me.slice(-20).toString("hex"),De={defaultBranch:Y.HEAD,fetchHead:Y.FETCH_HEAD.oid,fetchHeadDescription:Y.FETCH_HEAD.description};if(Y.headers&&(De.headers=Y.headers),k&&(De.pruned=Y.pruned),It!==""&&!K3(Me)){De.packfile=`objects/pack/pack-${It}.pack`;let G=O.join(l,De.packfile);await t.write(G,Me);let Je=X=>qe({fs:t,cache:e,gitdir:l,oid:X}),N=await ic.fromPack({pack:Me,getExternalRefDelta:Je,onProgress:n});await t.write(G.replace(/\.pack$/,".idx"),await N.toBuffer())}return De}async function LE({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:O.join(r,".git"),defaultBranch:i="master"}){if(await t.exists(n+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>n+"/"+s);for(let s of a)await t.mkdir(s);await t.write(n+"/config",`[core] + repositoryformatversion = 0 + filemode = false + bare = ${e} +`+(e?"":` logallrefupdates = true +`)+` symlinks = false + ignorecase = true +`),await t.write(n+"/HEAD",`ref: refs/heads/${i} +`)}async function t8({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:u,gitdir:c,url:f,corsProxy:d,ref:h,remote:m,depth:g,since:v,exclude:w,relative:b,singleBranch:E,noCheckout:x,noTags:k,headers:A,nonBlocking:y,batchSize:S=100}){try{if(await LE({fs:t,gitdir:c}),await PE({fs:t,gitdir:c,remote:m,url:f,force:!1}),d){let P=await nt.get({fs:t,gitdir:c});await P.set("http.corsProxy",d),await nt.save({fs:t,gitdir:c,config:P})}let{defaultBranch:_,fetchHead:T}=await Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:h,remote:m,corsProxy:d,depth:g,since:v,exclude:w,relative:b,singleBranch:E,headers:A,tags:!k});if(T===null)return;h=h||_,h=h.replace("refs/heads/",""),await Mg({fs:t,cache:e,onProgress:n,onPostCheckout:l,dir:u,gitdir:c,ref:h,remote:m,noCheckout:x,nonBlocking:y,batchSize:S})}catch(_){throw await t.rmdir(c,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function NE({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:u=O.join(l,".git"),url:c,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:m=void 0,since:g=void 0,exclude:v=[],relative:w=!1,singleBranch:b=!1,noCheckout:E=!1,noTags:x=!1,headers:k={},cache:A={},nonBlocking:y=!1,batchSize:S=100}){try{return C("fs",t),C("http",e),C("gitdir",u),E||C("dir",l),C("url",c),await t8({fs:new J(t),cache:A,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:u,url:c,corsProxy:f,ref:d,remote:h,depth:m,since:g,exclude:v,relative:w,singleBranch:b,noCheckout:E,noTags:x,headers:k,nonBlocking:y,batchSize:S})}catch(_){throw _.caller="git.clone",_}}async function BE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:u=!1,noUpdateBranch:c=!1,ref:f,parent:d,tree:h,cache:m={}}){try{C("fs",t),l||C("message",i),o&&C("onSign",e);let g=new J(t);return await Qf({fs:g,cache:m,onSign:e,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:u,noUpdateBranch:c,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function HE({fs:t,dir:e,gitdir:r=O.join(e,".git"),fullname:n=!1,test:i=!1}){try{return C("fs",t),C("gitdir",r),await pa({fs:new J(t),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function r8({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await z.exists({fs:t,gitdir:e,ref:r}))throw new Le(r);let i=await z.expand({fs:t,gitdir:e,ref:r}),a=await pa({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await z.resolve({fs:t,gitdir:e,ref:i});await z.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await z.deleteRef({fs:t,gitdir:e,ref:i});let s=Ka(r),o=await nt.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await nt.save({fs:t,gitdir:e,config:o})}async function UE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("ref",n),await r8({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function jE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{C("fs",t),C("ref",n),await z.deleteRef({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function n8({fs:t,gitdir:e,remote:r}){let n=await nt.get({fs:t,gitdir:e});await n.deleteSection("remote",r),await nt.save({fs:t,gitdir:e,config:n})}async function GE({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n}){try{return C("fs",t),C("remote",n),await n8({fs:new J(t),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function i8({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await z.deleteRef({fs:t,gitdir:e,ref:r})}async function qE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("ref",n),await i8({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function a8({fs:t,gitdir:e,oid:r}){let n=r.slice(0,2);return(await t.readdir(`${e}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function s8({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=[],s=await t.readdir(O.join(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,u=await Og({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(u.error)throw new de(u.error);for(let c of u.offsets.keys())c.startsWith(n)&&a.push(c)}return a}async function o8({fs:t,cache:e,gitdir:r,oid:n}){let i=o=>qe({fs:t,cache:e,gitdir:r,oid:o}),a=await a8({fs:t,gitdir:r,oid:n}),s=await s8({fs:t,cache:e,gitdir:r,oid:n,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 ac("oids",n,a):new Le(`an object matching "${n}"`)}async function zE({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await o8({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function VE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("gitdir",r),C("ref",n),await z.expand({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function Ng({fs:t,cache:e,gitdir:r,oids:n}){let i={},a=n.length,s=n.map((o,l)=>({index:l,oid:o}));for(;s.length;){let o=new Set;for(let{oid:u,index:c}of s)i[u]||(i[u]=new Set),i[u].add(c),i[u].size===a&&o.add(u);if(o.size>0)return[...o];let l=new Map;for(let{oid:u,index:c}of s)try{let{object:f}=await qe({fs:t,cache:e,gitdir:r,oid:u}),d=mr.from(f),{parent:h}=d.parseHeaders();for(let m of h)(!i[m]||!i[m].has(c))&&l.set(m+":"+c,{oid:m,index:c})}catch(f){}s=Array.from(l.values())}return[]}var wg=/^.*(\r?\n|$)/gm;function l8({branches:t,contents:e}){let r=t[1],n=t[2],i=e[0],a=e[1],s=e[2],o=a.match(wg),l=i.match(wg),u=s.match(wg),c=GH(o,l,u),f=7,d="",h=!0;for(let m of c)m.ok&&(d+=m.ok.join("")),m.conflict&&(h=!1,d+=`${"<".repeat(f)} ${r} +`,d+=m.conflict.a.join(""),d+=`${"=".repeat(f)} +`,d+=m.conflict.b.join(""),d+=`${">".repeat(f)} ${n} +`);return{cleanMerge:h,mergedText:d}}async function c8({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:u="base",theirName:c="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let m=$r({ref:a}),g=$r({ref:s}),v=$r({ref:o}),w=[],b=[],E=[],x=[],k=await ua({fs:t,cache:e,dir:r,gitdir:n,trees:[m,g,v],map:async function(A,[y,S,_]){let T=jf(A),P=await Wf(y,S),F=await Wf(_,S);switch(`${P}-${F}`){case"false-false":return{mode:await S.mode(),path:T,oid:await S.oid(),type:await S.type()};case"false-true":return!_&&await y.type()==="tree"?{mode:await y.mode(),path:T,oid:await y.oid(),type:await y.type()}:_?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return!y&&await _.type()==="tree"?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:y?{mode:await y.mode(),path:T,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&_&&await y.type()==="tree"&&await _.type()==="tree")return{mode:await y.mode(),path:T,oid:await y.oid(),type:"tree"};if(y&&_&&await y.type()==="blob"&&await _.type()==="blob")return u8({fs:t,gitdir:n,path:T,ours:y,base:S,theirs:_,ourName:l,baseName:u,theirName:c,mergeDriver:h}).then(async D=>{if(D.cleanMerge)d||i.insert({filepath:A,oid:D.mergeResult.oid,stage:0});else if(w.push(A),b.push(A),!d){let M="";S&&await S.type()==="blob"&&(M=await S.oid());let re=await y.oid(),ye=await _.oid();i.delete({filepath:A}),M&&i.insert({filepath:A,oid:M,stage:1}),i.insert({filepath:A,oid:re,stage:2}),i.insert({filepath:A,oid:ye,stage:3})}return D.mergeResult});if(S&&!y&&_&&await S.type()==="blob"&&await _.type()==="blob"){if(w.push(A),E.push(A),!d){let D=await S.oid(),M=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:D,stage:1}),i.insert({filepath:A,oid:M,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:T}}if(S&&y&&!_&&await S.type()==="blob"&&await y.type()==="blob"){if(w.push(A),x.push(A),!d){let D=await S.oid(),M=await y.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:D,stage:1}),i.insert({filepath:A,oid:M,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:T}}if(S&&!y&&!_&&(await S.type()==="blob"||await S.type()==="tree"))return;throw new wo}}},reduce:w.length!==0&&(!r||d)?void 0:async(A,y)=>{let S=y.filter(Boolean);if(A&&!(A&&A.type==="tree"&&S.length===0&&A.path!==".")){if(S.length>0||A.path==="."&&S.length===0){let T=new pr(S).toObject(),P=await gr({fs:t,gitdir:n,type:"tree",object:T,dryRun:f});A.oid=P}return A}}});return w.length!==0?(r&&!d&&await ua({fs:t,cache:e,dir:r,gitdir:n,trees:[$r({ref:k.oid})],map:async function(A,[y]){let S=`${r}/${A}`;if(await y.type()==="blob"){let _=await y.mode(),T=new TextDecoder().decode(await y.content());await t.write(S,T,{mode:_})}return!0}}),new yo(w,b,E,x)):k.oid}async function u8({fs:t,gitdir:e,path:r,ours:n,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:u,mergeDriver:c=l8}){let f="blob",d="100755",h="",m="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),m=Buffer.from(await i.content()).toString("utf8"));let g=d===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await a.oid(),type:f}};if(await a.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};let v=Buffer.from(await n.content()).toString("utf8"),w=Buffer.from(await a.content()).toString("utf8"),{mergedText:b,cleanMerge:E}=await c({branches:[l,s,o],contents:[m,v,w],path:r}),x=await gr({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:u});return{cleanMerge:E,mergeResult:{mode:g,path:r,oid:x,type:f}}}async function WE({fs:t,cache:e,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:u=!1,abortOnConflict:c=!0,message:f,author:d,committer:h,signingKey:m,onSign:g,mergeDriver:v,allowUnrelatedHistories:w=!1}){i===void 0&&(i=await pa({fs:t,gitdir:n,fullname:!0})),i=await z.expand({fs:t,gitdir:n,ref:i}),a=await z.expand({fs:t,gitdir:n,ref:a});let b=await z.resolve({fs:t,gitdir:n,ref:i}),E=await z.resolve({fs:t,gitdir:n,ref:a}),x=await Ng({fs:t,cache:e,gitdir:n,oids:[b,E]});if(x.length!==1)if(x.length===0&&w)x.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new wo;let k=x[0];if(k===E)return{oid:b,alreadyMerged:!0};if(s&&k===b)return!l&&!u&&await z.writeRef({fs:t,gitdir:n,ref:i,value:E}),{oid:E,fastForward:!0};{if(o)throw new cc;let A=await ct.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async S=>c8({fs:t,cache:e,dir:r,gitdir:n,index:S,ourOid:b,theirOid:E,baseOid:k,ourName:Ka(i),baseName:"base",theirName:Ka(a),dryRun:l,abortOnConflict:c,mergeDriver:v}));if(A instanceof yo)throw A;return f||(f=`Merge branch '${Ka(a)}' into ${Ka(i)}`),{oid:await Qf({fs:t,cache:e,gitdir:n,message:f,ref:i,tree:A,parent:[b,E],author:d,committer:h,signingKey:m,onSign:g,dryRun:l,noUpdateBranch:u}),tree:A,mergeCommit:!0}}}async function YE({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:l,gitdir:u,ref:c,url:f,remote:d,remoteRef:h,prune:m,pruneTags:g,fastForward:v,fastForwardOnly:w,corsProxy:b,singleBranch:E,headers:x,author:k,committer:A,signingKey:y}){try{if(!c){let T=await pa({fs:t,gitdir:u});if(!T)throw new hr("ref");c=T}let{fetchHead:S,fetchHeadDescription:_}=await Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,corsProxy:b,ref:c,url:f,remote:d,remoteRef:h,singleBranch:E,headers:x,prune:m,pruneTags:g});await WE({fs:t,cache:e,gitdir:u,ours:c,theirs:S,fastForward:v,fastForwardOnly:w,message:`Merge ${_}`,author:k,committer:A,signingKey:y,dryRun:!1,noUpdateBranch:!1}),await Mg({fs:t,cache:e,onProgress:n,dir:l,gitdir:u,ref:c,remote:d,noCheckout:!1})}catch(S){throw S.caller="git.pull",S}}async function XE({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=O.join(o,".git"),ref:u,url:c,remote:f,remoteRef:d,corsProxy:h,singleBranch:m,headers:g={},cache:v={}}){try{C("fs",t),C("http",e),C("gitdir",l);let w={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await YE({fs:new J(t),cache:v,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:u,url:c,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:m,headers:g,author:w,committer:w})}catch(w){throw w.caller="git.fastForward",w}}async function ZE({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=O.join(o,".git"),ref:u,remote:c,remoteRef:f,url:d,corsProxy:h,depth:m=null,since:g=null,exclude:v=[],relative:w=!1,tags:b=!1,singleBranch:E=!1,headers:x={},prune:k=!1,pruneTags:A=!1,cache:y={}}){try{return C("fs",t),C("http",e),C("gitdir",l),await Lg({fs:new J(t),cache:y,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:l,ref:u,remote:c,remoteRef:f,url:d,corsProxy:h,depth:m,since:g,exclude:v,relative:w,tags:b,singleBranch:E,headers:x,prune:k,pruneTags:A})}catch(S){throw S.caller="git.fetch",S}}async function KE({fs:t,dir:e,gitdir:r=O.join(e,".git"),oids:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oids",n),await Ng({fs:new J(t),cache:i,gitdir:r,oids:n})}catch(a){throw a.caller="git.findMergeBase",a}}async function JE({fs:t,filepath:e}){if(await t.exists(O.join(e,".git")))return e;{let r=go(e);if(r===e)throw new Le(`git root for ${e}`);return JE({fs:t,filepath:r})}}async function QE({fs:t,filepath:e}){try{return C("fs",t),C("filepath",e),await JE({fs:new J(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function ek({fs:t,dir:e,gitdir:r=O.join(e,".git"),path:n}){try{return C("fs",t),C("gitdir",r),C("path",n),await wc({fs:new J(t),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function f8({fs:t,gitdir:e,path:r}){return(await nt.get({fs:t,gitdir:e})).getall(r)}async function tk({fs:t,dir:e,gitdir:r=O.join(e,".git"),path:n}){try{return C("fs",t),C("gitdir",r),C("path",n),await f8({fs:new J(t),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function rk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{C("http",t),C("url",a);let u=await Ao.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),c={capabilities:[...u.capabilities]};for(let[f,d]of u.refs){let h=f.split("/"),m=h.pop(),g=c;for(let v of h)g[v]=g[v]||{},g=g[v];g[m]=d}for(let[f,d]of u.symrefs){let h=f.split("/"),m=h.pop(),g=c;for(let v of h)g[v]=g[v]||{},g=g[v];g[m]=d}return c}catch(l){throw l.caller="git.getRemoteInfo",l}}function nk(t,e,r,n){let i=[];for(let[a,s]of t.refs){if(e&&!a.startsWith(e))continue;if(a.endsWith("^{}")){if(n){let l=a.replace("^{}",""),u=i[i.length-1],c=u.ref===l?u:i.find(f=>f.ref===l);if(c===void 0)throw new Error("I did not expect this to happen");c.peeled=s}continue}let o={ref:a,oid:s};r&&t.symrefs.has(a)&&(o.target=t.symrefs.get(a)),i.push(o)}return i}async function ik({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2}){try{C("http",t),C("url",a);let c=await Ao.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(c.protocolVersion===2)return{protocolVersion:c.protocolVersion,capabilities:c.capabilities2};let f={};for(let d of c.capabilities){let[h,m]=d.split("=");m?f[h]=m:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:nk(c,void 0,!0,!0)}}catch(u){throw u.caller="git.getRemoteInfo2",u}}async function d8({type:t,object:e,format:r="content",oid:n=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=la.wrap({type:t,object:e})),n=await ki(e)),{oid:n,object:e}}async function ak({object:t}){try{C("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t=Buffer.from(t);let e="blob",{oid:r,object:n}=await d8({type:"blob",format:"content",object:t});return{oid:r,type:e,object:new Uint8Array(n),format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function h8({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,filepath:a}){try{a=O.join(n,a);let s=await t.read(a),o=u=>qe({fs:t,cache:e,gitdir:i,oid:u}),l=await ic.fromPack({pack:s,getExternalRefDelta:o,onProgress:r});return await t.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function sk({fs:t,onProgress:e,dir:r,gitdir:n=O.join(r,".git"),filepath:i,cache:a={}}){try{return C("fs",t),C("dir",r),C("gitdir",r),C("filepath",i),await h8({fs:new J(t),cache:a,onProgress:e,dir:r,gitdir:n,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function ok({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:O.join(r,".git"),defaultBranch:i="master"}){try{return C("fs",t),C("gitdir",n),e||C("dir",r),await LE({fs:new J(t),bare:e,dir:r,gitdir:n,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function lk({fs:t,cache:e,gitdir:r,oid:n,ancestor:i,depth:a}){let s=await Qa.read({fs:t,gitdir:r});if(!n)throw new hr("oid");if(!i)throw new hr("ancestor");if(n===i)return!1;let o=[n],l=new Set,u=0;for(;o.length;){if(u++===a)throw new fc(a);let c=o.shift(),{type:f,object:d}=await qe({fs:t,cache:e,gitdir:r,oid:c});if(f!=="commit")throw new rr(c,f,"commit");let h=mr.from(d).parse();for(let m of h.parent)if(m===i)return!0;if(!s.has(c))for(let m of h.parent)l.has(m)||(o.push(m),l.add(m))}return!1}async function ck({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,ancestor:i,depth:a=-1,cache:s={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),C("ancestor",i),await lk({fs:new J(t),cache:s,gitdir:r,oid:n,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function uk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n}){try{return C("fs",t),C("dir",e),C("gitdir",r),C("filepath",n),fa.isIgnored({fs:new J(t),dir:e,gitdir:r,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function fk({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n}){try{return C("fs",t),C("gitdir",r),z.listBranches({fs:new J(t),gitdir:r,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function p8({fs:t,gitdir:e,ref:r,cache:n}){if(r){let i=await z.resolve({gitdir:e,fs:t,ref:r}),a=[];return await dk({fs:t,cache:n,gitdir:e,oid:i,filenames:a,prefix:""}),a}else return ct.acquire({fs:t,gitdir:e,cache:n},async function(i){return i.entries.map(a=>a.path)})}async function dk({fs:t,cache:e,gitdir:r,oid:n,filenames:i,prefix:a}){let{tree:s}=await Po({fs:t,cache:e,gitdir:r,oid:n});for(let o of s)o.type==="tree"?await dk({fs:t,cache:e,gitdir:r,oid:o.oid,filenames:i,prefix:O.join(a,o.path)}):i.push(O.join(a,o.path))}async function hk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),await p8({fs:new J(t),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function m8({fs:t,cache:e,gitdir:r,ref:n}){let i;try{i=await z.resolve({gitdir:r,fs:t,ref:n})}catch(o){if(o instanceof Le)return[]}return(await Po({fs:t,cache:e,gitdir:r,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function pk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="refs/notes/commits",cache:i={}}){try{return C("fs",t),C("gitdir",r),C("ref",n),await m8({fs:new J(t),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function mk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n}){try{return C("fs",t),C("gitdir",r),z.listRefs({fs:new J(t),gitdir:r,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function g8({fs:t,gitdir:e}){let r=await nt.get({fs:t,gitdir:e}),n=await r.getSubsections("remote");return Promise.all(n.map(async a=>{let s=await r.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function gk({fs:t,dir:e,gitdir:r=O.join(e,".git")}){try{return C("fs",t),C("gitdir",r),await g8({fs:new J(t),gitdir:r})}catch(n){throw n.caller="git.listRemotes",n}}async function v8(t){let e=Qe.streamReader(t),r=[],n;for(;n=await e(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let[i,a,...s]=n.split(" "),o={ref:a,oid:i};for(let l of s){let[u,c]=l.split(":");u==="symref-target"?o.target=c:u==="peeled"&&(o.peeled=c)}r.push(o)}return r}async function w8({prefix:t,symrefs:e,peelTags:r}){let n=[];return n.push(Qe.encode(`command=ls-refs +`)),n.push(Qe.encode(`agent=${td.agent} +`)),(r||e||t)&&n.push(Qe.delim()),r&&n.push(Qe.encode("peel")),e&&n.push(Qe.encode("symrefs")),t&&n.push(Qe.encode(`ref-prefix ${t}`)),n.push(Qe.flush()),n}async function vk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:u,symrefs:c,peelTags:f}){try{C("http",t),C("url",a);let d=await ko.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(d.protocolVersion===1)return nk(d,u,c,f);let h=await w8({prefix:u,symrefs:c,peelTags:f}),m=await ko.connect({http:t,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return v8(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function wk({fs:t,dir:e,gitdir:r=O.join(e,".git")}){try{return C("fs",t),C("gitdir",r),z.listTags({fs:new J(t),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function y8(t,e){return t.committer.timestamp-e.committer.timestamp}var b8="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function oE({fs:t,cache:e,gitdir:r,oid:n,fileId:i}){if(i===b8)return;let a=n,s,o=await xo({fs:t,cache:e,gitdir:r,oid:n}),l=o.tree;return i===o.oid?s=o.path:(s=await yk({fs:t,cache:e,gitdir:r,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function yk({fs:t,cache:e,gitdir:r,tree:n,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=n.entries().map(function(u){let c;return u.oid===i?(c=O.join(o,u.path),s.push(c)):u.type==="tree"&&(c=qe({fs:t,cache:e,gitdir:r,oid:u.oid}).then(function({object:f}){return yk({fs:t,cache:e,gitdir:r,tree:pr.from(f),fileId:i,oid:a,filepaths:s,parentPath:O.join(o,u.path)})})),c});return await Promise.all(l),s}async function _8({fs:t,cache:e,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l}){let u=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),c=[],f=await Qa.read({fs:t,gitdir:r}),d=await z.resolve({fs:t,gitdir:r,ref:i}),h=[await Eo({fs:t,cache:e,gitdir:r,oid:d})],m,g,v;function w(b){v&&n&&c.push(b)}for(;h.length>0;){let b=h.pop();if(u!==void 0&&b.commit.committer.timestamp<=u)break;if(n){let E;try{E=await yc({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:n}),g&&m!==E&&c.push(g),m=E,g=b,v=!0}catch(x){if(x instanceof Le){let k=l&&m;if(k&&(k=await oE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:m}),k))if(Array.isArray(k)){if(g){let A=await oE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:m});if(Array.isArray(A))if(k=k.filter(y=>A.indexOf(y)===-1),k.length===1)k=k[0],n=k,g&&c.push(g);else{k=!1,g&&c.push(g);break}}}else n=k,g&&c.push(g);if(!k){if(v&&m&&(c.push(g),!o))break;if(!o&&!l)throw x}g=b,v=!1}else throw x}}else c.push(b);if(a!==void 0&&c.length===a){w(b);break}if(!f.has(b.oid))for(let E of b.commit.parent){let x=await Eo({fs:t,cache:e,gitdir:r,oid:E});h.map(k=>k.oid).includes(x.oid)||h.push(x)}h.length===0&&w(b),h.sort((E,x)=>y8(E.commit,x.commit))}return c}async function bk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:u={}}){try{return C("fs",t),C("gitdir",r),C("ref",i),await _8({fs:new J(t),cache:u,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l})}catch(c){throw c.caller="git.log",c}}async function _k({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:u=!1,abortOnConflict:c=!0,message:f,author:d,committer:h,signingKey:m,cache:g={},mergeDriver:v,allowUnrelatedHistories:w=!1}){try{C("fs",t),m&&C("onSign",e);let b=new J(t),E=await da({fs:b,gitdir:n,author:d});if(!E&&(!o||!s))throw new zt("author");let x=await So({fs:b,gitdir:n,author:E,committer:h});if(!x&&(!o||!s))throw new zt("committer");return await WE({fs:b,cache:g,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:u,abortOnConflict:c,message:f,author:E,committer:x,signingKey:m,onSign:e,mergeDriver:v,allowUnrelatedHistories:w})}catch(b){throw b.caller="git.merge",b}}var x8={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function xk({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),oids:i}){let a=new cE,s=[];function o(c,f){let d=Buffer.from(c,f);s.push(d),a.update(d)}async function l({stype:c,object:f}){let d=x8[c],h=f.length,m=h>15?128:0,g=h&15;h=h>>>4;let v=(m|d|g).toString(16);for(o(v,"hex");m;)m=h>127?128:0,v=m|h&127,o($g(2,v),"hex"),h=h>>>7;o(Buffer.from(await _E(f)))}o("PACK"),o("00000002","hex"),o($g(8,i.length),"hex");for(let c of i){let{type:f,object:d}=await qe({fs:t,cache:e,gitdir:n,oid:c});await l({write:o,object:d,stype:f})}let u=a.digest();return s.push(u),s}async function S8({fs:t,cache:e,gitdir:r,oids:n,write:i}){let a=await xk({fs:t,cache:e,gitdir:r,oids:n}),s=Buffer.from(await Yf(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(O.join(r,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function Sk({fs:t,dir:e,gitdir:r=O.join(e,".git"),oids:n,write:i=!1,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oids",n),await S8({fs:new J(t),cache:a,gitdir:r,oids:n,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function Ek({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=O.join(o,".git"),ref:u,url:c,remote:f,remoteRef:d,prune:h=!1,pruneTags:m=!1,fastForward:g=!0,fastForwardOnly:v=!1,corsProxy:w,singleBranch:b,headers:E={},author:x,committer:k,signingKey:A,cache:y={}}){try{C("fs",t),C("gitdir",l);let S=new J(t),_=await da({fs:S,gitdir:l,author:x});if(!_)throw new zt("author");let T=await So({fs:S,gitdir:l,author:_,committer:k});if(!T)throw new zt("committer");return await YE({fs:S,cache:y,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:u,url:c,remote:f,remoteRef:d,fastForward:g,fastForwardOnly:v,corsProxy:w,singleBranch:b,headers:E,author:_,committer:T,signingKey:A,prune:h,pruneTags:m})}catch(S){throw S.caller="git.pull",S}}async function E8({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),start:i,finish:a}){let s=await Qa.read({fs:t,gitdir:n}),o=new Set,l=new Set;for(let f of i)o.add(await z.resolve({fs:t,gitdir:n,ref:f}));for(let f of a)try{let d=await z.resolve({fs:t,gitdir:n,ref:f});l.add(d)}catch(d){}let u=new Set;async function c(f){u.add(f);let{type:d,object:h}=await qe({fs:t,cache:e,gitdir:n,oid:f});if(d==="tag"){let g=Fr.from(h).headers().object;return c(g)}if(d!=="commit")throw new rr(f,d,"commit");if(!s.has(f)){let g=mr.from(h).headers().parent;for(f of g)!l.has(f)&&!u.has(f)&&await c(f)}}for(let f of o)await c(f);return u}async function yg({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:l,object:u}=await qe({fs:t,cache:e,gitdir:n,oid:o});if(l==="tag"){let f=Fr.from(u).headers().object;await s(f)}else if(l==="commit"){let f=mr.from(u).headers().tree;await s(f)}else if(l==="tree"){let c=pr.from(u);for(let f of c)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 k8(t){let e={},r="",n=Qe.streamReader(t),i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+` +`),i=await n();let a=r.toString("utf8").split(` +`);if(i=a.shift(),!i.startsWith("unpack "))throw new Ja('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.slice(3),u=l.indexOf(" ");u===-1&&(u=l.length);let c=l.slice(0,u),f=l.slice(u+1);e.refs[c]={ok:o==="ok",error:f}}return e}async function A8({capabilities:t=[],triplets:e=[]}){let r=[],n=`\0 ${t.join(" ")}`;for(let i of e)r.push(Qe.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n} +`)),n="";return r.push(Qe.flush()),r}async function T8({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:u,ref:c,remoteRef:f,remote:d,url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={}}){let b=c||await pa({fs:t,gitdir:u});if(typeof b=="undefined")throw new hr("ref");let E=await nt.get({fs:t,gitdir:u});d=d||await E.get(`branch.${b}.pushRemote`)||await E.get("remote.pushDefault")||await E.get(`branch.${b}.remote`)||"origin";let x=h||await E.get(`remote.${d}.pushurl`)||await E.get(`remote.${d}.url`);if(typeof x=="undefined")throw new hr("remote OR url");let k=f||await E.get(`branch.${b}.merge`);if(typeof x=="undefined")throw new hr("remoteRef");v===void 0&&(v=await E.get("http.corsProxy"));let A=await z.expand({fs:t,gitdir:u,ref:b}),y=g?"0000000000000000000000000000000000000000":await z.resolve({fs:t,gitdir:u,ref:A}),S=Ao.getRemoteHelperFor({url:x}),_=await S.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:x,headers:w,protocolVersion:1}),T=_.auth,P;if(!k)P=A;else try{P=await z.expandAgainstMap({ref:k,map:_.refs})}catch(Z){if(Z instanceof Le)P=k.startsWith("refs/")?k:`refs/heads/${k}`;else throw Z}let F=_.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:y},remoteRef:{ref:P,oid:F}}))throw new _o;let D=!_.capabilities.has("no-thin"),M=new Set;if(!g){let Z=[..._.refs.values()],H=new Set;if(F!=="0000000000000000000000000000000000000000"){let Oe=await Ng({fs:t,cache:e,gitdir:u,oids:[y,F]});for(let cr of Oe)Z.push(cr);D&&(H=await yg({fs:t,cache:e,gitdir:u,oids:Oe}))}if(!Z.includes(y)){let Oe=await E8({fs:t,cache:e,gitdir:u,start:[y],finish:Z});M=await yg({fs:t,cache:e,gitdir:u,oids:Oe})}if(D){try{let Oe=await z.resolve({fs:t,gitdir:u,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:cr}=await z.resolveAgainstMap({ref:Oe.replace(`refs/remotes/${d}/`,""),fullref:Oe,map:_.refs}),Gt=[cr];for(let Y of await yg({fs:t,cache:e,gitdir:u,oids:Gt}))H.add(Y)}catch(Oe){}for(let Oe of H)M.delete(Oe)}if(y===F&&(m=!0),!m){if(A.startsWith("refs/tags")&&F!=="0000000000000000000000000000000000000000")throw new bo("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&F!=="0000000000000000000000000000000000000000"&&!await lk({fs:t,cache:e,gitdir:u,oid:y,ancestor:F,depth:-1}))throw new bo("not-fast-forward")}}let re=ME([..._.capabilities],["report-status","side-band-64k",`agent=${td.agent}`]),ye=await A8({capabilities:re,triplets:[{oldoid:F,oid:y,fullRef:P}]}),me=g?[]:await xk({fs:t,cache:e,gitdir:u,oids:[...M]}),fe=await S.connect({http:r,onProgress:n,corsProxy:v,service:"git-receive-pack",url:x,auth:T,headers:w,body:[...ye,...me]}),{packfile:Ge,progress:oe}=await Xf.demux(fe.body);if(i){let Z=DE(oe);_c(Z,async H=>{await i(H)})}let B=await k8(Ge);if(fe.headers&&(B.headers=fe.headers),d&&B.ok&&B.refs[P].ok&&!A.startsWith("refs/tags")){let Z=`refs/remotes/${d}/${P.replace("refs/heads","")}`;g?await z.deleteRef({fs:t,gitdir:u,ref:Z}):await z.writeRef({fs:t,gitdir:u,ref:Z,value:y})}if(B.ok&&Object.values(B.refs).every(Z=>Z.ok))return B;{let Z=Object.entries(B.refs).filter(([H,Oe])=>!Oe.ok).map(([H,Oe])=>` + - ${H}: ${Oe.error}`).join("");throw new uc(Z,B)}}async function kk({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:u=O.join(l,".git"),ref:c,remoteRef:f,remote:d="origin",url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={},cache:b={}}){try{return C("fs",t),C("http",e),C("gitdir",u),await T8({fs:new J(t),cache:b,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:u,ref:c,remoteRef:f,remote:d,url:h,force:m,delete:g,corsProxy:v,headers:w})}catch(E){throw E.caller="git.push",E}}async function Ak({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,Ak({fs:t,cache:e,gitdir:r,oid:n});if(i!=="blob")throw new rr(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function Tk({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await yc({fs:t,cache:e,gitdir:r,oid:n,filepath:i})),await Ak({fs:t,cache:e,gitdir:r,oid:n})}async function Ck({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,filepath:i,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Tk({fs:new J(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function Bg({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Eo({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function C8({fs:t,cache:e,gitdir:r,ref:n="refs/notes/commits",oid:i}){let a=await z.resolve({gitdir:r,fs:t,ref:n}),{blob:s}=await Tk({fs:t,cache:e,gitdir:r,oid:a,filepath:i});return s}async function Pk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("ref",n),C("oid",i),await C8({fs:new J(t),cache:a,gitdir:r,ref:n,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function Rk({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{C("fs",t),C("gitdir",r),C("oid",n);let l=new J(t);a!==void 0&&(n=await yc({fs:l,cache:o,gitdir:r,oid:n,filepath:a}));let c=await qe({fs:l,cache:o,gitdir:r,oid:n,format:i==="parsed"?"content":i});if(c.oid=n,i==="parsed")switch(c.format="parsed",c.type){case"commit":c.object=mr.from(c.object).parse();break;case"tree":c.object=pr.from(c.object).entries();break;case"blob":s?c.object=c.object.toString(s):(c.object=new Uint8Array(c.object),c.format="content");break;case"tag":c.object=Fr.from(c.object).parse();break;default:throw new rr(c.oid,c.type,"blob|commit|tag|tree")}else(c.format==="deflated"||c.format==="wrapped")&&(c.type=c.format);return c}catch(l){throw l.caller="git.readObject",l}}async function P8({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new rr(n,i,"tag");let s=Fr.from(a);return{oid:n,tag:s.parse(),payload:s.payload()}}async function Ik({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await P8({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function $k({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Po({fs:new J(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function Fk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,cache:i={}}){try{C("fs",t),C("gitdir",r),C("filepath",n),await ct.acquire({fs:new J(t),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function R8({fs:t,cache:e,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let u;try{u=await z.resolve({gitdir:n,fs:t,ref:i})}catch(m){if(!(m instanceof Le))throw m}let f=(await Po({fs:t,gitdir:n,oid:u||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(m=>m.path!==a);let d=await bc({fs:t,gitdir:n,tree:f});return await Qf({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:d,parent:u&&[u],message:`Note removed by 'isomorphic-git removeNote' +`,author:s,committer:o,signingKey:l})}async function Ok({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:u={}}){try{C("fs",t),C("gitdir",n),C("oid",a);let c=new J(t),f=await da({fs:c,gitdir:n,author:s});if(!f)throw new zt("author");let d=await So({fs:c,gitdir:n,author:f,committer:o});if(!d)throw new zt("committer");return await R8({fs:c,cache:u,onSign:e,gitdir:n,ref:i,oid:a,author:f,committer:d,signingKey:l})}catch(c){throw c.caller="git.removeNote",c}}async function I8({fs:t,gitdir:e,oldref:r,ref:n,checkout:i=!1}){if(n!==Xn.clean(n))throw new wn(n,Xn.clean(n));if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let a=`refs/heads/${r}`,s=`refs/heads/${n}`;if(await z.exists({fs:t,gitdir:e,ref:s}))throw new vn("branch",n,!1);let l=await z.resolve({fs:t,gitdir:e,ref:a,depth:1});await z.writeRef({fs:t,gitdir:e,ref:s,value:l}),await z.deleteRef({fs:t,gitdir:e,ref:a});let c=await pa({fs:t,gitdir:e,fullname:!0})===a;(i||c)&&await z.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function Mk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,oldref:i,checkout:a=!1}){try{return C("fs",t),C("gitdir",r),C("ref",n),C("oldref",i),await I8({fs:new J(t),gitdir:r,ref:n,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function Dk({gitdir:t,type:e,object:r}){return ki(la.wrap({type:e,object:r}))}async function Lk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,ref:i,cache:a={}}){try{C("fs",t),C("gitdir",r),C("filepath",n);let s=new J(t),o,l;try{o=await z.resolve({fs:s,gitdir:r,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await yc({fs:s,cache:a,gitdir:r,oid:o,filepath:n})}catch(f){o=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},c=e&&await s.read(O.join(e,n));c&&(l=await Dk({gitdir:r,type:"blob",object:c}),o===l&&(u=await s.lstat(O.join(e,n)))),await ct.acquire({fs:s,gitdir:r,cache:a},async function(f){f.delete({filepath:n}),o&&f.insert({filepath:n,stats:u,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function Nk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,depth:i}){try{return C("fs",t),C("gitdir",r),C("ref",n),await z.resolve({fs:new J(t),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function Bk({fs:t,dir:e,gitdir:r=O.join(e,".git"),path:n,value:i,append:a=!1}){try{C("fs",t),C("gitdir",r),C("path",n);let s=new J(t),o=await nt.get({fs:s,gitdir:r});a?await o.append(n,i):await o.set(n,i),await nt.save({fs:s,gitdir:r,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function Hk({fs:t,gitdir:e,commit:r}){let n=mr.from(r).toObject();return await gr({fs:t,gitdir:e,type:"commit",object:n,format:"content"})}var Zf=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,r,n){let i=e.name.replace(/\s/g,""),a="0000000000000000000000000000000000000000",s=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${a} ${r} ${i} ${e.email} ${s} ${o} ${n} +`}static getStashReflogEntry(e,r=!1){return e.split(` +`).filter(a=>a).reverse().map((a,s)=>r?`stash@{${s}}: ${a.split(" ")[1]}`:a)}},$8={stage:ts,workdir:Co},bg;async function To(t,e){return bg===void 0&&(bg=new tc),bg.acquire(t,e)}async function F8(t,e,r,n,i=null){let a=O.join(r,n),s=await t.lstat(a);if(!s)throw new Le(a);if(s.isDirectory())throw new de(`${a}: file expected, but found directory`);let o=i?await mE({fs:t,gitdir:e,oid:i}):void 0,l=o?i:void 0;return o||await To({fs:t,gitdir:e,currentFilepath:a},async()=>{let u=s.isSymbolicLink()?await t.readlink(a).then(xE):await t.read(a);if(u===null)throw new Le(a);l=await gr({fs:t,gitdir:e,type:"blob",object:u})}),l}async function O8({fs:t,dir:e,gitdir:r,entries:n}){async function i(a){if(a.type==="tree"){if(!a.oid){let s=await Promise.all(a.children.map(i));a.oid=await bc({fs:t,gitdir:r,tree:s}),a.mode=16384}}else a.type==="blob"&&(a.oid=await F8(t,r,e,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}return Promise.all(n.map(i))}async function lE({fs:t,dir:e,gitdir:r,treePair:n}){let i=n[1]==="stage",a=n.map(h=>typeof h=="string"?$8[h]():h),s=[],c=await ua({fs:t,cache:{},dir:e,gitdir:r,trees:a,map:async(h,[m,g])=>{if(!(h==="."||await fa.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!m||await m.oid()!==await g.oid()&&await g.oid()!==void 0)&&s.push([m,g]),{mode:await g.mode(),path:h,oid:await g.oid(),type:await g.type()}},reduce:async(h,m)=>(m=m.filter(Boolean),h?(h.children=m,h):m.length>0?m:void 0),iterate:async(h,m)=>{let g=[];for(let v of m){let[w,b]=v;i?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(v):s.push([null,b])):w&&(b?g.push(v):s.push([w,null]))}return g.length?Promise.all(g.map(h)):[]}});if(s.length===0||c.length===0)return null;let d=(await O8({fs:t,dir:e,gitdir:r,entries:c})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return bc({fs:t,gitdir:r,tree:d})}async function M8({fs:t,dir:e,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:a}){let s=[],o=[],l=await ua({fs:t,cache:{},dir:e,gitdir:r,trees:[$r({ref:i}),$r({ref:n})],map:async(u,[c,f])=>{if(u==="."||await fa.isIgnored({fs:t,dir:e,gitdir:r,filepath:u}))return;let d=f?await f.type():await c.type();if(d!=="tree"&&d!=="blob")return;if(!f&&c){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&s.push(u),d==="blob"&&a&&o.push({filepath:u,oid:await c.oid()}),{method:m,filepath:u}}let h=await f.oid();if(!c||await c.oid()!==h)return d==="tree"?{method:"mkdir",filepath:u}:(a&&o.push({filepath:u,oid:h,stats:await t.lstat(O.join(e,u))}),{method:"write",filepath:u,oid:h})}});await To({fs:t,gitdir:r,dirRemoved:s,ops:l},async()=>{for(let u of l){let c=O.join(e,u.filepath);switch(u.method){case"rmdir":await t.rmdir(c);break;case"mkdir":await t.mkdir(c);break;case"rm":await t.rm(c);break;case"write":if(!s.some(f=>c.startsWith(f))){let{object:f}=await qe({fs:t,cache:{},gitdir:r,oid:u.oid});await t.exists(c)&&await t.rm(c),await t.write(c,f)}break}}}),await ct.acquire({fs:t,gitdir:r,cache:{}},async u=>{o.forEach(({filepath:c,stats:f,oid:d})=>{u.insert({filepath:c,stats:f,oid:d})})})}var es=class t{constructor({fs:e,dir:r,gitdir:n=O.join(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O.join(this.gitdir,t.refStash)}get refLogsStashPath(){return O.join(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await da({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new zt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:n}){return Hk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new wn(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,r);return n?Eo({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return z.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let n=await this.getAuthor(),i=Zf.createStashReflogEntry(n,e,r),a=this.refLogsStashPath;await To({filepath:a,entry:i},async()=>{let s=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,s+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let n=(await this.fs.read(this.refLogsStashPath)).toString();return Zf.getStashReflogEntry(n,e)}};async function D8({fs:t,dir:e,gitdir:r,message:n=""}){let i=new es({fs:t,dir:e,gitdir:r});await i.getAuthor();let a=await pa({fs:t,gitdir:r,fullname:!1}),s=await z.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await Bg({fs:t,dir:e,gitdir:r,oid:s})).commit.message,u=[s],c=null,f=$r({ref:"HEAD"}),d=await lE({fs:t,dir:e,gitdir:r,treePair:[$r({ref:"HEAD"}),"stage"]});if(d){let v=await i.writeStashCommit({message:`stash-Index: WIP on ${a} - ${new Date().toISOString()}`,tree:d,parent:u});u.push(v),c=d,f=ts()}let h=await lE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${a} - ${new Date().toISOString()}`,tree:h,parent:[u[u.length-1]]});u.push(v),c=h}if(!c||!d&&!h)throw new Le("changes, nothing to stash");let m=(n.trim()||`WIP on ${a}`)+`: ${s.substring(0,7)} ${l}`,g=await i.writeStashCommit({message:m,tree:c,parent:u});return await i.writeStashRef(g),await i.writeStashReflogEntry({stashCommit:g,message:m}),await Dg({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),g}async function Uk({fs:t,dir:e,gitdir:r,refIdx:n=0}){let a=await new es({fs:t,dir:e,gitdir:r}).readStashCommit(n),{parent:s=null}=a.commit?a.commit:{};if(!(!s||!Array.isArray(s)))for(let o=0;o{await t.exists(s)&&await t.rm(s)});let o=await i.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(n,1);let l=i.refLogsStashPath;await To({reflogEntries:o,stashReflogPath:l,stashMgr:i},async()=>{if(o.length){await t.write(l,o.join(` +`),"utf8");let u=o[o.length-1].split(" ")[1];await i.writeStashRef(u)}else await t.rm(l)})}async function L8({fs:t,dir:e,gitdir:r}){return new es({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function N8({fs:t,dir:e,gitdir:r}){let n=new es({fs:t,dir:e,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await To(i,async()=>{await Promise.all(i.map(async a=>{if(await t.exists(a))return t.rm(a)}))})}async function B8({fs:t,dir:e,gitdir:r,refIdx:n=0}){await Uk({fs:t,dir:e,gitdir:r,refIdx:n}),await jk({fs:t,dir:e,gitdir:r,refIdx:n})}async function Gk({fs:t,dir:e,gitdir:r=O.join(e,".git"),op:n="push",message:i="",refIdx:a=0}){C("fs",t),C("dir",e),C("gitdir",r),C("op",n);let s={push:D8,apply:Uk,drop:jk,list:L8,clear:N8,pop:B8},o=["apply","drop","pop"];try{let l=new J(t);["refs","logs","logs/refs"].map(f=>O.join(r,f)).forEach(async f=>{await l.exists(f)||await l.mkdir(f)});let c=s[n];if(c){if(o.includes(n)&&a<0)throw new wn(`stash@${a}`,"number that is in range of [0, num of stash pushed]");return await c({fs:l,dir:e,gitdir:r,message:i,refIdx:a})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function qk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,cache:i={}}){try{C("fs",t),C("gitdir",r),C("filepath",n);let a=new J(t);if(await fa.isIgnored({fs:a,gitdir:r,dir:e,filepath:n}))return"ignored";let o=await H8({fs:a,cache:i,gitdir:r}),l=await zk({fs:a,cache:i,gitdir:r,tree:o,path:n}),u=await ct.acquire({fs:a,gitdir:r,cache:i},async function(g){for(let v of g)if(v.path===n)return v;return null}),c=await a.lstat(O.join(e,n)),f=l!==null,d=u!==null,h=c!==null,m=async()=>{if(d&&!Uf(u,c))return u.oid;{let g=await a.read(O.join(e,n)),v=await Dk({gitdir:r,type:"blob",object:g});return d&&u.oid===v&&c.size!==-1&&ct.acquire({fs:a,gitdir:r,cache:i},async function(w){w.insert({filepath:n,stats:c,oid:v})}),v}};if(!f&&!h&&!d)return"absent";if(!f&&!h&&d)return"*absent";if(!f&&h&&!d)return"*added";if(!f&&h&&d)return await m()===u.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return l===u.oid,"*deleted";if(f&&h&&!d)return await m()===l?"*undeleted":"*undeletemodified";if(f&&h&&d){let g=await m();return g===l?g===u.oid?"unmodified":"*unmodified":g===u.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function zk({fs:t,cache:e,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of n)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await qe({fs:t,cache:e,gitdir:r,oid:s.oid});if(o==="tree"){let u=pr.from(l);return zk({fs:t,cache:e,gitdir:r,tree:u,path:i})}if(o==="blob")throw new rr(s.oid,o,"blob",i.join("/"))}return null}async function H8({fs:t,cache:e,gitdir:r}){let n;try{n=await z.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof Le)return[]}let{tree:i}=await Po({fs:t,cache:e,gitdir:r,oid:n});return i}async function Vk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{C("fs",t),C("gitdir",r),C("ref",n);let l=new J(t);return await ua({fs:l,cache:s,dir:e,gitdir:r,trees:[$r({ref:n}),Co(),ts()],map:async function(u,[c,f,d]){if(!c&&!d&&f&&!o&&await fa.isIgnored({fs:l,dir:e,filepath:u})||!i.some(A=>FE(u,A)))return null;if(a&&!a(u))return;let[h,m,g]=await Promise.all([c&&c.type(),f&&f.type(),d&&d.type()]),v=[h,m,g].includes("blob");if((h==="tree"||h==="special")&&!v)return;if(h==="commit")return null;if((m==="tree"||m==="special")&&!v)return;if(g==="commit")return null;if((g==="tree"||g==="special")&&!v)return;let w=h==="blob"?await c.oid():void 0,b=g==="blob"?await d.oid():void 0,E;h!=="blob"&&m==="blob"&&g!=="blob"?E="42":m==="blob"&&(E=await f.oid());let x=[void 0,w,E,b],k=x.map(A=>x.indexOf(A));return k.shift(),[u,...k]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function Wk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,object:i,force:a=!1}){try{C("fs",t),C("gitdir",r),C("ref",n);let s=new J(t);if(n===void 0)throw new hr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let o=await z.resolve({fs:s,gitdir:r,ref:i||"HEAD"});if(!a&&await z.exists({fs:s,gitdir:r,ref:n}))throw new vn("tag",n);await z.writeRef({fs:s,gitdir:r,ref:n,value:o})}catch(s){throw s.caller="git.tag",s}}async function Yk({fs:t,dir:e,gitdir:r=O.join(e,".git"),cache:n={},filepath:i,oid:a,mode:s,add:o,remove:l,force:u}){try{C("fs",t),C("gitdir",r),C("filepath",i);let c=new J(t);if(l)return await ct.acquire({fs:c,gitdir:r,cache:n},async function(d){if(!u){let h=await c.lstat(O.join(e,i));if(h){if(h.isDirectory())throw new ca("directory");return}}d.has({filepath:i})&&d.delete({filepath:i})});let f;if(!a){if(f=await c.lstat(O.join(e,i)),!f)throw new Le(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new ca("directory")}return await ct.acquire({fs:c,gitdir:r,cache:n},async function(d){if(!o&&!d.has({filepath:i}))throw new Le(`file at "${i}" in index and "add" not set`);let h;if(a)h={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};else{h=f;let m=h.isSymbolicLink()?await c.readlink(O.join(e,i)):await c.read(O.join(e,i));a=await gr({fs:c,gitdir:r,type:"blob",format:"content",object:m})}return d.insert({filepath:i,oid:a,stats:h}),a})}catch(c){throw c.caller="git.updateIndex",c}}function Xk(){try{return td.version}catch(t){throw t.caller="git.version",t}}async function Zk({fs:t,dir:e,gitdir:r=O.join(e,".git"),trees:n,map:i,reduce:a,iterate:s,cache:o={}}){try{return C("fs",t),C("gitdir",r),C("trees",n),await ua({fs:new J(t),cache:o,dir:e,gitdir:r,trees:n,map:i,reduce:a,iterate:s})}catch(l){throw l.caller="git.walk",l}}async function Kk({fs:t,dir:e,gitdir:r=O.join(e,".git"),blob:n}){try{return C("fs",t),C("gitdir",r),C("blob",n),await gr({fs:new J(t),gitdir:r,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function Jk({fs:t,dir:e,gitdir:r=O.join(e,".git"),commit:n}){try{return C("fs",t),C("gitdir",r),C("commit",n),await Hk({fs:new J(t),gitdir:r,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function Qk({fs:t,dir:e,gitdir:r=O.join(e,".git"),type:n,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let l=new J(t);if(a==="parsed"){switch(n){case"commit":i=mr.from(i).toObject();break;case"tree":i=pr.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=Fr.from(i).toObject();break;default:throw new rr(s||"",n,"blob|commit|tag|tree")}a="content"}return s=await gr({fs:l,gitdir:r,type:n,object:i,oid:s,format:a}),s}catch(l){throw l.caller="git.writeObject",l}}async function eA({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,value:i,force:a=!1,symbolic:s=!1}){try{C("fs",t),C("gitdir",r),C("ref",n),C("value",i);let o=new J(t);if(n!==Xn.clean(n))throw new wn(n,Xn.clean(n));if(!a&&await z.exists({fs:o,gitdir:r,ref:n}))throw new vn("ref",n);s?await z.writeSymbolicRef({fs:o,gitdir:r,ref:n,value:i}):(i=await z.resolve({fs:o,gitdir:r,ref:i}),await z.writeRef({fs:o,gitdir:r,ref:n,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function U8({fs:t,gitdir:e,tag:r}){let n=Fr.from(r).toObject();return await gr({fs:t,gitdir:e,type:"tag",object:n,format:"content"})}async function tA({fs:t,dir:e,gitdir:r=O.join(e,".git"),tag:n}){try{return C("fs",t),C("gitdir",r),C("tag",n),await U8({fs:new J(t),gitdir:r,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function rA({fs:t,dir:e,gitdir:r=O.join(e,".git"),tree:n}){try{return C("fs",t),C("gitdir",r),C("tree",n),await bc({fs:new J(t),gitdir:r,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var j8={Errors:wE,STAGE:ts,TREE:$r,WORKDIR:Co,add:SE,abortMerge:bE,addNote:CE,addRemote:RE,annotatedTag:IE,branch:$E,checkout:Dg,clone:NE,commit:BE,getConfig:ek,getConfigAll:tk,setConfig:Bk,currentBranch:HE,deleteBranch:UE,deleteRef:jE,deleteRemote:GE,deleteTag:qE,expandOid:zE,expandRef:VE,fastForward:XE,fetch:ZE,findMergeBase:KE,findRoot:QE,getRemoteInfo:rk,getRemoteInfo2:ik,hashBlob:ak,indexPack:sk,init:ok,isDescendent:ck,isIgnored:uk,listBranches:fk,listFiles:hk,listNotes:pk,listRefs:mk,listRemotes:gk,listServerRefs:vk,listTags:wk,log:bk,merge:_k,packObjects:Sk,pull:Ek,push:kk,readBlob:Ck,readCommit:Bg,readNote:Pk,readObject:Rk,readTag:Ik,readTree:$k,remove:Fk,removeNote:Ok,renameBranch:Mk,resetIndex:Lk,updateIndex:Yk,resolveRef:Nk,status:qk,statusMatrix:Vk,tag:Wk,version:Xk,walk:Zk,writeBlob:Kk,writeCommit:Jk,writeObject:Qk,writeRef:eA,writeTag:tA,writeTree:rA,stash:Gk};W.Errors=wE;W.STAGE=ts;W.TREE=$r;W.WORKDIR=Co;W.abortMerge=bE;W.add=SE;W.addNote=CE;W.addRemote=RE;W.annotatedTag=IE;W.branch=$E;W.checkout=Dg;W.clone=NE;W.commit=BE;W.currentBranch=HE;W.default=j8;W.deleteBranch=UE;W.deleteRef=jE;W.deleteRemote=GE;W.deleteTag=qE;W.expandOid=zE;W.expandRef=VE;W.fastForward=XE;W.fetch=ZE;W.findMergeBase=KE;W.findRoot=QE;W.getConfig=ek;W.getConfigAll=tk;W.getRemoteInfo=rk;W.getRemoteInfo2=ik;W.hashBlob=ak;W.indexPack=sk;W.init=ok;W.isDescendent=ck;W.isIgnored=uk;W.listBranches=fk;W.listFiles=hk;W.listNotes=pk;W.listRefs=mk;W.listRemotes=gk;W.listServerRefs=vk;W.listTags=wk;W.log=bk;W.merge=_k;W.packObjects=Sk;W.pull=Ek;W.push=kk;W.readBlob=Ck;W.readCommit=Bg;W.readNote=Pk;W.readObject=Rk;W.readTag=Ik;W.readTree=$k;W.remove=Fk;W.removeNote=Ok;W.renameBranch=Mk;W.resetIndex=Lk;W.resolveRef=Nk;W.setConfig=Bk;W.stash=Gk;W.status=qk;W.statusMatrix=Vk;W.tag=Wk;W.updateIndex=Yk;W.version=Xk;W.walk=Zk;W.writeBlob=Kk;W.writeCommit=Jk;W.writeObject=Qk;W.writeRef=eA;W.writeTag=tA;W.writeTree=rA});var uA=I((nZ,cA)=>{"use strict";p();cA.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 dA=I((aZ,fA)=>{p();var Vg={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}};fA.exports=function(t,e,r,n){if(!Vg.hasOwnProperty(r))throw new Error("Cannot convert to "+r);if(!Vg[r].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+r);var i=Vg[r][e]*t;return n!==!1?(n=Math.pow(10,parseInt(n)||5),Math.round(i*n)/n):i}});var AA=I(Ai=>{"use strict";p();Object.defineProperty(Ai,"__esModule",{value:!0});Ai.fromRgba=$o;Ai.fromRgb=Wg;Ai.fromHsla=ld;Ai.fromHsl=EA;Ai.fromString=kA;Ai.default=void 0;var hA=gA(uA()),W8=gA(dA());function gA(t){return t&&t.__esModule?t:{default:t}}function Y8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pA(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r-1}function e6(t,e,r){var n=t/255,i=e/255,a=r/255,s=Math.max(n,i,a),o=Math.min(n,i,a),l=s-o,u=(s+o)/2;if(l===0)return[0,0,u*100];var c=l/(1-Math.abs(2*u-1)),f=function(){switch(s){case n:return(i-a)/l%6;case i:return(a-n)/l+2;default:return(n-i)/l+4}}();return[f*60,c*100,u*100]}function t6(t,e,r){var n=t/60,i=e/100,a=r/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(n%2-1)),l=a-s/2,u=function(){return n<1?[s,o,0]:n<2?[o,s,0]:n<3?[0,s,o]:n<4?[0,o,s]:n<5?[o,0,s]:[s,0,o]}(),c=nr(u,3),f=c[0],d=c[1],h=c[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var r6=function(){function t(e){var r=nr(e,4),n=r[0],i=r[1],a=r[2],s=r[3];Y8(this,t),this.values=[Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return X8(t,[{key:"toRgbString",value:function(){var r=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return s===1?"rgb(".concat(n,", ").concat(i,", ").concat(a,")"):"rgba(".concat(n,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),n=nr(r,4),i=n[0],a=n[1],s=n[2],o=n[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 r=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return n=Number(n).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(n).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3],o=e6(n,i,a),l=nr(o,3),u=l[0],c=l[1],f=l[2];return[u,c,f,s]}}]),t}();function $o(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3];return new r6([r,n,i,a])}function Wg(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return $o([r,n,i,1])}function ld(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3],s=t6(r,n,i),o=nr(s,3),l=o[0],u=o[1],c=o[2];return $o([l,u,c,a])}function EA(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return ld([r,n,i,1])}function n6(t){var e=vA.exec(t)||wA.exec(t),r=nr(e,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=parseInt(n.length<2?n.repeat(2):n,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,$o([n,i,a,s])}function i6(t){var e=yA.exec(t)||_A.exec(t)||bA.exec(t)||xA.exec(t),r=nr(e,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=Ec(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=Ec(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=Ec(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Ec(s,"%")?100:1),$o([n,i,a,s])}function a6(t){var e=SA.exec(t),r=nr(e,6),n=r[1],i=r[2],a=r[3],s=r[4],o=r[5];return i=i||"deg",n=(0,W8.default)(parseFloat(n),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Ec(o,"%")?100:1),ld([n,a,s,o])}function kA(t){return hA.default[t]?Wg(hA.default[t]):vA.test(t)||wA.test(t)?n6(t):yA.test(t)||_A.test(t)||bA.test(t)||xA.test(t)?i6(t):SA.test(t)?a6(t):null}var s6={fromString:kA,fromRgb:Wg,fromRgba:$o,fromHsl:EA,fromHsla:ld};Ai.default=s6});var Yg=I((cZ,CA)=>{"use strict";p();var TA=Object.prototype.toString;CA.exports=function(e){var r=TA.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&TA.call(e.callee)==="[object Function]"),n}});var LA=I((fZ,DA)=>{"use strict";p();var MA;Object.keys||(kc=Object.prototype.hasOwnProperty,Xg=Object.prototype.toString,PA=Yg(),Zg=Object.prototype.propertyIsEnumerable,RA=!Zg.call({toString:null},"toString"),IA=Zg.call(function(){},"prototype"),Ac=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],cd=function(t){var e=t.constructor;return e&&e.prototype===t},$A={$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},FA=function(){if(typeof window=="undefined")return!1;for(var t in window)try{if(!$A["$"+t]&&kc.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{cd(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),OA=function(t){if(typeof window=="undefined"||!FA)return cd(t);try{return cd(t)}catch(e){return!1}},MA=function(e){var r=e!==null&&typeof e=="object",n=Xg.call(e)==="[object Function]",i=PA(e),a=r&&Xg.call(e)==="[object String]",s=[];if(!r&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var o=IA&&n;if(a&&e.length>0&&!kc.call(e,0))for(var l=0;l0)for(var u=0;u{"use strict";p();var o6=Array.prototype.slice,l6=Yg(),NA=Object.keys,ud=NA?function(e){return NA(e)}:LA(),BA=Object.keys;ud.shim=function(){if(Object.keys){var e=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);e||(Object.keys=function(n){return l6(n)?BA(o6.call(n)):BA(n)})}else Object.keys=ud;return Object.keys||ud};HA.exports=ud});var va=I((mZ,qA)=>{"use strict";p();var c6=fd(),u6=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",f6=Object.prototype.toString,d6=Array.prototype.concat,UA=pf(),h6=function(t){return typeof t=="function"&&f6.call(t)==="[object Function]"},jA=mf()(),p6=function(t,e,r,n){if(e in t){if(n===!0){if(t[e]===r)return}else if(!h6(n)||!n())return}jA?UA(t,e,r,!0):UA(t,e,r)},GA=function(t,e){var r=arguments.length>2?arguments[2]:{},n=c6(e);u6&&(n=d6.call(n,Object.getOwnPropertySymbols(e)));for(var i=0;i{"use strict";p();var m6=fd(),VA=Fl()(),WA=St(),dd=Qu(),g6=WA("Array.prototype.push"),zA=WA("Object.prototype.propertyIsEnumerable"),v6=VA?dd.getOwnPropertySymbols:null;YA.exports=function(e,r){if(e==null)throw new TypeError("target must be an object");var n=dd(e);if(arguments.length===1)return n;for(var i=1;i{"use strict";p();var Jg=Kg(),w6=function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},n=0;n{"use strict";p();var b6=va(),_6=Qg();ZA.exports=function(){var e=_6();return b6(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var tT=I((SZ,eT)=>{"use strict";p();var x6=va(),S6=Ua(),E6=Kg(),JA=Qg(),k6=KA(),A6=S6.apply(JA()),QA=function(e,r){return A6(Object,arguments)};x6(QA,{getPolyfill:JA,implementation:E6,shim:k6});eT.exports=QA});var ev=I((kZ,iT)=>{"use strict";p();var rT=Bn(),nT=Ua(),T6=nT(rT("String.prototype.indexOf"));iT.exports=function(e,r){var n=rT(e,!!r);return typeof n=="function"&&T6(e,".prototype.")>-1?nT(n):n}});var sT=I((TZ,aT)=>{"use strict";p();var Cc=function(){return typeof function(){}.name=="string"},Tc=Object.getOwnPropertyDescriptor;if(Tc)try{Tc([],"length")}catch(t){Tc=null}Cc.functionsHaveConfigurableNames=function(){if(!Cc()||!Tc)return!1;var e=Tc(function(){},"name");return!!e&&!!e.configurable};var C6=Function.prototype.bind;Cc.boundFunctionsHaveNames=function(){return Cc()&&typeof C6=="function"&&function(){}.bind().name!==""};aT.exports=Cc});var cT=I((PZ,lT)=>{"use strict";p();var oT=pf(),P6=mf()(),R6=sT().functionsHaveConfigurableNames(),I6=fr();lT.exports=function(e,r){if(typeof e!="function")throw new I6("`fn` is not a function");var n=arguments.length>2&&!!arguments[2];return(!n||R6)&&(P6?oT(e,"name",r,!0,!0):oT(e,"name",r)),e}});var tv=I((IZ,uT)=>{"use strict";p();var $6=cT(),F6=fr(),O6=Object;uT.exports=$6(function(){if(this==null||this!==O6(this))throw new F6("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 rv=I((FZ,fT)=>{"use strict";p();var M6=tv(),D6=va().supportsDescriptors,L6=Object.getOwnPropertyDescriptor;fT.exports=function(){if(D6&&/a/mig.flags==="gim"){var e=L6(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(n,"sticky",{get:function(){r+="y"}}),e.get.call(n),r==="dy")return e.get}}return M6}});var pT=I((MZ,hT)=>{"use strict";p();var N6=va().supportsDescriptors,B6=rv(),H6=Ki(),U6=Object.defineProperty,j6=im(),dT=lf(),G6=/a/;hT.exports=function(){if(!N6||!dT)throw new j6("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=B6(),r=dT(G6),n=H6(r,"flags");return(!n||n.get!==e)&&U6(r,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var wT=I((LZ,vT)=>{"use strict";p();var q6=va(),z6=Ua(),V6=tv(),mT=rv(),W6=pT(),gT=z6(mT());q6(gT,{getPolyfill:mT,implementation:V6,shim:W6});vT.exports=gT});var iv=I((BZ,bT)=>{"use strict";p();var Y6=Ji()(),X6=St(),nv=X6("Object.prototype.toString"),hd=function(e){return Y6&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:nv(e)==="[object Arguments]"},yT=function(e){return hd(e)?!0:e!==null&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&e.length>=0&&nv(e)!=="[object Array]"&&"callee"in e&&nv(e.callee)==="[object Function]"},Z6=function(){return hd(arguments)}();hd.isLegacyArguments=yT;bT.exports=Z6?hd:yT});var _T=I(()=>{p()});var Fc=I((qZ,UT)=>{p();var pv=typeof Map=="function"&&Map.prototype,av=Object.getOwnPropertyDescriptor&&pv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,md=pv&&av&&typeof av.get=="function"?av.get:null,xT=pv&&Map.prototype.forEach,mv=typeof Set=="function"&&Set.prototype,sv=Object.getOwnPropertyDescriptor&&mv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,gd=mv&&sv&&typeof sv.get=="function"?sv.get:null,ST=mv&&Set.prototype.forEach,K6=typeof WeakMap=="function"&&WeakMap.prototype,Rc=K6?WeakMap.prototype.has:null,J6=typeof WeakSet=="function"&&WeakSet.prototype,Ic=J6?WeakSet.prototype.has:null,Q6=typeof WeakRef=="function"&&WeakRef.prototype,ET=Q6?WeakRef.prototype.deref:null,e4=Boolean.prototype.valueOf,t4=Object.prototype.toString,r4=Function.prototype.toString,n4=String.prototype.match,gv=String.prototype.slice,wa=String.prototype.replace,i4=String.prototype.toUpperCase,kT=String.prototype.toLowerCase,OT=RegExp.prototype.test,AT=Array.prototype.concat,Kn=Array.prototype.join,a4=Array.prototype.slice,TT=Math.floor,cv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ov=Object.getOwnPropertySymbols,uv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Fo=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$c=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Fo||!0)?Symbol.toStringTag:null,MT=Object.prototype.propertyIsEnumerable,CT=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function PT(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||OT.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-TT(-t):TT(t);if(n!==t){var i=String(n),a=gv.call(e,i.length+1);return wa.call(i,r,"$&_")+"."+wa.call(wa.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return wa.call(e,r,"$&_")}var fv=_T(),RT=fv.custom,IT=NT(RT)?RT:null,DT={__proto__:null,double:'"',single:"'"},s4={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};UT.exports=function t(e,r,n,i){var a=r||{};if(Ti(a,"quoteStyle")&&!Ti(DT,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ti(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=Ti(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(Ti(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(Ti(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 HT(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?PT(e,l):l}if(typeof e=="bigint"){var u=String(e)+"n";return o?PT(e,u):u}var c=typeof a.depth=="undefined"?5:a.depth;if(typeof n=="undefined"&&(n=0),n>=c&&c>0&&typeof e=="object")return dv(e)?"[Array]":"[Object]";var f=E4(a,n);if(typeof i=="undefined")i=[];else if(BT(i,e)>=0)return"[Circular]";function d(D,M,re){if(M&&(i=a4.call(i),i.push(M)),re){var ye={depth:a.depth};return Ti(a,"quoteStyle")&&(ye.quoteStyle=a.quoteStyle),t(D,ye,n+1,i)}return t(D,a,n+1,i)}if(typeof e=="function"&&!$T(e)){var h=m4(e),m=pd(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(m.length>0?" { "+Kn.call(m,", ")+" }":"")}if(NT(e)){var g=Fo?wa.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):uv.call(e);return typeof e=="object"&&!Fo?Pc(g):g}if(_4(e)){for(var v="<"+kT.call(String(e.nodeName)),w=e.attributes||[],b=0;b",v}if(dv(e)){if(e.length===0)return"[]";var E=pd(e,d);return f&&!S4(E)?"["+hv(E,f)+"]":"[ "+Kn.call(E,", ")+" ]"}if(c4(e)){var x=pd(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!MT.call(e,"cause")?"{ ["+String(e)+"] "+Kn.call(AT.call("[cause]: "+d(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Kn.call(x,", ")+" }"}if(typeof e=="object"&&s){if(IT&&typeof e[IT]=="function"&&fv)return fv(e,{depth:c-n});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(g4(e)){var k=[];return xT&&xT.call(e,function(D,M){k.push(d(M,e,!0)+" => "+d(D,e))}),FT("Map",md.call(e),k,f)}if(y4(e)){var A=[];return ST&&ST.call(e,function(D){A.push(d(D,e))}),FT("Set",gd.call(e),A,f)}if(v4(e))return lv("WeakMap");if(b4(e))return lv("WeakSet");if(w4(e))return lv("WeakRef");if(f4(e))return Pc(d(Number(e)));if(h4(e))return Pc(d(cv.call(e)));if(d4(e))return Pc(e4.call(e));if(u4(e))return Pc(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(!l4(e)&&!$T(e)){var y=pd(e,d),S=CT?CT(e)===Object.prototype:e instanceof Object||e.constructor===Object,_=e instanceof Object?"":"null prototype",T=!S&&$c&&Object(e)===e&&$c in e?gv.call(ya(e),8,-1):_?"Object":"",P=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",F=P+(T||_?"["+Kn.call(AT.call([],T||[],_||[]),": ")+"] ":"");return y.length===0?F+"{}":f?F+"{"+hv(y,f)+"}":F+"{ "+Kn.call(y,", ")+" }"}return String(e)};function LT(t,e,r){var n=r.quoteStyle||e,i=DT[n];return i+t+i}function o4(t){return wa.call(String(t),/"/g,""")}function ns(t){return!$c||!(typeof t=="object"&&($c in t||typeof t[$c]!="undefined"))}function dv(t){return ya(t)==="[object Array]"&&ns(t)}function l4(t){return ya(t)==="[object Date]"&&ns(t)}function $T(t){return ya(t)==="[object RegExp]"&&ns(t)}function c4(t){return ya(t)==="[object Error]"&&ns(t)}function u4(t){return ya(t)==="[object String]"&&ns(t)}function f4(t){return ya(t)==="[object Number]"&&ns(t)}function d4(t){return ya(t)==="[object Boolean]"&&ns(t)}function NT(t){if(Fo)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!uv)return!1;try{return uv.call(t),!0}catch(e){}return!1}function h4(t){if(!t||typeof t!="object"||!cv)return!1;try{return cv.call(t),!0}catch(e){}return!1}var p4=Object.prototype.hasOwnProperty||function(t){return t in this};function Ti(t,e){return p4.call(t,e)}function ya(t){return t4.call(t)}function m4(t){if(t.name)return t.name;var e=n4.call(r4.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function BT(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return HT(gv.call(t,0,e.maxStringLength),e)+n}var i=s4[e.quoteStyle||"single"];i.lastIndex=0;var a=wa.call(wa.call(t,i,"\\$1"),/[\x00-\x1f]/g,x4);return LT(a,"single",e)}function x4(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+i4.call(e.toString(16))}function Pc(t){return"Object("+t+")"}function lv(t){return t+" { ? }"}function FT(t,e,r,n){var i=n?hv(r,n):Kn.call(r,", ");return t+" ("+e+") {"+i+"}"}function S4(t){for(var e=0;e=0)return!1;return!0}function E4(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Kn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Kn.call(Array(e+1),r)}}function hv(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Kn.call(t,","+r)+` +`+e.prev}function pd(t,e){var r=dv(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";p();var k4=Fc(),A4=fr(),vd=function(t,e,r){for(var n=t,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i},T4=function(t,e){if(t){var r=vd(t,e);return r&&r.value}},C4=function(t,e,r){var n=vd(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},P4=function(t,e){return t?!!vd(t,e):!1},R4=function(t,e){if(t)return vd(t,e,!0)};jT.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new A4("Side channel does not contain "+k4(n))},delete:function(n){var i=e&&e.next,a=R4(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return T4(e,n)},has:function(n){return P4(e,n)},set:function(n,i){e||(e={next:void 0}),C4(e,n,i)}};return r}});var vv=I((YZ,zT)=>{"use strict";p();var I4=Bn(),Oc=St(),$4=Fc(),F4=fr(),qT=I4("%Map%",!0),O4=Oc("Map.prototype.get",!0),M4=Oc("Map.prototype.set",!0),D4=Oc("Map.prototype.has",!0),L4=Oc("Map.prototype.delete",!0),N4=Oc("Map.prototype.size",!0);zT.exports=!!qT&&function(){var e,r={assert:function(n){if(!r.has(n))throw new F4("Side channel does not contain "+$4(n))},delete:function(n){if(e){var i=L4(e,n);return N4(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return O4(e,n)},has:function(n){return e?D4(e,n):!1},set:function(n,i){e||(e=new qT),M4(e,n,i)}};return r}});var WT=I((ZZ,VT)=>{"use strict";p();var B4=Bn(),yd=St(),H4=Fc(),wd=vv(),U4=fr(),Oo=B4("%WeakMap%",!0),j4=yd("WeakMap.prototype.get",!0),G4=yd("WeakMap.prototype.set",!0),q4=yd("WeakMap.prototype.has",!0),z4=yd("WeakMap.prototype.delete",!0);VT.exports=Oo?function(){var e,r,n={assert:function(i){if(!n.has(i))throw new U4("Side channel does not contain "+H4(i))},delete:function(i){if(Oo&&i&&(typeof i=="object"||typeof i=="function")){if(e)return z4(e,i)}else if(wd&&r)return r.delete(i);return!1},get:function(i){return Oo&&i&&(typeof i=="object"||typeof i=="function")&&e?j4(e,i):r&&r.get(i)},has:function(i){return Oo&&i&&(typeof i=="object"||typeof i=="function")&&e?q4(e,i):!!r&&r.has(i)},set:function(i,a){Oo&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Oo),G4(e,i,a)):wd&&(r||(r=wd()),r.set(i,a))}};return n}:wd});var wv=I((JZ,YT)=>{"use strict";p();var V4=fr(),W4=Fc(),Y4=GT(),X4=vv(),Z4=WT(),K4=Z4||X4||Y4;YT.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new V4("Side channel does not contain "+W4(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=K4()),e.set(n,i)}};return r}});var ZT=I((eK,XT)=>{"use strict";p();var J4=cf(),Mc=wv()(),Ci=fr(),yv={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");if(Mc.assert(t),!yv.has(t,e))throw new Ci("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var r=Mc.get(t);return r&&r["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var r=Mc.get(t);return!!r&&J4(r,"$"+e)},set:function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var n=Mc.get(t);n||(n={},Mc.set(t,n)),n["$"+e]=r}};Object.freeze&&Object.freeze(yv);XT.exports=yv});var QT=I((rK,JT)=>{"use strict";p();var Dc=ZT(),Q4=ef(),KT=typeof StopIteration=="object"?StopIteration:null;JT.exports=function(e){if(!KT)throw new Q4("this environment lacks StopIteration");Dc.set(e,"[[Done]]",!1);var r={next:function(){var i=Dc.get(this,"[[Iterator]]"),a=!!Dc.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Dc.set(i,"[[Done]]",!0),s!==KT)throw s;return{done:!0,value:void 0}}}};return Dc.set(r,"[[Iterator]]",e),r}});var bv=I((iK,tC)=>{"use strict";p();var eC=St(),e5=eC("String.prototype.valueOf"),t5=function(e){try{return e5(e),!0}catch(r){return!1}},r5=eC("Object.prototype.toString"),n5="[object String]",i5=Ji()();tC.exports=function(e){return typeof e=="string"?!0:!e||typeof e!="object"?!1:i5?t5(e):r5(e)===n5}});var xv=I((sK,iC)=>{"use strict";p();var _v=typeof Map=="function"&&Map.prototype?Map:null,a5=typeof Set=="function"&&Set.prototype?Set:null,bd;_v||(bd=function(e){return!1});var nC=_v?Map.prototype.has:null,rC=a5?Set.prototype.has:null;!bd&&!nC&&(bd=function(e){return!1});iC.exports=bd||function(e){if(!e||typeof e!="object")return!1;try{if(nC.call(e),rC)try{rC.call(e)}catch(r){return!0}return e instanceof _v}catch(r){}return!1}});var Ev=I((lK,oC)=>{"use strict";p();var s5=typeof Map=="function"&&Map.prototype?Map:null,Sv=typeof Set=="function"&&Set.prototype?Set:null,_d;Sv||(_d=function(e){return!1});var aC=s5?Map.prototype.has:null,sC=Sv?Set.prototype.has:null;!_d&&!sC&&(_d=function(e){return!1});oC.exports=_d||function(e){if(!e||typeof e!="object")return!1;try{if(sC.call(e),aC)try{aC.call(e)}catch(r){return!0}return e instanceof Sv}catch(r){}return!1}});var yC=I((uK,Ed)=>{"use strict";p();var lC=iv(),cC=QT();nf()()||Fl()()?(xd=Symbol.iterator,Ed.exports=function(e){if(e!=null&&typeof e[xd]!="undefined")return e[xd]();if(lC(e))return Array.prototype[xd].call(e)}):(uC=Ju(),fC=bv(),kv=Bn(),dC=kv("%Map%",!0),hC=kv("%Set%",!0),en=ev(),Av=en("Array.prototype.push"),Tv=en("String.prototype.charCodeAt"),pC=en("String.prototype.slice"),mC=function(e,r){var n=e.length;if(r+1>=n)return r+1;var i=Tv(e,r);if(i<55296||i>56319)return r+1;var a=Tv(e,r+1);return a<56320||a>57343?r+1:r+2},Sd=function(e){var r=0;return{next:function(){var i=r>=e.length,a;return i||(a=e[r],r+=1),{done:i,value:a}}}},Cv=function(e,r){if(uC(e)||lC(e))return Sd(e);if(fC(e)){var n=0;return{next:function(){var a=mC(e,n),s=pC(e,n,a);return n=a,{done:a>e.length,value:s}}}}if(r&&typeof e["_es6-shim iterator_"]!="undefined")return e["_es6-shim iterator_"]()},!dC&&!hC?Ed.exports=function(e){if(e!=null)return Cv(e,!0)}:(gC=xv(),vC=Ev(),Pv=en("Map.prototype.forEach",!0),Rv=en("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(Iv=en("Map.prototype.iterator",!0),$v=en("Set.prototype.iterator",!0)),Fv=en("Map.prototype.@@iterator",!0)||en("Map.prototype._es6-shim iterator_",!0),Ov=en("Set.prototype.@@iterator",!0)||en("Set.prototype._es6-shim iterator_",!0),wC=function(e){if(gC(e)){if(Iv)return cC(Iv(e));if(Fv)return Fv(e);if(Pv){var r=[];return Pv(e,function(i,a){Av(r,[a,i])}),Sd(r)}}if(vC(e)){if($v)return cC($v(e));if(Ov)return Ov(e);if(Rv){var n=[];return Rv(e,function(i){Av(n,i)}),Sd(n)}}},Ed.exports=function(e){return wC(e)||Cv(e)}));var xd,uC,fC,kv,dC,hC,en,Av,Tv,pC,mC,Sd,Cv,gC,vC,Pv,Rv,Iv,$v,Fv,Ov,wC});var Mv=I((dK,_C)=>{"use strict";p();var bC=function(t){return t!==t};_C.exports=function(e,r){return e===0&&r===0?1/e===1/r:!!(e===r||bC(e)&&bC(r))}});var Dv=I((pK,xC)=>{"use strict";p();var o5=Mv();xC.exports=function(){return typeof Object.is=="function"?Object.is:o5}});var EC=I((gK,SC)=>{"use strict";p();var l5=Dv(),c5=va();SC.exports=function(){var e=l5();return c5(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var CC=I((wK,TC)=>{"use strict";p();var u5=va(),f5=Ua(),d5=Mv(),kC=Dv(),h5=EC(),AC=f5(kC(),Object);u5(AC,{getPolyfill:kC,implementation:d5,shim:h5});TC.exports=AC});var Nv=I((bK,$C)=>{"use strict";p();var p5=Ua(),IC=St(),m5=Bn(),Lv=m5("%ArrayBuffer%",!0),kd=IC("ArrayBuffer.prototype.byteLength",!0),g5=IC("Object.prototype.toString"),PC=!!Lv&&!kd&&new Lv(0).slice,RC=!!PC&&p5(PC);$C.exports=kd||RC?function(e){if(!e||typeof e!="object")return!1;try{return kd?kd(e):RC(e,0),!0}catch(r){return!1}}:Lv?function(e){return g5(e)==="[object ArrayBuffer]"}:function(e){return!1}});var MC=I((xK,OC)=>{"use strict";p();var FC=St(),v5=FC("Date.prototype.getDay"),w5=function(e){try{return v5(e),!0}catch(r){return!1}},y5=FC("Object.prototype.toString"),b5="[object Date]",_5=Ji()();OC.exports=function(e){return typeof e!="object"||e===null?!1:_5?w5(e):y5(e)===b5}});var jv=I((EK,HC)=>{"use strict";p();var DC=St(),x5=Ji()(),S5=cf(),E5=Ki(),Uv;x5?(LC=DC("RegExp.prototype.exec"),Bv={},Ad=function(){throw Bv},Hv={toString:Ad,valueOf:Ad},typeof Symbol.toPrimitive=="symbol"&&(Hv[Symbol.toPrimitive]=Ad),Uv=function(e){if(!e||typeof e!="object")return!1;var r=E5(e,"lastIndex"),n=r&&S5(r,"value");if(!n)return!1;try{LC(e,Hv)}catch(i){return i===Bv}}):(NC=DC("Object.prototype.toString"),BC="[object RegExp]",Uv=function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:NC(e)===BC});var LC,Bv,Ad,Hv,NC,BC;HC.exports=Uv});var GC=I((AK,jC)=>{"use strict";p();var k5=St(),UC=k5("SharedArrayBuffer.prototype.byteLength",!0);jC.exports=UC?function(e){if(!e||typeof e!="object")return!1;try{return UC(e),!0}catch(r){return!1}}:function(e){return!1}});var VC=I((CK,zC)=>{"use strict";p();var qC=St(),A5=qC("Number.prototype.toString"),T5=function(e){try{return A5(e),!0}catch(r){return!1}},C5=qC("Object.prototype.toString"),P5="[object Number]",R5=Ji()();zC.exports=function(e){return typeof e=="number"?!0:!e||typeof e!="object"?!1:R5?T5(e):C5(e)===P5}});var XC=I((RK,YC)=>{"use strict";p();var WC=St(),I5=WC("Boolean.prototype.toString"),$5=WC("Object.prototype.toString"),F5=function(e){try{return I5(e),!0}catch(r){return!1}},O5="[object Boolean]",M5=Ji()();YC.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:M5?F5(e):$5(e)===O5}});var KC=I(($K,ZC)=>{"use strict";p();var D5=St(),L5=jv(),N5=D5("RegExp.prototype.exec"),B5=fr();ZC.exports=function(e){if(!L5(e))throw new B5("`regex` must be a RegExp");return function(n){return N5(e,n)!==null}}});var r2=I((OK,Gv)=>{"use strict";p();var t2=St(),H5=t2("Object.prototype.toString"),U5=nf()(),j5=KC();U5?(JC=t2("Symbol.prototype.toString"),QC=j5(/^Symbol\(.*\)$/),e2=function(e){return typeof e.valueOf()!="symbol"?!1:QC(JC(e))},Gv.exports=function(e){if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||H5(e)!=="[object Symbol]")return!1;try{return e2(e)}catch(r){return!1}}):Gv.exports=function(e){return!1};var JC,QC,e2});var a2=I((DK,i2)=>{"use strict";p();var n2=typeof BigInt!="undefined"&&BigInt;i2.exports=function(){return typeof n2=="function"&&typeof BigInt=="function"&&typeof n2(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var l2=I((NK,qv)=>{"use strict";p();var G5=a2()();G5?(s2=BigInt.prototype.valueOf,o2=function(e){try{return s2.call(e),!0}catch(r){}return!1},qv.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:o2(e)}):qv.exports=function(e){return!1};var s2,o2});var u2=I((HK,c2)=>{"use strict";p();var q5=bv(),z5=VC(),V5=XC(),W5=r2(),Y5=l2();c2.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(q5(e))return"String";if(z5(e))return"Number";if(V5(e))return"Boolean";if(W5(e))return"Symbol";if(Y5(e))return"BigInt"}});var h2=I((jK,d2)=>{"use strict";p();var Td=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,f2=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Cd;Td||(Cd=function(e){return!1});var Vv=Td?Td.prototype.has:null,zv=f2?f2.prototype.has:null;!Cd&&!Vv&&(Cd=function(e){return!1});d2.exports=Cd||function(e){if(!e||typeof e!="object")return!1;try{if(Vv.call(e,Vv),zv)try{zv.call(e,zv)}catch(r){return!0}return e instanceof Td}catch(r){}return!1}});var m2=I((qK,Yv)=>{"use strict";p();var X5=Bn(),p2=St(),Z5=X5("%WeakSet%",!0),Wv=p2("WeakSet.prototype.has",!0);Wv?(Pd=p2("WeakMap.prototype.has",!0),Yv.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Wv(e,Wv),Pd)try{Pd(e,Pd)}catch(r){return!0}return e instanceof Z5}catch(r){}return!1}):Yv.exports=function(e){return!1};var Pd});var v2=I((VK,g2)=>{"use strict";p();var K5=xv(),J5=Ev(),Q5=h2(),eU=m2();g2.exports=function(e){if(e&&typeof e=="object"){if(K5(e))return"Map";if(J5(e))return"Set";if(Q5(e))return"WeakMap";if(eU(e))return"WeakSet"}return!1}});var b2=I((YK,y2)=>{"use strict";p();var tU=St(),w2=tU("ArrayBuffer.prototype.byteLength",!0),rU=Nv();y2.exports=function(e){return rU(e)?w2?w2(e):e.byteLength:NaN}});var z2=I((ZK,q2)=>{"use strict";p();var U2=tT(),Jn=ev(),_2=wT(),nU=Bn(),Mo=yC(),iU=wv(),x2=CC(),S2=iv(),E2=Ju(),k2=Nv(),A2=MC(),T2=jv(),C2=GC(),P2=fd(),R2=u2(),I2=v2(),$2=bm(),F2=b2(),O2=Jn("SharedArrayBuffer.prototype.byteLength",!0),M2=Jn("Date.prototype.getTime"),Xv=Object.getPrototypeOf,D2=Jn("Object.prototype.toString"),Id=nU("%Set%",!0),Zv=Jn("Map.prototype.has",!0),$d=Jn("Map.prototype.get",!0),L2=Jn("Map.prototype.size",!0),Fd=Jn("Set.prototype.add",!0),j2=Jn("Set.prototype.delete",!0),Od=Jn("Set.prototype.has",!0),Rd=Jn("Set.prototype.size",!0);function N2(t,e,r,n){for(var i=Mo(t),a;(a=i.next())&&!a.done;)if(yn(e,a.value,r,n))return j2(t,a.value),!0;return!1}function G2(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 aU(t,e,r,n,i,a){var s=G2(r);if(s!=null)return s;var o=$d(e,s),l=U2({},i,{strict:!1});return typeof o=="undefined"&&!Zv(e,s)||!yn(n,o,l,a)?!1:!Zv(t,s)&&yn(n,o,l,a)}function sU(t,e,r){var n=G2(r);return n!=null?n:Od(e,n)&&!Od(t,n)}function B2(t,e,r,n,i,a){for(var s=Mo(t),o,l;(o=s.next())&&!o.done;)if(l=o.value,yn(r,l,i,a)&&yn(n,$d(e,l),i,a))return j2(t,l),!0;return!1}function yn(t,e,r,n){var i=r||{};if(i.strict?x2(t,e):t===e)return!0;var a=R2(t),s=R2(e);if(a!==s)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?x2(t,e):t==e;var o=n.has(t),l=n.has(e),u;if(o&&l){if(n.get(t)===n.get(e))return!0}else u={};return o||n.set(t,u),l||n.set(e,u),cU(t,e,i,n)}function H2(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 oU(t,e,r,n){if(Rd(t)!==Rd(e))return!1;for(var i=Mo(t),a=Mo(e),s,o,l;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")l||(l=new Id),Fd(l,s.value);else if(!Od(e,s.value)){if(r.strict||!sU(t,e,s.value))return!1;l||(l=new Id),Fd(l,s.value)}if(l){for(;(o=a.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!N2(l,o.value,r.strict,n))return!1}else if(!r.strict&&!Od(t,o.value)&&!N2(l,o.value,r.strict,n))return!1;return Rd(l)===0}return!0}function lU(t,e,r,n){if(L2(t)!==L2(e))return!1;for(var i=Mo(t),a=Mo(e),s,o,l,u,c,f;(s=i.next())&&!s.done;)if(u=s.value[0],c=s.value[1],u&&typeof u=="object")l||(l=new Id),Fd(l,u);else if(f=$d(e,u),typeof f=="undefined"&&!Zv(e,u)||!yn(c,f,r,n)){if(r.strict||!aU(t,e,u,c,r,n))return!1;l||(l=new Id),Fd(l,u)}if(l){for(;(o=a.next())&&!o.done;)if(u=o.value[0],f=o.value[1],u&&typeof u=="object"){if(!B2(l,t,u,f,r,n))return!1}else if(!r.strict&&(!t.has(u)||!yn($d(t,u),f,r,n))&&!B2(l,t,u,f,U2({},r,{strict:!1}),n))return!1;return Rd(l)===0}return!0}function cU(t,e,r,n){var i,a;if(typeof t!=typeof e||t==null||e==null||D2(t)!==D2(e)||S2(t)!==S2(e))return!1;var s=E2(t),o=E2(e);if(s!==o)return!1;var l=t instanceof Error,u=e instanceof Error;if(l!==u||(l||u)&&(t.name!==e.name||t.message!==e.message))return!1;var c=T2(t),f=T2(e);if(c!==f||(c||f)&&(t.source!==e.source||_2(t)!==_2(e)))return!1;var d=A2(t),h=A2(e);if(d!==h||(d||h)&&M2(t)!==M2(e)||r.strict&&Xv&&Xv(t)!==Xv(e))return!1;var m=$2(t),g=$2(e);if(m!==g)return!1;if(m||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],!yn(t[a],e[a],r,n))return!1;var S=I2(t),_=I2(e);return S!==_?!1:S==="Set"||_==="Set"?oU(t,e,r,n):S==="Map"?lU(t,e,r,n):!0}q2.exports=function(e,r,n){return yn(e,r,n,iU())}});var aP=I((aJ,iP)=>{p();iP.exports=function(t,e){var r=t,n=e,i=r.length,a=n.length,s=!1,o=i+1,l=[],u=[],c,f,d=function(){i>=a&&(c=r,f=i,r=n,n=c,i=a,a=f,s=!0,o=i+1)},h=function(g,v,w,b,E){return{startX:g,startY:v,endX:w,endY:b,r:E}},m=function(g,v,w){var b,E,x,k,A;for(v>w?b=l[g-1+o]:b=l[g+1+o],A=x=Math.max(v,w),k=E=x-g;E=g+1;--k)w[k+o]=m(k,w[k-1+o]+1,w[k+1+o]);w[g+o]=m(g,w[g-1+o]+1,w[g+1+o])}while(w[g+o]!==a);for(ed=g+2*b,E=l[g+o],A=i,y=a,S=[];E!==-1;){let _=u[E];(i!=_.endX||a!=_.endY)&&S.push({file1:[s?_.endY:_.endX,s?y-_.endY:A-_.endX],file2:[s?_.endX:_.endY,s?A-_.endX:y-_.endY]}),A=_.startX,y=_.startY,E=u[E].r}return(A!=0||y!=0)&&S.push({file1:[0,s?y:A],file2:[0,s?A:y]}),S.reverse(),S}}}});var lP=I((oJ,oP)=>{p();var sP=aP();function fU(t,e,r){var n,i=new sP(e,t).compose(),a=new sP(e,r).compose(),s=[];function o(D,M){s.push([D.file1[0],M,D.file1[1],D.file2[0],D.file2[1]])}for(n=0;nu&&(l.push([1,u,D-u]),u=D)}for(var f=0;fg)break;g=Math.max(g,w+v[2]),f++}if(c(m),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(n=d;n<=f;n++){h=s[n];var E=h[1],x=b[E],k=h[0],A=k+h[2],y=h[3],S=y+h[4];x[0]=Math.min(y,x[0]),x[1]=Math.max(S,x[1]),x[2]=Math.min(k,x[2]),x[3]=Math.max(A,x[3])}var _=b[0][0]+(m-b[0][2]),T=b[0][1]+(g-b[0][3]),P=b[2][0]+(m-b[2][2]),F=b[2][1]+(g-b[2][3]);l.push([-1,_,T-_,m,g-m,P,F-P])}u=g}return c(e.length),l}function dU(t,e,r){var n=[],i=[t,e,r],a=fU(t,e,r),s=[];function o(){s.length&&n.push({ok:s}),s=[]}function l(h){for(var m=0;m{p();var Ho=1e3,Uo=Ho*60,jo=Uo*60,as=jo*24,mU=as*7,gU=as*365.25;uP.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return vU(t);if(r==="number"&&isFinite(t))return e.long?yU(t):wU(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function vU(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*gU;case"weeks":case"week":case"w":return r*mU;case"days":case"day":case"d":return r*as;case"hours":case"hour":case"hrs":case"hr":case"h":return r*jo;case"minutes":case"minute":case"mins":case"min":case"m":return r*Uo;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ho;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function wU(t){var e=Math.abs(t);return e>=as?Math.round(t/as)+"d":e>=jo?Math.round(t/jo)+"h":e>=Uo?Math.round(t/Uo)+"m":e>=Ho?Math.round(t/Ho)+"s":t+"ms"}function yU(t){var e=Math.abs(t);return e>=as?Ld(t,e,as,"day"):e>=jo?Ld(t,e,jo,"hour"):e>=Uo?Ld(t,e,Uo,"minute"):e>=Ho?Ld(t,e,Ho,"second"):t+" ms"}function Ld(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var hP=I((yJ,dP)=>{p();function bU(t){r.debug=r,r.default=r,r.coerce=l,r.disable=s,r.enable=i,r.enabled=o,r.humanize=fP(),r.destroy=u,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){let f=0;for(let d=0;d{if(A==="%%")return"%";x++;let S=r.formatters[y];if(typeof S=="function"){let _=v[x];A=S.call(w,_),v.splice(x,1),x--}return A}),r.formatArgs.call(w,v),(w.log||r.log).apply(w,v)}return g.namespace=c,g.useColors=r.useColors(),g.color=r.selectColor(c),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(c)),m),set:v=>{d=v}}),typeof r.init=="function"&&r.init(g),g}function n(c,f){let d=r(this.namespace+(typeof f=="undefined"?":":f)+c);return d.log=this.log,d}function i(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let f=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function a(c,f){let d=0,h=0,m=-1,g=0;for(;d"-"+f)].join(",");return r.enable(""),c}function o(c){for(let f of r.skips)if(a(c,f))return!1;for(let f of r.names)if(a(c,f))return!0;return!1}function l(c){return c instanceof Error?c.stack||c.message:c}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}dP.exports=bU});var Bd=I((vr,Nd)=>{p();vr.formatArgs=xU;vr.save=SU;vr.load=EU;vr.useColors=_U;vr.storage=kU();vr.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`."))}})();vr.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 _U(){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 xU(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Nd.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}vr.log=console.debug||console.log||(()=>{});function SU(t){try{t?vr.storage.setItem("debug",t):vr.storage.removeItem("debug")}catch(e){}}function EU(){let t;try{t=vr.storage.getItem("debug")||vr.storage.getItem("DEBUG")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function kU(){try{return localStorage}catch(t){}}Nd.exports=hP()(vr);var{formatters:AU}=Nd.exports;AU.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var pP=I(Or=>{"use strict";p();var TU=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});var CU=require("fs"),PU=TU(Bd()),Go=PU.default("@kwsites/file-exists");function RU(t,e,r){Go("checking %s",t);try{let n=CU.statSync(t);return n.isFile()&&e?(Go("[OK] path represents a file"),!0):n.isDirectory()&&r?(Go("[OK] path represents a directory"),!0):(Go("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return Go("[FAIL] path is not accessible: %o",n),!1;throw Go("[FATAL] %o",n),n}}function IU(t,e=Or.READABLE){return RU(t,(e&Or.FILE)>0,(e&Or.FOLDER)>0)}Or.exists=IU;Or.FILE=1;Or.FOLDER=2;Or.READABLE=Or.FILE+Or.FOLDER});var mP=I(Hd=>{"use strict";p();function $U(t){for(var e in t)Hd.hasOwnProperty(e)||(Hd[e]=t[e])}Object.defineProperty(Hd,"__esModule",{value:!0});$U(pP())});var nw=I(ss=>{"use strict";p();Object.defineProperty(ss,"__esModule",{value:!0});ss.createDeferred=ss.deferred=void 0;function rw(){let t,e,r="pending";return{promise:new Promise((i,a)=>{t=i,e=a}),done(i){r==="pending"&&(r="resolved",t(i))},fail(i){r==="pending"&&(r="rejected",e(i))},get fulfilled(){return r!=="pending"},get status(){return r}}}ss.deferred=rw;ss.createDeferred=rw;ss.default=rw});var Yw=I((exports,module)=>{p();(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(r){return new Sha256(e,!0).update(r)[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 r=0;r>2]|=t[i]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|n&63)<=57344?(o[a>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|n&63)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|n&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,r=this.h2,n=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=this.blocks,u,c,f,d,h,m,g,v,w,b,E;for(u=16;u<64;++u)h=l[u-15],c=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,h=l[u-2],f=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,l[u]=l[u-16]+c+l[u-7]+f<<0;for(E=e&r,u=0;u<64;u+=4)this.first?(this.is224?(v=300032,h=l[0]-1413257819,o=h-150054599<<0,n=h+24177077<<0):(v=704751109,h=l[0]-210244248,o=h-1521486534<<0,n=h+143694565<<0),this.first=!1):(c=(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),v=t&e,d=v^t&r^E,g=i&a^~i&s,h=o+f+g+K[u]+l[u],m=c+d,o=n+h<<0,n=h+m<<0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=n&t,d=w^n&e^v,g=o&i^~o&a,h=s+f+g+K[u+1]+l[u+1],m=c+d,s=r+h<<0,r=h+m<<0,c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,d=b^r&t^w,g=s&o^~s&i,h=a+f+g+K[u+2]+l[u+2],m=c+d,a=e+h<<0,e=h+m<<0,c=(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),E=e&r,d=E^e&n^b,g=a&s^~a&o,h=i+f+g+K[u+3]+l[u+3],m=c+d,i=t+h<<0,t=h+m<<0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<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,r=this.h2,n=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[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[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[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,r=this.h2,n=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,r>>24&255,r>>16&255,r>>8&255,r&255,n>>24&255,n>>16&255,n>>8&255,n&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,r){var n,i=typeof t;if(i==="string"){var a=[],s=t.length,o=0,l;for(n=0;n>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(++n)&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 u=[],c=[];for(n=0;n<64;++n){var f=t[n]||0;u[n]=92^f,c[n]=54^f}Sha256.call(this,e,r),this.update(c),this.oKeyPad=u,this.inner=!0,this.sharedMemory=r}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 NF=I(F0=>{p();(function(t){var e=/\S/,r=/\"/g,n=/\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,_){var T=S.length,P=0,F=1,D=2,M=P,re=null,ye=null,me="",fe=[],Ge=!1,oe=0,B=0,Z="{{",H="}}";function Oe(){me.length>0&&(fe.push({tag:"_t",text:new String(me)}),me="")}function cr(){for(var Ie=!0,Me=B;Me"&&(De.indent=fe[It].text.toString()),fe.splice(It,1));else Me||fe.push({tag:` +`});Ge=!1,B=fe.length}function Y(Ie,Me){var It="="+H,De=Ie.indexOf(It,Me),G=u(Ie.substring(Ie.indexOf("=",Me)+1,De)).split(" ");return Z=G[0],H=G[G.length-1],De+It.length-1}for(_&&(_=_.split(" "),Z=_[0],H=_[1]),oe=0;oe0;){if(M=y.shift(),D&&D.tag=="<"&&!(M.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[M.tag]<=t.tags.$||h(M,T))_.push(M),M.nodes=d(y,M.tag,_,T);else if(M.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+M.n);if(F=_.pop(),M.n!=F.n&&!m(M.n,F.n,T))throw new Error("Nesting error: "+F.n+" vs. "+M.n);return F.end=M.i,P}else M.tag==` +`&&(M.last=y.length==0||y[0].tag==` +`);P.push(M)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return P}function h(y,S){for(var _=0,T=S.length;_":x,"<":function(y,S){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,_);var T=S.partials[x(y,S)];T.subs=_.subs,T.partials=_.partials},$:function(y,S){var _={subs:{},code:"",partials:S.partials,prefix:y.n};t.walk(y.nodes,_),S.subs[y.n]=_.code,S.inPartial||(S.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,S){S.code+=A('"\\n"'+(y.last?"":" + i"))},_v:function(y,S){S.code+="t.b(t.v(t."+E(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,S){S.code+=A('"'+b(y.text)+'"')},"{":k,"&":k};function k(y,S){S.code+="t.b(t.t(t."+E(y.n)+'("'+b(y.n)+'",c,p,0)));'}function A(y){return"t.b("+y+");"}t.walk=function(y,S){for(var _,T=0,P=y.length;T{p();var eV={};(function(t){t.Template=function(d,h,m,g){d=d||{},this.r=d.code||this.r,this.c=m,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,m){return""},v:c,t:u,render:function(h,m,g){return this.ri([h],m||{},g)},ri:function(d,h,m){return this.r(d,h,m)},ep:function(d,h){var m=this.partials[d],g=h[m.name];if(m.instance&&m.base==g)return m.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,m.subs){h.stackText||(h.stackText={});for(key in m.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,m.subs,m.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,m,g){var v=this.ep(d,m);return v?v.ri(h,m,g):""},rs:function(d,h,m){var g=d[d.length-1];if(!f(g)){m(d,h,this);return}for(var v=0;v=0;x--)if(w=h[x],v=e(d,w,E),v!==void 0){b=!0;break}return b?(!g&&typeof v=="function"&&(v=this.mv(v,h,m)),v):g?!1:""},ls:function(d,h,m,g,v){var w=this.options.delimiters;return this.options.delimiters=v,this.b(this.ct(u(d.call(h,g)),h,m)),this.options.delimiters=w,!1},ct:function(d,h,m){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(d,this.options).render(h,m)},b:function(d){this.buf+=d},fl:function(){var d=this.buf;return this.buf="",d},ms:function(d,h,m,g,v,w,b){var E,x=h[h.length-1],k=d.call(x);return typeof k=="function"?g?!0:(E=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(k,x,m,E.substring(v,w),b)):k},mv:function(d,h,m){var g=h[h.length-1],v=d.call(g);return typeof v=="function"?this.ct(u(v.call(g)),g,m):v},sub:function(d,h,m,g){var v=this.subs[d];v&&(this.activeSub=d,v(h,m,this,g),this.activeSub=!1)}};function e(d,h,m){var g;return h&&typeof h=="object"&&(h[d]!==void 0?g=h[d]:m&&h.get&&typeof h.get=="function"&&(g=h.get(d))),g}function r(d,h,m,g,v,w){function b(){}b.prototype=d;function E(){}E.prototype=d.subs;var x,k=new b;k.subs=new E,k.subsText={},k.buf="",g=g||{},k.stackSubs=g,k.subsText=w;for(x in h)g[x]||(g[x]=h[x]);for(x in g)k.subs[x]=g[x];v=v||{},k.stackPartials=v;for(x in m)v[x]||(v[x]=m[x]);for(x in v)k.partials[x]=v[x];return k}var n=/&/g,i=//g,s=/\'/g,o=/\"/g,l=/[&<>\"\']/;function u(d){return String(d==null?"":d)}function c(d){return d=u(d),l.test(d)?d.replace(n,"&").replace(i,"<").replace(a,">").replace(s,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof O0!="undefined"?O0:eV)});var M0=I((Mte,HF)=>{p();var Hh=NF();Hh.Template=BF().Template;Hh.template=Hh.Template;HF.exports=Hh});var GF=I(nn=>{"use strict";p();Object.defineProperty(nn,"__esModule",{value:!0});nn.ColorSchemeType=nn.DiffStyleType=nn.LineMatchingType=nn.OutputFormatType=nn.LineType=void 0;var UF;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(UF||(nn.LineType=UF={}));nn.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"};nn.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"};nn.DiffStyleType={WORD:"word",CHAR:"char"};var jF;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(jF||(nn.ColorSchemeType=jF={}))});var A9={};JM(A9,{default:()=>Up});module.exports=QM(A9);p();var $M=bt(Hg()),we=require("obsidian"),FM=bt(require("path"));p();var Zn={};p();var rd=class{constructor(e){this.plugin=e;this.tasks=[]}addTask(e,r){this.tasks.push({task:e,onFinished:r!=null?r:()=>{}}),this.tasks.length===1&&this.handleTask()}handleTask(){if(this.tasks.length>0){let e=this.tasks[0];e.task().then(r=>{e.onFinished(r),this.tasks.shift(),this.handleTask()},r=>{this.plugin.displayError(r),e.onFinished(void 0),this.tasks.shift(),this.handleTask()})}}clear(){this.tasks=[]}};p();var U=require("obsidian");p();var nA=require("obsidian"),nd="YYYY-MM-DD",Ug=`${nd} HH:mm`,jg=`${nd} HH:mm:ss`,id=40,Ro="conflict-files-obsidian-git.md",Xe={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitMessageScript:"",commitDateFormat:jg,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,autoCommitOnlyStaged:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,showErrorNotices:!0,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",mergeStrategy:"none",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:nA.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,diffStyle:"split",hunks:{showSigns:!1,hunkCommands:!1,statusBar:"disabled"},lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:Ug,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"},Qr={type:"git-history-view",name:"History",icon:"history"},ma={type:"split-diff-view",name:"Diff view",icon:"diff"},ga={type:"diff-view",name:"Diff View",icon:"git-pull-request"},ad="C:\\Program Files\\Git\\cmd\\git.exe",sd="git_credentials_input",rs="obsidian_askpass.sh",iA=`#!/bin/sh + +PROMPT="$1" +TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT" + +cleanup() { + rm -f "$TEMP_FILE" "$TEMP_FILE.response" +} +trap cleanup EXIT + +echo "$PROMPT" > "$TEMP_FILE" + +while [ ! -e "$TEMP_FILE.response" ]; do + if [ ! -e "$TEMP_FILE" ]; then + echo "Trigger file got removed: Abort" >&2 + exit 1 + fi + sleep 0.1 +done + +RESPONSE=$(cat "$TEMP_FILE.response") + +echo "$RESPONSE" +`,aA=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];p();p();p();var xc=class{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let a=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(a,n)),l=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,l,n,i)}diffWithOptionsObj(e,r,n,i){var a;let s=b=>{if(b=this.postProcess(b,n),i){setTimeout(function(){i(b)},0);return}else return b},o=r.length,l=e.length,u=1,c=o+l;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let f=(a=n.timeout)!==null&&a!==void 0?a:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,e,0,n);if(h[0].oldPos+1>=l&&m+1>=o)return s(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,w=()=>{for(let b=Math.max(g,-u);b<=Math.min(v,u);b+=2){let E,x=h[b-1],k=h[b+1];x&&(h[b-1]=void 0);let A=!1;if(k){let S=k.oldPos-b;A=k&&0<=S&&S=l&&m+1>=o)return s(this.buildValues(E.lastComponent,r,e))||!0;h[b]=E,E.oldPos+1>=l&&(v=Math.min(v,b-1)),m+1>=o&&(g=Math.max(g,b+1))}u++};if(i)(function b(){setTimeout(function(){if(u>c||Date.now()>d)return i(void 0);w()||b()},0)})();else for(;u<=c&&Date.now()<=d;){let b=w();if(b)return b}}addToPath(e,r,n,i,a){let s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,i,a){let s=r.length,o=n.length,l=e.oldPos,u=l-i,c=0;for(;u+1d.length?m:d}),c.value=this.join(f)}else c.value=this.join(r.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}return i}};p();var Gg=class extends xc{constructor(){super(...arguments),this.tokenize=q8}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(` +`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(` +`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(` +`)&&(e=e.slice(0,-1)),r.endsWith(` +`)&&(r=r.slice(0,-1))),super.equals(e,r,n)}},G8=new Gg;function qg(t,e,r){return G8.diff(t,e,r)}function q8(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` +`));let r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i{let d=u(f);c(d)}}))}else return u(qg(r,n,o));function u(c){if(!c)return;c.push({value:"",lines:[]});function f(b){return b.map(function(E){return" "+E})}let d=[],h=0,m=0,g=[],v=1,w=1;for(let b=0;b0?f(k.lines.slice(-l)):[],h-=g.length,m-=g.length)}for(let k of x)g.push((E.added?"+":"-")+k);E.added?w+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&b{o(l?od(l):void 0)}}))}else{let o=zg(t,e,r,n,i,a,s);return o?od(o):void 0}}function Sc(t,e,r,n,i,a){return sA(t,t,e,r,n,i,a)}function z8(t){let e=t.endsWith(` +`),r=t.split(` +`).map(n=>n+` +`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var te=bt(Hg()),is=require("obsidian");p();function oA(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var Io=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};p();var lA=require("obsidian"),V8={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},ze=class extends lA.SuggestModal{constructor(e,r){if(super(e.app),this.config={...V8,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button"});i.style.marginRight="32px",i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let n;this.config.allowEmpty&&e===" "?n="":e==="..."?n=void 0:n=e,this.resolve(n)}}};p();var V2=bt(AA()),W2=require("child_process"),Y2=bt(z2()),Pi=require("obsidian");function Md(t){throw new Error(`Unexpected object: ${t}`)}function Lc(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var Kv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function bn(t,e){let r;if(e){if(e.button===0||e.button===1){let n=Pi.Keymap.isModEvent(e);r=t.workspace.getLeaf(n)}}else r=t.workspace.getLeaf(!1);return r}function Qn(t,e,r,n,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(r);if(a!=null){let s=new Pi.Menu;t.workspace.trigger("file-menu",s,a,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}else{let s=new Pi.Menu;t.workspace.trigger("obsidian-git:menu",s,r,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function ba(t){throw new Error("Impossible branch: "+t)}function Jv(t){return`rgb(${t.r},${t.g},${t.b})`}function X2(t){var a;let e=(a=V2.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[r,n,i]=e;return{r,g:n,b:i}}function Z2(t){return t.diff(Pi.moment.unix(0),"seconds")}function K2(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function J2(t,e){return(0,Y2.default)(t,e,{strict:!0})}function Nc(t,e){return new Proxy(t,{get(r,n){return n==="length"?Math.min(e,r.length):r[n]}})}function Q2(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function eP(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),n=t.substring(e,t.length);return r+n}function Qv(t,e,r){return t<=e&&e<=r}function Ri(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function ei(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function tP(t){return t===1?"1 minute":`${t} minutes`}function uU(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function Do(t){if(t.endsWith(".md"))return!1;let e=uU(t);return aA.includes(e)}function ew(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function Lo(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Pi.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(n){return!0}}function rP({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function No(t,e,r,n){let i=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:i,linktext:n})}function Bc(t,e,r={}){return new Promise((n,i)=>{let a=(0,W2.spawn)(t,e,r),s="",o="";a.stdout.on("data",l=>{s+=l.toString()}),a.stderr.on("data",l=>{o+=l.toString()}),a.on("error",l=>{n({error:new Error(l.message),stdout:s,stderr:s,code:1})}),a.on("close",l=>{n({stdout:s,stderr:o,code:l!=null?l:1,error:void 0})})})}p();var nP=require("obsidian"),Bo=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let n=[];for(e=[...e];e.length>0;){let i=e.first(),a=i.path.substring(r);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=e.filter(u=>u.path.substring(r).startsWith(s+"/"));o.forEach(u=>e.remove(u));let l=i.path.substring(0,a.indexOf("/")+r);n.push({title:s,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(r>0?r+s.length:s.length)+1)})}else n.push({title:a,data:i,path:i.path,vaultPath:this.getRelativeVaultPath(i.path)}),e.remove(i)}return n}simplify(e){var r,n,i,a;for(let s of e){for(;;){let o=((r=s.children)==null?void 0:r.length)==1,l=((i=(n=s.children)==null?void 0:n.first())==null?void 0:i.data)==null;if(!(s.children!=null&&o&&l))break;let u=s.children.first();s.title+="/"+u.title,s.data=u.data,s.path=u.path,s.vaultPath=u.vaultPath,s.children=u.children}s.children!=null&&this.simplify(s.children),(a=s.children)==null||a.sort((o,l)=>{let u=(l.data==null?1:0)-(o.data==null?1:0);return u!=0?u: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 r=this._getTreeStructure(e);return this.simplify(r)}async formatCommitMessage(e){let r;if(e.includes("{{numFiles}}")){r=await this.status();let n=r.staged.length;e=e.replace("{{numFiles}}",String(n))}if(e.includes("{{hostname}}")){let n=this.plugin.localStorage.getHostname()||"";e=e.replace("{{hostname}}",n)}if(e.includes("{{files}}")){r=r!=null?r:await this.status();let n={},i="";if(r.staged.length<100){r.staged.forEach(s=>{s.index in n?n[s.index].push(s.path):n[s.index]=[s.path]});let a=[];for(let[s,o]of Object.entries(n))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,nP.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let n=r!=null?r:await this.status(),i="";n.staged.length<100?i=n.staged.map(a=>a.path).join(` +`):i="Too many files to list",e=e+` + +Affected files: +`+i}return e}};p();var _a=require("obsidian"),Dd=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var n;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof _a.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)):(n=this.index)!=null?n:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof _a.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);return n instanceof _a.TFile?this.vault.modify(n,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let n=this.vault.getAbstractFileByPath(e);return n instanceof _a.TFile?this.vault.modifyBinary(n,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),n=[...r.files,...r.folders],i;return e!=="/"?i=n.map(a=>(0,_a.normalizePath)(a.substring(e.length))):i=n,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var n,i;return this.adapter.rmdir(e,(i=(n=r==null?void 0:r.options)==null?void 0:n.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.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(e);if(n==null)throw{code:"ENOENT"};return this.indexctime=n.ctime,this.indexmtime=n.mtime,{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof _a.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let n=await this.adapter.stat(e);if(n)return{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:n.type==="folder"?"directory":n.type,isFile:()=>n.type==="file",isDirectory:()=>n.type==="folder",isSymbolicLink:()=>!1};throw{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 cP=bt(lP()),_n=class extends Bo{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new Dd(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,n;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(n=this.plugin.localStorage.getPassword())!=null?n:void 0}},onAuthFailure:async()=>{new is.Notice("Authentication failed. Please try with different credentials");let r=await new ze(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let n=await new ze(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(n)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(n),{username:r,password:n}}return{cancel:!0}},http:{async request({url:r,method:n,headers:i,body:a}){let s;a&&(s=await pU(a));let o=await(0,is.requestUrl)({url:r,method:n,headers:i,body:s,throw:!1});return{url:r,method:n,headers:o.headers,body:hU(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let n=await r;return await this.fs.saveAndClear(),n}catch(n){throw await this.fs.saveAndClear(),n}}async status(r){let n,i=window.setTimeout(()=>{n=new is.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let a={...this.getRepo()};(r==null?void 0:r.path)!=null&&(a.filepaths=[`${r.path}/`]);let s=(await this.wrapFS(te.default.statusMatrix(a))).map(f=>this.getFileStatusResult(f)),o=[],l=[],u=[];for(let f of s)f.workingDir!==" "&&o.push(f),f.index!==" "&&f.index!=="U"&&l.push(f),(f.index!=" "||f.workingDir!=" ")&&u.push(f);let c=[];return window.clearTimeout(i),n==null||n.hide(),{all:u,changed:o,staged:l,conflicted:c}}catch(a){throw window.clearTimeout(i),n==null||n.hide(),this.plugin.displayError(a),a}}async commitAll({message:r,status:n,unstagedFiles:i}){try{return await this.checkAuthorInfo(),await this.stageAll({status:n,unstagedFiles:i}),this.commit({message:r})}catch(a){throw this.plugin.displayError(a),a}}async commit({message:r}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let n=await this.formatCommitMessage(r),i=this.plugin.localStorage.getConflict(),a;if(i){let s=await this.branchInfo();a=[s.current,s.tracking]}await this.wrapFS(te.default.commit({...this.getRepo(),message:n,parent:a})),this.plugin.localStorage.setConflict(!1);return}catch(n){throw this.plugin.displayError(n),n}}async stage(r,n){let i=this.getRelativeRepoPath(r,n),a;n?a=r:a=this.getRelativeVaultPath(r);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(a)?await this.wrapFS(te.default.add({...this.getRepo(),filepath:i})):await this.wrapFS(te.default.remove({...this.getRepo(),filepath:i}))}catch(s){throw this.plugin.displayError(s),s}}async stageAll({dir:r,status:n,unstagedFiles:i}){try{if(n)await Promise.all(n.changed.map(a=>a.workingDir!=="D"?this.wrapFS(te.default.add({...this.getRepo(),filepath:a.path})):te.default.remove({...this.getRepo(),filepath:a.path})));else{let a=i!=null?i:await this.getUnstagedFiles(r!=null?r:".");await Promise.all(a.map(({path:s,type:o})=>o=="D"?te.default.remove({...this.getRepo(),filepath:s}):this.wrapFS(te.default.add({...this.getRepo(),filepath:s}))))}}catch(a){throw this.plugin.displayError(a),a}}async unstage(r,n){try{this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.wrapFS(te.default.resetIndex({...this.getRepo(),filepath:r}))}catch(i){throw this.plugin.displayError(i),i}}async unstageAll({dir:r,status:n}){try{let i;n?i=n.staged.map(a=>a.path):i=(await this.getStagedFiles(r!=null?r:".")).map(({path:s})=>s),await this.wrapFS(Promise.all(i.map(a=>te.default.resetIndex({...this.getRepo(),filepath:a}))))}catch(i){throw this.plugin.displayError(i),i}}async discard(r){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(te.default.checkout({...this.getRepo(),filepaths:[r],force:!0}))}catch(n){throw this.plugin.displayError(n),n}}async discardAll({dir:r,status:n}){let i=[];n?r!=null?i=n.changed.filter(a=>a.workingDir!="U"&&a.path.startsWith(r)).map(a=>a.path):i=n.changed.filter(a=>a.workingDir!="U").map(a=>a.path):i=(await this.getUnstagedFiles(r)).filter(a=>a.type!="A").map(({path:a})=>a);try{await this.wrapFS(te.default.checkout({...this.getRepo(),filepaths:i,force:!0}))}catch(a){throw this.plugin.displayError(a),a}}async getUntrackedPaths(r){let n=[];if(r.status)for(let i of r.status.changed)i.index=="U"&&i.workingDir==="U"&&i.path.startsWith(r.path!=null?`${r.path}/`:"")&&n.push(i.path);else{let i=await this.status({path:r==null?void 0:r.path});for(let a of i.changed)a.index==="U"&&a.workingDir==="U"&&n.push(a.path)}return n}getProgressText(r,n){let i=`${r} progress:`;return n.phase&&(i=`${i} ${n.phase}:`),n.loaded&&(i=`${i} ${n.loaded}`,n.total&&(i=`${i} of ${n.total}`)),i}resolveRef(r){return this.wrapFS(te.default.resolveRef({...this.getRepo(),ref:r}))}async pull(){let r=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let n=await this.resolveRef("HEAD");await this.fetch();let i=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(te.default.merge({...this.getRepo(),ours:i.current,theirs:i.tracking,abortOnConflict:!1,mergeDriver:this.plugin.settings.mergeStrategy!=="none"?({contents:l})=>{var b,E,x;let u=l[0],c=l[1],f=l[2],d=/^.*(\r?\n|$)/gm,h=(b=c.match(d))!=null?b:[],m=(E=u.match(d))!=null?E:[],g=(x=f.match(d))!=null?x:[],v=(0,cP.default)(h,m,g),w="";for(let k of v)k.ok&&(w+=k.ok.join("")),k.conflict&&(w+=this.plugin.settings.mergeStrategy==="ours"?k.conflict.a.join(""):k.conflict.b.join(""));return{cleanMerge:!0,mergedText:w}}:void 0}))).alreadyMerged||await this.wrapFS(te.default.checkout({...this.getRepo(),ref:i.current,onProgress:l=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:i.remote})),r==null||r.hide();let s=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(n,s);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(l.path)}))}catch(n){throw r==null||r.hide(),n instanceof te.Errors.MergeConflictError&&await this.plugin.handleConflict(n.data.filepaths.map(i=>this.getRelativeVaultPath(i))),this.plugin.displayError(n),n}}async push(){if(!await this.canPush())return 0;let r=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let n=await this.branchInfo(),i=n.tracking,a=n.current,s=(await this.getFileChangesCount(a,i)).length;this.plugin.setPluginState({gitAction:5});let o=await this.getCurrentRemote();return await this.wrapFS(te.default.push({...this.getRepo(),remote:o,onProgress:l=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Pushing",l))}})),r==null||r.hide(),s}catch(n){throw r==null||r.hide(),this.plugin.displayError(n),n}}async getUnpushedCommits(){let r=await this.branchInfo(),n=r.tracking,i=r.current;if(n==null||i==null)return 0;let a=await this.resolveRef(i),s=await this.resolveRef(n);return(await this.getFileChangesCount(a,s)).length}async canPush(){let r=await this.branchInfo(),n=r.tracking,i=r.current,a=await this.resolveRef(i),s=await this.resolveRef(n);return a!=s}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var r,n;try{let i=await te.default.currentBranch(this.getRepo())||"",a=await te.default.listBranches(this.getRepo()),s=(r=await this.getConfig(`branch.${i}.remote`))!=null?r:"origin",o=(n=await this.getConfig(`branch.${i}.merge`))==null?void 0:n.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 r=await te.default.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${r}.remote`))!=null?i:"origin"}async checkout(r,n){try{return this.wrapFS(te.default.checkout({...this.getRepo(),ref:r,force:!!n,remote:n}))}catch(i){throw this.plugin.displayError(i),i}}async createBranch(r){try{await this.wrapFS(te.default.branch({...this.getRepo(),ref:r,checkout:!0}))}catch(n){throw this.plugin.displayError(n),n}}async deleteBranch(r){try{await this.wrapFS(te.default.deleteBranch({...this.getRepo(),ref:r}))}catch(n){throw this.plugin.displayError(n),n}}branchIsMerged(r){return Promise.resolve(!0)}async init(){try{await this.wrapFS(te.default.init(this.getRepo()))}catch(r){throw this.plugin.displayError(r),r}}async clone(r,n,i){let a=this.showNotice("Initializing clone");try{await this.wrapFS(te.default.clone({...this.getRepo(),dir:n,url:r,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(r,n){try{return this.wrapFS(te.default.setConfig({...this.getRepo(),path:r,value:n}))}catch(i){throw this.plugin.displayError(i),i}}async getConfig(r){try{return this.wrapFS(te.default.getConfig({...this.getRepo(),path:r}))}catch(n){throw this.plugin.displayError(n),n}}async fetch(r){let n=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:a=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Fetching",a))},remote:r!=null?r:await this.getCurrentRemote()};await this.wrapFS(te.default.fetch(i)),n==null||n.hide()}catch(i){throw this.plugin.displayError(i),n==null||n.hide(),i}}async setRemote(r,n){try{await this.wrapFS(te.default.addRemote({...this.getRepo(),remote:r,url:n,force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async getRemoteBranches(r){let n=[];return n.push(...await this.wrapFS(te.default.listBranches({...this.getRepo(),remote:r}))),n.remove("HEAD"),n=n.map(i=>`${r}/${i}`),n}async getRemotes(){return(await this.wrapFS(te.default.listRemotes({...this.getRepo()}))).map(r=>r.remote)}async removeRemote(r){await this.wrapFS(te.default.deleteRemote({...this.getRepo(),remote:r}))}async getRemoteUrl(r){var n;return(n=(await this.wrapFS(te.default.listRemotes({...this.getRepo()}))).filter(i=>i.remote==r)[0])==null?void 0:n.url}async log(r,n=!0,i,a){let s=await this.wrapFS(te.default.log({...this.getRepo(),depth:i,ref:a}));return Promise.all(s.map(async o=>{let l=o.commit.message.split(` + +`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(` + +`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(u=>({path:u.path,status:u.type,vaultPath:this.getRelativeVaultPath(u.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[n,i]=Ri(r),a=await this.branchInfo();await this.wrapFS(te.default.push({...this.getRepo(),remote:n,remoteRef:i})),await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,n){return this.walkDifference({walkers:[te.default.TREE({ref:r}),te.default.TREE({ref:n})]})}async walkDifference({walkers:r,dir:n}){return await this.wrapFS(te.default.walk({...this.getRepo(),trees:r,map:async function(a,[s,o]){if(!Kv(a,n))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()),u=await(o==null?void 0:o.oid()),c="equal";if(l!==u&&(c="M"),l===void 0&&(c="A"),u===void 0&&(c="D"),l===void 0&&u===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),c!=="equal")return{path:a,type:c}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[te.default.TREE({ref:"HEAD"}),te.default.STAGE()],dir:r})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path}))}async getUnstagedFiles(r="."){let n,i=window.setTimeout(()=>{n=new is.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(te.default.walk({...a,trees:[te.default.WORKDIR(),te.default.STAGE()],map:async function(o,[l,u]){if(!u&&l&&await te.default.isIgnored({...a,filepath:o})||!Kv(o,r))return null;let[c,f]=await Promise.all([l&&l.type(),u&&u.type()]),d=[c,f].includes("blob");if((c==="tree"||c==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await u.oid():void 0,m;return c==="blob"&&f!=="blob"?m="42":c==="blob"&&(m=await l.oid()),m?h?m!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(i),n==null||n.hide(),s}catch(a){throw window.clearTimeout(i),n==null||n.hide(),this.plugin.displayError(a),a}}async getDiffString(r,n=!1,i){let a=this.getRelativeVaultPath(r),s=async(u,[c])=>{if(r==u){let f=await c.oid();return(await te.default.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let u=await(0,te.readBlob)({...this.getRepo(),filepath:r,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof te.default.Errors.NotFoundError))throw h}),c=await te.default.readCommit({...this.getRepo(),oid:i}),f=await(0,te.readBlob)({...this.getRepo(),filepath:r,oid:c.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof te.default.Errors.NotFoundError))throw h});return Sc(a,f!=null?f:"",u!=null?u:"")}let o=(await te.default.walk({...this.getRepo(),trees:[te.default.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(n){let u=await this.resolveRef("HEAD").then(f=>(0,te.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof te.default.Errors.NotFoundError))throw f});return Sc(a,u!=null?u:"",l)}else{let u;return await this.app.vault.adapter.exists(a)?u=await this.app.vault.adapter.read(a):u="",Sc(a,l,u)}}async getLastCommitTime(){let r=this.getRepo(),n=await this.resolveRef("HEAD"),a=(await te.default.readCommit({...r,oid:n})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(r){let n=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:n[0]=="?"?"U":n[0],workingDir:n[1]=="?"?"U":n[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),n=await this.getConfig("user.email");if(!r||!n)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,n=!0){if(!this.plugin.settings.disablePopups)return new is.Notice(r,n?this.noticeLength:void 0)}};async function*hU(t){yield new Uint8Array(t)}async function pU(t){let e=new ReadableStream({async start(n){for await(let i of t)n.enqueue(i);n.close()}});return await new Response(e).arrayBuffer()}p();var QI=bt(Bd()),Dr=bt(require("fs/promises")),$i=require("obsidian"),He=bt(require("path")),Xc=require("path");p();var Kd=bt(mP(),1),Yd=bt(Bd(),1),HR=require("child_process"),SI=bt(nw(),1),qo=bt(nw(),1),XI=require("node:events"),Sw=Object.defineProperty,FU=Object.getOwnPropertyDescriptor,Ew=Object.getOwnPropertyNames,OU=Object.prototype.hasOwnProperty,V=(t,e)=>function(){return t&&(e=(0,t[Ew(t)[0]])(t=0)),e},MU=(t,e)=>function(){return e||(0,t[Ew(t)[0]])((e={exports:{}}).exports,e),e.exports},ft=(t,e)=>{for(var r in e)Sw(t,r,{get:e[r],enumerable:!0})},DU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ew(e))!OU.call(t,i)&&i!==r&&Sw(t,i,{get:()=>e[i],enumerable:!(n=FU(e,i))||n.enumerable});return t},it=t=>DU(Sw({},"__esModule",{value:!0}),t);function LU(...t){let e=new String(t);return Zd.set(e,t),e}function zd(t){return t instanceof String&&Zd.has(t)}function gP(t){return Zd.get(t)||[]}var Zd,Gc=V({"src/lib/args/pathspec.ts"(){"use strict";Zd=new WeakMap}}),br,Sa=V({"src/lib/errors/git-error.ts"(){"use strict";br=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),qc,Vo=V({"src/lib/errors/git-response-error.ts"(){"use strict";Sa(),qc=class extends br{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),WP,YP=V({"src/lib/errors/task-configuration-error.ts"(){"use strict";Sa(),WP=class extends br{constructor(t){super(void 0,t)}}}});function XP(t){return typeof t!="function"?us:t}function ZP(t){return typeof t=="function"&&t!==us}function KP(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function JP(t,e=0){return QP(t)&&t.length>e?t[e]:void 0}function cs(t,e=0){if(QP(t)&&t.length>e)return t[t.length-1-e]}function QP(t){return!!(t&&typeof t.length=="number")}function zc(t="",e=!0,r=` +`){return t.split(r).reduce((n,i)=>{let a=e?i.trim():i;return a&&n.push(a),n},[])}function kw(t,e){return zc(t,!0).map(r=>e(r))}function Aw(t){return(0,Kd.exists)(t,Kd.FOLDER)}function Re(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function eR(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Jd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function ti(t){return Array.isArray(t)?t:[t]}function tR(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function rR(t){return ti(t).map(String)}function Ue(t,e=0){if(t==null)return e;let r=parseInt(t,10);return isNaN(r)?e:r}function Uc(t,e){let r=[];for(let n=0,i=t.length;nr in t?{[r]:t[r]}:{}))}function uw(t=0){return new Promise(e=>setTimeout(e,t))}function fw(t){if(t!==!1)return t}var zo,us,Vc,Qd=V({"src/lib/utils/util.ts"(){"use strict";zo="\0",us=()=>{},Vc=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ri(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function dw(t,e){let r=zd(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function eh(t){return!!t&&Vc(t)==="[object Object]"}function iR(t){return typeof t=="function"}var Wc,Vt,aR,Vd,Tw,sR=V({"src/lib/utils/argument-filters.ts"(){"use strict";Qd(),Gc(),Wc=t=>Array.isArray(t),Vt=t=>typeof t=="string",aR=t=>Array.isArray(t)&&t.every(Vt),Vd=t=>Vt(t)||Array.isArray(t)&&t.every(Vt),Tw=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),hw,NU=V({"src/lib/utils/exit-codes.ts"(){"use strict";hw=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(hw||{})}}),Wd,BU=V({"src/lib/utils/git-output-streams.ts"(){"use strict";Wd=class oR{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new oR(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),he,xa,HU=V({"src/lib/utils/line-parser.ts"(){"use strict";he=class{constructor(t,e){this.matches=[],this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,r(a)))?this.useMatches(n,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,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},xa=class extends he{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function lR(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...cR},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var cR,UU=V({"src/lib/utils/simple-git-options.ts"(){"use strict";cR={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Cw(t,e=[]){return eh(t)?Object.keys(t).reduce((r,n)=>{let i=t[n];if(zd(i))r.push(i);else if(dw(i,["boolean"]))r.push(n+"="+i);else if(Array.isArray(i))for(let a of i)dw(a,["string","number"])||r.push(n+"="+a);else r.push(n);return r},e):e}function wr(t,e=0,r=!1){let n=[];for(let i=0,a=e<0?t.length:e;i{for(let a=zc(i,n),s=0,o=a.length;s{if(!(s+u>=o))return a[s+u]};e.some(({parse:u})=>u(l,t))}}),t}var qU=V({"src/lib/utils/task-parser.ts"(){"use strict";Qd()}}),uR={};ft(uR,{ExitCodes:()=>hw,GitOutputStreams:()=>Wd,LineParser:()=>he,NOOP:()=>us,NULL:()=>zo,RemoteLineParser:()=>xa,append:()=>Re,appendTaskOptions:()=>Cw,asArray:()=>ti,asCamelCase:()=>tR,asFunction:()=>XP,asNumber:()=>Ue,asStringArray:()=>rR,bufferToString:()=>jc,callTaskParser:()=>pw,createInstanceConfig:()=>lR,delay:()=>uw,filterArray:()=>Wc,filterFunction:()=>iR,filterHasLength:()=>Tw,filterPlainObject:()=>eh,filterPrimitives:()=>dw,filterString:()=>Vt,filterStringArray:()=>aR,filterStringOrStringArray:()=>Vd,filterType:()=>ri,first:()=>JP,folderExists:()=>Aw,forEachLineWithContent:()=>kw,getTrailingOptions:()=>wr,including:()=>eR,isUserFunction:()=>ZP,last:()=>cs,objectToString:()=>Vc,orVoid:()=>fw,parseStringResponse:()=>_r,pick:()=>nR,prefixedArray:()=>Uc,remove:()=>Jd,splitOn:()=>KP,toLinesWithContent:()=>zc,trailingFunctionArgument:()=>at,trailingOptionsArgument:()=>Pw});var ue=V({"src/lib/utils/index.ts"(){"use strict";sR(),NU(),BU(),HU(),UU(),GU(),qU(),Qd()}}),fR={};ft(fR,{CheckRepoActions:()=>mw,checkIsBareRepoTask:()=>hR,checkIsRepoRootTask:()=>dR,checkIsRepoTask:()=>zU});function zU(t){switch(t){case"bare":return hR();case"root":return dR()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:th,parser:Rw}}function dR(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:th,parser(e){return/^\.(git)?$/.test(e.trim())}}}function hR(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:th,parser:Rw}}function VU(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var mw,th,Rw,pR=V({"src/lib/tasks/check-is-repo.ts"(){"use strict";ue(),mw=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(mw||{}),th=({exitCode:t},e,r,n)=>{if(t===128&&VU(e))return r(Buffer.from("false"));n(e)},Rw=t=>t.trim()==="true"}});function WU(t,e){let r=new mR(t),n=t?vR:gR;return zc(e).forEach(i=>{let a=i.replace(n,"");r.paths.push(a),(wR.test(a)?r.folders:r.files).push(a)}),r}var mR,gR,vR,wR,YU=V({"src/lib/responses/CleanSummary.ts"(){"use strict";ue(),mR=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},gR=/^[a-z]+\s*/i,vR=/^[a-z]+\s+[a-z]+\s*/i,wR=/\/$/}}),gw={};ft(gw,{EMPTY_COMMANDS:()=>rh,adhocExecTask:()=>yR,configurationErrorTask:()=>yr,isBufferTask:()=>_R,isEmptyTask:()=>xR,straightThroughBufferTask:()=>bR,straightThroughStringTask:()=>ir});function yR(t){return{commands:rh,format:"empty",parser:t}}function yr(t){return{commands:rh,format:"empty",parser(){throw typeof t=="string"?new WP(t):t}}}function ir(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function bR(t){return{commands:t,format:"buffer",parser(e){return e}}}function _R(t){return t.format==="buffer"}function xR(t){return t.format==="empty"||!t.commands.length}var rh,ut=V({"src/lib/tasks/task.ts"(){"use strict";YP(),rh=[]}}),SR={};ft(SR,{CONFIG_ERROR_INTERACTIVE_MODE:()=>Iw,CONFIG_ERROR_MODE_REQUIRED:()=>$w,CONFIG_ERROR_UNKNOWN_OPTION:()=>Fw,CleanOptions:()=>ls,cleanTask:()=>ER,cleanWithOptionsTask:()=>XU,isCleanOptionsArray:()=>ZU});function XU(t,e){let{cleanMode:r,options:n,valid:i}=KU(t);return r?i.options?(n.push(...e),n.some(ej)?yr(Iw):ER(r,n)):yr(Fw+JSON.stringify(t)):yr($w)}function ER(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(n){return WU(t==="n",n)}}}function ZU(t){return Array.isArray(t)&&t.every(e=>Ow.has(e))}function KU(t){let e,r=[],n={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{JU(i)?(e=i,n.cleanMode=!0):n.options=n.options&&QU(r[r.length]=`-${i}`)}),{cleanMode:e,options:r,valid:n}}function JU(t){return t==="f"||t==="n"}function QU(t){return/^-[a-z]$/i.test(t)&&Ow.has(t.charAt(1))}function ej(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var Iw,$w,Fw,ls,Ow,kR=V({"src/lib/tasks/clean.ts"(){"use strict";YU(),ue(),ut(),Iw="Git clean interactive mode is not supported",$w='Git clean mode parameter ("n" or "f") is required',Fw="Git clean unknown option found in: ",ls=(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))(ls||{}),Ow=new Set(["i",...rR(Object.values(ls))])}});function tj(t){let e=new TR;for(let r of AR(t))e.addValue(r.file,String(r.key),r.value);return e}function rj(t,e){let r=null,n=[],i=new Map;for(let a of AR(t,e))a.key===e&&(n.push(r=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(r));return{key:e,paths:Array.from(i.keys()),scopes:i,value:r,values:n}}function nj(t){return t.replace(/^(file):/,"")}function*AR(t,e=null){let r=t.split("\0");for(let n=0,i=r.length-1;nObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=cs(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);n.hasOwnProperty(e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function iw(t,e){return typeof t=="string"&&vw.hasOwnProperty(t)?t:e}function aj(t,e,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function sj(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return rj(n,t)}}}function oj(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return tj(r)}}}function lj(){return{addConfig(t,e,...r){return this._runTask(aj(t,e,r[0]===!0,iw(r[1],"local")),at(arguments))},getConfig(t,e){return this._runTask(sj(t,iw(e,void 0)),at(arguments))},listConfig(...t){return this._runTask(oj(iw(t[0],void 0)),at(arguments))}}}var vw,CR=V({"src/lib/tasks/config.ts"(){"use strict";ij(),ue(),vw=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(vw||{})}});function cj(t){return PR.has(t)}var aw,PR,RR=V({"src/lib/tasks/diff-name-status.ts"(){"use strict";aw=(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))(aw||{}),PR=new Set(Object.values(aw))}});function uj(...t){return new $R().param(...t)}function fj(t){let e=new Set,r={};return kw(t,n=>{let[i,a,s]=n.split(zo);e.add(i),(r[i]=r[i]||[]).push({line:Ue(a),path:i,preview:s})}),{paths:e,results:r}}function dj(){return{grep(t){let e=at(arguments),r=wr(arguments);for(let i of IR)if(r.includes(i))return this._runTask(yr(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=uj().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(i){return fj(i)}},e)}}}var IR,Hc,vP,$R,FR=V({"src/lib/tasks/grep.ts"(){"use strict";ue(),ut(),IR=["-h"],Hc=Symbol("grepQuery"),$R=class{constructor(){this[vP]=[]}*[(vP=Hc,Symbol.iterator)](){for(let t of this[Hc])yield t}and(...t){return t.length&&this[Hc].push("--and","(",...Uc(t,"-e"),")"),this}param(...t){return this[Hc].push(...Uc(t,"-e")),this}}}}),OR={};ft(OR,{ResetMode:()=>jd,getResetMode:()=>pj,resetTask:()=>hj});function hj(t,e){let r=["reset"];return MR(t)&&r.push(`--${t}`),r.push(...e),ir(r)}function pj(t){if(MR(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function MR(t){return DR.includes(t)}var jd,DR,LR=V({"src/lib/tasks/reset.ts"(){"use strict";ut(),jd=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(jd||{}),DR=Array.from(Object.values(jd))}});function mj(){return(0,Yd.default)("simple-git")}function wP(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...i)=>{t(n,...i),r(n,...i)}:t:(n,...i)=>{t(`%s ${n}`,e,...i),r&&r(n,...i)}}function gj(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function Mw(t,e,r,n=mj()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?n.extend(e):e,o=gj(ri(e,Vt),s,n);return u(r);function l(c,f){return Re(a,Mw(t,o.replace(/^[^:]+/,c),f,n))}function u(c){let f=c&&`[${c}]`||"",d=s&&wP(s,f)||us,h=wP(n,`${i} ${f}`,d);return Object.assign(s?d:h,{label:t,sibling:l,info:h,step:u})}}var NR=V({"src/lib/git-logger.ts"(){"use strict";ue(),Yd.default.formatters.L=t=>String(Tw(t)?t.length:"-"),Yd.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):Vc(t)}}),BR,vj=V({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Sa(),NR(),BR=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let n=t.getName(r.commands[0]),i=Mw(this.logLabel,n);return{task:r,logger:i,name:n}}push(r){let n=this.createProgress(r);return n.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,n),n}fatal(r){for(let[n,{logger:i}]of Array.from(this._queue.entries()))n===r.task?(i.info("Failed %o",r),i("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):i.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(n);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let n=this.withProgress(r);if(!n)throw new br(void 0,"TasksPendingQueue: attempt called for an unknown task");return n.logger("Starting task"),n}static getName(r="empty"){return`task:${r}:${++t.counter}`}},t.counter=0,t)}});function os(t,e){return{method:JP(t.commands)||"",commands:e}}function wj(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}function yP(t,e,r,n){return i=>{r("%s received %L bytes",e,i),n("%B",i),t.push(i)}}var ww,yj=V({"src/lib/runners/git-executor-chain.ts"(){"use strict";Sa(),ut(),ue(),vj(),ww=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new BR}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:n}=this._queue.attempt(t);return await(xR(t)?this.attemptEmptyTask(t,n):this.attemptRemoteTask(t,n))}catch(n){throw this.onFatalException(t,n)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof br?Object.assign(e,{task:t}):new br(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",os(t,t.commands)),n=this._plugins.exec("spawn.args",[...t.commands],os(t,t.commands)),i=await this.gitResponse(t,r,n,this.outputHandler,e.step("SPAWN")),a=await this.handleTaskData(t,n,i,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),_R(t)?pw(t.parser,a):pw(t.parser,a.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,n){let{exitCode:i,rejection:a,stdOut:s,stdErr:o}=r;return new Promise((l,u)=>{n("Preparing to handle process response exitCode=%d stdOut=",i);let{error:c}=this._plugins.exec("task.error",{error:a},{...os(t,e),...r});if(c&&t.onError)return n.info("exitCode=%s handling with custom error handler"),t.onError(r,c,f=>{n.info("custom error handler treated as success"),n("custom error returned a %s",Vc(f)),l(new Wd(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},u);if(c)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,o.length,a),u(c);n.info("retrieving task output complete"),l(new Wd(Buffer.concat(s),Buffer.concat(o)))})}async gitResponse(t,e,r,n,i){let a=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},os(t,t.commands));return new Promise(o=>{let l=[],u=[];i.info("%s %o",e,r),i("%O",s);let c=this._beforeSpawn(t,r);if(c)return o({stdOut:l,stdErr:u,exitCode:9901,rejection:c});this._plugins.exec("spawn.before",void 0,{...os(t,r),kill(d){c=d||c}});let f=(0,HR.spawn)(e,r,s);f.stdout.on("data",yP(l,"stdOut",i,a.step("stdOut"))),f.stderr.on("data",yP(u,"stdErr",i,a.step("stdErr"))),f.on("error",wj(u,i)),n&&(i("Passing child process stdOut/stdErr to custom outputHandler"),n(e,f.stdout,f.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...os(t,r),spawned:f,close(d,h){o({stdOut:l,stdErr:u,exitCode:d,rejection:c||h})},kill(d){f.killed||(c=d,f.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...os(t,e),kill(n){r=n||r}}),r}}}}),UR={};ft(UR,{GitExecutor:()=>jR});var jR,bj=V({"src/lib/runners/git-executor.ts"(){"use strict";yj(),jR=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new ww(this,this._scheduler,this._plugins)}chain(){return new ww(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function _j(t,e,r=us){let n=a=>{r(null,a)},i=a=>{(a==null?void 0:a.task)===t&&r(a instanceof qc?xj(a):a,void 0)};e.then(n,i)}function xj(t){let e=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),e=us};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(n,i){return i in t||(n[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),n}}var Sj=V({"src/lib/task-callback.ts"(){"use strict";Vo(),ue()}});function bP(t,e){return yR(r=>{if(!Aw(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var Ej=V({"src/lib/tasks/change-working-directory.ts"(){"use strict";ue(),ut()}});function sw(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=Jd(e,"-B")),ir(e)}function kj(){return{checkout(){return this._runTask(sw(wr(arguments,1)),at(arguments))},checkoutBranch(t,e){return this._runTask(sw(["-b",t,e,...wr(arguments)]),at(arguments))},checkoutLocalBranch(t){return this._runTask(sw(["-b",t,...wr(arguments)]),at(arguments))}}}var Aj=V({"src/lib/tasks/checkout.ts"(){"use strict";ue(),ut()}});function Tj(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function Cj(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return _r(Tj(),[GR],t)}})}}}var GR,Pj=V({"src/lib/tasks/count-objects.ts"(){"use strict";ue(),GR=new he(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let n=tR(e);t.hasOwnProperty(n)&&(t[n]=Ue(r))})}});function Rj(t){return _r({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},qR,t)}var qR,Ij=V({"src/lib/parsers/parse-commit.ts"(){"use strict";ue(),qR=[new he(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,n])=>{t.branch=e,t.commit=n,t.root=!!r}),new he(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),n=r.pop();!n||!n.includes("@")||(t.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new he(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(n,10)||0}),new he(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(r,10)||0;n==="-"?t.summary.deletions=i:n==="+"&&(t.summary.insertions=i)})]}});function $j(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Uc(t,"-m"),...e,...r],format:"utf-8",parser:Rj}}function Fj(){return{commit(e,...r){let n=at(arguments),i=t(e)||$j(ti(e),ti(ri(r[0],Vd,[])),[...ri(r[1],Wc,[]),...wr(arguments,0,!0)]);return this._runTask(i,n)}};function t(e){return!Vd(e)&&yr("git.commit: requires the commit message to be supplied as a string/string[]")}}var Oj=V({"src/lib/tasks/commit.ts"(){"use strict";Ij(),ue(),ut()}});function Mj(){return{firstCommit(){return this._runTask(ir(["rev-list","--max-parents=0","HEAD"],!0),at(arguments))}}}var Dj=V({"src/lib/tasks/first-commit.ts"(){"use strict";ue(),ut()}});function Lj(t,e){let r=["hash-object",t];return e&&r.push("-w"),ir(r,!0)}var Nj=V({"src/lib/tasks/hash-object.ts"(){"use strict";ut()}});function Bj(t,e,r){let n=String(r).trim(),i;if(i=zR.exec(n))return new Gd(t,e,!1,i[1]);if(i=VR.exec(n))return new Gd(t,e,!0,i[1]);let a="",s=n.split(" ");for(;s.length;)if(s.shift()==="in"){a=s.join(" ");break}return new Gd(t,e,/^re/i.test(n),a)}var Gd,zR,VR,Hj=V({"src/lib/responses/InitSummary.ts"(){"use strict";Gd=class{constructor(t,e,r,n){this.bare=t,this.path=e,this.existing=r,this.gitDir=n}},zR=/^Init.+ repository in (.+)$/,VR=/^Rein.+ in (.+)$/}});function Uj(t){return t.includes(Dw)}function jj(t=!1,e,r){let n=["init",...r];return t&&!Uj(n)&&n.splice(1,0,Dw),{commands:n,format:"utf-8",parser(i){return Bj(n.includes("--bare"),e,i)}}}var Dw,Gj=V({"src/lib/tasks/init.ts"(){"use strict";Hj(),Dw="--bare"}});function Lw(t){for(let e=0;e_r(new WR,e,r,!1)}var ow,_P,xP,SP,XR,ZR=V({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Yc(),zj(),RR(),ue(),ow=[new he(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,n=""])=>{t.files.push({file:e.trim(),changes:Ue(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new he(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,n])=>{t.files.push({file:e.trim(),before:Ue(r),after:Ue(n),binary:!0})}),new he(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let n=/(\d+) i/.exec(r),i=/(\d+) d/.exec(r);t.changed=Ue(e),t.insertions=Ue(n==null?void 0:n[1]),t.deletions=Ue(i==null?void 0:i[1])})],_P=[new he(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,n])=>{let i=Ue(e),a=Ue(r);t.changed++,t.insertions+=i,t.deletions+=a,t.files.push({file:n,changes:i+a,insertions:i,deletions:a,binary:!1})}),new he(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],xP=[new he(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],SP=[new he(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,n,i,a])=>{t.changed++,t.files.push({file:a!=null?a:n,changes:0,insertions:0,deletions:0,binary:!1,status:fw(cj(e)&&e),from:fw(!!a&&n!==a&&n),similarity:Ue(r)})})],XR={"":ow,"--stat":ow,"--numstat":_P,"--name-status":SP,"--name-only":xP}}});function Vj(t,e){return e.reduce((r,n,i)=>(r[n]=t[i]||"",r),Object.create({diff:null}))}function KR(t=Uw,e=JR,r=""){let n=YR(r);return function(i){let a=zc(i.trim(),!1,Bw).map(function(s){let o=s.split(Hw),l=Vj(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=n(o[1])),l});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var Bw,Hw,Uw,JR,QR=V({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";ue(),ZR(),Yc(),Bw="\xF2\xF2\xF2\xF2\xF2\xF2 ",Hw=" \xF2\xF2",Uw=" \xF2 ",JR=["hash","date","message","refs","author_name","author_email"]}}),eI={};ft(eI,{diffSummaryTask:()=>Wj,validateLogFormatConfig:()=>nh});function Wj(t){let e=Lw(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),nh(r)||{commands:r,format:"utf-8",parser:YR(e)}}function nh(t){let e=t.filter(qj);if(e.length>1)return yr(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return yr(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var jw=V({"src/lib/tasks/diff.ts"(){"use strict";Yc(),ZR(),ut()}});function Yj(t,e){let r=[],n=[];return Object.keys(t).forEach(i=>{r.push(i),n.push(String(t[i]))}),[r,n.join(e)]}function Xj(t){return Object.keys(t).reduce((e,r)=>(r in yw||(e[r]=t[r]),e),{})}function tI(t={},e=[]){let r=ri(t.splitter,Vt,Uw),n=eh(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]=Yj(n,r),s=[],o=[`--pretty=format:${Bw}${a}${Hw}`,...e],l=t.n||t["max-count"]||t.maxCount;if(l&&o.push(`--max-count=${l}`),t.from||t.to){let u=t.symmetric!==!1?"...":"..";s.push(`${t.from||""}${u}${t.to||""}`)}return Vt(t.file)&&o.push("--follow",LU(t.file)),Cw(Xj(t),o),{fields:i,splitter:r,commands:[...o,...s]}}function Zj(t,e,r){let n=KR(t,e,Lw(r));return{commands:["log",...r],format:"utf-8",parser:n}}function Kj(){return{log(...r){let n=at(arguments),i=tI(Pw(arguments),ri(arguments[0],Wc)),a=e(...r)||nh(i.commands)||t(i);return this._runTask(a,n)}};function t(r){return Zj(r.splitter,r.fields,r.commands)}function e(r,n){return Vt(r)&&Vt(n)&&yr("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var yw,rI=V({"src/lib/tasks/log.ts"(){"use strict";Yc(),Gc(),QR(),ue(),ut(),jw(),yw=(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))(yw||{})}}),qd,nI,Jj=V({"src/lib/responses/MergeSummary.ts"(){"use strict";qd=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},nI=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"}}}}),bw,iI,Qj=V({"src/lib/responses/PullSummary.ts"(){"use strict";bw=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},iI=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function lw(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 EP(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Ue(e&&e[1]||"0"),delta:Ue(r&&r[1]||"0")}}var aI,eG=V({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";ue(),aI=[new xa(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let n=e.toLowerCase(),i=lw(t.remoteMessages);Object.assign(i,{[n]:Ue(r)})}),new xa(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let n=e.toLowerCase(),i=lw(t.remoteMessages);Object.assign(i,{[n]:Ue(r)})}),new xa(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,n])=>{let i=lw(t.remoteMessages);i.total=EP(e),i.reused=EP(r),i.packReused=Ue(n)})]}});function sI(t,e){return _r({remoteMessages:new lI},oI,e)}var oI,lI,cI=V({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";ue(),eG(),oI=[new xa(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...aI,new xa([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new xa([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,n])=>{t.remoteMessages.vulnerabilities={count:Ue(e),summary:r,url:n}})],lI=class{constructor(){this.all=[]}}}});function tG(t,e){let r=_r(new iI,uI,[t,e]);return r.message&&r}var kP,AP,TP,CP,uI,PP,Gw,fI=V({"src/lib/parsers/parse-pull.ts"(){"use strict";Qj(),ue(),cI(),kP=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,AP=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,TP=/^(create|delete) mode \d+ (.+)/,CP=[new he(kP,(t,[e,r,n])=>{t.files.push(e),r&&(t.insertions[e]=r.length),n&&(t.deletions[e]=n.length)}),new he(AP,(t,[e,,r,,n])=>r!==void 0||n!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+n||0,!0):!1),new he(TP,(t,[e,r])=>{Re(t.files,r),Re(e==="create"?t.created:t.deleted,r)})],uI=[new he(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new he(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new he(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,n,i])=>{t.branch.local=n,t.hash.local=e,t.branch.remote=i,t.hash.remote=r})],PP=(t,e)=>_r(new bw,CP,[t,e]),Gw=(t,e)=>Object.assign(new bw,PP(t,e),sI(t,e))}}),RP,dI,IP,rG=V({"src/lib/parsers/parse-merge.ts"(){"use strict";Jj(),ue(),fI(),RP=[new he(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new he(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new qd(e,r))}),new he(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,n])=>{t.conflicts.push(new qd(e,r,{deleteRef:n}))}),new he(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new qd(e,null))}),new he(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],dI=(t,e)=>Object.assign(IP(t,e),Gw(t,e)),IP=t=>_r(new nI,RP,t)}});function $P(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let n=dI(e,r);if(n.failed)throw new qc(n);return n}}:yr("Git.merge requires at least one option")}var nG=V({"src/lib/tasks/merge.ts"(){"use strict";Vo(),rG(),ut()}});function iG(t,e,r){let n=r.includes("deleted"),i=r.includes("tag")||/^refs\/tags/.test(t),a=!r.includes("new");return{deleted:n,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:t,remote:e}}var FP,hI,OP,aG=V({"src/lib/parsers/parse-push.ts"(){"use strict";ue(),cI(),FP=[new he(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new he(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new he(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,n])=>{t.pushed.push(iG(e,r,n))}),new he(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,n])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:n}}),new he(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,n,i])=>{t.update={head:{local:e,remote:r},hash:{from:n,to:i}}})],hI=(t,e)=>{let r=OP(t,e),n=sI(t,e);return{...r,...n}},OP=(t,e)=>_r({pushed:[]},FP,[t,e])}}),pI={};ft(pI,{pushTagsTask:()=>sG,pushTask:()=>qw});function sG(t={},e){return Re(e,"--tags"),qw(t,e)}function qw(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),Jd(r,"-v"),Re(r,"--verbose"),Re(r,"--porcelain"),{commands:r,format:"utf-8",parser:hI}}var mI=V({"src/lib/tasks/push.ts"(){"use strict";aG(),ue()}});function oG(){return{showBuffer(){let t=["show",...wr(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(bR(t),at(arguments))},show(){let t=["show",...wr(arguments,1)];return this._runTask(ir(t),at(arguments))}}}var lG=V({"src/lib/tasks/show.ts"(){"use strict";ue(),ut()}}),MP,gI,cG=V({"src/lib/responses/FileStatusSummary.ts"(){"use strict";MP=/^(.+)\0(.+)$/,gI=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let n=MP.exec(t)||[null,t,t];this.from=n[2]||"",this.path=n[1]||""}}}}});function DP(t){let[e,r]=t.split(zo);return{from:r||e,to:e}}function Mr(t,e,r){return[`${t}${e}`,r]}function cw(t,...e){return e.map(r=>Mr(t,r,(n,i)=>Re(n.conflicted,i)))}function uG(t,e){let r=e.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.substr(3));case r.charAt(1):return n(" ",r.charAt(0),r.substr(2));default:return}function n(i,a,s){let o=`${i}${a}`,l=vI.get(o);l&&l(t,s),o!=="##"&&o!=="!!"&&t.files.push(new gI(s,i,a))}}var LP,vI,wI,fG=V({"src/lib/responses/StatusSummary.ts"(){"use strict";ue(),cG(),LP=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}},vI=new Map([Mr(" ","A",(t,e)=>Re(t.created,e)),Mr(" ","D",(t,e)=>Re(t.deleted,e)),Mr(" ","M",(t,e)=>Re(t.modified,e)),Mr("A"," ",(t,e)=>Re(t.created,e)&&Re(t.staged,e)),Mr("A","M",(t,e)=>Re(t.created,e)&&Re(t.staged,e)&&Re(t.modified,e)),Mr("D"," ",(t,e)=>Re(t.deleted,e)&&Re(t.staged,e)),Mr("M"," ",(t,e)=>Re(t.modified,e)&&Re(t.staged,e)),Mr("M","M",(t,e)=>Re(t.modified,e)&&Re(t.staged,e)),Mr("R"," ",(t,e)=>{Re(t.renamed,DP(e))}),Mr("R","M",(t,e)=>{let r=DP(e);Re(t.renamed,r),Re(t.modified,r.to)}),Mr("!","!",(t,e)=>{Re(t.ignored=t.ignored||[],e)}),Mr("?","?",(t,e)=>Re(t.not_added,e)),...cw("A","A","U"),...cw("D","D","U"),...cw("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,s=/\son\s([\S]+)$/,o;o=r.exec(e),t.ahead=o&&+o[1]||0,o=n.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)}]]),wI=function(t){let e=t.split(zo),r=new LP;for(let n=0,i=e.length;n!yI.includes(r))],parser(r){return wI(r)}}}var yI,hG=V({"src/lib/tasks/status.ts"(){"use strict";fG(),yI=["--null","-z"]}});function Xd(t=0,e=0,r=0,n="",i=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:n,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function pG(){return Xd(0,0,0,"",!1)}function mG(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:gG,onError(t,e,r,n){if(t.exitCode===-2)return r(Buffer.from(zw));n(e)}})}}}function gG(t){return t===zw?pG():_r(Xd(0,0,0,t),bI,t)}var zw,bI,vG=V({"src/lib/tasks/version.ts"(){"use strict";ue(),zw="installed=false",bI=[new he(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,n,i=""])=>{Object.assign(t,Xd(Ue(e),Ue(r),Ue(n),i))}),new he(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,n,i=""])=>{Object.assign(t,Xd(Ue(e),Ue(r),n,i))})]}}),_I={};ft(_I,{SimpleGitApi:()=>_w});var _w,wG=V({"src/lib/simple-git-api.ts"(){"use strict";Sj(),Ej(),Aj(),Pj(),Oj(),CR(),Dj(),FR(),Nj(),Gj(),rI(),nG(),mI(),lG(),hG(),ut(),vG(),ue(),_w=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),n=r.push(t);return e&&_j(t,n,e),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(t){return this._runTask(ir(["add",...ti(t)]),at(arguments))}cwd(t){let e=at(arguments);return typeof t=="string"?this._runTask(bP(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(bP(t.path,t.root&&this._executor||void 0),e):this._runTask(yr("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Lj(t,e===!0),at(arguments))}init(t){return this._runTask(jj(t===!0,this._executor.cwd,wr(arguments)),at(arguments))}merge(){return this._runTask($P(wr(arguments)),at(arguments))}mergeFromTo(t,e){return Vt(t)&&Vt(e)?this._runTask($P([t,e,...wr(arguments)]),at(arguments,!1)):this._runTask(yr("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=qw({remote:ri(arguments[0],Vt),branch:ri(arguments[1],Vt)},wr(arguments));return this._runTask(t,at(arguments))}stash(){return this._runTask(ir(["stash",...wr(arguments)]),at(arguments))}status(){return this._runTask(dG(wr(arguments)),at(arguments))}},Object.assign(_w.prototype,kj(),Fj(),lj(),Cj(),Mj(),dj(),Kj(),oG(),mG())}}),xI={};ft(xI,{Scheduler:()=>EI});var NP,EI,yG=V({"src/lib/runners/scheduler.ts"(){"use strict";ue(),NR(),NP=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,SI.createDeferred)();return{promise:e,done:r,id:t}}})(),EI=class{constructor(t=2){this.concurrency=t,this.logger=Mw("","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=Re(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),Jd(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=Re(this.pending,NP());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),kI={};ft(kI,{applyPatchTask:()=>bG});function bG(t,e){return ir(["apply",...e,...t])}var _G=V({"src/lib/tasks/apply-patch.ts"(){"use strict";ut()}});function xG(t,e){return{branch:t,hash:e,success:!0}}function SG(t){return{branch:t,hash:null,success:!1}}var AI,EG=V({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";AI=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function TI(t,e){return e===1&&xw.test(t)}var BP,xw,HP,ih,kG=V({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";EG(),ue(),BP=/(\S+)\s+\(\S+\s([^)]+)\)/,xw=/^error[^']+'([^']+)'/m,HP=[new he(BP,(t,[e,r])=>{let n=xG(e,r);t.all.push(n),t.branches[e]=n}),new he(xw,(t,[e])=>{let r=SG(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],ih=(t,e)=>_r(new AI,HP,[t,e])}}),CI,AG=V({"src/lib/responses/BranchSummary.ts"(){"use strict";CI=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,n,i){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:n,label:i}}}}});function UP(t){return t?t.charAt(0):""}function PI(t){return _r(new CI,RI,t)}var RI,TG=V({"src/lib/parsers/parse-branch.ts"(){"use strict";AG(),ue(),RI=[new he(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,n,i])=>{t.push(UP(e),!0,r,n,i)}),new he(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,n,i])=>{t.push(UP(e),!1,r,n,i)})]}}),II={};ft(II,{branchLocalTask:()=>PG,branchTask:()=>CG,containsDeleteBranchCommand:()=>$I,deleteBranchTask:()=>IG,deleteBranchesTask:()=>RG});function $I(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function CG(t){let e=$I(t),r=["branch",...t];return r.length===1&&r.push("-a"),r.includes("-v")||r.splice(1,0,"-v"),{format:"utf-8",commands:r,parser(n,i){return e?ih(n,i).all[0]:PI(n)}}}function PG(){return{format:"utf-8",commands:["branch","-v"],parser:PI}}function RG(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,n){return ih(r,n)},onError({exitCode:r,stdOut:n},i,a,s){if(!TI(String(i),r))return s(i);a(n)}}}function IG(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(n,i){return ih(n,i).branches[t]},onError({exitCode:n,stdErr:i,stdOut:a},s,o,l){if(!TI(String(s),n))return l(s);throw new qc(r.parser(jc(a),jc(i)),String(s))}};return r}var $G=V({"src/lib/tasks/branch.ts"(){"use strict";Vo(),kG(),TG(),ue()}}),FI,FG=V({"src/lib/responses/CheckIgnore.ts"(){"use strict";FI=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),OI={};ft(OI,{checkIgnoreTask:()=>OG});function OG(t){return{commands:["check-ignore",...t],format:"utf-8",parser:FI}}var MG=V({"src/lib/tasks/check-ignore.ts"(){"use strict";FG()}}),MI={};ft(MI,{cloneMirrorTask:()=>LG,cloneTask:()=>DI});function DG(t){return/^--upload-pack(=|$)/.test(t)}function DI(t,e,r){let n=["clone",...r];return Vt(t)&&n.push(t),Vt(e)&&n.push(e),n.find(DG)?yr("git.fetch: potential exploit argument blocked."):ir(n)}function LG(t,e,r){return Re(r,"--mirror"),DI(t,e,r)}var NG=V({"src/lib/tasks/clone.ts"(){"use strict";ut(),ue()}});function BG(t,e){return _r({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},LI,[t,e])}var LI,HG=V({"src/lib/parsers/parse-fetch.ts"(){"use strict";ue(),LI=[new he(/From (.+)$/,(t,[e])=>{t.remote=e}),new he(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new he(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new he(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new he(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,n,i])=>{t.updated.push({name:n,tracking:i,to:r,from:e})})]}}),NI={};ft(NI,{fetchTask:()=>jG});function UG(t){return/^--upload-pack(=|$)/.test(t)}function jG(t,e,r){let n=["fetch",...r];return t&&e&&n.push(t,e),n.find(UG)?yr("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:BG}}var GG=V({"src/lib/tasks/fetch.ts"(){"use strict";HG(),ut()}});function qG(t){return _r({moves:[]},BI,t)}var BI,zG=V({"src/lib/parsers/parse-move.ts"(){"use strict";ue(),BI=[new he(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),HI={};ft(HI,{moveTask:()=>VG});function VG(t,e){return{commands:["mv","-v",...ti(t),e],format:"utf-8",parser:qG}}var WG=V({"src/lib/tasks/move.ts"(){"use strict";zG(),ue()}}),UI={};ft(UI,{pullTask:()=>YG});function YG(t,e,r){let n=["pull",...r];return t&&e&&n.splice(1,0,t,e),{commands:n,format:"utf-8",parser(i,a){return Gw(i,a)},onError(i,a,s,o){let l=tG(jc(i.stdOut),jc(i.stdErr));if(l)return o(new qc(l));o(a)}}}var XG=V({"src/lib/tasks/pull.ts"(){"use strict";Vo(),fI(),ue()}});function ZG(t){let e={};return jI(t,([r])=>e[r]={name:r}),Object.values(e)}function KG(t){let e={};return jI(t,([r,n,i])=>{e.hasOwnProperty(r)||(e[r]={name:r,refs:{fetch:"",push:""}}),i&&n&&(e[r].refs[i.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}function jI(t,e){kw(t,r=>e(r.split(/\s+/)))}var JG=V({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";ue()}}),GI={};ft(GI,{addRemoteTask:()=>QG,getRemotesTask:()=>eq,listRemotesTask:()=>tq,remoteTask:()=>rq,removeRemoteTask:()=>nq});function QG(t,e,r){return ir(["remote","add",...r,t,e])}function eq(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?KG:ZG}}function tq(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),ir(e)}function rq(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),ir(e)}function nq(t){return ir(["remote","remove",t])}var iq=V({"src/lib/tasks/remote.ts"(){"use strict";JG(),ut()}}),qI={};ft(qI,{stashListTask:()=>aq});function aq(t={},e){let r=tI(t),n=["stash","list",...r.commands,...e],i=KR(r.splitter,r.fields,Lw(n));return nh(n)||{commands:n,format:"utf-8",parser:i}}var sq=V({"src/lib/tasks/stash-list.ts"(){"use strict";Yc(),QR(),jw(),rI()}}),zI={};ft(zI,{addSubModuleTask:()=>oq,initSubModuleTask:()=>lq,subModuleTask:()=>ah,updateSubModuleTask:()=>cq});function oq(t,e){return ah(["add",t,e])}function lq(t){return ah(["init",...t])}function ah(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),ir(e)}function cq(t){return ah(["update",...t])}var uq=V({"src/lib/tasks/sub-module.ts"(){"use strict";ut()}});function fq(t,e){let r=isNaN(t),n=isNaN(e);return r!==n?r?1:-1:r?VI(t,e):0}function VI(t,e){return t===e?0:t>e?1:-1}function dq(t){return t.trim()}function Ud(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var jP,WI,hq=V({"src/lib/responses/TagList.ts"(){"use strict";jP=class{constructor(t,e){this.all=t,this.latest=e}},WI=function(t,e=!1){let r=t.split(` +`).map(dq).filter(Boolean);e||r.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return fq(Ud(s[0]),Ud(o[0]));for(let l=0,u=Math.max(s.length,o.length);li.indexOf(".")>=0);return new jP(r,n)}}}),YI={};ft(YI,{addAnnotatedTagTask:()=>gq,addTagTask:()=>mq,tagListTask:()=>pq});function pq(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return WI(r,e)}}}function mq(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function gq(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var vq=V({"src/lib/tasks/tag.ts"(){"use strict";hq()}}),wq=MU({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(bj(),it(UR)),{SimpleGitApi:n}=(wG(),it(_I)),{Scheduler:i}=(yG(),it(xI)),{configurationErrorTask:a}=(ut(),it(gw)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:u,filterStringOrStringArray:c,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:m}=(ue(),it(uR)),{applyPatchTask:g}=(_G(),it(kI)),{branchTask:v,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:E}=($G(),it(II)),{checkIgnoreTask:x}=(MG(),it(OI)),{checkIsRepoTask:k}=(pR(),it(fR)),{cloneTask:A,cloneMirrorTask:y}=(NG(),it(MI)),{cleanWithOptionsTask:S,isCleanOptionsArray:_}=(kR(),it(SR)),{diffSummaryTask:T}=(jw(),it(eI)),{fetchTask:P}=(GG(),it(NI)),{moveTask:F}=(WG(),it(HI)),{pullTask:D}=(XG(),it(UI)),{pushTagsTask:M}=(mI(),it(pI)),{addRemoteTask:re,getRemotesTask:ye,listRemotesTask:me,remoteTask:fe,removeRemoteTask:Ge}=(iq(),it(GI)),{getResetMode:oe,resetTask:B}=(LR(),it(OR)),{stashListTask:Z}=(sq(),it(qI)),{addSubModuleTask:H,initSubModuleTask:Oe,subModuleTask:cr,updateSubModuleTask:Gt}=(uq(),it(zI)),{addAnnotatedTagTask:Y,addTagTask:Ie,tagListTask:Me}=(vq(),it(YI)),{straightThroughBufferTask:It,straightThroughStringTask:De}=(ut(),it(gw));function G(N,X){this._plugins=X,this._executor=new r(N.baseDir,new i(N.maxConcurrentProcesses),X),this._trimmed=N.trimmed}(G.prototype=Object.create(n.prototype)).constructor=G,G.prototype.customBinary=function(N){return this._plugins.reconfigure("binary",N),this},G.prototype.env=function(N,X){return arguments.length===1&&typeof N=="object"?this._executor.env=N:(this._executor.env=this._executor.env||{})[N]=X,this},G.prototype.stashList=function(N){return this._runTask(Z(m(arguments)||{},o(N)&&N||[]),h(arguments))};function Je(N,X,Ee,We){return typeof Ee!="string"?a(`git.${N}() requires a string 'repoPath'`):X(Ee,f(We,u),d(arguments))}G.prototype.clone=function(){return this._runTask(Je("clone",A,...arguments),h(arguments))},G.prototype.mirror=function(){return this._runTask(Je("mirror",y,...arguments),h(arguments))},G.prototype.mv=function(N,X){return this._runTask(F(N,X),h(arguments))},G.prototype.checkoutLatestTag=function(N){var X=this;return this.pull(function(){X.tags(function(Ee,We){X.checkout(We.latest,N)})})},G.prototype.pull=function(N,X,Ee,We){return this._runTask(D(f(N,u),f(X,u),d(arguments)),h(arguments))},G.prototype.fetch=function(N,X){return this._runTask(P(f(N,u),f(X,u),d(arguments)),h(arguments))},G.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},G.prototype.tags=function(N,X){return this._runTask(Me(d(arguments)),h(arguments))},G.prototype.rebase=function(){return this._runTask(De(["rebase",...d(arguments)]),h(arguments))},G.prototype.reset=function(N){return this._runTask(B(oe(N),d(arguments)),h(arguments))},G.prototype.revert=function(N){let X=h(arguments);return typeof N!="string"?this._runTask(a("Commit must be a string"),X):this._runTask(De(["revert",...d(arguments,0,!0),N]),X)},G.prototype.addTag=function(N){let X=typeof N=="string"?Ie(N):a("Git.addTag requires a tag name");return this._runTask(X,h(arguments))},G.prototype.addAnnotatedTag=function(N,X){return this._runTask(Y(N,X),h(arguments))},G.prototype.deleteLocalBranch=function(N,X,Ee){return this._runTask(E(N,typeof X=="boolean"?X:!1),h(arguments))},G.prototype.deleteLocalBranches=function(N,X,Ee){return this._runTask(b(N,typeof X=="boolean"?X:!1),h(arguments))},G.prototype.branch=function(N,X){return this._runTask(v(d(arguments)),h(arguments))},G.prototype.branchLocal=function(N){return this._runTask(w(),h(arguments))},G.prototype.raw=function(N){let X=!Array.isArray(N),Ee=[].slice.call(X?arguments:N,0);for(let $t=0;$tt.removeEventListener("abort",a))}}]:void 0}function _q(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function xq(t,e){if(_q(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new Ii(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function Sq(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new Ii(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 Ii(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 Ii(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function Eq({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((i,a)=>{let s=auw(i))).then(s.done)}return{type:"spawn.after",async action(i,{spawned:a,close:s}){var c,f;let o=r(),l=!0,u=()=>void(l=!1);(c=a.stdout)==null||c.on("data",u),(f=a.stderr)==null||f.on("data",u),a.on("error",u),a.on("close",d=>o.close(d)),a.on("exit",d=>o.exit(d));try{await o.result,l&&await uw(50),s(o.exitCode)}catch(d){s(o.exitCode,d)}}}}ue();var Tq="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",qP="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function Cq(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(t)}function zP(t,e){if(t.length<1||t.length>2)throw new Ii(void 0,"binary",Tq);if(t.some(Cq))if(e)console.warn(qP);else throw new Ii(void 0,"binary",qP);let[n,i]=t;return{binary:n,prefix:i}}function Pq(t,e=["git"],r=!1){let n=zP(ti(e),r);t.on("binary",i=>{n=zP(ti(i),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",i=>n.prefix?[n.prefix,...i]:i)}Sa();function Rq(t){return!!(t.exitCode&&t.stdErr.length)}function Iq(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function $q(t=!1,e=Rq,r=Iq){return(n,i)=>!t&&n||!e(i)?n:r(i)}function VP(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new br(void 0,n.toString("utf-8"))}:{error:n}}}}ue();var Fq=class{constructor(){this.plugins=new Set,this.events=new XI.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=Re(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return ti(t).forEach(r=>r&&this.plugins.add(Re(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,i=Object.freeze(Object.create(r));for(let a of this.plugins)a.type===t&&(n=a.action(n,i));return n}};ue();function Oq(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,s){return r.includes(s.method)?eR(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 u=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));u&&t({method:s.method,stage:Mq(u[1]),progress:Ue(u[2]),processed:Ue(u[3]),total:Ue(u[4])})}))}}]}function Mq(t){return String(t.toLowerCase().split(" ",1))||"unknown"}ue();function Dq(t){let e=nR(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function Lq({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,i){var u,c;let a;function s(){a&&clearTimeout(a),a=setTimeout(l,t)}function o(){var f,d;(f=i.spawned.stdout)==null||f.off("data",s),(d=i.spawned.stderr)==null||d.off("data",s),i.spawned.off("exit",o),i.spawned.off("close",o),a&&clearTimeout(a)}function l(){o(),i.kill(new Ii(void 0,"timeout","block timeout reached"))}r&&((u=i.spawned.stdout)==null||u.on("data",s)),e&&((c=i.spawned.stderr)==null||c.on("data",s)),i.spawned.on("exit",o),i.spawned.on("close",o),s()}}}Gc();function Nq(){return{type:"spawn.args",action(t){let e=[],r;function n(i){(r=r||[]).push(...i)}for(let i=0;izd(s)&&gP(s)||s));break}e.push(a)}return r?[...e,"--",...r.map(String)]:e}}}ue();var Bq=wq();function Hq(t,e){var i;let r=new Fq,n=lR(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Aw(n.baseDir))throw new yq(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(kq(n.config)),r.add(Eq(n.unsafe)),r.add(Nq()),r.add(Aq(n.completion)),n.abort&&r.add(bq(n.abort)),n.progress&&r.add(Oq(n.progress)),n.timeout&&r.add(Lq(n.timeout)),n.spawnOptions&&r.add(Dq(n.spawnOptions)),r.add(VP($q(!0))),n.errors&&r.add(VP(n.errors)),Pq(r,n.binary,(i=n.unsafe)==null?void 0:i.allowUnsafeCustomBinary),new Bq(n,r)}Vo();var ZI=Hq;var _e=class extends Bo{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var n;if(await this.isGitInstalled()){let i=this.app.vault.adapter,a=i.getBasePath(),s=a;this.plugin.settings.basePath&&(await i.exists((0,$i.normalizePath)(this.plugin.settings.basePath))?s=He.join(a,this.plugin.settings.basePath):r||new $i.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=s,this.git=ZI({baseDir:s,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?ad:void 0),config:["core.quotepath=off"],unsafe:{allowUnsafeCustomBinary:!0}});let o=this.plugin.localStorage.getPATHPaths(),l=this.plugin.localStorage.getEnvVars(),u=this.plugin.settings.gitDir;if(o.length>0){let v=o.join(":")+":"+process.env.PATH;process.env.PATH=v}u&&(process.env.GIT_DIR=u);for(let v of l){let[w,b]=v.split("=");process.env[w]=b}let c="simple-git",f=",",h=((n=localStorage.debug)!=null?n:"").split(f);if(!h.includes(c)&&!h.includes(`-${c}`)&&(h.push(c),QI.default.enable(h.join(f))),await this.git.checkIsRepo()){let v=await this.git.revparse("--show-cdup"),w=(0,Xc.resolve)(s+Xc.sep+v);this.absoluteRepoPath=w,await this.git.cwd(w)}let m=He.join(a,this.app.vault.configDir,"plugins","obsidian-git"),g=He.join(m,rs);process.env.SSH_ASKPASS==null&&(process.env.SSH_ASKPASS=g),process.env.OBSIDIAN_GIT_CREDENTIALS_INPUT=He.join(m,sd),process.env.SSH_ASKPASS==g&&this.askpass().catch(v=>this.plugin.displayError(v))}}getRelativeVaultPath(r){let i=this.app.vault.adapter.getBasePath(),a=He.join(this.absoluteRepoPath,r),s=He.relative(i,a);return $i.Platform.isWin&&(s=s.replace(/\\/g,"/")),s}getRelativeRepoPath(r,n=!0){if(n){let a=this.plugin.app.vault.adapter.getBasePath(),s=this.absoluteRepoPath,o=He.join(a,r),l=He.relative(s,o);return $i.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}get absPluginConfigPath(){let n=this.app.vault.adapter.getBasePath();return He.join(n,this.app.vault.configDir,"plugins","obsidian-git")}get relPluginConfigPath(){return He.join(this.app.vault.configDir,"plugins","obsidian-git")}async askpass(){let r=this.app.vault.adapter,n=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await Dr.writeFile(He.join(this.absPluginConfigPath,rs),iA),await Dr.chmod(He.join(this.absPluginConfigPath,rs),493),this.watchAbortController=new AbortController;let{signal:i}=this.watchAbortController;try{let a=Dr.watch(this.absPluginConfigPath,{signal:i});for await(let s of a){if(s.filename!=sd)continue;let o=n+sd;if(!await r.exists(o))continue;let l=await r.read(o),u;l.length>60&&(u=new $i.Notice(l,999999));let c=await new ze(this.plugin,{allowEmpty:!0,obscure:!0,placeholder:l.length>60?"Enter a response to the message.":l}).openAndGetResult();u==null||u.hide(),await r.exists(o)&&await r.write(`${o}.response`,c!=null?c:"")}}catch(a){this.plugin.displayError(a),await Dr.rm(He.join(this.absPluginConfigPath,rs),{force:!0}),await Dr.rm(He.join(this.absPluginConfigPath,`${rs}.response`),{force:!0}),await new Promise(s=>setTimeout(s,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),n=He.join(this.app.vault.configDir,"plugins","obsidian-git",rs),i=this.getRelativeRepoPath(n,!0);(await Dr.readFile(r,"utf-8")).split(` +`).some(l=>l.contains(i))||await Dr.appendFile(r,i+` +`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=await this.git.status(n!=null?["--",n]:[]);this.plugin.setPluginState({gitAction:0});let a=i.files.map(s=>{let o=this.formatPath(s);return{path:o.path,from:o.from,index:s.index==="?"?"U":s.index,workingDir:s.working_dir==="?"?"U":s.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:a,changed:a.filter(s=>s.workingDir!==" "),staged:a.filter(s=>s.index!==" "&&s.index!="U"),conflicted:i.conflicted.map(s=>this.formatPath({path:s}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let n=this.getRelativeRepoPath(r),a=["-C",He.dirname(n),"rev-parse","HEAD"],s=this.git.raw(a);return s.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await s).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((n,i,a,s)=>{if(!(s.contains("submodule")&&s.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");i.on("data",u=>{o+=u.toString("utf8")}),i.on("end",()=>{let c=o.split(` +`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Xc.sep}).filter(f=>!!f);c.reverse(),r(c)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(r){function n(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return r.from!=null?{from:n(r.from),path:n(r.path)}:{path:n(r.path)}}async blame(r,n,i){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let a=await this.getSubmoduleOfFile(r),s=a?["-C",a.submodule]:[],o=a?a.relativeFilepath:r;s.push("blame","--porcelain"),i&&s.push("-w");let l=`-C${id}`;switch(n){case"inactive":break;case"same-commit":s.push("-C",l);break;case"all-commits":s.push("-C","-C",l);break;default:ba(n)}s.push("--",o);let u=await this.git.raw(s);return Uq(u)}async isTracked(r){let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("ls-files","--",a),this.git.raw(i).then(s=>s.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let i=await this.getSubmodulePaths();for(let a of i)await this.git.cwd({path:a,root:!1}).add("-A"),await this.git.cwd({path:a,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let n=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),n.summary.changes}async commit({message:r,amend:n}){this.plugin.setPluginState({gitAction:4});let i=(await this.git.commit(await this.formatCommitMessage(r),n?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),i}async stage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)&&await this.git.checkout(["--",r]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let n=He.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(n,r),await this.git.applyPatch(n,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(n)}async getUntrackedPaths(r){let n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=[];n!=null&&i.push("--",n);let a=await this.git.clean(ls.RECURSIVE+ls.DRY_RUN,i);return this.plugin.setPluginState({gitAction:0}),a.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("hash-object","--",a),this.git.raw(i)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),n=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let i=await this.git.revparse([r.tracking]);if(n!==i){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,i]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let a=await this.git.revparse([r.current]);return(await this.git.diff([`${n}..${a}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let s=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(s)}let r=await this.git.status(),n=r.tracking,i=r.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 a=(await this.git.diffSummary([i,n,"--"])).changed;return await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(),a}catch(r){this.convertErrors(r)}}async getUnpushedCommits(){let r=await this.git.status(),n=r.tracking,i=r.current;if(n==null||i==null)return 0;let[a,s]=Ri(n);return(await this.getRemoteBranches(a)).includes(n)?(await this.git.diffSummary([i,n,"--"])).changed:(this.plugin.log(`Tracking branch ${n} does not exist on remote ${a}.`),0)}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let r=await this.git.status(),n=r.tracking,i=r.current;return n?(await this.git.diffSummary([i,n,"--"])).changed!==0:!1}async checkRequirements(){return await this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let r=await this.git.status(),n=await this.git.branch(["--no-color"]);return{current:r.current||void 0,tracking:r.tracking||void 0,branches:n.all}}async getRemoteUrl(r){try{return await this.git.remote(["get-url",r])||void 0}catch(n){if(String(n).contains(r))return;throw n}}async log(r,n=!0,i,a){let s;r&&(s=this.getRelativeRepoPath(r,n));let o={file:s,maxCount:i,"--diff-merges":"first-parent","--name-status":null};return a&&(o[a]=null),(await this.git.log(o)).all.map(u=>{var c,f,d,h;return{...u,author:{name:u.author_name,email:u.author_email},refs:u.refs.split(", ").filter(m=>m.length>0),diff:{...u.diff,files:(f=(c=u.diff)==null?void 0:c.files.map(m=>({...m,status:m.status,path:m.file,hash:u.hash,vaultPath:this.getRelativeVaultPath(m.file),fromPath:m.from,fromVaultPath:m.from!=null?this.getRelativeVaultPath(m.from):void 0,binary:m.binary})))!=null?f:[]},fileName:(h=(d=u.diff)==null?void 0:d.files.first())==null?void 0:h.file}})}async show(r,n,i=!0){let a=this.getRelativeRepoPath(n,i);return this.git.show([r+":"+a])}async checkout(r,n){if(n&&(r=`${n}/${r}`),await this.git.checkout(r),this.plugin.settings.submoduleRecurseCheckout){let i=await this.getSubmodulePaths();for(let a of i){let s=await this.git.cwd({path:a,root:!1}).branch();Object.keys(s.branches).includes(r)&&await this.git.cwd({path:a,root:!1}).checkout(r)}}}async createBranch(r){await this.git.checkout(["-b",r])}async deleteBranch(r,n){await this.git.branch([n?"-D":"-d",r])}async branchIsMerged(r){return!(await this.git.branch(["--no-merged"])).all.contains(r)}async init(){await this.git.init(!1)}async clone(r,n,i){await this.git.clone(r,He.join(this.app.vault.adapter.getBasePath(),n),i?["--depth",`${i}`]:[])}async setConfig(r,n){n==null?await this.git.raw(["config","--local","--unset",r]):await this.git.addConfig(r,n)}async getConfig(r){let i=(await this.git.listConfig("local")).all[r];if(typeof i=="string"||i==null)return i;throw new Error("Config value is not a string")}async fetch(r){await this.git.fetch(r!=null?[r]:[])}async setRemote(r,n){(await this.getRemotes()).includes(r)?await this.git.remote(["set-url",r,n]):await this.git.remote(["add",r,n])}async getRemoteBranches(r){let n=await this.git.branch(["-r","--list",`${r}*`]),i=[];for(let a in n.branches)i.push(n.branches[a].name);return i}async getRemotes(){let r=await this.git.remote([]);return r?r.trim().split(` +`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(n){try{await this.git.branch(["--set-upstream",r])}catch(i){let[a,s]=Ri(r),o=await this.branchInfo();await this.git.push(["--set-upstream",a,`${o.current}:${s}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,n=!1,i){return n?await this.git.diff(["--cached","--",r]):i?await this.git.show([`${i}`,"--",r]):await this.git.diff(["--",r])}async diff(r,n,i){return await this.git.diff([`${n}..${i}`,"--",r])}async rawCommand(r){let n=r.split(" ");return await this.git.raw(n[0],...n.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(He.dirname(r)))return;let n=await this.git.raw(["-C",He.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",He.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let s=this.app.vault.adapter.getFullPath(He.normalize(r)),o=He.relative(n,s);return{submodule:n,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof br){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),n=await Bc(r||"git",["--version"],{});if(n.error)if($i.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${ad}) of Git for Windows.`);let i=await Bc(ad,["--version"]);if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof br){let n=String(r.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.contains("Unable to open connection")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Io(n)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(n){let i=n instanceof Error?n.message:String(n);return this.plugin.displayError(`Error checking LFS status: ${i}`),!1}}},e$={hash:"000000",isZeroCommit:!0,summary:""};function Uq(t){let r=t.replace(`\r +`,` +`).split(` +`),n={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return n}function Gq(t,e,r){let n=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[r],s=e.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(n){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=JI(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=JI(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 qq(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Vw(t.author)&&(t.author=void 0),Vw(t.committer)&&(t.committer=void 0),Vw(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Vw(t){return!t||Object.keys(t).length===0}function KI(t){return t.length>0&&t[0].trim()===t[0]}function JI(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}p();var k$=require("@codemirror/state");p();var Ww=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},Fi=new Ww;p();var oh=require("@codemirror/state"),t$=bt(Yw());function r$(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var n$=oh.StateEffect.define();function i$(t,e,r){return r.update({effects:n$.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Wo=oh.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(n$))return r.value;return zq(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function lh(t){var a;let e=t$.sha256.create();if(!t)return e;let{la:r,key:n,lineOffsetsFromUnsavedChanges:i}=t;e.update(r==="untracked"?"t":"f"),e.update(n);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var tn={get:void 0,save:void 0};function a$(t,e){tn.get=t,tn.save=e}function ch(t){var e,r;return(r=(e=sh(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:sh(Xe.lineAuthor.coloringMaxAge).asDays()}function zq(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,n,i,a)=>{var m;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(r).number,u=s.lineAt(n).number,c=o.lineAt(i).number,f=o.lineAt(a).number,d=u-l+1,h=f-c+1;for(let g=c;g<=f;g++){let v=(m=e.lineOffsetsFromUnsavedChanges.get(g))!=null?m:0,w=f===g,b=h-d;w&&(v+=b),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}p();function s$(){Yo=void 0,Xw=[],uh=0,dh.clear(),hh.clear(),Xo.clear()}var Yo,fh=()=>Yo;function o$(t,e){var i;let r=e.length;if(r<((i=Yo==null?void 0:Yo.length)!=null?i:0))return;Yo={gutter:t,length:r,text:e};let n=tn.get();r!==n.gutterSpacingFallbackLength&&(n.gutterSpacingFallbackLength=r,tn.save(n))}var Xw=[],Vq=15,uh=0;function l$(t){Xw[uh]=t,uh=(uh+1)%Vq}function c$(){return K2(Xw)}var dh=new Map,hh=new Map,Xo=new Set;p();var x$=require("@codemirror/state"),S$=require("@codemirror/view");p();var Qw=require("@codemirror/view"),w$=bt(Yw()),vh=require("obsidian");p();p();var ph={x:-10,y:-10};function u$(){ph.x===-10&&window.addEventListener("mousedown",t=>{ph.x=t.clientX,ph.y=t.clientY})}function f$(){for(let t of Xo)if(Wq(t,ph))return t}function Wq(t,e){let{x:r,y:n,width:i,height:a}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+i&&n<=e.y&&e.y<=n+a}var d$="data-commit";function h$(t,e,r){if(e.hasFocus())return;let n=f$();if(!n)return;let i=Xq(n);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&Yq(i,t),Zw("showCommitHash",t),Zw("authorDisplay",t),Zw("dateTimeFormatOptions",t))}function Yq(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(n=>navigator.clipboard.writeText(t.hash)))}function Zw(t,e){var l,u;let r,n,i=Zn.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=Xe.lineAuthor[t];if(t==="showCommitHash")r="Show commit hash",n=a;else if(t==="authorDisplay"){let c=(l=i.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(s?a:c),n=s?"hide":c}else if(t==="dateTimeFormatOptions"){let c=(u=i.lastShownDateTimeFormatOptions)!=null?u:o;r="Show "+(s?a:c),r+=r.contains("date")?"":" date",n=s?"hide":c}else ba(t);e.addItem(c=>c.setTitle(r).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var d,h;return(h=(d=Zn.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,n)}))}function p$(t,e,r){r.setAttr(d$,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function Xq(t){let e=t.getAttr(d$);return e?JSON.parse(e):void 0}p();function gh(t,e){return t==="oldest"?mh(0,!1,e).color:mh(void 0,!0,e).color}function mh(t,e,r){let n=ch(r),i=Date.now()/1e3,a=t!=null?t:0,o=(e?0:i-a)/60/60/24,l=Math.pow(Math.clamp(o/n,0,1),1/2.3),u=Zq(),c=r.colorNew,f=r.colorOld,d=u?.4:1,h=Kw(c.r,f.r,l)*d,m=Kw(c.g,f.g,l)*d,g=Kw(c.b,f.b,l)*d;return{color:`rgba(${h},${m},${g},${u?.75:.25})`,daysSinceCommit:o}}function Kw(t,e,r){return t+(e-t)*r}function Zq(){var t;return((t=window.app)==null?void 0:t.getTheme())==="obsidian"}function m$(t){document.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}p();function g$(t,e,r){let n;for(let i=e;i<=r;i++){let a=t.hashPerLine[i],s=t.commits.get(a);(!n||s.isZeroCommit||Kq(s,n))&&(n=s)}return n}function Kq(t,e){var i,a,s,o;let r=(a=(i=t.author)==null?void 0:i.epochSeconds)!=null?a:0,n=(o=(s=e.author)==null?void 0:s.epochSeconds)!=null?o:0;return r>n}var v$="-",Jq="+",Qq=3,ez="*",tz=/\S/g,rz="%",Zo=class t extends Qw.GutterMarker{constructor(r){super();this.text=r}eq(r){return r instanceof t&&this.text===r.text}toDOM(){return document.createTextNode(this.text)}destroy(r){}},Jw=class extends Qw.GutterMarker{constructor(r,n,i,a,s,o){super();this.lineAuthoring=r;this.startLine=n;this.endLine=i;this.key=a;this.settings=s;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(r){return this.key===(r==null?void 0:r.key)&&this.startLine===(r==null?void 0:r.startLine)&&this.endLine===(r==null?void 0:r.endLine)&&(this==null?void 0:this.options)===(r==null?void 0:r.options)}toDOM(){var r;return this.precomputedDomProvider=(r=this.precomputedDomProvider)!=null?r:this.computeDom(),this.precomputedDomProvider()}destroy(r){r&&(document.body.contains(r)||Xo.delete(r))}computeDom(){let r=g$(this.lineAuthoring,this.startLine,this.endLine),n=r.isZeroCommit?"":this.renderNonZeroCommit(r);return!r.isZeroCommit&&this.options!=="waiting-for-result"?o$(this,n):n=this.adaptTextForFakeCommit(r,n,this.options),this.createHtmlNode(r,n,this.options==="waiting-for-result")}createHtmlNode(r,n,i){var u;let a=window.createDiv();a.innerText=n;let{color:s,daysSinceCommit:o}=mh((u=r==null?void 0:r.author)==null?void 0:u.epochSeconds,r==null?void 0:r.isZeroCommit,this.settings);a.style.backgroundColor=s,p$(r,i,a);function l(){let c=a.cloneNode(!0);return Xo.add(c),i||l$(o),c}return l}renderNonZeroCommit(r){let n=this.settings.showCommitHash?this.renderHash(r):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(r,this.settings.authorDisplay)}`,a=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(r,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[n,i,a].filter(o=>o.length>=1).join(" ")}renderHash(r){return r.hash.substring(0,6)}renderAuthorName(r,n){var o,l,u,c;let i=(l=(o=r==null?void 0:r.author)==null?void 0:o.name)!=null?l:"",a=i.split(" ").filter(f=>f.length>=1),s;switch(n){case"initials":s=a.map(f=>f[0].toUpperCase()).join("");break;case"first name":s=(u=a.first())!=null?u:v$;break;case"last name":s=(c=a.last())!=null?c:v$;break;case"full":s=i;break;default:return ba(n)}return J2(r==null?void 0:r.author,r==null?void 0:r.committer)||(s=s+ez),s}renderAuthoringDate(r,n,i,a){var u;let s="?";if(((u=r==null?void 0:r.author)==null?void 0:u.epochSeconds)===void 0)return s;let o;switch(n){case"date":o=nd;break;case"datetime":o=Ug;break;case"custom":o=i;break;case"natural language":o=c=>{let f=c.diff((0,vh.moment)());return vh.moment.duration(f).humanize(!0)};break;default:return ba(n)}let l=vh.moment.unix(r.author.epochSeconds);switch(a){case"viewer-local":break;case"author-local":l=l.utcOffset(r.author.tz),typeof o=="string"&&(o+=" Z");break;case"utc0000":l=l.utc(),typeof o=="string"&&(o+="[Z]");break;default:return ba(a)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(r,n,i){var l,u,c,f;let a=(u=(l=fh())==null?void 0:l.text)!=null?u:n,s=i!=="waiting-for-result"&&r.isZeroCommit?Jq:rz;n=a.replace(tz,s);let o=(f=(c=tn.get())==null?void 0:c.gutterSpacingFallbackLength)!=null?f:n.length;if(n=Q2(n,o,s),i!=="waiting-for-result"&&r.isZeroCommit){let d=Math.min(o,Qq);n=eP(n,o-d)}return n}};function fs(t,e,r,n,i,a){let s=w$.sha256.create();s.update(JSON.stringify(i)),s.update(`s${e}-e${r}-k${n}-o${a}`);let o=s.hex(),l=dh.get(o);if(l)return l;let u=new Jw(t,e,r,n,i,a);return dh.set(o,u),u}p();var y$=require("obsidian");function e0(){var e,r;let t=(r=(e=tn.get())==null?void 0:e.gutterSpacingFallbackLength)!=null?r:Xe.lineAuthor.gutterSpacingFallbackLength;return new Zo(Array(t).fill("-").join(""))}function t0(t){let{lineAuthoring:e,ageForInitialRender:r}=nz(t);return fs(e,1,1,"initialGutter"+r,t,"waiting-for-result")}function nz(t){var a;let e=(a=c$())!=null?a:ch(t)*.25,r=(0,y$.moment)().add(-e,"days"),n={name:"",epochSeconds:Z2(r),tz:"+0000"},i={hash:"waiting-for-result",author:n,committer:n,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:e}}p();function b$(t,e){return fs({hashPerLine:[void 0,"000000"],commits:new Map([["000000",e$]])},1,1,t,e)}var r0=new Zo(""),E$=(0,S$.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(Wo,!1);return iz(t,e)},lineMarkerChange(t){let e=lh(t.state.field(Wo));return lh(t.startState.field(Wo))!==e},renderEmptyElements:!0,initialSpacer:t=>(_$(t),e0()),updateSpacer:(t,e)=>{var r,n;return _$(e.view),(n=(r=fh())==null?void 0:r.gutter)!=null?n:e0()}});function iz(t,e){let r=lh(e),n=t.state.doc,i=new Map;for(let c=1;c<=n.lines;c++){let f=n.line(c).from,d=t.lineBlockAt(f).to;i.set(c,[f,d]),r.update([f,d,0])}let a=tn.get();r.update("s"+Object.values(tn).join(","));let s=r.hex(),o=hh.get(s);if(o)return o;let{result:l,allowCache:u}=az(n,i,a,e);return u&&hh.set(s,l),l}function az(t,e,r,n){let i=!0,a=t.lines,s=[];function o(f,d,h){return s.push(h.range(f,d))}let l=sz(a,n),u=t.length===0,c=t.iterLines(a,a+1).next().value==="";for(let f=1;f<=a;f++){let[d,h]=e.get(f),m=t.lineAt(h).number;if(u){o(d,h,r0);continue}if(f===a&&c){o(d,h,r0);continue}if(n===void 0){o(d,h,t0(r)),i=!1;continue}let{key:g,la:v}=n;if(v==="untracked"){o(d,h,b$(v,r));continue}let w=v.hashPerLine.length-1,b=l[f],E=l[m];if(E&&E>w&&o(d,h,r0),b!==void 0&&Qv(1,b,w)&&E!==void 0&&Qv(1,E,w)){o(d,h,fs(v,b,E,g,r));continue}if(w<1){o(d,h,t0(r)),i=!1;continue}let x=Math.clamp(b!=null?b:f,1,w),k=Math.clamp(E!=null?E:m,1,w);o(d,h,fs(v,x,k,g+"computing",r,"waiting-for-result"))}return{result:x$.RangeSet.of(s,!0),allowCache:i}}function sz(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),i=>i);let r=[void 0],n=0;for(let i=1;i<=t;i++){let a=e.lineOffsetsFromUnsavedChanges.get(i);n+=a!=null?a:0,r[i]=a===void 0?i-n:void 0}return r}function _$(t){t.dom.querySelectorAll(".cm-gutters").forEach(r=>{r!=null&&r.style&&(r.style.marginLeft||(r.style.marginLeft="unset"))})}var wh=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){return this.trackChangedHelper(e).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeLineAuthorInfo(e.path)}}destroy(){this.lineAuthorings.clear(),s$()}async computeLineAuthorInfo(e){let r=this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,n=await r.submoduleAwareHeadRevisonInContainingDirectory(e),i=await r.hashObject(e),a=r$(n,i,e);if(a!==void 0){if(!this.lineAuthorings.has(a)){let s=await r.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(a,s)}this.notifyComputationResultToSubscribers(e,a)}}notifyComputationResultToSubscribers(e,r){Fi.ifFilepathDefinedTransformSubscribers(e,n=>n.forEach(i=>i.notifyLineAuthoring(r,this.lineAuthorings.get(r))))}},A$=k$.Prec.high([Wo,E$]);var oz="https://momentjs.com/docs/#/parsing/string-format/",lz="https://publish.obsidian.md/git-doc/Line+Authoring",yh=class extends U.PluginSettingTab{constructor(r,n){super(r,n);this.plugin=n;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,n=this.plugin,i;n.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=n.gitReady;r.empty(),a||(r.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let s;if(a){new U.Setting(r).setName("Automatic").setHeading(),new U.Setting(r).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(c=>c.setValue(n.settings.differentIntervalCommitAndPush).onChange(async f=>{n.settings.differentIntervalCommitAndPush=f,await n.saveSettings(),n.automaticsManager.reload("commit","push"),this.refreshDisplayWithDelay()})),new U.Setting(r).setName(`Auto ${i} interval (minutes)`).setDesc(`${n.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoSaveInterval"}),c.setPlaceholder(String(Xe.autoSaveInterval)),c.onChange(async f=>{f!==""?n.settings.autoSaveInterval=Number(f):n.settings.autoSaveInterval=Xe.autoSaveInterval,await n.saveSettings(),n.automaticsManager.reload("commit")})}),s=new U.Setting(r).setName(`Auto ${i} after stopping file edits`).setDesc(`Requires the ${i} interval not to be 0. + If turned on, do auto ${i} every ${tP(n.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(c=>c.setValue(n.settings.autoBackupAfterFileChange).onChange(async f=>{n.settings.autoBackupAfterFileChange=f,this.refreshDisplayWithDelay(),await n.saveSettings(),n.automaticsManager.reload("commit")})),this.mayDisableSetting(s,n.settings.setLastSaveToLastCommit),s=new U.Setting(r).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(c=>c.setValue(n.settings.setLastSaveToLastCommit).onChange(async f=>{n.settings.setLastSaveToLastCommit=f,await n.saveSettings(),n.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(s,n.settings.autoBackupAfterFileChange),s=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoPushInterval"}),c.setPlaceholder(String(Xe.autoPushInterval)),c.onChange(async f=>{f!==""?n.settings.autoPushInterval=Number(f):n.settings.autoPushInterval=Xe.autoPushInterval,await n.saveSettings(),n.automaticsManager.reload("push")})}),this.mayDisableSetting(s,!n.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoPullInterval"}),c.setPlaceholder(String(Xe.autoPullInterval)),c.onChange(async f=>{f!==""?n.settings.autoPullInterval=Number(f):n.settings.autoPullInterval=Xe.autoPullInterval,await n.saveSettings(),n.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${i} only staged files`).setDesc(`If turned on, only staged files are committed on ${i}. If turned off, all changed files are committed.`).addToggle(c=>c.setValue(n.settings.autoCommitOnlyStaged).onChange(async f=>{n.settings.autoCommitOnlyStaged=f,await n.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(c=>c.setValue(n.settings.customMessageOnAutoBackup).onChange(async f=>{n.settings.customMessageOnAutoBackup=f,await n.saveSettings(),this.refreshDisplayWithDelay()})),s=new U.Setting(r).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(c=>{c.setPlaceholder(Xe.autoCommitMessage).onChange(async f=>{f===""?n.settings.autoCommitMessage=Xe.autoCommitMessage:n.settings.autoCommitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(s,n.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading(),new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(c=>{c.setPlaceholder(Xe.commitMessage).onChange(async f=>{f===""?n.settings.commitMessage=Xe.commitMessage:n.settings.commitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"commitMessage"})}),new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(c=>{c.onChange(async f=>{f===""?n.settings.commitMessageScript=Xe.commitMessageScript:n.settings.commitMessageScript=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(c=>c.setDefaultFormat(n.settings.commitDateFormat).setValue(n.settings.commitDateFormat).onChange(async f=>{n.settings.commitDateFormat=f,await n.saveSettings()}));u.descEl.innerHTML=` + Specify custom date format. E.g. "${jg}. See Moment.js for more formats.`,new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(c=>{var f;return c.setValue((f=n.localStorage.getHostname())!=null?f:"").onChange(d=>{n.localStorage.setHostname(d)})}),new U.Setting(r).setName("Preview commit message").addButton(c=>c.setButtonText("Preview").onClick(async()=>{let f=await n.gitManager.formatCommitMessage(n.settings.commitMessage);new U.Notice(`${f}`)})),new U.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(c=>c.setValue(n.settings.listChangedFilesInMessageBody).onChange(async f=>{n.settings.listChangedFilesInMessageBody=f,await n.saveSettings()})),new U.Setting(r).setName("Pull").setHeading(),n.gitManager instanceof _e&&new U.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(c=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};c.addOptions(f),c.setValue(n.settings.syncMethod),c.onChange(async d=>{n.settings.syncMethod=d,await n.saveSettings()})}),new U.Setting(r).setName("Merge strategy on conflicts").setDesc("Decide how to solve conflicts when pulling remote changes. This can be used to favor your local changes or the remote changes automatically.").addDropdown(c=>{let f={none:"None (git default)",ours:"Our changes",theirs:"Their changes"};c.addOptions(f),c.setValue(n.settings.mergeStrategy),c.onChange(async d=>{n.settings.mergeStrategy=d,await n.saveSettings()})}),new U.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(c=>c.setValue(n.settings.autoPullOnBoot).onChange(async f=>{n.settings.autoPullOnBoot=f,await n.saveSettings()})),new U.Setting(r).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),s=new U.Setting(r).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${n.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(c=>c.setValue(!n.settings.disablePush).onChange(async f=>{n.settings.disablePush=!f,this.refreshDisplayWithDelay(),await n.saveSettings()})),new U.Setting(r).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${n.settings.disablePush?"":"and push "}only.`).addToggle(c=>c.setValue(n.settings.pullBeforePush).onChange(async f=>{n.settings.pullBeforePush=f,this.refreshDisplayWithDelay(),await n.saveSettings()})),n.gitManager instanceof _e&&(new U.Setting(r).setName("Hunk management").setDesc("Hunks are sections of grouped line changes right in your editor.").setHeading(),new U.Setting(r).setName("Signs").setDesc("This allows you to see your changes right in your editor via colored markers and stage/reset/preview individual hunks.").addToggle(c=>c.setValue(n.settings.hunks.showSigns).onChange(async f=>{n.settings.hunks.showSigns=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Hunk commands").setDesc("Adds commands to stage/reset individual Git diff hunks and navigate between them via 'Go to next/prev hunk' commands.").addToggle(c=>c.setValue(n.settings.hunks.hunkCommands).onChange(async f=>{n.settings.hunks.hunkCommands=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Status bar with summary of line changes").addDropdown(c=>c.addOptions({disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"}).setValue(n.settings.hunks.statusBar).onChange(async f=>{n.settings.hunks.statusBar=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new U.Setting(r).setName("History view").setHeading(),new U.Setting(r).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(u=>{let c={hide:"Hide",full:"Full",initials:"Initials"};u.addOptions(c),u.setValue(n.settings.authorInHistoryView),u.onChange(async f=>{n.settings.authorInHistoryView=f,await n.saveSettings(),await n.refresh()})}),new U.Setting(r).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(u=>u.setValue(n.settings.dateInHistoryView).onChange(async c=>{n.settings.dateInHistoryView=c,await n.saveSettings(),await n.refresh()})),new U.Setting(r).setName("Source control view").setHeading(),new U.Setting(r).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(u=>u.setValue(n.settings.refreshSourceControl).onChange(async c=>{n.settings.refreshSourceControl=c,await n.saveSettings()})),new U.Setting(r).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(u=>{u.inputEl.type="number",this.setNonDefaultValue({text:u,settingsProperty:"refreshSourceControlTimer"}),u.setPlaceholder(String(Xe.refreshSourceControlTimer)),u.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?n.settings.refreshSourceControlTimer=Math.max(Number(f),500):n.settings.refreshSourceControlTimer=Xe.refreshSourceControlTimer,await n.saveSettings(),n.setRefreshDebouncer()})}),new U.Setting(r).setName("Miscellaneous").setHeading(),n.gitManager instanceof _e&&new U.Setting(r).setName("Diff view style").setDesc('Set the style for the diff view. Note that the actual diff in "Split" mode is not generated by Git, but the editor itself instead so it may differ from the diff generated by Git. One advantage of this is that you can edit the text in that view.').addDropdown(u=>{let c={split:"Split",git_unified:"Unified"};u.addOptions(c),u.setValue(n.settings.diffStyle),u.onChange(async f=>{n.settings.diffStyle=f,await n.saveSettings()})}),new U.Setting(r).setName("Disable informative notifications").setDesc("Disable informative notifications for git operations to minimize distraction (refer to status bar for updates).").addToggle(u=>u.setValue(n.settings.disablePopups).onChange(async c=>{n.settings.disablePopups=c,this.refreshDisplayWithDelay(),await n.saveSettings()})),new U.Setting(r).setName("Disable error notifications").setDesc("Disable error notifications of any kind to minimize distraction (refer to status bar for updates).").addToggle(u=>u.setValue(!n.settings.showErrorNotices).onChange(async c=>{n.settings.showErrorNotices=!c,await n.saveSettings()})),n.settings.disablePopups||new U.Setting(r).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(u=>u.setValue(n.settings.disablePopupsForNoChanges).onChange(async c=>{n.settings.disablePopupsForNoChanges=c,await n.saveSettings()})),new U.Setting(r).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(u=>u.setValue(n.settings.showStatusBar).onChange(async c=>{n.settings.showStatusBar=c,await n.saveSettings()})),new U.Setting(r).setName("File menu integration").setDesc('Add "Stage", "Unstage" and "Add to .gitignore" actions to the file menu.').addToggle(u=>u.setValue(n.settings.showFileMenu).onChange(async c=>{n.settings.showFileMenu=c,await n.saveSettings()})),new U.Setting(r).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(u=>u.setValue(n.settings.showBranchStatusBar).onChange(async c=>{n.settings.showBranchStatusBar=c,await n.saveSettings()})),new U.Setting(r).setName("Show the count of modified files in the status bar").addToggle(u=>u.setValue(n.settings.changedFilesInStatusBar).onChange(async c=>{n.settings.changedFilesInStatusBar=c,await n.saveSettings()})),n.gitManager instanceof _n?new U.Setting(r).setName("Authentication/commit author").setHeading():new U.Setting(r).setName("Commit author").setHeading(),n.gitManager instanceof _n&&new U.Setting(r).setName("Username on your git server. E.g. your username on GitHub").addText(u=>{var c;u.setValue((c=n.localStorage.getUsername())!=null?c:""),u.onChange(f=>{n.localStorage.setUsername(f)})}),n.gitManager instanceof _n&&new U.Setting(r).setName("Password/Personal access token").setDesc("Type in your password. You won't be able to see it again.").addText(u=>{u.inputEl.autocapitalize="off",u.inputEl.autocomplete="off",u.inputEl.spellcheck=!1,u.onChange(c=>{n.localStorage.setPassword(c)})}),n.gitReady&&new U.Setting(r).setName("Author name for commit").addText(async u=>{var c;u.setValue((c=await n.gitManager.getConfig("user.name"))!=null?c:""),u.onChange(async f=>{await n.gitManager.setConfig("user.name",f==""?void 0:f)})}),n.gitReady&&new U.Setting(r).setName("Author email for commit").addText(async u=>{var c;u.setValue((c=await n.gitManager.getConfig("user.email"))!=null?c:""),u.onChange(async f=>{await n.gitManager.setConfig("user.email",f==""?void 0:f)})}),new U.Setting(r).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be required for special setups.").setHeading(),n.gitManager instanceof _e&&(new U.Setting(r).setName("Update submodules").setDesc('"Commit-and-sync" and "pull" takes care of submodules. Missing features: Conflicted files, count of pulled/pushed/committed files. Tracking branch needs to be set for each submodule.').addToggle(u=>u.setValue(n.settings.updateSubmodules).onChange(async c=>{n.settings.updateSubmodules=c,await n.saveSettings()})),n.settings.updateSubmodules&&new U.Setting(r).setName("Submodule recurse checkout/switch").setDesc("Whenever a checkout happens on the root repository, recurse the checkout on the submodules (if the branches exist).").addToggle(u=>u.setValue(n.settings.submoduleRecurseCheckout).onChange(async c=>{n.settings.submoduleRecurseCheckout=c,await n.saveSettings()}))),n.gitManager instanceof _e&&new U.Setting(r).setName("Custom Git binary path").setDesc("Specify the path to the Git binary/executable. Git should already be in your PATH. Should only be necessary for a custom Git installation.").addText(u=>{var c;u.setValue((c=n.localStorage.getGitPath())!=null?c:""),u.setPlaceholder("git"),u.onChange(f=>{n.localStorage.setGitPath(f),n.gitManager.updateGitPath(f||"git").catch(d=>n.displayError(d))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Additional environment variables").setDesc("Use each line for a new environment variable in the format KEY=VALUE .").addTextArea(u=>{u.setPlaceholder("GIT_DIR=/path/to/git/dir"),u.setValue(n.localStorage.getEnvVars().join(` +`)),u.onChange(c=>{n.localStorage.setEnvVars(c.split(` +`))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(u=>{u.setValue(n.localStorage.getPATHPaths().join(` +`)),u.onChange(c=>{n.localStorage.setPATHPaths(c.split(` +`))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(u=>{u.setButtonText("Reload"),u.setCta(),u.onClick(async()=>{await n.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(` + Sets the relative path to the vault from which the Git binary should be executed. + Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows. + `).addText(u=>{u.setValue(n.settings.basePath),u.setPlaceholder("directory/directory-with-git-repo"),u.onChange(async c=>{n.settings.basePath=c,await n.saveSettings(),n.gitManager.updateBasePath(c||"").catch(f=>n.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(u=>{u.setValue(n.settings.gitDir),u.setPlaceholder(".git"),u.onChange(async c=>{n.settings.gitDir=c,await n.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(u=>u.setValue(n.localStorage.getPluginDisabled()).onChange(c=>{n.localStorage.setPluginDisabled(c),c?n.unloadPlugin():n.init({fromReload:!0}).catch(f=>n.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(u=>{u.buttonEl.outerHTML="Buy Me a Coffee at ko-fi.com"});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let u=r.createDiv();u.setAttr("align","center"),u.setText(`Debugging and logging: +You can always see the logs of this and every other plugin by opening the console with`);let c=r.createDiv();c.setAttr("align","center"),c.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?c.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):c.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,n){n&&(r.setDisabled(n),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,n){this.settings.lineAuthor[r]=n,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.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.`,r.addToggle(n=>n.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let n=new U.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(n.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 ${id} characters) within the same (or all) commit(s), the originating commit's information is shown.`,new U.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new U.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 U.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.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new U.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 U.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 U.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 U.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 highly 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 U.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(r){let n=new U.Setting(this.containerEl).setName("").addText(i=>{let a=n0(r,this.settings.lineAuthor),s=n0(r,Xe.lineAuthor);i.setPlaceholder(Jv(s)),i.setValue(Jv(a)),i.onChange(async o=>{let l=X2(o);if(l!==void 0){let u=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(u,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,n),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,n0(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let n=this.lineAuthorColorSettings.get(r);if(n){let i=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";n.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(r,n){let i=this.lineAuthorColorSettings.get(r);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(r,this.settings.lineAuthor,n!==void 0))}colorSettingPreviewDescHtml(r,n,i){let a=i?gh(r,n):"rgba(127,127,127,0.3)",s=U.moment.unix(U.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(r){let n=(0,U.moment)().format(r);return`
Format string to display the authoring date.
Currently: ${n}`}previewOldestAgeDescriptionHtml(r){let n=sh(r);return[`The oldest age in the line author coloring. Everything older will have the same color. +
Smallest valid age is "1d". Currently: ${n!==void 0?`${n.asDays()} days`:"invalid!"}`,n]}setNonDefaultValue({settingsProperty:r,text:n}){let i=this.plugin.settings[r];Xe[r]!==i&&(typeof i=="string"||typeof i=="number"||typeof i=="boolean"?n.setValue(String(i)):n.setValue(JSON.stringify(i)))}refreshDisplayWithDelay(r=80){setTimeout(()=>this.display(),r)}};function n0(t,e){return t==="oldest"?e.colorOld:e.colorNew}function sh(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}p();var Lr=require("obsidian");var bh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,Lr.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,Lr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,Lr.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,Lr.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,Lr.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,Lr.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,Lr.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Lr.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var n;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let i=(0,Lr.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${i}`,(n=this.unPushedCommits)!=null&&n&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,Lr.setIcon)(this.iconEl,"globe"):(0,Lr.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()}};p();var xh=require("obsidian"),_h=class extends xh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let n=(0,xh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${n}: ${r}`,`${r}: ${n}`]}renderSuggestion(r,n){n.innerText=r}onChooseSuggestion(r,n){this.resolve&&this.resolve(r)}};p();var T$=require("obsidian"),Zc=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,n;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((n=this.plugin.localStorage.getLastAutoPush())!=null?n:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,T$.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let n=this.diff(this.plugin.settings.autoSaveInterval,r);if(n>0)return this.startAutoCommitAndSync(n),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((r=this.plugin.autoCommitDebouncer)==null||r.cancel(),this.plugin.autoCommitDebouncer=void 0,e=!0),e}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPush=void 0,!0):!1}diff(e,r){let i=e-Math.round((new Date().getTime()-r.getTime())/1e3/60);return Math.max(0,i)}};p();var kn=require("obsidian");p();var Kc=require("obsidian");async function C$(t,e,r){let n=await R$(e,r);if(n.result==="failure"){new Kc.Notice(n.reason);return}let{isGitHub:i,branch:a,repo:s,user:o,filePath:l}=n;if(i){let u=t.getCursor("from").line+1,c=t.getCursor("to").line+1;u===c?window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${u}`):window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${u}-L${c}`)}else new Kc.Notice("It seems like you are not using GitHub")}async function P$(t,e){let r=await R$(t,e);if(r.result==="failure"){new Kc.Notice(r.reason);return}let{isGitHub:n,branch:i,repo:a,user:s,filePath:o}=r;n?window.open(`https://github.com/${s}/${a}/commits/${i}/${o}`):new Kc.Notice("It seems like you are not using GitHub")}async function R$(t,e){let r=await e.branchInfo(),n=r.tracking,i=r.current,a,s=e.getRelativeRepoPath(t.path);if(e instanceof _e){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){s=l.relativeFilepath;let u=await e.git.cwd({path:l.submodule,root:!1}).status();if(n=u.tracking||void 0,i=u.current||void 0,n){let c=n.substring(0,n.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${c}.url`,"local");if(f.value!=null)a=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(n==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=n.substring(0,n.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,u,c,f,d]=o;return{result:"success",isGitHub:!!l,repo:c||d,user:u||f,branch:i,filePath:s}}}p();var I$=require("obsidian"),Sh=class extends I$.FuzzySuggestModal{constructor(e,r){super(e.app),this.plugin=e,this.changedFiles=r,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.workingDir=="U")return`Untracked | ${e.vaultPath}`;let r="",n="";return e.workingDir!=" "&&(r=`Working Dir: ${e.workingDir} `),e.index!=" "&&(n=`Index: ${e.index}`),`${r}${n} | ${e.vaultPath}`}onChooseItem(e,r){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vaultPath,"")==null?this.app.openWithDefaultApp(e.vaultPath):this.plugin.app.workspace.openLinkText(e.vaultPath,"/")}};p();var $$=require("obsidian"),Eh=class extends $$.Modal{constructor(r,n){super(r);this.content=n;this.resolve=null}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onOpen(){let{contentEl:r,titleEl:n}=this;n.setText("Edit .gitignore");let i=r.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:r}=this;r.empty(),this.resolve&&this.resolve(void 0)}};p();var cu=require("@codemirror/state"),jh=require("@codemirror/view");p();var Qo=require("@codemirror/state");p();var Et=class t{static createHunk(e,r,n,i){return{removed:{start:e,count:r,lines:[]},added:{start:n,count:i,lines:[]},head:`@@ -${e}${r>0?`,${r}`:""} +${n}${i>0?`,${i}`:""} @@`,vend:n+Math.max(i-1,0),type:i===0?"delete":r===0?"add":"change"}}static createPartialHunk(e,r,n){let i=r,a=n-r+1,s=0;for(let o of e){let l=o.added.count-o.removed.count,u=0;if(o.added.start>=r&&o.vend<=n)u=l;else{let c=Math.max(0,n+1-(o.added.start+o.removed.count)),f=Math.max(0,r-(o.added.start+o.removed.count));o.added.start>=r&&o.added.start<=n?u=c:o.vend>=r&&o.vend<=n?(u=l-f,i=i-f):o.added.start<=r&&o.vend>=n?(u=c-f,i=i-f):s++,r>o.vend&&(i=i-l)}a=a-u}if(s!==e.length)return a===0&&(i=i-1),this.createHunk(i,a,r,n-r+1)}patchLines(e,r=!1){let n=[];for(let i of e.removed.lines)n.push("-"+i);for(let i of e.added.lines)n.push("+"+i);return r?n.map(i=>i.replace(/\r$/,"")):n}static parseDiffLine(e){let i=e.split("@@")[1].trim().split(" "),a=i[0].substring(1).split(","),s=i[1].substring(1).split(","),o=this.createHunk(parseInt(a[0]),parseInt(a[1]||"1"),parseInt(s[0]),parseInt(s[1]||"1"));return o.head=e,o}static changeEnd(e){return e.added.count===0?e.added.start:e.removed.count===0?e.added.start+e.added.count-1:e.added.start+Math.min(e.added.count,e.removed.count)-1}static calcSigns(e,r,n,i=1,a=1/0,s){if(s&&r.type!=="add")return console.error(`Invalid hunk with untracked=${s} hunk="${r.head}"`),[];i=Math.max(1,i);let{start:o,added:l,removed:u}={start:r.added.start,added:r.added.count,removed:r.removed.count},c=this.changeEnd(r),f=r.type==="delete"&&(o===0||e&&this.changeEnd(e)===o)&&(!n||n.added.start!==o+1);f&&i===1&&(i=0);let d=[];for(let h=Math.max(o,i);h<=Math.min(c,a);h++){let m=r.type==="change"&&(u>l&&h===c||e&&e.added.start===0);d.push({type:f?"topdelete":m?"changedelete":s?"untracked":r.type,count:h===o?r.type==="add"?l:u:void 0,lnum:h+(f?1:0)})}if(r.type==="change"&&l>u&&r.vend>=i&&c<=a)for(let h=Math.max(c,i);h<=Math.min(r.vend,a);h++)d.push({type:"add",count:h===r.vend?l-u:void 0,lnum:h});return d}static createPatch(e,r,n,i=!1){let a=[`diff --git a/${e} b/${e}`,`index 000000..000000 ${n}`,`--- a/${e}`,`+++ b/${e}`],s=0;r=structuredClone(r);for(let o of r){let l=o.removed.start,u=o.removed.count,c=o.added.count;o.type==="add"&&(l=l+1);let f=o.removed.lines,d=o.added.lines;i&&([u,c]=[c,u],[f,d]=[d,f]),a.push(`@@ -${l},${u} +${l+s},${c} @@`);for(let h of f)a.push("-"+h);(i?o.added:o.removed).no_nl_at_eof&&a.push("\\ No newline at end of file");for(let h of d)a.push("+"+h);(i?o.removed:o.added).no_nl_at_eof&&a.push("\\ No newline at end of file"),o.removed.start=l+s,s=s+(c-u)}return a}getSummary(e){let r={added:0,changed:0,removed:0};for(let n of e)if(n.type==="add")r.added+=n.added.count;else if(n.type==="delete")r.removed+=n.removed.count;else if(n.type==="change"){let i=n.added.count,a=n.removed.count,s=Math.min(i,a);r.changed+=s,r.added+=i-s,r.removed+=a-s}return r}static findHunk(e,r){if(!r)return[void 0,void 0];for(let n=0;n=e)return[i,n]}return[void 0,void 0]}static findNearestHunk(e,r,n,i){if(r.length!==0){if(n==="first")return 0;if(n==="last")return r.length-1;if(n==="next"){if(r[0].added.start>e)return 0;for(let a=r.length-1;a>=0;a--)if(r[a].added.start<=e){if(a+1e)return a+1;if(i)return 0}}else if(n==="prev"){if(Math.max(r[r.length-1].vend)0&&Math.max(r[a-1].vend,1)l.added.start?i++:o.added.starts.replace(/\r$/,"")),a=a.map(s=>s.replace(/\r$/,"")));for(let s of[{sym:"-",lines:i,hl:"GitSignsDeletePreview"},{sym:"+",lines:a,hl:"GitSignsAddPreview"}])for(let o of s.lines){let l={start_row:0,hl_group:s.hl,end_row:1};n.push([[s.sym+o,[l]]])}return n}};p();p();var $e=require("@codemirror/view"),Te=require("@codemirror/state");p();var i0="\u037C",F$=typeof Symbol=="undefined"?"__"+i0:Symbol.for(i0),a0=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),O$=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},kh=class{constructor(e,r){this.rules=[];let{finish:n}=r||{};function i(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function a(s,o,l,u){let c=[],f=/^@(\w+)\b/.exec(s[0]),d=f&&f[1]=="keyframes";if(f&&o==null)return l.push(s[0]+";");for(let h in o){let m=o[h];if(/&/.test(h))a(h.split(/,\s*/).map(g=>s.map(v=>g.replace(/&/,v))).reduce((g,v)=>g.concat(v)),m,l);else if(m&&typeof m=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");a(i(h),m,c,d)}else m!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+m+";")}(c.length||d)&&l.push((n&&!f&&!u?s.map(n):s).join(", ")+" {"+c.join(" ")+"}")}for(let s in e)a(i(s),e[s],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=O$[F$]||1;return O$[F$]=e+1,i0+e.toString(36)}static mount(e,r,n){let i=e[a0],a=n&&n.nonce;i?a&&i.setNonce(a):i=new s0(e,a),i.mount(Array.isArray(r)?r:[r],e)}},M$=new Map,s0=class{constructor(e,r){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let a=M$.get(n);if(a)return e[a0]=a;this.sheet=new i.CSSStyleSheet,M$.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[a0]=this}mount(e,r){let n=this.sheet,i=0,a=0;for(let s=0;s-1&&(this.modules.splice(l,1),a--,l=-1),l==-1){if(this.modules.splice(a++,0,o),n)for(let u=0;uu){let f=t.slice(e,r).indexOf(n.slice(i,a));if(f>-1)return[new ht(e,e+f,i,i),new ht(e+f+u,r,a,a)]}else if(u>l){let f=n.slice(i,a).indexOf(t.slice(e,r));if(f>-1)return[new ht(e,e,i,i+f),new ht(r,r,i+f+l,a)]}if(l==1||u==1)return[new ht(e,r,i,a)];let c=tF(t,e,r,n,i,a);if(c){let[f,d,h]=c;return hs(t,e,f,n,i,d).concat(hs(t,f+h,r,n,d+h,a))}return uz(t,e,r,n,i,a)}var Jc=1e9,Qc=0,h0=!1;function uz(t,e,r,n,i,a){let s=r-e,o=a-i;if(Jc<1e9&&Math.min(s,o)>Jc*16||Qc>0&&Date.now()>Qc)return Math.min(s,o)>Jc*64?[new ht(e,r,i,a)]:D$(t,e,r,n,i,a);let l=Math.ceil((s+o)/2);o0.reset(l),l0.reset(l);let u=(h,m)=>t.charCodeAt(e+h)==n.charCodeAt(i+m),c=(h,m)=>t.charCodeAt(r-h-1)==n.charCodeAt(a-m-1),f=(s-o)%2!=0?l0:null,d=f?null:o0;for(let h=0;hJc||Qc>0&&!(h&63)&&Date.now()>Qc)return D$(t,e,r,n,i,a);let m=o0.advance(h,s,o,l,f,!1,u)||l0.advance(h,s,o,l,d,!0,c);if(m)return fz(t,e,r,e+m[0],n,i,a,i+m[1])}return[new ht(e,r,i,a)]}var Rh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;rr)this.end+=2;else if(f>n)this.start+=2;else if(a){let d=i+(r-n)-l;if(d>=0&&d=r-c)return[h,i+h-d]}else{let h=r-a.vec[d];if(c>=h)return[c,f]}}}return null}},o0=new Rh,l0=new Rh;function fz(t,e,r,n,i,a,s,o){let l=!1;return!Jo(t,n)&&++n==r&&(l=!0),!Jo(i,o)&&++o==s&&(l=!0),l?[new ht(e,r,a,s)]:hs(t,e,n,i,a,o).concat(hs(t,n,r,i,o,s))}function eF(t,e){let r=1,n=Math.min(t,e);for(;rr||c>a||t.slice(o,u)!=n.slice(l,c)){if(s==1)return o-e-(Jo(t,o)?0:1);s=s>>1}else{if(u==r||c==a)return u-e;o=u,l=c}}}function m0(t,e,r,n,i,a){if(e==r||i==a||t.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let s=eF(r-e,a-i);for(let o=r,l=a;;){let u=o-s,c=l-s;if(u>1}else{if(u==e||c==i)return r-u;o=u,l=c}}}function c0(t,e,r,n,i,a,s,o){let l=n.slice(i,a),u=null;for(;;){if(u||s=r)break;let d=t.slice(c,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let m=p0(t,f,r,n,i+h+d.length,a),g=m0(t,e,c,n,i,i+h),v=d.length+m+g;(!u||u[2]>1}}function tF(t,e,r,n,i,a){let s=r-e,o=a-i;if(si.fromA-e&&n.toB>i.fromB-e&&(t[r-1]=new ht(n.fromA,i.toA,n.fromB,i.toB),t.splice(r--,1))}}function dz(t,e,r){for(;;){rF(r,1);let n=!1;for(let i=0;i3||o>3){let l=i==t.length-1?e.length:t[i+1].fromA,u=a.fromA-n,c=l-a.toA,f=N$(e,a.fromA,u),d=L$(e,a.toA,c),h=a.fromA-f,m=d-a.toA;if((!s||!o)&&h&&m){let g=Math.max(s,o),[v,w,b]=s?[e,a.fromA,a.toA]:[r,a.fromB,a.toB];g>h&&e.slice(f,a.fromA)==v.slice(b-h,b)?(a=t[i]=new ht(f,f+s,a.fromB-h,a.toB-h),f=a.fromA,d=L$(e,a.toA,l-a.toA)):g>m&&e.slice(a.toA,d)==v.slice(w,w+m)&&(a=t[i]=new ht(d-s,d,a.fromB+m,a.toB+m),d=a.toA,f=N$(e,a.fromA,a.fromA-n)),h=a.fromA-f,m=d-a.toA}if(h||m)a=t[i]=new ht(a.fromA-h,a.toA+m,a.fromB-h,a.toB+m);else if(s){if(!o){let g=H$(e,a.fromA,a.toA),v,w=g<0?-1:B$(e,a.toA,a.fromA);g>-1&&(v=g-a.fromA)<=c&&e.slice(a.fromA,g)==e.slice(a.toA,a.toA+v)?a=t[i]=a.offset(v):w>-1&&(v=a.toA-w)<=u&&e.slice(a.fromA-v,a.fromA)==e.slice(w,a.toA)&&(a=t[i]=a.offset(-v))}}else{let g=H$(r,a.fromB,a.toB),v,w=g<0?-1:B$(r,a.toB,a.fromB);g>-1&&(v=g-a.fromB)<=c&&r.slice(a.fromB,g)==r.slice(a.toB,a.toB+v)?a=t[i]=a.offset(v):w>-1&&(v=a.toB-w)<=u&&r.slice(a.fromB-v,a.fromB)==r.slice(w,a.toB)&&(a=t[i]=a.offset(-v))}}n=a.toA}return rF(t,3),t}var ds;try{ds=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(t){}function nF(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function iF(t,e){if(e==t.length)return 0;let r=t.charCodeAt(e);return r<192?nF(r)?1:0:ds?!oF(r)||e==t.length-1?ds.test(String.fromCharCode(r))?1:0:ds.test(t.slice(e,e+2))?2:0:0}function aF(t,e){if(!e)return 0;let r=t.charCodeAt(e-1);return r<192?nF(r)?1:0:ds?!lF(r)||e==1?ds.test(String.fromCharCode(r))?1:0:ds.test(t.slice(e-2,e))?2:0:0}var sF=8;function L$(t,e,r){if(e==t.length||!aF(t,e))return e;for(let n=e,i=e+r,a=0;ai)return n;n+=s}return e}function N$(t,e,r){if(!e||!iF(t,e))return e;for(let n=e,i=e-r,a=0;at>=55296&&t<=56319,lF=t=>t>=56320&&t<=57343;function Jo(t,e){return!e||e==t.length||!oF(t.charCodeAt(e-1))||!lF(t.charCodeAt(e))}function pz(t,e,r){var n;return Jc=((n=r==null?void 0:r.scanLimit)!==null&&n!==void 0?n:1e9)>>1,Qc=r!=null&&r.timeout?Date.now()+r.timeout:0,h0=!1,dz(t,e,hs(t,0,t.length,e,0,e.length))}function cF(){return!h0}function uF(t,e,r){return hz(pz(t,e,r),t,e)}var xn=Te.Facet.define({combine:t=>t[0]}),u0=Te.StateEffect.define(),mz=Te.Facet.define(),ps=Te.StateField.define({create(t){return null},update(t,e){for(let r of e.effects)r.is(u0)&&(t=r.value);for(let r of e.state.facet(mz))t=r(t,e);return t}});function g0(t){let e=t.field(ps,!1);if(!e)return null;let r=t.facet(xn);return{chunks:e,side:r?r.side:null}}var Oi=class t{constructor(e,r,n,i,a,s=!0){this.changes=e,this.fromA=r,this.toA=n,this.fromB=i,this.toB=a,this.precise=s}offset(e,r){return e||r?new t(this.changes,this.fromA+e,this.toA+e,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,r,n){let i=uF(e.toString(),r.toString(),n);return fF(i,e,r,0,0,cF())}static updateA(e,r,n,i,a){return z$(q$(e,i,!0,n.length),e,r,n,a)}static updateB(e,r,n,i,a){return z$(q$(e,i,!1,r.length),e,r,n,a)}};function U$(t,e,r,n){let i=r.lineAt(t),a=n.lineAt(e);return i.to==t&&a.to==e&&tf+1&&v>d+1)break;h.push(m.offset(-u+n,-c+i)),[f,d]=j$(m.toA+n,m.toB+i,e,r),o++}s.push(new Oi(h,u,Math.max(u,f),c,Math.max(c,d),a))}return s}var Ah=1e3;function G$(t,e,r,n){let i=0,a=t.length;for(;;){if(i==a){let c=0,f=0;i&&({toA:c,toB:f}=t[i-1]);let d=e-(r?c:f);return[c+d,f+d]}let s=i+a>>1,o=t[s],[l,u]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>e)a=s;else if(u<=e)i=s+1;else return n?[o.fromA,o.fromB]:[o.toA,o.toB]}}function q$(t,e,r,n){let i=[];return e.iterChangedRanges((a,s,o,l)=>{let u=0,c=r?e.length:n,f=0,d=r?n:e.length;a>Ah&&([u,f]=G$(t,a-Ah,r,!0)),s=u?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:c,toB:d,diffA:m.diffA+g,diffB:m.diffB+v}:i.push({fromA:u,toA:c,fromB:f,toB:d,diffA:g,diffB:v})}),i}function z$(t,e,r,n,i){if(!t.length)return e;let a=[];for(let s=0,o=0,l=0,u=0;;s++){let c=s==t.length?null:t[s],f=c?c.fromA+o:r.length,d=c?c.fromB+l:n.length;for(;uf||Math.min(n.length,v.toB+l)>d)break;a.push(v.offset(o,l)),u++}if(!c)break;let h=c.toA+o+c.diffA,m=c.toB+l+c.diffB,g=uF(r.sliceString(f,h),n.sliceString(d,m),i);for(let v of fF(g,r,n,f,d,cF()))a.push(v);for(o+=c.diffA,l+=c.diffB;uh&&v.fromB+l>m)break;u++}}return a}var gz={scanLimit:500},dF=$e.ViewPlugin.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Y$(t))}update(t){(t.docChanged||t.viewportChanged||vz(t.startState,t.state)||wz(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Y$(t.view))}},{decorations:t=>t.deco}),Th=Te.Prec.low((0,$e.gutter)({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(dF))===null||e===void 0?void 0:e.gutter)||Te.RangeSet.empty}}));function vz(t,e){return t.field(ps,!1)!=e.field(ps,!1)}function wz(t,e){return t.facet(xn)!=e.facet(xn)}var V$=$e.Decoration.line({class:"cm-changedLine"}),yz=$e.Decoration.mark({class:"cm-changedText"}),bz=$e.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),_z=$e.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),W$=new class extends $e.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function xz(t,e,r,n,i,a){let s=r?t.fromA:t.fromB,o=r?t.toA:t.toB,l=0;if(s!=o){i.add(s,s,V$),i.add(s,o,r?_z:bz),a&&a.add(s,s,W$);for(let u=e.iterRange(s,o-1),c=s;!u.next().done;){if(u.lineBreak){c++,i.add(c,c,V$),a&&a.add(c,c,W$);continue}let f=c+u.value.length;if(n)for(;l=c)break;(s?f.toA:f.toB)>u&&(!a||!a(t.state,f,o,l))&&xz(f,t.state.doc,s,n,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}var Ko=class extends $e.WidgetType{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},Ih=Te.StateEffect.define({map:(t,e)=>t.map(e)}),eu=Te.StateField.define({create:()=>$e.Decoration.none,update:(t,e)=>{for(let r of e.effects)if(r.is(Ih))return r.value;return t.map(e.changes)},provide:t=>$e.EditorView.decorations.from(t)}),Ch=.01;function X$(t,e){if(t.size!=e.size)return!1;let r=t.iter(),n=e.iter();for(;r.value;){if(r.from!=n.from||Math.abs(r.value.spec.widget.height-n.value.spec.widget.height)>1)return!1;r.next(),n.next()}return!0}function Sz(t,e,r){let n=new Te.RangeSetBuilder,i=new Te.RangeSetBuilder,a=t.state.field(eu).iter(),s=e.state.field(eu).iter(),o=0,l=0,u=0,c=0,f=t.viewport,d=e.viewport;for(let v=0;;v++){let w=vCh&&(c+=A,i.add(l,l,$e.Decoration.widget({widget:new Ko(A),block:!0,side:-1})))}if(b>o+1e3&&of.from&&ld.from){let x=Math.min(f.from-o,d.from-l);o+=x,l+=x,v--}else if(w)o=w.toA,l=w.toB;else break;for(;a.value&&a.fromCh&&i.add(e.state.doc.length,e.state.doc.length,$e.Decoration.widget({widget:new Ko(h),block:!0,side:1}));let m=n.finish(),g=i.finish();X$(m,t.state.field(eu))||t.dispatch({effects:Ih.of(m)}),X$(g,e.state.field(eu))||e.dispatch({effects:Ih.of(g)})}var f0=Te.StateEffect.define({map:(t,e)=>e.mapPos(t)});var d0=class extends $e.WidgetType{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=e.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let i=e.posAtDOM(n.target);e.dispatch({effects:f0.of(i)});let{side:a,sibling:s}=e.state.facet(xn);s&&s().dispatch({effects:f0.of(Ez(i,e.state.field(ps),a=="a"))})}),r}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function Ez(t,e,r){let n=0,i=0;for(let a=0;;a++){let s=a=t)return i+(t-n);[n,i]=r?[s.toA,s.toB]:[s.toB,s.toA]}}var kz=Te.StateField.define({create(t){return $e.Decoration.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)r.is(f0)&&(t=t.update({filter:n=>n!=r.value}));return t},provide:t=>$e.EditorView.decorations.from(t)});function Z$({margin:t=3,minSize:e=4}){return kz.init(r=>Az(r,t,e))}function Az(t,e,r){let n=new Te.RangeSetBuilder,i=t.facet(xn).side=="a",a=t.field(ps),s=1;for(let o=0;;o++){let l=o=r&&n.add(t.doc.line(u).from,t.doc.line(c).to,$e.Decoration.replace({widget:new d0(f),block:!0})),!l)break;s=t.doc.lineAt(Math.min(t.doc.length,i?l.toA:l.toB)).number}return n.finish()}var Tz=$e.EditorView.styleModule.of(new kh({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),Cz=$e.EditorView.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),K$=new Te.Compartment,Ph=new Te.Compartment,$h=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||gz;let r=[Te.Prec.low(dF),Cz,Tz,eu,$e.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(Ih)))&&this.measure()})],n=[xn.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Th);let i=Te.EditorState.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],$e.EditorView.editorAttributes.of({class:"cm-merge-a"}),Ph.of(n),r]}),a=[xn.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&a.push(Th);let s=Te.EditorState.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],$e.EditorView.editorAttributes.of({class:"cm-merge-b"}),Ph.of(a),r]});this.chunks=Oi.build(i.doc,s.doc,this.diffConf);let o=[ps.init(()=>this.chunks),K$.of(e.collapseUnchanged?Z$(e.collapseUnchanged):[])];i=i.update({effects:Te.StateEffect.appendConfig.of(o)}).state,s=s.update({effects:Te.StateEffect.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let c=document.createElement("div");c.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?u:c),this.editorDOM.appendChild(l=="a-b"?c:u),this.a=new $e.EditorView({state:i,parent:u,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new $e.EditorView({state:s,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,r){if(e.some(n=>n.docChanged)){let n=e[e.length-1],i=e.reduce((s,o)=>s.compose(o.changes),Te.ChangeSet.empty(e[0].startState.doc.length));this.chunks=r==this.a?Oi.updateA(this.chunks,n.newDoc,this.b.state.doc,i,this.diffConf):Oi.updateB(this.chunks,this.a.state.doc,n.newDoc,i,this.diffConf),r.update([...e,n.state.update({effects:u0.of(this.chunks)})]);let a=r==this.a?this.b:this.a;a.update([a.state.update({effects:u0.of(this.chunks)})]),this.scheduleMeasure()}else r.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let a=e.orientation!="b-a";if(a!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,o=this.b.dom.parentNode;s.remove(),o.remove(),this.editorDOM.insertBefore(a?s:o,this.editorDOM.firstChild),this.editorDOM.appendChild(a?o:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let a=!!this.revertDOM,s=this.revertToA,o=this.renderRevert;"revertControls"in e&&(a=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(a,s,o)}let r="highlightChanges"in e,n="gutter"in e,i="collapseUnchanged"in e;if(r||n||i){let a=[],s=[];if(r||n){let o=this.a.state.facet(xn),l=n?e.gutter!==!1:o.markGutter,u=r?e.highlightChanges!==!1:o.highlightChanges;a.push(Ph.reconfigure([xn.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:l}),l?Th:[]])),s.push(Ph.reconfigure([xn.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:l}),l?Th:[]]))}if(i){let o=K$.reconfigure(e.collapseUnchanged?Z$(e.collapseUnchanged):[]);a.push(o),s.push(o)}this.a.dispatch({effects:a}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,r,n){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",i=>this.revertClicked(i)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){Sz(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,r=e.firstChild,n=this.a.viewport,i=this.b.viewport;for(let a=0;an.to||s.fromB>i.to)break;if(s.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function J$(t){let e=t.nextSibling;return t.remove(),e}var v0=require("@codemirror/state");function w0(t,e,r){let n=[],i=t.split(` +`),a=e.split(` +`);for(let s of r){let{oldStart:o,oldLines:l,newStart:u,newLines:c}=s,f=Et.createHunk(o,l,u,c);if(s.oldLines>0){for(let d=o;di.length&&i.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(s.newLines>0){for(let d=u;da.length&&a.last()!=""&&(f.added.no_nl_at_eof=!0)}n.push(f)}return n}function y0(t,e,r){let n=e.lineAt(t.fromA).number,i=t.fromA==t.toA?0:Fh(e,t.endA)-n+1,a=r.lineAt(t.fromB).number,s=t.fromB==t.toB?0:Fh(r,t.endB)-a+1,o={oldStart:n,oldLines:i,newStart:a,newLines:s};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var hF={scanLimit:1e3,timeout:200};function Pz(t,e,r,n){let i=v0.Text.of(t.split(` +`)),a=v0.Text.of(e.split(` +`)),s=r&&n?Oi.updateB(r,i,a,n,hF):Oi.build(i,a,hF),o=[];for(let l=0;lh.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));u.added.lines=c.compareText.split(` +`).slice(f-1,d),c.compareTextHead?u.removed.lines=c.compareTextHead.split(` +`).slice(u.removed.start-1,u.removed.start-1+u.removed.count):u.removed.lines=[]}else u.added.lines=e.doc.toString().split(` +`).slice(s-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(` +`)&&(u.added.no_nl_at_eof=!0),u.removed.lines=c.compareText.split(` +`).slice(u.removed.start-1,u.removed.start-1+u.removed.count),u.removed.start+u.removed.count-1===c.compareText.split(` +`).length&&!c.compareText.endsWith(` +`)&&(u.removed.no_nl_at_eof=!0);return u}},xr=Qo.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},n=!1;for(let i of e.effects)i.is(tl)&&(r.compareText=i.value.compareText,r.compareTextHead=i.value.compareTextHead,n=(t==null?void 0:t.compareText)!==i.value.compareText,n&&(r.chunks=void 0)),i.is(tu)&&mF(r,i.value,e.state);if(r.compareText!==void 0){if(n||e.docChanged){r.isDirty=!0;let i=Rz(e,r.compareText,r.chunks,r.maxDiffTimeMs);i&&mF(r,i,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function mF(t,e,r){var i,a;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let n=r.field(el.editorInfoField).file;(a=(i=Zn.plugin)==null?void 0:i.editorIntegration.signsFeature.changeStatusBar)==null||a.display(t.hunks,n)}var b0=Qo.StateField.define({create:()=>({debouncer:(0,el.debounce)(t=>{let{state:e,compareText:r,previousChunks:n,changeDesc:i}=t,a=gF(e,r,n,i);e.field(el.editorEditorField).dispatch({effects:tu.of(a)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let n of e.effects)if(n.is(tu))return t.changeDesc=void 0,t;return!t.changeDesc&&e.changes?t.changeDesc=e.changes:t.changeDesc=(r=t.changeDesc)==null?void 0:r.composeDesc(e.changes),t}});function gF(t,e,r,n){let i=t.doc.toString(),a=performance.now(),{hunks:s,chunks:o}=pF(e,i,r,n),l=performance.now()-a;return{hunks:s,chunks:o,diffDuration:l}}function Rz(t,e,r,n){let i=t.state,a=Math.abs(t.changes.length-t.changes.newLength),s=i.field(b0);if(a>1e3||n>16)s.debouncer({state:i,compareText:e,previousChunks:r,changeDesc:s.changeDesc});else return s.changeDesc=void 0,gF(i,e,r,t.changes)}var tl=Qo.StateEffect.define(),tu=Qo.StateEffect.define();function vF(t,e){return e.update({effects:tl.of(t)})}p();p();p();var Ze;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(Ze||(Ze={}));var wF={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},yF={LINES:"lines",WORDS:"words",NONE:"none"},bF={WORD:"word",CHAR:"char"},ms;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(ms||(ms={}));p();var Iz=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],$z=RegExp("["+Iz.join("\\")+"]","g");function _F(t){return t.replace($z,"\\$&")}function _0(t){return t&&t.replace(/\\/g,"/")}function xF(t){let e,r,n,i=0;for(e=0,n=t.length;e1?r[r.length-1]:e}function EF(t,e){return e.reduce((r,n)=>r||t.startsWith(n),!1)}var kF=["a/","b/","i/","w/","c/","o/"];function Ea(t,e,r){let n=r!==void 0?[...kF,r]:kF,i=e?new RegExp(`^${_F(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=n.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 Fz(t,e){return Ea(t,"---",e)}function Oz(t,e){return Ea(t,"+++",e)}function AF(t,e={}){let r=[],n=null,i=null,a=null,s=null,o=null,l=null,u=null,c="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,m=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,E=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,k=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,y=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,T=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,P=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,F=/^new file mode (\d{6})/,D=/^deleted file mode (\d{6}),(\d{6})/,M=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function re(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function ye(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&u!==null&&(n.newName=u),n.newName&&(r.push(n),n=null)),l=null,u=null}function me(){re(),ye(),n={blocks:[],deletedLines:0,addedLines:0}}function fe(B){re();let Z;n!==null&&((Z=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(B))?(n.isCombined=!1,a=parseInt(Z[1],10),o=parseInt(Z[2],10)):(Z=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(B))?(n.isCombined=!0,a=parseInt(Z[1],10),s=parseInt(Z[2],10),o=parseInt(Z[3],10)):(B.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,n.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:B}}function Ge(B){if(n===null||i===null||a===null||o===null)return;let Z={content:B},H=n.isCombined?["+ "," +","++"]:["+"],Oe=n.isCombined?["- "," -","--"]:["-"];EF(B,H)?(n.addedLines++,Z.type=Ze.INSERT,Z.oldNumber=void 0,Z.newNumber=o++):EF(B,Oe)?(n.deletedLines++,Z.type=Ze.DELETE,Z.oldNumber=a++,Z.newNumber=void 0):(Z.type=Ze.CONTEXT,Z.oldNumber=a++,Z.newNumber=o++),i.lines.push(Z)}function oe(B,Z){let H=Z;for(;H{if(!B||B.startsWith("*"))return;let H,Oe=M[Z-1],cr=M[Z+1],Gt=M[Z+2];if(B.startsWith("diff --git")||B.startsWith("diff --combined")){if(me(),(H=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(B))&&(l=Ea(H[1],void 0,e.dstPrefix),u=Ea(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(B.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(me(),(H=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(B))&&(l=Ea(H[1],void 0,e.dstPrefix),u=Ea(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&B.startsWith(c)&&cr.startsWith(f)&&Gt.startsWith(d))&&me(),n!=null&&n.isTooBig)return;if(n&&(typeof e.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&B.length>e.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let Ie=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";fe(Ie);return}if(B.startsWith(c)&&cr.startsWith(f)||B.startsWith(f)&&Oe.startsWith(c)){if(n&&!n.oldName&&B.startsWith("--- ")&&(H=Fz(B,e.srcPrefix))){n.oldName=H,n.language=SF(n.oldName,n.language);return}if(n&&!n.newName&&B.startsWith("+++ ")&&(H=Oz(B,e.dstPrefix))){n.newName=H,n.language=SF(n.newName,n.language);return}}if(n&&(B.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){fe(B);return}if(i&&(B.startsWith("+")||B.startsWith("-")||B.startsWith(" "))){Ge(B);return}let Y=!oe(B,Z);if(n===null)throw new Error("Where is my file !!!");(H=h.exec(B))?n.oldMode=H[1]:(H=m.exec(B))?n.newMode=H[1]:(H=g.exec(B))?(n.deletedFileMode=H[1],n.isDeleted=!0):(H=v.exec(B))?(n.newFileMode=H[1],n.isNew=!0):(H=w.exec(B))?(Y&&(n.oldName=H[1]),n.isCopy=!0):(H=b.exec(B))?(Y&&(n.newName=H[1]),n.isCopy=!0):(H=E.exec(B))?(Y&&(n.oldName=H[1]),n.isRename=!0):(H=x.exec(B))?(Y&&(n.newName=H[1]),n.isRename=!0):(H=S.exec(B))?(n.isBinary=!0,n.oldName=Ea(H[1],void 0,e.srcPrefix),n.newName=Ea(H[2],void 0,e.dstPrefix),fe("Binary file")):_.test(B)?(n.isBinary=!0,fe(B)):(H=k.exec(B))?n.unchangedPercentage=parseInt(H[1],10):(H=A.exec(B))?n.changedPercentage=parseInt(H[1],10):(H=y.exec(B))?(n.checksumBefore=H[1],n.checksumAfter=H[2],H[3]&&(n.mode=H[3])):(H=T.exec(B))?(n.checksumBefore=[H[2],H[3]],n.checksumAfter=H[1]):(H=P.exec(B))?(n.oldMode=[H[2],H[3]],n.newMode=H[1]):(H=F.exec(B))?(n.newFileMode=H[1],n.isNew=!0):(H=D.exec(B))&&(n.deletedFileMode=H[1],n.isDeleted=!0)}),re(),ye(),r}p();p();p();function En(){}En.prototype={diff:function(e,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var s=this;function o(x){return x=s.postProcess(x,i),a?(setTimeout(function(){a(x)},0),!0):x}e=this.castInput(e,i),r=this.castInput(r,i),e=this.removeEmpty(this.tokenize(e,i)),r=this.removeEmpty(this.tokenize(r,i));var l=r.length,u=e.length,c=1,f=l+u;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));var d=(n=i.timeout)!==null&&n!==void 0?n:1/0,h=Date.now()+d,m=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(m[0],r,e,0,i);if(m[0].oldPos+1>=u&&g+1>=l)return o(TF(s,m[0].lastComponent,r,e,s.useLongestToken));var v=-1/0,w=1/0;function b(){for(var x=Math.max(v,-c);x<=Math.min(w,c);x+=2){var k=void 0,A=m[x-1],y=m[x+1];A&&(m[x-1]=void 0);var S=!1;if(y){var _=y.oldPos-x;S=y&&0<=_&&_=u&&g+1>=l)return o(TF(s,k.lastComponent,r,e,s.useLongestToken));m[x]=k,k.oldPos+1>=u&&(w=Math.min(w,x-1)),g+1>=l&&(v=Math.max(v,x+1))}c++}if(a)(function x(){setTimeout(function(){if(c>f||Date.now()>h)return a();b()||x()},0)})();else for(;c<=f&&Date.now()<=h;){var E=b();if(E)return E}},addToPath:function(e,r,n,i,a){var s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}},extractCommon:function(e,r,n,i,a){for(var s=r.length,o=n.length,l=e.oldPos,u=l-i,c=0;u+1h.length?g:h}),f.value=t.join(d)}else f.value=t.join(r.slice(u,u+f.count));u+=f.count,f.added||(c+=f.count)}}return a}var Dz=new En;function $F(t,e,r){return Dz.diff(t,e,r)}function CF(t,e){var r;for(r=0;re.length&&(r=t.length-e.length);var n=e.length;t.length0&&e[s]!=e[a];)a=i[a];e[s]==e[a]&&a++}a=0;for(var o=r;o0&&t[o]!=e[a];)a=i[a];t[o]==e[a]&&a++}return a}var Dh="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}",Nz=new RegExp("[".concat(Dh,"]+|\\s+|[^").concat(Dh,"]"),"ug"),Lh=new En;Lh.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};Lh.tokenize=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(e.intlSegmenter.segment(t),function(a){return a.segment})}else r=t.match(Nz)||[];var n=[],i=null;return r.forEach(function(a){/\s/.test(a)?i==null?n.push(a):n.push(n.pop()+a):/\s/.test(i)?n[n.length-1]==i?n.push(n.pop()+a):n.push(i+a):n.push(a),i=a}),n};Lh.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};Lh.postProcess=function(t,e){if(!t||e.oneChangePerToken)return t;var r=null,n=null,i=null;return t.forEach(function(a){a.added?n=a:a.removed?i=a:((n||i)&&IF(r,i,n,a),r=a,n=null,i=null)}),(n||i)&&IF(r,i,n,null),t};function IF(t,e,r,n){if(e&&r){var i=e.value.match(/^\s*/)[0],a=e.value.match(/\s*$/)[0],s=r.value.match(/^\s*/)[0],o=r.value.match(/\s*$/)[0];if(t){var l=CF(i,s);t.value=S0(t.value,s,l),e.value=ru(e.value,l),r.value=ru(r.value,l)}if(n){var u=PF(a,o);n.value=x0(n.value,o,u),e.value=Mh(e.value,u),r.value=Mh(r.value,u)}}else if(r)t&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(t&&n){var c=n.value.match(/^\s*/)[0],f=e.value.match(/^\s*/)[0],d=e.value.match(/\s*$/)[0],h=CF(c,f);e.value=ru(e.value,h);var m=PF(ru(c,h),d);e.value=Mh(e.value,m),n.value=x0(n.value,c,m),t.value=S0(t.value,c,c.slice(0,c.length-m.length))}else if(n){var g=n.value.match(/^\s*/)[0],v=e.value.match(/\s*$/)[0],w=RF(v,g);e.value=Mh(e.value,w)}else if(t){var b=t.value.match(/\s*$/)[0],E=e.value.match(/^\s*/)[0],x=RF(b,E);e.value=ru(e.value,x)}}var FF=new En;FF.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(Dh,"]+|[^\\S\\n\\r]+|[^").concat(Dh,"]"),"ug");return t.match(e)||[]};function OF(t,e,r){return FF.diff(t,e,r)}var T0=new En;T0.tokenize=function(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` +`));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;i{let n=t(e).trim(),i=t(r).trim();return jz(n,i)/(n.length+i.length)}}function nl(t){function e(n,i,a=new Map){let s=1/0,o;for(let l=0;l0||o.indexB>0)&&(E=v.concat(E)),(n.length>d||i.length>h)&&(E=E.concat(b)),E}return r}var Lt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},gs={matching:yF.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:bF.WORD,colorScheme:ms.LIGHT},ni="/",MF=rl(t=>t.value),Gz=nl(MF);function P0(t){return t.indexOf("dev/null")!==-1}function qz(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function zz(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function il(t){switch(t){case Ze.CONTEXT:return Lt.CONTEXT;case Ze.INSERT:return Lt.INSERTS;case Ze.DELETE:return Lt.DELETES}}function al(t){switch(t){case ms.DARK:return"d2h-dark-color-scheme";case ms.AUTO:return"d2h-auto-color-scheme";case ms.LIGHT:default:return"d2h-light-color-scheme"}}function Vz(t){return t?2:1}function ka(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function rn(t,e,r=!0){let n=Vz(e);return{prefix:t.substring(0,n),content:r?ka(t.substring(n)):t.substring(n)}}function vs(t){let e=_0(t.oldName),r=_0(t.newName);if(e!==r&&!P0(e)&&!P0(r)){let n=[],i=[],a=e.split(ni),s=r.split(ni),o=a.length,l=s.length,u=0,c=o-1,f=l-1;for(;uu&&f>u&&a[c]===s[f];)i.unshift(s[f]),c-=1,f-=1;let d=n.join(ni),h=i.join(ni),m=a.slice(u,c+1).join(ni),g=s.slice(u,f+1).join(ni);return d.length&&h.length?d+ni+"{"+m+" \u2192 "+g+"}"+ni+h:d.length?d+ni+"{"+m+" \u2192 "+g+"}":h.length?"{"+m+" \u2192 "+g+"}"+ni+h:e+" \u2192 "+r}else return P0(r)?e:r}function sl(t){return`d2h-${xF(vs(t)).toString().slice(-6)}`}function ol(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 Nh(t,e,r,n={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},gs),n),l=rn(t,r,!1),u=rn(e,r,!1);if(l.content.length>a||u.content.length>a)return{oldLine:{prefix:l.prefix,content:ka(l.content)},newLine:{prefix:u.prefix,content:ka(u.content)}};let c=o==="char"?$F(l.content,u.content):OF(l.content,u.content),f=[];if(o==="word"&&i==="words"){let h=c.filter(v=>v.removed),m=c.filter(v=>v.added);Gz(m,h).forEach(v=>{v[0].length===1&&v[1].length===1&&MF(v[0][0],v[1][0]){let g=m.added?"ins":m.removed?"del":null,v=f.indexOf(m)>-1?' class="d2h-change"':"",w=ka(m.value);return g!==null?`${h}<${g}${v}>${w}`:`${h}${w}`},"");return{oldLine:{prefix:l.prefix,content:qz(d)},newLine:{prefix:u.prefix,content:zz(d)}}}var DF="file-summary",Wz="icon",Yz={colorScheme:gs.colorScheme},Bh=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Yz),r)}render(e){let r=e.map(n=>this.hoganUtils.render(DF,"line",{fileHtmlId:sl(n),oldName:n.oldName,newName:n.newName,fileName:vs(n),deletedLines:"-"+n.deletedLines,addedLines:"+"+n.addedLines},{fileIcon:this.hoganUtils.template(Wz,ol(n))})).join(` +`);return this.hoganUtils.render(DF,"wrapper",{colorScheme:al(this.config.colorScheme),filesNumber:e.length,files:r})}};p();var I0=Object.assign(Object.assign({},gs),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),iu="generic",LF="line-by-line",Xz="icon",Zz="tag",au=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},I0),r)}render(e){let r=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(` +`);return this.hoganUtils.render(iu,"wrapper",{colorScheme:al(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(LF,"file-diff"),i=this.hoganUtils.template(iu,"file-path"),a=this.hoganUtils.template(Xz,"file"),s=this.hoganUtils.template(Zz,ol(e));return n.render({file:e,fileHtmlId:sl(e),diffs:r,filePath:i.render({fileDiffName:vs(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(iu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Lt})}generateFileHtml(e){let r=nl(rl(n=>rn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i=this.hoganUtils.render(iu,"block-header",{CSSLineClass:Lt,blockHeader:e.isTooBig?n.header:ka(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,u])=>{let{left:c,right:f}=this.processChangedLines(e,e.isCombined,l,u);i+=c,i+=f});else if(a.length)a.forEach(l=>{let{prefix:u,content:c}=rn(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:Lt.CONTEXT,prefix:u,content:c,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:u}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=u}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(` +`)}applyLineGroupping(e){let r=[],n=[],i=[];for(let a=0;a0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ze.CONTEXT?r.push([[s],[],[]]):s.type===Ze.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ze.INSERT&&n.length>0?i.push(s):s.type===Ze.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=Oh(e.concat(r).map(o=>o.content.length));return i{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(` +`);return this.hoganUtils.render(su,"wrapper",{colorScheme:al(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(Kz,"file-diff"),i=this.hoganUtils.template(su,"file-path"),a=this.hoganUtils.template(Jz,"file"),s=this.hoganUtils.template(Qz,ol(e));return n.render({file:e,fileHtmlId:sl(e),diffs:r,filePath:i.render({fileDiffName:vs(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(su,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Lt})}}generateFileHtml(e){let r=nl(rl(n=>rn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,u])=>{let{left:c,right:f}=this.processChangedLines(e.isCombined,l,u);i.left+=c,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:u,content:c}=rn(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Lt.CONTEXT,prefix:u,content:c,number:l.oldNumber},{type:Lt.CONTEXT,prefix:u,content:c,number:l.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:l,right:u}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=u}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((n,i)=>({left:n.left+i.left,right:n.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],n=[],i=[];for(let a=0;a0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ze.CONTEXT?r.push([[s],[],[]]):s.type===Ze.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ze.INSERT&&n.length>0?i.push(s):s.type===Ze.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=Oh(e.concat(r).map(o=>o.content.length));return i'),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(n.rp("'),n.b(n.v(n.f("fileName",t,e,0))),n.b(""),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(' '),n.b(n.v(n.f("addedLines",t,e,0))),n.b(""),n.b(` +`+r),n.b(' '),n.b(n.v(n.f("deletedLines",t,e,0))),n.b(""),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b(""),n.fl()},partials:{"'),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b(' Files changed ('),n.b(n.v(n.f("filesNumber",t,e,0))),n.b(")"),n.b(` +`+r),n.b(' hide'),n.b(` +`+r),n.b(' show'),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b('
    '),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("files",t,e,0))),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["generic-block-header"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b(""),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b('
'),n.s(n.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),n.s(n.f("blockHeader",t,e,1),t,e,1,0,0,"")||n.b(" "),n.b("
"),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["generic-empty-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b(""),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b(" File without changes"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["generic-file-path"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b(''),n.b(` +`+r),n.b(n.rp("'),n.b(n.v(n.f("fileDiffName",t,e,0))),n.b(""),n.b(` +`+r),n.b(n.rp(""),n.b(` +`+r),n.b('"),n.fl()},partials:{""),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("lineNumber",t,e,0))),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.s(n.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("prefix",i,a,0))),s.b(""),s.b(` +`+r)}),t.pop()),n.s(n.f("prefix",t,e,1),t,e,1,0,0,"")||(n.b('  '),n.b(` +`+r)),n.s(n.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("content",i,a,0))),s.b(""),s.b(` +`+r)}),t.pop()),n.s(n.f("content",t,e,1),t,e,1,0,0,"")||(n.b('
'),n.b(` +`+r)),n.b("
"),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["generic-wrapper"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("content",t,e,0))),n.b(` +`+r),n.b("
"),n.fl()},partials:{},subs:{}});dt["icon-file-added"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('"),n.fl()},partials:{},subs:{}});dt["icon-file-changed"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('"),n.fl()},partials:{},subs:{}});dt["icon-file-deleted"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('"),n.fl()},partials:{},subs:{}});dt["icon-file-renamed"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('"),n.fl()},partials:{},subs:{}});dt["icon-file"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('"),n.fl()},partials:{},subs:{}});dt["line-by-line-file-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("filePath",t,e,0))),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("diffs",t,e,0))),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.fl()},partials:{},subs:{}});dt["line-by-line-numbers"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(n.v(n.f("oldNumber",t,e,0))),n.b("
"),n.b(` +`+r),n.b('
'),n.b(n.v(n.f("newNumber",t,e,0))),n.b("
"),n.fl()},partials:{},subs:{}});dt["side-by-side-file-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("filePath",t,e,0))),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(" "),n.b(n.t(n.d("diffs.left",t,e,0))),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(" "),n.b(n.t(n.d("diffs.right",t,e,0))),n.b(` +`+r),n.b(" "),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.b(` +`+r),n.b("
"),n.fl()},partials:{},subs:{}});dt["tag-file-added"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('ADDED'),n.fl()},partials:{},subs:{}});dt["tag-file-changed"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('CHANGED'),n.fl()},partials:{},subs:{}});dt["tag-file-deleted"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('DELETED'),n.fl()},partials:{},subs:{}});dt["tag-file-renamed"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('RENAMED'),n.fl()},partials:{},subs:{}});var lu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let n=Object.entries(r).reduce((i,[a,s])=>{let o=D0.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},dt),e),n)}static compile(e){return D0.compile(e,{asString:!1})}render(e,r,n,i,a){let s=this.templateKey(e,r);try{return this.preCompiledTemplates[s].render(n,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var tV=Object.assign(Object.assign(Object.assign({},I0),$0),{outputFormat:wF.LINE_BY_LINE,drawFileList:!0});function Uh(t,e={}){let r=Object.assign(Object.assign({},tV),e),n=typeof t=="string"?AF(t,r):t,i=new lu(r),{colorScheme:a}=r,s={colorScheme:a},o=r.drawFileList?new Bh(i,s).render(n):"",l=r.outputFormat==="side-by-side"?new ou(i,r).render(n):new au(i,r).render(n);return o+l}var zF=bt(GF());var uu=require("obsidian"),L0=cu.StateEffect.define();function ws(t,e){let r=t.state,n=r.field(Gh),i=r.field(xr),a=r.doc.lineAt(e!=null?e:r.selection.main.head).number,s=Et.findHunk(a,i==null?void 0:i.hunks)[0];if(!s)return;let o=r.doc.line(Math.max(1,s.added.start)).from,l=n.has(o);return r.field(uu.editorEditorField).dispatch({effects:L0.of({pos:o,add:!l})})}var Gh=cu.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let n of e.effects)n.is(L0)&&(n.value.add?t.add(n.value.pos):t.delete(n.value.pos));for(let n of t)r.add(e.changes.mapPos(n));return r}}),VF=cu.StateField.define({create:t=>qF(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(tl)||r.is(L0))?qF(e.state):t},provide:t=>jh.showTooltip.computeN([t],e=>e.field(t))}),WF=jh.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function qF(t){let e=t.field(xr);return e?[...t.field(Gh)].map(n=>{let i=t.doc.lineAt(n),a=Et.findHunk(i.number,e.hunks)[0];if(a)return{pos:n,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>rV(a,t,n)}}).filter(n=>n!==void 0):[]}function rV(t,e,r){let n=Et.createPatch("file",[t],"10064",!1).join(` +`)+` +`,i=Uh(n,{colorScheme:zF.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),a=new DOMParser().parseFromString(i,"text/html").querySelector(".d2h-file-diff"),s=document.createElement("div"),o=document.createElement("div");o.addClass("tooltip-toolbar");let l=(h,m)=>{let g=document.createElement("div");return(0,uu.setIcon)(g,h),g.setAttr("aria-label",m),g.addClass("clickable-icon"),g},u=l("x","Close hunk"),c=l("plus","Stage hunk"),f=l("undo","Reset hunk");o.appendChild(u),o.appendChild(c),o.appendChild(f),s.appendChild(o),s.appendChild(a),s.addClass("git-diff-tooltip","git-diff");let d=e.field(uu.editorEditorField);return u.onclick=()=>{ws(d,r)},c.onclick=()=>{let h=Zn.plugin;h&&(h.promiseQueue.addTask(()=>h.hunkActions.stageHunk(r)),ws(d,r))},f.onclick=()=>{let h=Zn.plugin;h&&(h.hunkActions.resetHunk(r),ws(d,r))},{dom:s,update:h=>{r=h.changes.mapPos(r)}}}function YF(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let n=await e.vault.adapter.read(r),a=await new Eh(e,n).openAndGetReslt();a!==void 0&&(await e.vault.adapter.write(r,a),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let r=e.workspace.getLeavesOfType(Dt.type),n;r.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:Dt.type})):n=r.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let r=e.workspace.getLeavesOfType(Qr.type),n;r.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:Qr.type})):n=r.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;{let i=t.gitManager.getRelativeRepoPath(n.path,!0);t.tools.openDiff({aFile:i,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:n})=>{if(n)return C$(r,n,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:n})=>{if(n)return P$(n,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;t.addFileToGitignore(n.path,n instanceof kn.TFolder).catch(i=>t.displayError(i))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let n=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:n})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),kn.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let n=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:n})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;t.promiseQueue.addTask(()=>t.stageFile(n))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;t.promiseQueue.addTask(()=>t.unstageFile(n))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>t.editRemotes().catch(r=>t.displayError(r))}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>t.removeRemote().catch(r=>t.displayError(r))}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>t.setUpstreamBranch().catch(r=>t.displayError(r))}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new ze(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 kn.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new kn.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>t.createNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>t.cloneNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(await t.isAllInitialized())try{let r=await t.updateCachedStatus();if(r.changed.length+r.staged.length>500){t.displayError("Too many changes to display");return}new Sh(t,r.all).open()}catch(r){t.displayError(r)}}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{let r=await t.discardAll();switch(r){case"discard":new kn.Notice("Discarded all changes in tracked files.");break;case"delete":new kn.Notice("Discarded all files.");break;case!1:break;default:Md(r)}}}),t.addCommand({id:"pause-automatic-routines",name:"Pause/Resume automatic routines",callback:()=>{let r=!t.localStorage.getPausedAutomatics();t.localStorage.setPausedAutomatics(r),r?(t.automaticsManager.unload(),new kn.Notice("Paused automatic routines.")):(t.automaticsManager.reload("commit","push","pull"),new kn.Notice("Resumed automatic routines."))}}),t.addCommand({id:"raw-command",name:"Raw command",checkCallback:r=>{let n=t.gitManager;if(r)return n instanceof _e;t.tools.runRawCommand().catch(i=>t.displayError(i))}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var r;return(r=t.settingsTab)==null?void 0:r.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}}),t.addCommand({id:"reset-hunk",name:"Reset hunk",editorCheckCallback(r,n,i){if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.resetHunk()}}),t.addCommand({id:"stage-hunk",name:"Stage hunk",editorCheckCallback:(r,n,i)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.promiseQueue.addTask(()=>t.hunkActions.stageHunk())}}),t.addCommand({id:"preview-hunk",name:"Preview hunk",editorCheckCallback:(r,n,i)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;let a=t.hunkActions.editor.editor;ws(a)}}),t.addCommand({id:"next-hunk",name:"Go to next hunk",editorCheckCallback:(r,n,i)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("next")}}),t.addCommand({id:"prev-hunk",name:"Go to previous hunk",editorCheckCallback:(r,n,i)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("prev")}})}p();var qh=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":",this.app=e.app}migrate(){let e=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let r of e){let n=localStorage.getItem(this.prefix+r);this.app.loadLocalStorage(this.prefix+r)==null&&n!=null&&n!=null&&(this.app.saveLocalStorage(this.prefix+r,n),localStorage.removeItem(this.prefix+r))}}getPassword(){return this.app.loadLocalStorage(this.prefix+"password")}setPassword(e){return this.app.saveLocalStorage(this.prefix+"password",e)}getUsername(){return this.app.loadLocalStorage(this.prefix+"username")}setUsername(e){return this.app.saveLocalStorage(this.prefix+"username",e)}getHostname(){return this.app.loadLocalStorage(this.prefix+"hostname")}setHostname(e){return this.app.saveLocalStorage(this.prefix+"hostname",e)}getConflict(){return this.app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(e){return this.app.saveLocalStorage(this.prefix+"conflict",`${e}`)}getLastAutoPull(){return this.app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPull",e)}getLastAutoBackup(){return this.app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(e){return this.app.saveLocalStorage(this.prefix+"lastAutoBackup",e)}getLastAutoPush(){return this.app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPush",e)}getGitPath(){return this.app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(e){return this.app.saveLocalStorage(this.prefix+"gitPath",e)}getPATHPaths(){var e,r;return(r=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?r:[]}setPATHPaths(e){return this.app.saveLocalStorage(this.prefix+"PATHPaths",e.join(":"))}getEnvVars(){var e;return JSON.parse((e=this.app.loadLocalStorage(this.prefix+"envVars"))!=null?e:"[]")}setEnvVars(e){return this.app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(e))}getPluginDisabled(){return this.app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(e){return this.app.saveLocalStorage(this.prefix+"pluginDisabled",`${e}`)}getPausedAutomatics(){return this.app.loadLocalStorage(this.prefix+"pausedAutomatics")=="true"}setPausedAutomatics(e){return this.app.saveLocalStorage(this.prefix+"pausedAutomatics",`${e}`)}};p();var ll=require("obsidian");var fu=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let r=await this.plugin.gitManager.branchInfo(),n=r.tracking?Ri(r.tracking)[0]:null;if(!n)return!1;let i=await this.plugin.gitManager.getRemoteUrl(n);if(i!=null&&i.includes("github.com")){let a=[],s=this.plugin.gitManager;for(let o of e){let l=this.plugin.app.vault.getAbstractFileByPath(o.vaultPath),u=!1;if(l instanceof ll.TFile)l.stat.size>=1e8&&(u=!0);else{let c=await this.plugin.app.vault.adapter.stat(o.vaultPath);c&&c.size>=1e8&&(u=!0)}if(u){let c=!1;s instanceof _e&&(c=await s.isFileTrackedByLFS(o.path)),c||a.push(o)}}if(a.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big: +- ${a.map(o=>o.vaultPath).join(` +- `)} +Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(Ro,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(n=>{n.getDisplayText()!=""&&Ro.startsWith(n.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(Ro,"/",!0)}openDiff({aFile:e,bFile:r,aRef:n,bRef:i,event:a}){var l,u;let s=this.plugin.settings.diffStyle;ll.Platform.isMobileApp&&(s="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:n,bRef:i};s=="split"?(l=bn(this.plugin.app,a))==null||l.setViewState({type:ma.type,active:!0,state:o}):s=="git_unified"&&((u=bn(this.plugin.app,a))==null||u.setViewState({type:ga.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof _e))return;let n=await new ze(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();n!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let i=new ll.Notice(`Running '${n}'...`,999999);try{let a=await e.rawCommand(n);a?(i.setMessage(a),window.setTimeout(()=>i.hide(),5e3)):i.hide()}catch(a){throw i.hide(),a}})}};p();var zh=require("obsidian");var ys=class extends zh.ItemView{constructor(r,n){super(r);this.plugin=n;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return ga.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return ga.name}getIcon(){return ga.icon}async setState(r,n){this.state=r,zh.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let n=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!n){if(this.plugin.gitManager instanceof _e&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(` +`);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);n=[...`--- /dev/null ++++ ${this.state.bFile} +@@ -0,0 +1,${a.split(` +`).length} @@`.split(` +`),...a.split(` +`).map(o=>`+${o}`)].join(` +`)}}if(n){let a=this.parser.parseFromString(Uh(n),"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.bFile})}}finally{this.gettingDiff=!1}}}};p();var Mi=require("obsidian");var ul=require("@codemirror/commands");var Vh=require("@codemirror/search"),cl=require("@codemirror/state"),an=require("@codemirror/view");var bs=class extends Mi.ItemView{constructor(r,n){super(r);this.plugin=n;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",i=>{this.state.bRef==null&&i.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(i,a)=>{this.state.bRef==null&&(i.path===this.state.bFile||a===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,Mi.debounce)(i=>{let a=this.state.bFile;a&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(a),i).catch(s=>this.plugin.displayError(s)))},1e3,!1)}getViewType(){return ma.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3));let i;return this.state.bRef==null?i=" (Working Tree)":this.state.bRef==""?i=" (Index)":i="("+this.state.bRef.substring(0,7)+")",`Diff: ${n} ${i}`}return ma.name}getIcon(){return ma.icon}async setState(r,n){this.state=r,Mi.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,n),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,n){try{return await this.plugin.gitManager.show(r,n,!1)}catch(i){if(i instanceof br&&(i.message.includes("does not exist")||i.message.includes("unknown revision or path")||i.message.includes("exists on disk, but not in")||i.message.includes("fatal: bad object")))return i.message.includes("fatal: bad object")&&this.plugin.displayError(i.message),"";throw i}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let n=await this.app.vault.adapter.read(this.state.bFile);if(n!=r.state.doc.toString()){let i=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n},annotations:[cl.Transaction.remote.of(!0)]});r.dispatch(i)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,n=this.mergeView.b;this.refreshing=!0;let i=await this.gitShow(this.state.aRef,this.state.aFile),a;if(this.state.bRef!=null&&(a=await this.gitShow(this.state.bRef,this.state.bFile)),i!=r.state.doc.toString()){let s=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i}});r.dispatch(s)}if(a!=null&&a!=n.state.doc.toString()){let s=n.state.update({changes:{from:0,to:n.state.doc.length,insert:a}});n.dispatch(s)}this.refreshing=!1}renderButtons(){let r=document.createElement("div"),n=r.createDiv();if(n.addClass("clickable-icon"),n.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,Mi.setIcon)(n,this.state.bRef==null?"plus":"minus"),n.onmousedown=async i=>{var h;let a=this.mergeView.b,s=this.mergeView.a,o=g0(a.state),l=(h=r.parentElement)==null?void 0:h.indexOf(r),u=o.chunks[l],c=y0(u,s.state.doc,a.state.doc),f=w0(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[c])[0],d=Et.createPatch(this.state.bFile,[f],"100644",this.state.bRef!=null).join(` +`)+` +`;await this.plugin.gitManager.applyPatch(d),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let i=r.createDiv();i.addClass("clickable-icon"),i.setAttr("aria-label","Reset hunk"),(0,Mi.setIcon)(i,"undo"),i.onmousedown=a=>{var f;let s=this.mergeView.a,o=this.mergeView.b,l=g0(o.state),u=(f=r.parentElement)==null?void 0:f.indexOf(r),c=l.chunks[u];if(c){let d=c.fromA,h=c.toA,m=c.fromB,g=c.toB,v=s.state.sliceDoc(d,Math.max(d,h-1));d!=h&&g<=o.state.doc.length&&(v+=s.state.lineBreak),o.dispatch({changes:{from:m,to:Math.min(o.state.doc.length,g),insert:v},userEvent:"revert"})}}}return r.onmousedown=i=>{i.preventDefault(),i.stopPropagation()},r}async createMergeView(){var r,n,i;if((r=this.state)!=null&&r.aFile&&((n=this.state)!=null&&n.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(i=this.mergeView)==null||i.destroy();let a=this.containerEl.children[1];a.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let s=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,an.lineNumbers)(),(0,Vh.highlightSelectionMatches)(),(0,an.drawSelection)(),an.keymap.of([...ul.standardKeymap,ul.indentWithTab]),(0,ul.history)(),(0,Vh.search)(),an.EditorView.lineWrapping],u=this,c=an.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(w=>w.annotation(cl.Transaction.remote))){let w=g.state.doc.toString();u.fileSaveDebouncer(w)}}})),f={doc:s,extensions:[...l,an.EditorView.editable.of(!1),cl.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(c):d.push(an.EditorView.editable.of(!1),cl.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};a.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let m=this.plugin.gitManager instanceof _e&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new $h({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:m?()=>this.renderButtons():void 0,revertControls:m?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:a}),this.refreshing=!1}}};p();var yM=require("obsidian");p();p();p();var XF="5";var ZF,KF,JF;typeof window!="undefined"&&((JF=(KF=(ZF=window.__svelte)!=null?ZF:window.__svelte={}).v)!=null?JF:KF.v=new Set).add(XF);p();p();p();var fl="[",Aa="[!",_s="]",Di={};var Ve=Symbol(),sn=Symbol("filename"),QF=Symbol("hmr"),eO="http://www.w3.org/1999/xhtml";p();p();p();p();var Wh=!0;p();var L=!1;p();var on=Array.isArray,tO=Array.prototype.indexOf,du=Array.from,N0=Object.keys,Wt=Object.defineProperty,Sr=Object.getOwnPropertyDescriptor,B0=Object.getOwnPropertyDescriptors,H0=Object.prototype,rO=Array.prototype,dl=Object.getPrototypeOf,U0=Object.isExtensible;function j0(t){return typeof t=="function"}var ar=()=>{};function hu(t){for(var e=0;e{t=n,e=i});return{promise:r,resolve:t,reject:e}}p();p();var Er=Symbol("$state"),pu=Symbol("legacy props"),iO=Symbol(""),Yh=Symbol("proxy path"),hl=new class extends Error{constructor(){super(...arguments);vt(this,"name","StaleReactionError");vt(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var mu=3,ln=8;p();p();function aO(){if(L){let t=new Error("await_outside_boundary\nCannot await outside a `` with a `pending` snippet\nhttps://svelte.dev/e/await_outside_boundary");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/await_outside_boundary")}function gu(t){if(L){let e=new Error(`lifecycle_outside_component +\`${t}(...)\` can only be used during component initialisation +https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function sO(){if(L){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function G0(){if(L){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function oO(){if(L){let t=new Error(`derived_references_self +A derived value cannot reference itself recursively +https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function lO(t){if(L){let e=new Error(`effect_in_teardown +\`${t}\` cannot be used inside an effect cleanup function +https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function cO(){if(L){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function uO(t){if(L){let e=new Error(`effect_orphan +\`${t}\` can only be used inside an effect (e.g. during component initialisation) +https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function fO(){if(L){let t=new Error(`effect_update_depth_exceeded +Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state +https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function dO(){if(L){let t=new Error("flush_sync_in_effect\nCannot use `flushSync` inside an effect\nhttps://svelte.dev/e/flush_sync_in_effect");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/flush_sync_in_effect")}function hO(){if(L){let t=new Error(`hydration_failed +Failed to hydrate the application +https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function pO(t){if(L){let e=new Error(`props_invalid_value +Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value +https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function mO(t){if(L){let e=new Error(`rune_outside_svelte +The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files +https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function gO(){if(L){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function vO(){if(L){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function wO(){if(L){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}p();p();p();var xs="font-weight: bold",Ss="font-weight: normal";function yO(t){L?console.warn(`%c[svelte] await_reactivity_loss +%cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\` +https://svelte.dev/e/await_reactivity_loss`,xs,Ss):console.warn("https://svelte.dev/e/await_reactivity_loss")}function bO(t,e){L?console.warn(`%c[svelte] await_waterfall +%cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app +https://svelte.dev/e/await_waterfall`,xs,Ss):console.warn("https://svelte.dev/e/await_waterfall")}function _O(t,e,r){L?console.warn(`%c[svelte] hydration_attribute_changed +%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value +https://svelte.dev/e/hydration_attribute_changed`,xs,Ss):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Es(t){L?console.warn(`%c[svelte] hydration_mismatch +%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"} +https://svelte.dev/e/hydration_mismatch`,xs,Ss):console.warn("https://svelte.dev/e/hydration_mismatch")}function xO(){L?console.warn(`%c[svelte] lifecycle_double_unmount +%cTried to unmount a component that was not mounted +https://svelte.dev/e/lifecycle_double_unmount`,xs,Ss):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Xh(t){L?console.warn(`%c[svelte] state_proxy_equality_mismatch +%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results +https://svelte.dev/e/state_proxy_equality_mismatch`,xs,Ss):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function SO(t){L?console.warn(`%c[svelte] transition_slide_display +%cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\` +https://svelte.dev/e/transition_slide_display`,xs,Ss):console.warn("https://svelte.dev/e/transition_slide_display")}var ae=!1;function Xt(t){ae=t}var pe;function et(t){if(t===null)throw Es(),Di;return pe=t}function Zt(){return et(Bt(pe))}function j(t){if(ae){if(Bt(pe)!==null)throw Es(),Di;pe=t}}function pl(t=1){if(ae){for(var e=t,r=pe;e--;)r=Bt(r);pe=r}}function ks(){for(var t=0,e=pe;;){if(e.nodeType===ln){var r=e.data;if(r===_s){if(t===0)return e;t-=1}else(r===fl||r===Aa)&&(t+=1)}var n=Bt(e);e.remove(),e=n}}function Zh(t){if(!t||t.nodeType!==ln)throw Es(),Di;return t.data}p();p();p();p();function Kh(t){return t===this.v}function Jh(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Qh(t){return!Jh(t,this.v)}p();var An=!1,Li=!1,ii=!1;p();p();p();var vu=null;function ai(t){let e=Error(),r=e.stack;if(!r)return null;let n=r.split(` +`),i=[` +`];for(let a=0;a"}`,a=e.ctx;a!==null;)i+=` +${n}in ${(o=a.function)==null?void 0:o[sn].split("/").pop()}`,a=a.p;return{message:t.message+` +${i} +`,stack:(l=t.stack)==null?void 0:l.split(` +`).filter(u=>!u.includes("svelte/src/internal")).join(` +`)}}}function AO(t){let e=V0.get(t);e&&(Wt(t,"message",{value:e.message}),Wt(t,"stack",{value:e.stack}))}p();var bu=[],Y0=[];function TO(){var t=bu;bu=[],hu(t)}function aV(){var t=Y0;Y0=[],hu(t)}function Br(t){bu.length===0&&queueMicrotask(TO),bu.push(t)}function CO(){bu.length>0&&TO(),Y0.length>0&&aV()}p();var Pie=589952;function np(){for(var t=Q.b;t!==null&&!t.has_pending_snippet();)t=t.parent;return t===null&&aO(),t}p();p();var Ui=null;function J0(t){Ui=t}var xu=new Set;function As(t){var e=2050,r=se!==null&&se.f&2?se:null;Q===null||r!==null&&r.f&256?e|=256:Q.f|=524288;let n={ctx:ve,deps:null,effects:null,equals:Kh,f:e,fn:t,reactions:null,rv:0,v:Ve,wv:0,parent:r!=null?r:Q,ac:null};return L&&ii&&(n.created=ai("CreatedAt")),n}function Q0(t,e){let r=Q;r===null&&sO();var n=r.b,i=void 0,a=Hr(Ve),s=null,o=!se;return PO(()=>{var h;L&&(Ui=Q);try{var l=t()}catch(m){l=Promise.reject(m)}L&&(Ui=null);var u=()=>l;i=(h=s==null?void 0:s.then(u,u))!=null?h:Promise.resolve(l),s=i;var c=Se,f=n.pending;o&&(n.update_pending_count(1),f||c.increment());let d=(m,g=void 0)=>{s=null,Ui=null,f||c.activate(),g?g!==hl&&(a.f|=8388608,oi(a,g)):(a.f&8388608&&(a.f^=8388608),oi(a,m),L&&e!==void 0&&(xu.add(a),setTimeout(()=>{xu.has(a)&&(bO(a.label,e),xu.delete(a))}))),o&&(n.update_pending_count(-1),f||c.decrement()),sp()};if(i.then(d,m=>d(null,m||"unknown")),c)return()=>{queueMicrotask(()=>c.neuter())}}),L&&(a.f|=4194304),new Promise(l=>{function u(c){function f(){c===i?l(a):u(i)}c.then(f,f)}u(i)})}function Rt(t){let e=As(t);return op(e),e}function Ts(t){let e=As(t);return e.equals=Qh,e}function ip(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;rQ0(l))).then(l=>{i==null||i.activate(),s();try{r([...t.map(n),...l])}catch(u){a.f&16384||ml(u,a)}i==null||i.deactivate(),sp()}).catch(l=>{o.error(l)})}function oV(){var t=Q,e=se,r=ve;return function(){Ht(t),Ct(e),Ca(r),L&&J0(null)}}function sp(){Ht(null),Ct(null),Ca(null),L&&J0(null)}var ku=new Set,Se=null,Au=null,Pa=null,X0=new Set,fp=[];function IO(){let t=fp.shift();fp.length>0&&queueMicrotask(IO),t()}var Rs=[],pp=null,ty=!1,cp=!1,vl,wl,Ra,Tu,Cu,Ps,yl,Ia,$a,bl,Pu,Ru,Rn,$O,up,ry,dp=class dp{constructor(){wt(this,Rn);vt(this,"current",new Map);wt(this,vl,new Map);wt(this,wl,new Set);wt(this,Ra,0);wt(this,Tu,null);wt(this,Cu,!1);wt(this,Ps,[]);wt(this,yl,[]);wt(this,Ia,[]);wt(this,$a,[]);wt(this,bl,[]);wt(this,Pu,[]);wt(this,Ru,[]);vt(this,"skipped_effects",new Set)}process(e){var a;Rs=[],Au=null;var r=null;if(ku.size>1){r=new Map,Pa=new Map;for(let[s,o]of this.current)r.set(s,{v:s.v,wv:s.wv}),s.v=o;for(let s of ku)if(s!==this)for(let[o,l]of le(s,vl))r.has(o)||(r.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(let s of e)vi(this,Rn,$O).call(this,s);if(le(this,Ps).length===0&&le(this,Ra)===0){vi(this,Rn,ry).call(this);var n=le(this,Ia),i=le(this,$a);Ot(this,Ia,[]),Ot(this,$a,[]),Ot(this,bl,[]),Au=Se,Se=null,RO(n),RO(i),Se===null?Se=this:ku.delete(this),(a=le(this,Tu))==null||a.resolve()}else vi(this,Rn,up).call(this,le(this,Ia)),vi(this,Rn,up).call(this,le(this,$a)),vi(this,Rn,up).call(this,le(this,bl));if(r){for(let[s,{v:o,wv:l}]of r)s.wv<=l&&(s.v=o);Pa=null}for(let s of le(this,Ps))Gi(s);for(let s of le(this,yl))Gi(s);Ot(this,Ps,[]),Ot(this,yl,[])}capture(e,r){le(this,vl).has(e)||le(this,vl).set(e,r),this.current.set(e,e.v)}activate(){Se=this}deactivate(){Se=null,Au=null;for(let e of X0)if(X0.delete(e),e(),Se!==null)break}neuter(){Ot(this,Cu,!0)}flush(){Rs.length>0?ny():vi(this,Rn,ry).call(this),Se===this&&(le(this,Ra)===0&&ku.delete(this),this.deactivate())}increment(){Ot(this,Ra,le(this,Ra)+1)}decrement(){if(Ot(this,Ra,le(this,Ra)-1),le(this,Ra)===0){for(let e of le(this,Pu))mt(e,2048),ci(e);for(let e of le(this,Ru))mt(e,4096),ci(e);Ot(this,Ia,[]),Ot(this,$a,[]),this.flush()}else this.deactivate()}add_callback(e){le(this,wl).add(e)}settled(){var e;return((e=le(this,Tu))!=null?e:Ot(this,Tu,nO())).promise}static ensure(){if(Se===null){let e=Se=new dp;ku.add(Se),cp||dp.enqueue(()=>{Se===e&&e.flush()})}return Se}static enqueue(e){fp.length===0&&queueMicrotask(IO),fp.unshift(e)}};vl=new WeakMap,wl=new WeakMap,Ra=new WeakMap,Tu=new WeakMap,Cu=new WeakMap,Ps=new WeakMap,yl=new WeakMap,Ia=new WeakMap,$a=new WeakMap,bl=new WeakMap,Pu=new WeakMap,Ru=new WeakMap,Rn=new WeakSet,$O=function(e){var c;e.f^=1024;for(var r=e.first;r!==null;){var n=r.f,i=(n&96)!==0,a=i&&(n&1024)!==0,s=a||(n&8192)!==0||this.skipped_effects.has(r);if(!s&&r.fn!==null){if(i)r.f^=1024;else if(!(n&1024))if(n&4)le(this,$a).push(r);else if(An&&n&8)le(this,Ia).push(r);else if(n&4194304){var o=(c=r.b)!=null&&c.pending?le(this,yl):le(this,Ps);o.push(r)}else Fa(r)&&(r.f&16&&le(this,bl).push(r),Gi(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)r=u.next,u=u.parent}},up=function(e){for(let r of e)(r.f&2048?le(this,Pu):le(this,Ru)).push(r),mt(r,1024);e.length=0},ry=function(){if(!le(this,Cu))for(let e of le(this,wl))e();le(this,wl).clear()};var si=dp;function _l(t){An&&Q!==null&&dO();var e=cp;cp=!0;try{var r;for(t&&(ny(),r=t());;){if(CO(),Rs.length===0&&(Se==null||Se.flush(),Rs.length===0))return pp=null,r;ny()}}finally{cp=e}}function ny(){var a;var t=Is;ty=!0;try{var e=0;for(iy(!0);Rs.length>0;){var r=si.ensure();if(e++>1e3){if(L){var n=new Map;for(let s of r.current.keys())for(let[o,l]of(a=s.updated)!=null?a:[]){var i=n.get(o);i||(i={error:l.error,count:0},n.set(o,i)),i.count+=l.count}for(let s of n.values())console.error(s.error)}lV()}r.process(Rs),qi.clear()}}finally{ty=!1,iy(t),pp=null}}function lV(){try{fO()}catch(t){L&&Wt(t,"stack",{value:""}),ml(t,pp)}}function RO(t){var e=t.length;if(e!==0){for(var r=0;ri&&n.f&1048576)break}}for(;r0&&!oy&&ly()}return e}function ly(){oy=!1;let t=Array.from(Cs);for(let e of t)e.f&1024&&mt(e,4096),Fa(e)&&Gi(e);Cs.clear()}function _u(t){ne(t,t.v+1)}function OO(t,e){var r=t.reactions;if(r!==null)for(var n=un(),i=r.length,a=0;a{if(Oa===s)return c();var f=se,d=Oa;Ct(null),cy(s);var h=c();return Ct(f),cy(d),h};n&&(r.set("length",Ce(t.length,a)),L&&(t=fV(t)));var l="";function u(c){l=c,cn(i,`${l} version`);for(let[f,d]of r)cn(d,Fs(l,f))}return new Proxy(t,{defineProperty(c,f,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&gO();var h=r.get(f);return h===void 0?h=o(()=>{var m=Ce(d.value,a);return r.set(f,m),L&&typeof f=="string"&&cn(m,Fs(l,f)),m}):ne(h,d.value,!0),!0},deleteProperty(c,f){var d=r.get(f);if(d===void 0){if(f in c){let h=o(()=>Ce(Ve,a));r.set(f,h),_u(i),L&&cn(h,Fs(l,f))}}else ne(d,Ve),_u(i);return!0},get(c,f,d){var v;if(f===Er)return t;if(L&&f===Yh)return u;var h=r.get(f),m=f in c;if(h===void 0&&(!m||(v=Sr(c,f))!=null&&v.writable)&&(h=o(()=>{var w=Ne(m?c[f]:Ve),b=Ce(w,a);return L&&cn(b,Fs(l,f)),b}),r.set(f,h)),h!==void 0){var g=R(h);return g===Ve?void 0:g}return Reflect.get(c,f,d)},getOwnPropertyDescriptor(c,f){var d=Reflect.getOwnPropertyDescriptor(c,f);if(d&&"value"in d){var h=r.get(f);h&&(d.value=R(h))}else if(d===void 0){var m=r.get(f),g=m==null?void 0:m.v;if(m!==void 0&&g!==Ve)return{enumerable:!0,configurable:!0,value:g,writable:!0}}return d},has(c,f){var g;if(f===Er)return!0;var d=r.get(f),h=d!==void 0&&d.v!==Ve||Reflect.has(c,f);if(d!==void 0||Q!==null&&(!h||(g=Sr(c,f))!=null&&g.writable)){d===void 0&&(d=o(()=>{var v=h?Ne(c[f]):Ve,w=Ce(v,a);return L&&cn(w,Fs(l,f)),w}),r.set(f,d));var m=R(d);if(m===Ve)return!1}return h},set(c,f,d,h){var A;var m=r.get(f),g=f in c;if(n&&f==="length")for(var v=d;vCe(Ve,a)),r.set(v+"",w),L&&cn(w,Fs(l,v)))}if(m===void 0)(!g||(A=Sr(c,f))!=null&&A.writable)&&(m=o(()=>Ce(void 0,a)),ne(m,Ne(d)),r.set(f,m),L&&cn(m,Fs(l,f)));else{g=m.v!==Ve;var b=o(()=>Ne(d));ne(m,b)}var E=Reflect.getOwnPropertyDescriptor(c,f);if(E!=null&&E.set&&E.set.call(h,d),!g){if(n&&typeof f=="string"){var x=r.get("length"),k=Number(f);Number.isInteger(k)&&k>=x.v&&ne(x,k+1)}_u(i)}return!0},ownKeys(c){R(i);var f=Reflect.ownKeys(c).filter(m=>{var g=r.get(m);return g===void 0||g.v!==Ve});for(var[d,h]of r)h.v!==Ve&&!(d in c)&&f.push(d);return f},setPrototypeOf(){vO()}})}function Fs(t,e){var r;return typeof e=="symbol"?`${t}[Symbol(${(r=e.description)!=null?r:""})]`:cV.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function mp(t){try{if(t!==null&&typeof t=="object"&&Er in t)return t[Er]}catch(e){}return t}var uV=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function fV(t){return new Proxy(t,{get(e,r,n){var i=Reflect.get(e,r,n);return uV.has(r)?function(...a){FO();var s=i.apply(this,a);return ly(),s}:i}})}function DO(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:n,includes:i}=t;t.indexOf=function(a,s){let o=r.call(this,a,s);if(o===-1){for(let l=s!=null?s:0;l{t.indexOf=r,t.lastIndexOf=n,t.includes=i}}var uy,LO,yu,NO,BO;function gp(){if(uy===void 0){uy=window,LO=document,yu=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;NO=Sr(e,"firstChild").get,BO=Sr(e,"nextSibling").get,U0(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),U0(r)&&(r.__t=void 0),L&&(t.__svelte_meta=null,DO())}}function Ut(t=""){return document.createTextNode(t)}function jt(t){return NO.call(t)}function Bt(t){return BO.call(t)}function q(t,e){if(!ae)return jt(t);var r=jt(pe);if(r===null)r=pe.appendChild(Ut());else if(e&&r.nodeType!==mu){var n=Ut();return r==null||r.before(n),et(n),n}return et(r),r}function Cr(t,e){var i,a;if(!ae){var r=jt(t);return r instanceof Comment&&r.data===""?Bt(r):r}if(e&&((i=pe)==null?void 0:i.nodeType)!==mu){var n=Ut();return(a=pe)==null||a.before(n),et(n),n}return pe}function ee(t,e=1,r=!1){let n=ae?pe:t;for(var i;e--;)i=n,n=Bt(n);if(!ae)return n;if(r&&(n==null?void 0:n.nodeType)!==mu){var a=Ut();return n===null?i==null||i.after(a):n.before(a),et(a),a}return et(n),n}function xl(t){t.textContent=""}function Sl(){if(!An)return!1;var t=Q.f;return(t&32768)!==0}function UO(t){Q===null&&se===null&&uO(t),se!==null&&se.f&256&&Q===null&&cO(),Cn&&lO(t)}function dV(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function fi(t,e,r,n=!0){var l;var i=Q;if(L)for(;i!==null&&i.f&131072;)i=i.parent;i!==null&&i.f&8192&&(t|=8192);var a={ctx:ve,deps:null,nodes_start:null,nodes_end:null,f:t|2048,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(L&&(a.component_function=Tn),r)try{Gi(a),a.f|=32768}catch(u){throw Tt(a),u}else e!==null&&ci(a);var s=r&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&524288)===0;if(!s&&n&&(i!==null&&dV(a,i),se!==null&&se.f&2&&!(t&64))){var o=se;((l=o.effects)!=null?l:o.effects=[]).push(a)}return a}function Gr(t){let e=fi(8,null,!1);return mt(e,1024),e.teardown=t,e}function Jt(t){var i;UO("$effect"),L&&Wt(t,"name",{value:"$effect"});var e=Q.f,r=!se&&(e&32)!==0&&(e&32768)===0;if(r){var n=ve;((i=n.e)!=null?i:n.e=[]).push(t)}else return z0(t)}function z0(t){return fi(1048580,t,!1)}function dy(t){si.ensure();let e=fi(64,t,!0);return()=>{Tt(e)}}function jO(t){si.ensure();let e=fi(64,t,!0);return(r={})=>new Promise(n=>{r.outro?li(e,()=>{Tt(e),n(void 0)}):(Tt(e),n(void 0))})}function Pr(t){return fi(4,t,!1)}function PO(t){return fi(4718592,t,!0)}function Kt(t,e=0){return fi(8|e,t,!0)}function Fe(t,e=[],r=[]){lp(e,r,n=>{fi(8,()=>t(...n.map(R)),!0)})}function kr(t,e=0){var r=fi(16|e,t,!0);return L&&(r.dev_stack=Bi),r}function At(t,e=!0){return fi(32,t,!0,e)}function hy(t){var e=t.teardown;if(e!==null){let r=Cn,n=se;fy(!0),Ct(null);try{e.call(null)}finally{fy(r),Ct(n)}}}function py(t,e=!1){var i;var r=t.first;for(t.first=t.last=null;r!==null;){(i=r.ac)==null||i.abort(hl);var n=r.next;r.f&64?r.parent=null:Tt(r,e),r=n}}function GO(t){for(var e=t.first;e!==null;){var r=e.next;e.f&32||Tt(e),e=r}}function Tt(t,e=!0){var r=!1;(e||t.f&262144)&&t.nodes_start!==null&&t.nodes_end!==null&&(qO(t.nodes_start,t.nodes_end),r=!0),py(t,e&&!r),Fu(t,0),mt(t,16384);var n=t.transitions;if(n!==null)for(let a of n)a.stop();hy(t);var i=t.parent;i!==null&&i.first!==null&&sy(t),L&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function qO(t,e){for(;t!==null;){var r=t===e?null:Bt(t);t.remove(),t=r}}function sy(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function li(t,e){var r=[];vp(t,r,!0),my(r,()=>{Tt(t),e&&e()})}function my(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function vp(t,e,r){if(!(t.f&8192)){if(t.f^=8192,t.transitions!==null)for(let s of t.transitions)(s.is_global||r)&&e.push(s);for(var n=t.first;n!==null;){var i=n.next,a=(n.f&65536)!==0||(n.f&32)!==0;vp(n,e,a?r:!1),n=i}}}function Os(t){zO(t,!0)}function zO(t,e){if(t.f&8192){t.f^=8192,t.f&1024||(mt(t,2048),ci(t));for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;zO(r,i?e:!1),r=n}if(t.transitions!==null)for(let a of t.transitions)(a.is_global||e)&&a.in()}}p();var VO=null;var Is=!1;function iy(t){Is=t}var Cn=!1;function fy(t){Cn=t}var se=null,Ar=!1;function Ct(t){se=t}var Q=null;function Ht(t){Q=t}var Tr=null;function op(t){se!==null&&(!An||se.f&2)&&(Tr===null?Tr=[t]:Tr.push(t))}var lr=null,qr=0,jr=null;function MO(t){jr=t}var WO=1,Ou=0,Oa=Ou;function cy(t){Oa=t}var ji=!1;function Eu(){return++WO}function Fa(t){var f,d;var e=t.f;if(e&2048)return!0;if(e&4096){var r=t.deps,n=(e&256)!==0;if(r!==null){var i,a,s=(e&512)!==0,o=n&&Q!==null&&!ji,l=r.length;if((s||o)&&(Q===null||!(Q.f&16384))){var u=t,c=u.parent;for(i=0;it.wv)return!0}(!n||Q!==null&&!ji)&&mt(t,1024)}return!1}function YO(t,e,r=!0){var n=t.reactions;if(n!==null&&!(!An&&(Tr!=null&&Tr.includes(t))))for(var i=0;i0)for(d.length=qr+lr.length,h=0;h{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r.__on_r)==null||e.call(r)})},{capture:!0}))}function Ms(t){var e=se,r=Q;Ct(null),Ht(null);try{return t()}finally{Ct(e),Ht(r)}}function wy(t,e,r,n=r){t.addEventListener(e,()=>Ms(r));let i=t.__on_r;i?t.__on_r=()=>{i(),n(!0)}:t.__on_r=()=>n(!0),vy()}var yy=new Set,bp=new Set;function KO(t,e,r,n={}){function i(a){if(n.capture||El.call(e,a),!a.cancelBubble)return Ms(()=>r==null?void 0:r.call(this,a))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Br(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function zr(t,e,r,n,i){var a={capture:n,passive:i},s=KO(t,e,r,a);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Gr(()=>{e.removeEventListener(t,s,a)})}function gt(t){for(var e=0;e{throw E});throw d}}finally{t.__root=e,delete t.currentTarget,Ct(c),Ht(f)}}}p();var mV;function JO(){mV=void 0}p();p();function _p(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("",""),e.content}function di(t,e){var r=Q;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function ce(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,a=!t.startsWith("");return()=>{if(ae)return di(pe,null),pe;i===void 0&&(i=_p(a?t:""+t),r||(i=jt(i)));var s=n||yu?document.importNode(i,!0):i.cloneNode(!0);if(r){var o=jt(s),l=s.lastChild;di(o,l)}else di(s,s);return s}}function zi(){if(ae)return di(pe,null),pe;var t=document.createDocumentFragment(),e=document.createComment(""),r=Ut();return t.append(e,r),di(e,r),t}function ie(t,e){if(ae){Q.nodes_end=pe,Zt();return}t!==null&&t.before(e)}p();var yV=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var woe=[...yV,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var bV=["touchstart","touchmove"];function eM(t){return bV.includes(t)}var _V=["$state","$state.raw","$derived","$derived.by"],yoe=[..._V,"$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var xp=!0;function Be(t,e){var n;var r=e==null?"":typeof e=="object"?e+"":e;r!==((n=t.__t)!=null?n:t.__t=t.nodeValue)&&(t.__t=r,t.nodeValue=r+"")}function Ma(t,e){return tM(t,e)}function _y(t,e){var s;gp(),e.intro=(s=e.intro)!=null?s:!1;let r=e.target,n=ae,i=pe;try{for(var a=jt(r);a&&(a.nodeType!==ln||a.data!==fl);)a=Bt(a);if(!a)throw Di;Xt(!0),et(a),Zt();let o=tM(t,{...e,anchor:a});if(pe===null||pe.nodeType!==ln||pe.data!==_s)throw Es(),Di;return Xt(!1),o}catch(o){if(o===Di)return e.recover===!1&&hO(),gp(),xl(r),Xt(!1),Ma(t,e);throw o}finally{Xt(n),et(i),JO()}}var kl=new Map;function tM(t,{target:e,anchor:r,props:n={},events:i,context:a,intro:s=!0}){gp();var o=new Set,l=f=>{for(var d=0;d{var f=r!=null?r:e.appendChild(Ut());return At(()=>{if(a){tt({});var d=ve;d.c=a}i&&(n.$$events=i),ae&&di(f,null),xp=s,u=t(f,n)||{},xp=!0,ae&&(Q.nodes_end=pe),a&&rt()}),()=>{var m;for(var d of o){e.removeEventListener(d,El);var h=kl.get(d);--h===0?(document.removeEventListener(d,El),kl.delete(d)):kl.set(d,h)}bp.delete(l),f!==r&&((m=f.parentNode)==null||m.removeChild(f))}});return by.set(u,c),u}var by=new WeakMap;function Vi(t,e){let r=by.get(t);return r?(by.delete(t),r(e)):(L&&xO(),Promise.resolve())}p();p();if(L){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;mO(e)},set:n=>{r=n}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function xy(t){ve===null&&gu("onMount"),Li&&ve.l!==null?kV(ve).m.push(t):Jt(()=>{let e=je(t);if(typeof e=="function")return e})}function nM(t){ve===null&&gu("onDestroy"),xy(()=>()=>je(t))}function kV(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}p();p();var aM=new Map;function sM(t,e){var r=aM.get(t);r||(r=new Set,aM.set(t,r)),r.add(e)}p();p();p();p();p();p();p();p();p();function xe(t,e,r=!1){ae&&Zt();var n=t,i=null,a=null,s=Ve,o=r?65536:0,l=!1;let u=(h,m=!0)=>{l=!0,d(m,h)};var c=null;function f(){c!==null&&(c.lastChild.remove(),n.before(c),c=null);var h=s?i:a,m=s?a:i;h&&Os(h),m&&li(m,()=>{s?a=null:i=null})}let d=(h,m)=>{if(s===(s=h))return;let g=!1;if(ae){let k=Zh(n)===Aa;!!s===k&&(n=ks(),et(n),Xt(!1),g=!0)}var v=Sl(),w=n;if(v&&(c=document.createDocumentFragment(),c.append(w=Ut())),s?i!=null||(i=m&&At(()=>m(w))):a!=null||(a=m&&At(()=>m(w))),v){var b=Se,E=s?i:a,x=s?a:i;E&&b.skipped_effects.delete(E),x&&b.skipped_effects.add(x),b.add_callback(f)}else f();g&&Xt(!0)};kr(()=>{l=!1,e(u),l||d(null,null)},o),ae&&(n=pe)}p();p();p();var Mu=null;function Vr(t,e){return e}function RV(t,e,r){for(var n=t.items,i=[],a=e.length,s=0;s0&&i.length===0&&r!==null;if(o){var l=r.parentNode;xl(l),l.append(r),n.clear(),hi(t,e[0].prev,e[a-1].next)}my(i,()=>{for(var u=0;u{var w=r();return on(w)?w:w==null?[]:du(w)}),m,g;function v(){IV(g,m,o,d,s,i,e,n,r),a!==null&&(m.length===0?c?Os(c):c=At(()=>a(s)):c!==null&&li(c,()=>{c=null}))}kr(()=>{var F;g!=null||(g=Q),m=R(h);var w=m.length;if(f&&w===0)return;f=w===0;let b=!1;if(ae){var E=Zh(s)===Aa;E!==(w===0)&&(s=ks(),et(s),Xt(!1),b=!0)}if(ae){for(var x=null,k,A=0;A0&&et(ks())}if(ae)w===0&&a&&(c=At(()=>a(s)));else if(Sl()){var _=new Set,T=Se;for(A=0;A0){var me=s&4&&f===0?i:null;if(u){for(y=0;y{var H;if(w!==void 0)for(A of w)(H=A.a)==null||H.apply()}),t.first=r.first&&r.first.e,t.last=v&&v.e;for(var fe of n.values())Tt(fe.e);n.clear()}function lM(t,e,r,n){n&1&&oi(t.v,e),n&2?oi(t.i,r):t.i=r}function Ey(t,e,r,n,i,a,s,o,l,u,c){var f=Mu,d=(l&1)!==0,h=(l&16)===0,m=d?h?$s(i,!1,!1):Hr(i):i,g=l&2?Hr(s):s;L&&d&&(m.trace=()=>{var b=typeof g=="number"?s:g.v;u()[b]});var v={i:g,v:m,k:a,a:null,e:null,prev:r,next:n};Mu=v;try{if(t===null){var w=document.createDocumentFragment();w.append(t=Ut())}return v.e=At(()=>o(t,m,g,u),ae),v.e.prev=r&&r.e,v.e.next=n&&n.e,r===null?c||(e.first=v):(r.next=v,r.e.next=v.e),n!==null&&(n.prev=v,n.e.prev=v.e),v}finally{Mu=f}}function Sy(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,i=e?e.e.nodes_start:r,a=t.e.nodes_start;a!==null&&a!==n;){var s=Bt(a);i.before(a),a=s}}function hi(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}p();p();p();p();p();function $n(t,e){Pr(()=>{var i;var r=t.getRootNode(),n=r.host?r:(i=r.head)!=null?i:r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){let a=document.createElement("style");a.id=e.hash,a.textContent=e.code,n.appendChild(a),L&&sM(e.hash,a)}})}p();p();p();p();p();p();var uM=[...` +\r\f\xA0\v\uFEFF`];function fM(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i in r)if(r[i])n=n?n+" "+i:i;else if(n.length)for(var a=i.length,s=0;(s=n.indexOf(i,s))>=0;){var o=s+a;(s===0||uM.includes(n[s-1]))&&(o===n.length||uM.includes(n[o]))?n=(s===0?"":n.substring(0,s))+n.substring(o+1):s=o}}return n===""?null:n}p();function ot(t,e,r,n,i,a){var s=t.__className;if(ae||s!==r||s===void 0){var o=fM(r,n,a);(!ae||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(a&&i!==a)for(var l in a){var u=!!a[l];(i==null||u!==!!i[l])&&t.classList.toggle(l,u)}return a}p();p();var BV=Symbol("class"),HV=Symbol("style"),UV=Symbol("is custom element"),jV=Symbol("is html");function ge(t,e,r,n){var i=GV(t);if(ae&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){n||zV(t,e,r!=null?r:"");return}i[e]!==(i[e]=r)&&(e==="loading"&&(t[iO]=r),r==null?t.removeAttribute(e):typeof r!="string"&&qV(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function GV(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[UV]:t.nodeName.includes("-"),[jV]:t.namespaceURI===eO}}var dM=new Map;function qV(t){var e=dM.get(t.nodeName);if(e)return e;dM.set(t.nodeName,e=[]);for(var r,n=t,i=Element.prototype;i!==n;){r=B0(n);for(var a in r)r[a].set&&e.push(a);n=dl(n)}return e}function zV(t,e,r){var n;L&&(e==="srcset"&&VV(t,r)||ky((n=t.getAttribute(e))!=null?n:"",r)||_O(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function ky(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function hM(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function VV(t,e){var r=hM(t.srcset),n=hM(e);return n.length===r.length&&n.every(([i,a],s)=>a===r[s][1]&&(ky(r[s][0],i)||ky(i,r[s][0])))}p();p();p();var WV=Wh?()=>performance.now():()=>Date.now(),Fn={tick:t=>(Wh?requestAnimationFrame:ar)(t),now:()=>WV(),tasks:new Set};function pM(){let t=Fn.now();Fn.tasks.forEach(e=>{e.c(t)||(Fn.tasks.delete(e),e.f())}),Fn.tasks.size!==0&&Fn.tick(pM)}function mM(t){let e;return Fn.tasks.size===0&&Fn.tick(pM),{promise:new Promise(r=>{Fn.tasks.add(e={c:t,f:r})}),abort(){Fn.tasks.delete(e)}}}function kp(t,e){Ms(()=>{t.dispatchEvent(new CustomEvent(e))})}function KV(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;let e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function gM(t){let e={},r=t.split(";");for(let n of r){let[i,a]=n.split(":");if(!i||a===void 0)break;let s=KV(i.trim());e[s]=a.trim()}return e}var JV=t=>t;function On(t,e,r,n){var E;var i=(t&1)!==0,a=(t&2)!==0,s=i&&a,o=(t&4)!==0,l=s?"both":i?"in":"out",u,c=e.inert,f=e.style.overflow,d,h;function m(){return Ms(()=>{var x;return u!=null?u:u=r()(e,(x=n==null?void 0:n())!=null?x:{},{direction:l})})}var g={is_global:o,in(){var x;if(e.inert=c,!i){h==null||h.abort(),(x=h==null?void 0:h.reset)==null||x.call(h);return}a||d==null||d.abort(),kp(e,"introstart"),d=Ay(e,m(),h,1,()=>{kp(e,"introend"),d==null||d.abort(),d=u=void 0,e.style.overflow=f})},out(x){if(!a){x==null||x(),u=void 0;return}e.inert=!0,kp(e,"outrostart"),h=Ay(e,m(),d,0,()=>{kp(e,"outroend"),x==null||x()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},v=Q;if(((E=v.transitions)!=null?E:v.transitions=[]).push(g),i&&xp){var w=o;if(!w){for(var b=v.parent;b&&b.f&65536;)for(;(b=b.parent)&&!(b.f&16););w=!b||(b.f&32768)!==0}w&&Pr(()=>{je(()=>g.in())})}}function Ay(t,e,r,n,i){var a=n===1;if(j0(e)){var s,o=!1;return Br(()=>{if(!o){var v=e({direction:a?"in":"out"});s=Ay(t,v,r,n,i)}}),{abort:()=>{o=!0,s==null||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration))return i(),{abort:ar,deactivate:ar,reset:ar,t:()=>n};let{delay:l=0,css:u,tick:c,easing:f=JV}=e;var d=[];if(a&&r===void 0&&(c&&c(0,1),u)){var h=gM(u(0,1));d.push(h,h)}var m=()=>1-n,g=t.animate(d,{duration:l,fill:"forwards"});return g.onfinish=()=>{var _;g.cancel();var v=(_=r==null?void 0:r.t())!=null?_:1-n;r==null||r.abort();var w=n-v,b=e.duration*Math.abs(w),E=[];if(b>0){var x=!1;if(u)for(var k=Math.ceil(b/16.666666666666668),A=0;A<=k;A+=1){var y=v+w*f(A/k),S=gM(u(y,1-y));E.push(S),x||(x=S.overflow==="hidden")}x&&(t.style.overflow="hidden"),m=()=>{var T=g.currentTime;return v+w*f(T/b)},c&&mM(()=>{if(g.playState!=="running")return!1;var T=m();return c(T,1-T),!0})}g=t.animate(E,{duration:b,fill:"forwards"}),g.onfinish=()=>{m=()=>n,c==null||c(n,1-n),i()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=ar)},deactivate:()=>{i=ar},reset:()=>{n===0&&(c==null||c(1,0))},t:()=>m()}}p();p();function Py(t,e,r=e){var n=un(),i=new WeakSet;wy(t,"input",a=>{L&&t.type==="checkbox"&&G0();var s=a?t.defaultValue:t.value;if(s=Ty(t)?Cy(s):s,r(s),Se!==null&&i.add(Se),n&&s!==(s=e())){var o=t.selectionStart,l=t.selectionEnd;t.value=s!=null?s:"",l!==null&&(t.selectionStart=o,t.selectionEnd=Math.min(l,t.value.length))}}),(ae&&t.defaultValue!==t.value||je(e)==null&&t.value)&&(r(Ty(t)?Cy(t.value):t.value),Se!==null&&i.add(Se)),Kt(()=>{var o;L&&t.type==="checkbox"&&G0();var a=e();if(t===document.activeElement){var s=(o=Au)!=null?o:Se;if(i.has(s))return}Ty(t)&&a===Cy(t.value)||t.type==="date"&&!a&&!t.value||a!==t.value&&(t.value=a!=null?a:"")})}function Ty(t){var e=t.type;return e==="number"||e==="range"}function Cy(t){return t===""?null:+t}p();p();p();p();p();function vM(t,e){return t===e||(t==null?void 0:t[Er])===e}function Ke(t={},e,r,n){return Pr(()=>{var i,a;return Kt(()=>{i=a,a=(n==null?void 0:n())||[],je(()=>{t!==r(...a)&&(e(t,...a),i&&vM(r(...i),t)&&e(null,...i))})}),()=>{Br(()=>{a&&vM(r(...a),t)&&e(null,...a)})}}),t}p();p();p();p();p();p();p();p();p();var Tp=!1,vpe=Symbol();function Iy(t){var e=Tp;try{return Tp=!1,[t(),Tp]}finally{Tp=e}}function dn(t,e,r,n){var E,x;var i=!Li||(r&2)!==0,a=(r&8)!==0,s=(r&16)!==0,o=n,l=!0,u=()=>(l&&(l=!1,o=s?je(n):n),o),c;if(a){var f=Er in t||pu in t;c=(x=(E=Sr(t,e))==null?void 0:E.set)!=null?x:f&&e in t?k=>t[e]=k:void 0}var d,h=!1;a?[d,h]=Iy(()=>t[e]):d=t[e],d===void 0&&n!==void 0&&(d=u(),c&&(i&&pO(e),c(d)));var m;if(i?m=()=>{var k=t[e];return k===void 0?u():(l=!0,k)}:m=()=>{var k=t[e];return k!==void 0&&(o=void 0),k===void 0?o:k},i&&!(r&4))return m;if(c){var g=t.$$legacy;return function(k,A){return arguments.length>0?((!i||!A||g||h)&&c(A?m():k),k):m()}}var v=!1,w=(r&1?As:Ts)(()=>(v=!1,m()));L&&(w.label=e),a&&R(w);var b=Q;return function(k,A){if(arguments.length>0){let y=A?R(w):i&&a?Ne(k):k;return ne(w,y),v=!0,o!==void 0&&(o=y),k}return Cn&&v||b.f&16384?w.v:R(w)}}p();p();p();function wM(t){return new $y(t)}var Wi,hn,$y=class{constructor(e){wt(this,Wi);wt(this,hn);var a,s;var r=new Map,n=(o,l)=>{var u=$s(l,!1,!1);return r.set(o,u),u};let i=new Proxy({...e.props||{},$$events:{}},{get(o,l){var u;return R((u=r.get(l))!=null?u:n(l,Reflect.get(o,l)))},has(o,l){var u;return l===pu?!0:(R((u=r.get(l))!=null?u:n(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,u){var c;return ne((c=r.get(l))!=null?c:n(l,u),u),Reflect.set(o,l,u)}});Ot(this,hn,(e.hydrate?_y:Ma)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:(a=e.intro)!=null?a:!1,recover:e.recover})),!An&&(!((s=e==null?void 0:e.props)!=null&&s.$$host)||e.sync===!1)&&_l(),Ot(this,Wi,i.$$events);for(let o of Object.keys(le(this,hn)))o==="$set"||o==="$destroy"||o==="$on"||Wt(this,o,{get(){return le(this,hn)[o]},set(l){le(this,hn)[o]=l},enumerable:!0});le(this,hn).$set=o=>{Object.assign(i,o)},le(this,hn).$destroy=()=>{Vi(le(this,hn))}}$set(e){le(this,hn).$set(e)}$on(e,r){le(this,Wi)[e]=le(this,Wi)[e]||[];let n=(...i)=>r.call(this,...i);return le(this,Wi)[e].push(n),()=>{le(this,Wi)[e]=le(this,Wi)[e].filter(i=>i!==n)}}$destroy(){le(this,hn).$destroy()}};Wi=new WeakMap,hn=new WeakMap;var dW;typeof HTMLElement=="function"&&(dW=class extends HTMLElement{constructor(e,r,n){super();vt(this,"$$ctor");vt(this,"$$s");vt(this,"$$c");vt(this,"$$cn",!1);vt(this,"$$d",{});vt(this,"$$r",!1);vt(this,"$$p_d",{});vt(this,"$$l",{});vt(this,"$$l_u",new Map);vt(this,"$$me");this.$$ctor=e,this.$$s=r,n&&this.attachShadow({mode:"open"})}addEventListener(e,r,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){let i=this.$$c.$on(e,r);this.$$l_u.set(r,i)}super.addEventListener(e,r,n)}removeEventListener(e,r,n){if(super.removeEventListener(e,r,n),this.$$c){let i=this.$$l_u.get(r);i&&(i(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(i){return a=>{let s=document.createElement("slot");i!=="default"&&(s.name=i),ie(a,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let r={},n=hW(this);for(let i of this.$$s)i in n&&(i==="default"&&!this.$$d.children?(this.$$d.children=e(i),r.default=!0):r[i]=e(i));for(let i of this.attributes){let a=this.$$g_p(i.name);a in this.$$d||(this.$$d[a]=Fy(a,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=wM({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=dy(()=>{Kt(()=>{var i;this.$$r=!0;for(let a of N0(this.$$c)){if(!((i=this.$$p_d[a])!=null&&i.reflect))continue;this.$$d[a]=this.$$c[a];let s=Fy(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})});for(let i in this.$$l)for(let a of this.$$l[i]){let s=this.$$c.$on(i,a);this.$$l_u.set(a,s)}this.$$l={}}}attributeChangedCallback(e,r,n){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Fy(e,n,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.$$me(),this.$$c=void 0)})}$$g_p(e){return N0(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function Fy(t,e,r,n){var a;let i=(a=r[t])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="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}}function hW(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}p();p();function Ds(t,e,r,n){function i(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(f){s(f)}}function l(c){try{u(n.throw(c))}catch(f){s(f)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(t,e||[])).next())})}var Ly=require("obsidian");p();var My=require("obsidian");p();function pW(t){let e=t-1;return e*e*e+1}var Oy=!1;function mi(t,{delay:e=0,duration:r=400,easing:n=pW,axis:i="y"}={}){let a=getComputedStyle(t);L&&!Oy&&/(contents|inline|table)/.test(a.display)&&(Oy=!0,Promise.resolve().then(()=>Oy=!1),SO(a.display));let s=+a.opacity,o=i==="y"?"height":"width",l=parseFloat(a[o]),u=i==="y"?["top","bottom"]:["left","right"],c=u.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),f=parseFloat(a[`padding${c[0]}`]),d=parseFloat(a[`padding${c[1]}`]),h=parseFloat(a[`margin${c[0]}`]),m=parseFloat(a[`margin${c[1]}`]),g=parseFloat(a[`border${c[0]}Width`]),v=parseFloat(a[`border${c[1]}Width`]);return{delay:e,duration:r,easing:n,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${o}: ${w*l}px;padding-${u[0]}: ${w*f}px;padding-${u[1]}: ${w*d}px;margin-${u[0]}: ${w*h}px;margin-${u[1]}: ${w*m}px;border-${u[0]}-width: ${w*g}px;border-${u[1]}-width: ${w*v}px;min-${o}: 0`}}p();var Cp=require("obsidian");var mW=ce('
'),gW=ce('
'),vW={hash:"svelte-1wbh8tp",code:"main.svelte-1wbh8tp .nav-file-title:where(.svelte-1wbh8tp) {align-items:center;}"};function Du(t,e){tt(e,!0),$n(t,vW);let r=Ne([]),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");Jt(()=>{for(let w of r)w&&(0,Cp.setIcon)(w,w.getAttr("data-icon"))});function i(w){w.stopPropagation(),Do(e.diff.path)?a(w):s(w)}function a(w){var b;w.stopPropagation();let E=e.view.app.vault.getAbstractFileByPath(e.diff.vaultPath);E instanceof Cp.TFile&&((b=bn(e.view.app,w))===null||b===void 0||b.openFile(E).catch(x=>e.view.plugin.displayError(x)))}function s(w){var b;e.view.plugin.tools.openDiff({event:w,aFile:(b=e.diff.fromPath)!==null&&b!==void 0?b:e.diff.path,aRef:`${e.diff.hash}^`,bFile:e.diff.path,bRef:e.diff.hash})}var o=gW();o.__click=i;var l=q(o),u=q(l),c=q(u,!0);j(u);var f=ee(u,2),d=q(f),h=q(d);{var m=w=>{var b=mW();b.__click=a,Ke(b,E=>r[0]=E,()=>r==null?void 0:r[0]),zr("auxclick",b,a),ie(w,b)};xe(h,w=>{Lo(e.diff.vaultPath,e.view.app)&&w(m)})}j(d);var g=ee(d,2),v=q(g,!0);j(g),j(f),j(l),j(o),Fe(w=>{ge(l,"data-path",e.diff.vaultPath),ge(l,"data-tooltip-position",R(n)),ge(l,"aria-label",e.diff.vaultPath),Be(c,w),ge(g,"data-type",e.diff.status),Be(v,e.diff.status)},[()=>ei(e.diff.vaultPath)]),zr("auxclick",o,w=>{w.stopPropagation(),w.button==2?Qn(e.view.app,w,e.diff.vaultPath,e.view.leaf,"git-history"):i(w)}),ie(t,o),rt()}gt(["click"]);p();var wW=ce("
"),yW=(t,e,r)=>e(t,R(r)),bW=ce(''),_W=ce('
'),xW=ce("
"),SW={hash:"svelte-1lnl15d",code:"main.svelte-1lnl15d .nav-folder-title-content:where(.svelte-1lnl15d) {display:flex;align-items:center;}"};function Lu(t,e){tt(e,!0),$n(t,SW);let r=dn(e,"topLevel",3,!1),n=dn(e,"closed",15),i=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function a(l,u){l.stopPropagation(),n(n()[u.path]=!n()[u.path],!0)}var s=xW();let o;Wr(s,21,()=>e.hierarchy.children,Vr,(l,u)=>{var c=zi(),f=Cr(c);{var d=m=>{var g=wW(),v=q(g);Du(v,{get diff(){return R(u).data},get view(){return e.view}}),j(g),ie(m,g)},h=m=>{var g=_W();let v;var w=q(g);w.__click=[yW,a,u];var b=ee(q(w),2);let E;var x=ee(b,2),k=q(x,!0);j(x),j(w);var A=ee(w,2);{var y=S=>{var _=bW(),T=q(_);Lu(T,{get hierarchy(){return R(u)},get plugin(){return e.plugin},get view(){return e.view},get closed(){return n()},set closed(P){n(P)}}),j(_),On(3,_,()=>mi,()=>({duration:150})),ie(S,_)};xe(A,S=>{n()[R(u).path]||S(y)})}j(g),Fe((S,_)=>{v=ot(g,1,"tree-item nav-folder",null,v,S),ge(w,"data-tooltip-position",R(i)),ge(w,"aria-label",R(u).vaultPath),E=ot(b,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,E,_),Be(k,R(u).title)},[()=>({"is-collapsed":n()[R(u).path]}),()=>({"is-collapsed":n()[R(u).path]})]),ie(m,g)};xe(f,m=>{R(u).data?m(d):m(h,!1)})}ie(l,c)}),j(s),Fe(l=>o=ot(s,1,"svelte-1lnl15d",null,o,l),[()=>({topLevel:r()})]),ie(t,s),rt()}gt(["click"]);var EW=(t,e)=>ne(e,!R(e)),kW=ce('
'),AW=ce('
'),TW=ce('
'),CW=ce(''),PW=ce('
'),RW={hash:"svelte-45h",code:""};function Dy(t,e){tt(e,!0),$n(t,RW);let r=Rt(()=>({title:"",path:"",vaultPath:"",children:e.plugin.gitManager.getTreeStructure(e.log.diff.files)})),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left"),i=Ce(!0),a=Ce(Ne({}));function s(S){let _=S.author.name;if(e.plugin.settings.authorInHistoryView=="full")return _;if(e.plugin.settings.authorInHistoryView=="initials")return _.split(" ").filter(P=>P.length>0).map(P=>P[0].toUpperCase()).join("")}var o=PW(),l=q(o);let u;var c=q(l);c.__click=[EW,i];var f=q(c);let d;var h=ee(f,2),m=q(h);{var g=S=>{var _=kW(),T=q(_,!0);j(_),Fe(P=>Be(T,P),[()=>e.log.refs.join(", ")]),ie(S,_)};xe(m,S=>{e.log.refs.length>0&&S(g)})}var v=ee(m,2);{var w=S=>{var _=AW(),T=q(_,!0);j(_),Fe(P=>Be(T,P),[()=>s(e.log)]),ie(S,_)};xe(v,S=>{var _;e.plugin.settings.authorInHistoryView!="hide"&&((_=e.log.author)!=null&&_.name)&&S(w)})}var b=ee(v,2);{var E=S=>{var _=TW(),T=q(_,!0);j(_),Fe(P=>Be(T,P),[()=>(0,My.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),ie(S,_)};xe(b,S=>{e.plugin.settings.dateInHistoryView&&S(E)})}var x=ee(b,2),k=q(x,!0);j(x),j(h),j(c);var A=ee(c,2);{var y=S=>{var _=CW(),T=q(_);{var P=D=>{Lu(D,{get hierarchy(){return R(r)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return R(a)},set closed(M){ne(a,M,!0)}})},F=D=>{var M=zi(),re=Cr(M);Wr(re,17,()=>e.log.diff.files,Vr,(ye,me)=>{Du(ye,{get view(){return e.view},get diff(){return R(me)}})}),ie(D,M)};xe(T,D=>{e.showTree?D(P):D(F,!1)})}j(_),On(3,_,()=>mi,()=>({duration:150})),ie(S,_)};xe(A,S=>{R(i)||S(y)})}j(l),j(o),Fe((S,_,T)=>{u=ot(l,1,"tree-item nav-folder",null,u,S),ge(c,"aria-label",_),ge(c,"data-tooltip-position",R(n)),d=ot(f,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,d,T),Be(k,e.log.message)},[()=>({"is-collapsed":R(i)}),()=>{var S;return`${e.log.refs.length>0?e.log.refs.join(", ")+` +`:""}${(S=e.log.author)==null?void 0:S.name} +${(0,My.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)} +${e.log.message}`},()=>({"is-collapsed":R(i)})]),ie(t,o),rt()}gt(["click"]);function IW(t,e){e().catch(console.error)}var $W=(t,e,r,n)=>{ne(e,!R(e)),(0,Ly.setIcon)(r[0],R(e)?"list":"folder"),n(n().settings.treeStructure=R(e),!0),n().saveSettings()},FW=ce(''),OW=ce('
'),MW={hash:"svelte-45h",code:""};function Ny(t,e){tt(e,!0),$n(t,MW);let r=dn(e,"plugin",15),n=Ce(!1),i=Ne([]),a=Ce(void 0),s=Ce(Ne(r().settings.treeStructure)),o,l;Jt(()=>{l&&l.empty()}),o=e.view.app.workspace.on("obsidian-git:head-change",()=>void u().catch(console.error)),Jt(()=>{i.forEach(x=>(0,Ly.setIcon)(x,x.getAttr("data-icon")))}),nM(()=>{e.view.app.workspace.offref(o)}),xy(()=>{let x=new IntersectionObserver(A=>{A[0].isIntersecting&&!R(n)&&c().catch(console.error)}),k=document.querySelector("#sentinel");return k&&x.observe(k),()=>{x.disconnect()}}),u().catch(console.error);function u(){return Ds(this,void 0,void 0,function*(){var x;if(!r().gitReady){ne(a,void 0);return}ne(n,!0);let k=r().gitManager instanceof _e,A;((x=R(a)===null||R(a)===void 0?void 0:R(a).length)!==null&&x!==void 0?x:0)==0?A=k?50:10:A=R(a).length,ne(a,yield r().gitManager.log(void 0,!1,A),!0),ne(n,!1)})}function c(){return Ds(this,void 0,void 0,function*(){var x;if(!r().gitReady||R(a)===void 0)return;ne(n,!0);let A=r().gitManager instanceof _e?50:10,y=yield r().gitManager.log(void 0,!1,A,(x=R(a).last())===null||x===void 0?void 0:x.hash);R(a).push(...y.slice(1)),ne(n,!1)})}var f=OW(),d=q(f),h=q(d),m=q(h);m.__click=[$W,s,i,r],Ke(m,x=>i[0]=x,()=>i==null?void 0:i[0]);var g=ee(m,2);let v;g.__click=[IW,u],Ke(g,x=>i[1]=x,()=>i==null?void 0:i[1]),j(h),j(d);var w=ee(d,2),b=q(w);{var E=x=>{var k=FW();Wr(k,21,()=>R(a),Vr,(A,y)=>{Dy(A,{get view(){return e.view},get showTree(){return R(s)},get log(){return R(y)},get plugin(){return r()}})}),j(k),ie(x,k)};xe(b,x=>{R(a)&&x(E)})}pl(4),j(w),j(f),Fe(x=>{ge(m,"data-icon",R(s)?"list":"folder"),v=ot(g,1,"clickable-icon nav-action-button",null,v,x)},[()=>({loading:R(n)})]),ie(t,f),rt()}gt(["click"]);var Nu=class extends yM.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Qr.type}getDisplayText(){return Qr.name}getIcon(){return Qr.icon}onClose(){return this._view&&Vi(this._view),super.onClose()}reload(){this._view&&Vi(this._view),this._view=Ma(Ny,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};p();var bM=require("obsidian"),Pp=class extends bM.FuzzySuggestModal{constructor(r,n){super(r.app);this.branches=n;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,n){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};p();var kM=require("obsidian");p();var Bs=require("obsidian");p();var Bu=require("obsidian");p();var _M=require("obsidian");var Al=class extends _M.Modal{constructor({app:r,path:n,filesToDeleteCount:i,filesToDiscardCount:a}){super(r);this.resolve=null;this.path=n,this.deleteCount=i,this.discardCount=a}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:n,titleEl:i}=this,a="";this.path!=""&&(r>1?a=`files in "${this.path}"`:a=`"${this.path}"`),i.setText(`${this.discardCount==0?"Delete":"Discard"} ${a}`),this.deleteCount>0&&n.createEl("p").setText(`Are you sure you want to DELETE the ${Lc(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&n.createEl("p").setText(`Are you sure you want to discard ALL changes in ${Lc(this.discardCount,"tracked file")}?`);let s=n.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=s.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${Lc(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=s.createEl("button",{cls:"mod-warning",text:`Discard all ${Lc(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=s.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty()}};function DW(t,e){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&No(e.view.app,t,e.view,e.change.vaultPath)}function LW(t,e){t.stopPropagation(),e.manager.stage(e.change.path,!1).catch(r=>e.view.plugin.displayError(r)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function NW(t,e){t.stopPropagation();let r=e.change.workingDir=="U";new Al({app:e.view.app,filesToDeleteCount:r?1:0,filesToDiscardCount:r?0:1,path:e.change.vaultPath}).openAndGetResult().then(n=>Ds(this,void 0,void 0,function*(){if(n=="delete"){let i=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);i instanceof Bu.TFile?yield e.view.app.fileManager.trashFile(i):yield e.view.app.vault.adapter.remove(e.change.vaultPath)}else n=="discard"&&(yield e.manager.discard(e.change.path).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")}));e.view.app.workspace.trigger("obsidian-git:refresh")}),n=>e.view.plugin.displayError(n))}var BW=ce('
'),HW=ce('
');function Hu(t,e){tt(e,!0);let r=Ne([]),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");Jt(()=>{for(let E of r)E&&(0,Bu.setIcon)(E,E.getAttr("data-icon"))});function i(E){E.stopPropagation(),Do(e.change.path)?a(E):s(E)}function a(E){var x;E.stopPropagation();let k=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);k instanceof Bu.TFile&&((x=bn(e.view.app,E))===null||x===void 0||x.openFile(k).catch(A=>e.view.plugin.displayError(A)))}function s(E){E.stopPropagation(),e.view.plugin.tools.openDiff({aFile:e.change.path,aRef:"",event:E})}var o=HW();o.__mouseover=[DW,e],o.__click=i;var l=q(o),u=q(l),c=q(u,!0);j(u);var f=ee(u,2),d=q(f),h=q(d);{var m=E=>{var x=BW();x.__click=a,Ke(x,k=>r[0]=k,()=>r==null?void 0:r[0]),zr("auxclick",x,a),ie(E,x)};xe(h,E=>{Lo(e.change.vaultPath,e.view.app)&&E(m)})}var g=ee(h,2);g.__click=[NW,e],Ke(g,E=>r[1]=E,()=>r==null?void 0:r[1]);var v=ee(g,2);v.__click=[LW,e],Ke(v,E=>r[2]=E,()=>r==null?void 0:r[2]),j(d);var w=ee(d,2),b=q(w,!0);j(w),j(f),j(l),j(o),Fe(E=>{ge(l,"data-path",e.change.vaultPath),ge(l,"data-tooltip-position",R(n)),ge(l,"aria-label",e.change.vaultPath),Be(c,E),ge(w,"data-type",e.change.workingDir),Be(b,e.change.workingDir)},[()=>ei(e.change.vaultPath)]),zr("auxclick",o,E=>{E.stopPropagation(),E.button==2?Qn(e.view.app,E,e.change.vaultPath,e.view.leaf,"git-source-control"):i(E)}),ie(t,o),rt()}gt(["mouseover","click"]);p();var xM=require("obsidian");function UW(t,e){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&No(e.view.app,t,e.view,e.change.vaultPath)}var jW=ce('
');function Uu(t,e){tt(e,!0);let r=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function n(f){var d;f.stopPropagation();let h=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);h instanceof xM.TFile&&((d=bn(e.view.app,f))===null||d===void 0||d.openFile(h).catch(m=>e.view.plugin.displayError(m)))}var i=jW();i.__mouseover=[UW,e],i.__click=n;var a=q(i),s=q(a),o=q(s,!0);j(s);var l=ee(s,2),u=q(l),c=q(u,!0);j(u),j(l),j(a),j(i),Fe(f=>{ge(a,"data-path",e.change.vaultPath),ge(a,"data-tooltip-position",R(r)),ge(a,"aria-label",e.change.vaultPath),Be(o,f),ge(u,"data-type",e.change.workingDir),Be(c,e.change.workingDir)},[()=>ei(e.change.vaultPath)]),zr("auxclick",i,f=>{f.stopPropagation(),f.button==2?Qn(e.view.app,f,e.change.vaultPath,e.view.leaf,"git-source-control"):n(f)}),ie(t,i),rt()}gt(["mouseover","click"]);p();var Rp=require("obsidian");function GW(t,e){e.view.app.vault.getFileByPath(e.change.vaultPath)&&No(e.view.app,t,e.view,e.change.vaultPath)}function qW(t,e){t.stopPropagation(),e.manager.unstage(e.change.path,!1).catch(r=>e.view.plugin.displayError(r)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}var zW=ce('
'),VW=ce('
');function ju(t,e){tt(e,!0);let r=Ne([]),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");Jt(()=>{for(let b of r)b&&(0,Rp.setIcon)(b,b.getAttr("data-icon"))});function i(b){b.stopPropagation(),Do(e.change.path)?a(b):s(b)}function a(b){var E;b.stopPropagation();let x=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);x instanceof Rp.TFile&&((E=bn(e.view.app,b))===null||E===void 0||E.openFile(x).catch(k=>e.view.plugin.displayError(k)))}function s(b){var E;b.stopPropagation(),e.view.plugin.tools.openDiff({aFile:(E=e.change.from)!==null&&E!==void 0?E:e.change.path,bFile:e.change.path,aRef:"HEAD",bRef:"",event:b})}var o=VW();o.__mouseover=[GW,e],o.__click=i;var l=q(o),u=q(l),c=q(u,!0);j(u);var f=ee(u,2),d=q(f),h=q(d);{var m=b=>{var E=zW();E.__click=a,Ke(E,x=>r[0]=x,()=>r==null?void 0:r[0]),ie(b,E)};xe(h,b=>{Lo(e.change.vaultPath,e.view.app)&&b(m)})}var g=ee(h,2);g.__click=[qW,e],Ke(g,b=>r[1]=b,()=>r==null?void 0:r[1]),j(d);var v=ee(d,2),w=q(v,!0);j(v),j(f),j(l),j(o),Fe(b=>{ge(l,"data-path",e.change.vaultPath),ge(l,"data-tooltip-position",R(n)),ge(l,"aria-label",e.change.vaultPath),Be(c,b),ge(v,"data-type",e.change.index),Be(w,e.change.index)},[()=>ei(e.change.vaultPath)]),zr("auxclick",o,b=>{b.stopPropagation(),b.button==2?Qn(e.view.app,b,e.change.vaultPath,e.view.leaf,"git-source-control"):i(b)}),ie(t,o),rt()}gt(["mouseover","click"]);p();p();var WW=ce(''),YW=ce("
");function Ls(t,e){tt(e,!0);var r=YW(),n=q(r);{var i=a=>{var s=WW(),o=q(s),l=q(o),u=q(l,!0);j(l),j(o),j(s),Fe(()=>{ge(o,"aria-label","And "+(e.files.length-500)+" more files"),Be(u,"And "+(e.files.length-500)+" more files")}),ie(a,s)};xe(n,a=>{e.files.length>500&&a(i)})}j(r),ie(t,r),rt()}var ZW=ce("
"),KW=(t,e,r)=>e(t,R(r)),JW=(t,e,r)=>e(t,R(r).path),QW=ce('
'),e9=(t,e,r)=>e(t,R(r)),t9=(t,e,r)=>e(t,R(r).path),r9=ce('
',1),n9=ce(''),i9=ce('
'),a9=ce("
");function Ns(t,e){tt(e,!0);var r,n;let i=dn(e,"topLevel",3,!1),a=dn(e,"closed",15);for(let g of e.hierarchy.children)((n=(r=g.children)===null||r===void 0?void 0:r.length)!==null&&n!==void 0?n:0)>100&&a(a()[g.title]=!0,!0);let s=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function o(g,v){g.stopPropagation(),e.plugin.gitManager.stageAll({dir:v}).catch(w=>e.plugin.displayError(w)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function l(g,v){g.stopPropagation(),e.plugin.gitManager.unstageAll({dir:v}).catch(w=>e.plugin.displayError(w)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function u(g,v){g.stopPropagation(),e.plugin.discardAll(v.vaultPath)}function c(g,v){g.stopPropagation(),a(a()[v.path]=!a()[v.path],!0)}var f=a9();let d;var h=q(f);Wr(h,17,()=>Nc(e.hierarchy.children,500),Vr,(g,v)=>{var w=zi(),b=Cr(w);{var E=k=>{var A=ZW(),y=q(A);{var S=T=>{ju(T,{get change(){return R(v).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},_=T=>{var P=zi(),F=Cr(P);{var D=re=>{Hu(re,{get change(){return R(v).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},M=re=>{var ye=zi(),me=Cr(ye);{var fe=Ge=>{Uu(Ge,{get change(){return R(v).data},get view(){return e.view}})};xe(me,Ge=>{e.fileType==2&&Ge(fe)},!0)}ie(re,ye)};xe(F,re=>{e.fileType==1?re(D):re(M,!1)},!0)}ie(T,P)};xe(y,T=>{e.fileType==0?T(S):T(_,!1)})}j(A),ie(k,A)},x=k=>{var A=i9();A.__click=[KW,c,v];let y;var S=q(A),_=ee(q(S),2);let T;var P=ee(_,2),F=q(P,!0);j(P);var D=ee(P,2),M=q(D),re=q(M);{var ye=oe=>{var B=QW();B.__click=[JW,l,v],ie(oe,B)},me=oe=>{var B=r9(),Z=Cr(B);Z.__click=[e9,u,v];var H=ee(Z,2);H.__click=[t9,o,v],ie(oe,B)};xe(re,oe=>{e.fileType==0?oe(ye):oe(me,!1)})}pl(2),j(M),j(D),j(S);var fe=ee(S,2);{var Ge=oe=>{var B=n9(),Z=q(B);Ns(Z,{get hierarchy(){return R(v)},get plugin(){return e.plugin},get view(){return e.view},get fileType(){return e.fileType},get closed(){return a()},set closed(H){a(H)}}),j(B),On(3,B,()=>mi,()=>({duration:150})),ie(oe,B)};xe(fe,oe=>{a()[R(v).path]||oe(Ge)})}j(A),Fe((oe,B)=>{y=ot(A,1,"tree-item nav-folder",null,y,oe),ge(S,"data-tooltip-position",R(s)),ge(S,"aria-label",R(v).vaultPath),T=ot(_,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,T,B),Be(F,R(v).title)},[()=>({"is-collapsed":a()[R(v).path]}),()=>({"is-collapsed":a()[R(v).path]})]),zr("auxclick",A,oe=>Qn(e.view.app,oe,R(v).vaultPath,e.view.leaf,"git-source-control")),ie(k,A)};xe(b,k=>{R(v).data?k(E):k(x,!1)})}ie(g,w)});var m=ee(h,2);Ls(m,{get files(){return e.hierarchy.children}}),j(f),Fe(g=>d=ot(f,1,"",null,d,g),[()=>({topLevel:i()})]),ie(t,f),rt()}gt(["click"]);function s9(t,e,r,n,i,a){if(ne(e,!0),R(r)){let s=R(r).staged.length>0;n().promiseQueue.addTask(()=>n().commit({fromAuto:!1,commitMessage:R(i),onlyStaged:s}).then(()=>ne(i,n().settings.commitMessage,!0)).finally(a))}}function SM(t,e,r,n,i){t.stopPropagation(),ne(e,!0),r().promiseQueue.addTask(()=>r().gitManager.stageAll({status:R(n)}).finally(i))}function EM(t,e,r,n,i){t.stopPropagation(),ne(e,!0),r().promiseQueue.addTask(()=>r().gitManager.unstageAll({status:R(n)}).finally(i))}function o9(t,e,r,n){ne(e,!0),r().promiseQueue.addTask(()=>r().push().finally(n))}function l9(t,e,r,n){ne(e,!0),r().promiseQueue.addTask(()=>r().pullChangesFromRemote().finally(n))}function c9(t,e){t.stopPropagation(),e().discardAll()}var u9=(t,e,r,n)=>{ne(e,!R(e)),(0,Bs.setIcon)(r[6],R(e)?"list":"folder"),n().settings.treeStructure=R(e),n().saveSettings()},f9=(t,e)=>ne(e,""),d9=ce('
'),h9=(t,e)=>ne(e,!R(e)),p9=ce(" ",1),m9=ce(''),g9=(t,e)=>ne(e,!R(e)),v9=ce(" ",1),w9=ce(''),y9=(t,e)=>ne(e,!R(e)),b9=ce(" ",1),_9=ce(''),x9=ce('
'),S9=ce(''),E9=ce('
'),k9={hash:"svelte-11adhly",code:`.commit-msg-input.svelte-11adhly {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-11adhly {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}main.svelte-11adhly .git-tools:where(.svelte-11adhly) .files-count:where(.svelte-11adhly) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-11adhly {align-items:center;}.git-commit-msg-clear-button.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: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 By(t,e){tt(e,!0),$n(t,k9);let r=dn(e,"plugin",7),n=dn(e,"view",7),i=Ce(!1),a=Ce(void 0),s=Ce(Ne([])),o=Ce(Ne(r().settings.commitMessage)),l=Ne([]),u=Ce(void 0),c=Ce(void 0),f=Ce(void 0),d=Ce(!0),h=Ce(!0),m=Ce(!0),g=Ce(0),v=Ce(Ne({})),w=Ce(Ne({})),b=Ce(Ne({})),E=Ce(Ne(r().settings.treeStructure));n().registerEvent(n().app.workspace.on("obsidian-git:loading-status",()=>ne(i,!0))),n().registerEvent(n().app.workspace.on("obsidian-git:status-changed",()=>void k().catch(console.error))),n().plugin.cachedStatus==null?n().plugin.refresh().catch(console.error):k().catch(console.error),Jt(()=>{l.forEach(Y=>(0,Bs.setIcon)(Y,Y.getAttr("data-icon")))}),Jt(()=>{l.forEach(Y=>{var Ie,Me;!Y||Y.id!="push"||(Bs.Platform.isMobile?(Y.removeClass("button-border"),R(g)>0&&Y.addClass("button-border")):((Ie=Y.firstElementChild)===null||Ie===void 0||Ie.removeAttribute("color"),R(g)>0&&((Me=Y.firstElementChild)===null||Me===void 0||Me.setAttr("color","var(--text-accent)"))))})}),n().scope=new Bs.Scope(r().app.scope),n().scope.register(["Ctrl"],"Enter",Y=>x());function x(){if(ne(i,!0),R(a)){let Y=R(a).staged.length>0;r().promiseQueue.addTask(()=>r().commitAndSync({fromAutoBackup:!1,commitMessage:R(o),onlyStaged:Y}).then(()=>{ne(o,r().settings.commitMessage,!0)}).finally(A))}}function k(){return Ds(this,void 0,void 0,function*(){if(!r().gitReady){ne(a,void 0);return}if(ne(g,yield r().gitManager.getUnpushedCommits(),!0),ne(a,r().cachedStatus,!0),ne(i,!1),r().lastPulledFiles&&r().lastPulledFiles!=R(s)&&(ne(s,r().lastPulledFiles,!0),ne(f,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(s))},!0)),R(a)){let Y=(Ie,Me)=>Ie.vaultPath.split("/").last().localeCompare(ei(Me.vaultPath));R(a).changed.sort(Y),R(a).staged.sort(Y),ne(u,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(a).changed)},!0),ne(c,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(a).staged)},!0)}else ne(u,void 0),ne(c,void 0)})}function A(){n().app.workspace.trigger("obsidian-git:refresh")}let y=Rt(()=>(R(o).match(/\n/g)||[]).length+1||1);var S=E9(),_=q(S),T=q(_),P=q(T);P.__click=x,Ke(P,Y=>l[0]=Y,()=>l==null?void 0:l[0]);var F=ee(P,2);F.__click=[s9,i,a,r,o,A],Ke(F,Y=>l[1]=Y,()=>l==null?void 0:l[1]);var D=ee(F,2);D.__click=[SM,i,r,a,A],Ke(D,Y=>l[2]=Y,()=>l==null?void 0:l[2]);var M=ee(D,2);M.__click=[EM,i,r,a,A],Ke(M,Y=>l[3]=Y,()=>l==null?void 0:l[3]);var re=ee(M,2);re.__click=[o9,i,r,A],Ke(re,Y=>l[4]=Y,()=>l==null?void 0:l[4]);var ye=ee(re,2);ye.__click=[l9,i,r,A],Ke(ye,Y=>l[5]=Y,()=>l==null?void 0:l[5]);var me=ee(ye,2);me.__click=[u9,E,l,r],Ke(me,Y=>l[6]=Y,()=>l==null?void 0:l[6]);var fe=ee(me,2);let Ge;fe.__click=A,Ke(fe,Y=>l[7]=Y,()=>l==null?void 0:l[7]),j(T),j(_);var oe=ee(_,2),B=q(oe);gy(B);var Z=ee(B,2);{var H=Y=>{var Ie=d9();Ie.__click=[f9,o],ge(Ie,"aria-label","Clear"),ie(Y,Ie)};xe(Z,Y=>{R(o)&&Y(H)})}j(oe);var Oe=ee(oe,2),cr=q(Oe);{var Gt=Y=>{var Ie=S9(),Me=q(Ie);let It;var De=q(Me);De.__click=[h9,h];var G=q(De);let Je;var N=ee(G,4),X=q(N),Ee=q(X);Ee.__click=[EM,i,r,a,A],Ke(Ee,Ft=>l[8]=Ft,()=>l==null?void 0:l[8]),j(X);var We=ee(X,2),$t=q(We,!0);j(We),j(N),j(De);var Cl=ee(De,2);{var OM=Ft=>{var qt=m9(),Yi=q(qt);{var Mn=Qt=>{Ns(Qt,{get hierarchy(){return R(c)},get plugin(){return r()},get view(){return n()},get fileType(){return 0},topLevel:!0,get closed(){return R(v)},set closed(pn){ne(v,pn,!0)}})},js=Qt=>{var pn=p9(),Da=Cr(pn);Wr(Da,17,()=>Nc(R(a).staged,500),Vr,(Xi,Pl)=>{ju(Xi,{get change(){return R(Pl)},get view(){return n()},get manager(){return r().gitManager}})});var gi=ee(Da,2);Ls(gi,{get files(){return R(a).staged}}),ie(Qt,pn)};xe(Yi,Qt=>{R(E)?Qt(Mn):Qt(js,!1)})}j(qt),On(3,qt,()=>mi,()=>({duration:150})),ie(Ft,qt)};xe(Cl,Ft=>{R(h)&&Ft(OM)})}j(Me);var qu=ee(Me,2);let qy;var zu=q(qu);zu.__click=[g9,d];var zy=q(zu);let Vy;var Wy=ee(zy,4),jp=q(Wy),Yy=q(jp);Yy.__click=[c9,r];var Xy=ee(Yy,2);Xy.__click=[SM,i,r,a,A],Ke(Xy,Ft=>l[9]=Ft,()=>l==null?void 0:l[9]),j(jp);var Zy=ee(jp,2),MM=q(Zy,!0);j(Zy),j(Wy),j(zu);var DM=ee(zu,2);{var LM=Ft=>{var qt=w9(),Yi=q(qt);{var Mn=Qt=>{Ns(Qt,{get hierarchy(){return R(u)},get plugin(){return r()},get view(){return n()},get fileType(){return 1},topLevel:!0,get closed(){return R(w)},set closed(pn){ne(w,pn,!0)}})},js=Qt=>{var pn=v9(),Da=Cr(pn);Wr(Da,17,()=>Nc(R(a).changed,500),Vr,(Xi,Pl)=>{Hu(Xi,{get change(){return R(Pl)},get view(){return n()},get manager(){return r().gitManager}})});var gi=ee(Da,2);Ls(gi,{get files(){return R(a).changed}}),ie(Qt,pn)};xe(Yi,Qt=>{R(E)?Qt(Mn):Qt(js,!1)})}j(qt),On(3,qt,()=>mi,()=>({duration:150})),ie(Ft,qt)};xe(DM,Ft=>{R(d)&&Ft(LM)})}j(qu);var NM=ee(qu,2);{var BM=Ft=>{var qt=x9();let Yi;var Mn=q(qt);Mn.__click=[y9,m];var js=ee(q(Mn),4),Qt=q(js,!0);j(js),j(Mn);var pn=ee(Mn,2);{var Da=gi=>{var Xi=_9(),Pl=q(Xi);{var HM=Gs=>{Ns(Gs,{get hierarchy(){return R(f)},get plugin(){return r()},get view(){return n()},get fileType(){return 2},topLevel:!0,get closed(){return R(b)},set closed(Vu){ne(b,Vu,!0)}})},UM=Gs=>{var Vu=b9(),Ky=Cr(Vu);Wr(Ky,17,()=>R(s),Vr,(GM,qM)=>{Uu(GM,{get change(){return R(qM)},get view(){return n()}})});var jM=ee(Ky,2);Ls(jM,{get files(){return R(s)}}),ie(Gs,Vu)};xe(Pl,Gs=>{R(E)?Gs(HM):Gs(UM,!1)})}j(Xi),On(3,Xi,()=>mi,()=>({duration:150})),ie(gi,Xi)};xe(pn,gi=>{R(m)&&gi(Da)})}j(qt),Fe(gi=>{Yi=ot(qt,1,"pulled nav-folder",null,Yi,gi),Be(Qt,R(s).length)},[()=>({"is-collapsed":!R(m)})]),ie(Ft,qt)};xe(NM,Ft=>{R(s).length>0&&R(f)&&Ft(BM)})}j(Ie),Fe((Ft,qt,Yi,Mn)=>{It=ot(Me,1,"staged tree-item nav-folder",null,It,Ft),Je=ot(G,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Je,qt),Be($t,R(a).staged.length),qy=ot(qu,1,"changes tree-item nav-folder",null,qy,Yi),Vy=ot(zy,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Vy,Mn),Be(MM,R(a).changed.length)},[()=>({"is-collapsed":!R(h)}),()=>({"is-collapsed":!R(h)}),()=>({"is-collapsed":!R(d)}),()=>({"is-collapsed":!R(d)})]),ie(Y,Ie)};xe(cr,Y=>{R(a)&&R(c)&&R(u)&&Y(Gt)})}j(Oe),j(S),Fe(Y=>{ge(S,"data-type",Dt.type),ge(me,"data-icon",R(E)?"list":"folder"),Ge=ot(fe,1,"clickable-icon nav-action-button",null,Ge,Y),ge(B,"rows",R(y))},[()=>({loading:R(i)})]),Py(B,()=>R(o),Y=>ne(o,Y)),ie(t,S),rt()}gt(["click"]);var Gu=class extends kM.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Dt.type}getDisplayText(){return Dt.name}getIcon(){return Dt.icon}onClose(){return this._view&&Vi(this._view),super.onClose()}reload(){this._view&&Vi(this._view),this._view=Ma(By,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};p();var Ip=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(n=>{this.plugin.switchBranch().catch(i=>r.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()}};p();var AM=require("obsidian");var $p=class{constructor(e){this.plugin=e}get editor(){var n;let e=(n=this.plugin.app.workspace.activeEditor)==null?void 0:n.editor,r=e==null?void 0:e.cm;if(!(!e||!Sn.hasHunksData(r.state)))return{editor:r,obEditor:e}}get gitManager(){return this.plugin.gitManager}resetHunk(e){if(!this.editor)return;let{editor:r,obEditor:n}=this.editor,i=Sn.getHunk(r.state,!1,e);if(i){let a,s;i.type==="delete"?(a=i.added.start+1,s=i.added.start+1):(a=i.added.start-0,s=i.added.start-1+i.added.count);let o=r.state.doc.line(a).from,l=i.type==="delete"?r.state.doc.line(s).from:r.state.doc.line(s).to+1,u=i.removed.lines.join(` +`);i.removed.lines.length>0&&!i.removed.no_nl_at_eof&&(u+=` +`),n.replaceRange(u,n.offsetToPos(o),n.offsetToPos(l)),n.setSelection(n.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,n=Sn.getHunk(r.state,!1,e),i=!1;if(n||(n=Sn.getHunk(r.state,!0,e),i=!0),!n)return;let a=r.state.field(AM.editorInfoField).file.path,s=Et.createPatch(a,[n],"100644",i).join(` +`)+` +`;await this.gitManager.applyPatch(s),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:n}=this.editor,i=Sn.getHunks(r.state,!1),a=n.getCursor().line+1,s=Et.findNearestHunk(a,i,e,!0);if(s==null)return;let o=i[s];if(o){let l=o.added.start-1;n.setCursor(l,0),n.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};p();p();var Hs=require("obsidian");var Fp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof Hs.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),a$(()=>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;m$(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new wh(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 _e?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(A$),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),u$(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;return void((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var n;return e instanceof Hs.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof Hs.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",h$)}};p();var Tl=require("obsidian");p();p();var Us=require("@codemirror/state"),Mp=require("@codemirror/view");var Op=class extends Mp.GutterMarker{constructor(r,n){super();this.type=r;this.staged=n}toDOM(r){let n=document.createElement("div");return n.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&n.setText("~"),n}},Hy=Us.StateField.define({create:()=>Us.RangeSet.empty,update:(t,e)=>{let r=e.state.field(xr,!1);if(!r)return Us.RangeSet.empty;let n=e.effects.some(a=>a.is(tu)),i=e.effects.some(a=>a.is(tl));if(n||i||(e.docChanged||t.size==0)&&r.isDirty==!1){let a=new Set,s=TM(e,r.hunks,!1,a),o=TM(e,r.stagedHunks,!0,a);return t=Us.RangeSet.of([...s,...o],!0),t}else e.docChanged&&(t=t.map(e.changes));return t}});function TM(t,e,r,n){let i=[];for(let s=0;s0?e[s-1]:void 0,l=s{var e;return(e=t.state.field(Hy,!1))!=null?e:Us.RangeSet.empty},initialSpacer:t=>new Op("delete",!1),domEventHandlers:{click:(t,e,r)=>{var i;return((i=Sn.getHunkAtPos(t.state,e.from,!1))!=null?i:Sn.getHunkAtPos(t.state,e.from,!0))&&(ws(t,e.from),r.preventDefault()),!1}}});var Dp=class{constructor(e){this.plugin=e}async trackChanged(e){return this.trackChangedHelper(e).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeSigns(e.path)}}destroy(){}async computeSigns(e){let n=await this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager.show("",e).catch(()=>{});this.notifySignComputationResultToSubscribers(e,{compareText:n,compareTextHead:void 0})}notifySignComputationResultToSubscribers(e,r){Fi.ifFilepathDefinedTransformSubscribers(e,n=>n.forEach(i=>i.notifyGitCompare(r)))}},PM=[VF,WF,CM,Hy,Gh],RM=[xr,b0];p();var Uy=require("obsidian"),Lp=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;e.addClass("git-changes-status-bar"),r.settings.hunks.statusBar==="colored"&&e.addClass("git-changes-status-bar-colored"),e.setAttr("aria-label","Git diff of the current editor"),this.statusBarEl.setAttribute("data-tooltip-position","top"),r.app.workspace.on("active-leaf-change",n=>{(!n||n.getRoot()==r.app.workspace.rootSplit&&!(n.view instanceof Uy.MarkdownView))&&this.statusBarEl.empty()})}display(e,r){var o;let n=this.plugin.app.workspace.getActiveViewOfType(Uy.MarkdownView);if(!n||((o=n.file)==null?void 0:o.path)!==(r==null?void 0:r.path))return;let i=0,a=0,s=0;for(let l of e)i+=Math.max(0,l.added.count-l.removed.count),a+=Math.min(l.added.count,l.removed.count),s+=Math.max(0,l.removed.count-l.added.count);this.statusBarEl.empty(),i>0&&this.statusBarEl.createSpan({text:`+${i} `,cls:"git-add"}),a>0&&this.statusBarEl.createSpan({text:`~${a} `,cls:"git-change"}),s>0&&this.statusBarEl.createSpan({text:`-${s}`,cls:"git-delete"})}remove(){this.statusBarEl.remove()}};var Np=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.signsProvider){console.warn("Git: undefined signsProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof Tl.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.signsProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions)}conditionallyActivateBySettings(){(this.plg.settings.hunks.showSigns||this.plg.settings.hunks.statusBar!="disabled"||this.plg.settings.hunks.hunkCommands)&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;if(this.signsProvider=new Dp(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),this.plg.settings.hunks.statusBar!="disabled"){let e=this.plg.addStatusBarItem();this.changeStatusBar=new Lp(e,this.plg)}}catch(e){console.warn("Git: Error while loading signs feature.",e),this.deactivateFeature()}}deactivateFeature(){var e,r;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.signsProvider)==null||e.destroy(),this.signsProvider=void 0,(r=this.changeStatusBar)==null||r.remove(),this.changeStatusBar=void 0}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&Tl.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof _e?this.plg.gitManager:void 0}}refresh(){this.plg.settings.hunks.showSigns&&this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(RM),this.plg.settings.hunks.showSigns&&this.codeMirrorExtensions.push(...PM),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileRenameEvent=this.createFileRenameEvent(),this.pluginRefreshedEvent=this.createPluginRefreshedEvent(),this.intervalRefreshEvent=this.createIntervalRefreshEvent(),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileRenameEvent),this.plg.registerEvent(this.pluginRefreshedEvent),this.plg.registerInterval(this.intervalRefreshEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent),this.plg.app.workspace.offref(this.pluginRefreshedEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent),window.clearInterval(this.intervalRefreshEvent)}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var n;return Fi.ifFilepathDefinedTransformSubscribers(r,i=>i.forEach(a=>{a.changeToNewFilepath(e.path)})),e instanceof Tl.TFile&&((n=this.signsProvider)==null?void 0:n.trackChanged(e))})}createPluginRefreshedEvent(){return this.plg.app.workspace.on("obsidian-git:refresh",()=>{this.refresh()})}createIntervalRefreshEvent(){return window.setInterval(()=>{var e,r;(e=this.plg.app.workspace.activeEditor)!=null&&e.file&&((r=this.signsProvider)==null||r.trackChanged(this.plg.app.workspace.activeEditor.file).catch(console.error))},10*1e3)}};p();var IM=require("@codemirror/state"),Bp=require("obsidian");var jy=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let n=this.view.state,i=i$(e,r,n);this.view.dispatch(i)}notifyGitCompare(e){if(this.view===void 0){console.warn("Git: View is not defined for editor cache key. Unforeseen situation. id: ");return}if(this.removeIfStale())return;let r=this.view.state,n=r.field(xr);if(!n||n.compareText!=e.compareText||n.compareTextHead!=e.compareTextHead){let i=vF(e,r);this.view.dispatch(i)}}updateToNewState(e){return this.state=e,!this.lastSeenPath&&this.filepath&&this.subscribeMe(),this}removeIfStale(){var e;return((e=this.view)==null?void 0:e.state.field(Gy,!1))!=this||this.view.destroyed?(this.unsubscribeMe(this.lastSeenPath),!0):!1}changeToNewFilepath(e){this.unsubscribeMe(this.lastSeenPath),this.subscribeMe(e)}subscribeMe(e){e!=null||(e=this.filepath),e!==void 0&&(Fi.ifFilepathDefinedTransformSubscribers(e,r=>r.add(this)),this.lastSeenPath=e)}unsubscribeMe(e){Fi.ifFilepathDefinedTransformSubscribers(e,r=>r.delete(this))}get filepath(){var e,r;return(r=(e=this.state.field(Bp.editorInfoField))==null?void 0:e.file)==null?void 0:r.path}get view(){return this.state.field(Bp.editorEditorField)}},Gy=IM.StateField.define({create:t=>new jy(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});var Hp=class{constructor(e){this.plg=e;this.lineAuthoringFeature=new Fp(this.plg);this.signsFeature=new Np(this.plg)}onUnloadPlugin(){this.lineAuthoringFeature.deactivateFeature(),this.signsFeature.deactivateFeature()}onLoadPlugin(){this.plg.registerEditorExtension(Gy),this.lineAuthoringFeature.onLoadPlugin(),this.signsFeature.onLoadPlugin()}onReady(){this.lineAuthoringFeature.conditionallyActivateBySettings(),this.signsFeature.conditionallyActivateBySettings()}activateLineAuthoring(){this.lineAuthoringFeature.activateFeature()}deactiveLineAuthoring(){this.lineAuthoringFeature.deactivateFeature()}refreshSignsSettings(){let e=this.plg.settings.hunks;e.showSigns||e.statusBar!="disabled"||e.hunkCommands?(this.signsFeature.deactivateFeature(),this.signsFeature.activateFeature()):this.signsFeature.deactivateFeature()}};var Up=class extends we.Plugin{constructor(){super(...arguments);this.automaticsManager=new Zc(this);this.tools=new fu(this);this.localStorage=new qh(this);this.state={gitAction:0,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new rd(this);this.intervalsToClear=[];this.editorIntegration=new Hp(this);this.hunkActions=new $p(this)}setPluginState(r){var n;this.state=Object.assign(this.state,r),(n=this.statusBar)==null||n.display()}async updateCachedStatus(){var r,n;return this.app.workspace.trigger("obsidian-git:loading-status"),this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((r=this.branchBar)==null?void 0:r.display())):(this.localStorage.setConflict(!1),await((n=this.branchBar)==null?void 0:n.display())),this.app.workspace.trigger("obsidian-git:status-changed",this.cachedStatus),this.cachedStatus}async refresh(){if(!this.gitReady)return;let r=this.app.workspace.getLeavesOfType(Dt.type),n=this.app.workspace.getLeavesOfType(Qr.type);(this.settings.changedFilesInStatusBar||r.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)})||n.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)}))&&await this.updateCachedStatus().catch(i=>this.displayError(i)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Zn.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new yh(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(r=>this.displayError(r))))}onExternalSettingsChange(){this.reloadSettings().catch(r=>this.displayError(r))}async reloadSettings(){let r=JSON.stringify(this.settings);await this.loadSettings();let n=JSON.stringify(this.settings);r!==n&&(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(Qr.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(r=>this.displayError(r))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(r,n,i)=>{this.handleFileMenu(r,n,i,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(r,n,i)=>{this.handleFileMenu(r,n,i,"obsidian-git:menu")})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{this.onActiveLeafChange(r)})),this.registerEvent(this.app.vault.on("modify",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerView(Dt.type,r=>new Gu(r,this)),this.registerView(Qr.type,r=>new Nu(r,this)),this.registerView(ga.type,r=>new ys(r,this)),this.registerView(ma.type,r=>new bs(r,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let r=this.app.workspace.getLeavesOfType(Dt.type),n;r.length===0?(n=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await n.setViewState({type:Dt.type})):n=r.first(),await this.app.workspace.revealLeaf(n)}),this.registerHoverLinkSource(Dt.type,{display:"Git View",defaultMod:!0}),this.editorIntegration.onLoadPlugin(),this.setRefreshDebouncer(),YF(this)}setRefreshDebouncer(){var r;(r=this.debRefresh)==null||r.cancel(),this.debRefresh=(0,we.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(r,n){let i=this.gitManager.getRelativeRepoPath(r,!0),a=rP({isFolder:n,gitRelativePath:i});await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+a),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,n,i,a){if(!this.gitReady||!this.settings.showFileMenu||!n)return;let s;if(typeof n=="string"?s=n:s=n.path,i=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof we.TFile?await this.stageFile(n):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(s,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof we.TFile?await this.unstageFile(n):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(s,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(s,n instanceof we.TFolder).catch(u=>this.displayError(u))})})),i=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(u=>{this.addFileToGitignore(s,n instanceof we.TFolder).catch(c=>this.displayError(c))})});let o=this.app.vault.adapter;a==="obsidian-git:menu"&&o instanceof we.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(u=>{this.app.openWithDefaultApp(s)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(u=>{window.electron.shell.showItemInFolder(FM.join(o.getBasePath(),s))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,n;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(n=this.statusBar)==null||n.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();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 r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=oA(Xe,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return we.Platform.isDesktopApp}async init({fromReload:r=!1}){var n;if(this.settings.showStatusBar&&!this.statusBar){let i=this.addStatusBarItem();this.statusBar=new bh(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 _e(this),await this.gitManager.setGitInstance()):this.gitManager=new _n(this);let i=await this.gitManager.checkRequirements(),a=this.localStorage.getPausedAutomatics();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new we.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}),we.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let s=this.addStatusBarItem();this.branchBar=new Ip(s,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.display().catch(console.error))},6e4))}await((n=this.branchBar)==null?void 0:n.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!a&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),a||await this.automaticsManager.init(),a&&new we.Notice("Automatic routines are currently paused.");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 we.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let n=await new ze(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(n){let i="Vault Root",a=await new ze(this,{options:this.gitManager instanceof _n?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof _n}).openAndGetResult();if(a==null)return;if(a===i&&(a="."),a=(0,we.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new ze(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 we.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new ze(this,{options:["Abort clone",d],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===d)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new we.Notice("Aborted clone");return}}}let s=await new ze(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(s===void 0){new we.Notice("Aborted clone");return}if(s!==""&&(o=parseInt(s),isNaN(o))){new we.Notice("Invalid depth. Aborting clone.");return}new we.Notice(`Cloning new repo into "${a}"`);let l=this.settings.basePath,u=a&&a!==".";u&&(this.settings.basePath=a);try{await this.gitManager.clone(ew(n),a,o),new we.Notice("Cloned new repo."),new we.Notice("Please restart Obsidian"),u&&await this.saveSettings()}catch(c){this.displayError(c),this.settings.basePath=l,await this.saveSettings()}}}async isAllInitialized(){return this.gitReady||await this.init({fromReload:!0}),this.gitReady}async pullChangesFromRemote(){if(!await this.isAllInitialized())return;let r=await this.pull();if(r!==!1){if(r||this.displayMessage("Pull: Everything is up-to-date"),this.gitManager instanceof _e){let n=await this.updateCachedStatus();n.conflicted.length>0&&(this.displayError(`You have conflicts in ${n.conflicted.length} ${n.conflicted.length==1?"file":"files"}`),await this.handleConflict(n.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync({fromAutoBackup:r,requestCustomMessage:n=!1,commitMessage:i,onlyStaged:a=!1}){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:r,requestCustomMessage:n,commitMessage:i,onlyStaged:a}))||(this.settings.syncMethod!="reset"&&this.settings.pullBeforePush&&await this.pull(),this.settings.disablePush||(await this.remotesAreSet()&&await this.gitManager.canPush()?await this.push():this.displayMessage("No commits to push")),this.setPluginState({gitAction:0}))}async commit({fromAuto:r,requestCustomMessage:n=!1,onlyStaged:i=!1,commitMessage:a,amend:s=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,u=[],c=[];if(this.gitManager instanceof _e){if(await this.mayDeleteConflictFile(),l=await this.updateCachedStatus(),l.conflicted.length==0&&(o=!1),r&&l.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${l.conflicted.length} ${l.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(l.conflicted),!1;u=l.staged,c=l.changed}else{if(r&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;{o&&await this.mayDeleteConflictFile();let f=this.gitManager;i?u=await f.getStagedFiles():c=(await f.getUnstagedFiles()).map(({path:h,type:m})=>({vaultPath:this.gitManager.getRelativeVaultPath(h),path:h,type:m}))}}if(await this.tools.hasTooBigFiles(i?u:[...u,...c]))return this.setPluginState({gitAction:0}),!1;if(c.length+u.length!==0||o){let f=a!=null?a:a=r?this.settings.autoCommitMessage:this.settings.commitMessage;if(r&&this.settings.customMessageOnAutoBackup||n){!this.settings.disablePopups&&r&&new we.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let m=await new _h(this).openAndGetResult();if(m!=null&&m!=""&&m!="...")f=m;else return this.setPluginState({gitAction:0}),!1}else if(this.gitManager instanceof _e&&this.settings.commitMessageScript){let m=this.settings.commitMessageScript,g=this.localStorage.getHostname()||"",v=m.replace("{{hostname}}",g);v=v.replace("{{date}}",(0,we.moment)().format(this.settings.commitDateFormat));let w=await Bc("sh",["-c",v],{cwd:this.gitManager.absoluteRepoPath});w.code!=0?this.displayError(w.stderr):w.stdout.trim().length==0?this.displayMessage("Stdout from commit message script is empty. Using default message."):f=w.stdout}let d;i?d=await this.gitManager.commit({message:f,amend:s}):d=await this.gitManager.commitAll({message:f,status:l,unstagedFiles:c,amend:s}),this.gitManager instanceof _e&&await this.updateCachedStatus();let h=!1;d===void 0&&(h=!0,d=c.length+u.length||0),this.displayMessage(`Committed${h?" approx.":""} ${d} ${d==1?"file":"files"}`)}else this.displayMessage("No changes to commit");return this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(o){return this.displayError(o),!1}}async push(){if(!await this.isAllInitialized()||!await this.remotesAreSet())return!1;let r=this.localStorage.getConflict();try{this.gitManager instanceof _e&&await this.mayDeleteConflictFile();let n;if(this.gitManager instanceof _e&&(n=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${n.conflicted.length} ${n.conflicted.length==1?"file":"files"}`),await this.handleConflict(n.conflicted),!1;if(this.gitManager instanceof _n&&r)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(n){return n instanceof Io?this.handleNoNetworkError(n):this.displayError(n),!1}}async pull(){if(!await this.remotesAreSet())return!1;try{this.log("Pulling....");let r=await this.gitManager.pull()||[];return this.setPluginState({offlineMode:!1}),r.length>0&&(this.displayMessage(`Pulled ${r.length} ${r.length==1?"file":"files"} from remote`),this.lastPulledFiles=r),r.length}catch(r){return this.displayError(r),!1}}async fetch(){if(await this.remotesAreSet())try{await this.gitManager.fetch(),this.displayMessage("Fetched from remote"),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh")}catch(r){this.displayError(r)}}async mayDeleteConflictFile(){let r=this.app.vault.getAbstractFileByPath(Ro);r&&(this.app.workspace.iterateAllLeaves(n=>{var i;n.view instanceof we.MarkdownView&&((i=n.view.file)==null?void 0:i.path)==r.path&&n.detach()}),await this.app.vault.delete(r))}async stageFile(r){return await this.isAllInitialized()?(await this.gitManager.stage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async unstageFile(r){return await this.isAllInitialized()?(await this.gitManager.unstage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async switchBranch(){var i;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo(),n=await new Pp(this,r.branches).openAndGetReslt();if(n!=null)return await this.gitManager.checkout(n),this.displayMessage(`Switched to ${n}`),this.app.workspace.trigger("obsidian-git:refresh"),await((i=this.branchBar)==null?void 0:i.display()),n}async switchRemoteBranch(){var a;if(!await this.isAllInitialized())return;let r=await this.selectRemoteBranch()||"",[n,i]=Ri(r);if(i!=null&&n!=null)return await this.gitManager.checkout(i,n),this.displayMessage(`Switched to ${r}`),await((a=this.branchBar)==null?void 0:a.display()),r}async createBranch(){var n;if(!await this.isAllInitialized())return;let r=await new ze(this,{placeholder:"Create new branch"}).openAndGetResult();if(r!=null)return await this.gitManager.createBranch(r),this.displayMessage(`Created new branch ${r}`),await((n=this.branchBar)==null?void 0:n.display()),r}async deleteBranch(){var i;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo();r.current&&r.branches.remove(r.current);let n=await new ze(this,{options:r.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(n!=null){let a=!1;if(!await this.gitManager.branchIsMerged(n)){let o=await new ze(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(n,a),this.displayMessage(`Deleted branch ${n}`),await((i=this.branchBar)==null?void 0:i.display()),n}}async remotesAreSet(){return this.settings.updateSubmodules||(await this.gitManager.branchInfo()).tracking?!0:(new we.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let r=await this.selectRemoteBranch();return r==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setPluginState({gitAction:0}),!1):(await this.gitManager.updateUpstreamBranch(r),this.displayMessage(`Set upstream branch to ${r}`),this.setPluginState({gitAction:0}),!0)}async discardAll(r){if(!await this.isAllInitialized())return!1;let n=await this.gitManager.status({path:r}),i=0,a=0;for(let o of n.changed)o.workingDir=="U"?i++:a++;if(i+a==0)return!1;let s=await new Al({app:this.app,filesToDeleteCount:i,filesToDiscardCount:a,path:r!=null?r:""}).openAndGetResult();switch(s){case!1:return s;case"discard":await this.gitManager.discardAll({dir:r,status:this.cachedStatus});break;case"delete":{await this.gitManager.discardAll({dir:r,status:this.cachedStatus});let o=await this.gitManager.getUntrackedPaths({path:r,status:this.cachedStatus});for(let l of o){let u=this.gitManager.getRelativeVaultPath(l),c=this.app.vault.getAbstractFileByPath(u);c?await this.app.fileManager.trashFile(c):l.endsWith("/")?await this.app.vault.adapter.rmdir(u,!0):await this.app.vault.adapter.remove(u)}break}default:Md(s)}return this.app.workspace.trigger("obsidian-git:refresh"),s}async handleConflict(r){this.localStorage.setConflict(!0);let n;r!==void 0&&(n=["# Conflicts","Please resolve them and commit them using the commands `Git: Commit all changes` followed by `Git: Push`","(This file will automatically be deleted before commit)","[[#Additional Instructions]] available below file list","",...r.map(i=>{let a=this.app.vault.getAbstractFileByPath(i);return a instanceof we.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 +\`\`\``]),await this.tools.writeAndOpenFile(n==null?void 0:n.join(` +`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(this,{options:r,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 ze(this,{initialValue:a,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,ew(o)),i}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),n;r.length===0&&(n=await this.editRemotes(),n==null&&(r=await this.gitManager.getRemotes()));let i=new ze(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=n!=null?n:await i.openAndGetResult();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a),l=await new ze(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(a+"/")?l:`${a}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();i&&await this.gitManager.removeRemote(i)}onActiveLeafChange(r){var s,o;let n=r==null?void 0:r.view;if(!(n!=null&&n.getState().file)&&!(n instanceof ys||n instanceof bs))return;let i=this.app.workspace.getLeavesOfType(Dt.type).first(),a=this.app.workspace.getLeavesOfType(Qr.type).first();if((s=i==null?void 0:i.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||s.removeClass("is-active"),(o=a==null?void 0:a.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof ys||(r==null?void 0:r.view)instanceof bs){let u=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let c;i&&r.view.state.aRef=="HEAD"?c=i.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${u}"]`):i&&r.view.state.aRef==""?c=i.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${u}"]`):a&&(c=a.view.containerEl.querySelector(`div.tree-item-self[data-path='${u}']`)),c==null||c.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,n=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(r.toLowerCase(),n),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new we.Notice(r,5*1e3),this.log(r)}displayError(r,n=10*1e3){var a;if(r instanceof $M.Errors.UserCanceledError){new we.Notice("Aborted");return}let i;r instanceof Error?i=r:i=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new we.Notice(i.message,n),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),n)}log(...r){console.log(`${this.manifest.id}:`,...r)}}; +/*! Bundled license information: + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + +buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) + +safe-buffer/index.js: + (*! safe-buffer. MIT License. Feross Aboukhadijeh *) + +crc-32/crc32.js: + (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) + +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 + *) +*/ + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json new file mode 100644 index 0000000..f0be393 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -0,0 +1,10 @@ +{ + "author": "Vinzent", + "authorUrl": "https://github.com/Vinzent03", + "id": "obsidian-git", + "name": "Git", + "description": "Integrate Git version control with automatic backup and other advanced features.", + "isDesktopOnly": false, + "fundingUrl": "https://ko-fi.com/vinzent", + "version": "2.36.1" +} diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css new file mode 100644 index 0000000..92c8af8 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -0,0 +1,705 @@ +@keyframes loading { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +.git-signs-gutter { + .cm-gutterElement { + /* Needed to align the sign properly for different line heigts. Such as + * when having a heading or list item. + */ + padding-top: 0 !important; + } +} + +.workspace-leaf-content[data-type="git-view"] .button-border { + border: 2px solid var(--interactive-accent); + border-radius: var(--radius-s); +} + +.workspace-leaf-content[data-type="git-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.workspace-leaf-content[data-type="git-history-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.loading { + overflow: hidden; +} + +.loading > svg { + animation: 2s linear infinite loading; + transform-origin: 50% 50%; + display: inline-block; +} + +.obsidian-git-center { + margin: auto; + text-align: center; + width: 50%; +} + +.obsidian-git-textarea { + display: block; + margin-left: auto; + margin-right: auto; +} + +.obsidian-git-disabled { + opacity: 0.5; +} + +.obsidian-git-center-button { + display: block; + margin: 20px auto; +} + +.tooltip.mod-left { + overflow-wrap: break-word; +} + +.tooltip.mod-right { + overflow-wrap: break-word; +} + +/* Limits the scrollbar to the view body */ +.git-view { + display: flex; + flex-direction: column; + position: relative; + height: 100%; +} + +.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; +} + +.workspace-leaf-content[data-type="git-view"] .tree-item-self, +.workspace-leaf-content[data-type="git-history-view"] .tree-item-self { + align-items: center; +} + +.workspace-leaf-content[data-type="git-view"] + .tree-item-self:hover + .clickable-icon, +.workspace-leaf-content[data-type="git-history-view"] + .tree-item-self:hover + .clickable-icon { + color: var(--icon-color-hover); +} + +/* Highlight an item as active if it's diff is currently opened */ +.is-active .git-tools .buttons > * { + color: var(--nav-item-color-active); +} + +.git-author { + color: var(--text-accent); +} + +.git-date { + color: var(--text-accent); +} + +.git-ref { + color: var(--text-accent); +} + +/* ====== diff2html ====== +The following styles are adapted from the obsidian-version-history plugin by +@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss +which itself is adapted from the diff2html library with the following original license: + + https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md + + Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +.theme-dark, +.theme-light { + --git-delete-bg: #ff475040; + --git-delete-hl: #96050a75; + --git-insert-bg: #68d36840; + --git-insert-hl: #23c02350; + --git-change-bg: #ffd55840; + --git-selected: #3572b0; + + --git-delete: #c33; + --git-insert: #399839; + --git-change: #d0b44c; + --git-move: #3572b0; +} + +.git-diff { + .d2h-d-none { + display: none; + } + .d2h-wrapper { + text-align: left; + border-radius: 0.25em; + overflow: auto; + } + .d2h-file-header.d2h-file-header { + background-color: var(--background-secondary); + border-bottom: 1px solid var(--background-modifier-border); + font-family: + Source Sans Pro, + Helvetica Neue, + Helvetica, + Arial, + sans-serif; + height: 35px; + padding: 5px 10px; + } + .d2h-file-header, + .d2h-file-stats { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + } + .d2h-file-header { + display: none; + } + .d2h-file-stats { + font-size: 14px; + margin-left: auto; + } + .d2h-lines-added { + border: 1px solid var(--color-green); + border-radius: 5px 0 0 5px; + color: var(--color-green); + padding: 2px; + text-align: right; + vertical-align: middle; + } + .d2h-lines-deleted { + border: 1px solid var(--color-red); + border-radius: 0 5px 5px 0; + color: var(--color-red); + margin-left: 1px; + padding: 2px; + text-align: left; + vertical-align: middle; + } + .d2h-file-name-wrapper { + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 15px; + width: 100%; + } + .d2h-file-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--text-normal); + font-size: var(--h5-size); + } + .d2h-file-wrapper { + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + margin-bottom: 1em; + max-height: 100%; + } + .d2h-file-collapse { + -webkit-box-pack: end; + -ms-flex-pack: end; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + cursor: pointer; + display: none; + font-size: 12px; + justify-content: flex-end; + padding: 4px 8px; + } + .d2h-file-collapse.d2h-selected { + background-color: var(--git-selected); + } + .d2h-file-collapse-input { + margin: 0 4px 0 0; + } + .d2h-diff-table { + border-collapse: collapse; + font-family: var(--font-monospace); + font-size: var(--code-size); + width: 100%; + } + .d2h-files-diff { + width: 100%; + } + .d2h-file-diff { + /* + overflow-y: scroll; + */ + border-radius: 5px; + font-size: var(--font-text-size); + line-height: var(--line-height-normal); + } + .d2h-file-side-diff { + display: inline-block; + margin-bottom: -8px; + margin-right: -4px; + overflow-x: scroll; + overflow-y: hidden; + width: 50%; + } + .d2h-code-line { + padding-left: 6em; + padding-right: 1.5em; + } + .d2h-code-line, + .d2h-code-side-line { + display: inline-block; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + white-space: nowrap; + width: 100%; + } + .d2h-code-side-line { + /* needed to be changed */ + padding-left: 0.5em; + padding-right: 0.5em; + } + .d2h-code-line-ctn { + word-wrap: normal; + background: none; + display: inline-block; + padding: 0; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + vertical-align: middle; + width: 100%; + /* only works for line-by-line */ + white-space: pre-wrap; + } + .d2h-code-line del, + .d2h-code-side-line del { + background-color: var(--git-delete-hl); + color: var(--text-normal); + } + .d2h-code-line del, + .d2h-code-line ins, + .d2h-code-side-line del, + .d2h-code-side-line ins { + border-radius: 0.2em; + display: inline-block; + margin-top: -1px; + text-decoration: none; + vertical-align: middle; + } + .d2h-code-line ins, + .d2h-code-side-line ins { + background-color: var(--git-insert-hl); + text-align: left; + } + .d2h-code-line-prefix { + word-wrap: normal; + background: none; + display: inline; + padding: 0; + white-space: pre; + } + .line-num1 { + float: left; + } + .line-num1, + .line-num2 { + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + /* + padding: 0 0.5em; + */ + text-overflow: ellipsis; + width: 2.5em; + padding-left: 0; + } + .line-num2 { + float: right; + } + .d2h-code-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + display: inline-block; + position: absolute; + text-align: right; + width: 5.5em; + } + .d2h-code-linenumber:after { + content: "\200b"; + } + .d2h-code-side-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + overflow: hidden; + padding: 0 0.5em; + text-align: right; + text-overflow: ellipsis; + width: 4em; + /* needed to be changed */ + display: table-cell; + position: relative; + } + .d2h-code-side-linenumber:after { + content: "\200b"; + } + .d2h-code-side-emptyplaceholder, + .d2h-emptyplaceholder { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + } + .d2h-code-line-prefix, + .d2h-code-linenumber, + .d2h-code-side-linenumber, + .d2h-emptyplaceholder { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + .d2h-code-linenumber, + .d2h-code-side-linenumber { + direction: rtl; + } + .d2h-del { + background-color: var(--git-delete-bg); + border-color: var(--git-delete-hl); + } + .d2h-ins { + background-color: var(--git-insert-bg); + border-color: var(--git-insert-hl); + } + .d2h-info { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + color: var(--text-faint); + } + .d2h-del, + .d2h-ins, + .d2h-file-diff .d2h-change { + color: var(--text-normal); + } + .d2h-file-diff .d2h-del.d2h-change { + background-color: var(--git-change-bg); + } + .d2h-file-diff .d2h-ins.d2h-change { + background-color: var(--git-insert-bg); + } + .d2h-file-list-wrapper { + a { + text-decoration: none; + cursor: default; + -webkit-user-drag: none; + } + + svg { + display: none; + } + } + .d2h-file-list-header { + text-align: left; + } + .d2h-file-list-title { + display: none; + } + .d2h-file-list-line { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + text-align: left; + } + .d2h-file-list { + } + .d2h-file-list > li { + border-bottom: 1px solid var(--background-modifier-border); + margin: 0; + padding: 5px 10px; + } + .d2h-file-list > li:last-child { + border-bottom: none; + } + .d2h-file-switch { + cursor: pointer; + display: none; + font-size: 10px; + } + .d2h-icon { + fill: currentColor; + margin-right: 10px; + vertical-align: middle; + } + .d2h-deleted { + color: var(--git-delete); + } + .d2h-added { + color: var(--git-insert); + } + .d2h-changed { + color: var(--git-change); + } + .d2h-moved { + color: var(--git-move); + } + .d2h-tag { + background-color: var(--background-secondary); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 10px; + margin-left: 5px; + padding: 0 2px; + } + .d2h-deleted-tag { + border: 1px solid var(--git-delete); + } + .d2h-added-tag { + border: 1px solid var(--git-insert); + } + .d2h-changed-tag { + border: 1px solid var(--git-change); + } + .d2h-moved-tag { + border: 1px solid var(--git-move); + } + + /* needed for line-by-line*/ + + .d2h-diff-tbody { + position: relative; + } +} + +/* ====================== 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; + } +} + +.git-unified-diff-view, +.git-split-diff-view .cm-deletedLine .cm-changedText { + background-color: #ee443330; +} + +.git-unified-diff-view, +.git-split-diff-view .cm-insertedLine .cm-changedText { + background-color: #22bb2230; +} + +.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +/* Override styling of Codemirror merge view "collapsed lines" indicator */ +.git-split-diff-view .ͼ2 .cm-collapsedLines { + background: var(--interactive-normal); + border-radius: var(--radius-m); + color: var(--text-accent); + font-size: var(--font-small); + padding: var(--size-4-1) var(--size-4-1); +} +.git-split-diff-view .ͼ2 .cm-collapsedLines:hover { + background: var(--interactive-hover); + color: var(--text-accent-hover); +} + +.git-signs-gutter { + .cm-gutterElement { + display: grid; + } +} + +.git-gutter-marker:hover { + border-radius: 2px; +} + +.git-gutter-marker.git-add { + background-color: var(--color-green); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-change { + background-color: var(--color-yellow); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-changedelete { + color: var(--color-yellow); + font-weight: var(--font-bold); + font-size: 1rem; + justify-self: center; + height: inherit; +} + +.git-gutter-marker.git-delete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: end; +} + +.git-gutter-marker.git-topdelete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: start; +} + +div:hover > .git-gutter-marker.git-change { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-add { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-delete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-topdelete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-changedelete { + font-weight: var(--font-bold); +} + +.git-gutter-marker.staged { + opacity: 0.5; +} + +.git-diff { + .cm-merge-revert { + width: 4em; + } + /* Ensure that merge revert markers are positioned correctly */ + .cm-merge-revert > * { + position: absolute; + background-color: var(--background-secondary); + display: flex; + } +} + +/* Prevent shifting of the editor when git signs gutter is the only gutter present */ +.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) { + margin-inline-end: 0; + .git-signs-gutter { + margin-inline-start: -1rem; + } +} + +.git-changes-status-bar-colored { + .git-add { + color: var(--color-green); + } + .git-change { + color: var(--color-yellow); + } + .git-delete { + color: var(--color-red); + } +} + +.git-changes-status-bar .git-add { + margin-right: 0.3em; +} + +.git-changes-status-bar .git-change { + margin-right: 0.3em; +} diff --git a/.obsidian/plugins/obsidian-icon-folder/data.json b/.obsidian/plugins/obsidian-icon-folder/data.json new file mode 100644 index 0000000..d801b21 --- /dev/null +++ b/.obsidian/plugins/obsidian-icon-folder/data.json @@ -0,0 +1,31 @@ +{ + "settings": { + "migrated": 6, + "iconPacksPath": ".obsidian/icons", + "fontSize": 16, + "emojiStyle": "native", + "iconColor": null, + "recentlyUsedIcons": [], + "recentlyUsedIconsSize": 5, + "rules": [], + "extraMargin": { + "top": 0, + "right": 4, + "bottom": 0, + "left": 0 + }, + "iconInTabsEnabled": false, + "iconInTitleEnabled": false, + "iconInTitlePosition": "above", + "iconInFrontmatterEnabled": false, + "iconInFrontmatterFieldName": "icon", + "iconColorInFrontmatterFieldName": "iconColor", + "iconsBackgroundCheckEnabled": false, + "iconsInNotesEnabled": true, + "iconsInLinksEnabled": true, + "iconIdentifier": ":", + "lucideIconPackType": "native", + "debugMode": false, + "useInternalPlugins": false + } +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-icon-folder/main.js b/.obsidian/plugins/obsidian-icon-folder/main.js new file mode 100644 index 0000000..271b2ff --- /dev/null +++ b/.obsidian/plugins/obsidian-icon-folder/main.js @@ -0,0 +1,7158 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ROLLUP +if you want to view the source visit the plugins github repository +*/ + +'use strict'; + +var obsidian = require('obsidian'); +var view = require('@codemirror/view'); +var state = require('@codemirror/state'); +var language = require('@codemirror/language'); + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, 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 ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +const iconPacks$1 = { + faBrands: { + name: 'font-awesome-brands', + displayName: 'FontAwesome Brands', + path: 'fontawesome-free-6.5.1-web/svgs/brands/', + downloadLink: 'https://github.com/FortAwesome/Font-Awesome/releases/download/6.5.1/fontawesome-free-6.5.1-web.zip', + }, + faRegular: { + name: 'font-awesome-regular', + displayName: 'FontAwesome Regular', + path: 'fontawesome-free-6.5.1-web/svgs/regular/', + downloadLink: 'https://github.com/FortAwesome/Font-Awesome/releases/download/6.5.1/fontawesome-free-6.5.1-web.zip', + }, + faSolid: { + name: 'font-awesome-solid', + displayName: 'FontAwesome Solid', + path: 'fontawesome-free-6.5.1-web/svgs/solid/', + downloadLink: 'https://github.com/FortAwesome/Font-Awesome/releases/download/6.5.1/fontawesome-free-6.5.1-web.zip', + }, + remixIcons: { + name: 'remix-icons', + displayName: 'Remix Icons', + path: '', + downloadLink: 'https://github.com/Remix-Design/RemixIcon/releases/download/v4.2.0/RemixIcon_Svg_v4.2.0.zip', + }, + iconBrew: { + name: 'icon-brew', + displayName: 'Icon Brew', + path: '', + downloadLink: 'https://github.com/FlorianWoelki/obsidian-iconize/raw/main/iconPacks/icon-brew.zip', + }, + /** @source https://simpleicons.org/ */ + simpleIcons: { + name: 'simple-icons', + displayName: 'Simple Icons', + path: 'simple-icons-11.10.0/icons/', + downloadLink: 'https://github.com/simple-icons/simple-icons/archive/refs/tags/11.10.0.zip', + }, + lucide: { + name: 'lucide-icons', + displayName: 'Lucide', + path: '', + downloadLink: 'https://github.com/lucide-icons/lucide/releases/download/0.363.0/lucide-icons-0.363.0.zip', + }, + tablerIcons: { + name: 'tabler-icons', + displayName: 'Tabler Icons', + path: 'svg', + downloadLink: 'https://github.com/tabler/tabler-icons/releases/download/v3.1.0/tabler-icons-3.1.0.zip', + }, + /** @source https://boxicons.com/ */ + boxicons: { + name: 'boxicons', + displayName: 'Boxicons', + path: 'svg', + downloadLink: 'https://github.com/FlorianWoelki/obsidian-iconize/raw/main/iconPacks/boxicons.zip', + }, + /** @source http://nagoshiashumari.github.io/Rpg-Awesome/ */ + rpgAwesome: { + name: 'rpg-awesome', + displayName: 'RPG Awesome', + path: '', + downloadLink: 'https://github.com/FlorianWoelki/obsidian-iconize/raw/main/iconPacks/rpg-awesome.zip', + }, + /** @source https://coolicons.cool/ */ + coolicons: { + name: 'coolicons', + displayName: 'Coolicons', + path: 'cooliocns SVG', + downloadLink: 'https://github.com/krystonschwarze/coolicons/releases/download/v4.1/coolicons.v4.1.zip', + }, + /** @source https://feathericons.com/ */ + feathericons: { + name: 'feather-icons', + displayName: 'Feather Icons', + path: 'feather-4.29.1/icons/', + downloadLink: 'https://github.com/feathericons/feather/archive/refs/tags/v4.29.1.zip', + }, + /** @source https://github.com/primer/octicons */ + octicons: { + name: 'octicons', + displayName: 'Octicons', + path: 'octicons-19.8.0/icons/', + downloadLink: 'https://github.com/primer/octicons/archive/refs/tags/v19.8.0.zip', + }, +}; +/** + * Returns a possible path to the icon pack. + * @param name String of the icon pack name. + * @returns String of the path to the icon pack or undefined if the icon pack does not + * exist. + */ +const getExtraPath = (iconPackName) => { + var _a; + const path = (_a = Object.values(iconPacks$1).find((iconPack) => iconPack.name === iconPackName)) === null || _a === void 0 ? void 0 : _a.path; + return (path === null || path === void 0 ? void 0 : path.length) === 0 ? undefined : path; +}; + +// This library file does not include any other dependency and is a standalone file that +// only include utility functions for manipulating or extracting svg information. +/** + * Extracts an SVG string from a given input string and returns a cleaned up and + * formatted SVG string. + * @param svgString SVG string to extract from. + * @returns Cleaned up and formatted SVG string. + */ +const extract = (svgString) => { + var _a, _b; + // Removes unnecessary spaces and newlines. + svgString = svgString.replace(/(\r\n|\n|\r)/gm, ''); + svgString = svgString.replace(/>\s+<'); + // Create a parser for better parsing of HTML. + const parser = new DOMParser(); + const svg = parser + .parseFromString(svgString, 'text/html') + .querySelector('svg'); + // Removes `width` and `height` from the `style` attribute. + if (svg.hasAttribute('style')) { + svg.style.width = ''; + svg.style.height = ''; + } + // Add `viewbox`, if it is not already a attribute. + if (svg.viewBox.baseVal.width === 0 && svg.viewBox.baseVal.height === 0) { + const width = (_a = svg.width.baseVal.value) !== null && _a !== void 0 ? _a : 16; + const height = (_b = svg.height.baseVal.value) !== null && _b !== void 0 ? _b : 16; + svg.viewBox.baseVal.width = width; + svg.viewBox.baseVal.height = height; + } + if (!svg.hasAttribute('fill')) { + svg.setAttribute('fill', 'currentColor'); + } + const possibleTitle = svg.querySelector('title'); + if (possibleTitle) { + possibleTitle.remove(); + } + svg.setAttribute('width', '16px'); + svg.setAttribute('height', '16px'); + return svg.outerHTML; +}; +/** + * Sets the font size of an SVG string by modifying its width and/or height attributes. + * The font size will be always set in pixels. + * @param svgString SVG string to modify. + * @param fontSize Font size in pixels to set. + * @returns Modified SVG string. + */ +const setFontSize = (svgString, fontSize) => { + const widthRe = new RegExp(/width="[\d.]+(px)?"/); + const heightRe = new RegExp(/height="[\d.]+(px)?"/); + if (svgString.match(widthRe)) { + svgString = svgString.replace(widthRe, `width="${fontSize}px"`); + } + if (svgString.match(heightRe)) { + svgString = svgString.replace(heightRe, `height="${fontSize}px"`); + } + return svgString; +}; +/** + * Replaces the fill or stroke color of an SVG string with a given color. + * @param svgString SVG string to modify. + * @param color Color to set. Defaults to 'currentColor'. + * @returns The modified SVG string. + */ +const colorize = (svgString, color) => { + if (!color) { + color = 'currentColor'; + } + const parser = new DOMParser(); + // Tries to parse the string into a HTML node. + const parsedNode = parser.parseFromString(svgString, 'text/html'); + const svg = parsedNode.querySelector('svg'); + if (svg) { + if (svg.hasAttribute('fill') && svg.getAttribute('fill') !== 'none') { + svg.setAttribute('fill', color); + } + else if (svg.hasAttribute('stroke') && + svg.getAttribute('stroke') !== 'none') { + svg.setAttribute('stroke', color); + } + return svg.outerHTML; + } + return svgString; +}; +var svg = { + extract, + colorize, + setFontSize, +}; + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +function commonjsRequire(path) { + throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); +} + +var jszip_min = {exports: {}}; + +/*! + +JSZip v3.10.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/ + +var hasRequiredJszip_min; + +function requireJszip_min () { + if (hasRequiredJszip_min) return jszip_min.exports; + hasRequiredJszip_min = 1; + (function (module, exports) { + !function(e){module.exports=e();}(function(){return function s(a,o,h){function u(r,e){if(!o[r]){if(!a[r]){var t="function"==typeof commonjsRequire&&commonjsRequire;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return u(t||e)},i,i.exports,s,a,o,h);}return o[r].exports}for(var l="function"==typeof commonjsRequire&&commonjsRequire,e=0;e>2,s=(3&t)<<4|r>>4,a=1>6:64,o=2>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),l[h++]=t,64!==s&&(l[h++]=r),64!==a&&(l[h++]=n);return l};},{"./support":30,"./utils":32}],2:[function(e,t,r){var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i;}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o;},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate");},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){var n=e("./utils");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e;}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return -1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t.charCodeAt(a))];return -1^e}(0|t,e,e.length,0):0};},{"./utils":32}],5:[function(e,t,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null;},{}],6:[function(e,t,r){var n=null;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n};},{lie:37}],7:[function(e,t,r){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),a=e("./stream/GenericWorker"),o=n?"uint8array":"array";function h(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={};}r.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1);},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0);},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null;},h.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta});};},r.compressWorker=function(e){return new h("Deflate",e)},r.uncompressWorker=function(){return new h("Inflate",{})};},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){function A(e,t){var r,n="";for(r=0;r>>=8;return n}function n(e,t,r,n,i,s){var a,o,h=e.file,u=e.compression,l=s!==O.utf8encode,f=I.transformTo("string",s(h.name)),c=I.transformTo("string",O.utf8encode(h.name)),d=h.comment,p=I.transformTo("string",s(d)),m=I.transformTo("string",O.utf8encode(d)),_=c.length!==h.name.length,g=m.length!==d.length,b="",v="",y="",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),"UNIX"===i?(C=798,z|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(e){return 63&(e||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+c,b+="up"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+="uc"+A(y.length,2)+y);var E="";return E+="\n\0",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+"\0\0\0\0"+A(z,4)+A(n,4)+f+b+p}}var I=e("../utils"),i=e("../stream/GenericWorker"),O=e("../utf8"),B=e("../crc32"),R=e("../signature");function s(e,t,r,n){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[];}I.inherits(s,i),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}));},s.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}});}else this.accumulate=!0;},s.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return R.DATA_DESCRIPTOR+A(e.crc32,4)+A(e.compressedSize,4)+A(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null;},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i;},{"../utils":32}],19:[function(e,t,r){var n=e("./Uint8ArrayReader");function i(e){n.call(this,e);}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i;},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){var n=e("./DataReader");function i(e){n.call(this,e);}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i;},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){var n=e("./ArrayReader");function i(e){n.call(this,e);}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i;},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){var n=e("../utils"),i=e("../support"),s=e("./ArrayReader"),a=e("./StringReader"),o=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new o(e):i.uint8array?new h(n.transformTo("uint8array",e)):new s(n.transformTo("array",e)):new a(e)};},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b";},{}],24:[function(e,t,r){var n=e("./GenericWorker"),i=e("../utils");function s(e){n.call(this,"ConvertWorker to "+e),this.destType=e;}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta});},t.exports=s;},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){var n=e("./GenericWorker"),i=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0);}e("../utils").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e);},t.exports=s;},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0);}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length;}i.prototype.processChunk.call(this,e);},t.exports=s;},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat();},function(e){t.error(e);});}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null;},s.prototype.resume=function(){return !!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0));},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return !1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t);}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s;},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null;}n.prototype={push:function(e){this.emit("data",e);},end:function(){if(this.isFinished)return !1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0;}catch(e){this.emit("error",e);}return !0},error:function(e){return !this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[];},emit:function(e,t){if(this._listeners[e])for(var r=0;r "+e:e}},t.exports=n;},{}],29:[function(e,t,r){var h=e("../utils"),i=e("./ConvertWorker"),s=e("./GenericWorker"),u=e("../base64"),n=e("../support"),a=e("../external"),o=null;if(n.nodestream)try{o=e("../nodejs/NodejsStreamOutputAdapter");}catch(e){}function l(e,o){return new a.Promise(function(t,r){var n=[],i=e._internalType,s=e._outputType,a=e._mimeType;e.on("data",function(e,t){n.push(e),o&&o(t);}).on("error",function(e){n=[],r(e);}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return h.newBlob(h.transformTo("arraybuffer",t),r);case"base64":return u.encode(t);default:return h.transformTo(e,t)}}(s,function(e,t){var r,n=0,i=null,s=0;for(r=0;r>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return h.nodebuffer?o.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,i,s=e.length,a=new Array(2*s);for(t=r=0;t>10&1023,a[r++]=56320|1023&n);}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(e=o.transformTo(h.uint8array?"uint8array":"array",e))},o.inherits(a,n),a.prototype.processChunk=function(e){var t=o.transformTo(h.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length);}else t=this.leftOver.concat(t);this.leftOver=null;}var n=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}(t),i=t;n!==t.length&&(h.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:s.utf8decode(i),meta:e.meta});},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null);},s.Utf8DecodeWorker=a,o.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta});},s.Utf8EncodeWorker=l;},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,a){var o=e("./support"),h=e("./base64"),r=e("./nodejsUtils"),u=e("./external");function n(e){return e}function l(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0);},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4));}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new h.Buf8(e.length),r=0,n=t.length;r>10&1023,o[n++]=56320|1023&i);}return l(o,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t};},{"./common":41}],43:[function(e,t,r){t.exports=function(e,t,r,n){for(var i=65535&e|0,s=e>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3>>1:e>>>1;t[r]=e;}return t}();t.exports=function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return -1^e};},{}],46:[function(e,t,r){var h,c=e("../utils/common"),u=e("./trees"),d=e("./adler32"),p=e("./crc32"),n=e("./messages"),l=0,f=4,m=0,_=-2,g=-1,b=4,i=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(e,t){return e.msg=n[t],t}function T(e){return (e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(c.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0));}function N(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm);}function U(e,t){e.pending_buf[e.pending++]=t;}function P(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t;}function L(e,t){var r,n,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,h=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,u=e.window,l=e.w_mask,f=e.prev,c=e.strstart+S,d=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===d&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sh&&0!=--i);return a<=e.lookahead?a:e.lookahead}function j(e){var t,r,n,i,s,a,o,h,u,l,f=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-z)){for(c.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;n=e.head[--t],e.head[t]=f<=n?n-f:0,--r;);for(t=r=f;n=e.prev[--t],e.prev[t]=f<=n?n-f:0,--r;);i+=f;}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,h=e.strstart+e.lookahead,u=i,l=void 0,l=a.avail_in,u=x)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x)if(n=u._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-x,n=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(j(e),0===e.lookahead&&t===l)return A;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,N(e,!1),0===e.strm.avail_out))return A;if(e.strstart-e.block_start>=e.w_size-z&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(e,t){return Y(e,t,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},r.deflate=function(e,t){var r,n,i,s;if(!e||!e.state||5>8&255),U(n,n.gzhead.time>>16&255),U(n,n.gzhead.time>>24&255),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(U(n,255&n.gzhead.extra.length),U(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(U(n,0),U(n,0),U(n,0),U(n,0),U(n,0),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,3),n.status=E);else {var a=v+(n.w_bits-8<<4)<<8;a|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=E,P(n,a),0!==n.strstart&&(P(n,e.adler>>>16),P(n,65535&e.adler)),e.adler=1;}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending!==n.pending_buf_size));)U(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73);}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.gzindex=0,n.status=91);}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.status=103);}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&F(e),n.pending+2<=n.pending_buf_size&&(U(n,255&e.adler),U(n,e.adler>>8&255),e.adler=0,n.status=E)):n.status=E),0!==n.pending){if(F(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&T(t)<=T(r)&&t!==f)return R(e,-5);if(666===n.status&&0!==e.avail_in)return R(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===l)return A;break}if(e.match_length=0,r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):3===n.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=S){if(j(e),e.lookahead<=S&&t===l)return A;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&0e.lookahead&&(e.match_length=e.lookahead);}if(e.match_length>=x?(r=u._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):h[n.level].func(n,t);if(o!==O&&o!==B||(n.status=666),o===A||o===O)return 0===e.avail_out&&(n.last_flush=-1),m;if(o===I&&(1===t?u._tr_align(n):5!==t&&(u._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),F(e),0===e.avail_out))return n.last_flush=-1,m}return t!==f?m:n.wrap<=0?1:(2===n.wrap?(U(n,255&e.adler),U(n,e.adler>>8&255),U(n,e.adler>>16&255),U(n,e.adler>>24&255),U(n,255&e.total_in),U(n,e.total_in>>8&255),U(n,e.total_in>>16&255),U(n,e.total_in>>24&255)):(P(n,e.adler>>>16),P(n,65535&e.adler)),F(e),0=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new c.Buf8(r.w_size),c.arraySet(u,t,l-r.w_size,r.w_size,0),t=u,l=r.w_size),a=e.avail_in,o=e.next_in,h=e.input,e.avail_in=l,e.next_in=0,e.input=t,j(r);r.lookahead>=x;){for(n=r.strstart,i=r.lookahead-(x-1);r.ins_h=(r.ins_h<>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else {if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(d&(1<>>=y,p-=y),p<15&&(d+=z[n++]<>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(d&(1<>>=y,p-=y,(y=s-a)>3,d&=(1<<(p-=w<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){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 I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(i),t.sane=1,t.back=-1,N):U}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):U}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(I.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),I.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(I.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>>8&255,r.check=B(r.check,E,2,0)),l=u=0;}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,n,s,d,k)),512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&d>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break e;o--,u+=n[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30;}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=n[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286>>=3,l-=3;}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=_,l-=_,r.lens[r.have++]=b;else {if(16===b){for(z=_+2;l>>=_,l-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2;}else if(17===b){for(z=_+3;l>>=_)),u>>>=3,l-=3;}else {for(z=_+7;l>>=_)),u>>>=7,l-=7;}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=k;}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=h){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,R(e,c),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v;}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra;}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v;}if(u>>>=_,l-=_,r.back+=_,64&g){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra;}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===h)break e;if(d=c-h,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),m=r.window;}else m=i,p=a-r.offset,d=r.length;for(hd?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=t[r+a[v]];}if(k>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255;}function P(e,t,r){e.bi_valid>d-r?(e.bi_buf|=t<>d-e.bi_valid,e.bi_valid+=r-d):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){var n,i,s=new Array(g+1),a=0;for(n=1;n<=g;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=j(s[o]++,o));}}function W(e){var t;for(t=0;t>1;1<=r;r--)G(e,s,r);for(i=h;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,o,h=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=g;s++)e.bl_count[s]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<_;r++)p<(s=h[2*h[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),h[2*n+1]=s,u>=7;n>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?J(e,t,r,n):4===e.strategy||s===i?(P(e,2+(n?1:0),3),K(e,z,C)):(P(e,4+(n?1:0),3),function(e,t,r,n){var i;for(P(e,t-257,5),P(e,r-1,5),P(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+u+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){P(e,2,3),L(e,m,z),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8);}(e);};},{"../utils/common":41}],53:[function(e,t,r){t.exports=function(){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;};},{}],54:[function(e,t,r){(function(e){!function(r,n){if(!r.setImmediate){var i,s,t,a,o=1,h={},u=!1,l=r.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(r);e=e&&e.setTimeout?e:r,i="[object process]"==={}.toString.call(r.process)?function(e){process.nextTick(function(){c(e);});}:function(){if(r.postMessage&&!r.importScripts){var e=!0,t=r.onmessage;return r.onmessage=function(){e=!1;},r.postMessage("","*"),r.onmessage=t,e}}()?(a="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",d,!1):r.attachEvent("onmessage",d),function(e){r.postMessage(a+e,"*");}):r.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data);},function(e){t.port2.postMessage(e);}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,s.removeChild(t),t=null;},s.appendChild(t);}):function(e){setTimeout(c,0,e);},e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r __awaiter(void 0, void 0, void 0, function* () { + const fetched = yield obsidian.requestUrl({ url }); + const bytes = fetched.arrayBuffer; + return bytes; +}); +/** + * Transforms a JSZip file into a File object. + * @param file JSZip file to transform. + * @returns File object of the JSZip file. + */ +const getFileFromJSZipFile = (file) => __awaiter(void 0, void 0, void 0, function* () { + const fileData = yield file.async('blob'); + const filename = file.name.split('/').pop(); + return new File([fileData], filename); +}); +/** + * Read a zip file and return the files inside it. + * @param bytes ArrayBuffer of the zip file. + * @param extraPath String path to filter the files inside the zip file. This can be used + * to set an extra path (like a directory inside the zip file) to filter the files. + * @returns Array of loaded files inside the zip file. + */ +const readZipFile = (bytes_1, ...args_1) => __awaiter(void 0, [bytes_1, ...args_1], void 0, function* (bytes, extraPath = '') { + const unzippedFiles = yield jszip_minExports.loadAsync(bytes); + return Promise.resolve(unzippedFiles).then((unzipped) => { + if (!Object.keys(unzipped.files).length) { + return Promise.reject('No file was found'); + } + const files = []; + // Regex for retrieving the files inside the zip file or inside the directory of a + // zip file. + const regex = new RegExp(extraPath + '(.+)\\.svg', 'g'); + Object.entries(unzippedFiles.files).forEach(([_, v]) => { + const matched = v.name.match(regex); + if (!v.dir && matched && matched.length > 0) { + files.push(v); + } + }); + return files; + }); +}); + +const PLUGIN_NAME = 'iconize'; +const TITLE_ICON_CLASS = 'iconize-title-icon'; +const INLINE_TITLE_WRAPPER_CLASS = 'iconize-inline-title-wrapper'; +/** + * The name of the attribute that is used to store the icon name in the node. + * The value of this attributes contains the prefix and the name of the icon. + */ +const ICON_ATTRIBUTE_NAME = 'data-icon'; +var config = { + PLUGIN_NAME, + TITLE_ICON_CLASS, + INLINE_TITLE_WRAPPER_CLASS, + ICON_ATTRIBUTE_NAME, +}; + +var LoggerPrefix; +(function (LoggerPrefix) { + LoggerPrefix["Outline"] = "Outline"; +})(LoggerPrefix || (LoggerPrefix = {})); +class ConsoleLogger { + constructor(projectPrefix, enabled = false) { + this.logLevels = { + log: { label: 'LOG:' }, + info: { label: 'INFO:' }, + warn: { label: 'WARN:' }, + error: { label: 'ERROR:' }, + }; + this.projectPrefix = projectPrefix; + this.enabled = enabled; + } + formatMessage(level, message, prefix, optionalParams) { + const timestamp = new Date().toISOString(); + const { label } = this.logLevels[level]; + const prefixAsStr = !prefix ? '' : `/${prefix}`; + return [ + `${this.projectPrefix}${prefixAsStr}: [${timestamp}] ${label} ${message}`, + ...optionalParams, + ]; + } + log(message, prefix, ...optionalParams) { + if (this.enabled) { + console.log(...this.formatMessage('log', message, prefix, optionalParams)); + } + } + info(message, prefix, ...optionalParams) { + if (this.enabled) { + console.info(...this.formatMessage('info', message, prefix, optionalParams)); + } + } + warn(message, prefix, ...optionalParams) { + if (this.enabled) { + console.warn(...this.formatMessage('warn', message, prefix, optionalParams)); + } + } + error(message, prefix, ...optionalParams) { + if (this.enabled) { + console.error(...this.formatMessage('error', message, prefix, optionalParams)); + } + } + toggleLogging(enabled) { + this.enabled = enabled; + } +} +const logger = new ConsoleLogger(config.PLUGIN_NAME); + +const LUCIDE_ICON_PACK_NAME = 'lucide-icons'; +let path; +const getPath = () => { + return path; +}; +const setPath = (newPath) => { + if (newPath === 'plugins/obsidian-icon-folder/icons') { + newPath = '.obsidian/plugins/obsidian-icon-folder/icons'; + new obsidian.Notice(`[${config.PLUGIN_NAME}] Due to a change in version v1.2.2, the icon pack folder changed. Please change it in the settings to not be directly in /plugins.`, 8000); + } + path = newPath; +}; +let preloadedIcons = []; +const getPreloadedIcons = () => { + return preloadedIcons; +}; +const resetPreloadedIcons = () => { + preloadedIcons = []; +}; +let iconPacks = []; +const addLucideIconsPack = (plugin) => { + iconPacks.push({ + name: LUCIDE_ICON_PACK_NAME, + prefix: 'Li', + custom: false, + icons: plugin.doesUseNativeLucideIconPack() + ? obsidian.getIconIds() + .map((iconId) => iconId.replace(/^lucide-/, '')) + .map((iconId) => { + const iconEl = obsidian.getIcon(iconId); + iconEl.removeClass('svg-icon'); // Removes native `svg-icon` class. + return { + name: getNormalizedName(iconId), + filename: iconId, + prefix: 'Li', + svgElement: iconEl === null || iconEl === void 0 ? void 0 : iconEl.outerHTML, + svgContent: iconEl === null || iconEl === void 0 ? void 0 : iconEl.innerHTML, + svgViewbox: '', + iconPackName: LUCIDE_ICON_PACK_NAME, + }; + }) + : [], + }); +}; +const addCustomLucideIconPack = (plugin) => __awaiter(void 0, void 0, void 0, function* () { + const iconPackIndex = iconPacks.findIndex((iconPack) => iconPack.name === LUCIDE_ICON_PACK_NAME); + if (iconPackIndex > -1) { + iconPacks.splice(iconPackIndex); + } + const iconPack = iconPacks$1['lucide']; + const arrayBuffer = yield downloadZipFile(iconPack.downloadLink); + yield createZipFile(plugin, `${iconPack.name}.zip`, arrayBuffer); + yield registerIconPack(iconPack.name, arrayBuffer); +}); +const removeCustomLucideIconPack = (plugin) => __awaiter(void 0, void 0, void 0, function* () { + const iconPackIndex = iconPacks.findIndex((iconPack) => iconPack.name === LUCIDE_ICON_PACK_NAME); + if (iconPackIndex > -1) { + iconPacks.splice(iconPackIndex); + } + yield deleteIconPack(plugin, LUCIDE_ICON_PACK_NAME); +}); +const moveIconPackDirectories = (plugin, from, to) => __awaiter(void 0, void 0, void 0, function* () { + // Tries to move all icon packs to the new folder. + for (let i = 0; i < iconPacks.length; i++) { + const iconPack = iconPacks[i]; + if (yield plugin.app.vault.adapter.exists(`${from}/${iconPack.name}`)) { + // Tries to create a new directory in the new path. + const doesDirExist = yield createDirectory(plugin, iconPack.name); + if (doesDirExist) { + new obsidian.Notice(`Directory with name ${iconPack.name} already exists.`); + continue; + } + } + new obsidian.Notice(`Moving ${iconPack.name}...`); + // Move the zip file. + if (yield plugin.app.vault.adapter.exists(`${from}/${iconPack.name}.zip`)) { + yield plugin.app.vault.adapter.copy(`${from}/${iconPack.name}.zip`, `${to}/${iconPack.name}.zip`); + } + // Move all other files inside of the iconpack directory. + const filesInDirectory = yield getFilesInDirectory(plugin, `${from}/${iconPack.name}`); + for (const file of filesInDirectory) { + const fileName = file.split('/').pop(); + yield plugin.app.vault.adapter.copy(`${from}/${iconPack.name}/${fileName}`, `${to}/${iconPack.name}/${fileName}`); + } + new obsidian.Notice(`...moved ${iconPack.name}`); + } + // Removes all the existing icon packs in the `from` directory. + for (let i = 0; i < iconPacks.length; i++) { + const iconPack = iconPacks[i]; + if (yield plugin.app.vault.adapter.exists(`${from}/${iconPack.name}`)) { + yield plugin.app.vault.adapter.rmdir(`${from}/${iconPack.name}`, true); + } + } + // Remove root directory that contains all the icon packs. + if (!to.startsWith(from)) { + yield plugin.app.vault.adapter.rmdir(`${from}`, true); + } +}); +const createCustomIconPackDirectory = (plugin, dir) => __awaiter(void 0, void 0, void 0, function* () { + yield createDirectory(plugin, dir); + const prefix = createIconPackPrefix(dir); + iconPacks.push({ name: dir, icons: [], prefix, custom: true }); +}); +const deleteIconPack = (plugin, dir) => __awaiter(void 0, void 0, void 0, function* () { + iconPacks = iconPacks.filter((iconPack) => iconPack.name !== dir); + // Check for the icon pack directory and delete it. + if (yield plugin.app.vault.adapter.exists(`${path}/${dir}`)) { + yield plugin.app.vault.adapter.rmdir(`${path}/${dir}`, true); + } + // Check for the icon pack zip file and delete it. + if (yield plugin.app.vault.adapter.exists(`${path}/${dir}.zip`)) { + yield plugin.app.vault.adapter.remove(`${path}/${dir}.zip`); + } +}); +const doesIconPackExist = (plugin, iconPackName) => { + return plugin.app.vault.adapter.exists(`${path}/${iconPackName}`); +}; +const createDirectory = (plugin, dir) => __awaiter(void 0, void 0, void 0, function* () { + const doesDirExist = yield plugin.app.vault.adapter.exists(`${path}/${dir}`); + if (!doesDirExist) { + yield plugin.app.vault.adapter.mkdir(`${path}/${dir}`); + } + return doesDirExist; +}); +const getNormalizedName = (s) => { + return s + .split(/[ -]|[ _]/g) + .map((part) => part.charAt(0).toUpperCase() + part.slice(1)) + .join(''); +}; +// export const normalizeFileName = async (plugin: Plugin, oldPath: string) => { +// const fileName = oldPath.split('/').pop(); +// const newPath = oldPath.substring(0, oldPath.indexOf(fileName)) + getNormalizedName(fileName); +// await plugin.app.vault.adapter.rename(oldPath, newPath); +// }; +const createZipFile = (plugin, filename, buffer) => __awaiter(void 0, void 0, void 0, function* () { + yield plugin.app.vault.adapter.writeBinary(`${path}/${filename}`, buffer); +}); +const createFile = (plugin, iconPackName, filename, content, absoluteFilename) => __awaiter(void 0, void 0, void 0, function* () { + const normalizedFilename = getNormalizedName(filename); + const exists = yield plugin.app.vault.adapter.exists(`${path}/${iconPackName}/${normalizedFilename}`); + if (exists) { + const folderSplit = absoluteFilename.split('/'); + if (folderSplit.length >= 2) { + const folderName = folderSplit[folderSplit.length - 2]; + const newFilename = folderName + normalizedFilename; + yield plugin.app.vault.adapter.write(`${path}/${iconPackName}/${newFilename}`, content); + logger.info(`Renamed old file ${normalizedFilename} to ${newFilename} due to duplication`); + new obsidian.Notice(`[${config.PLUGIN_NAME}] Renamed ${normalizedFilename} to ${newFilename} to avoid duplication.`, 8000); + } + else { + logger.warn(`Could not create icons with duplicated file names (file name: ${normalizedFilename})`); + new obsidian.Notice(`[${config.PLUGIN_NAME}] Could not create duplicated icon name (${normalizedFilename})`, 8000); + } + } + else { + yield plugin.app.vault.adapter.write(`${path}/${iconPackName}/${normalizedFilename}`, content); + } +}); +const createDefaultDirectory = (plugin) => __awaiter(void 0, void 0, void 0, function* () { + yield createDirectory(plugin, ''); +}); +const getAllIconPacks = () => { + return iconPacks; +}; +const getFilesInDirectory = (plugin, dir) => __awaiter(void 0, void 0, void 0, function* () { + if (!(yield plugin.app.vault.adapter.exists(dir))) { + return []; + } + return (yield plugin.app.vault.adapter.list(dir)).files; +}); +const validIconName = /^[(A-Z)|(0-9)]/; +const svgViewboxRegex = /viewBox="([^"]*)"/g; +const svgContentRegex = /(.*?)<\/svg>/g; +const generateIcon = (iconPackName, iconName, content) => { + if (content.length === 0) { + return; + } + content = content.replace(/(\r\n|\n|\r)/gm, ''); + content = content.replace(/>\s+<'); + const normalizedName = iconName.charAt(0).toUpperCase() + iconName.substring(1); + if (!validIconName.exec(normalizedName)) { + logger.info(`Skipping icon with invalid name: ${iconName}`); + return null; + } + const svgViewboxMatch = content.match(svgViewboxRegex); + let svgViewbox = ''; + if (svgViewboxMatch && svgViewboxMatch.length !== 0) { + svgViewbox = svgViewboxMatch[0]; + } + const svgContentMatch = content.match(svgContentRegex); + if (!svgContentMatch) { + logger.info(`Skipping icon with invalid svg content: ${iconName}`); + return null; + } + const svgContent = svgContentMatch.map((val) => val.replace(/<\/?svg>/g, '').replace(//g, ''))[0]; + const iconPackPrefix = createIconPackPrefix(iconPackName); + const icon = { + name: normalizedName.split('.svg')[0], + prefix: iconPackPrefix, + iconPackName, + filename: iconName, + svgContent, + svgViewbox, + svgElement: svg.extract(content), + }; + return icon; +}; +const createIconPackPrefix = (iconPackName) => { + if (iconPackName.includes('-')) { + const splitted = iconPackName.split('-'); + let result = splitted[0].charAt(0).toUpperCase(); + for (let i = 1; i < splitted.length; i++) { + result += splitted[i].charAt(0).toLowerCase(); + } + return result; + } + return (iconPackName.charAt(0).toUpperCase() + iconPackName.charAt(1).toLowerCase()); +}; +const loadUsedIcons = (plugin, icons) => __awaiter(void 0, void 0, void 0, function* () { + const iconPacks = (yield listPath(plugin)).folders.map((iconPack) => iconPack.split('/').pop()); + if (plugin.doesUseNativeLucideIconPack()) { + iconPacks.push(LUCIDE_ICON_PACK_NAME); + } + for (let i = 0; i < icons.length; i++) { + const entry = icons[i]; + if (!entry) { + continue; + } + yield loadIcon(plugin, iconPacks, entry); + } +}); +const listPath = (plugin, listPath) => { + return plugin.app.vault.adapter.list(path); +}; +const getIconPackNameByPrefix = (prefix) => { + var _a; + return (_a = iconPacks.find((iconPack) => iconPack.prefix === prefix)) === null || _a === void 0 ? void 0 : _a.name; +}; +const nextIdentifier = (iconName) => { + return iconName.substring(1).search(/[(A-Z)|(0-9)]/) + 1; +}; +const loadIcon = (plugin, iconPackNames, iconName) => __awaiter(void 0, void 0, void 0, function* () { + const nextLetter = nextIdentifier(iconName); + const prefix = iconName.substring(0, nextLetter); + const name = iconName.substring(nextLetter); + const iconPack = iconPackNames.find((folder) => { + const folderPrefix = createIconPackPrefix(folder); + return prefix === folderPrefix; + }); + if (!iconPack) { + // Ignore because background check automatically adds the icons and icon pack + // directories. + if (!plugin.getSettings().iconsBackgroundCheckEnabled) { + new obsidian.Notice(`Seems like you do not have an icon pack installed. (${iconName})`, 5000); + } + return; + } + if (iconPack === LUCIDE_ICON_PACK_NAME && + plugin.doesUseNativeLucideIconPack()) { + // Native lucide icons already exist for Obsidian. + const lucideIcons = iconPacks.find((iconPack) => iconPack.name === LUCIDE_ICON_PACK_NAME); + const icon = lucideIcons.icons.find((icon) => icon.name === name); + if (!icon) { + logger.warn(`Icon ${icon} does not exist in the native Lucide icon pack.`); + return; + } + preloadedIcons.push(icon); + return; + } + const fullPath = path + '/' + iconPack + '/' + name + '.svg'; + if (!(yield plugin.app.vault.adapter.exists(fullPath))) { + logger.info(`Icon with name '${name}' was not found (full path: ${fullPath})`); + return; + } + const content = yield plugin.app.vault.adapter.read(fullPath); + const icon = generateIcon(iconPack, name, content); + preloadedIcons.push(icon); +}); +const initIconPacks = (plugin) => __awaiter(void 0, void 0, void 0, function* () { + // Remove the beginning slash because paths which start with `/` are the same as without + // a slash. + if (path.startsWith('/')) { + path = path.slice(1); + } + const loadedIconPacks = yield plugin.app.vault.adapter.list(path); + // Extract all zip files which will be downloaded icon packs. + const zipFiles = {}; + for (let i = 0; i < loadedIconPacks.files.length; i++) { + const fileName = loadedIconPacks.files[i]; + if (fileName.endsWith('.zip')) { + const arrayBuffer = yield plugin.app.vault.adapter.readBinary(fileName); + const files = yield readZipFile(arrayBuffer); + const iconPackName = fileName.split('/').pop().split('.zip')[0]; + zipFiles[iconPackName] = files; + } + } + // Check for custom-made icon packs. + for (let i = 0; i < loadedIconPacks.folders.length; i++) { + const folderName = loadedIconPacks.folders[i].split('/').pop(); + // Continue if the icon pack does have a zip file. + if (zipFiles[folderName]) { + continue; + } + const files = yield getFilesInDirectory(plugin, `${path}/${folderName}`); + const loadedIcons = []; + // Convert files into loaded svgs. + for (let j = 0; j < files.length; j++) { + const iconNameRegex = files[j].match(new RegExp(path + '/' + folderName + '/(.*)')); + const iconName = getNormalizedName(iconNameRegex[1]); + const iconContent = yield plugin.app.vault.adapter.read(files[j]); + const icon = generateIcon(folderName, iconName, iconContent); + if (icon) { + loadedIcons.push(icon); + } + } + const prefix = createIconPackPrefix(folderName); + if (!iconPacks.some((iconPack) => iconPack.name === folderName)) { + iconPacks.push({ + name: folderName, + icons: loadedIcons, + prefix, + custom: true, + }); + logger.info(`Loaded icon pack '${folderName}' (amount of icons: ${loadedIcons.length})`); + } + } + // Extract all files from the zip files. + for (const zipFile in zipFiles) { + const files = zipFiles[zipFile]; + const loadedIcons = yield getLoadedIconsFromZipFile(zipFile, files); + const prefix = createIconPackPrefix(zipFile); + if (zipFile === LUCIDE_ICON_PACK_NAME && + !plugin.doesUseCustomLucideIconPack()) { + continue; + } + if (!iconPacks.some((iconPack) => iconPack.name === zipFile)) { + iconPacks.push({ + name: zipFile, + icons: loadedIcons, + prefix, + custom: false, + }); + logger.info(`Loaded icon pack '${zipFile}' (amount of icons: ${loadedIcons.length})`); + } + } +}); +const getLoadedIconsFromZipFile = (iconPackName, files) => __awaiter(void 0, void 0, void 0, function* () { + const loadedIcons = []; + const extraPath = getExtraPath(iconPackName); + for (let j = 0; j < files.length; j++) { + // Checks if the icon pack has an extra path. Also ignores files which do not start + // with the extra path. + if (extraPath && !files[j].name.startsWith(extraPath)) { + continue; + } + const file = yield getFileFromJSZipFile(files[j]); + const iconContent = yield file.text(); + const iconName = getNormalizedName(file.name); + const icon = generateIcon(iconPackName, iconName, iconContent); + if (icon) { + loadedIcons.push(icon); + } + } + return loadedIcons; +}); +const addIconToIconPack = (iconPackName, iconName, iconContent) => { + // Normalize the icon name to remove `-` or `_` in the name. + iconName = getNormalizedName(iconName); + const icon = generateIcon(iconPackName, iconName, iconContent); + if (!icon) { + logger.warn(`Icon could not be generated (icon: ${iconName}, content: ${iconContent})`); + return undefined; + } + const iconPack = iconPacks.find((iconPack) => iconPack.name === iconPackName); + if (!iconPack) { + logger.warn(`Iconpack with name '${iconPackName}' was not found`); + return undefined; + } + iconPack.icons.push(icon); + return icon; +}; +const removeIconFromIconPackDirectory = (plugin, iconPackName, iconName) => { + const iconPack = iconPacks.find((iconPack) => iconPack.name === iconPackName); + // Checks if icon pack is custom-made. + if (!iconPack.custom) { + return plugin.app.vault.adapter.rmdir(`${path}/${iconPackName}/${iconName}.svg`, true); + } +}; +const extractIconToIconPack = (plugin, icon, iconContent) => __awaiter(void 0, void 0, void 0, function* () { + const doesIconPackDirExist = yield plugin.app.vault.adapter.exists(`${path}/${icon.iconPackName}`); + if (!doesIconPackDirExist) { + yield plugin.app.vault.adapter.mkdir(`${path}/${icon.iconPackName}`); + } + const doesIconFileExists = yield plugin.app.vault.adapter.exists(`${path}/${icon.iconPackName}/${icon.name}.svg`); + if (!doesIconFileExists) { + yield createFile(plugin, icon.iconPackName, `${icon.name}.svg`, iconContent); + } +}); +const getAllLoadedIconNames = () => { + return iconPacks.reduce((total, iconPack) => { + total.push(...iconPack.icons); + return total; + }, []); +}; +const registerIconPack = (name, arrayBuffer) => __awaiter(void 0, void 0, void 0, function* () { + const files = yield readZipFile(arrayBuffer); + const loadedIcons = yield getLoadedIconsFromZipFile(name, files); + const prefix = createIconPackPrefix(name); + iconPacks.push({ name, icons: loadedIcons, prefix, custom: false }); + logger.info(`Loaded icon pack ${name} (amount of icons: ${loadedIcons.length})`); +}); +const doesIconExists = (iconName) => { + const icons = getAllLoadedIconNames(); + return (icons.find((icon) => icon.name === iconName || icon.prefix + icon.name === iconName) !== undefined); +}; +const getIconsFromIconPack = (iconPackName) => { + return iconPacks.find((iconPack) => iconPack.name === iconPackName); +}; +const getIconFromIconPack = (iconPackName, iconPrefix, iconName) => { + const foundIcon = preloadedIcons.find((icon) => icon.prefix.toLowerCase() === iconPrefix.toLowerCase() && + icon.name.toLowerCase() === iconName.toLowerCase()); + if (foundIcon) { + return foundIcon; + } + const iconPack = iconPacks.find((iconPack) => iconPack.name === iconPackName); + if (!iconPack) { + return undefined; + } + return iconPack.icons.find((icon) => getNormalizedName(icon.name) === iconName); +}; +const getSvgFromLoadedIcon = (iconPrefix, iconName) => { + let icon = ''; + let foundIcon = preloadedIcons.find((icon) => icon.prefix.toLowerCase() === iconPrefix.toLowerCase() && + icon.name.toLowerCase() === iconName.toLowerCase()); + if (!foundIcon) { + iconPacks.forEach((iconPack) => { + const icon = iconPack.icons.find((icon) => { + return (icon.prefix.toLowerCase() === iconPrefix.toLowerCase() && + getNormalizedName(icon.name).toLowerCase() === iconName.toLowerCase()); + }); + if (icon) { + foundIcon = icon; + } + }); + } + if (foundIcon) { + icon = foundIcon.svgElement; + } + return icon; +}; + +/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */ +var twemoji=function(){var twemoji={base:"https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.1.0/assets/",ext:".png",size:"72x72",className:"emoji",convert:{fromCodePoint:fromCodePoint,toCodePoint:toCodePoint},onerror:function onerror(){if(this.parentNode){this.parentNode.replaceChild(createText(this.alt,false),this);}},parse:parse,replace:replace,test:test},escaper={"&":"&","<":"<",">":">","'":"'",'"':"""},re=/(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c[\udffc-\udfff]|\ud83e\udef1\ud83c\udffc\u200d\ud83e\udef2\ud83c[\udffb\udffd-\udfff]|\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\udef1\ud83c\udffe\u200d\ud83e\udef2\ud83c[\udffb-\udffd\udfff]|\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c[\udffb-\udffe]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d\udc8f\ud83c[\udffb-\udfff]|\ud83d\udc91\ud83c[\udffb-\udfff]|\ud83e\udd1d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d\udc8f\udc91]|\ud83e\udd1d)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])(?:\u200d\u27a1\ufe0f)?|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f(?:\u200d\u27a1\ufe0f)?)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd4\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f(?:\u200d\u27a1\ufe0f)?|(?:\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83e\uddd1\u200d\ud83e\uddd1\u200d\ud83e\uddd2\u200d\ud83e\uddd2|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83e\uddd1\u200d\ud83e\uddd1\u200d\ud83e\uddd2|\ud83e\uddd1\u200d\ud83e\uddd2\u200d\ud83e\uddd2|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83d\ude36\u200d\ud83c\udf2b\ufe0f|\u26d3\ufe0f\u200d\ud83d\udca5|\u2764\ufe0f\u200d\ud83d\udd25|\u2764\ufe0f\u200d\ud83e\ude79|\ud83c\udf44\u200d\ud83d\udfeb|\ud83c\udf4b\u200d\ud83d\udfe9|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc26\u200d\ud83d\udd25|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83d\ude2e\u200d\ud83d\udca8|\ud83d\ude35\u200d\ud83d\udcab|\ud83d\ude42\u200d\u2194\ufe0f|\ud83d\ude42\u200d\u2195\ufe0f|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddd1\u200d\ud83e\uddd2|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b|\ud83d\udc26\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|\ud83e\udef0|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c\udfc3|\ud83d\udeb6|\ud83e\uddce)(?:\ud83c[\udffb-\udfff])?(?:\u200d\u27a1\ufe0f)?|(?:\ud83c[\udf85\udfc2\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4\udeb5\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd\uddcf\uddd1-\udddd\udec3-\udec5\udef1-\udef8]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udc8e\udc90\udc92-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udedc-\udedf\udeeb\udeec\udef4-\udefc\udfe0-\udfeb\udff0]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78-\uddb4\uddb7\uddba\uddbc-\uddcc\uddd0\uddde-\uddff\ude70-\ude7c\ude80-\ude88\ude90-\udebd\udebf-\udec2\udece-\udedb\udee0-\udee8]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,UFE0Fg=/\uFE0F/g,U200D=String.fromCharCode(8205),rescaper=/[&<>'"]/g,shouldntBeParsed=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,fromCharCode=String.fromCharCode;return twemoji;function createText(text,clean){return document.createTextNode(clean?text.replace(UFE0Fg,""):text)}function escapeHTML(s){return s.replace(rescaper,replacer)}function defaultImageSrcGenerator(icon,options){return "".concat(options.base,options.size,"/",icon,options.ext)}function grabAllTextNodes(node,allText){var childNodes=node.childNodes,length=childNodes.length,subnode,nodeType;while(length--){subnode=childNodes[length];nodeType=subnode.nodeType;if(nodeType===3){allText.push(subnode);}else if(nodeType===1&&!("ownerSVGElement"in subnode)&&!shouldntBeParsed.test(subnode.nodeName.toLowerCase())){grabAllTextNodes(subnode,allText);}}return allText}function grabTheRightIcon(rawText){return toCodePoint(rawText.indexOf(U200D)<0?rawText.replace(UFE0Fg,""):rawText)}function parseNode(node,options){var allText=grabAllTextNodes(node,[]),length=allText.length,attrib,attrname,modified,fragment,subnode,text,match,i,index,img,rawText,iconId,src;while(length--){modified=false;fragment=document.createDocumentFragment();subnode=allText[length];text=subnode.nodeValue;i=0;while(match=re.exec(text)){index=match.index;if(index!==i){fragment.appendChild(createText(text.slice(i,index),true));}rawText=match[0];iconId=grabTheRightIcon(rawText);i=index+rawText.length;src=options.callback(iconId,options);if(iconId&&src){img=new Image;img.onerror=options.onerror;img.setAttribute("draggable","false");attrib=options.attributes(rawText,iconId);for(attrname in attrib){if(attrib.hasOwnProperty(attrname)&&attrname.indexOf("on")!==0&&!img.hasAttribute(attrname)){img.setAttribute(attrname,attrib[attrname]);}}img.className=options.className;img.alt=rawText;img.src=src;modified=true;fragment.appendChild(img);}if(!img)fragment.appendChild(createText(rawText,false));img=null;}if(modified){if(i");}return ret})}function replacer(m){return escaper[m]}function returnNull(){return null}function toSizeSquaredAsset(value){return typeof value==="number"?value+"x"+value:value}function fromCodePoint(codepoint){var code=typeof codepoint==="string"?parseInt(codepoint,16):codepoint;if(code<65536){return fromCharCode(code)}code-=65536;return fromCharCode(55296+(code>>10),56320+(code&1023))}function parse(what,how){if(!how||typeof how==="function"){how={callback:how};}return (typeof what==="string"?parseString:parseNode)(what,{callback:how.callback||defaultImageSrcGenerator,attributes:typeof how.attributes==="function"?how.attributes:returnNull,base:typeof how.base==="string"?how.base:twemoji.base,ext:how.ext||twemoji.ext,size:how.folder||toSizeSquaredAsset(how.size||twemoji.size),className:how.className||twemoji.className,onerror:how.onerror||twemoji.onerror})}function replace(text,callback){return String(text).replace(re,callback)}function test(text){re.lastIndex=0;var result=re.test(text);re.lastIndex=0;return result}function toCodePoint(unicodeSurrogates,sep){var r=[],c=0,p=0,i=0;while(i { + return new RegExp(/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/, 'g'); +}; +const shortNames = { + '😀': 'grinning face', + '😃': 'grinning face with big eyes', + '😄': 'grinning face with smiling eyes', + '😁': 'beaming face with smiling eyes', + '😆': 'grinning squinting face', + '😅': 'grinning face with sweat', + '🤣': 'rolling on the floor laughing', + '😂': 'face with tears of joy', + '🙂': 'slightly smiling face', + '🙃': 'upside-down face', + '🫠': '⊛ melting face', + '😉': 'winking face', + '😊': 'smiling face with smiling eyes', + '😇': 'smiling face with halo', + '🥰': 'smiling face with hearts', + '😍': 'smiling face with heart-eyes', + '🤩': 'star-struck', + '😘': 'face blowing a kiss', + '😗': 'kissing face', + '☺': 'smiling face', + '😚': 'kissing face with closed eyes', + '😙': 'kissing face with smiling eyes', + '🥲': 'smiling face with tear', + '😋': 'face savoring food', + '😛': 'face with tongue', + '😜': 'winking face with tongue', + '🤪': 'zany face', + '😝': 'squinting face with tongue', + '🤑': 'money-mouth face', + '🤗': 'smiling face with open hands', + '🤭': 'face with hand over mouth', + '🫢': '⊛ face with open eyes and hand over mouth', + '🫣': '⊛ face with peeking eye', + '🤫': 'shushing face', + '🤔': 'thinking face', + '🫡': '⊛ saluting face', + '🤐': 'zipper-mouth face', + '🤨': 'face with raised eyebrow', + '😐': 'neutral face', + '😑': 'expressionless face', + '😶': 'face without mouth', + '🫥': '⊛ dotted line face', + '😶‍🌫️': 'face in clouds', + '😏': 'smirking face', + '😒': 'unamused face', + '🙄': 'face with rolling eyes', + '😬': 'grimacing face', + '😮‍💨': 'face exhaling', + '🤥': 'lying face', + '😌': 'relieved face', + '😔': 'pensive face', + '😪': 'sleepy face', + '🤤': 'drooling face', + '😴': 'sleeping face', + '😷': 'face with medical mask', + '🤒': 'face with thermometer', + '🤕': 'face with head-bandage', + '🤢': 'nauseated face', + '🤮': 'face vomiting', + '🤧': 'sneezing face', + '🥵': 'hot face', + '🥶': 'cold face', + '🥴': 'woozy face', + '😵': 'face with crossed-out eyes', + '😵‍💫': 'face with spiral eyes', + '🤯': 'exploding head', + '🤠': 'cowboy hat face', + '🥳': 'partying face', + '🥸': 'disguised face', + '😎': 'smiling face with sunglasses', + '🤓': 'nerd face', + '🧐': 'face with monocle', + '😕': 'confused face', + '🫤': '⊛ face with diagonal mouth', + '😟': 'worried face', + '🙁': 'slightly frowning face', + '☹': 'frowning face', + '😮': 'face with open mouth', + '😯': 'hushed face', + '😲': 'astonished face', + '😳': 'flushed face', + '🥺': 'pleading face', + '🥹': '⊛ face holding back tears', + '😦': 'frowning face with open mouth', + '😧': 'anguished face', + '😨': 'fearful face', + '😰': 'anxious face with sweat', + '😥': 'sad but relieved face', + '😢': 'crying face', + '😭': 'loudly crying face', + '😱': 'face screaming in fear', + '😖': 'confounded face', + '😣': 'persevering face', + '😞': 'disappointed face', + '😓': 'downcast face with sweat', + '😩': 'weary face', + '😫': 'tired face', + '🥱': 'yawning face', + '😤': 'face with steam from nose', + '😡': 'pouting face', + '😠': 'angry face', + '🤬': 'face with symbols on mouth', + '😈': 'smiling face with horns', + '👿': 'angry face with horns', + '💀': 'skull', + '☠': 'skull and crossbones', + '💩': 'pile of poo', + '🤡': 'clown face', + '👹': 'ogre', + '👺': 'goblin', + '👻': 'ghost', + '👽': 'alien', + '👾': 'alien monster', + '🤖': 'robot', + '😺': 'grinning cat', + '😸': 'grinning cat with smiling eyes', + '😹': 'cat with tears of joy', + '😻': 'smiling cat with heart-eyes', + '😼': 'cat with wry smile', + '😽': 'kissing cat', + '🙀': 'weary cat', + '😿': 'crying cat', + '😾': 'pouting cat', + '🙈': 'see-no-evil monkey', + '🙉': 'hear-no-evil monkey', + '🙊': 'speak-no-evil monkey', + '💋': 'kiss mark', + '💌': 'love letter', + '💘': 'heart with arrow', + '💝': 'heart with ribbon', + '💖': 'sparkling heart', + '💗': 'growing heart', + '💓': 'beating heart', + '💞': 'revolving hearts', + '💕': 'two hearts', + '💟': 'heart decoration', + '❣': 'heart exclamation', + '💔': 'broken heart', + '❤️‍🔥': 'heart on fire', + '❤️‍🩹': 'mending heart', + '❤': 'red heart', + '🧡': 'orange heart', + '💛': 'yellow heart', + '💚': 'green heart', + '💙': 'blue heart', + '💜': 'purple heart', + '🤎': 'brown heart', + '🖤': 'black heart', + '🤍': 'white heart', + '💯': 'hundred points', + '💢': 'anger symbol', + '💥': 'collision', + '💫': 'dizzy', + '💦': 'sweat droplets', + '💨': 'dashing away', + '🕳': 'hole', + '💣': 'bomb', + '💬': 'speech balloon', + '👁️‍🗨️': 'eye in speech bubble', + '🗨': 'left speech bubble', + '🗯': 'right anger bubble', + '💭': 'thought balloon', + '💤': 'zzz', + '👋': 'waving hand', + '🤚': 'raised back of hand', + '🖐': 'hand with fingers splayed', + '✋': 'raised hand', + '🖖': 'vulcan salute', + '🫱': '⊛ rightwards hand', + '🫲': '⊛ leftwards hand', + '🫳': '⊛ palm down hand', + '🫴': '⊛ palm up hand', + '👌': 'OK hand', + '🤌': 'pinched fingers', + '🤏': 'pinching hand', + '✌': 'victory hand', + '🤞': 'crossed fingers', + '🫰': '⊛ hand with index finger and thumb crossed', + '🤟': 'love-you gesture', + '🤘': 'sign of the horns', + '🤙': 'call me hand', + '👈': 'backhand index pointing left', + '👉': 'backhand index pointing right', + '👆': 'backhand index pointing up', + '🖕': 'middle finger', + '👇': 'backhand index pointing down', + '☝': 'index pointing up', + '🫵': '⊛ index pointing at the viewer', + '👍': 'thumbs up', + '👎': 'thumbs down', + '✊': 'raised fist', + '👊': 'oncoming fist', + '🤛': 'left-facing fist', + '🤜': 'right-facing fist', + '👏': 'clapping hands', + '🙌': 'raising hands', + '🫶': '⊛ heart hands', + '👐': 'open hands', + '🤲': 'palms up together', + '🤝': 'handshake', + '🙏': 'folded hands', + '✍': 'writing hand', + '💅': 'nail polish', + '🤳': 'selfie', + '💪': 'flexed biceps', + '🦾': 'mechanical arm', + '🦿': 'mechanical leg', + '🦵': 'leg', + '🦶': 'foot', + '👂': 'ear', + '🦻': 'ear with hearing aid', + '👃': 'nose', + '🧠': 'brain', + '🫀': 'anatomical heart', + '🫁': 'lungs', + '🦷': 'tooth', + '🦴': 'bone', + '👀': 'eyes', + '👁': 'eye', + '👅': 'tongue', + '👄': 'mouth', + '🫦': '⊛ biting lip', + '👶': 'baby', + '🧒': 'child', + '👦': 'boy', + '👧': 'girl', + '🧑': 'person', + '👱': 'person: blond hair', + '👨': 'man', + '🧔': 'person: beard', + '🧔‍♂️': 'man: beard', + '🧔‍♀️': 'woman: beard', + '👨‍🦰': 'man: red hair', + '👨‍🦱': 'man: curly hair', + '👨‍🦳': 'man: white hair', + '👨‍🦲': 'man: bald', + '👩': 'woman', + '👩‍🦰': 'woman: red hair', + '🧑‍🦰': 'person: red hair', + '👩‍🦱': 'woman: curly hair', + '🧑‍🦱': 'person: curly hair', + '👩‍🦳': 'woman: white hair', + '🧑‍🦳': 'person: white hair', + '👩‍🦲': 'woman: bald', + '🧑‍🦲': 'person: bald', + '👱‍♀️': 'woman: blond hair', + '👱‍♂️': 'man: blond hair', + '🧓': 'older person', + '👴': 'old man', + '👵': 'old woman', + '🙍': 'person frowning', + '🙍‍♂️': 'man frowning', + '🙍‍♀️': 'woman frowning', + '🙎': 'person pouting', + '🙎‍♂️': 'man pouting', + '🙎‍♀️': 'woman pouting', + '🙅': 'person gesturing NO', + '🙅‍♂️': 'man gesturing NO', + '🙅‍♀️': 'woman gesturing NO', + '🙆': 'person gesturing OK', + '🙆‍♂️': 'man gesturing OK', + '🙆‍♀️': 'woman gesturing OK', + '💁': 'person tipping hand', + '💁‍♂️': 'man tipping hand', + '💁‍♀️': 'woman tipping hand', + '🙋': 'person raising hand', + '🙋‍♂️': 'man raising hand', + '🙋‍♀️': 'woman raising hand', + '🧏': 'deaf person', + '🧏‍♂️': 'deaf man', + '🧏‍♀️': 'deaf woman', + '🙇': 'person bowing', + '🙇‍♂️': 'man bowing', + '🙇‍♀️': 'woman bowing', + '🤦': 'person facepalming', + '🤦‍♂️': 'man facepalming', + '🤦‍♀️': 'woman facepalming', + '🤷': 'person shrugging', + '🤷‍♂️': 'man shrugging', + '🤷‍♀️': 'woman shrugging', + '🧑‍⚕️': 'health worker', + '👨‍⚕️': 'man health worker', + '👩‍⚕️': 'woman health worker', + '🧑‍🎓': 'student', + '👨‍🎓': 'man student', + '👩‍🎓': 'woman student', + '🧑‍🏫': 'teacher', + '👨‍🏫': 'man teacher', + '👩‍🏫': 'woman teacher', + '🧑‍⚖️': 'judge', + '👨‍⚖️': 'man judge', + '👩‍⚖️': 'woman judge', + '🧑‍🌾': 'farmer', + '👨‍🌾': 'man farmer', + '👩‍🌾': 'woman farmer', + '🧑‍🍳': 'cook', + '👨‍🍳': 'man cook', + '👩‍🍳': 'woman cook', + '🧑‍🔧': 'mechanic', + '👨‍🔧': 'man mechanic', + '👩‍🔧': 'woman mechanic', + '🧑‍🏭': 'factory worker', + '👨‍🏭': 'man factory worker', + '👩‍🏭': 'woman factory worker', + '🧑‍💼': 'office worker', + '👨‍💼': 'man office worker', + '👩‍💼': 'woman office worker', + '🧑‍🔬': 'scientist', + '👨‍🔬': 'man scientist', + '👩‍🔬': 'woman scientist', + '🧑‍💻': 'technologist', + '👨‍💻': 'man technologist', + '👩‍💻': 'woman technologist', + '🧑‍🎤': 'singer', + '👨‍🎤': 'man singer', + '👩‍🎤': 'woman singer', + '🧑‍🎨': 'artist', + '👨‍🎨': 'man artist', + '👩‍🎨': 'woman artist', + '🧑‍✈️': 'pilot', + '👨‍✈️': 'man pilot', + '👩‍✈️': 'woman pilot', + '🧑‍🚀': 'astronaut', + '👨‍🚀': 'man astronaut', + '👩‍🚀': 'woman astronaut', + '🧑‍🚒': 'firefighter', + '👨‍🚒': 'man firefighter', + '👩‍🚒': 'woman firefighter', + '👮': 'police officer', + '👮‍♂️': 'man police officer', + '👮‍♀️': 'woman police officer', + '🕵': 'detective', + '🕵️‍♂️': 'man detective', + '🕵️‍♀️': 'woman detective', + '💂': 'guard', + '💂‍♂️': 'man guard', + '💂‍♀️': 'woman guard', + '🥷': 'ninja', + '👷': 'construction worker', + '👷‍♂️': 'man construction worker', + '👷‍♀️': 'woman construction worker', + '🫅': '⊛ person with crown', + '🤴': 'prince', + '👸': 'princess', + '👳': 'person wearing turban', + '👳‍♂️': 'man wearing turban', + '👳‍♀️': 'woman wearing turban', + '👲': 'person with skullcap', + '🧕': 'woman with headscarf', + '🤵': 'person in tuxedo', + '🤵‍♂️': 'man in tuxedo', + '🤵‍♀️': 'woman in tuxedo', + '👰': 'person with veil', + '👰‍♂️': 'man with veil', + '👰‍♀️': 'woman with veil', + '🤰': 'pregnant woman', + '🫃': '⊛ pregnant man', + '🫄': '⊛ pregnant person', + '🤱': 'breast-feeding', + '👩‍🍼': 'woman feeding baby', + '👨‍🍼': 'man feeding baby', + '🧑‍🍼': 'person feeding baby', + '👼': 'baby angel', + '🎅': 'Santa Claus', + '🤶': 'Mrs. Claus', + '🧑‍🎄': 'mx claus', + '🦸': 'superhero', + '🦸‍♂️': 'man superhero', + '🦸‍♀️': 'woman superhero', + '🦹': 'supervillain', + '🦹‍♂️': 'man supervillain', + '🦹‍♀️': 'woman supervillain', + '🧙': 'mage', + '🧙‍♂️': 'man mage', + '🧙‍♀️': 'woman mage', + '🧚': 'fairy', + '🧚‍♂️': 'man fairy', + '🧚‍♀️': 'woman fairy', + '🧛': 'vampire', + '🧛‍♂️': 'man vampire', + '🧛‍♀️': 'woman vampire', + '🧜': 'merperson', + '🧜‍♂️': 'merman', + '🧜‍♀️': 'mermaid', + '🧝': 'elf', + '🧝‍♂️': 'man elf', + '🧝‍♀️': 'woman elf', + '🧞': 'genie', + '🧞‍♂️': 'man genie', + '🧞‍♀️': 'woman genie', + '🧟': 'zombie', + '🧟‍♂️': 'man zombie', + '🧟‍♀️': 'woman zombie', + '🧌': '⊛ troll', + '💆': 'person getting massage', + '💆‍♂️': 'man getting massage', + '💆‍♀️': 'woman getting massage', + '💇': 'person getting haircut', + '💇‍♂️': 'man getting haircut', + '💇‍♀️': 'woman getting haircut', + '🚶': 'person walking', + '🚶‍♂️': 'man walking', + '🚶‍♀️': 'woman walking', + '🧍': 'person standing', + '🧍‍♂️': 'man standing', + '🧍‍♀️': 'woman standing', + '🧎': 'person kneeling', + '🧎‍♂️': 'man kneeling', + '🧎‍♀️': 'woman kneeling', + '🧑‍🦯': 'person with white cane', + '👨‍🦯': 'man with white cane', + '👩‍🦯': 'woman with white cane', + '🧑‍🦼': 'person in motorized wheelchair', + '👨‍🦼': 'man in motorized wheelchair', + '👩‍🦼': 'woman in motorized wheelchair', + '🧑‍🦽': 'person in manual wheelchair', + '👨‍🦽': 'man in manual wheelchair', + '👩‍🦽': 'woman in manual wheelchair', + '🏃': 'person running', + '🏃‍♂️': 'man running', + '🏃‍♀️': 'woman running', + '💃': 'woman dancing', + '🕺': 'man dancing', + '🕴': 'person in suit levitating', + '👯': 'people with bunny ears', + '👯‍♂️': 'men with bunny ears', + '👯‍♀️': 'women with bunny ears', + '🧖': 'person in steamy room', + '🧖‍♂️': 'man in steamy room', + '🧖‍♀️': 'woman in steamy room', + '🧗': 'person climbing', + '🧗‍♂️': 'man climbing', + '🧗‍♀️': 'woman climbing', + '🤺': 'person fencing', + '🏇': 'horse racing', + '⛷': 'skier', + '🏂': 'snowboarder', + '🏌': 'person golfing', + '🏌️‍♂️': 'man golfing', + '🏌️‍♀️': 'woman golfing', + '🏄': 'person surfing', + '🏄‍♂️': 'man surfing', + '🏄‍♀️': 'woman surfing', + '🚣': 'person rowing boat', + '🚣‍♂️': 'man rowing boat', + '🚣‍♀️': 'woman rowing boat', + '🏊': 'person swimming', + '🏊‍♂️': 'man swimming', + '🏊‍♀️': 'woman swimming', + '⛹': 'person bouncing ball', + '⛹️‍♂️': 'man bouncing ball', + '⛹️‍♀️': 'woman bouncing ball', + '🏋': 'person lifting weights', + '🏋️‍♂️': 'man lifting weights', + '🏋️‍♀️': 'woman lifting weights', + '🚴': 'person biking', + '🚴‍♂️': 'man biking', + '🚴‍♀️': 'woman biking', + '🚵': 'person mountain biking', + '🚵‍♂️': 'man mountain biking', + '🚵‍♀️': 'woman mountain biking', + '🤸': 'person cartwheeling', + '🤸‍♂️': 'man cartwheeling', + '🤸‍♀️': 'woman cartwheeling', + '🤼': 'people wrestling', + '🤼‍♂️': 'men wrestling', + '🤼‍♀️': 'women wrestling', + '🤽': 'person playing water polo', + '🤽‍♂️': 'man playing water polo', + '🤽‍♀️': 'woman playing water polo', + '🤾': 'person playing handball', + '🤾‍♂️': 'man playing handball', + '🤾‍♀️': 'woman playing handball', + '🤹': 'person juggling', + '🤹‍♂️': 'man juggling', + '🤹‍♀️': 'woman juggling', + '🧘': 'person in lotus position', + '🧘‍♂️': 'man in lotus position', + '🧘‍♀️': 'woman in lotus position', + '🛀': 'person taking bath', + '🛌': 'person in bed', + '🧑‍🤝‍🧑': 'people holding hands', + '👭': 'women holding hands', + '👫': 'woman and man holding hands', + '👬': 'men holding hands', + '💏': 'kiss', + '👩‍❤️‍💋‍👨': 'kiss: woman, man', + '👨‍❤️‍💋‍👨': 'kiss: man, man', + '👩‍❤️‍💋‍👩': 'kiss: woman, woman', + '💑': 'couple with heart', + '👩‍❤️‍👨': 'couple with heart: woman, man', + '👨‍❤️‍👨': 'couple with heart: man, man', + '👩‍❤️‍👩': 'couple with heart: woman, woman', + '👪': 'family', + '👨‍👩‍👦': 'family: man, woman, boy', + '👨‍👩‍👧': 'family: man, woman, girl', + '👨‍👩‍👧‍👦': 'family: man, woman, girl, boy', + '👨‍👩‍👦‍👦': 'family: man, woman, boy, boy', + '👨‍👩‍👧‍👧': 'family: man, woman, girl, girl', + '👨‍👨‍👦': 'family: man, man, boy', + '👨‍👨‍👧': 'family: man, man, girl', + '👨‍👨‍👧‍👦': 'family: man, man, girl, boy', + '👨‍👨‍👦‍👦': 'family: man, man, boy, boy', + '👨‍👨‍👧‍👧': 'family: man, man, girl, girl', + '👩‍👩‍👦': 'family: woman, woman, boy', + '👩‍👩‍👧': 'family: woman, woman, girl', + '👩‍👩‍👧‍👦': 'family: woman, woman, girl, boy', + '👩‍👩‍👦‍👦': 'family: woman, woman, boy, boy', + '👩‍👩‍👧‍👧': 'family: woman, woman, girl, girl', + '👨‍👦': 'family: man, boy', + '👨‍👦‍👦': 'family: man, boy, boy', + '👨‍👧': 'family: man, girl', + '👨‍👧‍👦': 'family: man, girl, boy', + '👨‍👧‍👧': 'family: man, girl, girl', + '👩‍👦': 'family: woman, boy', + '👩‍👦‍👦': 'family: woman, boy, boy', + '👩‍👧': 'family: woman, girl', + '👩‍👧‍👦': 'family: woman, girl, boy', + '👩‍👧‍👧': 'family: woman, girl, girl', + '🗣': 'speaking head', + '👤': 'bust in silhouette', + '👥': 'busts in silhouette', + '🫂': 'people hugging', + '👣': 'footprints', + '🦰': 'red hair', + '🦱': 'curly hair', + '🦳': 'white hair', + '🦲': 'bald', + '🐵': 'monkey face', + '🐒': 'monkey', + '🦍': 'gorilla', + '🦧': 'orangutan', + '🐶': 'dog face', + '🐕': 'dog', + '🦮': 'guide dog', + '🐕‍🦺': 'service dog', + '🐩': 'poodle', + '🐺': 'wolf', + '🦊': 'fox', + '🦝': 'raccoon', + '🐱': 'cat face', + '🐈': 'cat', + '🐈‍⬛': 'black cat', + '🦁': 'lion', + '🐯': 'tiger face', + '🐅': 'tiger', + '🐆': 'leopard', + '🐴': 'horse face', + '🐎': 'horse', + '🦄': 'unicorn', + '🦓': 'zebra', + '🦌': 'deer', + '🦬': 'bison', + '🐮': 'cow face', + '🐂': 'ox', + '🐃': 'water buffalo', + '🐄': 'cow', + '🐷': 'pig face', + '🐖': 'pig', + '🐗': 'boar', + '🐽': 'pig nose', + '🐏': 'ram', + '🐑': 'ewe', + '🐐': 'goat', + '🐪': 'camel', + '🐫': 'two-hump camel', + '🦙': 'llama', + '🦒': 'giraffe', + '🐘': 'elephant', + '🦣': 'mammoth', + '🦏': 'rhinoceros', + '🦛': 'hippopotamus', + '🐭': 'mouse face', + '🐁': 'mouse', + '🐀': 'rat', + '🐹': 'hamster', + '🐰': 'rabbit face', + '🐇': 'rabbit', + '🐿': 'chipmunk', + '🦫': 'beaver', + '🦔': 'hedgehog', + '🦇': 'bat', + '🐻': 'bear', + '🐻‍❄️': 'polar bear', + '🐨': 'koala', + '🐼': 'panda', + '🦥': 'sloth', + '🦦': 'otter', + '🦨': 'skunk', + '🦘': 'kangaroo', + '🦡': 'badger', + '🐾': 'paw prints', + '🦃': 'turkey', + '🐔': 'chicken', + '🐓': 'rooster', + '🐣': 'hatching chick', + '🐤': 'baby chick', + '🐥': 'front-facing baby chick', + '🐦': 'bird', + '🐧': 'penguin', + '🕊': 'dove', + '🦅': 'eagle', + '🦆': 'duck', + '🦢': 'swan', + '🦉': 'owl', + '🦤': 'dodo', + '🪶': 'feather', + '🦩': 'flamingo', + '🦚': 'peacock', + '🦜': 'parrot', + '🐸': 'frog', + '🐊': 'crocodile', + '🐢': 'turtle', + '🦎': 'lizard', + '🐍': 'snake', + '🐲': 'dragon face', + '🐉': 'dragon', + '🦕': 'sauropod', + '🦖': 'T-Rex', + '🐳': 'spouting whale', + '🐋': 'whale', + '🐬': 'dolphin', + '🦭': 'seal', + '🐟': 'fish', + '🐠': 'tropical fish', + '🐡': 'blowfish', + '🦈': 'shark', + '🐙': 'octopus', + '🐚': 'spiral shell', + '🪸': '⊛ coral', + '🐌': 'snail', + '🦋': 'butterfly', + '🐛': 'bug', + '🐜': 'ant', + '🐝': 'honeybee', + '🪲': 'beetle', + '🐞': 'lady beetle', + '🦗': 'cricket', + '🪳': 'cockroach', + '🕷': 'spider', + '🕸': 'spider web', + '🦂': 'scorpion', + '🦟': 'mosquito', + '🪰': 'fly', + '🪱': 'worm', + '🦠': 'microbe', + '💐': 'bouquet', + '🌸': 'cherry blossom', + '💮': 'white flower', + '🪷': '⊛ lotus', + '🏵': 'rosette', + '🌹': 'rose', + '🥀': 'wilted flower', + '🌺': 'hibiscus', + '🌻': 'sunflower', + '🌼': 'blossom', + '🌷': 'tulip', + '🌱': 'seedling', + '🪴': 'potted plant', + '🌲': 'evergreen tree', + '🌳': 'deciduous tree', + '🌴': 'palm tree', + '🌵': 'cactus', + '🌾': 'sheaf of rice', + '🌿': 'herb', + '☘': 'shamrock', + '🍀': 'four leaf clover', + '🍁': 'maple leaf', + '🍂': 'fallen leaf', + '🍃': 'leaf fluttering in wind', + '🪹': '⊛ empty nest', + '🪺': '⊛ nest with eggs', + '🍇': 'grapes', + '🍈': 'melon', + '🍉': 'watermelon', + '🍊': 'tangerine', + '🍋': 'lemon', + '🍌': 'banana', + '🍍': 'pineapple', + '🥭': 'mango', + '🍎': 'red apple', + '🍏': 'green apple', + '🍐': 'pear', + '🍑': 'peach', + '🍒': 'cherries', + '🍓': 'strawberry', + '🫐': 'blueberries', + '🥝': 'kiwi fruit', + '🍅': 'tomato', + '🫒': 'olive', + '🥥': 'coconut', + '🥑': 'avocado', + '🍆': 'eggplant', + '🥔': 'potato', + '🥕': 'carrot', + '🌽': 'ear of corn', + '🌶': 'hot pepper', + '🫑': 'bell pepper', + '🥒': 'cucumber', + '🥬': 'leafy green', + '🥦': 'broccoli', + '🧄': 'garlic', + '🧅': 'onion', + '🍄': 'mushroom', + '🥜': 'peanuts', + '🫘': '⊛ beans', + '🌰': 'chestnut', + '🍞': 'bread', + '🥐': 'croissant', + '🥖': 'baguette bread', + '🫓': 'flatbread', + '🥨': 'pretzel', + '🥯': 'bagel', + '🥞': 'pancakes', + '🧇': 'waffle', + '🧀': 'cheese wedge', + '🍖': 'meat on bone', + '🍗': 'poultry leg', + '🥩': 'cut of meat', + '🥓': 'bacon', + '🍔': 'hamburger', + '🍟': 'french fries', + '🍕': 'pizza', + '🌭': 'hot dog', + '🥪': 'sandwich', + '🌮': 'taco', + '🌯': 'burrito', + '🫔': 'tamale', + '🥙': 'stuffed flatbread', + '🧆': 'falafel', + '🥚': 'egg', + '🍳': 'cooking', + '🥘': 'shallow pan of food', + '🍲': 'pot of food', + '🫕': 'fondue', + '🥣': 'bowl with spoon', + '🥗': 'green salad', + '🍿': 'popcorn', + '🧈': 'butter', + '🧂': 'salt', + '🥫': 'canned food', + '🍱': 'bento box', + '🍘': 'rice cracker', + '🍙': 'rice ball', + '🍚': 'cooked rice', + '🍛': 'curry rice', + '🍜': 'steaming bowl', + '🍝': 'spaghetti', + '🍠': 'roasted sweet potato', + '🍢': 'oden', + '🍣': 'sushi', + '🍤': 'fried shrimp', + '🍥': 'fish cake with swirl', + '🥮': 'moon cake', + '🍡': 'dango', + '🥟': 'dumpling', + '🥠': 'fortune cookie', + '🥡': 'takeout box', + '🦀': 'crab', + '🦞': 'lobster', + '🦐': 'shrimp', + '🦑': 'squid', + '🦪': 'oyster', + '🍦': 'soft ice cream', + '🍧': 'shaved ice', + '🍨': 'ice cream', + '🍩': 'doughnut', + '🍪': 'cookie', + '🎂': 'birthday cake', + '🍰': 'shortcake', + '🧁': 'cupcake', + '🥧': 'pie', + '🍫': 'chocolate bar', + '🍬': 'candy', + '🍭': 'lollipop', + '🍮': 'custard', + '🍯': 'honey pot', + '🍼': 'baby bottle', + '🥛': 'glass of milk', + '☕': 'hot beverage', + '🫖': 'teapot', + '🍵': 'teacup without handle', + '🍶': 'sake', + '🍾': 'bottle with popping cork', + '🍷': 'wine glass', + '🍸': 'cocktail glass', + '🍹': 'tropical drink', + '🍺': 'beer mug', + '🍻': 'clinking beer mugs', + '🥂': 'clinking glasses', + '🥃': 'tumbler glass', + '🫗': '⊛ pouring liquid', + '🥤': 'cup with straw', + '🧋': 'bubble tea', + '🧃': 'beverage box', + '🧉': 'mate', + '🧊': 'ice', + '🥢': 'chopsticks', + '🍽': 'fork and knife with plate', + '🍴': 'fork and knife', + '🥄': 'spoon', + '🔪': 'kitchen knife', + '🫙': '⊛ jar', + '🏺': 'amphora', + '🌍': 'globe showing Europe-Africa', + '🌎': 'globe showing Americas', + '🌏': 'globe showing Asia-Australia', + '🌐': 'globe with meridians', + '🗺': 'world map', + '🗾': 'map of Japan', + '🧭': 'compass', + '🏔': 'snow-capped mountain', + '⛰': 'mountain', + '🌋': 'volcano', + '🗻': 'mount fuji', + '🏕': 'camping', + '🏖': 'beach with umbrella', + '🏜': 'desert', + '🏝': 'desert island', + '🏞': 'national park', + '🏟': 'stadium', + '🏛': 'classical building', + '🏗': 'building construction', + '🧱': 'brick', + '🪨': 'rock', + '🪵': 'wood', + '🛖': 'hut', + '🏘': 'houses', + '🏚': 'derelict house', + '🏠': 'house', + '🏡': 'house with garden', + '🏢': 'office building', + '🏣': 'Japanese post office', + '🏤': 'post office', + '🏥': 'hospital', + '🏦': 'bank', + '🏨': 'hotel', + '🏩': 'love hotel', + '🏪': 'convenience store', + '🏫': 'school', + '🏬': 'department store', + '🏭': 'factory', + '🏯': 'Japanese castle', + '🏰': 'castle', + '💒': 'wedding', + '🗼': 'Tokyo tower', + '🗽': 'Statue of Liberty', + '⛪': 'church', + '🕌': 'mosque', + '🛕': 'hindu temple', + '🕍': 'synagogue', + '⛩': 'shinto shrine', + '🕋': 'kaaba', + '⛲': 'fountain', + '⛺': 'tent', + '🌁': 'foggy', + '🌃': 'night with stars', + '🏙': 'cityscape', + '🌄': 'sunrise over mountains', + '🌅': 'sunrise', + '🌆': 'cityscape at dusk', + '🌇': 'sunset', + '🌉': 'bridge at night', + '♨': 'hot springs', + '🎠': 'carousel horse', + '🛝': '⊛ playground slide', + '🎡': 'ferris wheel', + '🎢': 'roller coaster', + '💈': 'barber pole', + '🎪': 'circus tent', + '🚂': 'locomotive', + '🚃': 'railway car', + '🚄': 'high-speed train', + '🚅': 'bullet train', + '🚆': 'train', + '🚇': 'metro', + '🚈': 'light rail', + '🚉': 'station', + '🚊': 'tram', + '🚝': 'monorail', + '🚞': 'mountain railway', + '🚋': 'tram car', + '🚌': 'bus', + '🚍': 'oncoming bus', + '🚎': 'trolleybus', + '🚐': 'minibus', + '🚑': 'ambulance', + '🚒': 'fire engine', + '🚓': 'police car', + '🚔': 'oncoming police car', + '🚕': 'taxi', + '🚖': 'oncoming taxi', + '🚗': 'automobile', + '🚘': 'oncoming automobile', + '🚙': 'sport utility vehicle', + '🛻': 'pickup truck', + '🚚': 'delivery truck', + '🚛': 'articulated lorry', + '🚜': 'tractor', + '🏎': 'racing car', + '🏍': 'motorcycle', + '🛵': 'motor scooter', + '🦽': 'manual wheelchair', + '🦼': 'motorized wheelchair', + '🛺': 'auto rickshaw', + '🚲': 'bicycle', + '🛴': 'kick scooter', + '🛹': 'skateboard', + '🛼': 'roller skate', + '🚏': 'bus stop', + '🛣': 'motorway', + '🛤': 'railway track', + '🛢': 'oil drum', + '⛽': 'fuel pump', + '🛞': '⊛ wheel', + '🚨': 'police car light', + '🚥': 'horizontal traffic light', + '🚦': 'vertical traffic light', + '🛑': 'stop sign', + '🚧': 'construction', + '⚓': 'anchor', + '🛟': '⊛ ring buoy', + '⛵': 'sailboat', + '🛶': 'canoe', + '🚤': 'speedboat', + '🛳': 'passenger ship', + '⛴': 'ferry', + '🛥': 'motor boat', + '🚢': 'ship', + '✈': 'airplane', + '🛩': 'small airplane', + '🛫': 'airplane departure', + '🛬': 'airplane arrival', + '🪂': 'parachute', + '💺': 'seat', + '🚁': 'helicopter', + '🚟': 'suspension railway', + '🚠': 'mountain cableway', + '🚡': 'aerial tramway', + '🛰': 'satellite', + '🚀': 'rocket', + '🛸': 'flying saucer', + '🛎': 'bellhop bell', + '🧳': 'luggage', + '⌛': 'hourglass done', + '⏳': 'hourglass not done', + '⌚': 'watch', + '⏰': 'alarm clock', + '⏱': 'stopwatch', + '⏲': 'timer clock', + '🕰': 'mantelpiece clock', + '🕛': 'twelve o’clock', + '🕧': 'twelve-thirty', + '🕐': 'one o’clock', + '🕜': 'one-thirty', + '🕑': 'two o’clock', + '🕝': 'two-thirty', + '🕒': 'three o’clock', + '🕞': 'three-thirty', + '🕓': 'four o’clock', + '🕟': 'four-thirty', + '🕔': 'five o’clock', + '🕠': 'five-thirty', + '🕕': 'six o’clock', + '🕡': 'six-thirty', + '🕖': 'seven o’clock', + '🕢': 'seven-thirty', + '🕗': 'eight o’clock', + '🕣': 'eight-thirty', + '🕘': 'nine o’clock', + '🕤': 'nine-thirty', + '🕙': 'ten o’clock', + '🕥': 'ten-thirty', + '🕚': 'eleven o’clock', + '🕦': 'eleven-thirty', + '🌑': 'new moon', + '🌒': 'waxing crescent moon', + '🌓': 'first quarter moon', + '🌔': 'waxing gibbous moon', + '🌕': 'full moon', + '🌖': 'waning gibbous moon', + '🌗': 'last quarter moon', + '🌘': 'waning crescent moon', + '🌙': 'crescent moon', + '🌚': 'new moon face', + '🌛': 'first quarter moon face', + '🌜': 'last quarter moon face', + '🌡': 'thermometer', + '☀': 'sun', + '🌝': 'full moon face', + '🌞': 'sun with face', + '🪐': 'ringed planet', + '⭐': 'star', + '🌟': 'glowing star', + '🌠': 'shooting star', + '🌌': 'milky way', + '☁': 'cloud', + '⛅': 'sun behind cloud', + '⛈': 'cloud with lightning and rain', + '🌤': 'sun behind small cloud', + '🌥': 'sun behind large cloud', + '🌦': 'sun behind rain cloud', + '🌧': 'cloud with rain', + '🌨': 'cloud with snow', + '🌩': 'cloud with lightning', + '🌪': 'tornado', + '🌫': 'fog', + '🌬': 'wind face', + '🌀': 'cyclone', + '🌈': 'rainbow', + '🌂': 'closed umbrella', + '☂': 'umbrella', + '☔': 'umbrella with rain drops', + '⛱': 'umbrella on ground', + '⚡': 'high voltage', + '❄': 'snowflake', + '☃': 'snowman', + '⛄': 'snowman without snow', + '☄': 'comet', + '🔥': 'fire', + '💧': 'droplet', + '🌊': 'water wave', + '🎃': 'jack-o-lantern', + '🎄': 'Christmas tree', + '🎆': 'fireworks', + '🎇': 'sparkler', + '🧨': 'firecracker', + '✨': 'sparkles', + '🎈': 'balloon', + '🎉': 'party popper', + '🎊': 'confetti ball', + '🎋': 'tanabata tree', + '🎍': 'pine decoration', + '🎎': 'Japanese dolls', + '🎏': 'carp streamer', + '🎐': 'wind chime', + '🎑': 'moon viewing ceremony', + '🧧': 'red envelope', + '🎀': 'ribbon', + '🎁': 'wrapped gift', + '🎗': 'reminder ribbon', + '🎟': 'admission tickets', + '🎫': 'ticket', + '🎖': 'military medal', + '🏆': 'trophy', + '🏅': 'sports medal', + '🥇': '1st place medal', + '🥈': '2nd place medal', + '🥉': '3rd place medal', + '⚽': 'soccer ball', + '⚾': 'baseball', + '🥎': 'softball', + '🏀': 'basketball', + '🏐': 'volleyball', + '🏈': 'american football', + '🏉': 'rugby football', + '🎾': 'tennis', + '🥏': 'flying disc', + '🎳': 'bowling', + '🏏': 'cricket game', + '🏑': 'field hockey', + '🏒': 'ice hockey', + '🥍': 'lacrosse', + '🏓': 'ping pong', + '🏸': 'badminton', + '🥊': 'boxing glove', + '🥋': 'martial arts uniform', + '🥅': 'goal net', + '⛳': 'flag in hole', + '⛸': 'ice skate', + '🎣': 'fishing pole', + '🤿': 'diving mask', + '🎽': 'running shirt', + '🎿': 'skis', + '🛷': 'sled', + '🥌': 'curling stone', + '🎯': 'bullseye', + '🪀': 'yo-yo', + '🪁': 'kite', + '🎱': 'pool 8 ball', + '🔮': 'crystal ball', + '🪄': 'magic wand', + '🧿': 'nazar amulet', + '🪬': '⊛ hamsa', + '🎮': 'video game', + '🕹': 'joystick', + '🎰': 'slot machine', + '🎲': 'game die', + '🧩': 'puzzle piece', + '🧸': 'teddy bear', + '🪅': 'piñata', + '🪩': '⊛ mirror ball', + '🪆': 'nesting dolls', + '♠': 'spade suit', + '♥': 'heart suit', + '♦': 'diamond suit', + '♣': 'club suit', + '♟': 'chess pawn', + '🃏': 'joker', + '🀄': 'mahjong red dragon', + '🎴': 'flower playing cards', + '🎭': 'performing arts', + '🖼': 'framed picture', + '🎨': 'artist palette', + '🧵': 'thread', + '🪡': 'sewing needle', + '🧶': 'yarn', + '🪢': 'knot', + '👓': 'glasses', + '🕶': 'sunglasses', + '🥽': 'goggles', + '🥼': 'lab coat', + '🦺': 'safety vest', + '👔': 'necktie', + '👕': 't-shirt', + '👖': 'jeans', + '🧣': 'scarf', + '🧤': 'gloves', + '🧥': 'coat', + '🧦': 'socks', + '👗': 'dress', + '👘': 'kimono', + '🥻': 'sari', + '🩱': 'one-piece swimsuit', + '🩲': 'briefs', + '🩳': 'shorts', + '👙': 'bikini', + '👚': 'woman’s clothes', + '👛': 'purse', + '👜': 'handbag', + '👝': 'clutch bag', + '🛍': 'shopping bags', + '🎒': 'backpack', + '🩴': 'thong sandal', + '👞': 'man’s shoe', + '👟': 'running shoe', + '🥾': 'hiking boot', + '🥿': 'flat shoe', + '👠': 'high-heeled shoe', + '👡': 'woman’s sandal', + '🩰': 'ballet shoes', + '👢': 'woman’s boot', + '👑': 'crown', + '👒': 'woman’s hat', + '🎩': 'top hat', + '🎓': 'graduation cap', + '🧢': 'billed cap', + '🪖': 'military helmet', + '⛑': 'rescue worker’s helmet', + '📿': 'prayer beads', + '💄': 'lipstick', + '💍': 'ring', + '💎': 'gem stone', + '🔇': 'muted speaker', + '🔈': 'speaker low volume', + '🔉': 'speaker medium volume', + '🔊': 'speaker high volume', + '📢': 'loudspeaker', + '📣': 'megaphone', + '📯': 'postal horn', + '🔔': 'bell', + '🔕': 'bell with slash', + '🎼': 'musical score', + '🎵': 'musical note', + '🎶': 'musical notes', + '🎙': 'studio microphone', + '🎚': 'level slider', + '🎛': 'control knobs', + '🎤': 'microphone', + '🎧': 'headphone', + '📻': 'radio', + '🎷': 'saxophone', + '🪗': 'accordion', + '🎸': 'guitar', + '🎹': 'musical keyboard', + '🎺': 'trumpet', + '🎻': 'violin', + '🪕': 'banjo', + '🥁': 'drum', + '🪘': 'long drum', + '📱': 'mobile phone', + '📲': 'mobile phone with arrow', + '☎': 'telephone', + '📞': 'telephone receiver', + '📟': 'pager', + '📠': 'fax machine', + '🔋': 'battery', + '🪫': '⊛ low battery', + '🔌': 'electric plug', + '💻': 'laptop', + '🖥': 'desktop computer', + '🖨': 'printer', + '⌨': 'keyboard', + '🖱': 'computer mouse', + '🖲': 'trackball', + '💽': 'computer disk', + '💾': 'floppy disk', + '💿': 'optical disk', + '📀': 'dvd', + '🧮': 'abacus', + '🎥': 'movie camera', + '🎞': 'film frames', + '📽': 'film projector', + '🎬': 'clapper board', + '📺': 'television', + '📷': 'camera', + '📸': 'camera with flash', + '📹': 'video camera', + '📼': 'videocassette', + '🔍': 'magnifying glass tilted left', + '🔎': 'magnifying glass tilted right', + '🕯': 'candle', + '💡': 'light bulb', + '🔦': 'flashlight', + '🏮': 'red paper lantern', + '🪔': 'diya lamp', + '📔': 'notebook with decorative cover', + '📕': 'closed book', + '📖': 'open book', + '📗': 'green book', + '📘': 'blue book', + '📙': 'orange book', + '📚': 'books', + '📓': 'notebook', + '📒': 'ledger', + '📃': 'page with curl', + '📜': 'scroll', + '📄': 'page facing up', + '📰': 'newspaper', + '🗞': 'rolled-up newspaper', + '📑': 'bookmark tabs', + '🔖': 'bookmark', + '🏷': 'label', + '💰': 'money bag', + '🪙': 'coin', + '💴': 'yen banknote', + '💵': 'dollar banknote', + '💶': 'euro banknote', + '💷': 'pound banknote', + '💸': 'money with wings', + '💳': 'credit card', + '🧾': 'receipt', + '💹': 'chart increasing with yen', + '✉': 'envelope', + '📧': 'e-mail', + '📨': 'incoming envelope', + '📩': 'envelope with arrow', + '📤': 'outbox tray', + '📥': 'inbox tray', + '📦': 'package', + '📫': 'closed mailbox with raised flag', + '📪': 'closed mailbox with lowered flag', + '📬': 'open mailbox with raised flag', + '📭': 'open mailbox with lowered flag', + '📮': 'postbox', + '🗳': 'ballot box with ballot', + '✏': 'pencil', + '✒': 'black nib', + '🖋': 'fountain pen', + '🖊': 'pen', + '🖌': 'paintbrush', + '🖍': 'crayon', + '📝': 'memo', + '💼': 'briefcase', + '📁': 'file folder', + '📂': 'open file folder', + '🗂': 'card index dividers', + '📅': 'calendar', + '📆': 'tear-off calendar', + '🗒': 'spiral notepad', + '🗓': 'spiral calendar', + '📇': 'card index', + '📈': 'chart increasing', + '📉': 'chart decreasing', + '📊': 'bar chart', + '📋': 'clipboard', + '📌': 'pushpin', + '📍': 'round pushpin', + '📎': 'paperclip', + '🖇': 'linked paperclips', + '📏': 'straight ruler', + '📐': 'triangular ruler', + '✂': 'scissors', + '🗃': 'card file box', + '🗄': 'file cabinet', + '🗑': 'wastebasket', + '🔒': 'locked', + '🔓': 'unlocked', + '🔏': 'locked with pen', + '🔐': 'locked with key', + '🔑': 'key', + '🗝': 'old key', + '🔨': 'hammer', + '🪓': 'axe', + '⛏': 'pick', + '⚒': 'hammer and pick', + '🛠': 'hammer and wrench', + '🗡': 'dagger', + '⚔': 'crossed swords', + '🔫': 'water pistol', + '🪃': 'boomerang', + '🏹': 'bow and arrow', + '🛡': 'shield', + '🪚': 'carpentry saw', + '🔧': 'wrench', + '🪛': 'screwdriver', + '🔩': 'nut and bolt', + '⚙': 'gear', + '🗜': 'clamp', + '⚖': 'balance scale', + '🦯': 'white cane', + '🔗': 'link', + '⛓': 'chains', + '🪝': 'hook', + '🧰': 'toolbox', + '🧲': 'magnet', + '🪜': 'ladder', + '⚗': 'alembic', + '🧪': 'test tube', + '🧫': 'petri dish', + '🧬': 'dna', + '🔬': 'microscope', + '🔭': 'telescope', + '📡': 'satellite antenna', + '💉': 'syringe', + '🩸': 'drop of blood', + '💊': 'pill', + '🩹': 'adhesive bandage', + '🩼': '⊛ crutch', + '🩺': 'stethoscope', + '🩻': '⊛ x-ray', + '🚪': 'door', + '🛗': 'elevator', + '🪞': 'mirror', + '🪟': 'window', + '🛏': 'bed', + '🛋': 'couch and lamp', + '🪑': 'chair', + '🚽': 'toilet', + '🪠': 'plunger', + '🚿': 'shower', + '🛁': 'bathtub', + '🪤': 'mouse trap', + '🪒': 'razor', + '🧴': 'lotion bottle', + '🧷': 'safety pin', + '🧹': 'broom', + '🧺': 'basket', + '🧻': 'roll of paper', + '🪣': 'bucket', + '🧼': 'soap', + '🫧': '⊛ bubbles', + '🪥': 'toothbrush', + '🧽': 'sponge', + '🧯': 'fire extinguisher', + '🛒': 'shopping cart', + '🚬': 'cigarette', + '⚰': 'coffin', + '🪦': 'headstone', + '⚱': 'funeral urn', + '🗿': 'moai', + '🪧': 'placard', + '🪪': '⊛ identification card', + '🏧': 'ATM sign', + '🚮': 'litter in bin sign', + '🚰': 'potable water', + '♿': 'wheelchair symbol', + '🚹': 'men’s room', + '🚺': 'women’s room', + '🚻': 'restroom', + '🚼': 'baby symbol', + '🚾': 'water closet', + '🛂': 'passport control', + '🛃': 'customs', + '🛄': 'baggage claim', + '🛅': 'left luggage', + '⚠': 'warning', + '🚸': 'children crossing', + '⛔': 'no entry', + '🚫': 'prohibited', + '🚳': 'no bicycles', + '🚭': 'no smoking', + '🚯': 'no littering', + '🚱': 'non-potable water', + '🚷': 'no pedestrians', + '📵': 'no mobile phones', + '🔞': 'no one under eighteen', + '☢': 'radioactive', + '☣': 'biohazard', + '⬆': 'up arrow', + '↗': 'up-right arrow', + '➡': 'right arrow', + '↘': 'down-right arrow', + '⬇': 'down arrow', + '↙': 'down-left arrow', + '⬅': 'left arrow', + '↖': 'up-left arrow', + '↕': 'up-down arrow', + '↔': 'left-right arrow', + '↩': 'right arrow curving left', + '↪': 'left arrow curving right', + '⤴': 'right arrow curving up', + '⤵': 'right arrow curving down', + '🔃': 'clockwise vertical arrows', + '🔄': 'counterclockwise arrows button', + '🔙': 'BACK arrow', + '🔚': 'END arrow', + '🔛': 'ON! arrow', + '🔜': 'SOON arrow', + '🔝': 'TOP arrow', + '🛐': 'place of worship', + '⚛': 'atom symbol', + '🕉': 'om', + '✡': 'star of David', + '☸': 'wheel of dharma', + '☯': 'yin yang', + '✝': 'latin cross', + '☦': 'orthodox cross', + '☪': 'star and crescent', + '☮': 'peace symbol', + '🕎': 'menorah', + '🔯': 'dotted six-pointed star', + '♈': 'Aries', + '♉': 'Taurus', + '♊': 'Gemini', + '♋': 'Cancer', + '♌': 'Leo', + '♍': 'Virgo', + '♎': 'Libra', + '♏': 'Scorpio', + '♐': 'Sagittarius', + '♑': 'Capricorn', + '♒': 'Aquarius', + '♓': 'Pisces', + '⛎': 'Ophiuchus', + '🔀': 'shuffle tracks button', + '🔁': 'repeat button', + '🔂': 'repeat single button', + '▶': 'play button', + '⏩': 'fast-forward button', + '⏭': 'next track button', + '⏯': 'play or pause button', + '◀': 'reverse button', + '⏪': 'fast reverse button', + '⏮': 'last track button', + '🔼': 'upwards button', + '⏫': 'fast up button', + '🔽': 'downwards button', + '⏬': 'fast down button', + '⏸': 'pause button', + '⏹': 'stop button', + '⏺': 'record button', + '⏏': 'eject button', + '🎦': 'cinema', + '🔅': 'dim button', + '🔆': 'bright button', + '📶': 'antenna bars', + '📳': 'vibration mode', + '📴': 'mobile phone off', + '♀': 'female sign', + '♂': 'male sign', + '⚧': 'transgender symbol', + '✖': 'multiply', + '➕': 'plus', + '➖': 'minus', + '➗': 'divide', + '🟰': '⊛ heavy equals sign', + '♾': 'infinity', + '‼': 'double exclamation mark', + '⁉': 'exclamation question mark', + '❓': 'red question mark', + '❔': 'white question mark', + '❕': 'white exclamation mark', + '❗': 'red exclamation mark', + '〰': 'wavy dash', + '💱': 'currency exchange', + '💲': 'heavy dollar sign', + '⚕': 'medical symbol', + '♻': 'recycling symbol', + '⚜': 'fleur-de-lis', + '🔱': 'trident emblem', + '📛': 'name badge', + '🔰': 'Japanese symbol for beginner', + '⭕': 'hollow red circle', + '✅': 'check mark button', + '☑': 'check box with check', + '✔': 'check mark', + '❌': 'cross mark', + '❎': 'cross mark button', + '➰': 'curly loop', + '➿': 'double curly loop', + '〽': 'part alternation mark', + '✳': 'eight-spoked asterisk', + '✴': 'eight-pointed star', + '❇': 'sparkle', + '©': 'copyright', + '®': 'registered', + '™': 'trade mark', + '#️⃣': 'keycap: #', + '*️⃣': 'keycap: *', + '0️⃣': 'keycap: 0', + '1️⃣': 'keycap: 1', + '2️⃣': 'keycap: 2', + '3️⃣': 'keycap: 3', + '4️⃣': 'keycap: 4', + '5️⃣': 'keycap: 5', + '6️⃣': 'keycap: 6', + '7️⃣': 'keycap: 7', + '8️⃣': 'keycap: 8', + '9️⃣': 'keycap: 9', + '🔟': 'keycap: 10', + '🔠': 'input latin uppercase', + '🔡': 'input latin lowercase', + '🔢': 'input numbers', + '🔣': 'input symbols', + '🔤': 'input latin letters', + '🅰': 'A button (blood type)', + '🆎': 'AB button (blood type)', + '🅱': 'B button (blood type)', + '🆑': 'CL button', + '🆒': 'COOL button', + '🆓': 'FREE button', + ℹ: 'information', + '🆔': 'ID button', + 'Ⓜ': 'circled M', + '🆕': 'NEW button', + '🆖': 'NG button', + '🅾': 'O button (blood type)', + '🆗': 'OK button', + '🅿': 'P button', + '🆘': 'SOS button', + '🆙': 'UP! button', + '🆚': 'VS button', + '🈁': 'Japanese “here” button', + '🈂': 'Japanese “service charge” button', + '🈷': 'Japanese “monthly amount” button', + '🈶': 'Japanese “not free of charge” button', + '🈯': 'Japanese “reserved” button', + '🉐': 'Japanese “bargain” button', + '🈹': 'Japanese “discount” button', + '🈚': 'Japanese “free of charge” button', + '🈲': 'Japanese “prohibited” button', + '🉑': 'Japanese “acceptable” button', + '🈸': 'Japanese “application” button', + '🈴': 'Japanese “passing grade” button', + '🈳': 'Japanese “vacancy” button', + '㊗': 'Japanese “congratulations” button', + '㊙': 'Japanese “secret” button', + '🈺': 'Japanese “open for business” button', + '🈵': 'Japanese “no vacancy” button', + '🔴': 'red circle', + '🟠': 'orange circle', + '🟡': 'yellow circle', + '🟢': 'green circle', + '🔵': 'blue circle', + '🟣': 'purple circle', + '🟤': 'brown circle', + '⚫': 'black circle', + '⚪': 'white circle', + '🟥': 'red square', + '🟧': 'orange square', + '🟨': 'yellow square', + '🟩': 'green square', + '🟦': 'blue square', + '🟪': 'purple square', + '🟫': 'brown square', + '⬛': 'black large square', + '⬜': 'white large square', + '◼': 'black medium square', + '◻': 'white medium square', + '◾': 'black medium-small square', + '◽': 'white medium-small square', + '▪': 'black small square', + '▫': 'white small square', + '🔶': 'large orange diamond', + '🔷': 'large blue diamond', + '🔸': 'small orange diamond', + '🔹': 'small blue diamond', + '🔺': 'red triangle pointed up', + '🔻': 'red triangle pointed down', + '💠': 'diamond with a dot', + '🔘': 'radio button', + '🔳': 'white square button', + '🔲': 'black square button', + '🏁': 'chequered flag', + '🚩': 'triangular flag', + '🎌': 'crossed flags', + '🏴': 'black flag', + '🏳': 'white flag', + '🏳️‍🌈': 'rainbow flag', + '🏳️‍⚧️': 'transgender flag', + '🏴‍☠️': 'pirate flag', + '🇦🇨': 'flag: Ascension Island', + '🇦🇩': 'flag: Andorra', + '🇦🇪': 'flag: United Arab Emirates', + '🇦🇫': 'flag: Afghanistan', + '🇦🇬': 'flag: Antigua & Barbuda', + '🇦🇮': 'flag: Anguilla', + '🇦🇱': 'flag: Albania', + '🇦🇲': 'flag: Armenia', + '🇦🇴': 'flag: Angola', + '🇦🇶': 'flag: Antarctica', + '🇦🇷': 'flag: Argentina', + '🇦🇸': 'flag: American Samoa', + '🇦🇹': 'flag: Austria', + '🇦🇺': 'flag: Australia', + '🇦🇼': 'flag: Aruba', + '🇦🇽': 'flag: Åland Islands', + '🇦🇿': 'flag: Azerbaijan', + '🇧🇦': 'flag: Bosnia & Herzegovina', + '🇧🇧': 'flag: Barbados', + '🇧🇩': 'flag: Bangladesh', + '🇧🇪': 'flag: Belgium', + '🇧🇫': 'flag: Burkina Faso', + '🇧🇬': 'flag: Bulgaria', + '🇧🇭': 'flag: Bahrain', + '🇧🇮': 'flag: Burundi', + '🇧🇯': 'flag: Benin', + '🇧🇱': 'flag: St. Barthélemy', + '🇧🇲': 'flag: Bermuda', + '🇧🇳': 'flag: Brunei', + '🇧🇴': 'flag: Bolivia', + '🇧🇶': 'flag: Caribbean Netherlands', + '🇧🇷': 'flag: Brazil', + '🇧🇸': 'flag: Bahamas', + '🇧🇹': 'flag: Bhutan', + '🇧🇻': 'flag: Bouvet Island', + '🇧🇼': 'flag: Botswana', + '🇧🇾': 'flag: Belarus', + '🇧🇿': 'flag: Belize', + '🇨🇦': 'flag: Canada', + '🇨🇨': 'flag: Cocos (Keeling) Islands', + '🇨🇩': 'flag: Congo - Kinshasa', + '🇨🇫': 'flag: Central African Republic', + '🇨🇬': 'flag: Congo - Brazzaville', + '🇨🇭': 'flag: Switzerland', + '🇨🇮': 'flag: Côte d’Ivoire', + '🇨🇰': 'flag: Cook Islands', + '🇨🇱': 'flag: Chile', + '🇨🇲': 'flag: Cameroon', + '🇨🇳': 'flag: China', + '🇨🇴': 'flag: Colombia', + '🇨🇵': 'flag: Clipperton Island', + '🇨🇷': 'flag: Costa Rica', + '🇨🇺': 'flag: Cuba', + '🇨🇻': 'flag: Cape Verde', + '🇨🇼': 'flag: Curaçao', + '🇨🇽': 'flag: Christmas Island', + '🇨🇾': 'flag: Cyprus', + '🇨🇿': 'flag: Czechia', + '🇩🇪': 'flag: Germany', + '🇩🇬': 'flag: Diego Garcia', + '🇩🇯': 'flag: Djibouti', + '🇩🇰': 'flag: Denmark', + '🇩🇲': 'flag: Dominica', + '🇩🇴': 'flag: Dominican Republic', + '🇩🇿': 'flag: Algeria', + '🇪🇦': 'flag: Ceuta & Melilla', + '🇪🇨': 'flag: Ecuador', + '🇪🇪': 'flag: Estonia', + '🇪🇬': 'flag: Egypt', + '🇪🇭': 'flag: Western Sahara', + '🇪🇷': 'flag: Eritrea', + '🇪🇸': 'flag: Spain', + '🇪🇹': 'flag: Ethiopia', + '🇪🇺': 'flag: European Union', + '🇫🇮': 'flag: Finland', + '🇫🇯': 'flag: Fiji', + '🇫🇰': 'flag: Falkland Islands', + '🇫🇲': 'flag: Micronesia', + '🇫🇴': 'flag: Faroe Islands', + '🇫🇷': 'flag: France', + '🇬🇦': 'flag: Gabon', + '🇬🇧': 'flag: United Kingdom', + '🇬🇩': 'flag: Grenada', + '🇬🇪': 'flag: Georgia', + '🇬🇫': 'flag: French Guiana', + '🇬🇬': 'flag: Guernsey', + '🇬🇭': 'flag: Ghana', + '🇬🇮': 'flag: Gibraltar', + '🇬🇱': 'flag: Greenland', + '🇬🇲': 'flag: Gambia', + '🇬🇳': 'flag: Guinea', + '🇬🇵': 'flag: Guadeloupe', + '🇬🇶': 'flag: Equatorial Guinea', + '🇬🇷': 'flag: Greece', + '🇬🇸': 'flag: South Georgia & South Sandwich Islands', + '🇬🇹': 'flag: Guatemala', + '🇬🇺': 'flag: Guam', + '🇬🇼': 'flag: Guinea-Bissau', + '🇬🇾': 'flag: Guyana', + '🇭🇰': 'flag: Hong Kong SAR China', + '🇭🇲': 'flag: Heard & McDonald Islands', + '🇭🇳': 'flag: Honduras', + '🇭🇷': 'flag: Croatia', + '🇭🇹': 'flag: Haiti', + '🇭🇺': 'flag: Hungary', + '🇮🇨': 'flag: Canary Islands', + '🇮🇩': 'flag: Indonesia', + '🇮🇪': 'flag: Ireland', + '🇮🇱': 'flag: Israel', + '🇮🇲': 'flag: Isle of Man', + '🇮🇳': 'flag: India', + '🇮🇴': 'flag: British Indian Ocean Territory', + '🇮🇶': 'flag: Iraq', + '🇮🇷': 'flag: Iran', + '🇮🇸': 'flag: Iceland', + '🇮🇹': 'flag: Italy', + '🇯🇪': 'flag: Jersey', + '🇯🇲': 'flag: Jamaica', + '🇯🇴': 'flag: Jordan', + '🇯🇵': 'flag: Japan', + '🇰🇪': 'flag: Kenya', + '🇰🇬': 'flag: Kyrgyzstan', + '🇰🇭': 'flag: Cambodia', + '🇰🇮': 'flag: Kiribati', + '🇰🇲': 'flag: Comoros', + '🇰🇳': 'flag: St. Kitts & Nevis', + '🇰🇵': 'flag: North Korea', + '🇰🇷': 'flag: South Korea', + '🇰🇼': 'flag: Kuwait', + '🇰🇾': 'flag: Cayman Islands', + '🇰🇿': 'flag: Kazakhstan', + '🇱🇦': 'flag: Laos', + '🇱🇧': 'flag: Lebanon', + '🇱🇨': 'flag: St. Lucia', + '🇱🇮': 'flag: Liechtenstein', + '🇱🇰': 'flag: Sri Lanka', + '🇱🇷': 'flag: Liberia', + '🇱🇸': 'flag: Lesotho', + '🇱🇹': 'flag: Lithuania', + '🇱🇺': 'flag: Luxembourg', + '🇱🇻': 'flag: Latvia', + '🇱🇾': 'flag: Libya', + '🇲🇦': 'flag: Morocco', + '🇲🇨': 'flag: Monaco', + '🇲🇩': 'flag: Moldova', + '🇲🇪': 'flag: Montenegro', + '🇲🇫': 'flag: St. Martin', + '🇲🇬': 'flag: Madagascar', + '🇲🇭': 'flag: Marshall Islands', + '🇲🇰': 'flag: North Macedonia', + '🇲🇱': 'flag: Mali', + '🇲🇲': 'flag: Myanmar (Burma)', + '🇲🇳': 'flag: Mongolia', + '🇲🇴': 'flag: Macao SAR China', + '🇲🇵': 'flag: Northern Mariana Islands', + '🇲🇶': 'flag: Martinique', + '🇲🇷': 'flag: Mauritania', + '🇲🇸': 'flag: Montserrat', + '🇲🇹': 'flag: Malta', + '🇲🇺': 'flag: Mauritius', + '🇲🇻': 'flag: Maldives', + '🇲🇼': 'flag: Malawi', + '🇲🇽': 'flag: Mexico', + '🇲🇾': 'flag: Malaysia', + '🇲🇿': 'flag: Mozambique', + '🇳🇦': 'flag: Namibia', + '🇳🇨': 'flag: New Caledonia', + '🇳🇪': 'flag: Niger', + '🇳🇫': 'flag: Norfolk Island', + '🇳🇬': 'flag: Nigeria', + '🇳🇮': 'flag: Nicaragua', + '🇳🇱': 'flag: Netherlands', + '🇳🇴': 'flag: Norway', + '🇳🇵': 'flag: Nepal', + '🇳🇷': 'flag: Nauru', + '🇳🇺': 'flag: Niue', + '🇳🇿': 'flag: New Zealand', + '🇴🇲': 'flag: Oman', + '🇵🇦': 'flag: Panama', + '🇵🇪': 'flag: Peru', + '🇵🇫': 'flag: French Polynesia', + '🇵🇬': 'flag: Papua New Guinea', + '🇵🇭': 'flag: Philippines', + '🇵🇰': 'flag: Pakistan', + '🇵🇱': 'flag: Poland', + '🇵🇲': 'flag: St. Pierre & Miquelon', + '🇵🇳': 'flag: Pitcairn Islands', + '🇵🇷': 'flag: Puerto Rico', + '🇵🇸': 'flag: Palestinian Territories', + '🇵🇹': 'flag: Portugal', + '🇵🇼': 'flag: Palau', + '🇵🇾': 'flag: Paraguay', + '🇶🇦': 'flag: Qatar', + '🇷🇪': 'flag: Réunion', + '🇷🇴': 'flag: Romania', + '🇷🇸': 'flag: Serbia', + '🇷🇺': 'flag: Russia', + '🇷🇼': 'flag: Rwanda', + '🇸🇦': 'flag: Saudi Arabia', + '🇸🇧': 'flag: Solomon Islands', + '🇸🇨': 'flag: Seychelles', + '🇸🇩': 'flag: Sudan', + '🇸🇪': 'flag: Sweden', + '🇸🇬': 'flag: Singapore', + '🇸🇭': 'flag: St. Helena', + '🇸🇮': 'flag: Slovenia', + '🇸🇯': 'flag: Svalbard & Jan Mayen', + '🇸🇰': 'flag: Slovakia', + '🇸🇱': 'flag: Sierra Leone', + '🇸🇲': 'flag: San Marino', + '🇸🇳': 'flag: Senegal', + '🇸🇴': 'flag: Somalia', + '🇸🇷': 'flag: Suriname', + '🇸🇸': 'flag: South Sudan', + '🇸🇹': 'flag: São Tomé & Príncipe', + '🇸🇻': 'flag: El Salvador', + '🇸🇽': 'flag: Sint Maarten', + '🇸🇾': 'flag: Syria', + '🇸🇿': 'flag: Eswatini', + '🇹🇦': 'flag: Tristan da Cunha', + '🇹🇨': 'flag: Turks & Caicos Islands', + '🇹🇩': 'flag: Chad', + '🇹🇫': 'flag: French Southern Territories', + '🇹🇬': 'flag: Togo', + '🇹🇭': 'flag: Thailand', + '🇹🇯': 'flag: Tajikistan', + '🇹🇰': 'flag: Tokelau', + '🇹🇱': 'flag: Timor-Leste', + '🇹🇲': 'flag: Turkmenistan', + '🇹🇳': 'flag: Tunisia', + '🇹🇴': 'flag: Tonga', + '🇹🇷': 'flag: Turkey', + '🇹🇹': 'flag: Trinidad & Tobago', + '🇹🇻': 'flag: Tuvalu', + '🇹🇼': 'flag: Taiwan', + '🇹🇿': 'flag: Tanzania', + '🇺🇦': 'flag: Ukraine', + '🇺🇬': 'flag: Uganda', + '🇺🇲': 'flag: U.S. Outlying Islands', + '🇺🇳': 'flag: United Nations', + '🇺🇸': 'flag: United States', + '🇺🇾': 'flag: Uruguay', + '🇺🇿': 'flag: Uzbekistan', + '🇻🇦': 'flag: Vatican City', + '🇻🇨': 'flag: St. Vincent & Grenadines', + '🇻🇪': 'flag: Venezuela', + '🇻🇬': 'flag: British Virgin Islands', + '🇻🇮': 'flag: U.S. Virgin Islands', + '🇻🇳': 'flag: Vietnam', + '🇻🇺': 'flag: Vanuatu', + '🇼🇫': 'flag: Wallis & Futuna', + '🇼🇸': 'flag: Samoa', + '🇽🇰': 'flag: Kosovo', + '🇾🇪': 'flag: Yemen', + '🇾🇹': 'flag: Mayotte', + '🇿🇦': 'flag: South Africa', + '🇿🇲': 'flag: Zambia', + '🇿🇼': 'flag: Zimbabwe', + '🏴󠁧󠁢󠁥󠁮󠁧󠁿': 'flag: England', + '🏴󠁧󠁢󠁳󠁣󠁴󠁿': 'flag: Scotland', + '🏴󠁧󠁢󠁷󠁬󠁳󠁿': 'flag: Wales', +}; +const isEmoji = (str) => { + const regex = getRegex(); + const emojiMatches = str.match(regex); + const emojiString = emojiMatches ? emojiMatches.join('') : ''; + return !/\d/.test(str) && emojiString === str; +}; +const parseEmoji = (style, str, size = 16) => { + switch (style) { + case 'twemoji': + return twemoji.parse(str, { + folder: 'svg', + ext: '.svg', + attributes: () => ({ + width: `${size}px`, + height: `${size}px`, + }), + }); + case 'native': + return str; + default: + return null; + } +}; +/** + * Gets the shortcode for a given emoji by the name of the emoji. This function replaces + * spaces with underscores and removes colons. + * @param key String to replace with shortcode. + * @returns String with shortcode, or `undefined` if no shortcode exists. + */ +const getShortcode = (key) => { + var _a; + // Removable of colons is necessary for the flag shortcodes. + return (_a = shortNames[key]) === null || _a === void 0 ? void 0 : _a.replace(/\s/g, '_').replace(/:/g, '').toLowerCase(); +}; +var emoji = { + shortNames, + isEmoji, + getShortcode, + parseEmoji, + getRegex, +}; + +// Default obsidian file icon. +const DEFAULT_FILE_ICON = ''; +// Default obsidian folder icon. +const DEFAULT_FOLDER_ICON = ''; +/** + * Tries to read the file synchronously. + * @param file File that will be read. + * @returns A promise that will resolve to a string which is the content of the file. + */ +const readFileSync = (file) => __awaiter(void 0, void 0, void 0, function* () { + const content = yield new Promise((resolve) => { + const reader = new FileReader(); + reader.readAsText(file, 'UTF-8'); + reader.onload = (readerEvent) => resolve(readerEvent.target.result); + }); + return content; +}); +/** + * Gets all the currently opened files by getting the markdown leaves and then checking + * for the `file` property in the view. This also returns the leaf of the file. + * @param plugin Instance of the IconizePlugin. + * @returns An array of {@link FileWithLeaf} objects. + */ +const getAllOpenedFiles = (plugin) => { + return plugin.app.workspace + .getLeavesOfType('markdown') + .reduce((prev, curr) => { + const file = curr.view.file; + if (file) { + prev.push(Object.assign(Object.assign({}, file), { leaf: curr, pinned: false })); + } + return prev; + }, []); +}; +/** + * Gets the file item title element by either accessing `titleEl` or `selfEl`. + * @param fileItem FileItem which will be used to retrieve the title element from. + * @returns HTMLElement which is the title element. + */ +const getFileItemTitleEl = (fileItem) => { + var _a; + return (_a = fileItem.titleEl) !== null && _a !== void 0 ? _a : fileItem.selfEl; +}; +/** + * Gets the file item inner title element by either accessing `titleInnerEl` or `innerEl`. + * @param fileItem FileItem which will be used to retrieve the inner title element from. + * @returns HTMLElement which is the inner title element. + */ +const getFileItemInnerTitleEl = (fileItem) => { + var _a; + return (_a = fileItem.titleInnerEl) !== null && _a !== void 0 ? _a : fileItem.innerEl; +}; +/** + * A utility function which will add the icon to the icon pack and then extract the icon + * to the icon pack. + * @param plugin IconizePlugin that will be used for extracting the icon. + * @param iconNameWithPrefix String that will be used to add the icon to the icon pack. + */ +const saveIconToIconPack = (plugin, iconNameWithPrefix) => { + const iconNextIdentifier = nextIdentifier(iconNameWithPrefix); + const iconName = iconNameWithPrefix.substring(iconNextIdentifier); + const iconPrefix = iconNameWithPrefix.substring(0, iconNextIdentifier); + const possibleIcon = getSvgFromLoadedIcon(iconPrefix, iconName); + if (!possibleIcon) { + throw new Error(`Icon ${iconNameWithPrefix} could not be found.`); + } + const iconPackName = getIconPackNameByPrefix(iconPrefix); + if (iconPackName === LUCIDE_ICON_PACK_NAME && + !plugin.doesUseCustomLucideIconPack()) { + return; + } + const icon = getIconFromIconPack(iconPackName, iconPrefix, iconName); + extractIconToIconPack(plugin, icon, possibleIcon); +}; +/** + * A utility function which will remove the icon from the icon pack by removing the icon + * file from the icon pack directory. + * @param plugin IconizePlugin that will be used for removing the icon. + * @param iconNameWithPrefix String that will be used to remove the icon from the icon pack. + */ +const removeIconFromIconPack = (plugin, iconNameWithPrefix) => { + const identifier = nextIdentifier(iconNameWithPrefix); + const prefix = iconNameWithPrefix.substring(0, identifier); + const iconName = iconNameWithPrefix.substring(identifier); + const iconPackName = getIconPackNameByPrefix(prefix); + const duplicatedIcon = plugin.getDataPathByValue(iconNameWithPrefix); + if (!duplicatedIcon) { + removeIconFromIconPackDirectory(plugin, iconPackName, iconName); + } +}; +/** + * A utility function which will convert a string to a hexadecimal color. + * @param str String that will be converted to a hexadecimal color. + * @returns A string which is the hexadecimal color. + */ +const stringToHex = (str) => { + const validHex = str.replace(/[^0-9a-fA-F]/g, ''); + const hex = validHex.padStart(6, '0').substring(0, 6); + return `#${hex}`; +}; +/** + * A utility function which will check if a string is a hexadecimal color. + * @param str String that will be checked if it is a hexadecimal color. + * @param includeHash Boolean which will include the hash in the check. + * @returns A boolean which is true if the string is a hexadecimal color. + */ +const isHexadecimal = (str, includeHash = false) => { + const regex = new RegExp(`^${includeHash ? '#' : ''}[0-9A-Fa-f]{1,6}$`); + return regex.test(str); +}; + +// This library file does not include any other dependency and is a standalone file that +// only include utility functions for setting styles for nodes or icons. The only +// dependency is the `svg` library. +/** + * Sets the margin for a specific node. + * @param el Node where the margin will be set. + * @param margin Margin that will be applied to the node. + * @returns The modified node with the applied margin. + */ +const setMargin = (el, margin) => { + el.style.margin = `${margin.top}px ${margin.right}px ${margin.bottom}px ${margin.left}px`; + return el; +}; +/** + * Applies all stylings to the specified svg icon string and applies styling to the node + * (container). The styling to the specified element is only modified when it is an emoji + * or extra margin is defined in the settings. + * @param plugin Instance of the IconizePlugin. + * @param iconString SVG that will be used to apply the svg styles to. + * @param el Node for manipulating the style. + * @returns Icon svg string with the manipulate style attributes. + */ +const applyAll = (plugin, iconString, container) => { + iconString = svg.setFontSize(iconString, plugin.getSettings().fontSize); + container.style.color = plugin.getSettings().iconColor; + iconString = svg.colorize(iconString, plugin.getSettings().iconColor); + // Sets the margin of an element. + const margin = plugin.getSettings().extraMargin; + const normalizedMargin = { + top: margin.top !== undefined ? margin.top : 4, + right: margin.right !== undefined ? margin.right : 4, + left: margin.left !== undefined ? margin.left : 4, + bottom: margin.bottom !== undefined ? margin.bottom : 4, + }; + if (plugin.getSettings().extraMargin) { + setMargin(container, normalizedMargin); + } + if (emoji.isEmoji(iconString)) { + container.style.fontSize = `${plugin.getSettings().fontSize}px`; + container.style.lineHeight = `${plugin.getSettings().fontSize}px`; + } + return iconString; +}; +/** + * Refreshes all the styles of all the applied icons where a `.iconize-icon` + * class is defined. This function only modifies the styling of the node. + * @param plugin Instance of the IconizePlugin. + * @param applyStyles Function that is getting called when the icon node is found and + * typically applies all the styles to the icon. + */ +const refreshIconNodes = (plugin, applyStyles = applyAll) => { + const fileExplorers = plugin.app.workspace.getLeavesOfType('file-explorer'); + for (const fileExplorer of fileExplorers) { + Object.keys(plugin.getData()).forEach((path) => { + const fileItem = fileExplorer.view.fileItems[path]; + if (fileItem) { + const titleEl = getFileItemTitleEl(fileItem); + const iconNode = titleEl.querySelector('.iconize-icon'); + if (iconNode) { + const pathValue = plugin.getData()[path]; + const hasIndividualColor = typeof pathValue === 'object' && pathValue.iconColor; + iconNode.innerHTML = applyStyles(plugin, iconNode.innerHTML, iconNode); + if (hasIndividualColor) { + iconNode.style.color = pathValue.iconColor; + const colorizedInnerHtml = svg.colorize(iconNode.innerHTML, pathValue.iconColor); + iconNode.innerHTML = colorizedInnerHtml; + } + } + } + }); + } +}; +var style = { + applyAll, + setMargin, + refreshIconNodes, +}; + +/** + * Removes the `iconize-icon` icon node from the provided HTMLElement. + * @param el HTMLElement from which the icon node will be removed. + */ +const removeIconInNode = (el) => { + const iconNode = el.querySelector('.iconize-icon'); + if (!iconNode) { + return; + } + iconNode.remove(); +}; +/** + * Removes the 'iconize-icon' icon node from the HTMLElement corresponding + * to the specified file path. + * @param path File path for which the icon node will be removed. + */ +const removeIconInPath = (path, options) => { + var _a; + const node = (_a = options === null || options === void 0 ? void 0 : options.container) !== null && _a !== void 0 ? _a : document.querySelector(`[data-path="${path}"]`); + if (!node) { + logger.warn(`Element with data path not found (path: ${path})`); + return; + } + removeIconInNode(node); +}; +/** + * Sets an icon or emoji for an HTMLElement based on the specified icon name and color. + * The function manipulates the specified node inline. + * @param plugin Instance of the IconizePlugin. + * @param iconName Name of the icon or emoji to add. + * @param node HTMLElement to which the icon or emoji will be added. + * @param options Options for adjusting settings while the icon is being set. + */ +const setIconForNode = (plugin, iconName, node, options) => { + var _a, _b; + options !== null && options !== void 0 ? options : (options = {}); + (_a = options.shouldApplyAllStyles) !== null && _a !== void 0 ? _a : (options.shouldApplyAllStyles = true); + // Gets the possible icon based on the icon name. + const iconNextIdentifier = nextIdentifier(iconName); + const possibleIcon = getSvgFromLoadedIcon(iconName.substring(0, iconNextIdentifier), iconName.substring(iconNextIdentifier)); + if (possibleIcon) { + // The icon is possibly not an emoji. + let iconContent = (options === null || options === void 0 ? void 0 : options.shouldApplyAllStyles) + ? style.applyAll(plugin, possibleIcon, node) + : possibleIcon; + if (options === null || options === void 0 ? void 0 : options.color) { + node.style.color = options.color; + iconContent = svg.colorize(iconContent, options.color); + } + node.innerHTML = iconContent; + } + else { + const parsedEmoji = (_b = emoji.parseEmoji(plugin.getSettings().emojiStyle, iconName)) !== null && _b !== void 0 ? _b : iconName; + node.innerHTML = (options === null || options === void 0 ? void 0 : options.shouldApplyAllStyles) + ? style.applyAll(plugin, parsedEmoji, node) + : parsedEmoji; + } + node.setAttribute('title', iconName); +}; +/** + * Creates an icon node for the specified path and inserts it to the DOM. + * @param plugin Instance of the IconizePlugin. + * @param path Path for which the icon node will be created. + * @param iconName Name of the icon or emoji to add. + * @param color Optional color of the icon to add. + */ +const createIconNode = (plugin, path, iconName, options) => { + var _a; + // Get the container from the provided options or try to find the node that has the + // path from the document itself. + const node = (_a = options === null || options === void 0 ? void 0 : options.container) !== null && _a !== void 0 ? _a : document.querySelector(`[data-path="${path}"]`); + if (!node) { + logger.warn(`Element with data path not found (path: ${path})`); + return; + } + // Get the folder or file title node. + let titleNode = node.querySelector('.nav-folder-title-content'); + if (!titleNode) { + titleNode = node.querySelector('.nav-file-title-content'); + if (!titleNode) { + logger.warn(`Element with title node not found (path: ${path})`); + return; + } + } + let iconNode = node.querySelector('.iconize-icon'); + // If the icon is already set in the path, we do not need to create a new div element. + if (iconNode) { + setIconForNode(plugin, iconName, iconNode, { color: options === null || options === void 0 ? void 0 : options.color }); + } + else { + // Creates a new icon node and inserts it to the DOM. + iconNode = document.createElement('div'); + iconNode.setAttribute(config.ICON_ATTRIBUTE_NAME, iconName); + iconNode.classList.add('iconize-icon'); + setIconForNode(plugin, iconName, iconNode, { color: options === null || options === void 0 ? void 0 : options.color }); + node.insertBefore(iconNode, titleNode); + } +}; +/** + * Checks if the element has an icon node by checking if the element has a child with the + * class `iconize-icon`. + * @param element HTMLElement which will be checked if it has an icon. + * @returns Boolean whether the element has an icon node or not. + */ +const doesElementHasIconNode = (element) => { + return element.querySelector('.iconize-icon') !== null; +}; +/** + * Gets the icon name of the element if it has an icon node. + * @param element HTMLElement parent which includes a node with the icon. + * @returns String with the icon name if the element has an icon, `undefined` otherwise. + */ +const getIconFromElement = (element) => { + const iconNode = element.querySelector('.iconize-icon'); + const existingIcon = iconNode === null || iconNode === void 0 ? void 0 : iconNode.getAttribute(config.ICON_ATTRIBUTE_NAME); + return existingIcon; +}; +const getIconNodeFromPath = (path) => { + var _a; + return (_a = document + .querySelector(`[data-path="${path}"]`)) === null || _a === void 0 ? void 0 : _a.querySelector('[data-icon]'); +}; +var dom = { + setIconForNode, + createIconNode, + doesElementHasIconNode, + getIconFromElement, + getIconNodeFromPath, + removeIconInNode, + removeIconInPath, +}; + +class IconsPickerModal extends obsidian.FuzzySuggestModal { + constructor(app, plugin, path) { + super(app); + this.renderIndex = 0; + this.plugin = plugin; + this.path = path; + this.limit = 150; + const pluginRecentltyUsedItems = [ + ...plugin.getSettings().recentlyUsedIcons, + ]; + this.recentlyUsedItems = new Set(pluginRecentltyUsedItems.reverse().filter((iconName) => { + return doesIconExists(iconName) || emoji.isEmoji(iconName); + })); + this.resultContainerEl.classList.add('iconize-modal'); + } + onOpen() { + super.onOpen(); + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + } + getItemText(item) { + return `${item.name} (${item.prefix})`; + } + getItems() { + const iconKeys = []; + if (this.inputEl.value.length === 0) { + this.renderIndex = 0; + this.recentlyUsedItems.forEach((iconName) => { + if (emoji.isEmoji(iconName)) { + iconKeys.push({ + name: emoji.shortNames[iconName], + prefix: 'Emoji', + displayName: iconName, + iconPackName: null, + }); + return; + } + const nextLetter = nextIdentifier(iconName); + const iconPrefix = iconName.substring(0, nextLetter); + const iconPackName = getIconPackNameByPrefix(iconPrefix); + iconKeys.push({ + name: iconName.substring(nextLetter), + prefix: iconPrefix, + displayName: iconName, + iconPackName: iconPackName, + }); + }); + } + for (const icon of getAllLoadedIconNames()) { + iconKeys.push({ + name: icon.name, + prefix: icon.prefix, + displayName: icon.prefix + icon.name, + iconPackName: icon.iconPackName, + }); + } + Object.entries(emoji.shortNames).forEach(([unicode, shortName]) => { + iconKeys.push({ + name: shortName, + prefix: 'Emoji', + displayName: unicode, + iconPackName: null, + }); + iconKeys.push({ + name: unicode, + prefix: 'Emoji', + displayName: unicode, + iconPackName: null, + }); + }); + return iconKeys; + } + onChooseItem(item) { + var _a; + const iconNameWithPrefix = typeof item === 'object' ? item.displayName : item; + dom.createIconNode(this.plugin, this.path, iconNameWithPrefix); + (_a = this.onSelect) === null || _a === void 0 ? void 0 : _a.call(this, iconNameWithPrefix); + this.plugin.addFolderIcon(this.path, item); + // Extracts the icon file to the icon pack. + if (typeof item === 'object' && !emoji.isEmoji(iconNameWithPrefix)) { + saveIconToIconPack(this.plugin, iconNameWithPrefix); + } + this.plugin.notifyPlugins(); + } + renderSuggestion(item, el) { + super.renderSuggestion(item, el); + // if (getAllIconPacks().length === 0) { + // this.resultContainerEl.style.display = 'block'; + // this.resultContainerEl.innerHTML = '
You need to create an icon pack.
'; + // return; + // } + // Render subheadlines for modal. + if (this.recentlyUsedItems.size !== 0 && this.inputEl.value.length === 0) { + if (this.renderIndex === 0) { + const subheadline = this.resultContainerEl.createDiv(); + subheadline.classList.add('iconize-subheadline'); + subheadline.innerText = 'Recently used Icons:'; + this.resultContainerEl.prepend(subheadline); + } + else if (this.renderIndex === this.recentlyUsedItems.size - 1) { + const subheadline = this.resultContainerEl.createDiv(); + subheadline.classList.add('iconize-subheadline'); + subheadline.innerText = 'All Icons:'; + this.resultContainerEl.append(subheadline); + } + } + if (item.item.name !== 'default') { + if (item.item.prefix === 'Emoji') { + const displayName = emoji.parseEmoji(this.plugin.getSettings().emojiStyle, item.item.displayName); + if (!displayName) { + return; + } + el.innerHTML = `
${el.innerHTML}
${displayName}
`; + } + else { + el.innerHTML = `
${el.innerHTML}
${getSvgFromLoadedIcon(item.item.prefix, item.item.name)}
`; + } + } + this.renderIndex++; + } +} + +var IconInTitlePosition; +(function (IconInTitlePosition) { + IconInTitlePosition["Above"] = "above"; + IconInTitlePosition["Inline"] = "inline"; +})(IconInTitlePosition || (IconInTitlePosition = {})); +const DEFAULT_SETTINGS = { + migrated: 2, + iconPacksPath: '.obsidian/icons', + fontSize: 16, + emojiStyle: 'native', + iconColor: null, + recentlyUsedIcons: [], + recentlyUsedIconsSize: 5, + rules: [], + extraMargin: { + top: 0, + right: 4, + bottom: 0, + left: 0, + }, + iconInTabsEnabled: false, + iconInTitleEnabled: false, + iconInTitlePosition: IconInTitlePosition.Above, + iconInFrontmatterEnabled: false, + iconInFrontmatterFieldName: 'icon', + iconColorInFrontmatterFieldName: 'iconColor', + iconsBackgroundCheckEnabled: false, + iconsInNotesEnabled: true, + iconsInLinksEnabled: true, + iconIdentifier: ':', + lucideIconPackType: 'native', + debugMode: false, + useInternalPlugins: false, +}; + +function migrate$5(plugin) { + return __awaiter(this, void 0, void 0, function* () { + // Migration for new syncing mechanism. + if (plugin.getSettings().migrated === 1) { + new obsidian.Notice('Please delete your old icon packs and redownload your icon packs to use the new syncing mechanism.', 20000); + plugin.getSettings().migrated++; + } + }); +} + +function migrate$4(plugin) { + return __awaiter(this, void 0, void 0, function* () { + // Migration for new order functionality of custom rules. + if (plugin.getSettings().migrated === 2) { + // Sorting alphabetically was the default behavior before. + plugin + .getSettings() + .rules.sort((a, b) => a.rule.localeCompare(b.rule)) + .forEach((rule, i) => { + rule.order = i; + }); + plugin.getSettings().migrated++; + } + }); +} + +class IconCache { + constructor() { + this.cache = new Map(); + this.set = (path, result) => { + this.cache.set(path, result); + }; + this.invalidate = (path) => { + this.cache.delete(path); + }; + this.clear = () => { + this.cache.clear(); + }; + this.get = (path) => { + var _a; + return (_a = this.cache.get(path)) !== null && _a !== void 0 ? _a : null; + }; + this.doesRecordExist = (path) => { + return this.get(path) !== null; + }; + if (IconCache.instance) { + throw new Error('Error: Instantiation failed: Use `IconCache.getInstance()` instead of new.'); + } + IconCache.instance = this; + } +} +IconCache.instance = new IconCache(); +IconCache.getInstance = () => { + return IconCache.instance; +}; + +/** + * Checks if the file type is equal to the `for` property of the custom rule. + * @param rule CustomRule that will be checked. + * @param fileType CustomRuleFileType that will be checked. Can be either `file` or `folder`. + * @returns Boolean whether the custom rule `for` matches the file type or not. + */ +const doesMatchFileType = (rule, fileType) => { + return (rule.for === 'everything' || + (rule.for === 'files' && fileType === 'file') || + (rule.for === 'folders' && fileType === 'folder')); +}; +/** + * Determines whether a given file or folder matches a specified custom rule. + * @param plugin Plugin instance. + * @param rule CustomRule to check against the file or folder. + * @param filePath String to check against the custom rule. + * @returns Promise that resolves to `true` if the file matches the rule, `false` otherwise. + */ +const isApplicable = (plugin, rule, filePath) => __awaiter(void 0, void 0, void 0, function* () { + const metadata = yield plugin.app.vault.adapter.stat(filePath); + if (!metadata) { + return false; + } + const fileType = metadata.type; + const doesMatch = doesMatchFileType(rule, fileType); + if (!doesMatch) { + return false; + } + return doesMatchPath(rule, filePath); +}); +/** + * Removes the icon from the custom rule from all the files and folders, if applicable. + * @param plugin IconizePlugin instance. + * @param rule CustomRule where the icons will be removed based on this rule. + */ +const removeFromAllFiles = (plugin, rule) => __awaiter(void 0, void 0, void 0, function* () { + const nodesWithIcon = document.querySelectorAll(`[${config.ICON_ATTRIBUTE_NAME}="${rule.icon}"]`); + for (let i = 0; i < nodesWithIcon.length; i++) { + const node = nodesWithIcon[i]; + // Parent element is the node which contains the data path. + const parent = node.parentElement; + if (!parent) { + continue; + } + const dataPath = parent.getAttribute('data-path'); + if (!dataPath) { + continue; + } + const fileType = (yield plugin.app.vault.adapter.stat(dataPath)).type; + if (doesMatchPath(rule, dataPath) && doesMatchFileType(rule, fileType)) { + dom.removeIconInNode(parent); + IconCache.getInstance().invalidate(dataPath); + } + } +}); +/** + * Gets all the custom rules sorted by their order property in ascending order. + * @param plugin IconizePlugin instance. + * @returns CustomRule array sorted by their order property in ascending order. + */ +const getSortedRules = (plugin) => { + return plugin.getSettings().rules.sort((a, b) => a.order - b.order); +}; +/** + * Tries to add all specific custom rule icons to all registered files and directories. + * It does that by calling the {@link add} function. Custom rules should have the lowest + * priority and will get ignored if an icon already exists in the file or directory. + * @param plugin IconizePlugin instance. + * @param rule CustomRule that will be applied, if applicable, to all files and folders. + */ +const addToAllFiles = (plugin, rule) => __awaiter(void 0, void 0, void 0, function* () { + const fileItems = yield getFileItems(plugin, rule); + for (const fileItem of fileItems) { + yield add$2(plugin, rule, fileItem.file, getFileItemTitleEl(fileItem)); + } +}); +/** + * Tries to add the icon of the custom rule to a file or folder. This function also checks + * if the file type matches the `for` property of the custom rule. + * @param plugin IconizePlugin instance. + * @param rule CustomRule that will be used to check if the rule is applicable to the file + * or directory. + * @param file TAbstractFile that will be used to possibly create the icon for. + * @param container HTMLElement where the icon will be added if the custom rules matches. + * @returns A promise that resolves to `true` if the icon was added, `false` otherwise. + */ +const add$2 = (plugin, rule, file, container) => __awaiter(void 0, void 0, void 0, function* () { + if (container && dom.doesElementHasIconNode(container)) { + return false; + } + // Checks if the file or directory already has an icon. + const hasIcon = plugin.getIconNameFromPath(file.path); + if (hasIcon) { + return false; + } + const doesMatch = yield isApplicable(plugin, rule, file.path); + if (doesMatch) { + IconCache.getInstance().set(file.path, { + iconNameWithPrefix: rule.icon, + inCustomRule: true, + }); + dom.createIconNode(plugin, file.path, rule.icon, { + color: rule.color, + container, + }); + return true; + } + return false; +}); +/** + * Determines whether a given rule exists in a given path. + * @param rule Rule to check for. + * @param path Path to check in. + * @returns True if the rule exists in the path, false otherwise. + */ +const doesMatchPath = (rule, path) => { + const toMatch = rule.useFilePath ? path : path.split('/').pop(); + try { + // Rule is in some sort of regex. + const regex = new RegExp(rule.rule); + if (toMatch.match(regex)) { + return true; + } + } + catch (_a) { + // Rule is not in some sort of regex, check for basic string match. + return toMatch.includes(rule.rule); + } + return false; +}; +/** + * Gets all the file items that can be applied to the specific custom rule. + * @param plugin Instance of IconizePlugin. + * @param rule Custom rule that will be checked for. + * @returns A promise that resolves to an array of file items that match the custom rule. + */ +const getFileItems = (plugin, rule) => __awaiter(void 0, void 0, void 0, function* () { + const result = []; + for (const fileExplorer of plugin.getRegisteredFileExplorers()) { + const files = Object.values(fileExplorer.fileItems || {}); + for (const fileItem of files) { + if (yield isApplicable(plugin, rule, fileItem.file.path)) { + result.push(fileItem); + } + } + } + return result; +}); +var customRule = { + getFileItems, + doesMatchPath, + doesMatchFileType, + getSortedRules, + removeFromAllFiles, + add: add$2, + addToAllFiles, + isApplicable, +}; + +function migrate$3(plugin) { + return __awaiter(this, void 0, void 0, function* () { + // Migration for inheritance to custom rule. + if (plugin.getSettings().migrated === 3) { + let hasRemovedInheritance = false; + for (const [key, value] of Object.entries(plugin.getData())) { + if (key === 'settings' || typeof value !== 'object') { + continue; + } + const folderData = value; + const inheritanceIcon = folderData.inheritanceIcon; + if (!inheritanceIcon) { + continue; + } + const folderIconName = folderData.iconName; + // Clean up old data. + if (folderData.iconColor && folderIconName) { + delete folderData.inheritanceIcon; + } + else if (folderIconName) { + delete plugin.getData()[key]; + plugin.getData()[key] = folderIconName; + } + else if (!folderIconName) { + delete plugin.getData()[key]; + } + const folderPath = key + '\\/[\\w\\d\\s]+'; + const newRule = { + icon: inheritanceIcon, + rule: `${folderPath}\\.(?:\\w+\\.)*\\w+`, + for: 'files', + order: 0, + useFilePath: true, + }; + // Reorder existing custom rules so that the new inheritance custom rule + // is at the top. + plugin.getSettings().rules.map((rule) => { + rule.order++; + }); + plugin.getSettings().rules.unshift(newRule); + // Apply the custom rule. + yield customRule.addToAllFiles(plugin, newRule); + hasRemovedInheritance = true; + } + if (hasRemovedInheritance) { + new obsidian.Notice(`[${config.PLUGIN_NAME}] Inheritance has been removed and replaced with custom rules.`); + } + plugin.getSettings().migrated++; + } + }); +} + +function migrate$2(plugin) { + return __awaiter(this, void 0, void 0, function* () { + if (plugin.getSettings().migrated === 4) { + if (plugin.getSettings().emojiStyle === 'none') { + plugin.getSettings().emojiStyle = 'native'; + } + plugin.getSettings().migrated++; + } + }); +} + +function migrate$1(plugin) { + return __awaiter(this, void 0, void 0, function* () { + if (plugin.getSettings().migrated === 5) { + yield deleteIconPack(plugin, LUCIDE_ICON_PACK_NAME); + plugin.getSettings().migrated++; + } + }); +} + +const migrate = (plugin) => __awaiter(void 0, void 0, void 0, function* () { + // eslint-disable-next-line + // @ts-ignore - Required because an older version of the plugin saved the `migrated` + // property as a boolean instead of a number. + if (plugin.getSettings().migrated === true) { + plugin.getSettings().migrated = 1; + } + yield migrate$5(plugin); + yield migrate$4(plugin); + yield migrate$3(plugin); + yield migrate$2(plugin); + yield migrate$1(plugin); + yield plugin.saveIconFolderData(); +}); + +class IconFolderSetting { + constructor(plugin, containerEl) { + this.plugin = plugin; + this.containerEl = containerEl; + } +} + +/** + * Gets the tab leaves of a specific file path by looping through all opened files and + * checking if the file path matches. + * @param plugin IconizePlugin instance. + * @param path String of the file path to get the tab leaf of. + * @returns TabHeaderLeaf array that includes all tab leaves of the file path. + */ +const getTabLeavesOfFilePath = (plugin, path) => { + const openedFiles = getAllOpenedFiles(plugin); + const openedFile = openedFiles.filter((openedFile) => openedFile.path === path); + const leaves = openedFile.map((openedFile) => openedFile.leaf); + return leaves; +}; +/** + * Adds an icon to the tab and its container. This function respects the + * custom rules and individually icon set. + * @param plugin IconizePlugin instance. + * @param filePath String file path to add the icon to. + * @param iconContainer HTMLElement where the icon will be added to. + * @param options AddOptions for the add function which can optionally be used. + */ +const add$1 = (plugin, filePath, iconContainer, options) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const iconColor = (_a = options === null || options === void 0 ? void 0 : options.iconColor) !== null && _a !== void 0 ? _a : plugin.getSettings().iconColor; + const data = Object.entries(plugin.getData()); + // Removes the `display: none` from the obsidian styling. + iconContainer.style.display = 'flex'; + // Only add the icon name manually when it is defined in the options. + if (options === null || options === void 0 ? void 0 : options.iconName) { + dom.setIconForNode(plugin, options.iconName, iconContainer, { + color: iconColor, + }); + // TODO: Refactor to include option to `insertIconToNode` function. + iconContainer.style.margin = null; + return; + } + // Add icons to tabs if a custom rule is applicable. + for (const rule of customRule.getSortedRules(plugin)) { + const isApplicable = yield customRule.isApplicable(plugin, rule, filePath); + if (isApplicable) { + dom.setIconForNode(plugin, rule.icon, iconContainer, { + color: rule.color, + }); + // TODO: Refactor to include option to `insertIconToNode` function. + iconContainer.style.margin = null; + break; + } + } + // Add icons to tabs if there is an icon set. + const iconData = data.find(([dataPath]) => dataPath === filePath); + if (!iconData) { + return; + } + const value = iconData[1]; + if (typeof value !== 'string' && typeof value !== 'object') { + return; + } + let iconName; + if (typeof value === 'object') { + const v = value; + if (v.iconName === null) { + return; + } + iconName = v.iconName; + } + else { + iconName = value; + } + dom.setIconForNode(plugin, iconName, iconContainer, { + color: iconColor, + shouldApplyAllStyles: true, + }); + // TODO: Refactor to include option to `insertIconToNode` function. + iconContainer.style.margin = null; +}); +/** + * Updates the icon in the tab and container by setting calling the `setIconForNode` + * function and removing the margin from the icon container. + * @param plugin IconizePlugin instance. + * @param iconName String of the icon name to update to. + * @param iconContainer HTMLElement where the icon is located and will be updated. + */ +const update = (plugin, iconName, iconContainer) => { + dom.setIconForNode(plugin, iconName, iconContainer); + // TODO: Refactor to include option to `insertIconToNode` function. + iconContainer.style.margin = null; +}; +/** + * Removes the icon from the tab and container by setting the `display` style property + * to `none`. Optionally, the icon can be replaced with the default obsidian icon. + * @param iconContainer HTMLElement where the icon is located and will be removed from. + * @param options RemoveOptions for the remove function which can optionally be used. + */ +const remove$1 = (iconContainer, options) => { + if (!(options === null || options === void 0 ? void 0 : options.replaceWithDefaultIcon)) { + // Removes the display of the icon container to remove the icons from the tabs. + iconContainer.style.display = 'none'; + } + else { + iconContainer.innerHTML = DEFAULT_FILE_ICON; + } +}; +var iconTabs = { + add: add$1, + update, + remove: remove$1, + getTabLeavesOfFilePath, +}; + +const checkMissingIcons = (plugin, data) => __awaiter(void 0, void 0, void 0, function* () { + const missingIcons = new Set(); + const allIcons = new Map(); + const getMissingIcon = (iconNameWithPrefix) => __awaiter(void 0, void 0, void 0, function* () { + const iconNextIdentifier = nextIdentifier(iconNameWithPrefix); + const iconName = iconNameWithPrefix.substring(iconNextIdentifier); + const iconPrefix = iconNameWithPrefix.substring(0, iconNextIdentifier); + const iconPackName = getIconPackNameByPrefix(iconPrefix); + if (iconPackName === LUCIDE_ICON_PACK_NAME && + !plugin.doesUseCustomLucideIconPack()) { + return; + } + const icon = getIconFromIconPack(iconPackName, iconPrefix, iconName); + if (!icon) { + logger.error(`Icon file with name ${iconNameWithPrefix} could not be found`); + return null; + } + const doesIconFileExists = yield plugin.app.vault.adapter.exists(`${getPath()}/${iconPackName}/${iconName}.svg`); + if (!doesIconFileExists) { + const possibleIcon = getSvgFromLoadedIcon(iconPrefix, iconName); + if (!possibleIcon) { + logger.error(`Icon SVG with name ${iconNameWithPrefix} could not be found`); + return null; + } + yield extractIconToIconPack(plugin, icon, possibleIcon); + return icon; + } + return null; + }); + for (const rule of plugin.getSettings().rules) { + if (!emoji.isEmoji(rule.icon)) { + allIcons.set(rule.icon, true); + const icon = yield getMissingIcon(rule.icon); + if (icon) { + missingIcons.add(icon); + } + } + } + for (const [_, value] of data) { + // Check for missing icon names. + let iconNameWithPrefix = value; + if (typeof value === 'object') { + iconNameWithPrefix = value.iconName; + } + if (iconNameWithPrefix && !emoji.isEmoji(iconNameWithPrefix)) { + allIcons.set(iconNameWithPrefix, true); + const icon = yield getMissingIcon(iconNameWithPrefix); + if (icon) { + missingIcons.add(icon); + } + } + } + // Show notice that background check is running. + if (missingIcons.size !== 0) { + new obsidian.Notice(`[${config.PLUGIN_NAME}] Background Check: found missing icons. Adding missing icons...`, 10000); + } + // Iterates over all the missing icons with its path and adds the icon to the node. + for (const icon of missingIcons) { + const normalizedName = getNormalizedName(icon.prefix + icon.name); + const nodesWithIcon = document.querySelectorAll(`[${config.ICON_ATTRIBUTE_NAME}="${normalizedName}"]`); + nodesWithIcon.forEach((node) => { + dom.setIconForNode(plugin, normalizedName, node); + }); + } + // Show notice that background check was finished. + if (missingIcons.size !== 0) { + new obsidian.Notice(`[${config.PLUGIN_NAME}] Background Check: added missing icons`, 10000); + } + // Remove all icon files that can not be found in the data. + for (const iconPack of getAllIconPacks()) { + // Checks if the icon pack exists. + const doesIconPackExist = yield plugin.app.vault.adapter.exists(`${getPath()}/${iconPack.name}`); + if (!doesIconPackExist) { + continue; + } + const iconFiles = yield plugin.app.vault.adapter.list(`${getPath()}/${iconPack.name}`); + for (const iconFilePath of iconFiles.files) { + const iconNameWithExtension = iconFilePath.split('/').pop(); + // Removes the file extension. + const iconName = iconNameWithExtension === null || iconNameWithExtension === void 0 ? void 0 : iconNameWithExtension.substring(0, iconNameWithExtension.length - 4); + const iconNameWithPrefix = iconPack.prefix + iconName; + const doesIconExist = allIcons.get(iconNameWithPrefix); + if (!doesIconExist) { + const path = `${getPath()}/${iconPack.name}/${iconName}.svg`; + const doesPathExist = yield plugin.app.vault.adapter.exists(path); + if (doesPathExist) { + logger.info(`Removing icon with path '${path}' because it is not used anymore`); + // Removes the icon file. + yield plugin.app.vault.adapter.remove(`${getPath()}/${iconPack.name}/${iconName}.svg`); + } + } + } + } +}); +/** + * This function adds all the possible icons to the corresponding nodes. It + * adds the icons, that are defined in the data as a basic string to the nodes + * and the custom rule icons. + * @param plugin Instance of IconizePlugin. + * @param data Data that will be used to add all the icons to the nodes. + * @param registeredFileExplorers A WeakSet of file explorers that are being used as a + * cache for already handled file explorers. + * @param callback Callback is being called whenever the icons are added to one file + * explorer. + */ +const addAll = (plugin, data, registeredFileExplorers, callback) => { + const fileExplorers = plugin.app.workspace.getLeavesOfType('file-explorer'); + for (const fileExplorer of fileExplorers) { + if (registeredFileExplorers.has(fileExplorer.view)) { + continue; + } + registeredFileExplorers.add(fileExplorer.view); + const setIcons = () => { + var _a, _b; + // Adds icons to already open file tabs. + if (plugin.getSettings().iconInTabsEnabled) { + for (const leaf of plugin.app.workspace.getLeavesOfType('markdown')) { + const filePath = (_b = (_a = leaf.view.file) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : leaf.view.getState().file; + if (typeof filePath === 'string') { + const tabHeaderLeaf = leaf; + const iconColor = plugin.getIconColor(filePath); + iconTabs.add(plugin, filePath, tabHeaderLeaf.tabHeaderInnerIconEl, { + iconColor, + }); + } + } + } + for (const [dataPath, value] of data) { + const fileItem = fileExplorer.view.fileItems[dataPath]; + if (fileItem) { + const titleEl = getFileItemTitleEl(fileItem); + const titleInnerEl = getFileItemInnerTitleEl(fileItem); + // Need to check this because refreshing the plugin will duplicate all the icons. + if (titleEl.children.length === 2 || titleEl.children.length === 1) { + const iconName = typeof value === 'string' ? value : value.iconName; + const iconColor = typeof value === 'string' ? undefined : value.iconColor; + if (iconName) { + // Removes a possible existing icon. + const existingIcon = titleEl.querySelector('.iconize-icon'); + if (existingIcon) { + existingIcon.remove(); + } + // Creates the new node with the icon inside. + const iconNode = titleEl.createDiv(); + iconNode.setAttribute(config.ICON_ATTRIBUTE_NAME, iconName); + iconNode.classList.add('iconize-icon'); + IconCache.getInstance().set(dataPath, { + iconNameWithPrefix: iconName, + }); + dom.setIconForNode(plugin, iconName, iconNode, { + color: iconColor, + }); + titleEl.insertBefore(iconNode, titleInnerEl); + } + } + } + } + // Callback function to register other events to this file explorer. + callback === null || callback === void 0 ? void 0 : callback(); + }; + if (obsidian.requireApiVersion('1.7.2')) { + // TODO: Remove loading deferred view to improve performance. + fileExplorer.loadIfDeferred().then(setIcons); + } + else { + setIcons(); + } + } + // Handles the custom rules. + for (const rule of customRule.getSortedRules(plugin)) { + customRule.addToAllFiles(plugin, rule); + } +}; +/** + * Gets the icon of a given path. This function returns the first occurrence of an icon. + * @param plugin Instance of the IconizePlugin. + * @param path Path to get the icon of. + * @returns The icon of the path if it exists, undefined otherwise. + */ +const getByPath = (plugin, path) => { + if (path === 'settings' || path === 'migrated') { + return undefined; + } + const value = plugin.getData()[path]; + if (typeof value === 'string') { + // If the value is a plain icon name, return it. + return value; + } + else if (typeof value === 'object') { + const v = value; + if (v.iconName !== null) { + return v.iconName; + } + } + // Tries to get the custom rule for the path and returns its icon if it exists. + const rule = customRule.getSortedRules(plugin).find((rule) => { + return customRule.doesMatchPath(rule, path); + }); + if (rule) { + return rule.icon; + } + return undefined; +}; +/** + * Gets all the icons with their paths as an object. + * @param plugin Instance of the IconizePlugin. + * @returns An object that consists of the path and the icon name for the data + * or custom rule. + */ +const getAllWithPath = (plugin) => { + const result = []; + Object.keys(plugin.getData()).forEach((path) => { + if (path === 'settings' || path === 'migrated') { + return; + } + const icon = getByPath(plugin, path); + if (icon && !emoji.isEmoji(icon)) { + result.push({ path, icon }); + } + }); + // Add all icons for the custom rules with the rule as the path. + for (const rule of plugin.getSettings().rules) { + if (!emoji.isEmoji(rule.icon)) { + result.push({ path: rule.rule, icon: rule.icon }); + } + } + return result; +}; +/** + * Returns the {@link Icon} for the given icon name. It is important, that the icon name + * contains the icon pack prefix. + * @param iconNameWithPrefix String that contains the icon pack prefix combined with the + * icon name. + * @returns Icon if it exists, `null` otherwise. + */ +const getIconByName = (iconNameWithPrefix) => { + const iconNextIdentifier = nextIdentifier(iconNameWithPrefix); + const iconName = iconNameWithPrefix.substring(iconNextIdentifier); + const iconPrefix = iconNameWithPrefix.substring(0, iconNextIdentifier); + const iconPackName = getIconPackNameByPrefix(iconPrefix); + const icon = getIconFromIconPack(iconPackName, iconPrefix, iconName); + if (!icon) { + return null; + } + return icon; +}; +/** + * Returns the {@link Icon} for the given path. + * @param plugin IconizePlugin instance. + * @param path String which is the path to get the icon of. + * @returns Icon or Emoji as string if it exists, `null` otherwise. + */ +const getIconByPath = (plugin, path) => { + const iconNameWithPrefix = getByPath(plugin, path); + if (!iconNameWithPrefix) { + return null; + } + if (emoji.isEmoji(iconNameWithPrefix)) { + return iconNameWithPrefix; + } + return getIconByName(iconNameWithPrefix); +}; +var icon = { + addAll, + getByPath, + getAllWithPath, + getIconByPath, + getIconByName, + checkMissingIcons, +}; + +class CustomIconPackSetting extends IconFolderSetting { + constructor(plugin, containerEl, refreshDisplay) { + super(plugin, containerEl); + this.refreshDisplay = refreshDisplay; + this.dragOverElement = document.createElement('div'); + this.dragOverElement.addClass('iconize-dragover-el'); + this.dragOverElement.style.display = 'hidden'; + this.dragOverElement.innerHTML = '

Drop to add icon.

'; + } + normalizeIconPackName(value) { + return value.toLowerCase().replace(/\s/g, '-'); + } + preventDefaults(event) { + event.preventDefault(); + event.stopPropagation(); + } + highlight(el) { + clearTimeout(this.closeTimer); + if (!this.dragTargetElement) { + el.appendChild(this.dragOverElement); + el.classList.add('iconize-dragover'); + this.dragTargetElement = el; + } + } + unhighlight(target, el) { + if (this.dragTargetElement && this.dragTargetElement !== target) { + this.dragTargetElement.removeChild(this.dragOverElement); + this.dragTargetElement.classList.remove('iconize-dragover'); + this.dragTargetElement = undefined; + } + clearTimeout(this.closeTimer); + this.closeTimer = setTimeout(() => { + if (this.dragTargetElement) { + el.removeChild(this.dragOverElement); + el.classList.remove('iconize-dragover'); + this.dragTargetElement = undefined; + } + }, 100); + } + display() { + new obsidian.Setting(this.containerEl) + .setName('Add custom icon pack') + .setDesc('Add a custom icon pack.') + .addText((text) => { + text.setPlaceholder('Your icon pack name'); + this.textComponent = text; + }) + .addButton((btn) => { + btn.setButtonText('Add icon pack'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + const name = this.textComponent.getValue(); + if (name.length === 0) { + return; + } + const normalizedName = this.normalizeIconPackName(this.textComponent.getValue()); + if (yield doesIconPackExist(this.plugin, normalizedName)) { + new obsidian.Notice('Icon pack already exists.'); + return; + } + yield createCustomIconPackDirectory(this.plugin, normalizedName); + this.textComponent.setValue(''); + this.refreshDisplay(); + new obsidian.Notice('Icon pack successfully created.'); + })); + }); + // Sorts lucide icon pack always to the top. + const iconPacks = [...getAllIconPacks()].sort((a, b) => { + if (a.name === LUCIDE_ICON_PACK_NAME) + return -1; + if (b.name === LUCIDE_ICON_PACK_NAME) + return 1; + return a.name.localeCompare(b.name); + }); + iconPacks.forEach((iconPack) => { + const isLucideIconPack = iconPack.name === LUCIDE_ICON_PACK_NAME; + const additionalLucideDescription = '(Native Pack has fewer icons but 100% Obsidian Sync support)'; + const iconPackSetting = new obsidian.Setting(this.containerEl) + .setName(`${iconPack.name} (${iconPack.prefix})`) + .setDesc(`Total icons: ${iconPack.icons.length}${isLucideIconPack ? ` ${additionalLucideDescription}` : ''}`); + // iconPackSetting.addButton((btn) => { + // btn.setIcon('broken-link'); + // btn.setTooltip('Try to fix icon pack'); + // btn.onClick(async () => { + // new Notice('Try to fix icon pack...'); + // getIconPack(iconPack.name).icons = []; + // const icons = await getFilesInDirectory(this.plugin, `${getPath()}/${iconPack.name}`); + // for (let i = 0; i < icons.length; i++) { + // const filePath = icons[i]; + // const fileName = filePath.split('/').pop(); + // const file = await this.plugin.app.vault.adapter.read(filePath); + // const iconContent = file + // .replace(/stroke="#fff"/g, 'stroke="currentColor"') + // .replace(/fill="#fff"/g, 'fill="currentColor"'); + // await this.plugin.app.vault.adapter.write(filePath, iconContent); + // await normalizeFileName(this.plugin, filePath); + // addIconToIconPack(iconPack.name, fileName, iconContent); + // } + // new Notice('...tried to fix icon pack'); + // // Refreshes the DOM. + // Object.entries(this.plugin.getData()).forEach(async ([k, v]) => { + // const doesPathExist = await this.plugin.app.vault.adapter.exists(k, true); + // if (doesPathExist && typeof v === 'string') { + // // dom.removeIconInPath(k); + // dom.createIconNode(this.plugin, k, v); + // } + // }); + // }); + // }); + if (isLucideIconPack) { + iconPackSetting.addDropdown((dropdown) => { + dropdown.addOptions({ + native: 'Native', + custom: 'Custom', + none: 'None', + }); + dropdown.setValue(this.plugin.getSettings().lucideIconPackType); + dropdown.onChange((value) => __awaiter(this, void 0, void 0, function* () { + dropdown.setDisabled(true); + new obsidian.Notice('Changing icon packs...'); + this.plugin.getSettings().lucideIconPackType = value; + yield this.plugin.saveIconFolderData(); + if (value === 'native' || value === 'none') { + yield removeCustomLucideIconPack(this.plugin); + addLucideIconsPack(this.plugin); + } + else { + yield addCustomLucideIconPack(this.plugin); + yield icon.checkMissingIcons(this.plugin, Object.entries(this.plugin.getData())); + } + dropdown.setDisabled(false); + new obsidian.Notice('Done. This change requires a restart of Obsidian'); + })); + }); + return; + } + iconPackSetting.addButton((btn) => { + btn.setIcon('plus'); + btn.setTooltip('Add an icon'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + const fileSelector = document.createElement('input'); + fileSelector.setAttribute('type', 'file'); + fileSelector.setAttribute('multiple', 'multiple'); + fileSelector.setAttribute('accept', '.svg'); + fileSelector.click(); + fileSelector.onchange = (e) => __awaiter(this, void 0, void 0, function* () { + const target = e.target; + for (let i = 0; i < target.files.length; i++) { + const file = target.files[i]; + const content = yield readFileSync(file); + yield createFile(this.plugin, iconPack.name, file.name, content); + addIconToIconPack(iconPack.name, file.name, content); + iconPackSetting.setDesc(`Total icons: ${iconPack.icons.length} (added: ${file.name})`); + } + new obsidian.Notice('Icons successfully added.'); + }); + })); + }); + iconPackSetting.addButton((btn) => { + btn.setIcon('trash'); + btn.setTooltip('Remove the icon pack'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + yield deleteIconPack(this.plugin, iconPack.name); + this.refreshDisplay(); + new obsidian.Notice('Icon pack successfully deleted.'); + })); + }); + ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((event) => { + iconPackSetting.settingEl.addEventListener(event, this.preventDefaults, false); + }); + ['dragenter', 'dragover'].forEach((event) => { + iconPackSetting.settingEl.addEventListener(event, () => this.highlight(iconPackSetting.settingEl), false); + }); + ['dragleave', 'drop'].forEach((event) => { + iconPackSetting.settingEl.addEventListener(event, (event) => this.unhighlight(event.currentTarget, iconPackSetting.settingEl), false); + }); + iconPackSetting.settingEl.addEventListener('drop', (event) => __awaiter(this, void 0, void 0, function* () { + const files = event.dataTransfer.files; + let successful = false; + for (let i = 0; i < files.length; i++) { + const file = files[i]; + if (file.type !== 'image/svg+xml') { + new obsidian.Notice(`File ${file.name} is not a SVG file.`); + continue; + } + successful = true; + const content = yield readFileSync(file); + yield createFile(this.plugin, iconPack.name, file.name, content); + addIconToIconPack(iconPack.name, file.name, content); + iconPackSetting.setDesc(`Total icons: ${iconPack.icons.length} (added: ${file.name})`); + } + if (successful) { + new obsidian.Notice('Icons successfully added.'); + } + }), false); + }); + } +} + +class CustomIconRuleSetting extends IconFolderSetting { + constructor(plugin, containerEl, app, refreshDisplay) { + super(plugin, containerEl); + this.app = app; + this.refreshDisplay = refreshDisplay; + } + /** + * Updates all the open files based on the custom rule that was specified. + * @param rule Rule that will be used to update all the icons for all opened files. + * @param remove Whether to remove the icons that are applicable to the rule or not. + */ + updateIconTabs(rule_1, remove_1) { + return __awaiter(this, arguments, void 0, function* (rule, remove, cachedPaths = []) { + if (this.plugin.getSettings().iconInTabsEnabled) { + for (const openedFile of getAllOpenedFiles(this.plugin)) { + if (cachedPaths.includes(openedFile.path)) { + continue; + } + const applicable = yield customRule.isApplicable(this.plugin, rule, openedFile.path); + if (!applicable) { + continue; + } + const leaf = openedFile.leaf; + if (remove) { + iconTabs.remove(leaf.tabHeaderInnerIconEl, { + replaceWithDefaultIcon: true, + }); + } + else { + iconTabs.add(this.plugin, openedFile.path, leaf.tabHeaderInnerIconEl, { + iconName: rule.icon, + iconColor: rule.color, + }); + } + } + } + }); + } + createDescriptionEl(container, text) { + const description = container.createEl('p', { + text, + cls: 'setting-item-description', + }); + description.style.marginBottom = 'var(--size-2-2)'; + } + display() { + new obsidian.Setting(this.containerEl) + .setName('Add icon rule') + .setDesc('Will add the icon based on the defined rule (as a plain string or in regex format).') + .addText((text) => { + text.onChange((value) => { + this.chooseIconBtn.setDisabled(value.length === 0); + this.chooseIconBtn.buttonEl.style.cursor = + value.length === 0 ? 'not-allowed' : 'default'; + this.chooseIconBtn.buttonEl.style.opacity = + value.length === 0 ? '50%' : '100%'; + }); + text.setPlaceholder('regex or simple string'); + this.textComponent = text; + }) + .addButton((btn) => { + btn.setDisabled(true); + btn.setButtonText('Choose icon'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + if (this.textComponent.getValue().length === 0) { + return; + } + const modal = new IconsPickerModal(this.app, this.plugin, ''); + modal.onChooseItem = (item) => __awaiter(this, void 0, void 0, function* () { + const icon = getNormalizedName(typeof item === 'object' ? item.displayName : item); + const rule = { + rule: this.textComponent.getValue(), + icon, + for: 'everything', + order: this.plugin.getSettings().rules.length, + }; + this.plugin.getSettings().rules = [ + ...this.plugin.getSettings().rules, + rule, + ]; + yield this.plugin.saveIconFolderData(); + this.refreshDisplay(); + new obsidian.Notice('Icon rule added.'); + this.textComponent.setValue(''); + saveIconToIconPack(this.plugin, rule.icon); + yield customRule.addToAllFiles(this.plugin, rule); + this.updateIconTabs(rule, false); + }); + modal.open(); + })); + this.chooseIconBtn = btn; + }); + this.plugin.getSettings().rules.forEach((rule) => { + // Keeping track of the old rule so that we can get a reference to it for old values. + const oldRule = Object.assign({}, rule); + const settingRuleEl = new obsidian.Setting(this.containerEl) + .setName(rule.rule) + .setDesc(`Icon: ${rule.icon}`); + const currentOrder = rule.order; + /** + * Re-orders the custom rule based on the value that is passed in. + * @param valueForReorder Number that will be used to determine whether to swap the + * custom rule with the next rule or the previous rule. + */ + const orderCustomRules = (valueForReorder) => __awaiter(this, void 0, void 0, function* () { + const otherRule = this.plugin.getSettings().rules[currentOrder + valueForReorder]; + // Swap the current rule with the next rule. + otherRule.order = otherRule.order - valueForReorder; + rule.order = currentOrder + valueForReorder; + // Refreshes the DOM. + yield customRule.removeFromAllFiles(this.plugin, oldRule); + yield this.plugin.saveIconFolderData(); + const addedPaths = []; + for (const fileExplorer of this.plugin.getRegisteredFileExplorers()) { + const files = Object.values(fileExplorer.fileItems || {}); + for (const rule of customRule.getSortedRules(this.plugin)) { + // Removes the icon tabs from all opened files. + this.updateIconTabs(rule, true, addedPaths); + // Adds the icon tabs to all opened files. + this.updateIconTabs(rule, false, addedPaths); + for (const fileItem of files) { + if (addedPaths.includes(fileItem.file.path)) { + continue; + } + const added = yield customRule.add(this.plugin, rule, fileItem.file, getFileItemTitleEl(fileItem)); + if (added) { + addedPaths.push(fileItem.file.path); + } + } + } + } + this.refreshDisplay(); + }); + // Add the move down custom rule button to re-order the custom rule. + settingRuleEl.addExtraButton((btn) => { + const isFirstOrder = currentOrder === 0; + btn.setDisabled(isFirstOrder); + btn.extraSettingsEl.style.cursor = isFirstOrder + ? 'not-allowed' + : 'default'; + btn.extraSettingsEl.style.opacity = isFirstOrder ? '50%' : '100%'; + btn.setIcon('arrow-up'); + btn.setTooltip('Prioritize the custom rule'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + yield orderCustomRules(-1); + })); + }); + // Add the move up custom rule button to re-order the custom rule. + settingRuleEl.addExtraButton((btn) => { + const isLastOrder = currentOrder === this.plugin.getSettings().rules.length - 1; + btn.setDisabled(isLastOrder); + btn.extraSettingsEl.style.cursor = isLastOrder + ? 'not-allowed' + : 'default'; + btn.extraSettingsEl.style.opacity = isLastOrder ? '50%' : '100%'; + btn.setIcon('arrow-down'); + btn.setTooltip('Deprioritize the custom rule'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + yield orderCustomRules(1); + })); + }); + // Add the edit custom rule button. + settingRuleEl.addButton((btn) => { + btn.setIcon('pencil'); + btn.setTooltip('Edit the custom rule'); + btn.onClick(() => { + var _a, _b; + // Create modal and its children elements. + const modal = new obsidian.Modal(this.plugin.app); + modal.contentEl.style.display = 'block'; + modal.modalEl.classList.add('iconize-custom-modal'); + modal.titleEl.setText('Edit custom rule'); + // Create the input for the rule. + this.createDescriptionEl(modal.contentEl, 'Regex or simple string'); + const input = new obsidian.TextComponent(modal.contentEl); + input.setValue(rule.rule); + input.onChange((value) => __awaiter(this, void 0, void 0, function* () { + rule.rule = value; + })); + const useFilePathContainer = modal.contentEl.createDiv(); + useFilePathContainer.style.display = 'flex'; + useFilePathContainer.style.alignItems = 'center'; + useFilePathContainer.style.justifyContent = 'space-between'; + useFilePathContainer.style.marginTop = 'var(--size-4-5)'; + const useFilePathDescription = useFilePathContainer.createEl('p', { + text: 'Include folders and files that are part of the path.', + cls: 'setting-item-description', + }); + useFilePathDescription.style.margin = '0'; + useFilePathDescription.style.marginBottom = 'var(--size-2-2)'; + new obsidian.ToggleComponent(useFilePathContainer) + .setValue(rule.useFilePath === true) + .onChange((value) => { + rule.useFilePath = value; + }); + // Create the toggle for changing the rule type. + const ruleTypeContainer = modal.contentEl.createDiv(); + ruleTypeContainer.style.display = 'flex'; + ruleTypeContainer.style.alignItems = 'center'; + ruleTypeContainer.style.justifyContent = 'space-between'; + ruleTypeContainer.style.marginTop = 'var(--size-4-5)'; + const ruleTypeDescription = ruleTypeContainer.createEl('p', { + text: 'Where the custom rule gets applied to.', + cls: 'setting-item-description', + }); + ruleTypeDescription.style.margin = '0'; + ruleTypeDescription.style.marginBottom = 'var(--size-2-2)'; + const ruleTypeButton = new obsidian.ButtonComponent(ruleTypeContainer); + const setButtonContent = (isFor) => { + if (isFor === 'folders') { + ruleTypeButton.setIcon('folder'); + } + else if (isFor === 'files') { + ruleTypeButton.setIcon('document'); + } + else { + ruleTypeButton.setIcon('documents'); + } + ruleTypeButton.setTooltip(`Icon applicable to: ${isFor}`); + }; + setButtonContent((_a = rule.for) !== null && _a !== void 0 ? _a : 'everything'); + ruleTypeButton.onClick(() => __awaiter(this, void 0, void 0, function* () { + var _a; + const isFor = (_a = rule.for) !== null && _a !== void 0 ? _a : 'everything'; + this.updateIconTabs(rule, true); + yield customRule.removeFromAllFiles(this.plugin, Object.assign(Object.assign({}, rule), { for: isFor })); + if (isFor === 'folders') { + rule.for = 'everything'; + } + else if (isFor === 'files') { + rule.for = 'folders'; + } + else { + rule.for = 'files'; + } + setButtonContent(rule.for); + })); + // Create the change icon button with icon preview. + this.createDescriptionEl(modal.contentEl, 'Custom rule icon'); + const iconContainer = modal.contentEl.createDiv(); + iconContainer.style.display = 'flex'; + iconContainer.style.alignItems = 'center'; + iconContainer.style.justifyContent = 'space-between'; + const iconEl = iconContainer.createDiv(); + const iconPreviewEl = iconEl.createDiv(); + dom.setIconForNode(this.plugin, rule.icon, iconPreviewEl); + iconEl.style.display = 'flex'; + iconEl.style.alignItems = 'center'; + iconEl.style.justifyContent = 'space-between'; + iconEl.style.margin = null; + iconPreviewEl.innerHTML = svg.setFontSize(iconPreviewEl.innerHTML, 20); + const iconNameEl = iconEl.createEl('div', { + cls: 'setting-item-description', + }); + iconNameEl.style.paddingTop = '0'; + iconNameEl.style.marginLeft = 'var(--size-2-2)'; + iconNameEl.innerText = rule.icon; + const changeIconBtn = new obsidian.ButtonComponent(iconContainer); + changeIconBtn.setButtonText('Change icon'); + changeIconBtn.onClick(() => __awaiter(this, void 0, void 0, function* () { + const modal = new IconsPickerModal(this.app, this.plugin, rule.icon); + modal.onChooseItem = (item) => __awaiter(this, void 0, void 0, function* () { + const icon = typeof item === 'object' ? item.displayName : item; + rule.icon = icon; + dom.setIconForNode(this.plugin, rule.icon, iconPreviewEl); + iconPreviewEl.innerHTML = svg.setFontSize(iconPreviewEl.innerHTML, 20); + iconNameEl.innerText = getNormalizedName(rule.icon); + }); + modal.open(); + })); + // Create the color picker for the rule. + this.createDescriptionEl(modal.contentEl, 'Color of the icon'); + const colorContainer = modal.contentEl.createDiv(); + colorContainer.style.display = 'flex'; + colorContainer.style.alignItems = 'center'; + colorContainer.style.justifyContent = 'space-between'; + const colorPicker = new obsidian.ColorComponent(colorContainer) + .setValue((_b = rule.color) !== null && _b !== void 0 ? _b : '#000000') + .onChange((value) => { + rule.color = value; + }); + const defaultColorButton = new obsidian.ButtonComponent(colorContainer); + defaultColorButton.setTooltip('Set color to the default one'); + defaultColorButton.setButtonText('Default'); + defaultColorButton.onClick(() => { + colorPicker.setValue('#000000'); + rule.color = undefined; + }); + // Create the save button. + const button = new obsidian.ButtonComponent(modal.contentEl); + button.buttonEl.style.marginTop = 'var(--size-4-4)'; + button.buttonEl.style.float = 'right'; + button.setButtonText('Save Changes'); + button.onClick(() => __awaiter(this, void 0, void 0, function* () { + if (!emoji.isEmoji(oldRule.icon)) { + // Tries to remove the previously used icon from the icon pack. + removeIconFromIconPack(this.plugin, oldRule.icon); + } + if (!emoji.isEmoji(rule.icon)) { + // Tries to add the newly used icon to the icon pack. + saveIconToIconPack(this.plugin, rule.icon); + rule.icon = getNormalizedName(rule.icon); + } + this.refreshDisplay(); + new obsidian.Notice('Custom rule updated.'); + // Refresh the DOM. + yield customRule.removeFromAllFiles(this.plugin, oldRule); + this.updateIconTabs(rule, true); + this.plugin.getSettings().rules.forEach((rule) => __awaiter(this, void 0, void 0, function* () { + yield customRule.addToAllFiles(this.plugin, rule); + this.updateIconTabs(rule, false); + })); + yield this.plugin.saveIconFolderData(); + modal.close(); + })); + modal.open(); + }); + }); + // Add the delete custom rule button. + settingRuleEl.addButton((btn) => { + btn.setIcon('trash'); + btn.setTooltip('Remove the custom rule'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + const newRules = this.plugin + .getSettings() + .rules.filter((r) => rule.rule !== r.rule || + rule.color !== r.color || + rule.icon !== r.icon || + rule.for !== r.for); + this.plugin.getSettings().rules = newRules; + yield this.plugin.saveIconFolderData(); + this.refreshDisplay(); + new obsidian.Notice('Custom rule deleted.'); + yield customRule.removeFromAllFiles(this.plugin, rule); + removeIconFromIconPack(this.plugin, rule.icon); + this.updateIconTabs(rule, true); + const previousRules = this.plugin + .getSettings() + .rules.filter((r) => rule.for === r.for); + previousRules.forEach((previousRule) => __awaiter(this, void 0, void 0, function* () { + yield customRule.addToAllFiles(this.plugin, previousRule); + this.updateIconTabs(previousRule, false); + })); + })); + }); + }); + } +} + +const getTitleIcon = (leaf) => { + return leaf.querySelector(`.${config.TITLE_ICON_CLASS}`); +}; +const add = (plugin, inlineTitleEl, svgElement, options) => { + var _a; + if (!inlineTitleEl.parentElement) { + return; + } + if (options === null || options === void 0 ? void 0 : options.fontSize) { + svgElement = svg.setFontSize(svgElement, options.fontSize); + } + let titleIcon = getTitleIcon(inlineTitleEl.parentElement); + if (!titleIcon) { + titleIcon = document.createElement('div'); + } + const isInline = plugin.getSettings().iconInTitlePosition === IconInTitlePosition.Inline; + if (isInline) { + titleIcon.style.display = 'inline-block'; + titleIcon.style.removeProperty('margin-inline'); + titleIcon.style.removeProperty('width'); + } + else { + titleIcon.style.display = 'block'; + titleIcon.style.width = 'var(--line-width)'; + titleIcon.style.marginInline = '0'; + } + titleIcon.classList.add(config.TITLE_ICON_CLASS); + // Checks if the passed element is an emoji. + if (emoji.isEmoji(svgElement) && options.fontSize) { + svgElement = + (_a = emoji.parseEmoji(plugin.getSettings().emojiStyle, svgElement, options.fontSize)) !== null && _a !== void 0 ? _a : svgElement; + titleIcon.style.fontSize = `${options.fontSize}px`; + } + titleIcon.innerHTML = svgElement; + let wrapperElement = inlineTitleEl.parentElement; + // Checks the parent and selects the correct wrapper element. + // This should only happen in the beginning. + if (wrapperElement && + !wrapperElement.classList.contains(config.INLINE_TITLE_WRAPPER_CLASS)) { + wrapperElement = wrapperElement.querySelector(`.${config.INLINE_TITLE_WRAPPER_CLASS}`); + } + // Whenever there is no correct wrapper element, we create one. + if (!wrapperElement) { + wrapperElement = inlineTitleEl.parentElement.createDiv(); + wrapperElement.classList.add(config.INLINE_TITLE_WRAPPER_CLASS); + } + // Avoiding adding the same nodes together when changing the title. + if (wrapperElement !== inlineTitleEl.parentElement) { + inlineTitleEl.parentElement.prepend(wrapperElement); + } + if (isInline) { + wrapperElement.style.display = 'flex'; + wrapperElement.style.alignItems = 'flex-start'; + const inlineTitlePaddingTop = getComputedStyle(inlineTitleEl, null).getPropertyValue('padding-top'); + titleIcon.style.paddingTop = inlineTitlePaddingTop; + if (emoji.isEmoji(svgElement)) { + titleIcon.style.transform = 'translateY(-9%)'; + } + else { + titleIcon.style.transform = 'translateY(9%)'; + } + } + else { + wrapperElement.style.display = 'block'; + titleIcon.style.transform = 'translateY(9%)'; + } + wrapperElement.append(titleIcon); + wrapperElement.append(inlineTitleEl); +}; +const updateStyle = (inlineTitleEl, options) => { + if (!inlineTitleEl.parentElement) { + return; + } + const titleIcon = getTitleIcon(inlineTitleEl.parentElement); + if (!titleIcon) { + return; + } + if (options.fontSize) { + if (!emoji.isEmoji(titleIcon.innerHTML)) { + titleIcon.innerHTML = svg.setFontSize(titleIcon.innerHTML, options.fontSize); + } + else { + titleIcon.style.fontSize = `${options.fontSize}px`; + } + } +}; +/** + * Hides the title icon from the provided HTMLElement. + * @param contentEl HTMLElement to hide the title icon from. + */ +const hide = (inlineTitleEl) => { + if (!inlineTitleEl.parentElement) { + return; + } + const titleIconContainer = getTitleIcon(inlineTitleEl.parentElement); + if (!titleIconContainer) { + return; + } + titleIconContainer.style.display = 'none'; +}; +const remove = (inlineTitleEl) => { + if (!inlineTitleEl.parentElement) { + return; + } + const titleIconContainer = getTitleIcon(inlineTitleEl.parentElement); + if (!titleIconContainer) { + return; + } + titleIconContainer.remove(); +}; +var titleIcon = { + add, + updateStyle, + hide, + remove, +}; + +// Cache for font size +let cachedFontSize = null; +let fontSizeCacheTime = 0; +const calculateFontTextSize = () => { + var _a; + // get cached font size if available + const now = Date.now(); + if (cachedFontSize !== null && now - fontSizeCacheTime < 2000) { + return cachedFontSize; + } + let fontSize = parseFloat((_a = getComputedStyle(document.body).getPropertyValue('--font-text-size')) !== null && _a !== void 0 ? _a : '0'); + if (!fontSize) { + fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize); + } + // set font size cache + cachedFontSize = fontSize; + fontSizeCacheTime = now; + return fontSize; +}; +const calculateInlineTitleSize = () => { + const fontSize = calculateFontTextSize(); + const inlineTitleSizeValue = getComputedStyle(document.body).getPropertyValue('--inline-title-size'); + const unit = inlineTitleSizeValue.replace(/[\d.]/g, ''); + let inlineTitleSize = parseFloat(inlineTitleSizeValue); + if (unit === 'px') { + inlineTitleSize /= 16; + } + return fontSize * inlineTitleSize; +}; +const isHeader = (value) => { + return /^h[1-6]$/.test(value); +}; +const getHTMLHeaderByToken = (header) => { + for (let i = 1; i <= 6; i++) { + if (header === `header-${i}`) { + return `h${i}`; + } + } + return null; +}; +const calculateHeaderSize = (header) => { + var _a; + const fontSize = calculateFontTextSize(); + const htmlHeader = (_a = getHTMLHeaderByToken(header)) !== null && _a !== void 0 ? _a : header; + const headerComputedStyle = getComputedStyle(document.body).getPropertyValue(`--${htmlHeader}-size`); + let headerSize = parseFloat(headerComputedStyle); + if (isPx(headerComputedStyle)) { + headerSize = pxToRem(headerSize, fontSize); + } + // If there is some `calc` operation going on, it has to be evaluated. + if (headerComputedStyle.includes('calc')) { + const temp = document.createElement('div'); + temp.style.setProperty('font-size', `var(--${htmlHeader}-size)`); + document.body.appendChild(temp); + const computedStyle = window.getComputedStyle(temp); + const computedValue = computedStyle.getPropertyValue('font-size'); + headerSize = parseFloat(computedValue); + if (isPx(computedValue)) { + headerSize = pxToRem(headerSize, fontSize); + } + document.body.removeChild(temp); + } + return fontSize * headerSize; +}; +const pxToRem = (px, baseSize = 16) => { + return px / baseSize; +}; +const isPx = (value) => { + return /^-?\d+(\.\d+)?px$/.test(value); +}; + +class EmojiStyleSetting extends IconFolderSetting { + display() { + const emojiStyle = new obsidian.Setting(this.containerEl) + .setName('Emoji style') + .setDesc('Change the style of your emojis.'); + emojiStyle.addDropdown((dropdown) => { + dropdown.addOption('native', 'Native'); + dropdown.addOption('twemoji', 'Twemoji'); + dropdown.setValue(this.plugin.getSettings().emojiStyle); + dropdown.onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().emojiStyle = value; + this.updateDOM(); + yield this.plugin.saveIconFolderData(); + })); + }); + } + updateDOM() { + for (const fileExplorer of this.plugin.getRegisteredFileExplorers()) { + const fileItems = Object.entries(fileExplorer.fileItems || {}); + for (const [path, _] of fileItems) { + let iconName = this.plugin.getData()[path]; + if (!iconName) { + continue; + } + const data = this.plugin.getData()[path]; + if (typeof data === 'object') { + const data = this.plugin.getData()[path]; + if (data.iconName) { + iconName = data.iconName; + } + } + if (emoji.isEmoji(iconName)) { + dom.createIconNode(this.plugin, path, iconName); + if (this.plugin.getSettings().iconInTabsEnabled) { + const tabLeaves = iconTabs.getTabLeavesOfFilePath(this.plugin, path); + for (const tabLeaf of tabLeaves) { + iconTabs.update(this.plugin, iconName, tabLeaf.tabHeaderInnerIconEl); + } + } + if (this.plugin.getSettings().iconInTitleEnabled) { + for (const openedFile of getAllOpenedFiles(this.plugin)) { + const activeView = openedFile.leaf.view; + if (activeView instanceof obsidian.MarkdownView && + openedFile.path === path) { + titleIcon.add(this.plugin, activeView.inlineTitleEl, iconName, { + fontSize: calculateInlineTitleSize(), + }); + } + } + } + } + } + } + for (const rule of customRule.getSortedRules(this.plugin)) { + customRule.addToAllFiles(this.plugin, rule); + } + } +} + +/** + * Helper function that refreshes the style of all the icons that are defined + * or in a custom rule involved. + * @param plugin Instance of the IconizePlugin. + */ +const refreshStyleOfIcons = (plugin) => __awaiter(void 0, void 0, void 0, function* () { + // Refreshes the icon style for all normally added icons. + style.refreshIconNodes(plugin); + // Refreshes the icon style for all custom icon rules, when the color of the rule is + // not defined. + for (const rule of customRule.getSortedRules(plugin)) { + const fileItems = yield customRule.getFileItems(plugin, rule); + for (const fileItem of fileItems) { + const titleEl = getFileItemTitleEl(fileItem); + const iconNode = titleEl.querySelector('.iconize-icon'); + let iconContent = iconNode.innerHTML; + iconContent = style.applyAll(plugin, iconContent, iconNode); + if (rule.color) { + iconContent = svg.colorize(iconContent, rule.color); + iconNode.style.color = rule.color; + } + iconNode.innerHTML = iconContent; + } + } +}); +var helper = { + refreshStyleOfIcons, +}; + +class ExtraMarginSetting extends IconFolderSetting { + display() { + var _a, _b; + const extraMarginSetting = new obsidian.Setting(this.containerEl) + .setName('Extra margin (in pixels)') + .setDesc('Change the margin of the icons.') + .setClass('iconize-setting'); + const extraMarginDropdown = new obsidian.DropdownComponent(extraMarginSetting.controlEl).addOptions({ + top: 'Top', + right: 'Right', + bottom: 'Bottom', + left: 'Left', + }); + const extraMarginSlider = new obsidian.SliderComponent(extraMarginSetting.controlEl) + .setLimits(-24, 24, 1) + .setDynamicTooltip() + .setValue((_b = (_a = this.plugin.getSettings().extraMargin) === null || _a === void 0 ? void 0 : _a.top) !== null && _b !== void 0 ? _b : 2) + .onChange((val) => __awaiter(this, void 0, void 0, function* () { + const dropdownValue = extraMarginDropdown.getValue(); + if (this.plugin.getSettings().extraMargin) { + this.plugin.getSettings().extraMargin[dropdownValue] = val; + } + else { + this.plugin.getSettings().extraMargin = { + [dropdownValue]: val, + }; + } + yield this.plugin.saveIconFolderData(); + helper.refreshStyleOfIcons(this.plugin); + })); + extraMarginDropdown.onChange((val) => { + var _a; + if (this.plugin.getSettings().extraMargin) { + extraMarginSlider.setValue((_a = this.plugin.getSettings().extraMargin[val]) !== null && _a !== void 0 ? _a : 2); + } + else { + extraMarginSlider.setValue(2); + } + }); + extraMarginSetting.components.push(extraMarginDropdown, extraMarginSlider); + } +} + +class ResetButtonComponent extends obsidian.ButtonComponent { + constructor(contentEl) { + super(contentEl); + this.contentEl = contentEl; + this.setTooltip('Restore default'); + this.setIcon('rotate-ccw'); + this.render(); + } + render() { + this.buttonEl.classList.add('clickable-icon'); + this.buttonEl.classList.add('extra-setting-button'); + } +} + +const DEFAULT_VALUE = DEFAULT_SETTINGS.iconColor; +class IconColorSetting extends IconFolderSetting { + display() { + var _a; + const setting = new obsidian.Setting(this.containerEl) + .setName('Icon color') + .setDesc('Change the color of the displayed icons.'); + new ResetButtonComponent(setting.controlEl).onClick(() => __awaiter(this, void 0, void 0, function* () { + colorPicker.setValue(DEFAULT_VALUE); + this.plugin.getSettings().iconColor = null; + // Custom saving to not save the color black in the data. + yield this.plugin.saveIconFolderData(); + helper.refreshStyleOfIcons(this.plugin); + })); + const colorPicker = new obsidian.ColorComponent(setting.controlEl) + .setValue((_a = this.plugin.getSettings().iconColor) !== null && _a !== void 0 ? _a : DEFAULT_VALUE) + .onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().iconColor = value; + yield this.plugin.saveIconFolderData(); + helper.refreshStyleOfIcons(this.plugin); + })); + } +} + +const values = { + min: 10, + max: 64, + default: DEFAULT_SETTINGS.fontSize, + step: 1, +}; +class IconFontSizeSetting extends IconFolderSetting { + display() { + const setting = new obsidian.Setting(this.containerEl) + .setName('Icon font size (in pixels)') + .setDesc('Change the font size of the displayed icons.'); + new ResetButtonComponent(setting.controlEl).onClick(() => { + this.slider.setValue(values.default); + }); + setting.addSlider((slider) => { + var _a; + this.slider = slider; + slider + .setLimits(values.min, values.max, values.step) + .setDynamicTooltip() + .setValue((_a = this.plugin.getSettings().fontSize) !== null && _a !== void 0 ? _a : DEFAULT_SETTINGS.fontSize) + .onChange((val) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().fontSize = val; + yield this.plugin.saveIconFolderData(); + helper.refreshStyleOfIcons(this.plugin); + })); + }); + } +} + +class IconPacksPathSetting extends IconFolderSetting { + display() { + const iconPacksPathSetting = new obsidian.Setting(this.containerEl) + .setName('Icon packs folder path') + .setDesc('Change the default icon packs folder path.'); + iconPacksPathSetting.addText((text) => { + this.iconPacksSettingTextComp = text; + text.setValue(this.plugin.getSettings().iconPacksPath); + }); + iconPacksPathSetting.addButton((btn) => { + btn.setButtonText('Save'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + const newPath = this.iconPacksSettingTextComp.getValue(); + const oldPath = this.plugin.getSettings().iconPacksPath; + if (oldPath === this.iconPacksSettingTextComp.getValue()) { + return; + } + new obsidian.Notice('Saving in progress...'); + setPath(newPath); + yield createDefaultDirectory(this.plugin); + yield moveIconPackDirectories(this.plugin, oldPath, newPath); + this.plugin.getSettings().iconPacksPath = newPath; + yield this.plugin.saveIconFolderData(); + new obsidian.Notice('...saved successfully'); + })); + }); + } +} + +class IconPacksBackgroundChecker extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('Icons background check') + .setDesc('Check in the background on every load of Obsidian, if icons are missing and it will try to add them to the specific icon pack.') + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().iconsBackgroundCheckEnabled) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().iconsBackgroundCheckEnabled = enabled; + yield this.plugin.saveIconFolderData(); + if (enabled) { + new obsidian.Notice('You need to reload Obsidian for this to take effect.', 10000); + } + })); + }); + } +} + +class IconPackBrowserModal extends obsidian.FuzzySuggestModal { + constructor(app, plugin) { + super(app); + this.plugin = plugin; + this.resultContainerEl.classList.add('iconize-browse-modal'); + this.inputEl.placeholder = 'Select to download icon pack'; + } + // eslint-disable-next-line + onAddedIconPack() { } + onOpen() { + super.onOpen(); + } + onClose() { + this.contentEl.empty(); + } + getItemText(item) { + const prefix = createIconPackPrefix(item.name); + return `${item.displayName} (${prefix})`; + } + getItems() { + const predefinedIconPacks = Object.values(iconPacks$1); + const allIconPacks = getAllIconPacks(); + return predefinedIconPacks.filter((iconPack) => allIconPacks.find((ip) => iconPack.name === ip.name) === undefined); + } + onChooseItem(item, _event) { + return __awaiter(this, void 0, void 0, function* () { + new obsidian.Notice(`Adding ${item.displayName}...`); + const arrayBuffer = yield downloadZipFile(item.downloadLink); + yield createZipFile(this.plugin, `${item.name}.zip`, arrayBuffer); + yield registerIconPack(item.name, arrayBuffer); + new obsidian.Notice(`...${item.displayName} added`); + this.onAddedIconPack(); + }); + } + renderSuggestion(item, el) { + super.renderSuggestion(item, el); + el.innerHTML = `
${el.innerHTML}
`; + } +} + +class PredefinedIconPacksSetting extends IconFolderSetting { + constructor(plugin, containerEl, app, refreshDisplay) { + super(plugin, containerEl); + this.app = app; + this.refreshDisplay = refreshDisplay; + } + display() { + new obsidian.Setting(this.containerEl) + .setName('Add predefined icon pack') + .setDesc('Add a predefined icon pack that is officially supported.') + .addButton((btn) => { + btn.setButtonText('Browse icon packs'); + btn.onClick(() => { + const modal = new IconPackBrowserModal(this.app, this.plugin); + modal.onAddedIconPack = () => { + this.refreshDisplay(); + }; + modal.open(); + }); + }); + } +} + +class RecentlyUsedIconsSetting extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('Recently used icons limit') + .setDesc('Change the limit for the recently used icons displayed in the icon selection modal.') + .addSlider((slider) => { + var _a; + slider + .setLimits(1, 25, 1) + .setDynamicTooltip() + .setValue((_a = this.plugin.getSettings().recentlyUsedIconsSize) !== null && _a !== void 0 ? _a : DEFAULT_SETTINGS.recentlyUsedIconsSize) + .onChange((val) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().recentlyUsedIconsSize = val; + yield this.plugin.checkRecentlyUsedIcons(); + yield this.plugin.saveIconFolderData(); + })); + }); + } +} + +class ToggleIconInTabs extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('Toggle icon in tabs') + .setDesc('Toggles the visibility of an icon for a file in the tab bar.') + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().iconInTabsEnabled) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().iconInTabsEnabled = enabled; + yield this.plugin.saveIconFolderData(); + // Updates the already opened files. + this.plugin.app.workspace + .getLeavesOfType('markdown') + .forEach((leaf) => { + const file = leaf.view.file; + if (file) { + const tabHeaderLeaf = leaf; + if (enabled) { + // Adds the icons to already opened files. + iconTabs.add(this.plugin, file.path, tabHeaderLeaf.tabHeaderInnerIconEl); + } + else { + // Removes the icons from already opened files. + iconTabs.remove(tabHeaderLeaf.tabHeaderInnerIconEl); + } + } + }); + })); + }); + } +} + +class ToggleIconInTitle extends IconFolderSetting { + updateLeaves(options) { + this.plugin.app.workspace.getLeavesOfType('markdown').forEach((leaf) => { + const view = leaf.view; + if (view instanceof obsidian.MarkdownView) { + const foundIcon = icon.getIconByPath(this.plugin, view.file.path); + if (foundIcon && options.enabled) { + if (options.removeBeforeReAdd) { + // Remove the icon before re-adding it. This is needed to update the DOM because + // the icon node will be inserted in the beginning inline title node. + titleIcon.remove(view.contentEl); + } + const content = typeof foundIcon === 'string' ? foundIcon : foundIcon.svgElement; + titleIcon.add(this.plugin, view.inlineTitleEl, content, { + fontSize: calculateInlineTitleSize(), + }); + } + else { + titleIcon.remove(view.contentEl); + } + } + }); + } + display() { + new obsidian.Setting(this.containerEl) + .setName('Toggle icon in title') + .setDesc('Toggles the visibility of an icon above the title of a file.') + .addDropdown((dropdown) => { + this.dropdown = dropdown; + dropdown.setDisabled(!this.plugin.getSettings().iconInTitleEnabled); + dropdown.addOptions({ + above: 'Above title', + inline: 'Next to title', + }); + dropdown.setValue(this.plugin.getSettings().iconInTitlePosition); + dropdown.onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().iconInTitlePosition = + value; + yield this.plugin.saveIconFolderData(); + this.updateLeaves({ enabled: true, removeBeforeReAdd: true }); + })); + }) + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().iconInTitleEnabled) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + if (this.dropdown) { + this.dropdown.setDisabled(!enabled); + } + this.plugin.getSettings().iconInTitleEnabled = enabled; + yield this.plugin.saveIconFolderData(); + this.updateLeaves({ enabled }); + })); + }); + } +} + +class FrontmatterOptions extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('Use icon in frontmatter') + .setDesc('Toggles whether to set the icon based on the frontmatter property `icon`.') + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().iconInFrontmatterEnabled) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().iconInFrontmatterEnabled = enabled; + yield this.plugin.saveIconFolderData(); + })); + }); + new obsidian.Setting(this.containerEl) + .setName('Frontmatter icon field name') + .setDesc('Sets the name of the frontmatter field which contains the icon.') + .addText((text) => { + this.iconFieldNameTextComp = text; + text.setValue(this.plugin.getSettings().iconInFrontmatterFieldName); + }) + .addButton((button) => { + button.setButtonText('Save'); + button.onClick(() => __awaiter(this, void 0, void 0, function* () { + const newValue = this.iconFieldNameTextComp.getValue(); + const oldValue = this.plugin.getSettings().iconInFrontmatterFieldName; + if (newValue === oldValue) { + return; + } + this.plugin.getSettings().iconInFrontmatterFieldName = newValue; + yield this.plugin.saveIconFolderData(); + new obsidian.Notice('...saved successfully'); + })); + }); + new obsidian.Setting(this.containerEl) + .setName('Frontmatter icon color field name') + .setDesc('Sets the name of the frontmatter field which contains the icon color.') + .addText((text) => { + this.iconColorFieldNameTextComp = text; + text.setValue(this.plugin.getSettings().iconColorInFrontmatterFieldName); + }) + .addButton((button) => { + button.setButtonText('Save'); + button.onClick(() => __awaiter(this, void 0, void 0, function* () { + const newValue = this.iconColorFieldNameTextComp.getValue(); + const oldValue = this.plugin.getSettings().iconColorInFrontmatterFieldName; + if (newValue === oldValue) { + return; + } + this.plugin.getSettings().iconColorInFrontmatterFieldName = newValue; + yield this.plugin.saveIconFolderData(); + new obsidian.Notice('...saved successfully'); + })); + }); + new obsidian.Setting(this.containerEl) + .setName('Refresh icons from frontmatter') + .setDesc('Sets the icon and color for each note in the vault based on the frontmatter properties. WARNING: This will change any manually set icons to the one defined in the frontmatter. IF A NOTE HAS NO FRONTMATTER, THE CURRENT ICON WILL BE REMOVED. Please restart Obsidian after this completes to see the changes.') + .addButton((btn) => { + btn.setButtonText('Refresh').onClick(() => __awaiter(this, void 0, void 0, function* () { + var _a, _b; + if (!this.plugin.getSettings().iconInFrontmatterEnabled) { + new obsidian.Notice(`[${config.PLUGIN_NAME}] Please enable "Use icon in frontmatter".`); + return; + } + new obsidian.Notice(`[${config.PLUGIN_NAME}] Refreshing icons from frontmatter, please wait...`); + const files = this.plugin.app.vault.getMarkdownFiles(); + for (const file of files) { + const fileCache = this.plugin.app.metadataCache.getFileCache(file); + const frontmatterIconKey = this.plugin.getSettings().iconInFrontmatterFieldName; + const frontmatterIconColorKey = this.plugin.getSettings().iconColorInFrontmatterFieldName; + const iconName = (_a = fileCache.frontmatter) === null || _a === void 0 ? void 0 : _a[frontmatterIconKey]; + let iconColor = (_b = fileCache.frontmatter) === null || _b === void 0 ? void 0 : _b[frontmatterIconColorKey]; + if (!iconName) { + yield this.plugin.removeFolderIcon(file.path); + continue; + } + if (typeof iconName !== 'string') { + const message = `${file.path}\nFrontmatter property type \`${frontmatterIconKey}\` has to be of type \`text\`.`; + logger.warn(message); + new obsidian.Notice(`[${config.PLUGIN_NAME}]\n${message}`); + continue; + } + this.plugin.addFolderIcon(file.path, iconName); + if (!iconColor) { + yield this.plugin.removeIconColor(file.path); + continue; + } + if (typeof iconColor !== 'string') { + const message = `${file.path}\nFrontmatter property type \`${frontmatterIconColorKey}\` has to be of type \`text\`.`; + logger.warn(message); + new obsidian.Notice(`[${config.PLUGIN_NAME}]\n${message}`); + continue; + } + iconColor = isHexadecimal(iconColor) + ? stringToHex(iconColor) + : iconColor; + this.plugin.addIconColor(file.path, iconColor); + } + new obsidian.Notice(`[${config.PLUGIN_NAME}] Refreshed icons from frontmatter. Please restart Obsidian to see the changes.`); + })); + }); + } +} + +class ToggleIconsInEditor extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('Toggle icons while editing notes') + .setDesc('Toggles whether you are able to add and see icons in your notes and editor (e.g., ability to have :LiSofa: as an icon in your notes).') + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().iconsInNotesEnabled) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().iconsInNotesEnabled = enabled; + yield this.plugin.saveIconFolderData(); + new obsidian.Notice(`[${config.PLUGIN_NAME}] Obsidian has to be restarted for this change to take effect.`); + })); + }); + } +} + +class ToggleIconsInLinks extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('Toggle icons in links') + .setDesc('Toggles whether you are able to see icons in the links to other notes') + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().iconsInLinksEnabled) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().iconsInLinksEnabled = enabled; + yield this.plugin.saveIconFolderData(); + new obsidian.Notice(`[${config.PLUGIN_NAME}] Obsidian has to be restarted for this change to take effect.`); + })); + }); + } +} + +class IconIdentifierSetting extends IconFolderSetting { + display() { + const setting = new obsidian.Setting(this.containerEl) + .setName('Icon identifier') + .setDesc('Change the icon identifier used in notes.') + .setClass('iconize-setting'); + setting.addText((text) => { + this.textComp = text; + text.setValue(this.plugin.getSettings().iconIdentifier); + }); + setting.addButton((btn) => { + btn.setButtonText('Save'); + btn.onClick(() => __awaiter(this, void 0, void 0, function* () { + const newIdentifier = this.textComp.getValue(); + const oldIdentifier = this.plugin.getSettings().iconIdentifier; + if (newIdentifier === oldIdentifier) { + return; + } + this.plugin.getSettings().iconIdentifier = newIdentifier; + yield this.plugin.saveIconFolderData(); + new obsidian.Notice('...saved successfully'); + })); + }); + } +} + +class DebugMode extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('Toggle Debug Mode') + .setDesc('Toggle debug mode to see more detailed logs in the console. Do not touch this unless you know what you are doing.') + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().debugMode) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().debugMode = enabled; + yield this.plugin.saveIconFolderData(); + })); + }); + } +} + +class UseInternalPlugins extends IconFolderSetting { + display() { + new obsidian.Setting(this.containerEl) + .setName('EXPERIMENTAL: Use internal plugins') + .setDesc('Toggles whether to try to add icons to the bookmark and outline internal plugins.') + .addToggle((toggle) => { + toggle + .setValue(this.plugin.getSettings().useInternalPlugins) + .onChange((enabled) => __awaiter(this, void 0, void 0, function* () { + this.plugin.getSettings().useInternalPlugins = enabled; + yield this.plugin.saveIconFolderData(); + new obsidian.Notice(`[${config.PLUGIN_NAME}] Obsidian has to be restarted for this change to take effect.`); + })); + }); + } +} + +class IconFolderSettings extends obsidian.PluginSettingTab { + constructor(app, plugin) { + super(app, plugin); + this.plugin = plugin; + } + display() { + const { plugin, containerEl, app } = this; + containerEl.empty(); + containerEl.createEl('h1', { text: 'General' }); + new RecentlyUsedIconsSetting(plugin, containerEl).display(); + new IconPacksPathSetting(plugin, containerEl).display(); + new IconPacksBackgroundChecker(plugin, containerEl).display(); + new EmojiStyleSetting(plugin, containerEl).display(); + new IconIdentifierSetting(plugin, containerEl).display(); + new UseInternalPlugins(plugin, containerEl).display(); + new DebugMode(plugin, containerEl).display(); + containerEl.createEl('h3', { text: 'Visibility of icons' }); + new ToggleIconInTabs(plugin, containerEl).display(); + new ToggleIconInTitle(plugin, containerEl).display(); + new FrontmatterOptions(plugin, containerEl).display(); + new ToggleIconsInEditor(plugin, containerEl).display(); + new ToggleIconsInLinks(plugin, containerEl).display(); + containerEl.createEl('h1', { + text: 'Icon customization for files/folders', + }); + new IconFontSizeSetting(plugin, containerEl).display(); + new IconColorSetting(plugin, containerEl).display(); + new ExtraMarginSetting(plugin, containerEl).display(); + containerEl.createEl('h1', { text: 'Custom icon rules' }); + new CustomIconRuleSetting(plugin, containerEl, app, () => this.display()).display(); + containerEl.createEl('h1', { text: 'Icon packs' }); + new PredefinedIconPacksSetting(plugin, containerEl, app, () => this.display()).display(); + new CustomIconPackSetting(plugin, containerEl, () => this.display()).display(); + } +} + +function around(obj, factories) { + const removers = Object.keys(factories).map(key => around1(obj, key, factories[key])); + return removers.length === 1 ? removers[0] : function () { removers.forEach(r => r()); }; +} +function around1(obj, method, createWrapper) { + const original = obj[method], hadOwn = obj.hasOwnProperty(method); + let current = createWrapper(original); + // Let our wrapper inherit static props from the wrapping method, + // and the wrapping method, props from the original method + if (original) + Object.setPrototypeOf(current, original); + Object.setPrototypeOf(wrapper, current); + obj[method] = wrapper; + // Return a callback to allow safe removal + return remove; + function wrapper(...args) { + // If we have been deactivated and are no longer wrapped, remove ourselves + if (current === original && obj[method] === wrapper) + remove(); + return current.apply(this, args); + } + function remove() { + // If no other patches, just do a direct removal + if (obj[method] === wrapper) { + if (hadOwn) + obj[method] = original; + else + delete obj[method]; + } + if (current === original) + return; + // Else pass future calls through, and remove wrapper from the prototype chain + current = original; + Object.setPrototypeOf(wrapper, original || Function); + } +} + +class InternalPluginInjector { + constructor(plugin) { + this.plugin = plugin; + } + get fileExplorers() { + return this.plugin.app.workspace.getLeavesOfType('file-explorer'); + } + onMount() { } +} + +/** + * @deprecated After obsidian 1.2.6 in favor of the bookmarks plugin. + */ +class StarredInternalPlugin extends InternalPluginInjector { + constructor(plugin) { + super(plugin); + } + get starred() { + return this.plugin.app.internalPlugins.getPluginById('starred'); + } + get enabled() { + return this.plugin.app.internalPlugins.getPluginById('starred').enabled; + } + get leaf() { + const leaf = this.plugin.app.workspace.getLeavesOfType('starred'); + if (!leaf) { + return undefined; + } + if (leaf.length === 1) { + return leaf[0].view; + } + return undefined; + } + setIcon(filePath, node) { + const iconName = icon.getByPath(this.plugin, filePath); + const iconNode = node.querySelector('.nav-file-icon'); + if (!iconNode || !iconName) { + return; + } + dom.setIconForNode(this.plugin, iconName, iconNode); + } + computeNodesWithPath(callback) { + const { itemLookup, containerEl } = this.leaf; + const navFileEls = containerEl.querySelectorAll('.nav-file'); + navFileEls.forEach((navFileEl) => { + const lookupFile = itemLookup.get(navFileEl); + if (!lookupFile) { + return; + } + callback(navFileEl, lookupFile.path); + }); + } + onMount() { + const nodesWithPath = {}; + this.computeNodesWithPath((node, filePath) => { + nodesWithPath[filePath] = node; + }); + Object.entries(nodesWithPath).forEach(([filePath, node]) => this.setIcon(filePath, node)); + } + register() { + if (!this.plugin.app.internalPlugins.getPluginById('file-explorer').enabled) { + console.info(`[${config.PLUGIN_NAME}/Starred] Skipping starred internal plugin registration because file-explorer is not enabled.`); + return; + } + if (!this.enabled) { + console.info(`[${config.PLUGIN_NAME}/Starred] Skipping starred internal plugin registration because it's not enabled.`); + return; + } + // eslint-disable-next-line + const self = this; + this.plugin.register(around(this.starred.instance, { + addItem: function (next) { + return function (file) { + next.call(this, file); + self.onMount(); + }; + }, + removeItem: function (next) { + return function (file) { + next.call(this, file); + self.onMount(); + }; + }, + })); + } +} + +class BookmarkInternalPlugin extends InternalPluginInjector { + constructor(plugin) { + super(plugin); + } + get bookmark() { + return this.plugin.app.internalPlugins.getPluginById('bookmarks'); + } + get enabled() { + return this.plugin.app.internalPlugins.getPluginById('bookmarks').enabled; + } + get leaf() { + const leaf = this.plugin.app.workspace.getLeavesOfType('bookmarks'); + if (!leaf) { + return undefined; + } + if (leaf.length === 1) { + return leaf[0]; + } + return undefined; + } + setIconOrRemove(filePath, node) { + var _a; + const iconName = icon.getByPath(this.plugin, filePath); + let iconNode = node.querySelector('.tree-item-icon'); + if (!iconName) { + if (iconNode) { + // Reset the icon to the default obsidian icon. + const items = this.bookmark.instance.items; + const item = items.find((item) => item.path === filePath); + if ((item === null || item === void 0 ? void 0 : item.type) === 'file') { + iconNode.innerHTML = DEFAULT_FILE_ICON; + } + else if ((item === null || item === void 0 ? void 0 : item.type) === 'folder') { + iconNode.innerHTML = DEFAULT_FOLDER_ICON; + } + } + return; + } + // If the icon node is not defined, then we need to recreate it. + if (!iconNode) { + // Get the tree-item-self element where the original icon is set. + const treeItemSelf = node.querySelector('.tree-item-self'); + if (!treeItemSelf) { + return; + } + iconNode = node.createDiv({ cls: 'tree-item-icon' }); + // Prepends the icon to the tree-item-self element as a first child. + treeItemSelf.prepend(iconNode); + } + const defaultMargin = iconNode.style.margin; + const iconColor = (_a = this.plugin.getIconColor(filePath)) !== null && _a !== void 0 ? _a : this.plugin.getSettings().iconColor; + dom.setIconForNode(this.plugin, iconName, iconNode, { color: iconColor }); + // Reset the margin to the default value to prevent overlapping with the text. + iconNode.style.margin = defaultMargin; + } + computeNodesWithPath(callback) { + if (!this.leaf || !this.leaf.view) { + return; + } + /** + * Retrieves the lookup item from the bookmark plugin and calls the callback with the + * element and the path of the item. + * @param item BookmarkItem object which can be a folder or a file. + * @param itemDoms WeakMap of the bookmark plugin which contains the lookup item. + */ + const retrieveLookupItem = (item, itemDoms) => { + const lookupItem = itemDoms.get(item); + if (!lookupItem) { + return; + } + if (item.items) { + // If the item is a folder, then we need to retrieve all the items inside it. + for (const subItem of item.items) { + retrieveLookupItem(subItem, itemDoms); + } + } + // If the item is a `file` or a `folder` (not of type `group`), then we can call the callback. + if (item.type === 'file' || item.type === 'folder') { + callback(lookupItem.el, item.path); + } + }; + const { itemDoms } = this.leaf.view; + // Retrieves all the items of the bookmark plugin which areo objects. + const items = this.bookmark.instance.items; + items.forEach((item) => { + retrieveLookupItem(item, itemDoms); + }); + } + onMount() { + var _a; + const setBookmarkIcon = () => { + const nodesWithPath = {}; + this.computeNodesWithPath((node, filePath) => { + nodesWithPath[filePath] = node; + }); + Object.entries(nodesWithPath).forEach(([filePath, node]) => this.setIconOrRemove(filePath, node)); + }; + if (obsidian.requireApiVersion('1.7.2')) { + // TODO: Might improve the performance here. + (_a = this.leaf) === null || _a === void 0 ? void 0 : _a.loadIfDeferred().then(setBookmarkIcon); + } + else { + setBookmarkIcon(); + } + } + register() { + if (!this.plugin.app.internalPlugins.getPluginById('file-explorer').enabled) { + console.info(`[${config.PLUGIN_NAME}/Bookmarks] Skipping bookmark internal plugin registration because file-explorer is not enabled.`); + return; + } + if (!this.enabled) { + console.info(`[${config.PLUGIN_NAME}/Bookmarks] Skipping bookmark internal plugin registration because it's not enabled.`); + return; + } + // eslint-disable-next-line + const self = this; + this.plugin.register(around(this.bookmark.instance, { + addItem: function (next) { + return function (...args) { + next.call(this, ...args); + // TODO: Remove in the future, I could not think of a better way to do this. + setTimeout(() => { + self.onMount(); + }, 1000); + }; + }, + removeItem: function (next) { + return function (...args) { + next.call(this, ...args); + self.onMount(); + }; + }, + })); + } +} + +// TODO: Optimize the code to reduce the number of iterations and improve the +// performance. +const createIconShortcodeRegex = (plugin) => { + return new RegExp(`(${plugin.getSettings().iconIdentifier})((\\w{1,64}:\\d{17,18})|(\\w{1,64}))(${plugin.getSettings().iconIdentifier})`, 'g'); +}; +const createTreeWalker = (plugin, root) => { + return document.createTreeWalker(root, NodeFilter.SHOW_ALL, { + acceptNode: function (node) { + if (node.nodeName === 'CODE') { + return NodeFilter.FILTER_REJECT; + } + else if (node.nodeName === '#text') { + if (node.nodeValue && + (emoji.getRegex().test(node.nodeValue) || + createIconShortcodeRegex(plugin).test(node.nodeValue))) { + return NodeFilter.FILTER_ACCEPT; + } + else { + return NodeFilter.FILTER_REJECT; + } + } + return NodeFilter.FILTER_SKIP; + }, + }); +}; +const checkForTextNodes = (treeWalker, match, cb) => { + let currentNode = treeWalker.currentNode; + while (currentNode) { + if (currentNode.nodeType === Node.TEXT_NODE) { + const text = currentNode; + const textNodes = [...Array.from(text.parentElement.childNodes)].filter((n) => n instanceof Text); + for (const text of textNodes) { + for (const code of [...text.wholeText.matchAll(match)] + .sort((a, b) => b.index - a.index) + .map((arr) => ({ text: arr[0], index: arr.index }))) { + if (!text.textContent) { + continue; + } + cb(text, code); + } + } + } + currentNode = treeWalker.nextNode(); + } +}; +const processIconInTextMarkdown = (plugin, element) => { + // Ignore if codeblock + const codeElement = element.querySelector('pre > code'); + const callOut = element.querySelector('.callout'); + if (codeElement && !callOut) { + return; + } + const iconTreeWalker = createTreeWalker(plugin, element); + const iconShortcodeRegex = createIconShortcodeRegex(plugin); + const iconIdentifierLength = plugin.getSettings().iconIdentifier.length; + checkForTextNodes(iconTreeWalker, iconShortcodeRegex, (text, code) => { + var _a, _b; + const shortcode = code.text; + const iconName = shortcode.slice(iconIdentifierLength, shortcode.length - iconIdentifierLength); + const iconObject = icon.getIconByName(iconName); + if (iconObject) { + const toReplace = text.splitText(code.index); + const rootSpan = createSpan({ + cls: 'cm-iconize-icon', + attr: { + 'aria-label': iconName, + 'data-icon': iconName, + 'aria-hidden': 'true', + }, + }); + rootSpan.style.display = 'inline-flex'; + rootSpan.style.transform = 'translateY(13%)'; + const parentElement = toReplace.parentElement; + const tagName = (_b = (_a = parentElement === null || parentElement === void 0 ? void 0 : parentElement.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : ''; + let fontSize = calculateFontTextSize(); + if (isHeader(tagName)) { + fontSize = calculateHeaderSize(tagName); + const svgElement = svg.setFontSize(iconObject.svgElement, fontSize); + rootSpan.innerHTML = svgElement; + } + else { + const svgElement = svg.setFontSize(iconObject.svgElement, fontSize); + rootSpan.innerHTML = svgElement; + } + parentElement === null || parentElement === void 0 ? void 0 : parentElement.insertBefore(rootSpan, toReplace); + toReplace.textContent = toReplace.wholeText.substring(code.text.length); + // Set the font size to its parent font size if defined. + // We do this after that to not freeze the insertion while iterating over the tree. + // We are also updating the size after the animation because the styling won't be set + // in the first place. + requestAnimationFrame(() => { + const parentFontSize = parseFloat(getComputedStyle(parentElement).fontSize); + if (!isNaN(parentFontSize)) { + rootSpan.innerHTML = svg.setFontSize(rootSpan.innerHTML, parentFontSize); + } + }); + } + }); + const emojiTreeWalker = createTreeWalker(plugin, element); + checkForTextNodes(emojiTreeWalker, emoji.getRegex(), (text, code) => { + var _a, _b, _c, _d; + if (!emoji.isEmoji(code.text)) { + return; + } + if (plugin.getSettings().emojiStyle === 'twemoji') { + const toReplace = text.splitText(code.index); + const tagName = (_c = (_b = (_a = toReplace.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : ''; + let fontSize = calculateFontTextSize(); + if (isHeader(tagName)) { + fontSize = calculateHeaderSize(tagName); + } + const emojiValue = emoji.parseEmoji(plugin.getSettings().emojiStyle, code.text, fontSize); + if (!emojiValue) { + return; + } + const emojiNode = createSpan(); + emojiNode.innerHTML = emojiValue; + (_d = toReplace.parentElement) === null || _d === void 0 ? void 0 : _d.insertBefore(emojiNode, toReplace); + toReplace.textContent = toReplace.wholeText.substring(code.text.length); + } + }); +}; + +const processIconInLinkMarkdown = (plugin, element, ctx) => { + const linkElements = element.querySelectorAll('a'); + if (!linkElements || linkElements.length === 0) { + return; + } + linkElements.forEach((linkElement) => { + var _a, _b, _c, _d, _e; + // Skip if the link element e.g., is a tag. + if (!linkElement.hasAttribute('data-href')) { + return; + } + const linkHref = linkElement.getAttribute('href'); + if (!linkHref) { + logger.warn('Link element does not have an `href` attribute'); + return; + } + const file = plugin.app.metadataCache.getFirstLinkpathDest(linkHref, ctx.sourcePath); + if (!file) { + logger.warn('Link element does not have a linkpath to a file'); + return; + } + const path = file.path; + const iconValue = icon.getIconByPath(plugin, path); + if (!iconValue) { + return; + } + let fontSize = calculateFontTextSize(); + const tagName = (_c = (_b = (_a = linkElement.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : ''; + if (isHeader(tagName)) { + fontSize = calculateHeaderSize(tagName); + } + const iconName = typeof iconValue === 'string' + ? iconValue + : iconValue.prefix + iconValue.name; + const rootSpan = createSpan({ + cls: 'iconize-icon-in-link', + attr: { + title: iconName, + 'aria-label': iconName, + 'data-icon': iconName, + 'aria-hidden': 'true', + }, + }); + rootSpan.style.color = + (_d = plugin.getIconColor(path)) !== null && _d !== void 0 ? _d : plugin.getSettings().iconColor; + if (emoji.isEmoji(iconName)) { + const parsedEmoji = (_e = emoji.parseEmoji(plugin.getSettings().emojiStyle, iconName, fontSize)) !== null && _e !== void 0 ? _e : iconName; + rootSpan.style.transform = 'translateY(0)'; + rootSpan.innerHTML = parsedEmoji; + } + else { + let svgEl = icon.getIconByName(iconName).svgElement; + svgEl = svg.setFontSize(svgEl, fontSize); + if (svgEl) { + rootSpan.style.transform = 'translateY(20%)'; + rootSpan.innerHTML = svgEl; + } + } + linkElement.prepend(rootSpan); + }); +}; + +const TREE_ITEM_CLASS = 'tree-item-self'; +const TREE_ITEM_INNER = 'tree-item-inner'; +class OutlineInternalPlugin extends InternalPluginInjector { + constructor(plugin) { + super(plugin); + } + onMount() { + // TODO: Might improve the performance here. + } + register() { + if (!this.enabled) { + logger.info('Skipping internal plugin registration because it is not enabled.', LoggerPrefix.Outline); + return; + } + const updateTreeItems = () => { + var _a, _b, _c; + if (!((_b = (_a = this.leaf) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.tree)) { + return; + } + const treeItems = Array.from(this.leaf.view.tree.containerEl.querySelectorAll(`.${TREE_ITEM_CLASS}`)); + for (const treeItem of treeItems) { + const treeItemInner = treeItem.querySelector(`.${TREE_ITEM_INNER}`); + let text = treeItemInner === null || treeItemInner === void 0 ? void 0 : treeItemInner.getText(); + if (!text) { + continue; + } + const iconShortcodeRegex = createIconShortcodeRegex(this.plugin); + const iconIdentifierLength = this.plugin.getSettings().iconIdentifier.length; + let trimmedLength = 0; + for (const code of [...text.matchAll(iconShortcodeRegex)] + .sort((a, b) => a.index - b.index) + .map((arr) => ({ text: arr[0], index: arr.index }))) { + const shortcode = code.text; + const iconName = shortcode.slice(iconIdentifierLength, shortcode.length - iconIdentifierLength); + const iconObject = icon.getIconByName(iconName); + if (iconObject) { + const startIndex = code.index - trimmedLength; + const endIndex = code.index + code.text.length - trimmedLength; + const str = text.substring(0, startIndex) + text.substring(endIndex); + const iconSpan = createSpan({ + cls: 'cm-iconize-icon', + attr: { + 'aria-label': iconName, + 'data-icon': iconName, + 'aria-hidden': 'true', + }, + }); + const fontSize = parseFloat((_c = getComputedStyle(document.body).getPropertyValue('--nav-item-size')) !== null && _c !== void 0 ? _c : '16'); + const svgElement = svg.setFontSize(iconObject.svgElement, fontSize); + iconSpan.style.display = 'inline-flex'; + iconSpan.style.transform = 'translateY(13%)'; + iconSpan.innerHTML = svgElement; + treeItemInner.innerHTML = treeItemInner.innerHTML.replace(shortcode, iconSpan.outerHTML); + text = str; + trimmedLength += code.text.length; + } + } + } + }; + const setOutlineIcons = () => { + this.plugin.getEventEmitter().once('allIconsLoaded', () => { + updateTreeItems(); + const callback = (mutations) => { + mutations.forEach((mutation) => { + if (mutation.type !== 'childList') { + return; + } + const addedNodes = mutation.addedNodes; + if (addedNodes.length === 0) { + return; + } + updateTreeItems(); + }); + if (!this.enabled) { + observer.disconnect(); + } + }; + const observer = new MutationObserver(callback); + observer.observe(this.leaf.view.tree.containerEl, { + childList: true, + subtree: true, + }); + }); + }; + if (obsidian.requireApiVersion('1.7.2')) { + // TODO: Might improve the performance here. + this.leaf.loadIfDeferred().then(setOutlineIcons); + } + else { + setOutlineIcons(); + } + } + get leaf() { + const leaf = this.plugin.app.workspace.getLeavesOfType('outline'); + if (!leaf) { + logger.log('`leaf` in outline is undefined', LoggerPrefix.Outline); + return undefined; + } + if (leaf.length === 0) { + logger.log('`leaf` length in outline is 0', LoggerPrefix.Outline); + return undefined; + } + return leaf[0]; + } + get outline() { + return this.plugin.app.internalPlugins.getPluginById('outline'); + } + get enabled() { + return this.plugin.app.internalPlugins.getPluginById('outline').enabled; + } +} + +class SuggestionIcon extends obsidian.EditorSuggest { + constructor(app, plugin) { + super(app); + this.plugin = plugin; + } + onTrigger(cursor, editor) { + // Isolate shortcode starting position closest to the cursor. + const shortcodeStart = editor + .getLine(cursor.line) + .substring(0, cursor.ch) + .lastIndexOf(this.plugin.getSettings().iconIdentifier); + // `onTrigger` needs to return `null` as soon as possible to save processing performance. + if (shortcodeStart === -1) { + return null; + } + // Regex for checking if the shortcode is not done yet. + const regex = new RegExp(`^(${this.plugin.getSettings().iconIdentifier})\\w+$`, 'g'); + const regexOngoingShortcode = editor + .getLine(cursor.line) + .substring(shortcodeStart, cursor.ch) + .match(regex); + if (regexOngoingShortcode === null) { + return null; + } + const startingIndex = editor + .getLine(cursor.line) + .indexOf(regexOngoingShortcode[0]); + return { + start: { + line: cursor.line, + ch: startingIndex, + }, + end: { + line: cursor.line, + ch: startingIndex + regexOngoingShortcode[0].length, + }, + query: regexOngoingShortcode[0], + }; + } + getSuggestions(context) { + const queryLowerCase = context.query + .substring(this.plugin.getSettings().iconIdentifier.length) + .toLowerCase(); + // Store all icons corresponding to the current query. + const iconsNameArray = getAllLoadedIconNames() + .filter((iconObject) => { + const name = iconObject.prefix.toLowerCase() + iconObject.name.toLowerCase(); + return name.toLowerCase().includes(queryLowerCase); + }) + .map((iconObject) => iconObject.prefix + iconObject.name); + // Store all emojis correspoding to the current query - parsing whitespaces and + // colons for shortcodes compatibility. + const emojisNameArray = Object.keys(emoji.shortNames).filter((e) => { var _a; return (_a = emoji.getShortcode(e)) === null || _a === void 0 ? void 0 : _a.includes(queryLowerCase); }); + return [...iconsNameArray, ...emojisNameArray]; + } + renderSuggestion(value, el) { + const iconObject = icon.getIconByName(value); + el.style.display = 'flex'; + el.style.alignItems = 'center'; + el.style.gap = '0.25rem'; + if (iconObject) { + // Suggest an icon. + el.innerHTML = `${iconObject.svgElement} ${value}`; + } + else { + // Suggest an emoji - display its shortcode version. + const shortcode = emoji.getShortcode(value); + if (shortcode) { + el.innerHTML = `${value} ${shortcode}`; + } + } + } + selectSuggestion(value) { + const isEmoji = emoji.isEmoji(value.replace(/_/g, ' ')); + if (!isEmoji) { + saveIconToIconPack(this.plugin, value); + } + // Replace query with iconNameWithPrefix or emoji unicode directly. + const updatedValue = isEmoji + ? value + : `${this.plugin.getSettings().iconIdentifier}${value}${this.plugin.getSettings().iconIdentifier}`; + this.context.editor.replaceRange(updatedValue, this.context.start, this.context.end); + } +} + +class IconInTextWidget extends view.WidgetType { + constructor(plugin, id) { + super(); + this.plugin = plugin; + this.id = id; + this.start = -1; + this.end = -1; + } + setPosition(start, end) { + this.start = start; + this.end = end; + } + eq(other) { + return other instanceof IconInTextWidget && other.id === this.id; + } + getSize(view) { + let fontSize = calculateFontTextSize(); + const line = view.state.doc.lineAt(this.end); + const headerMatch = line.text.match(/^#{1,6}\s/); + if (headerMatch && headerMatch[0].trim()) { + const mapping = { + '#': 'h1', + '##': 'h2', + '###': 'h3', + '####': 'h4', + '#####': 'h5', + '######': 'h6', + }; + const header = mapping[headerMatch[0].trim()]; + fontSize = calculateHeaderSize(header); + } + return fontSize; + } + toDOM(view) { + const wrap = createSpan({ + cls: 'cm-iconize-icon', + attr: { + 'aria-label': this.id, + 'data-icon': this.id, + 'aria-hidden': 'true', + }, + }); + const foundIcon = icon.getIconByName(this.id); + const fontSize = this.getSize(view); + if (foundIcon) { + const svgElement = svg.setFontSize(foundIcon.svgElement, fontSize); + wrap.style.display = 'inline-flex'; + wrap.style.transform = 'translateY(13%)'; + wrap.innerHTML = svgElement; + } + else if (emoji.isEmoji(this.id)) { + wrap.innerHTML = emoji.parseEmoji(this.plugin.getSettings().emojiStyle, this.id, fontSize); + } + else { + wrap.append(`${this.plugin.getSettings().iconIdentifier}${this.id}${this.plugin.getSettings().iconIdentifier}`); + } + return wrap; + } + ignoreEvent() { + return false; + } +} + +class IconInLinkWidget extends view.WidgetType { + constructor(plugin, iconData, path, headerType) { + super(); + this.plugin = plugin; + this.iconData = iconData; + this.path = path; + this.headerType = headerType; + } + toDOM() { + var _a; + const iconNode = document.createElement('span'); + const iconName = typeof this.iconData === 'string' + ? this.iconData + : this.iconData.prefix + this.iconData.name; + iconNode.style.color = + (_a = this.plugin.getIconColor(this.path)) !== null && _a !== void 0 ? _a : this.plugin.getSettings().iconColor; + iconNode.setAttribute('title', iconName); + iconNode.classList.add('iconize-icon-in-link'); + if (typeof this.iconData === 'string') { + iconNode.style.transform = 'translateY(0)'; + } + let innerHTML = typeof this.iconData === 'string' + ? this.iconData + : this.iconData.svgElement; + let fontSize = calculateFontTextSize(); + if (this.headerType) { + fontSize = calculateHeaderSize(this.headerType); + } + if (emoji.isEmoji(innerHTML)) { + innerHTML = emoji.parseEmoji(this.plugin.getSettings().emojiStyle, innerHTML, fontSize); + } + else { + innerHTML = svg.setFontSize(innerHTML, fontSize); + } + iconNode.innerHTML = innerHTML; + return iconNode; + } + ignoreEvent() { + return true; + } +} + +const buildLinkDecorations = (view$1, plugin) => { + const builder = new state.RangeSetBuilder(); + const mdView = view$1.state.field(obsidian.editorInfoField); + for (const { from, to } of view$1.visibleRanges) { + language.syntaxTree(view$1.state).iterate({ + from, + to, + enter: (node) => { + const tokenProps = node.type.prop(language.tokenClassNodeProp); + if (tokenProps) { + const props = new Set(tokenProps.split(' ')); + const isLink = props.has('hmd-internal-link'); + const headerType = [ + 'header-1', + 'header-2', + 'header-3', + 'header-4', + 'header-5', + 'header-6', + ].find((header) => props.has(header)); + if (isLink) { + let linkText = view$1.state.doc.sliceString(node.from, node.to); + linkText = linkText.split('#')[0]; + const file = plugin.app.metadataCache.getFirstLinkpathDest(linkText, mdView.file.basename); + if (file) { + const possibleIcon = icon.getIconByPath(plugin, file.path); + if (possibleIcon) { + const iconDecoration = view.Decoration.widget({ + widget: new IconInLinkWidget(plugin, possibleIcon, file.path, headerType), + }); + builder.add(node.from, node.from, iconDecoration); + } + } + } + } + }, + }); + } + return builder.finish(); +}; + +const buildTextDecorations = (view$1, plugin) => { + const ranges = []; + const iconInfo = view$1.state.field(plugin.positionField); + for (const { from, to } of view$1.visibleRanges) { + iconInfo.between(from - 1, to + 1, (from, to, { iconId }) => { + ranges.push([iconId, from, to]); + }); + } + return view.Decoration.set(ranges.map(([code, from, to]) => { + const widget = new IconInTextWidget(plugin, code); + widget.setPosition(from, to); + if (view$1.state.field(obsidian.editorLivePreviewField)) { + return view.Decoration.replace({ + widget, + side: -1, + }).range(from, to); + } + return view.Decoration.widget({ + widget, + side: -1, + }).range(to); + }), true); +}; + +const buildIconInTextPlugin = (plugin) => { + return view.ViewPlugin.fromClass(class IconPlugin { + constructor(view) { + this.plugin = plugin; + this.decorations = buildTextDecorations(view, plugin); + } + update(update) { + this.decorations = buildTextDecorations(update.view, this.plugin); + } + }, { + decorations: (v) => v.decorations, + provide: (plugin) => view.EditorView.atomicRanges.of((view$1) => { + const value = view$1.plugin(plugin); + return value ? value.decorations : view.Decoration.none; + }), + }); +}; + +const buildIconInLinksPlugin = (plugin) => { + return view.ViewPlugin.fromClass(class { + constructor(view) { + this.plugin = plugin; + this.decorations = buildLinkDecorations(view, plugin); + } + destroy() { } + update(update) { + if (update.docChanged || update.viewportChanged) { + this.decorations = buildLinkDecorations(update.view, this.plugin); + } + } + }, { + decorations: (v) => v.decorations, + }); +}; + +// TODO: Optimize the code to reduce the number of iterations and improve the +// performance. +function checkForSourceMode(plugin) { + let isSourceMode = false; + // Iterate over all leaves to check if any is in source mode + plugin.app.workspace.iterateAllLeaves((leaf) => { + var _a; + if (!isSourceMode && leaf.view.getViewType() === 'markdown') { + if ((_a = leaf.getViewState().state) === null || _a === void 0 ? void 0 : _a.source) { + isSourceMode = true; + } + } + }); + return isSourceMode; +} +class IconPosition extends state.RangeValue { + constructor(text) { + super(); + this.text = text; + } + get iconId() { + return this.text; + } + eq(other) { + return other instanceof IconPosition && other.text === this.text; + } +} +/** + * Builds a position field for the editor state. This field will track the + * positions of the icons in the document. + **/ +const buildPositionField = (plugin) => { + /** + * Checks the ranges of the icons in the document. If the range is not + * excluded, the range is added to the range set. If the range is excluded, + * the range is removed from the range set. + * @param state EditorState to get the ranges from. + * @param excludeFrom Number to exclude from the ranges. + * @param excludeTo Number to exclude to the ranges. + * @param updateRange Function callback to update the range. + */ + const checkRanges = (state, excludeFrom, excludeTo, updateRange) => { + const isSourceMode = checkForSourceMode(plugin); + const text = state.doc.sliceString(0, state.doc.length); + const identifier = plugin.getSettings().iconIdentifier; + const regex = new RegExp(`(${identifier})((\\w{1,64}:\\d{17,18})|(\\w{1,64}))(${identifier})`, 'g'); + for (const { 0: rawCode, index: offset } of text.matchAll(regex)) { + const iconName = rawCode.substring(identifier.length, rawCode.length - identifier.length); + if (!icon.getIconByName(iconName)) { + continue; + } + const from = offset; + const to = offset + rawCode.length; + if (!isNodeInRangeAccepted(state, from, to)) { + continue; + } + if (offset < excludeFrom || offset > excludeTo) { + updateRange(from, to, new IconPosition(iconName), isSourceMode); + continue; + } + updateRange(from, to, new IconPosition(iconName), true); + } + for (const { 0: emojiName, index: offset } of text.matchAll(emoji.getRegex())) { + if (!emoji.isEmoji(emojiName)) { + continue; + } + const from = offset; + const to = offset + emojiName.length; + if (!isNodeInRangeAccepted(state, from, to)) { + continue; + } + if (offset < excludeFrom || offset > excludeTo) { + updateRange(from, to, new IconPosition(emojiName), isSourceMode); + continue; + } + updateRange(from, to, new IconPosition(emojiName), true); + } + }; + const isNodeInRangeAccepted = (state, from, to) => { + let isRangeAccepted = true; + language.syntaxTree(state).iterate({ + from, + to, + enter: ({ type }) => { + var _a; + if (type.name === 'Document') { + return; + } + const allowedNodeTypes = [ + 'header', + 'strong', + 'em', + 'quote', + 'link', + 'list-1', + 'list-2', + 'list-3', + 'highlight', + 'footref', + 'comment', + 'link-alias', + ]; + const excludedNodeTypes = [ + 'formatting', + 'hmd-codeblock', + 'inline-code', + 'hr', + ]; + const nodeProps = (_a = type.prop(language.tokenClassNodeProp)) !== null && _a !== void 0 ? _a : ''; + const s = new Set(nodeProps.split(' ')); + if (excludedNodeTypes.some((t) => s.has(t)) && + allowedNodeTypes.every((t) => !s.has(t))) { + isRangeAccepted = false; + } + }, + }); + return isRangeAccepted; + }; + return state.StateField.define({ + create: (state$1) => { + const rangeSet = new state.RangeSetBuilder(); + const changedLines = []; + checkRanges(state$1, -1, -1, (from, to, iconPosition) => { + changedLines.push({ from, to, iconPosition }); + }); + changedLines.sort((a, b) => a.from - b.from); + for (const { from, to, iconPosition } of changedLines) { + rangeSet.add(from, to, iconPosition); + } + return rangeSet.finish(); + }, + update: (rangeSet, transaction) => { + const newRanges = []; + if (!transaction.docChanged) { + if (transaction.selection) { + const from = transaction.selection.ranges[0].from; + const to = transaction.selection.ranges[0].to; + const lineEnd = transaction.state.doc.lineAt(to).length; + const lineStart = transaction.state.doc.lineAt(from).from; + // Checks the ranges of the icons in the document except for the + // excluded line start and end. + checkRanges(transaction.state, lineStart, lineStart + lineEnd, (from, to, value, removed) => { + rangeSet = rangeSet.update({ + filterFrom: from, + filterTo: to, + filter: () => false, + }); + if (!removed) { + newRanges.push(value.range(from, to)); + } + }); + } + else { + checkRanges(transaction.state, -1, -1, (from, to, value, removed) => { + rangeSet = rangeSet.update({ + filterFrom: from, + filterTo: to, + filter: () => false, + }); + if (!removed) { + newRanges.push(value.range(from, to)); + } + }); + } + newRanges.sort((a, b) => a.from - b.from); + rangeSet = rangeSet.update({ add: newRanges }); + return rangeSet; + } + rangeSet = rangeSet.map(transaction.changes); + const changedLines = []; + transaction.changes.iterChangedRanges((_f, _t, from, to) => { + changedLines.push([ + transaction.state.doc.lineAt(from).number, + transaction.state.doc.lineAt(to).number, + ]); + }); + for (const [start, end] of changedLines) { + const from = transaction.state.doc.line(start).from; + const to = transaction.state.doc.line(end).to; + rangeSet = rangeSet.update({ + filterFrom: from, + filterTo: to, + filter: () => false, + }); + const lineEnd = transaction.state.doc.line(end).length; + const lineStart = transaction.state.doc.line(end).from; + // Checks the ranges of the icons in the document except for the excluded + // line start and end. + checkRanges(transaction.state, lineStart, lineStart + lineEnd, (from, to, value, removed) => { + if (!removed) { + newRanges.push(value.range(from, to)); + } + }); + } + newRanges.sort((a, b) => a.from - b.from); + rangeSet = rangeSet.update({ add: newRanges }); + return rangeSet; + }, + }); +}; + +class ChangeColorModal extends obsidian.Modal { + constructor(app, plugin, path) { + var _a; + super(app); + this.plugin = plugin; + this.path = path; + this.usedColor = this.plugin.getIconColor(this.path); + this.contentEl.style.display = 'block'; + this.modalEl.classList.add('iconize-custom-modal'); + this.titleEl.setText('Change color'); + const description = this.contentEl.createEl('p', { + text: 'Select a color for this icon', + cls: 'setting-item-description', + }); + description.style.marginBottom = 'var(--size-2-2)'; + const colorContainer = this.contentEl.createDiv(); + colorContainer.style.display = 'flex'; + colorContainer.style.alignItems = 'center'; + colorContainer.style.justifyContent = 'space-between'; + const colorPicker = new obsidian.ColorComponent(colorContainer) + .setValue((_a = this.usedColor) !== null && _a !== void 0 ? _a : '#000000') + .onChange((value) => { + this.usedColor = value; + }); + const defaultColorButton = new obsidian.ButtonComponent(colorContainer); + defaultColorButton.setTooltip('Set color to the default one'); + defaultColorButton.setButtonText('Reset'); + defaultColorButton.onClick(() => { + colorPicker.setValue('#000000'); + this.usedColor = undefined; + }); + // Save button. + const button = new obsidian.ButtonComponent(this.contentEl); + button.buttonEl.style.marginTop = 'var(--size-4-4)'; + button.buttonEl.style.float = 'right'; + button.setButtonText('Save Changes'); + button.onClick(() => __awaiter(this, void 0, void 0, function* () { + var _a; + new obsidian.Notice('Color of icon changed.'); + if (this.usedColor) { + this.plugin.addIconColor(this.path, this.usedColor); + } + else { + this.plugin.removeIconColor(this.path); + } + // Refresh the DOM. + const iconNode = dom.getIconNodeFromPath(this.path); + iconNode.style.color = (_a = this.usedColor) !== null && _a !== void 0 ? _a : null; + const colorizedInnerHtml = svg.colorize(iconNode.innerHTML, this.usedColor); + iconNode.innerHTML = colorizedInnerHtml; + this.close(); + })); + } + onOpen() { + super.onOpen(); + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +} + +class EventEmitter { + constructor() { + this.listeners = {}; + } + on(type, listener, priority = 0) { + var _a, _b; + var _c; + (_a = (_c = this.listeners)[type]) !== null && _a !== void 0 ? _a : (_c[type] = []); + (_b = this.listeners[type]) === null || _b === void 0 ? void 0 : _b.push({ listener, once: false, priority }); + this.sortListeners(type); + } + once(type, listener, priority = 0) { + var _a, _b; + var _c; + (_a = (_c = this.listeners)[type]) !== null && _a !== void 0 ? _a : (_c[type] = []); + (_b = this.listeners[type]) === null || _b === void 0 ? void 0 : _b.push({ listener, once: true, priority }); + this.sortListeners(type); + } + off(type, listener) { + var _a; + if (!this.listeners[type]) { + return; + } + this.listeners[type] = (_a = this.listeners[type]) === null || _a === void 0 ? void 0 : _a.filter((entry) => entry.listener !== listener); + } + emit(type, payload) { + const listeners = this.listeners[type]; + if (!listeners) { + return; + } + const event = { payload }; + listeners.slice().forEach((entry) => { + entry.listener(event); + if (entry.once) { + this.off(type, entry.listener); + } + }); + } + sortListeners(type) { + var _a; + if (this.listeners[type]) { + (_a = this.listeners[type]) === null || _a === void 0 ? void 0 : _a.sort((a, b) => b.priority - a.priority); + } + } +} + +function getApi(plugin) { + return { + getEventEmitter: () => plugin.getEventEmitter(), + getIconByName: (iconNameWithPrefix) => icon.getIconByName(iconNameWithPrefix), + setIconForNode: (iconName, node, color) => dom.setIconForNode(plugin, iconName, node, { color }), + saveIconToIconPack: (iconNameWithPrefix) => saveIconToIconPack(plugin, iconNameWithPrefix), + removeIconFromIconPack: (iconNameWithPrefix) => removeIconFromIconPack(plugin, iconNameWithPrefix), + getIconsFromIconPack: getIconsFromIconPack, + getAllIconPacks: getAllIconPacks, + doesElementHasIconNode: dom.doesElementHasIconNode, + getIconFromElement: dom.getIconFromElement, + removeIconInNode: dom.removeIconInNode, + removeIconInPath: dom.removeIconInPath, + util: { + dom, + svg, + }, + version: { + get current() { + return plugin.manifest.version; + }, + }, + }; +} + +class IconizePlugin extends obsidian.Plugin { + constructor() { + super(...arguments); + this.registeredFileExplorers = new Set(); + this.modifiedInternalPlugins = []; + this.positionField = buildPositionField(this); + this.frontmatterCache = new Set(); + this.eventEmitter = new EventEmitter(); + this.api = getApi(this); + } + onload() { + return __awaiter(this, void 0, void 0, function* () { + console.log(`loading ${config.PLUGIN_NAME}`); + yield this.loadIconFolderData(); + logger.toggleLogging(this.getSettings().debugMode); + setPath(this.getSettings().iconPacksPath); + if (this.getSettings().useInternalPlugins) { + // Registers all modified internal plugins. + // Only adds star plugin for obsidian under v0.12.6. + if (!obsidian.requireApiVersion('0.12.6')) { + this.modifiedInternalPlugins.push(new StarredInternalPlugin(this)); + } + else if (obsidian.requireApiVersion('1.2.0')) { + this.modifiedInternalPlugins.push(new BookmarkInternalPlugin(this)); + } + this.modifiedInternalPlugins.push(new OutlineInternalPlugin(this)); + } + yield createDefaultDirectory(this); + yield this.checkRecentlyUsedIcons(); + yield migrate(this); + const usedIconNames = icon.getAllWithPath(this).map((value) => value.icon); + if (!this.doesUseCustomLucideIconPack()) { + addLucideIconsPack(this); + } + yield loadUsedIcons(this, usedIconNames); + this.app.workspace.onLayoutReady(() => this.handleChangeLayout()); + this.addCommand({ + id: 'iconize:set-icon-for-file', + name: 'Set icon for file', + hotkeys: [ + { + modifiers: ['Mod', 'Shift'], + key: 'j', + }, + ], + editorCallback: (editor) => __awaiter(this, void 0, void 0, function* () { + var _a; + const file = (_a = editor.editorComponent) === null || _a === void 0 ? void 0 : _a.file; + if (!file) { + logger.warn(`'editor.editorComponent?.file' is undefined for file: ${file}`); + return; + } + const modal = new IconsPickerModal(this.app, this, file.path); + modal.open(); + modal.onSelect = (iconName) => { + IconCache.getInstance().set(file.path, { + iconNameWithPrefix: iconName, + }); + // Update icon in tab when setting is enabled. + if (this.getSettings().iconInTabsEnabled) { + const tabLeaves = iconTabs.getTabLeavesOfFilePath(this, file.path); + for (const tabLeaf of tabLeaves) { + iconTabs.update(this, iconName, tabLeaf.tabHeaderInnerIconEl); + } + } + // Update icon in title when setting is enabled. + if (this.getSettings().iconInTitleEnabled) { + this.addIconInTitle(iconName); + } + }; + }), + }); + this.registerEvent( + // Registering file menu event for listening to file pinning and unpinning. + this.app.workspace.on('file-menu', (menu, file) => { + // I've researched other ways of doing this. However, there is no other way to listen to file pinning and unpinning. + menu.onHide(() => { + const path = file.path; + if (this.getSettings().iconInTabsEnabled) { + for (const openedFile of getAllOpenedFiles(this)) { + if (openedFile.path === path) { + const possibleIcon = IconCache.getInstance().get(path); + if (!possibleIcon) { + return; + } + const tabLeaves = iconTabs.getTabLeavesOfFilePath(this, file.path); + for (const tabLeaf of tabLeaves) { + // Add timeout to ensure that the default icon is already set. + setTimeout(() => { + iconTabs.add(this, file.path, tabLeaf.tabHeaderInnerIconEl); + }, 5); + } + } + } + } + }); + })); + this.registerEvent(this.app.workspace.on('layout-change', () => this.handleChangeLayout())); + this.registerEvent(this.app.workspace.on('file-menu', (menu, file) => { + const addIconMenuItem = (item) => { + item.setTitle('Change icon'); + item.setIcon('hashtag'); + item.onClick(() => { + const modal = new IconsPickerModal(this.app, this, file.path); + modal.open(); + modal.onSelect = (iconName) => { + IconCache.getInstance().set(file.path, { + iconNameWithPrefix: iconName, + }); + // Update icon in tab when setting is enabled. + if (this.getSettings().iconInTabsEnabled) { + const tabLeaves = iconTabs.getTabLeavesOfFilePath(this, file.path); + for (const tabLeaf of tabLeaves) { + iconTabs.update(this, iconName, tabLeaf.tabHeaderInnerIconEl); + } + } + // Update icon in title when setting is enabled. + if (this.getSettings().iconInTitleEnabled) { + this.addIconInTitle(iconName); + } + }; + }); + }; + const removeIconMenuItem = (item) => { + item.setTitle('Remove icon'); + item.setIcon('trash'); + item.onClick(() => __awaiter(this, void 0, void 0, function* () { + yield this.removeSingleIcon(file); + })); + }; + const changeColorOfIcon = (item) => { + item.setTitle('Change color of icon'); + item.setIcon('palette'); + item.onClick(() => { + const modal = new ChangeColorModal(this.app, this, file.path); + modal.open(); + }); + }; + menu.addItem(addIconMenuItem); + const filePathData = this.getData()[file.path]; + const hasNestedIcon = typeof filePathData === 'object' && + filePathData.iconName !== null; + // Only add remove icon menu item when the file path exists in the data. + // We do not want to show this menu item for e.g. custom rules. + if (filePathData && + (typeof filePathData === 'string' || hasNestedIcon)) { + const icon = typeof filePathData === 'string' + ? filePathData + : filePathData.iconName; + if (!emoji.isEmoji(icon)) { + menu.addItem(changeColorOfIcon); + } + menu.addItem(removeIconMenuItem); + } + })); + // deleting event + this.registerEvent(this.app.vault.on('delete', (file) => { + const path = file.path; + this.removeFolderIcon(path); + })); + // renaming event + this.registerEvent(this.app.vault.on('rename', (file, oldPath) => { + // Check if the file was moved and had an icon before. + const dataPoint = this.data[oldPath]; + if (dataPoint && oldPath !== 'settings') { + const iconNameWithPrefix = typeof dataPoint === 'object' + ? dataPoint.iconName + : dataPoint; + dom.createIconNode(this, file.path, iconNameWithPrefix); + } + this.renameFolder(file.path, oldPath); + })); + if (this.getSettings().iconsInNotesEnabled) { + this.registerMarkdownPostProcessor((el) => processIconInTextMarkdown(this, el)); + this.registerEditorSuggest(new SuggestionIcon(this.app, this)); + this.registerEditorExtension([ + this.positionField, + buildIconInTextPlugin(this), + ]); + } + if (this.getSettings().iconsInLinksEnabled) { + this.registerMarkdownPostProcessor((el, ctx) => processIconInLinkMarkdown(this, el, ctx)); + this.registerEditorExtension([ + this.positionField, + buildIconInLinksPlugin(this), + ]); + } + this.addSettingTab(new IconFolderSettings(this.app, this)); + }); + } + notifyPlugins() { + this.modifiedInternalPlugins.forEach((internalPlugin) => { + if (internalPlugin.enabled) { + internalPlugin.onMount(); + } + }); + } + removeSingleIcon(file) { + return __awaiter(this, void 0, void 0, function* () { + this.removeFolderIcon(file.path); + dom.removeIconInPath(file.path); + IconCache.getInstance().invalidate(file.path); + this.notifyPlugins(); + let didUpdate = false; + // Refreshes the icon tab and title icon for custom rules. + for (const rule of customRule.getSortedRules(this)) { + const applicable = yield customRule.isApplicable(this, rule, file.path); + if (applicable) { + customRule.add(this, rule, file); + this.addIconInTitle(rule.icon); + const tabLeaves = iconTabs.getTabLeavesOfFilePath(this, file.path); + for (const tabLeaf of tabLeaves) { + iconTabs.add(this, file.path, tabLeaf.tabHeaderInnerIconEl, { + iconName: rule.icon, + }); + } + didUpdate = true; + break; + } + } + // Only remove icon above titles and icon in tabs if no custom rule was found. + if (!didUpdate) { + // Refreshes icons above title and icons in tabs. + for (const openedFile of getAllOpenedFiles(this)) { + if (this.getSettings().iconInTitleEnabled) { + titleIcon.remove(openedFile.leaf.view.inlineTitleEl); + } + if (this.getSettings().iconInTabsEnabled) { + const leaf = openedFile.leaf; + iconTabs.remove(leaf.tabHeaderInnerIconEl, { + replaceWithDefaultIcon: true, + }); + } + } + } + }); + } + handleChangeLayout() { + // Transform data that are objects to single strings. + const data = Object.entries(this.data); + this.modifiedInternalPlugins.forEach((internalPlugin) => { + if (internalPlugin.enabled) { + internalPlugin.onMount(); + internalPlugin.register(); + } + }); + icon.addAll(this, data, this.registeredFileExplorers, () => { + // After initialization of the icon packs, checks the vault for missing icons and + // adds them. + initIconPacks(this).then(() => __awaiter(this, void 0, void 0, function* () { + if (this.getSettings().iconsBackgroundCheckEnabled) { + const data = Object.entries(this.data); + yield icon.checkMissingIcons(this, data); + resetPreloadedIcons(); + } + this.eventEmitter.emit('allIconsLoaded'); + })); + if (this.getSettings().iconInFrontmatterEnabled) { + const activeFile = this.app.workspace.getActiveFile(); + if (activeFile) { + this.frontmatterCache.add(activeFile.path); + } + } + // Adds the title icon to the active leaf view. + if (this.getSettings().iconInTitleEnabled) { + for (const openedFile of getAllOpenedFiles(this)) { + const iconName = icon.getByPath(this, openedFile.path); + const activeView = openedFile.leaf.view; + if (activeView instanceof obsidian.MarkdownView && iconName) { + let possibleIcon = iconName; + if (!emoji.isEmoji(iconName)) { + const iconNextIdentifier = nextIdentifier(iconName); + possibleIcon = getSvgFromLoadedIcon(iconName.substring(0, iconNextIdentifier), iconName.substring(iconNextIdentifier)); + } + if (possibleIcon) { + titleIcon.add(this, activeView.inlineTitleEl, possibleIcon, { + fontSize: calculateInlineTitleSize(), + }); + } + } + } + } + // Register rename event for adding icons with custom rules to the DOM + // when file was moved to another directory. + this.registerEvent(this.app.vault.on('rename', (file, oldPath) => __awaiter(this, void 0, void 0, function* () { + const sortedRules = customRule.getSortedRules(this); + // Removes possible icons from the renamed file. + sortedRules.forEach((rule) => { + if (customRule.doesMatchPath(rule, oldPath)) { + dom.removeIconInPath(file.path); + } + }); + // Adds possible icons to the renamed file. + sortedRules.forEach((rule) => { + if (customRule.doesMatchPath(rule, oldPath)) { + return; + } + customRule.add(this, rule, file, undefined); + }); + // Updates icon tabs for the renamed file. + for (const rule of customRule.getSortedRules(this)) { + const applicable = yield customRule.isApplicable(this, rule, file.path); + if (!applicable) { + continue; + } + const openedFiles = getAllOpenedFiles(this); + const openedFile = openedFiles.find((openedFile) => openedFile.path === file.path); + if (openedFile) { + const leaf = openedFile.leaf; + iconTabs.update(this, rule.icon, leaf.tabHeaderInnerIconEl); + } + break; + } + }))); + // Register `layout-change` event for adding icons to tabs when moving a pane or + // enabling reading mode. + this.registerEvent(this.app.workspace.on('layout-change', () => { + var _a, _b; + if (this.getSettings().iconInTitleEnabled) { + const activeView = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView); + if (activeView) { + const file = activeView.file; + const view = activeView.leaf.view.currentMode + .view; + const iconNameWithPrefix = icon.getByPath(this, file.path); + if (!iconNameWithPrefix) { + titleIcon.hide(view.inlineTitleEl); + return; + } + let foundIcon = iconNameWithPrefix; + if (!emoji.isEmoji(foundIcon)) { + foundIcon = (_a = icon.getIconByName(iconNameWithPrefix)) === null || _a === void 0 ? void 0 : _a.svgElement; + // Check for preloaded icons if no icon was found when the start up was faster + // than the loading of the icons. + if (!foundIcon && getPreloadedIcons().length > 0) { + foundIcon = (_b = getPreloadedIcons().find((icon) => icon.prefix + icon.name === iconNameWithPrefix)) === null || _b === void 0 ? void 0 : _b.svgElement; + } + } + if (foundIcon) { + // Removes the node because the editor markdown content is being rerendered + // when the content mode changes back to editing. + titleIcon.remove(view.inlineTitleEl); + titleIcon.add(this, view.inlineTitleEl, foundIcon, { + fontSize: calculateInlineTitleSize(), + }); + } + } + } + if (!this.getSettings().iconInTabsEnabled) { + return; + } + for (const openedFile of getAllOpenedFiles(this)) { + const leaf = openedFile.leaf; + const iconColor = this.getIconColor(leaf.view.file.path); + iconTabs.add(this, openedFile.path, leaf.tabHeaderInnerIconEl, { + iconColor, + }); + } + })); + // Register `file-open` event for adding icon to title. + this.registerEvent(this.app.workspace.on('file-open', (file) => { + var _a, _b; + if (!this.getSettings().iconInTitleEnabled) { + return; + } + for (const openedFile of getAllOpenedFiles(this)) { + if (!file || !openedFile || openedFile.path !== file.path) { + continue; + } + const leaf = openedFile.leaf.view; + const iconNameWithPrefix = icon.getByPath(this, file.path); + if (!iconNameWithPrefix) { + titleIcon.hide(leaf.inlineTitleEl); + return; + } + let foundIcon = iconNameWithPrefix; + if (!emoji.isEmoji(foundIcon)) { + foundIcon = (_a = icon.getIconByName(iconNameWithPrefix)) === null || _a === void 0 ? void 0 : _a.svgElement; + // Check for preloaded icons if no icon was found when the start up was faster + // than the loading of the icons. + if (!foundIcon && getPreloadedIcons().length > 0) { + foundIcon = (_b = getPreloadedIcons().find((icon) => icon.prefix + icon.name === iconNameWithPrefix)) === null || _b === void 0 ? void 0 : _b.svgElement; + } + } + if (foundIcon) { + titleIcon.add(this, leaf.inlineTitleEl, foundIcon, { + fontSize: calculateInlineTitleSize(), + }); + } + else { + titleIcon.hide(leaf.inlineTitleEl); + } + } + })); + // Register event for frontmatter icon registration. + this.registerEvent(this.app.metadataCache.on('resolve', (file) => __awaiter(this, void 0, void 0, function* () { + if (!this.getSettings().iconInFrontmatterEnabled) { + return; + } + const fileCache = this.app.metadataCache.getFileCache(file); + const iconFrontmatterName = this.getSettings().iconInFrontmatterFieldName; + const iconColorFrontmatterName = this.getSettings().iconColorInFrontmatterFieldName; + if (fileCache === null || fileCache === void 0 ? void 0 : fileCache.frontmatter) { + const { [iconFrontmatterName]: newIconName, [iconColorFrontmatterName]: newIconColor, } = fileCache.frontmatter; + // If `icon` property is empty, we will remove it from the data and remove the icon. + if (!newIconName) { + if (this.frontmatterCache.has(file.path)) { + yield this.removeSingleIcon(file); + this.frontmatterCache.delete(file.path); + } + return; + } + if (typeof newIconName !== 'string') { + new obsidian.Notice(`[${config.PLUGIN_NAME}] Frontmatter property type \`icon\` has to be of type \`text\`.`); + return; + } + if (newIconColor && typeof newIconColor !== 'string') { + new obsidian.Notice(`[${config.PLUGIN_NAME}] Frontmatter property type \`iconColor\` has to be of type \`text\`.`); + return; + } + let iconColor = newIconColor; + if (isHexadecimal(iconColor)) { + iconColor = stringToHex(iconColor); + } + const cachedIcon = IconCache.getInstance().get(file.path); + if (newIconName === (cachedIcon === null || cachedIcon === void 0 ? void 0 : cachedIcon.iconNameWithPrefix) && + iconColor === (cachedIcon === null || cachedIcon === void 0 ? void 0 : cachedIcon.iconColor)) { + return; + } + this.frontmatterCache.add(file.path); + try { + if (!emoji.isEmoji(newIconName)) { + saveIconToIconPack(this, newIconName); + } + } + catch (e) { + logger.warn(`Something went wrong while saving icon to icon pack (error: ${e})`); + new obsidian.Notice(e.message); + return; + } + dom.createIconNode(this, file.path, newIconName, { + color: iconColor, + }); + this.addFolderIcon(file.path, newIconName); + this.addIconColor(file.path, iconColor); + IconCache.getInstance().set(file.path, { + iconNameWithPrefix: newIconName, + iconColor, + }); + // Update icon in tab when setting is enabled. + if (this.getSettings().iconInTabsEnabled) { + const tabLeaves = iconTabs.getTabLeavesOfFilePath(this, file.path); + for (const tabLeaf of tabLeaves) { + iconTabs.update(this, newIconName, tabLeaf.tabHeaderInnerIconEl); + } + } + // Update icon in title when setting is enabled. + if (this.getSettings().iconInTitleEnabled) { + this.addIconInTitle(newIconName); + } + } + }))); + // Register active leaf change event for adding icon of file to tab. + this.registerEvent(this.app.workspace.on('active-leaf-change', (leaf) => { + if (!this.getSettings().iconInTabsEnabled) { + return; + } + // TODO: Maybe change in the future to a more optimal solution. + // Fixes a problem when the file was clicked twice in the same tab. + // See https://github.com/FlorianWoelki/obsidian-iconize/issues/208. + if (leaf.view.getViewType() === 'file-explorer') { + for (const openedFile of getAllOpenedFiles(this)) { + const leaf = openedFile.leaf; + const iconColor = this.getIconColor(leaf.view.file.path); + iconTabs.add(this, openedFile.path, leaf.tabHeaderInnerIconEl, { + iconColor, + }); + } + return; + } + if (leaf.view.getViewType() !== 'markdown') { + return; + } + const tabHeaderLeaf = leaf; + if (tabHeaderLeaf.view.file) { + const iconColor = this.getIconColor(tabHeaderLeaf.view.file.path); + iconTabs.add(this, tabHeaderLeaf.view.file.path, tabHeaderLeaf.tabHeaderInnerIconEl, { + iconColor, + }); + } + })); + this.registerEvent(this.app.workspace.on('css-change', () => { + for (const openedFile of getAllOpenedFiles(this)) { + const activeView = openedFile.leaf.view; + if (activeView instanceof obsidian.MarkdownView) { + titleIcon.updateStyle(activeView.inlineTitleEl, { + fontSize: calculateInlineTitleSize(), + }); + } + } + })); + }); + } + addIconInTitle(iconName) { + var _a; + for (const openedFile of getAllOpenedFiles(this)) { + const activeView = openedFile.leaf.view; + if (activeView instanceof obsidian.MarkdownView) { + let possibleIcon = iconName; + if (!emoji.isEmoji(iconName)) { + possibleIcon = (_a = icon.getIconByName(iconName)) === null || _a === void 0 ? void 0 : _a.svgElement; + } + if (possibleIcon) { + titleIcon.add(this, activeView.inlineTitleEl, possibleIcon, { + fontSize: calculateInlineTitleSize(), + }); + } + } + } + } + onunload() { + console.log('unloading obsidian-icon-folder'); + } + renameFolder(newPath, oldPath) { + if (!this.data[oldPath] || newPath === oldPath) { + return; + } + Object.defineProperty(this.data, newPath, Object.getOwnPropertyDescriptor(this.data, oldPath)); + delete this.data[oldPath]; + this.saveIconFolderData(); + } + addIconColor(path, iconColor) { + const pathData = this.getData()[path]; + if (typeof pathData === 'string') { + this.getData()[path] = { + iconName: pathData, + iconColor, + }; + } + else { + pathData.iconColor = iconColor; + } + this.saveIconFolderData(); + } + getIconColor(path) { + const pathData = this.getData()[path]; + if (!pathData) { + return undefined; + } + if (typeof pathData === 'string') { + return undefined; + } + return pathData.iconColor; + } + removeIconColor(path) { + const pathData = this.getData()[path]; + if (typeof pathData === 'string') { + return; + } + const currentValue = pathData; + this.getData()[path] = currentValue.iconName; + this.saveIconFolderData(); + } + removeFolderIcon(path) { + if (!this.data[path]) { + return; + } + // Saves the icon name with prefix to remove it from the icon pack directory later. + const iconData = this.data[path]; + delete this.data[path]; + // Removes the icon from the icon pack directory if it is not used as an icon somewhere + // else. + if (iconData) { + let iconNameWithPrefix = iconData; + if (typeof iconData === 'object') { + iconNameWithPrefix = iconData.iconName; + } + else { + iconNameWithPrefix = iconData; + } + if (!emoji.isEmoji(iconNameWithPrefix)) { + removeIconFromIconPack(this, iconNameWithPrefix); + } + } + //this.addIconsToSearch(); + this.saveIconFolderData(); + } + addFolderIcon(path, icon) { + const iconName = getNormalizedName(typeof icon === 'object' ? icon.displayName : icon); + this.data[path] = iconName; + // Update recently used icons. + if (!this.getSettings().recentlyUsedIcons.includes(iconName)) { + if (this.getSettings().recentlyUsedIcons.length >= + this.getSettings().recentlyUsedIconsSize) { + this.getSettings().recentlyUsedIcons = + this.getSettings().recentlyUsedIcons.slice(0, this.getSettings().recentlyUsedIconsSize - 1); + } + this.getSettings().recentlyUsedIcons.unshift(iconName); + this.checkRecentlyUsedIcons(); + } + //this.addIconsToSearch(); + this.saveIconFolderData(); + } + getSettings() { + return this.data.settings; + } + loadIconFolderData() { + return __awaiter(this, void 0, void 0, function* () { + const data = yield this.loadData(); + if (data) { + Object.entries(DEFAULT_SETTINGS).forEach(([k, v]) => { + if (data.settings[k] === undefined) { + data.settings[k] = v; + } + }); + } + this.data = Object.assign({ settings: Object.assign({}, DEFAULT_SETTINGS) }, {}, data); + }); + } + saveIconFolderData() { + return __awaiter(this, void 0, void 0, function* () { + yield this.saveData(this.data); + }); + } + checkRecentlyUsedIcons() { + return __awaiter(this, void 0, void 0, function* () { + if (this.getSettings().recentlyUsedIcons.length > + this.getSettings().recentlyUsedIconsSize) { + this.getSettings().recentlyUsedIcons = + this.getSettings().recentlyUsedIcons.slice(0, this.getSettings().recentlyUsedIconsSize); + yield this.saveIconFolderData(); + } + }); + } + getEventEmitter() { + return this.eventEmitter; + } + getData() { + return this.data; + } + getIconNameFromPath(path) { + if (typeof this.getData()[path] === 'object') { + return this.getData()[path].iconName; + } + return this.getData()[path]; + } + getRegisteredFileExplorers() { + return this.registeredFileExplorers; + } + doesUseCustomLucideIconPack() { + return this.getSettings().lucideIconPackType === 'custom'; + } + doesUseNativeLucideIconPack() { + return this.getSettings().lucideIconPackType === 'native'; + } + /** + * Returns a possible data path by the given value. This function checks for + * direct icon and custom rules. + * @param value String that will be used to find the data path. + * @returns String that is the data path or `undefined` if no data path was found. + */ + getDataPathByValue(value) { + return Object.entries(this.data).find(([k, v]) => { + if (typeof v === 'string') { + if (value === v) { + return k; + } + } + else if (typeof v === 'object') { + // Check for custom rules. + if (k === 'settings') { + // `rules` are defined in the settings object. + const rules = v.rules; + return rules.find((rule) => rule.icon === value); + } + v = v; + if (value === v.iconName) { + return k; + } + } + }); + } +} + +module.exports = IconizePlugin; + + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-icon-folder/manifest.json b/.obsidian/plugins/obsidian-icon-folder/manifest.json new file mode 100644 index 0000000..6e916c3 --- /dev/null +++ b/.obsidian/plugins/obsidian-icon-folder/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "obsidian-icon-folder", + "name": "Iconize", + "version": "2.14.7", + "minAppVersion": "0.9.12", + "description": "Add icons to anything you desire in Obsidian, including files, folders, and text.", + "author": "Florian Woelki", + "authorUrl": "https://florianwoelki.com/", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/obsidian-icon-folder/styles.css b/.obsidian/plugins/obsidian-icon-folder/styles.css new file mode 100644 index 0000000..a74fdd4 --- /dev/null +++ b/.obsidian/plugins/obsidian-icon-folder/styles.css @@ -0,0 +1,120 @@ +.iconize-inline-title-wrapper { + width: var(--line-width); + max-width: var(--max-width); + margin-inline: var(--content-margin); +} + +.iconize-title-icon { + max-width: var(--max-width); + margin-right: var(--size-4-2); +} + +.iconize-icon-in-link { + transform: translateY(20%); + margin-right: var(--size-2-2); + display: inline-flex; +} + +.iconize-icon { + border: 1px solid transparent; + margin: 0px 4px 0px 0px; + display: flex; + align-self: center; + margin: auto 0; +} + +.nav-folder-title, +.nav-file-title { + align-items: center; +} + +.iconize-setting input[type='color'] { + margin: 0 6px; +} + +.iconize-modal.prompt-results { + margin: 0; + overflow-y: auto; + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); +} + +.prompt .iconize-subheadline { + margin-top: 12px; + font-size: 12px; + color: gray; + grid-column-start: 1; + grid-column-end: 6; +} + +@media (max-width: 640px) { + .iconize-modal.prompt-results { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } + .prompt .iconize-subheadline { + grid-column-end: 4; + } +} + +.iconize-modal.prompt-results .suggestion-item { + cursor: pointer; + white-space: pre-wrap; + display: flex; + justify-content: flex-end; + align-items: center; + flex-direction: column-reverse; + text-align: center; + font-size: 13px; + color: var(--text-muted); + padding: 16px 8px; + line-break: auto; + word-break: break-word; + line-height: 1.3; +} + +.iconize-modal.prompt-results .suggestion-item.suggestion-item__center { + justify-content: center; +} + +.iconize-icon-preview { + font-size: 22px; +} + +.iconize-icon-preview img { + width: 16px; + height: 16px; +} + +.iconize-icon-preview svg { + width: 24px; + height: 24px; + color: currentColor; + margin-bottom: 4px; +} + +.iconize-dragover { + position: relative; +} + +.iconize-dragover-el { + position: absolute; + width: 100%; + height: 100%; + color: var(--text-normal); + background-color: var(--background-secondary-alt); + display: flex; + align-items: center; + justify-content: center; +} + +/* Custom rule modal. */ +.iconize-custom-modal .modal-content { + display: flex; + align-items: center; + justify-content: center; +} + +.iconize-custom-modal .modal-content input { + width: 100%; + margin-right: 0.5rem; +} diff --git a/.obsidian/plugins/obsidian-kanban/main.js b/.obsidian/plugins/obsidian-kanban/main.js new file mode 100644 index 0000000..9090d50 --- /dev/null +++ b/.obsidian/plugins/obsidian-kanban/main.js @@ -0,0 +1,153 @@ +var sF=Object.create;var Vs=Object.defineProperty;var lF=Object.getOwnPropertyDescriptor;var uF=Object.getOwnPropertyNames;var cF=Object.getPrototypeOf,dF=Object.prototype.hasOwnProperty;var fF=(e,t,r)=>t in e?Vs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var hF=(e,t)=>()=>(e&&(t=e(e=0)),t);var wn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Rf=(e,t)=>{for(var r in t)Vs(e,r,{get:t[r],enumerable:!0})},av=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uF(t))!dF.call(e,i)&&i!==r&&Vs(e,i,{get:()=>t[i],enumerable:!(n=lF(t,i))||n.enumerable});return e};var Ct=(e,t,r)=>(r=e!=null?sF(cF(e)):{},av(t||!e||!e.__esModule?Vs(r,"default",{value:e,enumerable:!0}):r,e)),ov=e=>av(Vs({},"__esModule",{value:!0}),e);var ur=(e,t,r)=>(fF(e,typeof t!="symbol"?t+"":t,r),r);var ln=wn((hi,Zv)=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});function Qr(e){return typeof e=="object"&&!("toString"in e)?Object.prototype.toString.call(e).slice(8,-1):e}var eI=typeof process=="object"&&!0;function Vr(e,t){if(!e)throw eI?new Error("Invariant failed"):new Error(t())}hi.invariant=Vr;var nh=Object.prototype.hasOwnProperty,tI=Array.prototype.splice,nI=Object.prototype.toString;function Ua(e){return nI.call(e).slice(8,-1)}var bu=Object.assign||function(e,t){return rh(t).forEach(function(r){nh.call(t,r)&&(e[r]=t[r])}),e},rh=typeof Object.getOwnPropertySymbols=="function"?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.keys(e)};function sa(e){return Array.isArray(e)?bu(e.constructor(e.length),e):Ua(e)==="Map"?new Map(e):Ua(e)==="Set"?new Set(e):e&&typeof e=="object"?bu(Object.create(Object.getPrototypeOf(e)),e):e}var Gv=function(){function e(){this.commands=bu({},rI),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(t,r){return t===r},this.update.newContext=function(){return new e().update}}return Object.defineProperty(e.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(t){this.update.isEquals=t},enumerable:!0,configurable:!0}),e.prototype.extend=function(t,r){this.commands[t]=r},e.prototype.update=function(t,r){var n=this,i=typeof r=="function"?{$apply:r}:r;Array.isArray(t)&&Array.isArray(i)||Vr(!Array.isArray(i),function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),Vr(typeof i=="object"&&i!==null,function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(n.commands).join(", ")+".")});var a=t;return rh(i).forEach(function(o){if(nh.call(n.commands,o)){var s=t===a;a=n.commands[o](i[o],a,i,t),s&&n.isEquals(a,t)&&(a=t)}else{var u=Ua(t)==="Map"?n.update(t.get(o),i[o]):n.update(t[o],i[o]),l=Ua(a)==="Map"?a.get(o):a[o];(!n.isEquals(u,l)||typeof u=="undefined"&&!nh.call(t,o))&&(a===t&&(a=sa(t)),Ua(a)==="Map"?a.set(o,u):a[o]=u)}}),a},e}();hi.Context=Gv;var rI={$push:function(e,t,r){return jv(t,r,"$push"),e.length?t.concat(e):t},$unshift:function(e,t,r){return jv(t,r,"$unshift"),e.length?e.concat(t):t},$splice:function(e,t,r,n){return iI(t,r),e.forEach(function(i){Jv(i),t===n&&i.length&&(t=sa(n)),tI.apply(t,i)}),t},$set:function(e,t,r){return oI(r),e},$toggle:function(e,t){zs(e,"$toggle");var r=e.length?sa(t):t;return e.forEach(function(n){r[n]=!t[n]}),r},$unset:function(e,t,r,n){return zs(e,"$unset"),e.forEach(function(i){Object.hasOwnProperty.call(t,i)&&(t===n&&(t=sa(n)),delete t[i])}),t},$add:function(e,t,r,n){return qv(t,"$add"),zs(e,"$add"),Ua(t)==="Map"?e.forEach(function(i){var a=i[0],o=i[1];t===n&&t.get(a)!==o&&(t=sa(n)),t.set(a,o)}):e.forEach(function(i){t===n&&!t.has(i)&&(t=sa(n)),t.add(i)}),t},$remove:function(e,t,r,n){return qv(t,"$remove"),zs(e,"$remove"),e.forEach(function(i){t===n&&t.has(i)&&(t=sa(n)),t.delete(i)}),t},$merge:function(e,t,r,n){return sI(t,e),rh(e).forEach(function(i){e[i]!==t[i]&&(t===n&&(t=sa(n)),t[i]=e[i])}),t},$apply:function(e,t){return aI(e),e(t)}},ih=new Gv;hi.isEquals=ih.update.isEquals;hi.extend=ih.extend;hi.default=ih.update;hi.default.default=Zv.exports=bu(hi.default,hi);function jv(e,t,r){Vr(Array.isArray(e),function(){return"update(): expected target of "+Qr(r)+" to be an array; got "+Qr(e)+"."}),zs(t[r],r)}function zs(e,t){Vr(Array.isArray(e),function(){return"update(): expected spec of "+Qr(t)+" to be an array; got "+Qr(e)+". Did you forget to wrap your parameter in an array?"})}function iI(e,t){Vr(Array.isArray(e),function(){return"Expected $splice target to be an array; got "+Qr(e)}),Jv(t.$splice)}function Jv(e){Vr(Array.isArray(e),function(){return"update(): expected spec of $splice to be an array of arrays; got "+Qr(e)+". Did you forget to wrap your parameters in an array?"})}function aI(e){Vr(typeof e=="function",function(){return"update(): expected spec of $apply to be a function; got "+Qr(e)+"."})}function oI(e){Vr(Object.keys(e).length===1,function(){return"Cannot have more than one key in an object with $set"})}function sI(e,t){Vr(t&&typeof t=="object",function(){return"update(): $merge expects a spec of type 'object'; got "+Qr(t)}),Vr(e&&typeof e=="object",function(){return"update(): $merge expects a target of type 'object'; got "+Qr(e)})}function qv(e,t){var r=Ua(e);Vr(r==="Map"||r==="Set",function(){return"update(): "+Qr(t)+" expects a target of type Set or Map; got "+Qr(r)})}});var tw=wn((JB,ew)=>{"use strict";var lI=function(t){return uI(t)&&!cI(t)};function uI(e){return!!e&&typeof e=="object"}function cI(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||hI(e)}var dI=typeof Symbol=="function"&&Symbol.for,fI=dI?Symbol.for("react.element"):60103;function hI(e){return e.$$typeof===fI}function mI(e){return Array.isArray(e)?[]:{}}function Ks(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Mo(mI(e),e,t):e}function pI(e,t,r){return e.concat(t).map(function(n){return Ks(n,r)})}function gI(e,t){if(!t.customMerge)return Mo;var r=t.customMerge(e);return typeof r=="function"?r:Mo}function yI(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function Qv(e){return Object.keys(e).concat(yI(e))}function Xv(e,t){try{return t in e}catch(r){return!1}}function vI(e,t){return Xv(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function wI(e,t,r){var n={};return r.isMergeableObject(e)&&Qv(e).forEach(function(i){n[i]=Ks(e[i],r)}),Qv(t).forEach(function(i){vI(e,i)||(Xv(e,i)&&r.isMergeableObject(t[i])?n[i]=gI(i,r)(e[i],t[i],r):n[i]=Ks(t[i],r))}),n}function Mo(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||pI,r.isMergeableObject=r.isMergeableObject||lI,r.cloneUnlessOtherwiseSpecified=Ks;var n=Array.isArray(t),i=Array.isArray(e),a=n===i;return a?n?r.arrayMerge(e,t,r):wI(e,t,r):Ks(t,r)}Mo.all=function(t,r){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(n,i){return Mo(n,i,r)},{})};var bI=Mo;ew.exports=bI});var Db=wn((FU,Ch)=>{"use strict";var JA=Object.prototype.hasOwnProperty,cr="~";function al(){}Object.create&&(al.prototype=Object.create(null),new al().__proto__||(cr=!1));function ZA(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function bb(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new ZA(r,n||e,i),o=cr?cr+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],a]:e._events[o].push(a):(e._events[o]=a,e._eventsCount++),e}function Ru(e,t){--e._eventsCount===0?e._events=new al:delete e._events[t]}function Xn(){this._events=new al,this._eventsCount=0}Xn.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)JA.call(r,n)&&t.push(cr?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};Xn.prototype.listeners=function(t){var r=cr?cr+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i{"use strict";"use restrict";var Ih=32;dn.INT_BITS=Ih;dn.INT_MAX=2147483647;dn.INT_MIN=-1<0)-(e<0)};dn.abs=function(e){var t=e>>Ih-1;return(e^t)-t};dn.min=function(e,t){return t^(e^t)&-(e65535)<<4,e>>>=t,r=(e>255)<<3,e>>>=r,t|=r,r=(e>15)<<2,e>>>=r,t|=r,r=(e>3)<<1,e>>>=r,t|=r,t|e>>1};dn.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0};dn.popCount=function(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24};function Fb(e){var t=32;return e&=-e,e&&t--,e&65535&&(t-=16),e&16711935&&(t-=8),e&252645135&&(t-=4),e&858993459&&(t-=2),e&1431655765&&(t-=1),t}dn.countTrailingZeros=Fb;dn.nextPow2=function(e){return e+=e===0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1};dn.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e-(e>>>1)};dn.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,e&=15,27030>>>e&1};var ll=new Array(256);(function(e){for(var t=0;t<256;++t){var r=t,n=t,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=r&1,--i;e[t]=n<>>8&255]<<16|ll[e>>>16&255]<<8|ll[e>>>24&255]};dn.interleave2=function(e,t){return e&=65535,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t&=65535,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1};dn.deinterleave2=function(e,t){return e=e>>>t&1431655765,e=(e|e>>>1)&858993459,e=(e|e>>>2)&252645135,e=(e|e>>>4)&16711935,e=(e|e>>>16)&65535,e<<16>>16};dn.interleave3=function(e,t,r){return e&=1023,e=(e|e<<16)&4278190335,e=(e|e<<8)&251719695,e=(e|e<<4)&3272356035,e=(e|e<<2)&1227133513,t&=1023,t=(t|t<<16)&4278190335,t=(t|t<<8)&251719695,t=(t|t<<4)&3272356035,t=(t|t<<2)&1227133513,e|=t<<1,r&=1023,r=(r|r<<16)&4278190335,r=(r|r<<8)&251719695,r=(r|r<<4)&3272356035,r=(r|r<<2)&1227133513,e|r<<2};dn.deinterleave3=function(e,t){return e=e>>>t&1227133513,e=(e|e>>>2)&3272356035,e=(e|e>>>4)&251719695,e=(e|e>>>8)&4278190335,e=(e|e>>>16)&1023,e<<22>>22};dn.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>Fb(e)+1}});var Ob=wn((lW,Ab)=>{"use strict";function Ib(e,t,r){var n=e[r]|0;if(n<=0)return[];var i=new Array(n),a;if(r===e.length-1)for(a=0;a0)return tO(e|0,t);break;case"object":if(typeof e.length=="number")return Ib(e,t,0);break}return[]}Ab.exports=nO});var eD={};Rf(eD,{Buffer:()=>fe,INSPECT_MAX_BYTES:()=>$b,SlowBuffer:()=>mO,isBuffer:()=>Qb,kMaxLength:()=>uO});function Hb(){Oh=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t0)throw new Error("Invalid string. Length must be a multiple of 4");a=e[s-2]==="="?2:e[s-1]==="="?1:0,o=new rO(s*3/4-a),n=a>0?s-4:s;var u=0;for(t=0,r=0;t>16&255,o[u++]=i>>8&255,o[u++]=i&255;return a===2?(i=Wr[e.charCodeAt(t)]<<2|Wr[e.charCodeAt(t+1)]>>4,o[u++]=i&255):a===1&&(i=Wr[e.charCodeAt(t)]<<10|Wr[e.charCodeAt(t+1)]<<4|Wr[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=i&255),o}function aO(e){return wi[e>>18&63]+wi[e>>12&63]+wi[e>>6&63]+wi[e&63]}function oO(e,t,r){for(var n,i=[],a=t;au?u:s+o));return n===1?(t=e[r-1],i+=wi[t>>2],i+=wi[t<<4&63],i+="=="):n===2&&(t=(e[r-2]<<8)+e[r-1],i+=wi[t>>10],i+=wi[t>>4&63],i+=wi[t<<2&63],i+="="),a.push(i),a.join("")}function Ku(e,t,r,n,i){var a,o,s=i*8-n-1,u=(1<>1,c=-7,d=r?i-1:0,m=r?-1:1,h=e[t+d];for(d+=m,a=h&(1<<-c)-1,h>>=-c,c+=s;c>0;a=a*256+e[t+d],d+=m,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=o*256+e[t+d],d+=m,c-=8);if(a===0)a=1-l;else{if(a===u)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-l}return(h?-1:1)*o*Math.pow(2,a-n)}function Bb(e,t,r,n,i,a){var o,s,u,l=a*8-i-1,c=(1<>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,g=n?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?t+=m/u:t+=m*Math.pow(2,1-d),t*u>=2&&(o++,u/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*u-1)*Math.pow(2,i),o=o+d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=s&255,h+=g,s/=256,i-=8);for(o=o<0;e[r+h]=o&255,h+=g,o/=256,l-=8);e[r+h-g]|=y*128}function Yu(){return fe.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Wi(e,t){if(Yu()=Yu())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yu().toString(16)+" bytes");return e|0}function mO(e){return+e!=e&&(e=0),fe.alloc(+e)}function bi(e){return!!(e!=null&&e._isBuffer)}function Yb(e,t){if(bi(e))return e.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var r=e.length;if(r===0)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return zu(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Zb(e).length;default:if(n)return zu(e).length;t=(""+t).toLowerCase(),n=!0}}function pO(e,t,r){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return xO(this,t,r);case"utf8":case"utf-8":return jb(this,t,r);case"ascii":return EO(this,t,r);case"latin1":case"binary":return kO(this,t,r);case"base64":return DO(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return CO(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Ga(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function zb(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=fe.from(t,n)),bi(t))return t.length===0?-1:Nb(e,t,r,n,i);if(typeof t=="number")return t=t&255,fe.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Nb(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Nb(e,t,r,n,i){var a=1,o=e.length,s=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,r/=2}function u(h,g){return a===1?h[g]:h.readUInt16BE(g*a)}var l;if(i){var c=-1;for(l=r;lo&&(r=o-s),l=r;l>=0;l--){for(var d=!0,m=0;mi&&(n=i)):n=i;var a=t.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(i+s<=r){var u,l,c,d;switch(s){case 1:a<128&&(o=a);break;case 2:u=e[i+1],(u&192)===128&&(d=(a&31)<<6|u&63,d>127&&(o=d));break;case 3:u=e[i+1],l=e[i+2],(u&192)===128&&(l&192)===128&&(d=(a&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(d=(a&15)<<18|(u&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=s}return SO(n)}function SO(e){var t=e.length;if(t<=Rb)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function gr(e,t,r,n,i,a){if(!bi(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function ju(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i>>(n?i:1-i)*8}function qu(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i>>(n?i:3-i)*8&255}function qb(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Gb(e,t,r,n,i){return i||qb(e,t,r,4),Bb(e,t,r,n,23,4),r+4}function Jb(e,t,r,n,i){return i||qb(e,t,r,8),Bb(e,t,r,n,52,8),r+8}function MO(e){if(e=TO(e).replace(_O,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function TO(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function FO(e){return e<16?"0"+e.toString(16):e.toString(16)}function zu(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function IO(e){for(var t=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function Zb(e){return iO(MO(e))}function Gu(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function OO(e){return e!==e}function Qb(e){return e!=null&&(!!e._isBuffer||Xb(e)||LO(e))}function Xb(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function LO(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&Xb(e.slice(0,0))}var wi,Wr,rO,Oh,sO,Vb,$b,Pb,lO,uO,Rb,_O,tD=hF(()=>{wi=[],Wr=[],rO=typeof Uint8Array!="undefined"?Uint8Array:Array,Oh=!1;sO={}.toString,Vb=Array.isArray||function(e){return sO.call(e)=="[object Array]"};$b=50,Pb=window;fe.TYPED_ARRAY_SUPPORT=Pb.TYPED_ARRAY_SUPPORT!==void 0?Pb.TYPED_ARRAY_SUPPORT:!0;lO=Yu(),uO=lO;fe.poolSize=8192;fe._augment=function(e){return e.__proto__=fe.prototype,e};fe.from=function(e,t,r){return Ub(null,e,t,r)};fe.TYPED_ARRAY_SUPPORT&&(fe.prototype.__proto__=Uint8Array.prototype,fe.__proto__=Uint8Array);fe.alloc=function(e,t,r){return cO(null,e,t,r)};fe.allocUnsafe=function(e){return Lh(null,e)};fe.allocUnsafeSlow=function(e){return Lh(null,e)};fe.isBuffer=Qb;fe.compare=function(t,r){if(!bi(t)||!bi(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,i=r.length,a=0,o=Math.min(n,i);a0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""};fe.prototype.compare=function(t,r,n,i,a){if(!bi(t))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===t)return 0;for(var o=a-i,s=n-r,u=Math.min(o,s),l=this.slice(i,a),c=t.slice(r,n),d=0;da)&&(n=a),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return gO(this,t,r,n);case"utf8":case"utf-8":return yO(this,t,r,n);case"ascii":return Kb(this,t,r,n);case"latin1":case"binary":return vO(this,t,r,n);case"base64":return wO(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bO(this,t,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};fe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Rb=4096;fe.prototype.slice=function(t,r){var n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r0&&(a*=256);)i+=this[t+--r]*a;return i};fe.prototype.readUInt8=function(t,r){return r||Pn(t,1,this.length),this[t]};fe.prototype.readUInt16LE=function(t,r){return r||Pn(t,2,this.length),this[t]|this[t+1]<<8};fe.prototype.readUInt16BE=function(t,r){return r||Pn(t,2,this.length),this[t]<<8|this[t+1]};fe.prototype.readUInt32LE=function(t,r){return r||Pn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};fe.prototype.readUInt32BE=function(t,r){return r||Pn(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};fe.prototype.readIntLE=function(t,r,n){t=t|0,r=r|0,n||Pn(t,r,this.length);for(var i=this[t],a=1,o=0;++o=a&&(i-=Math.pow(2,8*r)),i};fe.prototype.readIntBE=function(t,r,n){t=t|0,r=r|0,n||Pn(t,r,this.length);for(var i=r,a=1,o=this[t+--i];i>0&&(a*=256);)o+=this[t+--i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*r)),o};fe.prototype.readInt8=function(t,r){return r||Pn(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};fe.prototype.readInt16LE=function(t,r){r||Pn(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};fe.prototype.readInt16BE=function(t,r){r||Pn(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};fe.prototype.readInt32LE=function(t,r){return r||Pn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};fe.prototype.readInt32BE=function(t,r){return r||Pn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};fe.prototype.readFloatLE=function(t,r){return r||Pn(t,4,this.length),Ku(this,t,!0,23,4)};fe.prototype.readFloatBE=function(t,r){return r||Pn(t,4,this.length),Ku(this,t,!1,23,4)};fe.prototype.readDoubleLE=function(t,r){return r||Pn(t,8,this.length),Ku(this,t,!0,52,8)};fe.prototype.readDoubleBE=function(t,r){return r||Pn(t,8,this.length),Ku(this,t,!1,52,8)};fe.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r|0,n=n|0,!i){var a=Math.pow(2,8*n)-1;gr(this,t,r,n,a,0)}var o=1,s=0;for(this[r]=t&255;++s=0&&(s*=256);)this[r+o]=t/s&255;return r+n};fe.prototype.writeUInt8=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,1,255,0),fe.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=t&255,r+1};fe.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,2,65535,0),fe.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8):ju(this,t,r,!0),r+2};fe.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,2,65535,0),fe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=t&255):ju(this,t,r,!1),r+2};fe.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,4,4294967295,0),fe.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255):qu(this,t,r,!0),r+4};fe.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,4,4294967295,0),fe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255):qu(this,t,r,!1),r+4};fe.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r|0,!i){var a=Math.pow(2,8*n-1);gr(this,t,r,n,a-1,-a)}var o=0,s=1,u=0;for(this[r]=t&255;++o>0)-u&255;return r+n};fe.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r|0,!i){var a=Math.pow(2,8*n-1);gr(this,t,r,n,a-1,-a)}var o=n-1,s=1,u=0;for(this[r+o]=t&255;--o>=0&&(s*=256);)t<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(t/s>>0)-u&255;return r+n};fe.prototype.writeInt8=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,1,127,-128),fe.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=t&255,r+1};fe.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,2,32767,-32768),fe.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8):ju(this,t,r,!0),r+2};fe.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,2,32767,-32768),fe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=t&255):ju(this,t,r,!1),r+2};fe.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,4,2147483647,-2147483648),fe.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):qu(this,t,r,!0),r+4};fe.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r|0,n||gr(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),fe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255):qu(this,t,r,!1),r+4};fe.prototype.writeFloatLE=function(t,r,n){return Gb(this,t,r,!0,n)};fe.prototype.writeFloatBE=function(t,r,n){return Gb(this,t,r,!1,n)};fe.prototype.writeDoubleLE=function(t,r,n){return Jb(this,t,r,!0,n)};fe.prototype.writeDoubleBE=function(t,r,n){return Jb(this,t,r,!1,n)};fe.prototype.copy=function(t,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(a<1e3||!fe.TYPED_ARRAY_SUPPORT)for(o=0;o>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var o;if(typeof t=="number")for(o=r;o{var Ja=(tD(),ov(eD));if(Ja&&Ja.default){Ju.exports=Ja.default;for(let e in Ja)Ju.exports[e]=Ja[e]}else Ja&&(Ju.exports=Ja)});var Xu=wn(bt=>{"use strict";var pa=Wu(),Wn=Ob(),rD=nD().Buffer;window.__TYPEDARRAY_POOL||(window.__TYPEDARRAY_POOL={UINT8:Wn([32,0]),UINT16:Wn([32,0]),UINT32:Wn([32,0]),BIGUINT64:Wn([32,0]),INT8:Wn([32,0]),INT16:Wn([32,0]),INT32:Wn([32,0]),BIGINT64:Wn([32,0]),FLOAT:Wn([32,0]),DOUBLE:Wn([32,0]),DATA:Wn([32,0]),UINT8C:Wn([32,0]),BUFFER:Wn([32,0])});var PO=typeof Uint8ClampedArray!="undefined",NO=typeof BigUint64Array!="undefined",RO=typeof BigInt64Array!="undefined",Sn=window.__TYPEDARRAY_POOL;Sn.UINT8C||(Sn.UINT8C=Wn([32,0]));Sn.BIGUINT64||(Sn.BIGUINT64=Wn([32,0]));Sn.BIGINT64||(Sn.BIGINT64=Wn([32,0]));Sn.BUFFER||(Sn.BUFFER=Wn([32,0]));var Zu=Sn.DATA,Qu=Sn.BUFFER;bt.free=function(t){if(rD.isBuffer(t))Qu[pa.log2(t.length)].push(t);else{if(Object.prototype.toString.call(t)!=="[object ArrayBuffer]"&&(t=t.buffer),!t)return;var r=t.length||t.byteLength,n=pa.log2(r)|0;Zu[n].push(t)}};function iD(e){if(e){var t=e.length||e.byteLength,r=pa.log2(t);Zu[r].push(e)}}function HO(e){iD(e.buffer)}bt.freeUint8=bt.freeUint16=bt.freeUint32=bt.freeBigUint64=bt.freeInt8=bt.freeInt16=bt.freeInt32=bt.freeBigInt64=bt.freeFloat32=bt.freeFloat=bt.freeFloat64=bt.freeDouble=bt.freeUint8Clamped=bt.freeDataView=HO;bt.freeArrayBuffer=iD;bt.freeBuffer=function(t){Qu[pa.log2(t.length)].push(t)};bt.malloc=function(t,r){if(r===void 0||r==="arraybuffer")return yr(t);switch(r){case"uint8":return Nh(t);case"uint16":return aD(t);case"uint32":return oD(t);case"int8":return sD(t);case"int16":return lD(t);case"int32":return uD(t);case"float":case"float32":return cD(t);case"double":case"float64":return dD(t);case"uint8_clamped":return fD(t);case"bigint64":return mD(t);case"biguint64":return hD(t);case"buffer":return gD(t);case"data":case"dataview":return pD(t);default:return null}return null};function yr(t){var t=pa.nextPow2(t),r=pa.log2(t),n=Zu[r];return n.length>0?n.pop():new ArrayBuffer(t)}bt.mallocArrayBuffer=yr;function Nh(e){return new Uint8Array(yr(e),0,e)}bt.mallocUint8=Nh;function aD(e){return new Uint16Array(yr(2*e),0,e)}bt.mallocUint16=aD;function oD(e){return new Uint32Array(yr(4*e),0,e)}bt.mallocUint32=oD;function sD(e){return new Int8Array(yr(e),0,e)}bt.mallocInt8=sD;function lD(e){return new Int16Array(yr(2*e),0,e)}bt.mallocInt16=lD;function uD(e){return new Int32Array(yr(4*e),0,e)}bt.mallocInt32=uD;function cD(e){return new Float32Array(yr(4*e),0,e)}bt.mallocFloat32=bt.mallocFloat=cD;function dD(e){return new Float64Array(yr(8*e),0,e)}bt.mallocFloat64=bt.mallocDouble=dD;function fD(e){return PO?new Uint8ClampedArray(yr(e),0,e):Nh(e)}bt.mallocUint8Clamped=fD;function hD(e){return NO?new BigUint64Array(yr(8*e),0,e):null}bt.mallocBigUint64=hD;function mD(e){return RO?new BigInt64Array(yr(8*e),0,e):null}bt.mallocBigInt64=mD;function pD(e){return new DataView(yr(e),0,e)}bt.mallocDataView=pD;function gD(e){e=pa.nextPow2(e);var t=pa.log2(e),r=Qu[t];return r.length>0?r.pop():new rD(e)}bt.mallocBuffer=gD;bt.clearCache=function(){for(var t=0;t<32;++t)Sn.UINT8[t].length=0,Sn.UINT16[t].length=0,Sn.UINT32[t].length=0,Sn.INT8[t].length=0,Sn.INT16[t].length=0,Sn.INT32[t].length=0,Sn.FLOAT[t].length=0,Sn.DOUBLE[t].length=0,Sn.BIGUINT64[t].length=0,Sn.BIGINT64[t].length=0,Sn.UINT8C[t].length=0,Zu[t].length=0,Qu[t].length=0}});var DD=wn((dW,bD)=>{"use strict";bD.exports=BO;var tc=32;function BO(e,t){t<=4*tc?nc(0,t-1,e):rc(0,t-1,e)}function nc(e,t,r){for(var n=2*(e+1),i=e+1;i<=t;++i){for(var a=r[n++],o=r[n++],s=i,u=n-2;s-- >e;){var l=r[u-2],c=r[u-1];if(lr[t+1]:!0}function ec(e,t,r,n){e*=2;var i=n[e];return i>1,s=o-n,u=o+n,l=i,c=s,d=o,m=u,h=a,g=e+1,y=t-1,v=0;Yi(l,c,r)&&(v=l,l=c,c=v),Yi(m,h,r)&&(v=m,m=h,h=v),Yi(l,d,r)&&(v=l,l=d,d=v),Yi(c,d,r)&&(v=c,c=d,d=v),Yi(l,m,r)&&(v=l,l=m,m=v),Yi(d,m,r)&&(v=d,d=m,m=v),Yi(c,h,r)&&(v=c,c=h,h=v),Yi(c,d,r)&&(v=c,c=d,d=v),Yi(m,h,r)&&(v=m,m=h,h=v);for(var D=r[2*c],I=r[2*c+1],C=r[2*m],x=r[2*m+1],O=2*l,A=2*d,P=2*h,B=2*i,G=2*o,J=2*a,Q=0;Q<2;++Q){var oe=r[O+Q],te=r[A+Q],re=r[P+Q];r[B+Q]=oe,r[G+Q]=te,r[J+Q]=re}vD(s,e,r),vD(u,t,r);for(var ne=g;ne<=y;++ne)if(ec(ne,D,I,r))ne!==g&&yD(ne,g,r),++g;else if(!ec(ne,C,x,r))for(;;)if(ec(y,C,x,r)){ec(y,D,I,r)?(VO(ne,g,y,r),++g,--y):(yD(ne,y,r),--y);break}else{if(--y{"use strict";SD.exports={init:UO,sweepBipartite:WO,sweepComplete:YO,scanBipartite:zO,scanComplete:KO};var En=Xu(),$O=Wu(),ic=DD(),Fr=1<<28,Qa=1024,Yn=En.mallocInt32(Qa),zi=En.mallocInt32(Qa),Ki=En.mallocInt32(Qa),Za=En.mallocInt32(Qa),Uo=En.mallocInt32(Qa),ul=En.mallocInt32(Qa),dt=En.mallocDouble(Qa*8);function UO(e){var t=$O.nextPow2(e);Yn.length>>1;ic(dt,I);for(var C=0,x=0,g=0;g=Fr)O=O-Fr|0,Wo(Ki,Za,x--,O);else if(O>=0)Wo(Yn,zi,C--,O);else if(O<=-Fr){O=-O-Fr|0;for(var A=0;A>>1;ic(dt,I);for(var C=0,x=0,O=0,g=0;g>1===dt[2*g+3]>>1&&(P=2,g+=1),A<0){for(var B=-(A>>1)-1,G=0;G>1)-1;P===0?Wo(Yn,zi,C--,B):P===1?Wo(Ki,Za,x--,B):P===2&&Wo(Uo,ul,O--,B)}}}function zO(e,t,r,n,i,a,o,s,u,l,c,d){var m=0,h=2*e,g=t,y=t+e,v=1,D=1;n?D=Fr:v=Fr;for(var I=i;I>>1;ic(dt,A);for(var P=0,I=0;I=Fr?(G=!n,C-=Fr):(G=!!n,C-=1),G)Yo(Yn,zi,P++,C);else{var J=d[C],Q=h*C,oe=c[Q+t+1],te=c[Q+t+1+e];e:for(var re=0;re>>1;ic(dt,C);for(var x=0,y=0;y=Fr)Yn[x++]=v-Fr;else{v-=1;var A=c[v],P=m*v,B=l[P+t+1],G=l[P+t+1+e];e:for(var J=0;J=0;--J)if(Yn[J]===v){for(var re=J+1;re{"use strict";var Xa="d",jo="ax",ED="vv",Hh="fp",cl="es",ac="rs",Uh="re",dl="rb",kD="ri",zo="rp",oc="bs",Wh="be",fl="bb",xD="bi",Ko="bp",Bh="rv",Vh="Q",$h=[Xa,jo,ED,ac,Uh,dl,kD,oc,Wh,fl,xD];function jO(e,t,r){var n="bruteForce"+(e?"Red":"Blue")+(t?"Flip":"")+(r?"Full":""),i=["function ",n,"(",$h.join(),"){","var ",cl,"=2*",Xa,";"],a="for(var i="+ac+","+zo+"="+cl+"*"+ac+";i<"+Uh+";++i,"+zo+"+="+cl+"){var x0="+dl+"["+jo+"+"+zo+"],x1="+dl+"["+jo+"+"+zo+"+"+Xa+"],xi="+kD+"[i];",o="for(var j="+oc+","+Ko+"="+cl+"*"+oc+";j<"+Wh+";++j,"+Ko+"+="+cl+"){var y0="+fl+"["+jo+"+"+Ko+"],"+(r?"y1="+fl+"["+jo+"+"+Ko+"+"+Xa+"],":"")+"yi="+xD+"[j];";return e?i.push(a,Vh,":",o):i.push(o,Vh,":",a),r?i.push("if(y1"+Wh+"-"+oc+"){"),e?(a(!0,!1),i.push("}else{"),a(!1,!1)):(i.push("if("+Hh+"){"),a(!0,!0),i.push("}else{"),a(!0,!1),i.push("}}else{if("+Hh+"){"),a(!1,!0),i.push("}else{"),a(!1,!1),i.push("}")),i.push("}}return "+t);var o=r.join("")+i.join(""),s=new Function(o);return s()}Yh.partial=CD(!1);Yh.full=CD(!0)});var zh=wn((mW,MD)=>{"use strict";MD.exports=GO;var qO="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m";function GO(e,t){var r="abcdef".split("").concat(t),n=[];return e.indexOf("lo")>=0&&n.push("lo=e[k+n]"),e.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(qO.replace("_",n.join()).replace("$",e)),Function.apply(void 0,r)}});var ID=wn((pW,FD)=>{"use strict";FD.exports=XO;var JO=zh(),TD=JO("lor&&i[d+t]>l;--c,d-=o){for(var m=d,h=d+o,g=0;g>>1,l=2*e,c=u,d=i[l*u+t];o=v?(c=y,d=v):g>=I?(c=h,d=g):(c=D,d=I):v>=I?(c=y,d=v):I>=g?(c=h,d=g):(c=D,d=I);for(var O=l*(s-1),A=l*c,C=0;C{"use strict";RD.exports=fL;var qo=Xu(),Kh=Wu(),PD=_D(),eL=PD.partial,tL=PD.full,ga=Rh(),nL=ID(),Go=zh(),AD=128,rL=1<<22,iL=1<<22,aL=Go("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),OD=Go("lo===p0",["p0"]),oL=Go("lo0;){l-=1;var m=l*jh,h=dr[m],g=dr[m+1],y=dr[m+2],v=dr[m+3],D=dr[m+4],I=dr[m+5],C=l*qh,x=eo[C],O=eo[C+1],A=I&1,P=!!(I&16),B=i,G=a,J=s,Q=u;if(A&&(B=s,G=u,J=i,Q=a),!(I&2&&(y=oL(e,h,g,y,B,G,O),g>=y))&&!(I&4&&(g=sL(e,h,g,y,B,G,x),g>=y))){var oe=y-g,te=D-v;if(P){if(e*oe*(oe+te){"use strict";$D.exports=yL;var ya=Xu(),sc=Rh(),hL=HD();function mL(e,t){for(var r=0;r>>1;if(!(o<=0)){var s,u=ya.mallocDouble(2*o*i),l=ya.mallocInt32(i);if(i=BD(e,o,u,l),i>0){if(o===1&&n)sc.init(i),s=sc.sweepComplete(o,r,0,i,u,l,0,i,u,l);else{var c=ya.mallocDouble(2*o*a),d=ya.mallocInt32(a);a=BD(t,o,c,d),a>0&&(sc.init(i+a),o===1?s=sc.sweepBipartite(o,r,0,i,u,l,0,a,c,d):s=hL(o,r,n,i,u,l,a,c,d),ya.free(c),ya.free(d))}ya.free(u),ya.free(l)}return s}}}var hl;function VD(e,t){hl.push([e,t])}function pL(e){return hl=[],lc(e,e,VD,!0),hl}function gL(e,t){return hl=[],lc(e,t,VD,!1),hl}function yL(e,t,r){var n;switch(arguments.length){case 1:return pL(e);case 2:return typeof t=="function"?lc(e,e,t,!0):gL(e,t);case 3:return lc(e,t,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}});var o0=wn(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});var on=require("obsidian"),Zh="YYYY-MM-DD",Qh="gggg-[W]ww",jD="YYYY-MM",qD="YYYY-[Q]Q",GD="YYYY";function pl(e){var r,n;let t=window.app.plugins.getPlugin("periodic-notes");return t&&((n=(r=t.settings)==null?void 0:r[e])==null?void 0:n.enabled)}function gl(){var e,t,r,n;try{let{internalPlugins:i,plugins:a}=window.app;if(pl("daily")){let{format:l,folder:c,template:d}=((t=(e=a.getPlugin("periodic-notes"))==null?void 0:e.settings)==null?void 0:t.daily)||{};return{format:l||Zh,folder:(c==null?void 0:c.trim())||"",template:(d==null?void 0:d.trim())||""}}let{folder:o,format:s,template:u}=((n=(r=i.getPluginById("daily-notes"))==null?void 0:r.instance)==null?void 0:n.options)||{};return{format:s||Zh,folder:(o==null?void 0:o.trim())||"",template:(u==null?void 0:u.trim())||""}}catch(i){console.info("No custom daily note settings found!",i)}}function yl(){var e,t,r,n,i,a,o;try{let s=window.app.plugins,u=(e=s.getPlugin("calendar"))==null?void 0:e.options,l=(r=(t=s.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:r.weekly;if(pl("weekly"))return{format:l.format||Qh,folder:((n=l.folder)==null?void 0:n.trim())||"",template:((i=l.template)==null?void 0:i.trim())||""};let c=u||{};return{format:c.weeklyNoteFormat||Qh,folder:((a=c.weeklyNoteFolder)==null?void 0:a.trim())||"",template:((o=c.weeklyNoteTemplate)==null?void 0:o.trim())||""}}catch(s){console.info("No custom weekly note settings found!",s)}}function vl(){var t,r,n,i;let e=window.app.plugins;try{let a=pl("monthly")&&((r=(t=e.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:r.monthly)||{};return{format:a.format||jD,folder:((n=a.folder)==null?void 0:n.trim())||"",template:((i=a.template)==null?void 0:i.trim())||""}}catch(a){console.info("No custom monthly note settings found!",a)}}function wl(){var t,r,n,i;let e=window.app.plugins;try{let a=pl("quarterly")&&((r=(t=e.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:r.quarterly)||{};return{format:a.format||qD,folder:((n=a.folder)==null?void 0:n.trim())||"",template:((i=a.template)==null?void 0:i.trim())||""}}catch(a){console.info("No custom quarterly note settings found!",a)}}function bl(){var t,r,n,i;let e=window.app.plugins;try{let a=pl("yearly")&&((r=(t=e.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:r.yearly)||{};return{format:a.format||GD,folder:((n=a.folder)==null?void 0:n.trim())||"",template:((i=a.template)==null?void 0:i.trim())||""}}catch(a){console.info("No custom yearly note settings found!",a)}}function JD(...e){let t=[];for(let n=0,i=e.length;n{let I=n(),C=e.clone().set({hour:I.get("hour"),minute:I.get("minute"),second:I.get("second")});return g&&C.add(parseInt(y,10),v),D?C.format(D.substring(1).trim()):C.format(a)}).replace(/{{\s*yesterday\s*}}/gi,e.clone().subtract(1,"day").format(a)).replace(/{{\s*tomorrow\s*}}/gi,e.clone().add(1,"d").format(a)));return t.foldManager.save(d,u),d}catch(d){console.error(`Failed to create file: '${c}'`,d),new on.Notice("Unable to create new file.")}}function AL(e,t){var r;return(r=t[ni(e,"day")])!=null?r:null}function OL(){let{vault:e}=window.app,{folder:t}=gl(),r=e.getAbstractFileByPath(on.normalizePath(t));if(!r)throw new Xh("Failed to find daily notes folder");let n={};return on.Vault.recurseChildren(r,i=>{if(i instanceof on.TFile){let a=Zo(i,"day");if(a){let o=ni(a,"day");n[o]=i}}}),n}var em=class extends Error{};function LL(){let{moment:e}=window,t=e.localeData()._week.dow,r=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];for(;t;)r.push(r.shift()),t--;return r}function PL(e){return LL().indexOf(e.toLowerCase())}async function e0(e){let{vault:t}=window.app,{template:r,format:n,folder:i}=yl(),[a,o]=await Jo(r),s=e.format(n),u=await Dl(i,s);try{let l=await t.create(u,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(c,d,m,h,g,y)=>{let v=window.moment(),D=e.clone().set({hour:v.get("hour"),minute:v.get("minute"),second:v.get("second")});return m&&D.add(parseInt(h,10),g),y?D.format(y.substring(1).trim()):D.format(n)}).replace(/{{\s*title\s*}}/gi,s).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*(sunday|monday|tuesday|wednesday|thursday|friday|saturday)\s*:(.*?)}}/gi,(c,d,m)=>{let h=PL(d);return e.weekday(h).format(m.trim())}));return window.app.foldManager.save(l,o),l}catch(l){console.error(`Failed to create file: '${u}'`,l),new on.Notice("Unable to create new file.")}}function NL(e,t){var r;return(r=t[ni(e,"week")])!=null?r:null}function RL(){let e={};if(!n0())return e;let{vault:t}=window.app,{folder:r}=yl(),n=t.getAbstractFileByPath(on.normalizePath(r));if(!n)throw new em("Failed to find weekly notes folder");return on.Vault.recurseChildren(n,i=>{if(i instanceof on.TFile){let a=Zo(i,"week");if(a){let o=ni(a,"week");e[o]=i}}}),e}var tm=class extends Error{};async function t0(e){let{vault:t}=window.app,{template:r,format:n,folder:i}=vl(),[a,o]=await Jo(r),s=e.format(n),u=await Dl(i,s);try{let l=await t.create(u,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(c,d,m,h,g,y)=>{let v=window.moment(),D=e.clone().set({hour:v.get("hour"),minute:v.get("minute"),second:v.get("second")});return m&&D.add(parseInt(h,10),g),y?D.format(y.substring(1).trim()):D.format(n)}).replace(/{{\s*date\s*}}/gi,s).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,s));return window.app.foldManager.save(l,o),l}catch(l){console.error(`Failed to create file: '${u}'`,l),new on.Notice("Unable to create new file.")}}function HL(e,t){var r;return(r=t[ni(e,"month")])!=null?r:null}function BL(){let e={};if(!r0())return e;let{vault:t}=window.app,{folder:r}=vl(),n=t.getAbstractFileByPath(on.normalizePath(r));if(!n)throw new tm("Failed to find monthly notes folder");return on.Vault.recurseChildren(n,i=>{if(i instanceof on.TFile){let a=Zo(i,"month");if(a){let o=ni(a,"month");e[o]=i}}}),e}var nm=class extends Error{};async function VL(e){let{vault:t}=window.app,{template:r,format:n,folder:i}=wl(),[a,o]=await Jo(r),s=e.format(n),u=await Dl(i,s);try{let l=await t.create(u,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(c,d,m,h,g,y)=>{let v=window.moment(),D=e.clone().set({hour:v.get("hour"),minute:v.get("minute"),second:v.get("second")});return m&&D.add(parseInt(h,10),g),y?D.format(y.substring(1).trim()):D.format(n)}).replace(/{{\s*date\s*}}/gi,s).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,s));return window.app.foldManager.save(l,o),l}catch(l){console.error(`Failed to create file: '${u}'`,l),new on.Notice("Unable to create new file.")}}function $L(e,t){var r;return(r=t[ni(e,"quarter")])!=null?r:null}function UL(){let e={};if(!i0())return e;let{vault:t}=window.app,{folder:r}=wl(),n=t.getAbstractFileByPath(on.normalizePath(r));if(!n)throw new nm("Failed to find quarterly notes folder");return on.Vault.recurseChildren(n,i=>{if(i instanceof on.TFile){let a=Zo(i,"quarter");if(a){let o=ni(a,"quarter");e[o]=i}}}),e}var rm=class extends Error{};async function WL(e){let{vault:t}=window.app,{template:r,format:n,folder:i}=bl(),[a,o]=await Jo(r),s=e.format(n),u=await Dl(i,s);try{let l=await t.create(u,a.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(c,d,m,h,g,y)=>{let v=window.moment(),D=e.clone().set({hour:v.get("hour"),minute:v.get("minute"),second:v.get("second")});return m&&D.add(parseInt(h,10),g),y?D.format(y.substring(1).trim()):D.format(n)}).replace(/{{\s*date\s*}}/gi,s).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,s));return window.app.foldManager.save(l,o),l}catch(l){console.error(`Failed to create file: '${u}'`,l),new on.Notice("Unable to create new file.")}}function YL(e,t){var r;return(r=t[ni(e,"year")])!=null?r:null}function zL(){let e={};if(!a0())return e;let{vault:t}=window.app,{folder:r}=bl(),n=t.getAbstractFileByPath(on.normalizePath(r));if(!n)throw new rm("Failed to find yearly notes folder");return on.Vault.recurseChildren(n,i=>{if(i instanceof on.TFile){let a=Zo(i,"year");if(a){let o=ni(a,"year");e[o]=i}}}),e}function KL(){var n,i;let{app:e}=window,t=e.internalPlugins.plugins["daily-notes"];if(t&&t.enabled)return!0;let r=e.plugins.getPlugin("periodic-notes");return r&&((i=(n=r.settings)==null?void 0:n.daily)==null?void 0:i.enabled)}function n0(){var r,n;let{app:e}=window;if(e.plugins.getPlugin("calendar"))return!0;let t=e.plugins.getPlugin("periodic-notes");return t&&((n=(r=t.settings)==null?void 0:r.weekly)==null?void 0:n.enabled)}function r0(){var r,n;let{app:e}=window,t=e.plugins.getPlugin("periodic-notes");return t&&((n=(r=t.settings)==null?void 0:r.monthly)==null?void 0:n.enabled)}function i0(){var r,n;let{app:e}=window,t=e.plugins.getPlugin("periodic-notes");return t&&((n=(r=t.settings)==null?void 0:r.quarterly)==null?void 0:n.enabled)}function a0(){var r,n;let{app:e}=window,t=e.plugins.getPlugin("periodic-notes");return t&&((n=(r=t.settings)==null?void 0:r.yearly)==null?void 0:n.enabled)}function jL(e){let t={day:gl,week:yl,month:vl,quarter:wl,year:bl}[e];return t()}function qL(e,t){return{day:XD,month:t0,week:e0}[e](t)}gt.DEFAULT_DAILY_NOTE_FORMAT=Zh;gt.DEFAULT_MONTHLY_NOTE_FORMAT=jD;gt.DEFAULT_QUARTERLY_NOTE_FORMAT=qD;gt.DEFAULT_WEEKLY_NOTE_FORMAT=Qh;gt.DEFAULT_YEARLY_NOTE_FORMAT=GD;gt.appHasDailyNotesPluginLoaded=KL;gt.appHasMonthlyNotesPluginLoaded=r0;gt.appHasQuarterlyNotesPluginLoaded=i0;gt.appHasWeeklyNotesPluginLoaded=n0;gt.appHasYearlyNotesPluginLoaded=a0;gt.createDailyNote=XD;gt.createMonthlyNote=t0;gt.createPeriodicNote=qL;gt.createQuarterlyNote=VL;gt.createWeeklyNote=e0;gt.createYearlyNote=WL;gt.getAllDailyNotes=OL;gt.getAllMonthlyNotes=BL;gt.getAllQuarterlyNotes=UL;gt.getAllWeeklyNotes=RL;gt.getAllYearlyNotes=zL;gt.getDailyNote=AL;gt.getDailyNoteSettings=gl;gt.getDateFromFile=Zo;gt.getDateFromPath=IL;gt.getDateUID=ni;gt.getMonthlyNote=HL;gt.getMonthlyNoteSettings=vl;gt.getPeriodicNoteSettings=jL;gt.getQuarterlyNote=$L;gt.getQuarterlyNoteSettings=wl;gt.getTemplateInfo=Jo;gt.getWeeklyNote=NL;gt.getWeeklyNoteSettings=yl;gt.getYearlyNote=YL;gt.getYearlyNoteSettings=bl});var Ic=wn(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});require("obsidian");var qi=class extends Error{},fm=class extends qi{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}},hm=class extends qi{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}},mm=class extends qi{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}},ro=class extends qi{},yc=class extends qi{constructor(t){super(`Invalid unit ${t}`)}},vr=class extends qi{},Di=class extends qi{constructor(){super("Zone is an abstract class")}},_e="numeric",oi="short",Or="long",vc={year:_e,month:_e,day:_e},H0={year:_e,month:oi,day:_e},GL={year:_e,month:oi,day:_e,weekday:oi},B0={year:_e,month:Or,day:_e},V0={year:_e,month:Or,day:_e,weekday:Or},$0={hour:_e,minute:_e},U0={hour:_e,minute:_e,second:_e},W0={hour:_e,minute:_e,second:_e,timeZoneName:oi},Y0={hour:_e,minute:_e,second:_e,timeZoneName:Or},z0={hour:_e,minute:_e,hourCycle:"h23"},K0={hour:_e,minute:_e,second:_e,hourCycle:"h23"},j0={hour:_e,minute:_e,second:_e,hourCycle:"h23",timeZoneName:oi},q0={hour:_e,minute:_e,second:_e,hourCycle:"h23",timeZoneName:Or},G0={year:_e,month:_e,day:_e,hour:_e,minute:_e},J0={year:_e,month:_e,day:_e,hour:_e,minute:_e,second:_e},Z0={year:_e,month:oi,day:_e,hour:_e,minute:_e},Q0={year:_e,month:oi,day:_e,hour:_e,minute:_e,second:_e},JL={year:_e,month:oi,day:_e,weekday:oi,hour:_e,minute:_e},X0={year:_e,month:Or,day:_e,hour:_e,minute:_e,timeZoneName:oi},eS={year:_e,month:Or,day:_e,hour:_e,minute:_e,second:_e,timeZoneName:oi},tS={year:_e,month:Or,day:_e,weekday:Or,hour:_e,minute:_e,timeZoneName:Or},nS={year:_e,month:Or,day:_e,weekday:Or,hour:_e,minute:_e,second:_e,timeZoneName:Or},oo=class{get type(){throw new Di}get name(){throw new Di}get ianaName(){return this.name}get isUniversal(){throw new Di}offsetName(t,r){throw new Di}formatOffset(t,r){throw new Di}offset(t){throw new Di}equals(t){throw new Di}get isValid(){throw new Di}},im=null,wc=class e extends oo{static get instance(){return im===null&&(im=new e),im}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return iS(t,r,n)}formatOffset(t,r){return _l(this.offset(t),r)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}},pc={};function ZL(e){return pc[e]||(pc[e]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),pc[e]}var QL={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function XL(e,t){let r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,a,o,s,u,l,c]=n;return[o,i,a,s,u,l,c]}function e2(e,t){let r=e.formatToParts(t),n=[];for(let i=0;i=0?g:1e3+g,(m-h)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}},s0={};function t2(e,t={}){let r=JSON.stringify([e,t]),n=s0[r];return n||(n=new Intl.ListFormat(e,t),s0[r]=n),n}var pm={};function gm(e,t={}){let r=JSON.stringify([e,t]),n=pm[r];return n||(n=new Intl.DateTimeFormat(e,t),pm[r]=n),n}var ym={};function n2(e,t={}){let r=JSON.stringify([e,t]),n=ym[r];return n||(n=new Intl.NumberFormat(e,t),ym[r]=n),n}var vm={};function r2(e,t={}){let{base:r,...n}=t,i=JSON.stringify([e,n]),a=vm[i];return a||(a=new Intl.RelativeTimeFormat(e,t),vm[i]=a),a}var xl=null;function i2(){return xl||(xl=new Intl.DateTimeFormat().resolvedOptions().locale,xl)}function a2(e){let t=e.indexOf("-x-");t!==-1&&(e=e.substring(0,t));let r=e.indexOf("-u-");if(r===-1)return[e];{let n,i;try{n=gm(e).resolvedOptions(),i=e}catch(s){let u=e.substring(0,r);n=gm(u).resolvedOptions(),i=u}let{numberingSystem:a,calendar:o}=n;return[i,a,o]}}function o2(e,t,r){return(r||t)&&(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`)),e}function s2(e){let t=[];for(let r=1;r<=12;r++){let n=mt.utc(2009,r,1);t.push(e(n))}return t}function l2(e){let t=[];for(let r=1;r<=7;r++){let n=mt.utc(2016,11,13+r);t.push(e(n))}return t}function cc(e,t,r,n){let i=e.listingMode();return i==="error"?null:i==="en"?r(t):n(t)}function u2(e){return e.numberingSystem&&e.numberingSystem!=="latn"?!1:e.numberingSystem==="latn"||!e.locale||e.locale.startsWith("en")||new Intl.DateTimeFormat(e.intl).resolvedOptions().numberingSystem==="latn"}var wm=class{constructor(t,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:a,...o}=n;if(!r||Object.keys(o).length>0){let s={useGrouping:!1,...n};n.padTo>0&&(s.minimumIntegerDigits=n.padTo),this.inf=n2(t,s)}}format(t){if(this.inf){let r=this.floor?Math.floor(t):t;return this.inf.format(r)}else{let r=this.floor?Math.floor(t):Om(t,3);return Tn(r,this.padTo)}}},bm=class{constructor(t,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=t;else if(t.zone.type==="fixed"){let o=-1*(t.offset/60),s=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;t.offset!==0&&Da.create(s).valid?(i=s,this.dt=t):(i="UTC",this.dt=t.offset===0?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else t.zone.type==="system"?this.dt=t:t.zone.type==="iana"?(this.dt=t,i=t.zone.name):(i="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);let a={...this.opts};a.timeZone=a.timeZone||i,this.dtf=gm(r,a)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):t}resolvedOptions(){return this.dtf.resolvedOptions()}},Dm=class{constructor(t,r,n){this.opts={style:"long",...n},!r&&rS()&&(this.rtf=r2(t,n))}format(t,r){return this.rtf?this.rtf.format(t,r):x2(r,t,this.opts.numeric,this.opts.style!=="long")}formatToParts(t,r){return this.rtf?this.rtf.formatToParts(t,r):[]}},mn=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.defaultToEN)}static create(t,r,n,i=!1){let a=t||hn.defaultLocale,o=a||(i?"en-US":i2()),s=r||hn.defaultNumberingSystem,u=n||hn.defaultOutputCalendar;return new e(o,s,u,a)}static resetCache(){xl=null,pm={},ym={},vm={}}static fromObject({locale:t,numberingSystem:r,outputCalendar:n}={}){return e.create(t,r,n)}constructor(t,r,n,i){let[a,o,s]=a2(t);this.locale=a,this.numberingSystem=r||o||null,this.outputCalendar=n||s||null,this.intl=o2(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=u2(this)),this.fastNumbersCached}listingMode(){let t=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return t&&r?"en":"intl"}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,t.defaultToEN||!1)}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,r=!1){return cc(this,t,sS,()=>{let n=r?{month:t,day:"numeric"}:{month:t},i=r?"format":"standalone";return this.monthsCache[i][t]||(this.monthsCache[i][t]=s2(a=>this.extract(a,n,"month"))),this.monthsCache[i][t]})}weekdays(t,r=!1){return cc(this,t,cS,()=>{let n=r?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},i=r?"format":"standalone";return this.weekdaysCache[i][t]||(this.weekdaysCache[i][t]=l2(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[i][t]})}meridiems(){return cc(this,void 0,()=>dS,()=>{if(!this.meridiemCache){let t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[mt.utc(2016,11,13,9),mt.utc(2016,11,13,19)].map(r=>this.extract(r,t,"dayperiod"))}return this.meridiemCache})}eras(t){return cc(this,t,fS,()=>{let r={era:t};return this.eraCache[t]||(this.eraCache[t]=[mt.utc(-40,1,1),mt.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[t]})}extract(t,r,n){let i=this.dtFormatter(t,r),a=i.formatToParts(),o=a.find(s=>s.type.toLowerCase()===n);return o?o.value:null}numberFormatter(t={}){return new wm(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,r={}){return new bm(t,this.intl,r)}relFormatter(t={}){return new Dm(this.intl,this.isEnglish(),t)}listFormatter(t={}){return t2(this.intl,t)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}},am=null,Kr=class e extends oo{static get utcInstance(){return am===null&&(am=new e(0)),am}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let r=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new e(Tc(r[1],r[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${_l(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${_l(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,r){return _l(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}},Sm=class extends oo{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function ba(e,t){if(kt(e)||e===null)return t;if(e instanceof oo)return e;if(c2(e)){let r=e.toLowerCase();return r==="default"?t:r==="local"||r==="system"?wc.instance:r==="utc"||r==="gmt"?Kr.utcInstance:Kr.parseSpecifier(r)||Da.create(e)}else return ao(e)?Kr.instance(e):typeof e=="object"&&"offset"in e&&typeof e.offset=="function"?e:new Sm(e)}var l0=()=>Date.now(),u0="system",c0=null,d0=null,f0=null,h0=60,m0,hn=class{static get now(){return l0}static set now(t){l0=t}static set defaultZone(t){u0=t}static get defaultZone(){return ba(u0,wc.instance)}static get defaultLocale(){return c0}static set defaultLocale(t){c0=t}static get defaultNumberingSystem(){return d0}static set defaultNumberingSystem(t){d0=t}static get defaultOutputCalendar(){return f0}static set defaultOutputCalendar(t){f0=t}static get twoDigitCutoffYear(){return h0}static set twoDigitCutoffYear(t){h0=t%100}static get throwOnInvalid(){return m0}static set throwOnInvalid(t){m0=t}static resetCaches(){mn.resetCache(),Da.resetCache()}};function kt(e){return typeof e=="undefined"}function ao(e){return typeof e=="number"}function _c(e){return typeof e=="number"&&e%1===0}function c2(e){return typeof e=="string"}function d2(e){return Object.prototype.toString.call(e)==="[object Date]"}function rS(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function f2(e){return Array.isArray(e)?e:[e]}function p0(e,t,r){if(e.length!==0)return e.reduce((n,i)=>{let a=[t(i),i];return n&&r(n[0],a[0])===n[0]?n:a},null)[1]}function h2(e,t){return t.reduce((r,n)=>(r[n]=e[n],r),{})}function rs(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ji(e,t,r){return _c(e)&&e>=t&&e<=r}function m2(e,t){return e-t*Math.floor(e/t)}function Tn(e,t=2){let r=e<0,n;return r?n="-"+(""+-e).padStart(t,"0"):n=(""+e).padStart(t,"0"),n}function wa(e){if(!(kt(e)||e===null||e===""))return parseInt(e,10)}function to(e){if(!(kt(e)||e===null||e===""))return parseFloat(e)}function Am(e){if(!(kt(e)||e===null||e==="")){let t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function Om(e,t,r=!1){let n=10**t;return(r?Math.trunc:Math.round)(e*n)/n}function Fl(e){return e%4===0&&(e%100!==0||e%400===0)}function Cl(e){return Fl(e)?366:365}function bc(e,t){let r=m2(t-1,12)+1,n=e+(t-r)/12;return r===2?Fl(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Mc(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Dc(e){let t=(e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400))%7,r=e-1,n=(r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400))%7;return t===4||n===3?53:52}function Em(e){return e>99?e:e>hn.twoDigitCutoffYear?1900+e:2e3+e}function iS(e,t,r,n=null){let i=new Date(e),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(r,o).formatToParts(i).find(u=>u.type.toLowerCase()==="timezonename");return s?s.value:null}function Tc(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);let n=parseInt(t,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function aS(e){let t=Number(e);if(typeof e=="boolean"||e===""||Number.isNaN(t))throw new vr(`Invalid unit value ${e}`);return t}function Sc(e,t){let r={};for(let n in e)if(rs(e,n)){let i=e[n];if(i==null)continue;r[t(n)]=aS(i)}return r}function _l(e,t){let r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${Tn(r,2)}:${Tn(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${Tn(r,2)}${Tn(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Fc(e){return h2(e,["hour","minute","second","millisecond"])}var p2=["January","February","March","April","May","June","July","August","September","October","November","December"],oS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],g2=["J","F","M","A","M","J","J","A","S","O","N","D"];function sS(e){switch(e){case"narrow":return[...g2];case"short":return[...oS];case"long":return[...p2];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var lS=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],uS=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],y2=["M","T","W","T","F","S","S"];function cS(e){switch(e){case"narrow":return[...y2];case"short":return[...uS];case"long":return[...lS];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var dS=["AM","PM"],v2=["Before Christ","Anno Domini"],w2=["BC","AD"],b2=["B","A"];function fS(e){switch(e){case"narrow":return[...b2];case"short":return[...w2];case"long":return[...v2];default:return null}}function D2(e){return dS[e.hour<12?0:1]}function S2(e,t){return cS(t)[e.weekday-1]}function E2(e,t){return sS(t)[e.month-1]}function k2(e,t){return fS(t)[e.year<0?0:1]}function x2(e,t,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(e)===-1;if(r==="auto"&&a){let d=e==="days";switch(t){case 1:return d?"tomorrow":`next ${i[e][0]}`;case-1:return d?"yesterday":`last ${i[e][0]}`;case 0:return d?"today":`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),u=s===1,l=i[e],c=n?u?l[1]:l[2]||l[1]:u?i[e][0]:e;return o?`${s} ${c} ago`:`in ${s} ${c}`}function g0(e,t){let r="";for(let n of e)n.literal?r+=n.val:r+=t(n.val);return r}var C2={D:vc,DD:H0,DDD:B0,DDDD:V0,t:$0,tt:U0,ttt:W0,tttt:Y0,T:z0,TT:K0,TTT:j0,TTTT:q0,f:G0,ff:Z0,fff:X0,ffff:tS,F:J0,FF:Q0,FFF:eS,FFFF:nS},Ir=class e{static create(t,r={}){return new e(t,r)}static parseFormat(t){let r=null,n="",i=!1,a=[];for(let o=0;o0&&a.push({literal:i||/^\s+$/.test(n),val:n}),r=null,n="",i=!i):i||s===r?n+=s:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=s,r=s)}return n.length>0&&a.push({literal:i||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(t){return C2[t]}constructor(t,r){this.opts=r,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...r}).format()}dtFormatter(t,r={}){return this.loc.dtFormatter(t,{...this.opts,...r})}formatDateTime(t,r){return this.dtFormatter(t,r).format()}formatDateTimeParts(t,r){return this.dtFormatter(t,r).formatToParts()}formatInterval(t,r){return this.dtFormatter(t.start,r).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,r){return this.dtFormatter(t,r).resolvedOptions()}num(t,r=0){if(this.opts.forceSimple)return Tn(t,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(t)}formatDateTimeFromString(t,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(h,g)=>this.loc.extract(t,h,g),o=h=>t.isOffsetFixed&&t.offset===0&&h.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,h.format):"",s=()=>n?D2(t):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(h,g)=>n?E2(t,h):a(g?{month:h}:{month:h,day:"numeric"},"month"),l=(h,g)=>n?S2(t,h):a(g?{weekday:h}:{weekday:h,month:"long",day:"numeric"},"weekday"),c=h=>{let g=e.macroTokenToFormatOpts(h);return g?this.formatWithSystemDefault(t,g):h},d=h=>n?k2(t,h):a({era:h},"era"),m=h=>{switch(h){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12===0?12:t.hour%12);case"hh":return this.num(t.hour%12===0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return s();case"d":return i?a({day:"numeric"},"day"):this.num(t.day);case"dd":return i?a({day:"2-digit"},"day"):this.num(t.day,2);case"c":return this.num(t.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(t.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?a({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return i?a({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return i?a({month:"numeric"},"month"):this.num(t.month);case"MM":return i?a({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return i?a({year:"numeric"},"year"):this.num(t.year);case"yy":return i?a({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return i?a({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return i?a({year:"numeric"},"year"):this.num(t.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(h)}};return g0(e.parseFormat(r),m)}formatDurationFromString(t,r){let n=u=>{switch(u[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=u=>l=>{let c=n(l);return c?this.num(u.get(c),l.length):l},a=e.parseFormat(r),o=a.reduce((u,{literal:l,val:c})=>l?u:u.concat(c),[]),s=t.shiftTo(...o.map(n).filter(u=>u));return g0(a,i(s))}},Ar=class{constructor(t,r){this.reason=t,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},hS=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function is(...e){let t=e.reduce((r,n)=>r+n.source,"");return RegExp(`^${t}$`)}function as(...e){return t=>e.reduce(([r,n,i],a)=>{let[o,s,u]=a(t,i);return[{...r,...o},s||n,u]},[{},null,1]).slice(0,2)}function os(e,...t){if(e==null)return[null,null];for(let[r,n]of t){let i=r.exec(e);if(i)return n(i)}return[null,null]}function mS(...e){return(t,r)=>{let n={},i;for(i=0;ih!==void 0&&(g||h&&c)?-h:h;return[{years:m(to(r)),months:m(to(n)),weeks:m(to(i)),days:m(to(a)),hours:m(to(o)),minutes:m(to(s)),seconds:m(to(u),u==="-0"),milliseconds:m(Am(l),d)}]}var B2={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Nm(e,t,r,n,i,a,o){let s={year:t.length===2?Em(wa(t)):wa(t),month:oS.indexOf(r)+1,day:wa(n),hour:wa(i),minute:wa(a)};return o&&(s.second=wa(o)),e&&(s.weekday=e.length>3?lS.indexOf(e)+1:uS.indexOf(e)+1),s}var V2=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function $2(e){let[,t,r,n,i,a,o,s,u,l,c,d]=e,m=Nm(t,i,n,r,a,o,s),h;return u?h=B2[u]:l?h=0:h=Tc(c,d),[m,new Kr(h)]}function U2(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var W2=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Y2=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,z2=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function y0(e){let[,t,r,n,i,a,o,s]=e;return[Nm(t,i,n,r,a,o,s),Kr.utcInstance]}function K2(e){let[,t,r,n,i,a,o,s]=e;return[Nm(t,s,r,n,i,a,o),Kr.utcInstance]}var j2=is(M2,Pm),q2=is(T2,Pm),G2=is(F2,Pm),J2=is(gS),vS=as(P2,ss,Il,Al),Z2=as(I2,ss,Il,Al),Q2=as(A2,ss,Il,Al),X2=as(ss,Il,Al);function eP(e){return os(e,[j2,vS],[q2,Z2],[G2,Q2],[J2,X2])}function tP(e){return os(U2(e),[V2,$2])}function nP(e){return os(e,[W2,y0],[Y2,y0],[z2,K2])}function rP(e){return os(e,[R2,H2])}var iP=as(ss);function aP(e){return os(e,[N2,iP])}var oP=is(O2,L2),sP=is(yS),lP=as(ss,Il,Al);function uP(e){return os(e,[oP,vS],[sP,lP])}var v0="Invalid Duration",wS={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},cP={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...wS},Yr=146097/400,Qo=146097/4800,dP={years:{quarters:4,months:12,weeks:Yr/7,days:Yr,hours:Yr*24,minutes:Yr*24*60,seconds:Yr*24*60*60,milliseconds:Yr*24*60*60*1e3},quarters:{months:3,weeks:Yr/28,days:Yr/4,hours:Yr*24/4,minutes:Yr*24*60/4,seconds:Yr*24*60*60/4,milliseconds:Yr*24*60*60*1e3/4},months:{weeks:Qo/7,days:Qo,hours:Qo*24,minutes:Qo*24*60,seconds:Qo*24*60*60,milliseconds:Qo*24*60*60*1e3},...wS},io=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],fP=io.slice(0).reverse();function va(e,t,r=!1){let n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new He(n)}function bS(e,t){var n;let r=(n=t.milliseconds)!=null?n:0;for(let i of fP.slice(1))t[i]&&(r+=t[i]*e[i].milliseconds);return r}function w0(e,t){let r=bS(e,t)<0?-1:1;io.reduceRight((n,i)=>{if(kt(t[i]))return n;if(n){let a=t[n]*r,o=e[i][n],s=Math.floor(a/o);t[i]+=s*r,t[n]-=s*o*r}return i},null),io.reduce((n,i)=>{if(kt(t[i]))return n;if(n){let a=t[n]%1;t[n]-=a,t[i]+=a*e[n][i]}return i},null)}function hP(e){let t={};for(let[r,n]of Object.entries(e))n!==0&&(t[r]=n);return t}var He=class e{constructor(t){let r=t.conversionAccuracy==="longterm"||!1,n=r?dP:cP;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||mn.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,r){return e.fromObject({milliseconds:t},r)}static fromObject(t,r={}){if(t==null||typeof t!="object")throw new vr(`Duration.fromObject: argument expected to be an object, got ${t===null?"null":typeof t}`);return new e({values:Sc(t,e.normalizeUnit),loc:mn.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(t){if(ao(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t=="object")return e.fromObject(t);throw new vr(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,r){let[n]=rP(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,r){let[n]=aP(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,r=null){if(!t)throw new vr("need to specify a reason the Duration is invalid");let n=t instanceof Ar?t:new Ar(t,r);if(hn.throwOnInvalid)throw new mm(n);return new e({invalid:n})}static normalizeUnit(t){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t&&t.toLowerCase()];if(!r)throw new yc(t);return r}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Ir.create(this.loc,n).formatDurationFromString(this,t):v0}toHuman(t={}){if(!this.isValid)return v0;let r=io.map(n=>{let i=this.values[n];return kt(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return this.years!==0&&(t+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(t+=this.months+this.quarters*3+"M"),this.weeks!==0&&(t+=this.weeks+"W"),this.days!==0&&(t+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(t+="T"),this.hours!==0&&(t+=this.hours+"H"),this.minutes!==0&&(t+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(t+=Om(this.seconds+this.milliseconds/1e3,3)+"S"),t==="P"&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},mt.fromMillis(r,{zone:"UTC"}).toISOTime(t))}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.isValid?bS(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t),n={};for(let i of io)(rs(r.values,i)||rs(this.values,i))&&(n[i]=r.get(i)+this.get(i));return va(this,{values:n},!0)}minus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t);return this.plus(r.negate())}mapUnits(t){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=aS(t(this.values[n],n));return va(this,{values:r},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let r={...this.values,...Sc(t,e.normalizeUnit)};return va(this,{values:r})}reconfigure({locale:t,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let o={loc:this.loc.clone({locale:t,numberingSystem:r}),matrix:i,conversionAccuracy:n};return va(this,o)}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;let t=this.toObject();return w0(this.matrix,t),va(this,{values:t},!0)}rescale(){if(!this.isValid)return this;let t=hP(this.normalize().shiftToAll().toObject());return va(this,{values:t},!0)}shiftTo(...t){if(!this.isValid)return this;if(t.length===0)return this;t=t.map(o=>e.normalizeUnit(o));let r={},n={},i=this.toObject(),a;for(let o of io)if(t.indexOf(o)>=0){a=o;let s=0;for(let l in n)s+=this.matrix[l][o]*n[l],n[l]=0;ao(i[o])&&(s+=i[o]);let u=Math.trunc(s);r[o]=u,n[o]=(s*1e3-u*1e3)/1e3}else ao(i[o])&&(n[o]=i[o]);for(let o in n)n[o]!==0&&(r[a]+=o===a?n[o]:n[o]/this.matrix[a][o]);return w0(this.matrix,r),va(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=this.values[r]===0?0:-this.values[r];return va(this,{values:t},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid||!this.loc.equals(t.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of io)if(!r(this.values[n],t.values[n]))return!1;return!0}},Xo="Invalid Interval";function mP(e,t){return!e||!e.isValid?ns.invalid("missing or invalid start"):!t||!t.isValid?ns.invalid("missing or invalid end"):tt:!1}isBefore(t){return this.isValid?this.e<=t:!1}contains(t){return this.isValid?this.s<=t&&this.e>t:!1}set({start:t,end:r}={}){return this.isValid?e.fromDateTimes(t||this.s,r||this.e):this}splitAt(...t){if(!this.isValid)return[];let r=t.map(El).filter(o=>this.contains(o)).sort(),n=[],{s:i}=this,a=0;for(;i+this.e?this.e:o;n.push(e.fromDateTimes(i,s)),i=s,a+=1}return n}splitBy(t){let r=He.fromDurationLike(t);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,a,o=[];for(;nu*i));a=+s>+this.e?this.e:s,o.push(e.fromDateTimes(n,a)),n=a,i+=1}return o}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s=t.e:!1}equals(t){return!this.isValid||!t.isValid?!1:this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;let r=this.s>t.s?this.s:t.s,n=this.e=n?null:e.fromDateTimes(r,n)}union(t){if(!this.isValid)return this;let r=this.st.e?this.e:t.e;return e.fromDateTimes(r,n)}static merge(t){let[r,n]=t.sort((i,a)=>i.s-a.s).reduce(([i,a],o)=>a?a.overlaps(o)||a.abutsStart(o)?[i,a.union(o)]:[i.concat([a]),o]:[i,o],[[],null]);return n&&r.push(n),r}static xor(t){let r=null,n=0,i=[],a=t.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),o=Array.prototype.concat(...a),s=o.sort((u,l)=>u.time-l.time);for(let u of s)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&i.push(e.fromDateTimes(r,u.time)),r=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Xo}toLocaleString(t=vc,r={}){return this.isValid?Ir.create(this.s.loc.clone(r),t).formatInterval(this):Xo}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:Xo}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Xo}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:Xo}toFormat(t,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(t)}${r}${this.e.toFormat(t)}`:Xo}toDuration(t,r){return this.isValid?this.e.diff(this.s,t,r):He.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},es=class{static hasDST(t=hn.defaultZone){let r=mt.now().setZone(t).set({month:12});return!t.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(t){return Da.isValidZone(t)}static normalizeZone(t){return ba(t,hn.defaultZone)}static months(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||mn.create(r,n,a)).months(t)}static monthsFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||mn.create(r,n,a)).months(t,!0)}static weekdays(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||mn.create(r,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||mn.create(r,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return mn.create(t).meridiems()}static eras(t="short",{locale:r=null}={}){return mn.create(r,null,"gregory").eras(t)}static features(){return{relative:rS()}}};function b0(e,t){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(t)-r(e);return Math.floor(He.fromMillis(n).as("days"))}function pP(e,t,r){let n=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{let c=b0(u,l);return(c-c%7)/7}],["days",b0]],i={},a=e,o,s;for(let[u,l]of n)r.indexOf(u)>=0&&(o=u,i[u]=l(e,t),s=a.plus(i),s>t?(i[u]--,e=a.plus(i),e>t&&(s=e,i[u]--,e=a.plus(i))):e=s);return[e,i,s,o]}function gP(e,t,r,n){let[i,a,o,s]=pP(e,t,r),u=t-i,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(o0?He.fromMillis(u,n).shiftTo(...l).plus(c):c}var Rm={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},D0={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},yP=Rm.hanidec.replace(/[\[|\]]/g,"").split("");function vP(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r=a&&n<=o&&(t+=n-a)}}return parseInt(t,10)}else return t}function ri({numberingSystem:e},t=""){return new RegExp(`${Rm[e||"latn"]}${t}`)}var wP="missing Intl.DateTimeFormat.formatToParts support";function Nt(e,t=r=>r){return{regex:e,deser:([r])=>t(vP(r))}}var bP="\xA0",DS=`[ ${bP}]`,SS=new RegExp(DS,"g");function DP(e){return e.replace(/\./g,"\\.?").replace(SS,DS)}function S0(e){return e.replace(/\./g,"").replace(SS," ").toLowerCase()}function ii(e,t){return e===null?null:{regex:RegExp(e.map(DP).join("|")),deser:([r])=>e.findIndex(n=>S0(r)===S0(n))+t}}function E0(e,t){return{regex:e,deser:([,r,n])=>Tc(r,n),groups:t}}function dc(e){return{regex:e,deser:([t])=>t}}function SP(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function EP(e,t){let r=ri(t),n=ri(t,"{2}"),i=ri(t,"{3}"),a=ri(t,"{4}"),o=ri(t,"{6}"),s=ri(t,"{1,2}"),u=ri(t,"{1,3}"),l=ri(t,"{1,6}"),c=ri(t,"{1,9}"),d=ri(t,"{2,4}"),m=ri(t,"{4,6}"),h=v=>({regex:RegExp(SP(v.val)),deser:([D])=>D,literal:!0}),y=(v=>{if(e.literal)return h(v);switch(v.val){case"G":return ii(t.eras("short"),0);case"GG":return ii(t.eras("long"),0);case"y":return Nt(l);case"yy":return Nt(d,Em);case"yyyy":return Nt(a);case"yyyyy":return Nt(m);case"yyyyyy":return Nt(o);case"M":return Nt(s);case"MM":return Nt(n);case"MMM":return ii(t.months("short",!0),1);case"MMMM":return ii(t.months("long",!0),1);case"L":return Nt(s);case"LL":return Nt(n);case"LLL":return ii(t.months("short",!1),1);case"LLLL":return ii(t.months("long",!1),1);case"d":return Nt(s);case"dd":return Nt(n);case"o":return Nt(u);case"ooo":return Nt(i);case"HH":return Nt(n);case"H":return Nt(s);case"hh":return Nt(n);case"h":return Nt(s);case"mm":return Nt(n);case"m":return Nt(s);case"q":return Nt(s);case"qq":return Nt(n);case"s":return Nt(s);case"ss":return Nt(n);case"S":return Nt(u);case"SSS":return Nt(i);case"u":return dc(c);case"uu":return dc(s);case"uuu":return Nt(r);case"a":return ii(t.meridiems(),0);case"kkkk":return Nt(a);case"kk":return Nt(d,Em);case"W":return Nt(s);case"WW":return Nt(n);case"E":case"c":return Nt(r);case"EEE":return ii(t.weekdays("short",!1),1);case"EEEE":return ii(t.weekdays("long",!1),1);case"ccc":return ii(t.weekdays("short",!0),1);case"cccc":return ii(t.weekdays("long",!0),1);case"Z":case"ZZ":return E0(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return E0(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return dc(/[a-z_+-/]{1,256}?/i);case" ":return dc(/[^\S\n\r]/);default:return h(v)}})(e)||{invalidReason:wP};return y.token=e,y}var kP={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function xP(e,t,r){let{type:n,value:i}=e;if(n==="literal"){let u=/^\s+$/.test(i);return{literal:!u,val:u?" ":i}}let a=t[n],o=n;n==="hour"&&(t.hour12!=null?o=t.hour12?"hour12":"hour24":t.hourCycle!=null?t.hourCycle==="h11"||t.hourCycle==="h12"?o="hour12":o="hour24":o=r.hour12?"hour12":"hour24");let s=kP[o];if(typeof s=="object"&&(s=s[a]),s)return{literal:!1,val:s}}function CP(e){return[`^${e.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,e]}function _P(e,t,r){let n=e.match(t);if(n){let i={},a=1;for(let o in r)if(rs(r,o)){let s=r[o],u=s.groups?s.groups+1:1;!s.literal&&s.token&&(i[s.token.val[0]]=s.deser(n.slice(a,a+u))),a+=u}return[n,i]}else return[n,{}]}function MP(e){let t=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return kt(e.z)||(r=Da.create(e.z)),kt(e.Z)||(r||(r=new Kr(e.Z)),n=e.Z),kt(e.q)||(e.M=(e.q-1)*3+1),kt(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),kt(e.u)||(e.S=Am(e.u)),[Object.keys(e).reduce((a,o)=>{let s=t(o);return s&&(a[s]=e[o]),a},{}),r,n]}var om=null;function TP(){return om||(om=mt.fromMillis(1555555555555)),om}function FP(e,t){if(e.literal)return e;let r=Ir.macroTokenToFormatOpts(e.val),n=xS(r,t);return n==null||n.includes(void 0)?e:n}function ES(e,t){return Array.prototype.concat(...e.map(r=>FP(r,t)))}function kS(e,t,r){let n=ES(Ir.parseFormat(r),e),i=n.map(o=>EP(o,e)),a=i.find(o=>o.invalidReason);if(a)return{input:t,tokens:n,invalidReason:a.invalidReason};{let[o,s]=CP(i),u=RegExp(o,"i"),[l,c]=_P(t,u,s),[d,m,h]=c?MP(c):[null,null,void 0];if(rs(c,"a")&&rs(c,"H"))throw new ro("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:n,regex:u,rawMatches:l,matches:c,result:d,zone:m,specificOffset:h}}}function IP(e,t,r){let{result:n,zone:i,specificOffset:a,invalidReason:o}=kS(e,t,r);return[n,i,a,o]}function xS(e,t){if(!e)return null;let n=Ir.create(t,e).dtFormatter(TP()),i=n.formatToParts(),a=n.resolvedOptions();return i.map(o=>xP(o,e,a))}var CS=[0,31,59,90,120,151,181,212,243,273,304,334],_S=[0,31,60,91,121,152,182,213,244,274,305,335];function zr(e,t){return new Ar("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function MS(e,t,r){let n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function TS(e,t,r){return r+(Fl(e)?_S:CS)[t-1]}function FS(e,t){let r=Fl(e)?_S:CS,n=r.findIndex(a=>aDc(t)?(s=t+1,o=1):s=t,{weekYear:s,weekNumber:o,weekday:a,...Fc(e)}}function k0(e){let{weekYear:t,weekNumber:r,weekday:n}=e,i=MS(t,1,4),a=Cl(t),o=r*7+n-i-3,s;o<1?(s=t-1,o+=Cl(s)):o>a?(s=t+1,o-=Cl(t)):s=t;let{month:u,day:l}=FS(s,o);return{year:s,month:u,day:l,...Fc(e)}}function sm(e){let{year:t,month:r,day:n}=e,i=TS(t,r,n);return{year:t,ordinal:i,...Fc(e)}}function x0(e){let{year:t,ordinal:r}=e,{month:n,day:i}=FS(t,r);return{year:t,month:n,day:i,...Fc(e)}}function AP(e){let t=_c(e.weekYear),r=ji(e.weekNumber,1,Dc(e.weekYear)),n=ji(e.weekday,1,7);return t?r?n?!1:zr("weekday",e.weekday):zr("week",e.week):zr("weekYear",e.weekYear)}function OP(e){let t=_c(e.year),r=ji(e.ordinal,1,Cl(e.year));return t?r?!1:zr("ordinal",e.ordinal):zr("year",e.year)}function IS(e){let t=_c(e.year),r=ji(e.month,1,12),n=ji(e.day,1,bc(e.year,e.month));return t?r?n?!1:zr("day",e.day):zr("month",e.month):zr("year",e.year)}function AS(e){let{hour:t,minute:r,second:n,millisecond:i}=e,a=ji(t,0,23)||t===24&&r===0&&n===0&&i===0,o=ji(r,0,59),s=ji(n,0,59),u=ji(i,0,999);return a?o?s?u?!1:zr("millisecond",i):zr("second",n):zr("minute",r):zr("hour",t)}var lm="Invalid DateTime",C0=864e13;function fc(e){return new Ar("unsupported zone",`the zone "${e.name}" is not supported`)}function um(e){return e.weekData===null&&(e.weekData=km(e.c)),e.weekData}function no(e,t){let r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new mt({...r,...t,old:r})}function OS(e,t,r){let n=e-t*60*1e3,i=r.offset(n);if(t===i)return[n,t];n-=(i-t)*60*1e3;let a=r.offset(n);return i===a?[n,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function hc(e,t){e+=t*60*1e3;let r=new Date(e);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function gc(e,t,r){return OS(Mc(e),t,r)}function _0(e,t){let r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:n,month:i,day:Math.min(e.c.day,bc(n,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=He.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),s=Mc(a),[u,l]=OS(s,r,e.zone);return o!==0&&(u+=o,l=e.zone.offset(u)),{ts:u,o:l}}function Sl(e,t,r,n,i,a){let{setZone:o,zone:s}=r;if(e&&Object.keys(e).length!==0||t){let u=t||s,l=mt.fromObject(e,{...r,zone:u,specificOffset:a});return o?l:l.setZone(s)}else return mt.invalid(new Ar("unparsable",`the input "${i}" can't be parsed as ${n}`))}function mc(e,t,r=!0){return e.isValid?Ir.create(mn.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function cm(e,t){let r=e.c.year>9999||e.c.year<0,n="";return r&&e.c.year>=0&&(n+="+"),n+=Tn(e.c.year,r?6:4),t?(n+="-",n+=Tn(e.c.month),n+="-",n+=Tn(e.c.day)):(n+=Tn(e.c.month),n+=Tn(e.c.day)),n}function M0(e,t,r,n,i,a){let o=Tn(e.c.hour);return t?(o+=":",o+=Tn(e.c.minute),(e.c.millisecond!==0||e.c.second!==0||!r)&&(o+=":")):o+=Tn(e.c.minute),(e.c.millisecond!==0||e.c.second!==0||!r)&&(o+=Tn(e.c.second),(e.c.millisecond!==0||!n)&&(o+=".",o+=Tn(e.c.millisecond,3))),i&&(e.isOffsetFixed&&e.offset===0&&!a?o+="Z":e.o<0?(o+="-",o+=Tn(Math.trunc(-e.o/60)),o+=":",o+=Tn(Math.trunc(-e.o%60))):(o+="+",o+=Tn(Math.trunc(e.o/60)),o+=":",o+=Tn(Math.trunc(e.o%60)))),a&&(o+="["+e.zone.ianaName+"]"),o}var LS={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},LP={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},PP={ordinal:1,hour:0,minute:0,second:0,millisecond:0},PS=["year","month","day","hour","minute","second","millisecond"],NP=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],RP=["year","ordinal","hour","minute","second","millisecond"];function T0(e){let t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new yc(e);return t}function F0(e,t){let r=ba(t.zone,hn.defaultZone),n=mn.fromObject(t),i=hn.now(),a,o;if(kt(e.year))a=i;else{for(let l of PS)kt(e[l])&&(e[l]=LS[l]);let s=IS(e)||AS(e);if(s)return mt.invalid(s);let u=r.offset(i);[a,o]=gc(e,u,r)}return new mt({ts:a,zone:r,loc:n,o})}function I0(e,t,r){let n=kt(r.round)?!0:r.round,i=(o,s)=>(o=Om(o,n||r.calendary?0:2,!0),t.loc.clone(r).relFormatter(r).format(o,s)),a=o=>r.calendary?t.hasSame(e,o)?0:t.startOf(o).diff(e.startOf(o),o).get(o):t.diff(e,o).get(o);if(r.unit)return i(a(r.unit),r.unit);for(let o of r.units){let s=a(o);if(Math.abs(s)>=1)return i(s,o)}return i(e>t?-0:0,r.units[r.units.length-1])}function A0(e){let t={},r;return e.length>0&&typeof e[e.length-1]=="object"?(t=e[e.length-1],r=Array.from(e).slice(0,e.length-1)):r=Array.from(e),[t,r]}var mt=class e{constructor(t){let r=t.zone||hn.defaultZone,n=t.invalid||(Number.isNaN(t.ts)?new Ar("invalid input"):null)||(r.isValid?null:fc(r));this.ts=kt(t.ts)?hn.now():t.ts;let i=null,a=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(r))[i,a]=[t.old.c,t.old.o];else{let s=r.offset(this.ts);i=hc(this.ts,s),n=Number.isNaN(i.year)?new Ar("invalid input"):null,i=n?null:i,a=n?null:s}this._zone=r,this.loc=t.loc||mn.create(),this.invalid=n,this.weekData=null,this.c=i,this.o=a,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[t,r]=A0(arguments),[n,i,a,o,s,u,l]=r;return F0({year:n,month:i,day:a,hour:o,minute:s,second:u,millisecond:l},t)}static utc(){let[t,r]=A0(arguments),[n,i,a,o,s,u,l]=r;return t.zone=Kr.utcInstance,F0({year:n,month:i,day:a,hour:o,minute:s,second:u,millisecond:l},t)}static fromJSDate(t,r={}){let n=d2(t)?t.valueOf():NaN;if(Number.isNaN(n))return e.invalid("invalid input");let i=ba(r.zone,hn.defaultZone);return i.isValid?new e({ts:n,zone:i,loc:mn.fromObject(r)}):e.invalid(fc(i))}static fromMillis(t,r={}){if(ao(t))return t<-C0||t>C0?e.invalid("Timestamp out of range"):new e({ts:t,zone:ba(r.zone,hn.defaultZone),loc:mn.fromObject(r)});throw new vr(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,r={}){if(ao(t))return new e({ts:t*1e3,zone:ba(r.zone,hn.defaultZone),loc:mn.fromObject(r)});throw new vr("fromSeconds requires a numerical input")}static fromObject(t,r={}){t=t||{};let n=ba(r.zone,hn.defaultZone);if(!n.isValid)return e.invalid(fc(n));let i=hn.now(),a=kt(r.specificOffset)?n.offset(i):r.specificOffset,o=Sc(t,T0),s=!kt(o.ordinal),u=!kt(o.year),l=!kt(o.month)||!kt(o.day),c=u||l,d=o.weekYear||o.weekNumber,m=mn.fromObject(r);if((c||s)&&d)throw new ro("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&s)throw new ro("Can't mix ordinal dates with month/day");let h=d||o.weekday&&!c,g,y,v=hc(i,a);h?(g=NP,y=LP,v=km(v)):s?(g=RP,y=PP,v=sm(v)):(g=PS,y=LS);let D=!1;for(let B of g){let G=o[B];kt(G)?D?o[B]=y[B]:o[B]=v[B]:D=!0}let I=h?AP(o):s?OP(o):IS(o),C=I||AS(o);if(C)return e.invalid(C);let x=h?k0(o):s?x0(o):o,[O,A]=gc(x,a,n),P=new e({ts:O,zone:n,o:A,loc:m});return o.weekday&&c&&t.weekday!==P.weekday?e.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${P.toISO()}`):P}static fromISO(t,r={}){let[n,i]=eP(t);return Sl(n,i,r,"ISO 8601",t)}static fromRFC2822(t,r={}){let[n,i]=tP(t);return Sl(n,i,r,"RFC 2822",t)}static fromHTTP(t,r={}){let[n,i]=nP(t);return Sl(n,i,r,"HTTP",r)}static fromFormat(t,r,n={}){if(kt(t)||kt(r))throw new vr("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:a=null}=n,o=mn.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),[s,u,l,c]=IP(o,t,r);return c?e.invalid(c):Sl(s,u,n,`format ${r}`,t,l)}static fromString(t,r,n={}){return e.fromFormat(t,r,n)}static fromSQL(t,r={}){let[n,i]=uP(t);return Sl(n,i,r,"SQL",t)}static invalid(t,r=null){if(!t)throw new vr("need to specify a reason the DateTime is invalid");let n=t instanceof Ar?t:new Ar(t,r);if(hn.throwOnInvalid)throw new fm(n);return new e({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,r={}){let n=xS(t,mn.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(t,r={}){return ES(Ir.parseFormat(t),mn.fromObject(r)).map(i=>i.val).join("")}get(t){return this[t]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?um(this).weekYear:NaN}get weekNumber(){return this.isValid?um(this).weekNumber:NaN}get weekday(){return this.isValid?um(this).weekday:NaN}get ordinal(){return this.isValid?sm(this.c).ordinal:NaN}get monthShort(){return this.isValid?es.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?es.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?es.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?es.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let t=864e5,r=6e4,n=Mc(this.c),i=this.zone.offset(n-t),a=this.zone.offset(n+t),o=this.zone.offset(n-i*r),s=this.zone.offset(n-a*r);if(o===s)return[this];let u=n-o*r,l=n-s*r,c=hc(u,o),d=hc(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[no(this,{ts:u}),no(this,{ts:l})]:[this]}get isInLeapYear(){return Fl(this.year)}get daysInMonth(){return bc(this.year,this.month)}get daysInYear(){return this.isValid?Cl(this.year):NaN}get weeksInWeekYear(){return this.isValid?Dc(this.weekYear):NaN}resolvedLocaleOptions(t={}){let{locale:r,numberingSystem:n,calendar:i}=Ir.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(t=0,r={}){return this.setZone(Kr.instance(t),r)}toLocal(){return this.setZone(hn.defaultZone)}setZone(t,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(t=ba(t,hn.defaultZone),t.equals(this.zone))return this;if(t.isValid){let i=this.ts;if(r||n){let a=t.offset(this.ts),o=this.toObject();[i]=gc(o,a,t)}return no(this,{ts:i,zone:t})}else return e.invalid(fc(t))}reconfigure({locale:t,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:t,numberingSystem:r,outputCalendar:n});return no(this,{loc:i})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;let r=Sc(t,T0),n=!kt(r.weekYear)||!kt(r.weekNumber)||!kt(r.weekday),i=!kt(r.ordinal),a=!kt(r.year),o=!kt(r.month)||!kt(r.day),s=a||o,u=r.weekYear||r.weekNumber;if((s||i)&&u)throw new ro("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(o&&i)throw new ro("Can't mix ordinal dates with month/day");let l;n?l=k0({...km(this.c),...r}):kt(r.ordinal)?(l={...this.toObject(),...r},kt(r.day)&&(l.day=Math.min(bc(l.year,l.month),l.day))):l=x0({...sm(this.c),...r});let[c,d]=gc(l,this.o,this.zone);return no(this,{ts:c,o:d})}plus(t){if(!this.isValid)return this;let r=He.fromDurationLike(t);return no(this,_0(this,r))}minus(t){if(!this.isValid)return this;let r=He.fromDurationLike(t).negate();return no(this,_0(this,r))}startOf(t){if(!this.isValid)return this;let r={},n=He.normalizeUnit(t);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(n==="weeks"&&(r.weekday=1),n==="quarters"){let i=Math.ceil(this.month/3);r.month=(i-1)*3+1}return this.set(r)}endOf(t){return this.isValid?this.plus({[t]:1}).startOf(t).minus(1):this}toFormat(t,r={}){return this.isValid?Ir.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,t):lm}toLocaleString(t=vc,r={}){return this.isValid?Ir.create(this.loc.clone(r),t).formatDateTime(this):lm}toLocaleParts(t={}){return this.isValid?Ir.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:a=!1}={}){if(!this.isValid)return null;let o=t==="extended",s=cm(this,o);return s+="T",s+=M0(this,o,r,n,i,a),s}toISODate({format:t="extended"}={}){return this.isValid?cm(this,t==="extended"):null}toISOWeekDate(){return mc(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:a=!1,format:o="extended"}={}){return this.isValid?(i?"T":"")+M0(this,o==="extended",r,t,n,a):null}toRFC2822(){return mc(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return mc(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?cm(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||t)&&(n&&(i+=" "),r?i+="z":t&&(i+="ZZ")),mc(this,i,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():lm}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};let r={...this.c};return t.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,r="milliseconds",n={}){if(!this.isValid||!t.isValid)return He.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=f2(r).map(He.normalizeUnit),o=t.valueOf()>this.valueOf(),s=o?this:t,u=o?t:this,l=gP(s,u,a,i);return o?l.negate():l}diffNow(t="milliseconds",r={}){return this.diff(e.now(),t,r)}until(t){return this.isValid?ns.fromDateTimes(this,t):this}hasSame(t,r){if(!this.isValid)return!1;let n=t.valueOf(),i=this.setZone(t.zone,{keepLocalTime:!0});return i.startOf(r)<=n&&n<=i.endOf(r)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;let r=t.base||e.fromObject({},{zone:this.zone}),n=t.padding?thisr.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new vr("max requires all arguments be DateTimes");return p0(t,r=>r.valueOf(),Math.max)}static fromFormatExplain(t,r,n={}){let{locale:i=null,numberingSystem:a=null}=n,o=mn.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});return kS(o,t,r)}static fromStringExplain(t,r,n={}){return e.fromFormatExplain(t,r,n)}static get DATE_SHORT(){return vc}static get DATE_MED(){return H0}static get DATE_MED_WITH_WEEKDAY(){return GL}static get DATE_FULL(){return B0}static get DATE_HUGE(){return V0}static get TIME_SIMPLE(){return $0}static get TIME_WITH_SECONDS(){return U0}static get TIME_WITH_SHORT_OFFSET(){return W0}static get TIME_WITH_LONG_OFFSET(){return Y0}static get TIME_24_SIMPLE(){return z0}static get TIME_24_WITH_SECONDS(){return K0}static get TIME_24_WITH_SHORT_OFFSET(){return j0}static get TIME_24_WITH_LONG_OFFSET(){return q0}static get DATETIME_SHORT(){return G0}static get DATETIME_SHORT_WITH_SECONDS(){return J0}static get DATETIME_MED(){return Z0}static get DATETIME_MED_WITH_SECONDS(){return Q0}static get DATETIME_MED_WITH_WEEKDAY(){return JL}static get DATETIME_FULL(){return X0}static get DATETIME_FULL_WITH_SECONDS(){return eS}static get DATETIME_HUGE(){return tS}static get DATETIME_HUGE_WITH_SECONDS(){return nS}};function El(e){if(mt.isDateTime(e))return e;if(e&&e.valueOf&&ao(e.valueOf()))return mt.fromJSDate(e);if(e&&typeof e=="object")return mt.fromObject(e);throw new vr(`Unknown datetime argument: ${e}, of type ${typeof e}`)}var Hm={renderNullAs:"\\-",taskCompletionTracking:!1,taskCompletionUseEmojiShorthand:!1,taskCompletionText:"completion",taskCompletionDateFormat:"yyyy-MM-dd",recursiveSubTaskCompletion:!1,warnOnEmptyResult:!0,refreshEnabled:!0,refreshInterval:2500,defaultDateFormat:"MMMM dd, yyyy",defaultDateTimeFormat:"h:mm a - MMMM dd, yyyy",maxRecursiveRenderDepth:4,tableIdColumnName:"File",tableGroupColumnName:"Group",showResultCount:!0},HP={allowHtml:!0};({...Hm,...HP});var xm=class e{constructor(t){ur(this,"value");ur(this,"successful");this.value=t,this.successful=!0}map(t){return new e(t(this.value))}flatMap(t){return t(this.value)}mapErr(t){return this}bimap(t,r){return this.map(t)}orElse(t){return this.value}cast(){return this}orElseThrow(t){return this.value}},Cm=class e{constructor(t){ur(this,"error");ur(this,"successful");this.error=t,this.successful=!1}map(t){return this}flatMap(t){return this}mapErr(t){return new e(t(this.error))}bimap(t,r){return this.mapErr(r)}orElse(t){return t}cast(){return this}orElseThrow(t){throw t?new Error(t(this.error)):new Error(""+this.error)}},Ec;(function(e){function t(a){return new xm(a)}e.success=t;function r(a){return new Cm(a)}e.failure=r;function n(a,o,s){return a.successful?o.successful?s(a.value,o.value):r(o.error):r(a.error)}e.flatMap2=n;function i(a,o,s){return n(a,o,(u,l)=>t(s(u,l)))}e.map2=i})(Ec||(Ec={}));var BP=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"||typeof window!="undefined"?window:typeof self!="undefined"?self:{},kc={exports:{}};kc.exports;(function(e,t){(function(r,n){e.exports=n()})(typeof self!="undefined"?self:BP,function(){return function(r){var n={};function i(a){if(n[a])return n[a].exports;var o=n[a]={i:a,l:!1,exports:{}};return r[a].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=r,i.c=n,i.d=function(a,o,s){i.o(a,o)||Object.defineProperty(a,o,{configurable:!1,enumerable:!0,get:s})},i.r=function(a){Object.defineProperty(a,"__esModule",{value:!0})},i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,"a",o),o},i.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)},i.p="",i(i.s=0)}([function(r,n,i){function a(L){if(!(this instanceof a))return new a(L);this._=L}var o=a.prototype;function s(L,K){for(var ee=0;ee>7),buf:function(de){var ve=u(function(ge,M,H,q){return ge.concat(H===q.length-1?Buffer.from([M,0]).readUInt16BE(0):q.readUInt16BE(H))},[],de);return Buffer.from(l(function(ge){return(ge<<1&65535)>>8},ve))}(ee.buf)}}),ee}function d(){return typeof Buffer!="undefined"}function m(){if(!d())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function h(L){m();var K=u(function(ve,ge){return ve+ge},0,L);if(K%8!=0)throw new Error("The bits ["+L.join(", ")+"] add up to "+K+" which is not an even number of bytes; the total should be divisible by 8");var ee,ue=K/8,de=(ee=function(ve){return ve>48},u(function(ve,ge){return ve||(ee(ge)?ge:ve)},null,L));if(de)throw new Error(de+" bit range requested exceeds 48 bit (6 byte) Number max.");return new a(function(ve,ge){var M=ue+ge;return M>ve.length?B(ge,ue.toString()+" bytes"):P(M,u(function(H,q){var ie=c(q,H.buf);return{coll:H.coll.concat(ie.v),buf:ie.buf}},{coll:[],buf:ve.slice(ge,M)},L).coll)})}function g(L,K){return new a(function(ee,ue){return m(),ue+K>ee.length?B(ue,K+" bytes for "+L):P(ue+K,ee.slice(ue,ue+K))})}function y(L,K){if(typeof(ee=K)!="number"||Math.floor(ee)!==ee||K<0||K>6)throw new Error(L+" requires integer length in range [0, 6].");var ee}function v(L){return y("uintBE",L),g("uintBE("+L+")",L).map(function(K){return K.readUIntBE(0,L)})}function D(L){return y("uintLE",L),g("uintLE("+L+")",L).map(function(K){return K.readUIntLE(0,L)})}function I(L){return y("intBE",L),g("intBE("+L+")",L).map(function(K){return K.readIntBE(0,L)})}function C(L){return y("intLE",L),g("intLE("+L+")",L).map(function(K){return K.readIntLE(0,L)})}function x(L){return L instanceof a}function O(L){return{}.toString.call(L)==="[object Array]"}function A(L){return d()&&Buffer.isBuffer(L)}function P(L,K){return{status:!0,index:L,value:K,furthest:-1,expected:[]}}function B(L,K){return O(K)||(K=[K]),{status:!1,index:-1,value:null,furthest:L,expected:K}}function G(L,K){if(!K||L.furthest>K.furthest)return L;var ee=L.furthest===K.furthest?function(ue,de){if(function(){if(a._supportsSet!==void 0)return a._supportsSet;var ae=typeof Set!="undefined";return a._supportsSet=ae,ae}()&&Array.from){for(var ve=new Set(ue),ge=0;ge=0;){if(ge in ee){ue=ee[ge].line,ve===0&&(ve=ee[ge].lineStart);break}(L.charAt(ge)===` +`||L.charAt(ge)==="\r"&&L.charAt(ge+1)!==` +`)&&(de++,ve===0&&(ve=ge+1)),ge--}var M=ue+de,H=K-ve;return ee[K]={line:M,lineStart:ve},{offset:K,line:M+1,column:H+1}}function oe(L){if(!x(L))throw new Error("not a parser: "+L)}function te(L,K){return typeof L=="string"?L.charAt(K):L[K]}function re(L){if(typeof L!="number")throw new Error("not a number: "+L)}function ne(L){if(typeof L!="function")throw new Error("not a function: "+L)}function be(L){if(typeof L!="string")throw new Error("not a string: "+L)}var pe=2,De=3,Ce=8,U=5*Ce,Je=4*Ce,it=" ";function N(L,K){return new Array(K+1).join(L)}function Ze(L,K,ee){var ue=K-L.length;return ue<=0?L:N(ee,ue)+L}function It(L,K,ee,ue){return{from:L-K>0?L-K:0,to:L+ee>ue?ue:L+ee}}function Mt(L,K){var ee,ue,de,ve,ge,M=K.index,H=M.offset,q=1;if(H===L.length)return"Got the end of the input";if(A(L)){var ie=H-H%Ce,ye=H-ie,ce=It(ie,U,Je+Ce,L.length),ae=l(function(Te){return l(function(Ue){return Ze(Ue.toString(16),2,"0")},Te)},function(Te,Ue){var We=Te.length,Ft=[],Hn=0;if(We<=Ue)return[Te.slice()];for(var Ot=0;Ot=4&&(ee+=1),q=2,de=l(function(Te){return Te.length<=4?Te.join(" "):Te.slice(0,4).join(" ")+" "+Te.slice(4).join(" ")},ae),(ge=(8*(ve.to>0?ve.to-1:ve.to)).toString(16).length)<2&&(ge=2)}else{var Se=L.split(/\r\n|[\n\r\u2028\u2029]/);ee=M.column-1,ue=M.line-1,ve=It(ue,pe,De,Se.length),de=Se.slice(ve.from,ve.to),ge=ve.to.toString().length}var nt=ue-ve.from;return A(L)&&(ge=(8*(ve.to>0?ve.to-1:ve.to)).toString(16).length)<2&&(ge=2),u(function(Te,Ue,We){var Ft,Hn=We===nt,Ot=Hn?"> ":it;return Ft=A(L)?Ze((8*(ve.from+We)).toString(16),ge,"0"):Ze((ve.from+We+1).toString(),ge," "),[].concat(Te,[Ot+Ft+" | "+Ue],Hn?[it+N(" ",ge)+" | "+Ze("",ee," ")+N("^",q)]:[])},[],de).join(` +`)}function jt(L,K){return[` +`,"-- PARSING FAILED "+N("-",50),` + +`,Mt(L,K),` + +`,(ee=K.expected,ee.length===1?`Expected: + +`+ee[0]:`Expected one of the following: + +`+ee.join(", ")),` +`].join("");var ee}function vt(L){return L.flags!==void 0?L.flags:[L.global?"g":"",L.ignoreCase?"i":"",L.multiline?"m":"",L.unicode?"u":"",L.sticky?"y":""].join("")}function Wt(){for(var L=[].slice.call(arguments),K=L.length,ee=0;ee=2?re(K):K=0;var ee=function(de){return RegExp("^(?:"+de.source+")",vt(de))}(L),ue=""+L;return a(function(de,ve){var ge=ee.exec(de.slice(ve));if(ge){if(0<=K&&K<=ge.length){var M=ge[0],H=ge[K];return P(ve+M.length,H)}return B(ve,"valid match group (0 to "+ge.length+") in "+ue)}return B(ve,ue)})}function xn(L){return a(function(K,ee){return P(ee,L)})}function jn(L){return a(function(K,ee){return B(ee,L)})}function sn(L){if(x(L))return a(function(K,ee){var ue=L._(K,ee);return ue.index=ee,ue.value="",ue});if(typeof L=="string")return sn(yn(L));if(L instanceof RegExp)return sn(vn(L));throw new Error("not a string, regexp, or parser: "+L)}function Rt(L){return oe(L),a(function(K,ee){var ue=L._(K,ee),de=K.slice(ee,ue.index);return ue.status?B(ee,'not "'+de+'"'):P(ee,null)})}function Vt(L){return ne(L),a(function(K,ee){var ue=te(K,ee);return ee=L.length?B(K,"any character/byte"):P(K+1,te(L,K))}),rn=a(function(L,K){return P(L.length,L.slice(K))}),At=a(function(L,K){return K=0}).desc(K)},a.optWhitespace=Dt,a.Parser=a,a.range=function(L,K){return Vt(function(ee){return L<=ee&&ee<=K}).desc(L+"-"+K)},a.regex=vn,a.regexp=vn,a.sepBy=en,a.sepBy1=gn,a.seq=Wt,a.seqMap=Tt,a.seqObj=function(){for(var L,K={},ee=0,ue=(L=arguments,Array.prototype.slice.call(L)),de=ue.length,ve=0;ve255)throw new Error("Value specified to byte constructor ("+L+"=0x"+L.toString(16)+") is larger in value than a single byte.");var K=(L>15?"0x":"0x0")+L.toString(16);return a(function(ee,ue){var de=te(ee,ue);return de===L?P(ue+1,de):B(ue,K)})},buffer:function(L){return g("buffer",L).map(function(K){return Buffer.from(K)})},encodedString:function(L,K){return g("string",K).map(function(ee){return ee.toString(L)})},uintBE:v,uint8BE:v(1),uint16BE:v(2),uint32BE:v(4),uintLE:D,uint8LE:D(1),uint16LE:D(2),uint32LE:D(4),intBE:I,int8BE:I(1),int16BE:I(2),int32BE:I(4),intLE:C,int8LE:C(1),int16LE:C(2),int32LE:C(4),floatBE:g("floatBE",4).map(function(L){return L.readFloatBE(0)}),floatLE:g("floatLE",4).map(function(L){return L.readFloatLE(0)}),doubleBE:g("doubleBE",8).map(function(L){return L.readDoubleBE(0)}),doubleLE:g("doubleLE",8).map(function(L){return L.readDoubleLE(0)})},r.exports=a}])})})(kc,kc.exports);var W=kc.exports,Bm=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function NS(e){return e==null?e:e.shiftToAll().normalize()}function O0(e){return e.includes("/")&&(e=e.substring(e.lastIndexOf("/")+1)),e.endsWith(".md")&&(e=e.substring(0,e.length-3)),e}W.alt(W.regex(new RegExp(Bm(),"")),W.regex(/[0-9\p{Letter}_-]+/u).map(e=>e.toLocaleLowerCase()),W.whitespace.map(e=>"-"),W.any.map(e=>"")).many().map(e=>e.join(""));var VP=W.alt(W.regex(new RegExp(Bm(),"")),W.regex(/[0-9\p{Letter}_-]+/u),W.whitespace.map(e=>" "),W.any.map(e=>" ")).many().map(e=>e.join("").split(/\s+/).join(" ").trim());function $P(e){return VP.tryParse(e)}function UP(e){return e=NS(e),e=He.fromObject(Object.fromEntries(Object.entries(e.toObject()).filter(([,t])=>t!=0))),e.toHuman()}var Ml;(function(e){function t(x,O=Hm,A=!1){let P=r(x);if(!P)return O.renderNullAs;switch(P.type){case"null":return O.renderNullAs;case"string":return P.value;case"number":case"boolean":return""+P.value;case"html":return P.value.outerHTML;case"widget":return P.value.markdown();case"link":return P.value.markdown();case"function":return"";case"array":let B="";return A&&(B+="["),B+=P.value.map(G=>t(G,O,!0)).join(", "),A&&(B+="]"),B;case"object":return"{ "+Object.entries(P.value).map(G=>G[0]+": "+t(G[1],O,!0)).join(", ")+" }";case"date":return P.value.second==0&&P.value.hour==0&&P.value.minute==0?P.value.toFormat(O.defaultDateFormat):P.value.toFormat(O.defaultDateTimeFormat);case"duration":return UP(P.value)}}e.toString=t;function r(x){return m(x)?{type:"null",value:x}:l(x)?{type:"number",value:x}:u(x)?{type:"string",value:x}:g(x)?{type:"boolean",value:x}:d(x)?{type:"duration",value:x}:c(x)?{type:"date",value:x}:v(x)?{type:"widget",value:x}:h(x)?{type:"array",value:x}:y(x)?{type:"link",value:x}:C(x)?{type:"function",value:x}:D(x)?{type:"html",value:x}:I(x)?{type:"object",value:x}:void 0}e.wrapValue=r;function n(x,O){if(I(x)){let A={};for(let[P,B]of Object.entries(x))A[P]=n(B,O);return A}else if(h(x)){let A=[];for(let P of x)A.push(n(P,O));return A}else return O(x)}e.mapLeaves=n;function i(x,O,A){var G,J;if(x===void 0&&(x=null),O===void 0&&(O=null),x===null&&O===null)return 0;if(x===null)return-1;if(O===null)return 1;let P=r(x),B=r(O);if(P===void 0&&B===void 0)return 0;if(P===void 0)return-1;if(B===void 0)return 1;if(P.type!=B.type)return P.type.localeCompare(B.type);if(P.value===B.value)return 0;switch(P.type){case"string":return P.value.localeCompare(B.value);case"number":return P.valueN,re=te(Q.path).localeCompare(te(oe.path));if(re!=0)return re;let ne=Q.type.localeCompare(oe.type);return ne!=0?ne:Q.subpath&&!oe.subpath?1:!Q.subpath&&oe.subpath?-1:!Q.subpath&&!oe.subpath?0:((G=Q.subpath)!=null?G:"").localeCompare((J=oe.subpath)!=null?J:"");case"date":return P.value0;case"boolean":return O.value;case"link":return!!O.value.path;case"date":return O.value.toMillis()!=0;case"duration":return O.value.as("seconds")!=0;case"object":return Object.keys(O.value).length>0;case"array":return O.value.length>0;case"null":return!1;case"html":case"widget":case"function":return!0}}e.isTruthy=o;function s(x){if(x==null)return x;if(e.isArray(x))return[].concat(x.map(O=>s(O)));if(e.isObject(x)){let O={};for(let[A,P]of Object.entries(x))O[A]=s(P);return O}else return x}e.deepCopy=s;function u(x){return typeof x=="string"}e.isString=u;function l(x){return typeof x=="number"}e.isNumber=l;function c(x){return x instanceof mt}e.isDate=c;function d(x){return x instanceof He}e.isDuration=d;function m(x){return x==null}e.isNull=m;function h(x){return Array.isArray(x)}e.isArray=h;function g(x){return typeof x=="boolean"}e.isBoolean=g;function y(x){return x instanceof xc}e.isLink=y;function v(x){return x instanceof Tl}e.isWidget=v;function D(x){return typeof HTMLElement!="undefined"?x instanceof HTMLElement:!1}e.isHtml=D;function I(x){return typeof x=="object"&&!D(x)&&!v(x)&&!h(x)&&!d(x)&&!c(x)&&!y(x)&&x!==void 0&&!m(x)}e.isObject=I;function C(x){return typeof x=="function"}e.isFunction=C})(Ml||(Ml={}));var L0;(function(e){function t(i){return Ml.isObject(i)&&Object.keys(i).length==2&&"key"in i&&"rows"in i}e.isElementGroup=t;function r(i){for(let a of i)if(!t(a))return!1;return!0}e.isGrouping=r;function n(i){if(r(i)){let a=0;for(let o of i)a+=n(o.rows);return a}else return i.length}e.count=n})(L0||(L0={}));var xc=class e{constructor(t){ur(this,"path");ur(this,"display");ur(this,"subpath");ur(this,"embed");ur(this,"type");Object.assign(this,t)}static file(t,r=!1,n){return new e({path:t,embed:r,display:n,subpath:void 0,type:"file"})}static infer(t,r=!1,n){if(t.includes("#^")){let i=t.split("#^");return e.block(i[0],i[1],r,n)}else if(t.includes("#")){let i=t.split("#");return e.header(i[0],i[1],r,n)}else return e.file(t,r,n)}static header(t,r,n,i){return new e({path:t,embed:n,display:i,subpath:$P(r),type:"header"})}static block(t,r,n,i){return new e({path:t,embed:n,display:i,subpath:r,type:"block"})}static fromObject(t){return new e(t)}equals(t){return t==null||t==null?!1:this.path==t.path&&this.type==t.type&&this.subpath==t.subpath}toString(){return this.markdown()}toObject(){return{path:this.path,type:this.type,subpath:this.subpath,display:this.display,embed:this.embed}}withPath(t){return new e(Object.assign({},this,{path:t}))}withDisplay(t){return new e(Object.assign({},this,{display:t}))}withHeader(t){return e.header(this.path,t,this.embed,this.display)}toFile(){return e.file(this.path,this.embed,this.display)}toEmbed(){if(this.embed)return this;{let t=new e(this);return t.embed=!0,t}}fromEmbed(){if(this.embed){let t=new e(this);return t.embed=!1,t}else return this}markdown(){let t=(this.embed?"!":"")+"[["+this.obsidianLink();return this.display?t+="|"+this.display:(t+="|"+O0(this.path),(this.type=="header"||this.type=="block")&&(t+=" > "+this.subpath)),t+="]]",t}obsidianLink(){var r,n;let t=this.path.replaceAll("|","\\|");return this.type=="header"?t+"#"+((r=this.subpath)==null?void 0:r.replaceAll("|","\\|")):this.type=="block"?t+"#^"+((n=this.subpath)==null?void 0:n.replaceAll("|","\\|")):t}fileName(){return O0(this.path).replace(".md","")}},Tl=class{constructor(t){ur(this,"$widget");this.$widget=t}},_m=class extends Tl{constructor(r,n){super("dataview:list-pair");ur(this,"key");ur(this,"value");this.key=r,this.value=n}markdown(){return`${Ml.toString(this.key)}: ${Ml.toString(this.value)}`}},Mm=class extends Tl{constructor(r,n){super("dataview:external-link");ur(this,"url");ur(this,"display");this.url=r,this.display=n}markdown(){var r;return`[${(r=this.display)!=null?r:this.url}](${this.url})`}},P0;(function(e){function t(o,s){return new _m(o,s)}e.listPair=t;function r(o,s){return new Mm(o,s)}e.externalLink=r;function n(o){return o.$widget==="dataview:list-pair"}e.isListPair=n;function i(o){return o.$widget==="dataview:external-link"}e.isExternalLink=i;function a(o){return n(o)||i(o)}e.isBuiltin=a})(P0||(P0={}));var fn;(function(e){function t(m){return{type:"variable",name:m}}e.variable=t;function r(m){return{type:"literal",value:m}}e.literal=r;function n(m,h,g){return{type:"binaryop",left:m,op:h,right:g}}e.binaryOp=n;function i(m,h){return{type:"index",object:m,index:h}}e.index=i;function a(m){let h=m.split("."),g=e.variable(h[0]);for(let y=1;y"||m==">="||m=="!="||m=="="}e.isCompareOp=d,e.NULL=e.literal(null)})(fn||(fn={}));var Si;(function(e){function t(c){return{type:"tag",tag:c}}e.tag=t;function r(c){return{type:"csv",path:c}}e.csv=r;function n(c){return{type:"folder",folder:c}}e.folder=n;function i(c,d){return{type:"link",file:c,direction:d?"incoming":"outgoing"}}e.link=i;function a(c,d,m){return{type:"binaryop",left:c,op:d,right:m}}e.binaryOp=a;function o(c,d){return{type:"binaryop",left:c,op:"&",right:d}}e.and=o;function s(c,d){return{type:"binaryop",left:c,op:"|",right:d}}e.or=s;function u(c){return{type:"negate",child:c}}e.negate=u;function l(){return{type:"empty"}}e.empty=l})(Si||(Si={}));var N0=new RegExp(Bm(),""),Tm={year:He.fromObject({years:1}),years:He.fromObject({years:1}),yr:He.fromObject({years:1}),yrs:He.fromObject({years:1}),month:He.fromObject({months:1}),months:He.fromObject({months:1}),mo:He.fromObject({months:1}),mos:He.fromObject({months:1}),week:He.fromObject({weeks:1}),weeks:He.fromObject({weeks:1}),wk:He.fromObject({weeks:1}),wks:He.fromObject({weeks:1}),w:He.fromObject({weeks:1}),day:He.fromObject({days:1}),days:He.fromObject({days:1}),d:He.fromObject({days:1}),hour:He.fromObject({hours:1}),hours:He.fromObject({hours:1}),hr:He.fromObject({hours:1}),hrs:He.fromObject({hours:1}),h:He.fromObject({hours:1}),minute:He.fromObject({minutes:1}),minutes:He.fromObject({minutes:1}),min:He.fromObject({minutes:1}),mins:He.fromObject({minutes:1}),m:He.fromObject({minutes:1}),second:He.fromObject({seconds:1}),seconds:He.fromObject({seconds:1}),sec:He.fromObject({seconds:1}),secs:He.fromObject({seconds:1}),s:He.fromObject({seconds:1})},Fm={now:()=>mt.local(),today:()=>mt.local().startOf("day"),yesterday:()=>mt.local().startOf("day").minus(He.fromObject({days:1})),tomorrow:()=>mt.local().startOf("day").plus(He.fromObject({days:1})),sow:()=>mt.local().startOf("week"),"start-of-week":()=>mt.local().startOf("week"),eow:()=>mt.local().endOf("week"),"end-of-week":()=>mt.local().endOf("week"),soy:()=>mt.local().startOf("year"),"start-of-year":()=>mt.local().startOf("year"),eoy:()=>mt.local().endOf("year"),"end-of-year":()=>mt.local().endOf("year"),som:()=>mt.local().startOf("month"),"start-of-month":()=>mt.local().startOf("month"),eom:()=>mt.local().endOf("month"),"end-of-month":()=>mt.local().endOf("month")},Im=["FROM","WHERE","LIMIT","GROUP","FLATTEN"];function WP(e){let t=-1;for(;(t=e.indexOf("|",t+1))>=0;)if(!(t>0&&e[t-1]=="\\"))return[e.substring(0,t).replace(/\\\|/g,"|"),e.substring(t+1)];return[e.replace(/\\\|/g,"|"),void 0]}function YP(e){let[t,r]=WP(e);return xc.infer(t,!1,r)}function kl(e,t,r){return W.seqMap(e,W.seq(W.optWhitespace,t,W.optWhitespace,e).many(),(n,i)=>{if(i.length==0)return n;let a=r(n,i[0][1],i[0][3]);for(let o=1;o(i,a)=>{let o=e._(i,a);if(!o.status)return o;for(let s of t){let u=s(o.value)._(i,o.index);if(!u.status)return o;o=u}return o})}var ai=W.createLanguage({number:e=>W.regexp(/-?[0-9]+(\.[0-9]+)?/).map(t=>Number.parseFloat(t)).desc("number"),string:e=>W.string('"').then(W.alt(e.escapeCharacter,W.noneOf('"\\')).atLeast(0).map(t=>t.join(""))).skip(W.string('"')).desc("string"),escapeCharacter:e=>W.string("\\").then(W.any).map(t=>t==='"'?'"':t==="\\"?"\\":"\\"+t),bool:e=>W.regexp(/true|false|True|False/).map(t=>t.toLowerCase()=="true").desc("boolean ('true' or 'false')"),tag:e=>W.seqMap(W.string("#"),W.alt(W.regexp(/[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]/).desc("text")).many(),(t,r)=>t+r.join("")).desc("tag ('#hello/stuff')"),identifier:e=>W.seqMap(W.alt(W.regexp(/\p{Letter}/u),W.regexp(N0).desc("text")),W.alt(W.regexp(/[0-9\p{Letter}_-]/u),W.regexp(N0).desc("text")).many(),(t,r)=>t+r.join("")).desc("variable identifier"),link:e=>W.regexp(/\[\[([^\[\]]*?)\]\]/u,1).map(t=>YP(t)).desc("file link"),embedLink:e=>W.seqMap(W.string("!").atMost(1),e.link,(t,r)=>(t.length>0&&(r.embed=!0),r)).desc("file link"),binaryPlusMinus:e=>W.regexp(/\+|-/).map(t=>t).desc("'+' or '-'"),binaryMulDiv:e=>W.regexp(/\*|\/|%/).map(t=>t).desc("'*' or '/' or '%'"),binaryCompareOp:e=>W.regexp(/>=|<=|!=|>|<|=/).map(t=>t).desc("'>=' or '<=' or '!=' or '=' or '>' or '<'"),binaryBooleanOp:e=>W.regexp(/and|or|&|\|/i).map(t=>t.toLowerCase()=="and"?"&":t.toLowerCase()=="or"?"|":t).desc("'and' or 'or'"),rootDate:e=>W.seqMap(W.regexp(/\d{4}/),W.string("-"),W.regexp(/\d{2}/),(t,r,n)=>mt.fromObject({year:Number.parseInt(t),month:Number.parseInt(n)})).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),dateShorthand:e=>W.alt(...Object.keys(Fm).sort((t,r)=>r.length-t.length).map(W.string)),date:e=>zP(e.rootDate,t=>W.seqMap(W.string("-"),W.regexp(/\d{2}/),(r,n)=>t.set({day:Number.parseInt(n)})),t=>W.seqMap(W.string("T"),W.regexp(/\d{2}/),(r,n)=>t.set({hour:Number.parseInt(n)})),t=>W.seqMap(W.string(":"),W.regexp(/\d{2}/),(r,n)=>t.set({minute:Number.parseInt(n)})),t=>W.seqMap(W.string(":"),W.regexp(/\d{2}/),(r,n)=>t.set({second:Number.parseInt(n)})),t=>W.alt(W.seqMap(W.string("."),W.regexp(/\d{3}/),(r,n)=>t.set({millisecond:Number.parseInt(n)})),W.succeed(t)),t=>W.alt(W.seqMap(W.string("+").or(W.string("-")),W.regexp(/\d{1,2}(:\d{2})?/),(r,n)=>t.setZone("UTC"+r+n,{keepLocalTime:!0})),W.seqMap(W.string("Z"),()=>t.setZone("utc",{keepLocalTime:!0})),W.seqMap(W.string("["),W.regexp(/[0-9A-Za-z+-\/]+/u),W.string("]"),(r,n,i)=>t.setZone(n,{keepLocalTime:!0})))).assert(t=>t.isValid,"valid date").desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),datePlus:e=>W.alt(e.dateShorthand.map(t=>Fm[t]()),e.date).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS] or in shorthand"),durationType:e=>W.alt(...Object.keys(Tm).sort((t,r)=>r.length-t.length).map(W.string)),duration:e=>W.seqMap(e.number,W.optWhitespace,e.durationType,(t,r,n)=>Tm[n].mapUnits(i=>i*t)).sepBy1(W.string(",").trim(W.optWhitespace).or(W.optWhitespace)).map(t=>t.reduce((r,n)=>r.plus(n))).desc("duration like 4hr2min"),rawNull:e=>W.string("null"),tagSource:e=>e.tag.map(t=>Si.tag(t)),csvSource:e=>W.seqMap(W.string("csv(").skip(W.optWhitespace),e.string,W.string(")"),(t,r,n)=>Si.csv(r)),linkIncomingSource:e=>e.link.map(t=>Si.link(t.path,!0)),linkOutgoingSource:e=>W.seqMap(W.string("outgoing(").skip(W.optWhitespace),e.link,W.string(")"),(t,r,n)=>Si.link(r.path,!1)),folderSource:e=>e.string.map(t=>Si.folder(t)),parensSource:e=>W.seqMap(W.string("("),W.optWhitespace,e.source,W.optWhitespace,W.string(")"),(t,r,n,i,a)=>n),negateSource:e=>W.seqMap(W.alt(W.string("-"),W.string("!")),e.atomSource,(t,r)=>Si.negate(r)),atomSource:e=>W.alt(e.parensSource,e.negateSource,e.linkOutgoingSource,e.linkIncomingSource,e.folderSource,e.tagSource,e.csvSource),binaryOpSource:e=>kl(e.atomSource,e.binaryBooleanOp.map(t=>t),Si.binaryOp),source:e=>e.binaryOpSource,variableField:e=>e.identifier.chain(t=>Im.includes(t.toUpperCase())?W.fail("Variable fields cannot be a keyword ("+Im.join(" or ")+")"):W.succeed(fn.variable(t))).desc("variable"),numberField:e=>e.number.map(t=>fn.literal(t)).desc("number"),stringField:e=>e.string.map(t=>fn.literal(t)).desc("string"),boolField:e=>e.bool.map(t=>fn.literal(t)).desc("boolean"),dateField:e=>W.seqMap(W.string("date("),W.optWhitespace,e.datePlus,W.optWhitespace,W.string(")"),(t,r,n,i,a)=>fn.literal(n)).desc("date"),durationField:e=>W.seqMap(W.string("dur("),W.optWhitespace,e.duration,W.optWhitespace,W.string(")"),(t,r,n,i,a)=>fn.literal(n)).desc("duration"),nullField:e=>e.rawNull.map(t=>fn.NULL),linkField:e=>e.link.map(t=>fn.literal(t)),listField:e=>e.field.sepBy(W.string(",").trim(W.optWhitespace)).wrap(W.string("[").skip(W.optWhitespace),W.optWhitespace.then(W.string("]"))).map(t=>fn.list(t)).desc("list ('[1, 2, 3]')"),objectField:e=>W.seqMap(e.identifier.or(e.string),W.string(":").trim(W.optWhitespace),e.field,(t,r,n)=>({name:t,value:n})).sepBy(W.string(",").trim(W.optWhitespace)).wrap(W.string("{").skip(W.optWhitespace),W.optWhitespace.then(W.string("}"))).map(t=>{let r={};for(let n of t)r[n.name]=n.value;return fn.object(r)}).desc("object ('{ a: 1, b: 2 }')"),atomInlineField:e=>W.alt(e.date,e.duration.map(t=>NS(t)),e.string,e.tag,e.embedLink,e.bool,e.number,e.rawNull),inlineFieldList:e=>e.atomInlineField.sepBy(W.string(",").trim(W.optWhitespace).lookahead(e.atomInlineField)),inlineField:e=>W.alt(W.seqMap(e.atomInlineField,W.string(",").trim(W.optWhitespace),e.inlineFieldList,(t,r,n)=>[t].concat(n)),e.atomInlineField),atomField:e=>W.alt(e.embedLink.map(t=>fn.literal(t)),e.negatedField,e.linkField,e.listField,e.objectField,e.lambdaField,e.parensField,e.boolField,e.numberField,e.stringField,e.dateField,e.durationField,e.nullField,e.variableField),indexField:e=>W.seqMap(e.atomField,W.alt(e.dotPostfix,e.indexPostfix,e.functionPostfix).many(),(t,r)=>{let n=t;for(let i of r)switch(i.type){case"dot":n=fn.index(n,fn.literal(i.field));break;case"index":n=fn.index(n,i.field);break;case"function":n=fn.func(n,i.fields);break}return n}),negatedField:e=>W.seqMap(W.string("!"),e.indexField,(t,r)=>fn.negate(r)).desc("negated field"),parensField:e=>W.seqMap(W.string("("),W.optWhitespace,e.field,W.optWhitespace,W.string(")"),(t,r,n,i,a)=>n),lambdaField:e=>W.seqMap(e.identifier.sepBy(W.string(",").trim(W.optWhitespace)).wrap(W.string("(").trim(W.optWhitespace),W.string(")").trim(W.optWhitespace)),W.string("=>").trim(W.optWhitespace),e.field,(t,r,n)=>({type:"lambda",arguments:t,value:n})),dotPostfix:e=>W.seqMap(W.string("."),e.identifier,(t,r)=>({type:"dot",field:r})),indexPostfix:e=>W.seqMap(W.string("["),W.optWhitespace,e.field,W.optWhitespace,W.string("]"),(t,r,n,i,a)=>({type:"index",field:n})),functionPostfix:e=>W.seqMap(W.string("("),W.optWhitespace,e.field.sepBy(W.string(",").trim(W.optWhitespace)),W.optWhitespace,W.string(")"),(t,r,n,i,a)=>({type:"function",fields:n})),binaryMulDivField:e=>kl(e.indexField,e.binaryMulDiv,fn.binaryOp),binaryPlusMinusField:e=>kl(e.binaryMulDivField,e.binaryPlusMinus,fn.binaryOp),binaryCompareField:e=>kl(e.binaryPlusMinusField,e.binaryCompareOp,fn.binaryOp),binaryBooleanField:e=>kl(e.binaryCompareField,e.binaryBooleanOp,fn.binaryOp),binaryOpField:e=>e.binaryBooleanField,field:e=>e.binaryOpField});function KP(e){try{return Ec.success(ai.field.tryParse(e))}catch(t){return Ec.failure(""+t)}}var Cc;(function(e){function t(n,i){return{name:n,field:i}}e.named=t;function r(n,i){return{field:n,direction:i}}e.sortBy=r})(Cc||(Cc={}));function jP(e){return W.custom((t,r)=>(n,i)=>{let a=e._(n,i);return a.status?Object.assign({},a,{value:[a.value,n.substring(i,a.index)]}):a})}function qP(e){return e.split(/[\r\n]+/).map(t=>t.trim()).join("")}function R0(e,t){return W.eof.map(e).or(W.whitespace.then(t))}var RS=W.createLanguage({queryType:e=>W.alt(W.regexp(/TABLE|LIST|TASK|CALENDAR/i)).map(t=>t.toLowerCase()).desc("query type ('TABLE', 'LIST', 'TASK', or 'CALENDAR')"),explicitNamedField:e=>W.seqMap(ai.field.skip(W.whitespace),W.regexp(/AS/i).skip(W.whitespace),ai.identifier.or(ai.string),(t,r,n)=>Cc.named(n,t)),comment:()=>W.Parser((e,t)=>{let r=e.substring(t);if(!r.startsWith("//"))return W.makeFailure(t,"Not a comment");r=r.split(` +`)[0];let n=r.substring(2).trim();return W.makeSuccess(t+r.length,n)}),namedField:e=>W.alt(e.explicitNamedField,jP(ai.field).map(([t,r])=>Cc.named(qP(r),t))),sortField:e=>W.seqMap(ai.field.skip(W.optWhitespace),W.regexp(/ASCENDING|DESCENDING|ASC|DESC/i).atMost(1),(t,r)=>{let n=r.length==0?"ascending":r[0].toLowerCase();return n=="desc"&&(n="descending"),n=="asc"&&(n="ascending"),{field:t,direction:n}}),headerClause:e=>e.queryType.chain(t=>{switch(t){case"table":return R0(()=>({type:t,fields:[],showId:!0}),W.seqMap(W.regexp(/WITHOUT\s+ID/i).skip(W.optWhitespace).atMost(1),W.sepBy(e.namedField,W.string(",").trim(W.optWhitespace)),(r,n)=>({type:t,fields:n,showId:r.length==0})));case"list":return R0(()=>({type:t,format:void 0,showId:!0}),W.seqMap(W.regexp(/WITHOUT\s+ID/i).skip(W.optWhitespace).atMost(1),ai.field.atMost(1),(r,n)=>({type:t,format:n.length==1?n[0]:void 0,showId:r.length==0})));case"task":return W.succeed({type:t});case"calendar":return W.whitespace.then(W.seqMap(e.namedField,r=>({type:t,showId:!0,field:r})));default:return W.fail(`Unrecognized query type '${t}'`)}}).desc("TABLE or LIST or TASK or CALENDAR"),fromClause:e=>W.seqMap(W.regexp(/FROM/i),W.whitespace,ai.source,(t,r,n)=>n),whereClause:e=>W.seqMap(W.regexp(/WHERE/i),W.whitespace,ai.field,(t,r,n)=>({type:"where",clause:n})).desc("WHERE "),sortByClause:e=>W.seqMap(W.regexp(/SORT/i),W.whitespace,e.sortField.sepBy1(W.string(",").trim(W.optWhitespace)),(t,r,n)=>({type:"sort",fields:n})).desc("SORT field [ASC/DESC]"),limitClause:e=>W.seqMap(W.regexp(/LIMIT/i),W.whitespace,ai.field,(t,r,n)=>({type:"limit",amount:n})).desc("LIMIT "),flattenClause:e=>W.seqMap(W.regexp(/FLATTEN/i).skip(W.whitespace),e.namedField,(t,r)=>({type:"flatten",field:r})).desc("FLATTEN [AS ]"),groupByClause:e=>W.seqMap(W.regexp(/GROUP BY/i).skip(W.whitespace),e.namedField,(t,r)=>({type:"group",field:r})).desc("GROUP BY [AS ]"),clause:e=>W.alt(e.fromClause,e.whereClause,e.sortByClause,e.limitClause,e.groupByClause,e.flattenClause),query:e=>W.seqMap(e.headerClause.trim(dm),e.fromClause.trim(dm).atMost(1),e.clause.trim(dm).many(),(t,r,n)=>({header:t,source:r.length==0?Si.folder(""):r[0],operations:n,settings:Hm}))}),dm=W.alt(W.whitespace,RS.comment).many().map(e=>e.join("")),GP=e=>{var t;return e?(t=e.plugins.plugins.dataview)==null?void 0:t.api:window.DataviewAPI},JP=e=>e.plugins.enabledPlugins.has("dataview");Ei.DATE_SHORTHANDS=Fm;Ei.DURATION_TYPES=Tm;Ei.EXPRESSION=ai;Ei.KEYWORDS=Im;Ei.QUERY_LANGUAGE=RS;Ei.getAPI=GP;Ei.isPluginEnabled=JP;Ei.parseField=KP});var HS=wn((Vm,$m)=>{(function(e,t){typeof Vm=="object"&&typeof $m!="undefined"?$m.exports=t():typeof define=="function"&&define.amd?define(t):e.Mark=t()})(Vm,function(){"use strict";var e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},t=function(s,u){if(!(s instanceof u))throw new TypeError("Cannot call a class as a function")},r=function(){function s(u,l){for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:!0,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5e3;t(this,s),this.ctx=u,this.iframes=l,this.exclude=c,this.iframesTimeout=d}return r(s,[{key:"getContexts",value:function(){var l=void 0,c=[];return typeof this.ctx=="undefined"||!this.ctx?l=[]:NodeList.prototype.isPrototypeOf(this.ctx)?l=Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?l=this.ctx:typeof this.ctx=="string"?l=Array.prototype.slice.call(document.querySelectorAll(this.ctx)):l=[this.ctx],l.forEach(function(d){var m=c.filter(function(h){return h.contains(d)}).length>0;c.indexOf(d)===-1&&!m&&c.push(d)}),c}},{key:"getIframeContents",value:function(l,c){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},m=void 0;try{var h=l.contentWindow;if(m=h.document,!h||!m)throw new Error("iframe inaccessible")}catch(g){d()}m&&c(m)}},{key:"isIframeBlank",value:function(l){var c="about:blank",d=l.getAttribute("src").trim(),m=l.contentWindow.location.href;return m===c&&d!==c&&d}},{key:"observeIframeLoad",value:function(l,c,d){var m=this,h=!1,g=null,y=function v(){if(!h){h=!0,activeWindow.clearTimeout(g);try{m.isIframeBlank(l)||(l.removeEventListener("load",v),m.getIframeContents(l,c,d))}catch(D){d()}}};l.addEventListener("load",y),g=activeWindow.setTimeout(y,this.iframesTimeout)}},{key:"onIframeReady",value:function(l,c,d){try{l.contentWindow.document.readyState==="complete"?this.isIframeBlank(l)?this.observeIframeLoad(l,c,d):this.getIframeContents(l,c,d):this.observeIframeLoad(l,c,d)}catch(m){d()}}},{key:"waitForIframes",value:function(l,c){var d=this,m=0;this.forEachIframe(l,function(){return!0},function(h){m++,d.waitForIframes(h.querySelector("html"),function(){--m||c()})},function(h){h||c()})}},{key:"forEachIframe",value:function(l,c,d){var m=this,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){},g=l.querySelectorAll("iframe"),y=g.length,v=0;g=Array.prototype.slice.call(g);var D=function(){--y<=0&&h(v)};y||D(),g.forEach(function(I){s.matches(I,m.exclude)?D():m.onIframeReady(I,function(C){c(I)&&(v++,d(C)),D()},D)})}},{key:"createIterator",value:function(l,c,d){return document.createNodeIterator(l,c,d,!1)}},{key:"createInstanceOnIframe",value:function(l){return new s(l.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(l,c,d){var m=l.compareDocumentPosition(d),h=Node.DOCUMENT_POSITION_PRECEDING;if(m&h)if(c!==null){var g=c.compareDocumentPosition(d),y=Node.DOCUMENT_POSITION_FOLLOWING;if(g&y)return!0}else return!0;return!1}},{key:"getIteratorNode",value:function(l){var c=l.previousNode(),d=void 0;return c===null?d=l.nextNode():d=l.nextNode()&&l.nextNode(),{prevNode:c,node:d}}},{key:"checkIframeFilter",value:function(l,c,d,m){var h=!1,g=!1;return m.forEach(function(y,v){y.val===d&&(h=v,g=y.handled)}),this.compareNodeIframe(l,c,d)?(h===!1&&!g?m.push({val:d,handled:!0}):h!==!1&&!g&&(m[h].handled=!0),!0):(h===!1&&m.push({val:d,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(l,c,d,m){var h=this;l.forEach(function(g){g.handled||h.getIframeContents(g.val,function(y){h.createInstanceOnIframe(y).forEachNode(c,d,m)})})}},{key:"iterateThroughNodes",value:function(l,c,d,m,h){for(var g=this,y=this.createIterator(c,l,m),v=[],D=[],I=void 0,C=void 0,x=function(){var A=g.getIteratorNode(y);return C=A.prevNode,I=A.node,I};x();)this.iframes&&this.forEachIframe(c,function(O){return g.checkIframeFilter(I,C,O,v)},function(O){g.createInstanceOnIframe(O).forEachNode(l,function(A){return D.push(A)},m)}),D.push(I);D.forEach(function(O){d(O)}),this.iframes&&this.handleOpenIframes(v,l,d,m),h()}},{key:"forEachNode",value:function(l,c,d){var m=this,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){},g=this.getContexts(),y=g.length;y||h(),g.forEach(function(v){var D=function(){m.iterateThroughNodes(l,v,c,d,function(){--y<=0&&h()})};m.iframes?m.waitForIframes(v,D):D()})}}],[{key:"matches",value:function(l,c){var d=typeof c=="string"?[c]:c,m=l.matches||l.matchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.oMatchesSelector||l.webkitMatchesSelector;if(m){var h=!1;return d.every(function(g){return m.call(l,g)?(h=!0,!1):!0}),h}else return!1}}]),s}(),a=function(){function s(u){t(this,s),this.ctx=u,this.ie=!1;var l=window.navigator.userAgent;(l.indexOf("MSIE")>-1||l.indexOf("Trident")>-1)&&(this.ie=!0)}return r(s,[{key:"log",value:function(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"debug",d=this.opt.log;this.opt.debug&&(typeof d=="undefined"?"undefined":e(d))==="object"&&typeof d[c]=="function"&&d[c]("mark.js: "+l)}},{key:"escapeStr",value:function(l){return l.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(l){return this.opt.wildcards!=="disabled"&&(l=this.setupWildcardsRegExp(l)),l=this.escapeStr(l),Object.keys(this.opt.synonyms).length&&(l=this.createSynonymsRegExp(l)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(l=this.setupIgnoreJoinersRegExp(l)),this.opt.diacritics&&(l=this.createDiacriticsRegExp(l)),l=this.createMergedBlanksRegExp(l),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(l=this.createJoinersRegExp(l)),this.opt.wildcards!=="disabled"&&(l=this.createWildcardsRegExp(l)),l=this.createAccuracyRegExp(l),l}},{key:"createSynonymsRegExp",value:function(l){var c=this.opt.synonyms,d=this.opt.caseSensitive?"":"i",m=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var h in c)if(c.hasOwnProperty(h)){var g=c[h],y=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(h):this.escapeStr(h),v=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(g):this.escapeStr(g);y!==""&&v!==""&&(l=l.replace(new RegExp("("+this.escapeStr(y)+"|"+this.escapeStr(v)+")","gm"+d),m+("("+this.processSynomyms(y)+"|")+(this.processSynomyms(v)+")")+m))}return l}},{key:"processSynomyms",value:function(l){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(l=this.setupIgnoreJoinersRegExp(l)),l}},{key:"setupWildcardsRegExp",value:function(l){return l=l.replace(/(?:\\)*\?/g,function(c){return c.charAt(0)==="\\"?"?":""}),l.replace(/(?:\\)*\*/g,function(c){return c.charAt(0)==="\\"?"*":""})}},{key:"createWildcardsRegExp",value:function(l){var c=this.opt.wildcards==="withSpaces";return l.replace(/\u0001/g,c?"[\\S\\s]?":"\\S?").replace(/\u0002/g,c?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(l){return l.replace(/[^(|)\\]/g,function(c,d,m){var h=m.charAt(d+1);return/[(|)\\]/.test(h)||h===""?c:c+"\0"})}},{key:"createJoinersRegExp",value:function(l){var c=[],d=this.opt.ignorePunctuation;return Array.isArray(d)&&d.length&&c.push(this.escapeStr(d.join(""))),this.opt.ignoreJoiners&&c.push("\\u00ad\\u200b\\u200c\\u200d"),c.length?l.split(/\u0000+/).join("["+c.join("")+"]*"):l}},{key:"createDiacriticsRegExp",value:function(l){var c=this.opt.caseSensitive?"":"i",d=this.opt.caseSensitive?["a\xE0\xE1\u1EA3\xE3\u1EA1\u0103\u1EB1\u1EAF\u1EB3\u1EB5\u1EB7\xE2\u1EA7\u1EA5\u1EA9\u1EAB\u1EAD\xE4\xE5\u0101\u0105","A\xC0\xC1\u1EA2\xC3\u1EA0\u0102\u1EB0\u1EAE\u1EB2\u1EB4\u1EB6\xC2\u1EA6\u1EA4\u1EA8\u1EAA\u1EAC\xC4\xC5\u0100\u0104","c\xE7\u0107\u010D","C\xC7\u0106\u010C","d\u0111\u010F","D\u0110\u010E","e\xE8\xE9\u1EBB\u1EBD\u1EB9\xEA\u1EC1\u1EBF\u1EC3\u1EC5\u1EC7\xEB\u011B\u0113\u0119","E\xC8\xC9\u1EBA\u1EBC\u1EB8\xCA\u1EC0\u1EBE\u1EC2\u1EC4\u1EC6\xCB\u011A\u0112\u0118","i\xEC\xED\u1EC9\u0129\u1ECB\xEE\xEF\u012B","I\xCC\xCD\u1EC8\u0128\u1ECA\xCE\xCF\u012A","l\u0142","L\u0141","n\xF1\u0148\u0144","N\xD1\u0147\u0143","o\xF2\xF3\u1ECF\xF5\u1ECD\xF4\u1ED3\u1ED1\u1ED5\u1ED7\u1ED9\u01A1\u1EDF\u1EE1\u1EDB\u1EDD\u1EE3\xF6\xF8\u014D","O\xD2\xD3\u1ECE\xD5\u1ECC\xD4\u1ED2\u1ED0\u1ED4\u1ED6\u1ED8\u01A0\u1EDE\u1EE0\u1EDA\u1EDC\u1EE2\xD6\xD8\u014C","r\u0159","R\u0158","s\u0161\u015B\u0219\u015F","S\u0160\u015A\u0218\u015E","t\u0165\u021B\u0163","T\u0164\u021A\u0162","u\xF9\xFA\u1EE7\u0169\u1EE5\u01B0\u1EEB\u1EE9\u1EED\u1EEF\u1EF1\xFB\xFC\u016F\u016B","U\xD9\xDA\u1EE6\u0168\u1EE4\u01AF\u1EEA\u1EE8\u1EEC\u1EEE\u1EF0\xDB\xDC\u016E\u016A","y\xFD\u1EF3\u1EF7\u1EF9\u1EF5\xFF","Y\xDD\u1EF2\u1EF6\u1EF8\u1EF4\u0178","z\u017E\u017C\u017A","Z\u017D\u017B\u0179"]:["a\xE0\xE1\u1EA3\xE3\u1EA1\u0103\u1EB1\u1EAF\u1EB3\u1EB5\u1EB7\xE2\u1EA7\u1EA5\u1EA9\u1EAB\u1EAD\xE4\xE5\u0101\u0105A\xC0\xC1\u1EA2\xC3\u1EA0\u0102\u1EB0\u1EAE\u1EB2\u1EB4\u1EB6\xC2\u1EA6\u1EA4\u1EA8\u1EAA\u1EAC\xC4\xC5\u0100\u0104","c\xE7\u0107\u010DC\xC7\u0106\u010C","d\u0111\u010FD\u0110\u010E","e\xE8\xE9\u1EBB\u1EBD\u1EB9\xEA\u1EC1\u1EBF\u1EC3\u1EC5\u1EC7\xEB\u011B\u0113\u0119E\xC8\xC9\u1EBA\u1EBC\u1EB8\xCA\u1EC0\u1EBE\u1EC2\u1EC4\u1EC6\xCB\u011A\u0112\u0118","i\xEC\xED\u1EC9\u0129\u1ECB\xEE\xEF\u012BI\xCC\xCD\u1EC8\u0128\u1ECA\xCE\xCF\u012A","l\u0142L\u0141","n\xF1\u0148\u0144N\xD1\u0147\u0143","o\xF2\xF3\u1ECF\xF5\u1ECD\xF4\u1ED3\u1ED1\u1ED5\u1ED7\u1ED9\u01A1\u1EDF\u1EE1\u1EDB\u1EDD\u1EE3\xF6\xF8\u014DO\xD2\xD3\u1ECE\xD5\u1ECC\xD4\u1ED2\u1ED0\u1ED4\u1ED6\u1ED8\u01A0\u1EDE\u1EE0\u1EDA\u1EDC\u1EE2\xD6\xD8\u014C","r\u0159R\u0158","s\u0161\u015B\u0219\u015FS\u0160\u015A\u0218\u015E","t\u0165\u021B\u0163T\u0164\u021A\u0162","u\xF9\xFA\u1EE7\u0169\u1EE5\u01B0\u1EEB\u1EE9\u1EED\u1EEF\u1EF1\xFB\xFC\u016F\u016BU\xD9\xDA\u1EE6\u0168\u1EE4\u01AF\u1EEA\u1EE8\u1EEC\u1EEE\u1EF0\xDB\xDC\u016E\u016A","y\xFD\u1EF3\u1EF7\u1EF9\u1EF5\xFFY\xDD\u1EF2\u1EF6\u1EF8\u1EF4\u0178","z\u017E\u017C\u017AZ\u017D\u017B\u0179"],m=[];return l.split("").forEach(function(h){d.every(function(g){if(g.indexOf(h)!==-1){if(m.indexOf(g)>-1)return!1;l=l.replace(new RegExp("["+g+"]","gm"+c),"["+g+"]"),m.push(g)}return!0})}),l}},{key:"createMergedBlanksRegExp",value:function(l){return l.replace(/[\s]+/gmi,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(l){var c=this,d="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\xA1\xBF",m=this.opt.accuracy,h=typeof m=="string"?m:m.value,g=typeof m=="string"?[]:m.limiters,y="";switch(g.forEach(function(v){y+="|"+c.escapeStr(v)}),h){case"partially":default:return"()("+l+")";case"complementary":return y="\\s"+(y||this.escapeStr(d)),"()([^"+y+"]*"+l+"[^"+y+"]*)";case"exactly":return"(^|\\s"+y+")("+l+")(?=$|\\s"+y+")"}}},{key:"getSeparatedKeywords",value:function(l){var c=this,d=[];return l.forEach(function(m){c.opt.separateWordSearch?m.split(" ").forEach(function(h){h.trim()&&d.indexOf(h)===-1&&d.push(h)}):m.trim()&&d.indexOf(m)===-1&&d.push(m)}),{keywords:d.sort(function(m,h){return h.length-m.length}),length:d.length}}},{key:"isNumeric",value:function(l){return Number(parseFloat(l))==l}},{key:"checkRanges",value:function(l){var c=this;if(!Array.isArray(l)||Object.prototype.toString.call(l[0])!=="[object Object]")return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(l),[];var d=[],m=0;return l.sort(function(h,g){return h.start-g.start}).forEach(function(h){var g=c.callNoMatchOnInvalidRanges(h,m),y=g.start,v=g.end,D=g.valid;D&&(h.start=y,h.length=v-y,d.push(h),m=v)}),d}},{key:"callNoMatchOnInvalidRanges",value:function(l,c){var d=void 0,m=void 0,h=!1;return l&&typeof l.start!="undefined"?(d=parseInt(l.start,10),m=d+parseInt(l.length,10),this.isNumeric(l.start)&&this.isNumeric(l.length)&&m-c>0&&m-d>0?h=!0:(this.log("Ignoring invalid or overlapping range: "+(""+JSON.stringify(l))),this.opt.noMatch(l))):(this.log("Ignoring invalid range: "+JSON.stringify(l)),this.opt.noMatch(l)),{start:d,end:m,valid:h}}},{key:"checkWhitespaceRanges",value:function(l,c,d){var m=void 0,h=!0,g=d.length,y=c-g,v=parseInt(l.start,10)-y;return v=v>g?g:v,m=v+parseInt(l.length,10),m>g&&(m=g,this.log("End range automatically set to the max value of "+g)),v<0||m-v<0||v>g||m>g?(h=!1,this.log("Invalid range: "+JSON.stringify(l)),this.opt.noMatch(l)):d.substring(v,m).replace(/\s+/g,"")===""&&(h=!1,this.log("Skipping whitespace only range: "+JSON.stringify(l)),this.opt.noMatch(l)),{start:v,end:m,valid:h}}},{key:"getTextNodes",value:function(l){var c=this,d="",m=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(h){m.push({start:d.length,end:(d+=h.textContent).length,node:h})},function(h){return c.matchesExclude(h.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){l({value:d,nodes:m})})}},{key:"matchesExclude",value:function(l){return i.matches(l,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(l,c,d){var m=this.opt.element?this.opt.element:"mark",h=l.splitText(c),g=h.splitText(d-c),y=document.createElement(m);return y.setAttribute("data-markjs","true"),this.opt.className&&y.setAttribute("class",this.opt.className),y.textContent=h.textContent,h.parentNode.replaceChild(y,h),g}},{key:"wrapRangeInMappedTextNode",value:function(l,c,d,m,h){var g=this;l.nodes.every(function(y,v){var D=l.nodes[v+1];if(typeof D=="undefined"||D.start>c){if(!m(y.node))return!1;var I=c-y.start,C=(d>y.end?y.end:d)-y.start,x=l.value.substr(0,y.start),O=l.value.substr(C+y.start);if(y.node=g.wrapRangeInTextNode(y.node,I,C),l.value=x+O,l.nodes.forEach(function(A,P){P>=v&&(l.nodes[P].start>0&&P!==v&&(l.nodes[P].start-=C),l.nodes[P].end-=C)}),d-=C,h(y.node.previousSibling,y.start),d>y.end)c=y.end;else return!1}return!0})}},{key:"wrapMatches",value:function(l,c,d,m,h){var g=this,y=c===0?0:c+1;this.getTextNodes(function(v){v.nodes.forEach(function(D){D=D.node;for(var I=void 0;(I=l.exec(D.textContent))!==null&&I[y]!=="";)if(d(I[y],D)){var C=I.index;if(y!==0)for(var x=1;x{(function(e,t){typeof Um=="object"&&typeof ls!="undefined"?ls.exports=t():typeof define=="function"&&define.amd?define(t):e.moment=t()})(Um,function(){"use strict";var e;function t(){return e.apply(null,arguments)}function r(f){e=f}function n(f){return f instanceof Array||Object.prototype.toString.call(f)==="[object Array]"}function i(f){return f!=null&&Object.prototype.toString.call(f)==="[object Object]"}function a(f,p){return Object.prototype.hasOwnProperty.call(f,p)}function o(f){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(f).length===0;var p;for(p in f)if(a(f,p))return!1;return!0}function s(f){return f===void 0}function u(f){return typeof f=="number"||Object.prototype.toString.call(f)==="[object Number]"}function l(f){return f instanceof Date||Object.prototype.toString.call(f)==="[object Date]"}function c(f,p){var w=[],S,F=f.length;for(S=0;S>>0,S;for(S=0;S0)for(w=0;w=0;return(j?w?"+":"":"-")+Math.pow(10,Math.max(0,F)).toString().substr(1)+S}var Ce=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,U=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Je={},it={};function N(f,p,w,S){var F=S;typeof S=="string"&&(F=function(){return this[S]()}),f&&(it[f]=F),p&&(it[p[0]]=function(){return De(F.apply(this,arguments),p[1],p[2])}),w&&(it[w]=function(){return this.localeData().ordinal(F.apply(this,arguments),f)})}function Ze(f){return f.match(/\[[\s\S]/)?f.replace(/^\[|\]$/g,""):f.replace(/\\/g,"")}function It(f){var p=f.match(Ce),w,S;for(w=0,S=p.length;w=0&&U.test(f);)f=f.replace(U,S),U.lastIndex=0,w-=1;return f}var vt={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Wt(f){var p=this._longDateFormat[f],w=this._longDateFormat[f.toUpperCase()];return p||!w?p:(this._longDateFormat[f]=w.match(Ce).map(function(S){return S==="MMMM"||S==="MM"||S==="DD"||S==="dddd"?S.slice(1):S}).join(""),this._longDateFormat[f])}var Tt="Invalid date";function Jt(){return this._invalidDate}var en="%d",gn=/\d{1,2}/;function yn(f){return this._ordinal.replace("%d",f)}var vn={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function xn(f,p,w,S){var F=this._relativeTime[w];return Q(F)?F(f,p,w,S):F.replace(/%d/i,f)}function jn(f,p){var w=this._relativeTime[f>0?"future":"past"];return Q(w)?w(p):w.replace(/%s/i,p)}var sn={};function Rt(f,p){var w=f.toLowerCase();sn[w]=sn[w+"s"]=sn[p]=f}function Vt(f){return typeof f=="string"?sn[f]||sn[f.toLowerCase()]:void 0}function Sr(f){var p={},w,S;for(S in f)a(f,S)&&(w=Vt(S),w&&(p[w]=f[S]));return p}var Rr={};function Bt(f,p){Rr[f]=p}function Hr(f){var p=[],w;for(w in f)a(f,w)&&p.push({unit:w,priority:Rr[w]});return p.sort(function(S,F){return S.priority-F.priority}),p}function rn(f){return f%4===0&&f%100!==0||f%400===0}function At(f){return f<0?Math.ceil(f)||0:Math.floor(f)}function Z(f){var p=+f,w=0;return p!==0&&isFinite(p)&&(w=At(p)),w}function me(f,p){return function(w){return w!=null?(at(this,f,w),t.updateOffset(this,p),this):Ie(this,f)}}function Ie(f,p){return f.isValid()?f._d["get"+(f._isUTC?"UTC":"")+p]():NaN}function at(f,p,w){f.isValid()&&!isNaN(w)&&(p==="FullYear"&&rn(f.year())&&f.month()===1&&f.date()===29?(w=Z(w),f._d["set"+(f._isUTC?"UTC":"")+p](w,f.month(),b(w,f.month()))):f._d["set"+(f._isUTC?"UTC":"")+p](w))}function Dt(f){return f=Vt(f),Q(this[f])?this[f]():this}function Cn(f,p){if(typeof f=="object"){f=Sr(f);var w=Hr(f),S,F=w.length;for(S=0;S68?1900:2e3)};var On=me("FullYear",!0);function Vn(){return rn(this.year())}function ki(f,p,w,S,F,j,se){var Pe;return f<100&&f>=0?(Pe=new Date(f+400,p,w,S,F,j,se),isFinite(Pe.getFullYear())&&Pe.setFullYear(f)):Pe=new Date(f,p,w,S,F,j,se),Pe}function kr(f){var p,w;return f<100&&f>=0?(w=Array.prototype.slice.call(arguments),w[0]=f+400,p=new Date(Date.UTC.apply(null,w)),isFinite(p.getUTCFullYear())&&p.setUTCFullYear(f)):p=new Date(Date.UTC.apply(null,arguments)),p}function Jr(f,p,w){var S=7+p-w,F=(7+kr(f,0,S).getUTCDay()-p)%7;return-F+S-1}function My(f,p,w,S,F){var j=(7+w-S)%7,se=Jr(f,S,F),Pe=1+7*(p-1)+j+se,ut,$t;return Pe<=0?(ut=f-1,$t=qt(ut)+Pe):Pe>qt(f)?(ut=f+1,$t=Pe-qt(f)):(ut=f,$t=Pe),{year:ut,dayOfYear:$t}}function Ns(f,p,w){var S=Jr(f.year(),p,w),F=Math.floor((f.dayOfYear()-S-1)/7)+1,j,se;return F<1?(se=f.year()-1,j=F+xi(se,p,w)):F>xi(f.year(),p,w)?(j=F-xi(f.year(),p,w),se=f.year()+1):(se=f.year(),j=F),{week:j,year:se}}function xi(f,p,w){var S=Jr(f,p,w),F=Jr(f+1,p,w);return(qt(f)-S+F)/7}N("w",["ww",2],"wo","week"),N("W",["WW",2],"Wo","isoWeek"),Rt("week","w"),Rt("isoWeek","W"),Bt("week",5),Bt("isoWeek",5),ae("w",L),ae("ww",L,Ht),ae("W",L),ae("WW",L,Ht),Ft(["w","ww","W","WW"],function(f,p,w,S){p[S.substr(0,1)]=Z(f)});function j_(f){return Ns(f,this._week.dow,this._week.doy).week}var q_={dow:0,doy:6};function G_(){return this._week.dow}function J_(){return this._week.doy}function Z_(f){var p=this.localeData().week(this);return f==null?p:this.add((f-p)*7,"d")}function Q_(f){var p=Ns(this,1,4).week;return f==null?p:this.add((f-p)*7,"d")}N("d",0,"do","day"),N("dd",0,0,function(f){return this.localeData().weekdaysMin(this,f)}),N("ddd",0,0,function(f){return this.localeData().weekdaysShort(this,f)}),N("dddd",0,0,function(f){return this.localeData().weekdays(this,f)}),N("e",0,0,"weekday"),N("E",0,0,"isoWeekday"),Rt("day","d"),Rt("weekday","e"),Rt("isoWeekday","E"),Bt("day",11),Bt("weekday",11),Bt("isoWeekday",11),ae("d",L),ae("e",L),ae("E",L),ae("dd",function(f,p){return p.weekdaysMinRegex(f)}),ae("ddd",function(f,p){return p.weekdaysShortRegex(f)}),ae("dddd",function(f,p){return p.weekdaysRegex(f)}),Ft(["dd","ddd","dddd"],function(f,p,w,S){var F=w._locale.weekdaysParse(f,S,w._strict);F!=null?p.d=F:g(w).invalidWeekday=f}),Ft(["d","e","E"],function(f,p,w,S){p[S]=Z(f)});function X_(f,p){return typeof f!="string"?f:isNaN(f)?(f=p.weekdaysParse(f),typeof f=="number"?f:null):parseInt(f,10)}function e1(f,p){return typeof f=="string"?p.weekdaysParse(f)%7||7:isNaN(f)?null:f}function bf(f,p){return f.slice(p,7).concat(f.slice(0,p))}var t1="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ty="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),n1="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),r1=ye,i1=ye,a1=ye;function o1(f,p){var w=n(this._weekdays)?this._weekdays:this._weekdays[f&&f!==!0&&this._weekdays.isFormat.test(p)?"format":"standalone"];return f===!0?bf(w,this._week.dow):f?w[f.day()]:w}function s1(f){return f===!0?bf(this._weekdaysShort,this._week.dow):f?this._weekdaysShort[f.day()]:this._weekdaysShort}function l1(f){return f===!0?bf(this._weekdaysMin,this._week.dow):f?this._weekdaysMin[f.day()]:this._weekdaysMin}function u1(f,p,w){var S,F,j,se=f.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],S=0;S<7;++S)j=m([2e3,1]).day(S),this._minWeekdaysParse[S]=this.weekdaysMin(j,"").toLocaleLowerCase(),this._shortWeekdaysParse[S]=this.weekdaysShort(j,"").toLocaleLowerCase(),this._weekdaysParse[S]=this.weekdays(j,"").toLocaleLowerCase();return w?p==="dddd"?(F=_.call(this._weekdaysParse,se),F!==-1?F:null):p==="ddd"?(F=_.call(this._shortWeekdaysParse,se),F!==-1?F:null):(F=_.call(this._minWeekdaysParse,se),F!==-1?F:null):p==="dddd"?(F=_.call(this._weekdaysParse,se),F!==-1||(F=_.call(this._shortWeekdaysParse,se),F!==-1)?F:(F=_.call(this._minWeekdaysParse,se),F!==-1?F:null)):p==="ddd"?(F=_.call(this._shortWeekdaysParse,se),F!==-1||(F=_.call(this._weekdaysParse,se),F!==-1)?F:(F=_.call(this._minWeekdaysParse,se),F!==-1?F:null)):(F=_.call(this._minWeekdaysParse,se),F!==-1||(F=_.call(this._weekdaysParse,se),F!==-1)?F:(F=_.call(this._shortWeekdaysParse,se),F!==-1?F:null))}function c1(f,p,w){var S,F,j;if(this._weekdaysParseExact)return u1.call(this,f,p,w);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),S=0;S<7;S++){if(F=m([2e3,1]).day(S),w&&!this._fullWeekdaysParse[S]&&(this._fullWeekdaysParse[S]=new RegExp("^"+this.weekdays(F,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[S]=new RegExp("^"+this.weekdaysShort(F,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[S]=new RegExp("^"+this.weekdaysMin(F,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[S]||(j="^"+this.weekdays(F,"")+"|^"+this.weekdaysShort(F,"")+"|^"+this.weekdaysMin(F,""),this._weekdaysParse[S]=new RegExp(j.replace(".",""),"i")),w&&p==="dddd"&&this._fullWeekdaysParse[S].test(f))return S;if(w&&p==="ddd"&&this._shortWeekdaysParse[S].test(f))return S;if(w&&p==="dd"&&this._minWeekdaysParse[S].test(f))return S;if(!w&&this._weekdaysParse[S].test(f))return S}}function d1(f){if(!this.isValid())return f!=null?this:NaN;var p=this._isUTC?this._d.getUTCDay():this._d.getDay();return f!=null?(f=X_(f,this.localeData()),this.add(f-p,"d")):p}function f1(f){if(!this.isValid())return f!=null?this:NaN;var p=(this.day()+7-this.localeData()._week.dow)%7;return f==null?p:this.add(f-p,"d")}function h1(f){if(!this.isValid())return f!=null?this:NaN;if(f!=null){var p=e1(f,this.localeData());return this.day(this.day()%7?p:p-7)}else return this.day()||7}function m1(f){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Df.call(this),f?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=r1),this._weekdaysStrictRegex&&f?this._weekdaysStrictRegex:this._weekdaysRegex)}function p1(f){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Df.call(this),f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=i1),this._weekdaysShortStrictRegex&&f?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function g1(f){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Df.call(this),f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=a1),this._weekdaysMinStrictRegex&&f?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Df(){function f(lr,Fi){return Fi.length-lr.length}var p=[],w=[],S=[],F=[],j,se,Pe,ut,$t;for(j=0;j<7;j++)se=m([2e3,1]).day(j),Pe=Te(this.weekdaysMin(se,"")),ut=Te(this.weekdaysShort(se,"")),$t=Te(this.weekdays(se,"")),p.push(Pe),w.push(ut),S.push($t),F.push(Pe),F.push(ut),F.push($t);p.sort(f),w.sort(f),S.sort(f),F.sort(f),this._weekdaysRegex=new RegExp("^("+F.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+S.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+w.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+p.join("|")+")","i")}function Sf(){return this.hours()%12||12}function y1(){return this.hours()||24}N("H",["HH",2],0,"hour"),N("h",["hh",2],0,Sf),N("k",["kk",2],0,y1),N("hmm",0,0,function(){return""+Sf.apply(this)+De(this.minutes(),2)}),N("hmmss",0,0,function(){return""+Sf.apply(this)+De(this.minutes(),2)+De(this.seconds(),2)}),N("Hmm",0,0,function(){return""+this.hours()+De(this.minutes(),2)}),N("Hmmss",0,0,function(){return""+this.hours()+De(this.minutes(),2)+De(this.seconds(),2)});function Fy(f,p){N(f,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),p)})}Fy("a",!0),Fy("A",!1),Rt("hour","h"),Bt("hour",13);function Iy(f,p){return p._meridiemParse}ae("a",Iy),ae("A",Iy),ae("H",L),ae("h",L),ae("k",L),ae("HH",L,Ht),ae("hh",L,Ht),ae("kk",L,Ht),ae("hmm",K),ae("hmmss",ee),ae("Hmm",K),ae("Hmmss",ee),We(["H","HH"],Yt),We(["k","kk"],function(f,p,w){var S=Z(f);p[Yt]=S===24?0:S}),We(["a","A"],function(f,p,w){w._isPm=w._locale.isPM(f),w._meridiem=f}),We(["h","hh"],function(f,p,w){p[Yt]=Z(f),g(w).bigHour=!0}),We("hmm",function(f,p,w){var S=f.length-2;p[Yt]=Z(f.substr(0,S)),p[Bn]=Z(f.substr(S)),g(w).bigHour=!0}),We("hmmss",function(f,p,w){var S=f.length-4,F=f.length-2;p[Yt]=Z(f.substr(0,S)),p[Bn]=Z(f.substr(S,2)),p[Er]=Z(f.substr(F)),g(w).bigHour=!0}),We("Hmm",function(f,p,w){var S=f.length-2;p[Yt]=Z(f.substr(0,S)),p[Bn]=Z(f.substr(S))}),We("Hmmss",function(f,p,w){var S=f.length-4,F=f.length-2;p[Yt]=Z(f.substr(0,S)),p[Bn]=Z(f.substr(S,2)),p[Er]=Z(f.substr(F))});function v1(f){return(f+"").toLowerCase().charAt(0)==="p"}var w1=/[ap]\.?m?\.?/i,b1=me("Hours",!0);function D1(f,p,w){return f>11?w?"pm":"PM":w?"am":"AM"}var Ay={calendar:be,longDateFormat:vt,invalidDate:Tt,ordinal:en,dayOfMonthOrdinalParse:gn,relativeTime:vn,months:T,monthsShort:V,week:q_,weekdays:t1,weekdaysMin:n1,weekdaysShort:Ty,meridiemParse:w1},tn={},Rs={},Hs;function S1(f,p){var w,S=Math.min(f.length,p.length);for(w=0;w0;){if(F=nu(j.slice(0,w).join("-")),F)return F;if(S&&S.length>=w&&S1(j,S)>=w-1)break;w--}p++}return Hs}function k1(f){return f.match("^[^/\\\\]*$")!=null}function nu(f){var p=null,w;if(tn[f]===void 0&&typeof ls!="undefined"&&ls&&ls.exports&&k1(f))try{p=Hs._abbr,w=require,w("./locale/"+f),na(p)}catch(S){tn[f]=null}return tn[f]}function na(f,p){var w;return f&&(s(p)?w=Ci(f):w=Ef(f,p),w?Hs=w:typeof console!="undefined"&&console.warn&&console.warn("Locale "+f+" not found. Did you forget to load it?")),Hs._abbr}function Ef(f,p){if(p!==null){var w,S=Ay;if(p.abbr=f,tn[f]!=null)J("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),S=tn[f]._config;else if(p.parentLocale!=null)if(tn[p.parentLocale]!=null)S=tn[p.parentLocale]._config;else if(w=nu(p.parentLocale),w!=null)S=w._config;else return Rs[p.parentLocale]||(Rs[p.parentLocale]=[]),Rs[p.parentLocale].push({name:f,config:p}),null;return tn[f]=new re(te(S,p)),Rs[f]&&Rs[f].forEach(function(F){Ef(F.name,F.config)}),na(f),tn[f]}else return delete tn[f],null}function x1(f,p){if(p!=null){var w,S,F=Ay;tn[f]!=null&&tn[f].parentLocale!=null?tn[f].set(te(tn[f]._config,p)):(S=nu(f),S!=null&&(F=S._config),p=te(F,p),S==null&&(p.abbr=f),w=new re(p),w.parentLocale=tn[f],tn[f]=w),na(f)}else tn[f]!=null&&(tn[f].parentLocale!=null?(tn[f]=tn[f].parentLocale,f===na()&&na(f)):tn[f]!=null&&delete tn[f]);return tn[f]}function Ci(f){var p;if(f&&f._locale&&f._locale._abbr&&(f=f._locale._abbr),!f)return Hs;if(!n(f)){if(p=nu(f),p)return p;f=[f]}return E1(f)}function C1(){return ne(tn)}function kf(f){var p,w=f._a;return w&&g(f).overflow===-2&&(p=w[or]<0||w[or]>11?or:w[sr]<1||w[sr]>b(w[Ot],w[or])?sr:w[Yt]<0||w[Yt]>24||w[Yt]===24&&(w[Bn]!==0||w[Er]!==0||w[Gr]!==0)?Yt:w[Bn]<0||w[Bn]>59?Bn:w[Er]<0||w[Er]>59?Er:w[Gr]<0||w[Gr]>999?Gr:-1,g(f)._overflowDayOfYear&&(psr)&&(p=sr),g(f)._overflowWeeks&&p===-1&&(p=tu),g(f)._overflowWeekday&&p===-1&&(p=z),g(f).overflow=p),f}var _1=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,M1=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,T1=/Z|[+-]\d\d(?::?\d\d)?/,ru=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],xf=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],F1=/^\/?Date\((-?\d+)/i,I1=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,A1={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ly(f){var p,w,S=f._i,F=_1.exec(S)||M1.exec(S),j,se,Pe,ut,$t=ru.length,lr=xf.length;if(F){for(g(f).iso=!0,p=0,w=$t;pqt(se)||f._dayOfYear===0)&&(g(f)._overflowDayOfYear=!0),w=kr(se,0,f._dayOfYear),f._a[or]=w.getUTCMonth(),f._a[sr]=w.getUTCDate()),p=0;p<3&&f._a[p]==null;++p)f._a[p]=S[p]=F[p];for(;p<7;p++)f._a[p]=S[p]=f._a[p]==null?p===2?1:0:f._a[p];f._a[Yt]===24&&f._a[Bn]===0&&f._a[Er]===0&&f._a[Gr]===0&&(f._nextDay=!0,f._a[Yt]=0),f._d=(f._useUTC?kr:ki).apply(null,S),j=f._useUTC?f._d.getUTCDay():f._d.getDay(),f._tzm!=null&&f._d.setUTCMinutes(f._d.getUTCMinutes()-f._tzm),f._nextDay&&(f._a[Yt]=24),f._w&&typeof f._w.d!="undefined"&&f._w.d!==j&&(g(f).weekdayMismatch=!0)}}function V1(f){var p,w,S,F,j,se,Pe,ut,$t;p=f._w,p.GG!=null||p.W!=null||p.E!=null?(j=1,se=4,w=bo(p.GG,f._a[Ot],Ns(Zt(),1,4).year),S=bo(p.W,1),F=bo(p.E,1),(F<1||F>7)&&(ut=!0)):(j=f._locale._week.dow,se=f._locale._week.doy,$t=Ns(Zt(),j,se),w=bo(p.gg,f._a[Ot],$t.year),S=bo(p.w,$t.week),p.d!=null?(F=p.d,(F<0||F>6)&&(ut=!0)):p.e!=null?(F=p.e+j,(p.e<0||p.e>6)&&(ut=!0)):F=j),S<1||S>xi(w,j,se)?g(f)._overflowWeeks=!0:ut!=null?g(f)._overflowWeekday=!0:(Pe=My(w,S,F,j,se),f._a[Ot]=Pe.year,f._dayOfYear=Pe.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function _f(f){if(f._f===t.ISO_8601){Ly(f);return}if(f._f===t.RFC_2822){Py(f);return}f._a=[],g(f).empty=!0;var p=""+f._i,w,S,F,j,se,Pe=p.length,ut=0,$t,lr;for(F=jt(f._f,f._locale).match(Ce)||[],lr=F.length,w=0;w0&&g(f).unusedInput.push(se),p=p.slice(p.indexOf(S)+S.length),ut+=S.length),it[j]?(S?g(f).empty=!1:g(f).unusedTokens.push(j),Hn(j,S,f)):f._strict&&!S&&g(f).unusedTokens.push(j);g(f).charsLeftOver=Pe-ut,p.length>0&&g(f).unusedInput.push(p),f._a[Yt]<=12&&g(f).bigHour===!0&&f._a[Yt]>0&&(g(f).bigHour=void 0),g(f).parsedDateParts=f._a.slice(0),g(f).meridiem=f._meridiem,f._a[Yt]=$1(f._locale,f._a[Yt],f._meridiem),$t=g(f).era,$t!==null&&(f._a[Ot]=f._locale.erasConvertYear($t,f._a[Ot])),Cf(f),kf(f)}function $1(f,p,w){var S;return w==null?p:f.meridiemHour!=null?f.meridiemHour(p,w):(f.isPM!=null&&(S=f.isPM(w),S&&p<12&&(p+=12),!S&&p===12&&(p=0)),p)}function U1(f){var p,w,S,F,j,se,Pe=!1,ut=f._f.length;if(ut===0){g(f).invalidFormat=!0,f._d=new Date(NaN);return}for(F=0;Fthis?this:f:D()});function Hy(f,p){var w,S;if(p.length===1&&n(p[0])&&(p=p[0]),!p.length)return Zt();for(w=p[0],S=1;Sthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function uM(){if(!s(this._isDSTShifted))return this._isDSTShifted;var f={},p;return x(f,this),f=Ny(f),f._a?(p=f._isUTC?m(f._a):Zt(f._a),this._isDSTShifted=this.isValid()&&eM(f._a,p.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function cM(){return this.isValid()?!this._isUTC:!1}function dM(){return this.isValid()?this._isUTC:!1}function Vy(){return this.isValid()?this._isUTC&&this._offset===0:!1}var fM=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,hM=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Zr(f,p){var w=f,S=null,F,j,se;return au(f)?w={ms:f._milliseconds,d:f._days,M:f._months}:u(f)||!isNaN(+f)?(w={},p?w[p]=+f:w.milliseconds=+f):(S=fM.exec(f))?(F=S[1]==="-"?-1:1,w={y:0,d:Z(S[sr])*F,h:Z(S[Yt])*F,m:Z(S[Bn])*F,s:Z(S[Er])*F,ms:Z(Mf(S[Gr]*1e3))*F}):(S=hM.exec(f))?(F=S[1]==="-"?-1:1,w={y:Ha(S[2],F),M:Ha(S[3],F),w:Ha(S[4],F),d:Ha(S[5],F),h:Ha(S[6],F),m:Ha(S[7],F),s:Ha(S[8],F)}):w==null?w={}:typeof w=="object"&&("from"in w||"to"in w)&&(se=mM(Zt(w.from),Zt(w.to)),w={},w.ms=se.milliseconds,w.M=se.months),j=new iu(w),au(f)&&a(f,"_locale")&&(j._locale=f._locale),au(f)&&a(f,"_isValid")&&(j._isValid=f._isValid),j}Zr.fn=iu.prototype,Zr.invalid=X1;function Ha(f,p){var w=f&&parseFloat(f.replace(",","."));return(isNaN(w)?0:w)*p}function $y(f,p){var w={};return w.months=p.month()-f.month()+(p.year()-f.year())*12,f.clone().add(w.months,"M").isAfter(p)&&--w.months,w.milliseconds=+p-+f.clone().add(w.months,"M"),w}function mM(f,p){var w;return f.isValid()&&p.isValid()?(p=Ff(p,f),f.isBefore(p)?w=$y(f,p):(w=$y(p,f),w.milliseconds=-w.milliseconds,w.months=-w.months),w):{milliseconds:0,months:0}}function Uy(f,p){return function(w,S){var F,j;return S!==null&&!isNaN(+S)&&(J(p,"moment()."+p+"(period, number) is deprecated. Please use moment()."+p+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),j=w,w=S,S=j),F=Zr(w,S),Wy(this,F,f),this}}function Wy(f,p,w,S){var F=p._milliseconds,j=Mf(p._days),se=Mf(p._months);f.isValid()&&(S=S==null?!0:S,se&&Qe(f,Ie(f,"Month")+se*w),j&&at(f,"Date",Ie(f,"Date")+j*w),F&&f._d.setTime(f._d.valueOf()+F*w),S&&t.updateOffset(f,j||se))}var pM=Uy(1,"add"),gM=Uy(-1,"subtract");function Yy(f){return typeof f=="string"||f instanceof String}function yM(f){return A(f)||l(f)||Yy(f)||u(f)||wM(f)||vM(f)||f===null||f===void 0}function vM(f){var p=i(f)&&!o(f),w=!1,S=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],F,j,se=S.length;for(F=0;Fw.valueOf():w.valueOf()9999?Mt(w,p?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Q(Date.prototype.toISOString)?p?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Mt(w,"Z")):Mt(w,p?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function OM(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var f="moment",p="",w,S,F,j;return this.isLocal()||(f=this.utcOffset()===0?"moment.utc":"moment.parseZone",p="Z"),w="["+f+'("]',S=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",F="-MM-DD[T]HH:mm:ss.SSS",j=p+'[")]',this.format(w+S+F+j)}function LM(f){f||(f=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var p=Mt(this,f);return this.localeData().postformat(p)}function PM(f,p){return this.isValid()&&(A(f)&&f.isValid()||Zt(f).isValid())?Zr({to:this,from:f}).locale(this.locale()).humanize(!p):this.localeData().invalidDate()}function NM(f){return this.from(Zt(),f)}function RM(f,p){return this.isValid()&&(A(f)&&f.isValid()||Zt(f).isValid())?Zr({from:this,to:f}).locale(this.locale()).humanize(!p):this.localeData().invalidDate()}function HM(f){return this.to(Zt(),f)}function zy(f){var p;return f===void 0?this._locale._abbr:(p=Ci(f),p!=null&&(this._locale=p),this)}var Ky=B("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(f){return f===void 0?this.localeData():this.locale(f)});function jy(){return this._locale}var su=1e3,Do=60*su,lu=60*Do,qy=(365*400+97)*24*lu;function So(f,p){return(f%p+p)%p}function Gy(f,p,w){return f<100&&f>=0?new Date(f+400,p,w)-qy:new Date(f,p,w).valueOf()}function Jy(f,p,w){return f<100&&f>=0?Date.UTC(f+400,p,w)-qy:Date.UTC(f,p,w)}function BM(f){var p,w;if(f=Vt(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?Jy:Gy,f){case"year":p=w(this.year(),0,1);break;case"quarter":p=w(this.year(),this.month()-this.month()%3,1);break;case"month":p=w(this.year(),this.month(),1);break;case"week":p=w(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":p=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":p=w(this.year(),this.month(),this.date());break;case"hour":p=this._d.valueOf(),p-=So(p+(this._isUTC?0:this.utcOffset()*Do),lu);break;case"minute":p=this._d.valueOf(),p-=So(p,Do);break;case"second":p=this._d.valueOf(),p-=So(p,su);break}return this._d.setTime(p),t.updateOffset(this,!0),this}function VM(f){var p,w;if(f=Vt(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?Jy:Gy,f){case"year":p=w(this.year()+1,0,1)-1;break;case"quarter":p=w(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":p=w(this.year(),this.month()+1,1)-1;break;case"week":p=w(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":p=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":p=w(this.year(),this.month(),this.date()+1)-1;break;case"hour":p=this._d.valueOf(),p+=lu-So(p+(this._isUTC?0:this.utcOffset()*Do),lu)-1;break;case"minute":p=this._d.valueOf(),p+=Do-So(p,Do)-1;break;case"second":p=this._d.valueOf(),p+=su-So(p,su)-1;break}return this._d.setTime(p),t.updateOffset(this,!0),this}function $M(){return this._d.valueOf()-(this._offset||0)*6e4}function UM(){return Math.floor(this.valueOf()/1e3)}function WM(){return new Date(this.valueOf())}function YM(){var f=this;return[f.year(),f.month(),f.date(),f.hour(),f.minute(),f.second(),f.millisecond()]}function zM(){var f=this;return{years:f.year(),months:f.month(),date:f.date(),hours:f.hours(),minutes:f.minutes(),seconds:f.seconds(),milliseconds:f.milliseconds()}}function KM(){return this.isValid()?this.toISOString():null}function jM(){return v(this)}function qM(){return d({},g(this))}function GM(){return g(this).overflow}function JM(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}N("N",0,0,"eraAbbr"),N("NN",0,0,"eraAbbr"),N("NNN",0,0,"eraAbbr"),N("NNNN",0,0,"eraName"),N("NNNNN",0,0,"eraNarrow"),N("y",["y",1],"yo","eraYear"),N("y",["yy",2],0,"eraYear"),N("y",["yyy",3],0,"eraYear"),N("y",["yyyy",4],0,"eraYear"),ae("N",Af),ae("NN",Af),ae("NNN",Af),ae("NNNN",sT),ae("NNNNN",lT),We(["N","NN","NNN","NNNN","NNNNN"],function(f,p,w,S){var F=w._locale.erasParse(f,S,w._strict);F?g(w).era=F:g(w).invalidEra=f}),ae("y",ge),ae("yy",ge),ae("yyy",ge),ae("yyyy",ge),ae("yo",uT),We(["y","yy","yyy","yyyy"],Ot),We(["yo"],function(f,p,w,S){var F;w._locale._eraYearOrdinalRegex&&(F=f.match(w._locale._eraYearOrdinalRegex)),w._locale.eraYearOrdinalParse?p[Ot]=w._locale.eraYearOrdinalParse(f,F):p[Ot]=parseInt(f,10)});function ZM(f,p){var w,S,F,j=this._eras||Ci("en")._eras;for(w=0,S=j.length;w=0)return j[S]}function XM(f,p){var w=f.since<=f.until?1:-1;return p===void 0?t(f.since).year():t(f.since).year()+(p-f.offset)*w}function eT(){var f,p,w,S=this.localeData().eras();for(f=0,p=S.length;fj&&(p=j),gT.call(this,f,p,w,S,F))}function gT(f,p,w,S,F){var j=My(f,p,w,S,F),se=kr(j.year,0,j.dayOfYear);return this.year(se.getUTCFullYear()),this.month(se.getUTCMonth()),this.date(se.getUTCDate()),this}N("Q",0,"Qo","quarter"),Rt("quarter","Q"),Bt("quarter",7),ae("Q",_n),We("Q",function(f,p){p[or]=(Z(f)-1)*3});function yT(f){return f==null?Math.ceil((this.month()+1)/3):this.month((f-1)*3+this.month()%3)}N("D",["DD",2],"Do","date"),Rt("date","D"),Bt("date",9),ae("D",L),ae("DD",L,Ht),ae("Do",function(f,p){return f?p._dayOfMonthOrdinalParse||p._ordinalParse:p._dayOfMonthOrdinalParseLenient}),We(["D","DD"],sr),We("Do",function(f,p){p[sr]=Z(f.match(L)[0])});var Qy=me("Date",!0);N("DDD",["DDDD",3],"DDDo","dayOfYear"),Rt("dayOfYear","DDD"),Bt("dayOfYear",4),ae("DDD",ue),ae("DDDD",ar),We(["DDD","DDDD"],function(f,p,w){w._dayOfYear=Z(f)});function vT(f){var p=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return f==null?p:this.add(f-p,"d")}N("m",["mm",2],0,"minute"),Rt("minute","m"),Bt("minute",14),ae("m",L),ae("mm",L,Ht),We(["m","mm"],Bn);var wT=me("Minutes",!1);N("s",["ss",2],0,"second"),Rt("second","s"),Bt("second",15),ae("s",L),ae("ss",L,Ht),We(["s","ss"],Er);var bT=me("Seconds",!1);N("S",0,0,function(){return~~(this.millisecond()/100)}),N(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),N(0,["SSS",3],0,"millisecond"),N(0,["SSSS",4],0,function(){return this.millisecond()*10}),N(0,["SSSSS",5],0,function(){return this.millisecond()*100}),N(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),N(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),N(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),N(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Rt("millisecond","ms"),Bt("millisecond",16),ae("S",ue,_n),ae("SS",ue,Ht),ae("SSS",ue,ar);var ra,Xy;for(ra="SSSS";ra.length<=9;ra+="S")ae(ra,ge);function DT(f,p){p[Gr]=Z(("0."+f)*1e3)}for(ra="S";ra.length<=9;ra+="S")We(ra,DT);Xy=me("Milliseconds",!1),N("z",0,0,"zoneAbbr"),N("zz",0,0,"zoneName");function ST(){return this._isUTC?"UTC":""}function ET(){return this._isUTC?"Coordinated Universal Time":""}var we=O.prototype;we.add=pM,we.calendar=SM,we.clone=EM,we.diff=FM,we.endOf=VM,we.format=LM,we.from=PM,we.fromNow=NM,we.to=RM,we.toNow=HM,we.get=Dt,we.invalidAt=GM,we.isAfter=kM,we.isBefore=xM,we.isBetween=CM,we.isSame=_M,we.isSameOrAfter=MM,we.isSameOrBefore=TM,we.isValid=jM,we.lang=Ky,we.locale=zy,we.localeData=jy,we.max=j1,we.min=K1,we.parsingFlags=qM,we.set=Cn,we.startOf=BM,we.subtract=gM,we.toArray=YM,we.toObject=zM,we.toDate=WM,we.toISOString=AM,we.inspect=OM,typeof Symbol!="undefined"&&Symbol.for!=null&&(we[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),we.toJSON=KM,we.toString=IM,we.unix=UM,we.valueOf=$M,we.creationData=JM,we.eraName=eT,we.eraNarrow=tT,we.eraAbbr=nT,we.eraYear=rT,we.year=On,we.isLeapYear=Vn,we.weekYear=cT,we.isoWeekYear=dT,we.quarter=we.quarters=yT,we.month=ot,we.daysInMonth=qe,we.week=we.weeks=Z_,we.isoWeek=we.isoWeeks=Q_,we.weeksInYear=mT,we.weeksInWeekYear=pT,we.isoWeeksInYear=fT,we.isoWeeksInISOWeekYear=hT,we.date=Qy,we.day=we.days=d1,we.weekday=f1,we.isoWeekday=h1,we.dayOfYear=vT,we.hour=we.hours=b1,we.minute=we.minutes=wT,we.second=we.seconds=bT,we.millisecond=we.milliseconds=Xy,we.utcOffset=nM,we.utc=iM,we.local=aM,we.parseZone=oM,we.hasAlignedHourOffset=sM,we.isDST=lM,we.isLocal=cM,we.isUtcOffset=dM,we.isUtc=Vy,we.isUTC=Vy,we.zoneAbbr=ST,we.zoneName=ET,we.dates=B("dates accessor is deprecated. Use date instead.",Qy),we.months=B("months accessor is deprecated. Use month instead",ot),we.years=B("years accessor is deprecated. Use year instead",On),we.zone=B("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",rM),we.isDSTShifted=B("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",uM);function kT(f){return Zt(f*1e3)}function xT(){return Zt.apply(null,arguments).parseZone()}function ev(f){return f}var Lt=re.prototype;Lt.calendar=pe,Lt.longDateFormat=Wt,Lt.invalidDate=Jt,Lt.ordinal=yn,Lt.preparse=ev,Lt.postformat=ev,Lt.relativeTime=xn,Lt.pastFuture=jn,Lt.set=oe,Lt.eras=ZM,Lt.erasParse=QM,Lt.erasConvertYear=XM,Lt.erasAbbrRegex=aT,Lt.erasNameRegex=iT,Lt.erasNarrowRegex=oT,Lt.months=he,Lt.monthsShort=Me,Lt.monthsParse=Le,Lt.monthsRegex=st,Lt.monthsShortRegex=yt,Lt.week=j_,Lt.firstDayOfYear=J_,Lt.firstDayOfWeek=G_,Lt.weekdays=o1,Lt.weekdaysMin=l1,Lt.weekdaysShort=s1,Lt.weekdaysParse=c1,Lt.weekdaysRegex=m1,Lt.weekdaysShortRegex=p1,Lt.weekdaysMinRegex=g1,Lt.isPM=v1,Lt.meridiem=D1;function cu(f,p,w,S){var F=Ci(),j=m().set(S,p);return F[w](j,f)}function tv(f,p,w){if(u(f)&&(p=f,f=void 0),f=f||"",p!=null)return cu(f,p,w,"month");var S,F=[];for(S=0;S<12;S++)F[S]=cu(f,S,w,"month");return F}function Lf(f,p,w,S){typeof f=="boolean"?(u(p)&&(w=p,p=void 0),p=p||""):(p=f,w=p,f=!1,u(p)&&(w=p,p=void 0),p=p||"");var F=Ci(),j=f?F._week.dow:0,se,Pe=[];if(w!=null)return cu(p,(w+j)%7,S,"day");for(se=0;se<7;se++)Pe[se]=cu(p,(se+j)%7,S,"day");return Pe}function CT(f,p){return tv(f,p,"months")}function _T(f,p){return tv(f,p,"monthsShort")}function MT(f,p,w){return Lf(f,p,w,"weekdays")}function TT(f,p,w){return Lf(f,p,w,"weekdaysShort")}function FT(f,p,w){return Lf(f,p,w,"weekdaysMin")}na("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(f){var p=f%10,w=Z(f%100/10)===1?"th":p===1?"st":p===2?"nd":p===3?"rd":"th";return f+w}}),t.lang=B("moment.lang is deprecated. Use moment.locale instead.",na),t.langData=B("moment.langData is deprecated. Use moment.localeData instead.",Ci);var _i=Math.abs;function IT(){var f=this._data;return this._milliseconds=_i(this._milliseconds),this._days=_i(this._days),this._months=_i(this._months),f.milliseconds=_i(f.milliseconds),f.seconds=_i(f.seconds),f.minutes=_i(f.minutes),f.hours=_i(f.hours),f.months=_i(f.months),f.years=_i(f.years),this}function nv(f,p,w,S){var F=Zr(p,w);return f._milliseconds+=S*F._milliseconds,f._days+=S*F._days,f._months+=S*F._months,f._bubble()}function AT(f,p){return nv(this,f,p,1)}function OT(f,p){return nv(this,f,p,-1)}function rv(f){return f<0?Math.floor(f):Math.ceil(f)}function LT(){var f=this._milliseconds,p=this._days,w=this._months,S=this._data,F,j,se,Pe,ut;return f>=0&&p>=0&&w>=0||f<=0&&p<=0&&w<=0||(f+=rv(Pf(w)+p)*864e5,p=0,w=0),S.milliseconds=f%1e3,F=At(f/1e3),S.seconds=F%60,j=At(F/60),S.minutes=j%60,se=At(j/60),S.hours=se%24,p+=At(se/24),ut=At(iv(p)),w+=ut,p-=rv(Pf(ut)),Pe=At(w/12),w%=12,S.days=p,S.months=w,S.years=Pe,this}function iv(f){return f*4800/146097}function Pf(f){return f*146097/4800}function PT(f){if(!this.isValid())return NaN;var p,w,S=this._milliseconds;if(f=Vt(f),f==="month"||f==="quarter"||f==="year")switch(p=this._days+S/864e5,w=this._months+iv(p),f){case"month":return w;case"quarter":return w/3;case"year":return w/12}else switch(p=this._days+Math.round(Pf(this._months)),f){case"week":return p/7+S/6048e5;case"day":return p+S/864e5;case"hour":return p*24+S/36e5;case"minute":return p*1440+S/6e4;case"second":return p*86400+S/1e3;case"millisecond":return Math.floor(p*864e5)+S;default:throw new Error("Unknown unit "+f)}}function NT(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Z(this._months/12)*31536e6:NaN}function Mi(f){return function(){return this.as(f)}}var RT=Mi("ms"),HT=Mi("s"),BT=Mi("m"),VT=Mi("h"),$T=Mi("d"),UT=Mi("w"),WT=Mi("M"),YT=Mi("Q"),zT=Mi("y");function KT(){return Zr(this)}function jT(f){return f=Vt(f),this.isValid()?this[f+"s"]():NaN}function Ba(f){return function(){return this.isValid()?this._data[f]:NaN}}var qT=Ba("milliseconds"),GT=Ba("seconds"),JT=Ba("minutes"),ZT=Ba("hours"),QT=Ba("days"),XT=Ba("months"),eF=Ba("years");function tF(){return At(this.days()/7)}var Ti=Math.round,Eo={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function nF(f,p,w,S,F){return F.relativeTime(p||1,!!w,f,S)}function rF(f,p,w,S){var F=Zr(f).abs(),j=Ti(F.as("s")),se=Ti(F.as("m")),Pe=Ti(F.as("h")),ut=Ti(F.as("d")),$t=Ti(F.as("M")),lr=Ti(F.as("w")),Fi=Ti(F.as("y")),ia=j<=w.ss&&["s",j]||j0,ia[4]=S,nF.apply(null,ia)}function iF(f){return f===void 0?Ti:typeof f=="function"?(Ti=f,!0):!1}function aF(f,p){return Eo[f]===void 0?!1:p===void 0?Eo[f]:(Eo[f]=p,f==="s"&&(Eo.ss=p-1),!0)}function oF(f,p){if(!this.isValid())return this.localeData().invalidDate();var w=!1,S=Eo,F,j;return typeof f=="object"&&(p=f,f=!1),typeof f=="boolean"&&(w=f),typeof p=="object"&&(S=Object.assign({},Eo,p),p.s!=null&&p.ss==null&&(S.ss=p.s-1)),F=this.localeData(),j=rF(this,!w,S,F),w&&(j=F.pastFuture(+this,j)),F.postformat(j)}var Nf=Math.abs;function ko(f){return(f>0)-(f<0)||+f}function du(){if(!this.isValid())return this.localeData().invalidDate();var f=Nf(this._milliseconds)/1e3,p=Nf(this._days),w=Nf(this._months),S,F,j,se,Pe=this.asSeconds(),ut,$t,lr,Fi;return Pe?(S=At(f/60),F=At(S/60),f%=60,S%=60,j=At(w/12),w%=12,se=f?f.toFixed(3).replace(/\.?0+$/,""):"",ut=Pe<0?"-":"",$t=ko(this._months)!==ko(Pe)?"-":"",lr=ko(this._days)!==ko(Pe)?"-":"",Fi=ko(this._milliseconds)!==ko(Pe)?"-":"",ut+"P"+(j?$t+j+"Y":"")+(w?$t+w+"M":"")+(p?lr+p+"D":"")+(F||S||f?"T":"")+(F?Fi+F+"H":"")+(S?Fi+S+"M":"")+(f?Fi+se+"S":"")):"P0D"}var xt=iu.prototype;xt.isValid=Q1,xt.abs=IT,xt.add=AT,xt.subtract=OT,xt.as=PT,xt.asMilliseconds=RT,xt.asSeconds=HT,xt.asMinutes=BT,xt.asHours=VT,xt.asDays=$T,xt.asWeeks=UT,xt.asMonths=WT,xt.asQuarters=YT,xt.asYears=zT,xt.valueOf=NT,xt._bubble=LT,xt.clone=KT,xt.get=jT,xt.milliseconds=qT,xt.seconds=GT,xt.minutes=JT,xt.hours=ZT,xt.days=QT,xt.weeks=tF,xt.months=XT,xt.years=eF,xt.humanize=oF,xt.toISOString=du,xt.toString=du,xt.toJSON=du,xt.locale=zy,xt.localeData=jy,xt.toIsoString=B("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",du),xt.lang=Ky,N("X",0,0,"unix"),N("x",0,0,"valueOf"),ae("x",M),ae("X",ie),We("X",function(f,p,w){w._d=new Date(parseFloat(f)*1e3)}),We("x",function(f,p,w){w._d=new Date(Z(f))});return t.version="2.29.4",r(Zt),t.fn=we,t.min=q1,t.max=G1,t.now=J1,t.utc=m,t.unix=kT,t.months=CT,t.isDate=l,t.locale=na,t.invalid=D,t.duration=Zr,t.isMoment=A,t.weekdays=MT,t.parseZone=xT,t.localeData=Ci,t.isDuration=au,t.monthsShort=_T,t.weekdaysMin=FT,t.defineLocale=Ef,t.updateLocale=x1,t.locales=C1,t.weekdaysShort=TT,t.normalizeUnits=Vt,t.relativeTimeRounding=iF,t.relativeTimeThreshold=aF,t.calendarFormat=DM,t.prototype=we,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t})});var dx=wn((Fd,_g)=>{(function(t,r){typeof Fd=="object"&&typeof _g=="object"?_g.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Fd=="object"?Fd.Choices=r():t.Choices=r()})(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:a})},r.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,i){if(i&1&&(n=r(n)),i&8||i&4&&typeof n=="object"&&n&&n.__esModule)return n;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:n}),i&2&&typeof n!="string")for(var o in n)r.d(a,o,function(s){return n[s]}.bind(null,o));return a},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="/public/assets/scripts/",r(r.s=4)}([function(e,t,r){"use strict";var n=function(x){return i(x)&&!a(x)};function i(C){return!!C&&typeof C=="object"}function a(C){var x=Object.prototype.toString.call(C);return x==="[object RegExp]"||x==="[object Date]"||u(C)}var o=typeof Symbol=="function"&&Symbol.for,s=o?Symbol.for("react.element"):60103;function u(C){return C.$$typeof===s}function l(C){return Array.isArray(C)?[]:{}}function c(C,x){return x.clone!==!1&&x.isMergeableObject(C)?D(l(C),C,x):C}function d(C,x,O){return C.concat(x).map(function(A){return c(A,O)})}function m(C,x){if(!x.customMerge)return D;var O=x.customMerge(C);return typeof O=="function"?O:D}function h(C){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(C).filter(function(x){return C.propertyIsEnumerable(x)}):[]}function g(C){return Object.keys(C).concat(h(C))}function y(C,x){try{return x in C&&!(Object.hasOwnProperty.call(C,x)&&Object.propertyIsEnumerable.call(C,x))}catch(O){return!1}}function v(C,x,O){var A={};return O.isMergeableObject(C)&&g(C).forEach(function(P){A[P]=c(C[P],O)}),g(x).forEach(function(P){y(C,P)||(!O.isMergeableObject(x[P])||!C[P]?A[P]=c(x[P],O):A[P]=m(P,O)(C[P],x[P],O))}),A}function D(C,x,O){O=O||{},O.arrayMerge=O.arrayMerge||d,O.isMergeableObject=O.isMergeableObject||n,O.cloneUnlessOtherwiseSpecified=c;var A=Array.isArray(x),P=Array.isArray(C),B=A===P;return B?A?O.arrayMerge(C,x,O):v(C,x,O):c(x,O)}D.all=function(x,O){if(!Array.isArray(x))throw new Error("first argument should be an array");return x.reduce(function(A,P){return D(A,P,O)},{})};var I=D;e.exports=I},function(e,t,r){"use strict";(function(n,i){var a=r(3),o;typeof self!="undefined"?o=self:typeof window!="undefined"?o=window:typeof n!="undefined"?o=n:o=i;var s=Object(a.a)(o);t.a=s}).call(this,r(5),r(6)(e))},function(e,t,r){(function(n,i){e.exports=i()})(this,function(){return function(n){var i={};function a(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=n,a.c=i,a.d=function(o,s,u){a.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:u})},a.r=function(o){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},a.t=function(o,s){if(1&s&&(o=a(o)),8&s||4&s&&typeof o=="object"&&o&&o.__esModule)return o;var u=Object.create(null);if(a.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:o}),2&s&&typeof o!="string")for(var l in o)a.d(u,l,function(c){return o[c]}.bind(null,l));return u},a.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(s,"a",s),s},a.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},a.p="",a(a.s=1)}([function(n,i){n.exports=function(a){return Array.isArray?Array.isArray(a):Object.prototype.toString.call(a)==="[object Array]"}},function(n,i,a){function o(m){return(o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h})(m)}function s(m,h){for(var g=0;g1&&arguments[1]!==void 0?arguments[1]:{limit:!1};this._log(`--------- +Search pattern: "`.concat(v,'"'));var I=this._prepareSearchers(v),C=I.tokenSearchers,x=I.fullSearcher,O=this._search(C,x),A=O.weights,P=O.results;return this._computeScore(A,P),this.options.shouldSort&&this._sort(P),D.limit&&typeof D.limit=="number"&&(P=P.slice(0,D.limit)),this._format(P)}},{key:"_prepareSearchers",value:function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",D=[];if(this.options.tokenize)for(var I=v.split(this.options.tokenSeparator),C=0,x=I.length;C0&&arguments[0]!==void 0?arguments[0]:[],D=arguments.length>1?arguments[1]:void 0,I=this.list,C={},x=[];if(typeof I[0]=="string"){for(var O=0,A=I.length;O1)throw new Error("Key weight has to be > 0 and <= 1");te=te.name}else P[te]={weight:1};this._analyze({key:te,value:this.options.getFn(J,te),record:J,index:B},{resultMap:C,results:x,tokenSearchers:v,fullSearcher:D})}return{weights:P,results:x}}},{key:"_analyze",value:function(v,D){var I=v.key,C=v.arrayIndex,x=C===void 0?-1:C,O=v.value,A=v.record,P=v.index,B=D.tokenSearchers,G=B===void 0?[]:B,J=D.fullSearcher,Q=J===void 0?[]:J,oe=D.resultMap,te=oe===void 0?{}:oe,re=D.results,ne=re===void 0?[]:re;if(O!=null){var be=!1,pe=-1,De=0;if(typeof O=="string"){this._log(` +Key: `.concat(I===""?"-":I));var Ce=Q.search(O);if(this._log('Full text: "'.concat(O,'", score: ').concat(Ce.score)),this.options.tokenize){for(var U=O.split(this.options.tokenSeparator),Je=[],it=0;it-1&&(Jt=(Jt+pe)/2),this._log("Score average:",Jt);var en=!this.options.tokenize||!this.options.matchAllTokens||De>=G.length;if(this._log(` +Check Matches: `.concat(en)),(be||Ce.isMatch)&&en){var gn=te[P];gn?gn.output.push({key:I,arrayIndex:x,value:O,score:Jt,matchedIndices:Ce.matchedIndices}):(te[P]={item:A,output:[{key:I,arrayIndex:x,value:O,score:Jt,matchedIndices:Ce.matchedIndices}]},ne.push(te[P]))}}else if(c(O))for(var yn=0,vn=O.length;yn-1&&(be.arrayIndex=ne.arrayIndex),Q.matches.push(be)}}}),this.options.includeScore&&C.push(function(J,Q){Q.score=J.score});for(var x=0,O=v.length;xD)return s(y,this.pattern,I);var C=this.options,x=C.location,O=C.distance,A=C.threshold,P=C.findAllMatches,B=C.minMatchCharLength;return u(y,this.pattern,this.patternAlphabet,{location:x,distance:O,threshold:A,findAllMatches:P,minMatchCharLength:B})}}])&&o(m.prototype,h),g&&o(m,g),d}();n.exports=c},function(n,i){var a=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;n.exports=function(o,s){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:/ +/g,l=new RegExp(s.replace(a,"\\$&").replace(u,"|")),c=o.match(l),d=!!c,m=[];if(d)for(var h=0,g=c.length;h=it;It-=1){var Mt=It-1,jt=c[u.charAt(Mt)];if(jt&&(Q[Mt]=1),Ze[It]=(Ze[It+1]<<1|1)&jt,Ce!==0&&(Ze[It]|=(ne[It+1]|ne[It])<<1|1|ne[It+1]),Ze[It]&De&&(be=o(l,{errors:Ce,currentLocation:Mt,expectedLocation:A,distance:y}))<=B){if(B=be,(G=Mt)<=A)break;it=Math.max(1,2*A-G)}}if(o(l,{errors:Ce+1,currentLocation:A,expectedLocation:A,distance:y})>B)break;ne=Ze}return{isMatch:G>=0,score:be===0?.001:be,matchedIndices:s(Q,O)}}},function(n,i){n.exports=function(a,o){var s=o.errors,u=s===void 0?0:s,l=o.currentLocation,c=l===void 0?0:l,d=o.expectedLocation,m=d===void 0?0:d,h=o.distance,g=h===void 0?100:h,y=u/a.length,v=Math.abs(m-c);return g?y+v/g:v?1:y}},function(n,i){n.exports=function(){for(var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=[],u=-1,l=-1,c=0,d=a.length;c=o&&s.push([u,l]),u=-1)}return a[c-1]&&c-u>=o&&s.push([u,c-1]),s}},function(n,i){n.exports=function(a){for(var o={},s=a.length,u=0;u0)return"Unexpected "+(Y.length>1?"keys":"key")+" "+('"'+Y.join('", "')+'" found in '+V+". ")+"Expected to find one of the known reducer keys instead: "+('"'+T.join('", "')+'". Unexpected keys will be ignored.')}function y(z){Object.keys(z).forEach(function(k){var _=z[k],b=_(void 0,{type:l.INIT});if(typeof b=="undefined")throw new Error('Reducer "'+k+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof _(void 0,{type:l.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+k+'" returned undefined when probed with a random type. '+("Don't try to handle "+l.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function v(z){for(var k=Object.keys(z),_={},b=0;b-1?z.map(function(_){var b=_;return b.id===parseInt(k.choiceId,10)&&(b.selected=!0),b}):z;case"REMOVE_ITEM":return k.choiceId>-1?z.map(function(_){var b=_;return b.id===parseInt(k.choiceId,10)&&(b.selected=!1),b}):z;case"FILTER_CHOICES":return z.map(function(_){var b=_;return b.active=k.results.some(function(T){var V=T.item,Y=T.score;return V.id===b.id?(b.score=Y,!0):!1}),b});case"ACTIVATE_CHOICES":return z.map(function(_){var b=_;return b.active=k.active,b});case"CLEAR_CHOICES":return te;default:return z}}var ne={loading:!1},be=function(k,_){switch(k===void 0&&(k=ne),_.type){case"SET_IS_LOADING":return{loading:_.isLoading};default:return k}},pe=be,De=function(k,_){return Math.floor(Math.random()*(_-k)+k)},Ce=function(k){return Array.from({length:k},function(){return De(0,36).toString(36)}).join("")},U=function(k,_){var b=k.id||k.name&&k.name+"-"+Ce(2)||Ce(4);return b=b.replace(/(:|\.|\[|\]|,)/g,""),b=_+"-"+b,b},Je=function(k){return Object.prototype.toString.call(k).slice(8,-1)},it=function(k,_){return _!=null&&Je(_)===k},N=function(k,_){return _===void 0&&(_=document.createElement("div")),k.nextSibling?k.parentNode.insertBefore(_,k.nextSibling):k.parentNode.appendChild(_),_.appendChild(k)},Ze=function(k,_,b){if(b===void 0&&(b=1),!(!(k instanceof Element)||typeof _!="string")){for(var T=(b>0?"next":"previous")+"ElementSibling",V=k[T];V;){if(V.matches(_))return V;V=V[T]}return V}},It=function(k,_,b){if(b===void 0&&(b=1),!k)return!1;var T;return b>0?T=_.scrollTop+_.offsetHeight>=k.offsetTop+k.offsetHeight:T=k.offsetTop>=_.scrollTop,T},Mt=function(k){return typeof k!="string"?k:k.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/"'+Mt(k)+'"'},maxItemText:function(k){return"Only "+k+" values can be added"},valueComparer:function(k,_){return k===_},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:Bt},rn={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"},At={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"},Z={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34},me="text",Ie="select-one",at="select-multiple",Dt=4,Cn=function(){function z(_){var b=_.element,T=_.type,V=_.classNames,Y=_.position;this.element=b,this.classNames=V,this.type=T,this.position=Y,this.isOpen=!1,this.isFlipped=!1,this.isFocussed=!1,this.isDisabled=!1,this.isLoading=!1,this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}var k=z.prototype;return k.addEventListeners=function(){this.element.addEventListener("focus",this._onFocus),this.element.addEventListener("blur",this._onBlur)},k.removeEventListeners=function(){this.element.removeEventListener("focus",this._onFocus),this.element.removeEventListener("blur",this._onBlur)},k.shouldFlip=function(b){if(typeof b!="number")return!1;var T=!1;return this.position==="auto"?T=!window.matchMedia("(min-height: "+(b+1)+"px)").matches:this.position==="top"&&(T=!0),T},k.setActiveDescendant=function(b){this.element.setAttribute("aria-activedescendant",b)},k.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},k.open=function(b){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(b)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)},k.close=function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)},k.focus=function(){this.isFocussed||this.element.focus()},k.addFocusState=function(){this.element.classList.add(this.classNames.focusState)},k.removeFocusState=function(){this.element.classList.remove(this.classNames.focusState)},k.enable=function(){this.element.classList.remove(this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===Ie&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},k.disable=function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===Ie&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},k.wrap=function(b){N(b,this.element)},k.unwrap=function(b){this.element.parentNode.insertBefore(b,this.element),this.element.parentNode.removeChild(this.element)},k.addLoadingState=function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},k.removeLoadingState=function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},k._onFocus=function(){this.isFocussed=!0},k._onBlur=function(){this.isFocussed=!1},z}();function _n(z,k){for(var _=0;_0?this.element.scrollTop+he-X:b.offsetTop;activeWindow.requestAnimationFrame(function(){V._animateScroll(Me,T)})}},k._scrollDown=function(b,T,V){var Y=(V-b)/T,X=Y>1?Y:1;this.element.scrollTop=b+X},k._scrollUp=function(b,T,V){var Y=(b-V)/T,X=Y>1?Y:1;this.element.scrollTop=b-X},k._animateScroll=function(b,T){var V=this,Y=Dt,X=this.element.scrollTop,le=!1;T>0?(this._scrollDown(X,Y,b),Xb&&(le=!0)),le&&activeWindow.requestAnimationFrame(function(){V._animateScroll(b,T)})},z}();function St(z,k){for(var _=0;_0?"treeitem":"option"),Object.assign(lt.dataset,{choice:"",id:Me,value:Ve,selectText:b}),qe?(lt.classList.add(le),lt.dataset.choiceDisabled="",lt.setAttribute("aria-disabled","true")):(lt.classList.add(Y),lt.dataset.choiceSelectable=""),lt},input:function(k,_){var b=k.input,T=k.inputCloned,V=Object.assign(document.createElement("input"),{type:"text",className:b+" "+T,autocomplete:"off",autocapitalize:"off",spellcheck:!1});return V.setAttribute("role","textbox"),V.setAttribute("aria-autocomplete","list"),V.setAttribute("aria-label",_),V},dropdown:function(k){var _=k.list,b=k.listDropdown,T=document.createElement("div");return T.classList.add(_,b),T.setAttribute("aria-expanded","false"),T},notice:function(k,_,b){var T=k.item,V=k.itemChoice,Y=k.noResults,X=k.noChoices;b===void 0&&(b="");var le=[T,V];return b==="no-choices"?le.push(X):b==="no-results"&&le.push(Y),Object.assign(document.createElement("div"),{innerHTML:_,className:le.join(" ")})},option:function(k){var _=k.label,b=k.value,T=k.customProperties,V=k.active,Y=k.disabled,X=new Option(_,b,!1,V);return T&&(X.dataset.customProperties=T),X.disabled=Y,X}},ye=ie,ce=function(k){var _=k.value,b=k.label,T=k.id,V=k.groupId,Y=k.disabled,X=k.elementId,le=k.customProperties,he=k.placeholder,Me=k.keyCode;return{type:At.ADD_CHOICE,value:_,label:b,id:T,groupId:V,disabled:Y,elementId:X,customProperties:le,placeholder:he,keyCode:Me}},ae=function(k){return{type:At.FILTER_CHOICES,results:k}},Se=function(k){return k===void 0&&(k=!0),{type:At.ACTIVATE_CHOICES,active:k}},nt=function(){return{type:At.CLEAR_CHOICES}},Te=function(k){var _=k.value,b=k.label,T=k.id,V=k.choiceId,Y=k.groupId,X=k.customProperties,le=k.placeholder,he=k.keyCode;return{type:At.ADD_ITEM,value:_,label:b,id:T,choiceId:V,groupId:Y,customProperties:X,placeholder:le,keyCode:he}},Ue=function(k,_){return{type:At.REMOVE_ITEM,id:k,choiceId:_}},We=function(k,_){return{type:At.HIGHLIGHT_ITEM,id:k,highlighted:_}},Ft=function(k){var _=k.value,b=k.id,T=k.active,V=k.disabled;return{type:At.ADD_GROUP,value:_,id:b,active:T,disabled:V}},Hn=function(){return{type:"CLEAR_ALL"}},Ot=function(k){return{type:"RESET_TO",state:k}},or=function(k){return{type:"SET_IS_LOADING",isLoading:k}};function sr(z,k){for(var _=0;_=0?this._store.getGroupById(X):null;return this._store.dispatch(We(V,!0)),T&&this.passedElement.triggerEvent(rn.highlightItem,{id:V,value:he,label:Ve,groupValue:Le&&Le.value?Le.value:null}),this},k.unhighlightItem=function(b){if(!b)return this;var T=b.id,V=b.groupId,Y=V===void 0?-1:V,X=b.value,le=X===void 0?"":X,he=b.label,Me=he===void 0?"":he,Ve=Y>=0?this._store.getGroupById(Y):null;return this._store.dispatch(We(T,!1)),this.passedElement.triggerEvent(rn.highlightItem,{id:T,value:le,label:Me,groupValue:Ve&&Ve.value?Ve.value:null}),this},k.highlightAll=function(){var b=this;return this._store.items.forEach(function(T){return b.highlightItem(T)}),this},k.unhighlightAll=function(){var b=this;return this._store.items.forEach(function(T){return b.unhighlightItem(T)}),this},k.removeActiveItemsByValue=function(b){var T=this;return this._store.activeItems.filter(function(V){return V.value===b}).forEach(function(V){return T._removeItem(V)}),this},k.removeActiveItems=function(b){var T=this;return this._store.activeItems.filter(function(V){var Y=V.id;return Y!==b}).forEach(function(V){return T._removeItem(V)}),this},k.removeHighlightedItems=function(b){var T=this;return b===void 0&&(b=!1),this._store.highlightedActiveItems.forEach(function(V){T._removeItem(V),b&&T._triggerChange(V.value)}),this},k.showDropdown=function(b){var T=this;return this.dropdown.isActive?this:(activeWindow.requestAnimationFrame(function(){T.dropdown.show(),T.containerOuter.open(T.dropdown.distanceFromTopWindow),!b&&T._canSearch&&T.input.focus(),T.passedElement.triggerEvent(rn.showDropdown,{})}),this)},k.hideDropdown=function(b){var T=this;return this.dropdown.isActive?(activeWindow.requestAnimationFrame(function(){T.dropdown.hide(),T.containerOuter.close(),!b&&T._canSearch&&(T.input.removeActiveDescendant(),T.input.blur()),T.passedElement.triggerEvent(rn.hideDropdown,{})}),this):this},k.getValue=function(b){b===void 0&&(b=!1);var T=this._store.activeItems.reduce(function(V,Y){var X=b?Y.value:Y;return V.push(X),V},[]);return this._isSelectOneElement?T[0]:T},k.setValue=function(b){var T=this;return this.initialised?(b.forEach(function(V){return T._setChoiceOrItem(V)}),this):this},k.setChoiceByValue=function(b){var T=this;if(!this.initialised||this._isTextElement)return this;var V=Array.isArray(b)?b:[b];return V.forEach(function(Y){return T._findAndSelectChoiceByValue(Y)}),this},k.setChoices=function(b,T,V,Y){var X=this;if(b===void 0&&(b=[]),T===void 0&&(T="value"),V===void 0&&(V="label"),Y===void 0&&(Y=!1),!this.initialised)throw new ReferenceError("setChoices was called on a non-initialized instance of Choices");if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if(typeof T!="string"||!T)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(Y&&this.clearChoices(),typeof b=="function"){var le=b(this);if(typeof Promise=="function"&&le instanceof Promise)return new Promise(function(he){return activeWindow.requestAnimationFrame(he)}).then(function(){return X._handleLoadingState(!0)}).then(function(){return le}).then(function(he){return X.setChoices(he,T,V,Y)}).catch(function(he){X.config.silent||console.error(he)}).then(function(){return X._handleLoadingState(!1)}).then(function(){return X});if(!Array.isArray(le))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: "+typeof le);return this.setChoices(le,T,V,!1)}if(!Array.isArray(b))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._startLoading(),b.forEach(function(he){he.choices?X._addGroup({id:parseInt(he.id,10)||null,group:he,valueKey:T,labelKey:V}):X._addChoice({value:he[T],label:he[V],isSelected:he.selected,isDisabled:he.disabled,customProperties:he.customProperties,placeholder:he.placeholder})}),this._stopLoading(),this},k.clearChoices=function(){return this._store.dispatch(nt()),this},k.clearStore=function(){return this._store.dispatch(Hn()),this},k.clearInput=function(){var b=!this._isSelectOneElement;return this.input.clear(b),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch(Se(!0))),this},k._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var b=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,T=this._isSelectElement,V=this._currentState.items!==this._prevState.items;b&&(T&&this._renderChoices(),V&&this._renderItems(),this._prevState=this._currentState)}},k._renderChoices=function(){var b=this,T=this._store,V=T.activeGroups,Y=T.activeChoices,X=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&activeWindow.requestAnimationFrame(function(){return b.choiceList.scrollToTop()}),V.length>=1&&!this._isSearching){var le=Y.filter(function(Qe){return Qe.placeholder===!0&&Qe.groupId===-1});le.length>=1&&(X=this._createChoicesFragment(le,X)),X=this._createGroupsFragment(V,Y,X)}else Y.length>=1&&(X=this._createChoicesFragment(Y,X));if(X.childNodes&&X.childNodes.length>0){var he=this._store.activeItems,Me=this._canAddItem(he,this.input.value);Me.response?(this.choiceList.append(X),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",Me.notice))}else{var Ve,Le;this._isSearching?(Le=typeof this.config.noResultsText=="function"?this.config.noResultsText():this.config.noResultsText,Ve=this._getTemplate("notice",Le,"no-results")):(Le=typeof this.config.noChoicesText=="function"?this.config.noChoicesText():this.config.noChoicesText,Ve=this._getTemplate("notice",Le,"no-choices")),this.choiceList.append(Ve)}},k._renderItems=function(){var b=this._store.activeItems||[];this.itemList.clear();var T=this._createItemsFragment(b);T.childNodes&&this.itemList.append(T)},k._createGroupsFragment=function(b,T,V){var Y=this;V===void 0&&(V=document.createDocumentFragment());var X=function(he){return T.filter(function(Me){return Y._isSelectOneElement?Me.groupId===he.id:Me.groupId===he.id&&(Y.config.renderSelectedChoices==="always"||!Me.selected)})};return this.config.shouldSort&&b.sort(this.config.sorter),b.forEach(function(le){var he=X(le);if(he.length>=1){var Me=Y._getTemplate("choiceGroup",le);V.appendChild(Me),Y._createChoicesFragment(he,V,!0)}}),V},k._createChoicesFragment=function(b,T,V){var Y=this;T===void 0&&(T=document.createDocumentFragment()),V===void 0&&(V=!1);var X=this.config,le=X.renderSelectedChoices,he=X.searchResultLimit,Me=X.renderChoiceLimit,Ve=this._isSearching?Wt:this.config.sorter,Le=function(Vn){var ki=le==="auto"?Y._isSelectOneElement||!Vn.selected:!0;if(ki){var kr=Y._getTemplate("choice",Vn,Y.config.itemSelectText);T.appendChild(kr)}},Qe=b;le==="auto"&&!this._isSelectOneElement&&(Qe=b.filter(function(On){return!On.selected}));var ot=Qe.reduce(function(On,Vn){return Vn.placeholder?On.placeholderChoices.push(Vn):On.normalChoices.push(Vn),On},{placeholderChoices:[],normalChoices:[]}),qe=ot.placeholderChoices,yt=ot.normalChoices;(this.config.shouldSort||this._isSearching)&&yt.sort(Ve);var st=Qe.length,lt=this._isSelectOneElement?[].concat(qe,yt):yt;this._isSearching?st=he:Me&&Me>0&&!V&&(st=Me);for(var qt=0;qt=Y){var he=X?this._searchChoices(b):0;this.passedElement.triggerEvent(rn.search,{value:b,resultCount:he})}else le&&(this._isSearching=!1,this._store.dispatch(Se(!0)))}},k._canAddItem=function(b,T){var V=!0,Y=typeof this.config.addItemText=="function"?this.config.addItemText(T):this.config.addItemText;if(!this._isSelectOneElement){var X=Jt(b,T);this.config.maxItemCount>0&&this.config.maxItemCount<=b.length&&(V=!1,Y=typeof this.config.maxItemText=="function"?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&X&&V&&(V=!1,Y=typeof this.config.uniqueItemText=="function"?this.config.uniqueItemText(T):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&V&&typeof this.config.addItemFilter=="function"&&!this.config.addItemFilter(T)&&(V=!1,Y=typeof this.config.customAddItemText=="function"?this.config.customAddItemText(T):this.config.customAddItemText)}return{response:V,notice:Y}},k._searchChoices=function(b){var T=typeof b=="string"?b.trim():b,V=typeof this._currentValue=="string"?this._currentValue.trim():this._currentValue;if(T.length<1&&T===V+" ")return 0;var Y=this._store.searchableChoices,X=T,le=[].concat(this.config.searchFields),he=Object.assign(this.config.fuseOptions,{keys:le}),Me=new i.a(Y,he),Ve=Me.search(X);return this._currentValue=T,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(ae(Ve)),Ve.length},k._addEventListeners=function(){var b=document,T=b.documentElement;T.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),T.addEventListener("click",this._onClick,{passive:!0}),T.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},k._removeEventListeners=function(){var b=document,T=b.documentElement;T.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),T.removeEventListener("click",this._onClick),T.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("keyup",this._onKeyUp),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},k._onKeyDown=function(b){var T,V=b.target,Y=b.keyCode,X=b.ctrlKey,le=b.metaKey,he=this._store.activeItems,Me=this.input.isFocussed,Ve=this.dropdown.isActive,Le=this.itemList.hasChildren(),Qe=String.fromCharCode(Y),ot=Z.BACK_KEY,qe=Z.DELETE_KEY,yt=Z.ENTER_KEY,st=Z.A_KEY,lt=Z.ESC_KEY,qt=Z.UP_KEY,On=Z.DOWN_KEY,Vn=Z.PAGE_UP_KEY,ki=Z.PAGE_DOWN_KEY,kr=X||le;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(Qe)&&this.showDropdown();var Jr=(T={},T[st]=this._onAKey,T[yt]=this._onEnterKey,T[lt]=this._onEscapeKey,T[qt]=this._onDirectionKey,T[Vn]=this._onDirectionKey,T[On]=this._onDirectionKey,T[ki]=this._onDirectionKey,T[qe]=this._onDeleteKey,T[ot]=this._onDeleteKey,T);Jr[Y]&&Jr[Y]({event:b,target:V,keyCode:Y,metaKey:le,activeItems:he,hasFocusedInput:Me,hasActiveDropdown:Ve,hasItems:Le,hasCtrlDownKeyPressed:kr})},k._onKeyUp=function(b){var T=b.target,V=b.keyCode,Y=this.input.value,X=this._store.activeItems,le=this._canAddItem(X,Y),he=Z.BACK_KEY,Me=Z.DELETE_KEY;if(this._isTextElement){var Ve=le.notice&&Y;if(Ve){var Le=this._getTemplate("notice",le.notice);this.dropdown.element.innerHTML=Le.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0)}else{var Qe=(V===he||V===Me)&&!T.value,ot=!this._isTextElement&&this._isSearching,qe=this._canSearch&&le.response;Qe&&ot?(this._isSearching=!1,this._store.dispatch(Se(!0))):qe&&this._handleSearch(this.input.value)}this._canSearch=this.config.searchEnabled},k._onAKey=function(b){var T=b.hasItems,V=b.hasCtrlDownKeyPressed;if(V&&T){this._canSearch=!1;var Y=this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement;Y&&this.highlightAll()}},k._onEnterKey=function(b){var T=b.event,V=b.target,Y=b.activeItems,X=b.hasActiveDropdown,le=Z.ENTER_KEY,he=V.hasAttribute("data-button");if(this._isTextElement&&V.value){var Me=this.input.value,Ve=this._canAddItem(Y,Me);Ve.response&&(this.hideDropdown(!0),this._addItem({value:Me}),this._triggerChange(Me),this.clearInput())}if(he&&(this._handleButtonAction(Y,V),T.preventDefault()),X){var Le=this.dropdown.getChild("."+this.config.classNames.highlightedState);Le&&(Y[0]&&(Y[0].keyCode=le),this._handleChoiceAction(Y,Le)),T.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),T.preventDefault())},k._onEscapeKey=function(b){var T=b.hasActiveDropdown;T&&(this.hideDropdown(!0),this.containerOuter.focus())},k._onDirectionKey=function(b){var T=b.event,V=b.hasActiveDropdown,Y=b.keyCode,X=b.metaKey,le=Z.DOWN_KEY,he=Z.PAGE_UP_KEY,Me=Z.PAGE_DOWN_KEY;if(V||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var Ve=Y===le||Y===Me?1:-1,Le=X||Y===Me||Y===he,Qe="[data-choice-selectable]",ot;if(Le)Ve>0?ot=this.dropdown.element.querySelector(Qe+":last-of-type"):ot=this.dropdown.element.querySelector(Qe);else{var qe=this.dropdown.element.querySelector("."+this.config.classNames.highlightedState);qe?ot=Ze(qe,Qe,Ve):ot=this.dropdown.element.querySelector(Qe)}ot&&(It(ot,this.choiceList.element,Ve)||this.choiceList.scrollToChildElement(ot,Ve),this._highlightChoice(ot)),T.preventDefault()}},k._onDeleteKey=function(b){var T=b.event,V=b.target,Y=b.hasFocusedInput,X=b.activeItems;Y&&!V.value&&!this._isSelectOneElement&&(this._handleBackspace(X),T.preventDefault())},k._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},k._onTouchEnd=function(b){var T=b||b.touches[0],V=T.target,Y=this._wasTap&&this.containerOuter.element.contains(V);if(Y){var X=V===this.containerOuter.element||V===this.containerInner.element;X&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),b.stopPropagation()}this._wasTap=!0},k._onMouseDown=function(b){var T=b.target;if(T instanceof HTMLElement){if(Bn&&this.choiceList.element.contains(T)){var V=this.choiceList.element.firstElementChild,Y=this._direction==="ltr"?b.offsetX>=V.offsetWidth:b.offsetX0;Y&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0)}},k._onFocus=function(b){var T=this,V,Y=b.target,X=this.containerOuter.element.contains(Y);if(X){var le=(V={},V[me]=function(){Y===T.input.element&&T.containerOuter.addFocusState()},V[Ie]=function(){T.containerOuter.addFocusState(),Y===T.input.element&&T.showDropdown(!0)},V[at]=function(){Y===T.input.element&&(T.showDropdown(!0),T.containerOuter.addFocusState())},V);le[this.passedElement.element.type]()}},k._onBlur=function(b){var T=this,V=b.target,Y=this.containerOuter.element.contains(V);if(Y&&!this._isScrollingOnIe){var X,le=this._store.activeItems,he=le.some(function(Ve){return Ve.highlighted}),Me=(X={},X[me]=function(){V===T.input.element&&(T.containerOuter.removeFocusState(),he&&T.unhighlightAll(),T.hideDropdown(!0))},X[Ie]=function(){T.containerOuter.removeFocusState(),(V===T.input.element||V===T.containerOuter.element&&!T._canSearch)&&T.hideDropdown(!0)},X[at]=function(){V===T.input.element&&(T.containerOuter.removeFocusState(),T.hideDropdown(!0),he&&T.unhighlightAll())},X);Me[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()},k._onFormReset=function(){this._store.dispatch(Ot(this._initialState))},k._highlightChoice=function(b){var T=this;b===void 0&&(b=null);var V=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(V.length){var Y=b,X=Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState));X.forEach(function(le){le.classList.remove(T.config.classNames.highlightedState),le.setAttribute("aria-selected","false")}),Y?this._highlightPosition=V.indexOf(Y):(V.length>this._highlightPosition?Y=V[this._highlightPosition]:Y=V[V.length-1],Y||(Y=V[0])),Y.classList.add(this.config.classNames.highlightedState),Y.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(rn.highlightChoice,{el:Y}),this.dropdown.isActive&&(this.input.setActiveDescendant(Y.id),this.containerOuter.setActiveDescendant(Y.id))}},k._addItem=function(b){var T=b.value,V=b.label,Y=V===void 0?null:V,X=b.choiceId,le=X===void 0?-1:X,he=b.groupId,Me=he===void 0?-1:he,Ve=b.customProperties,Le=Ve===void 0?null:Ve,Qe=b.placeholder,ot=Qe===void 0?!1:Qe,qe=b.keyCode,yt=qe===void 0?null:qe,st=typeof T=="string"?T.trim():T,lt=yt,qt=Le,On=this._store.items,Vn=Y||st,ki=le||-1,kr=Me>=0?this._store.getGroupById(Me):null,Jr=On?On.length+1:1;return this.config.prependValue&&(st=this.config.prependValue+st.toString()),this.config.appendValue&&(st+=this.config.appendValue.toString()),this._store.dispatch(Te({value:st,label:Vn,id:Jr,choiceId:ki,groupId:Me,customProperties:Le,placeholder:ot,keyCode:lt})),this._isSelectOneElement&&this.removeActiveItems(Jr),this.passedElement.triggerEvent(rn.addItem,{id:Jr,value:st,label:Vn,customProperties:qt,groupValue:kr&&kr.value?kr.value:void 0,keyCode:lt}),this},k._removeItem=function(b){if(!b||!it("Object",b))return this;var T=b.id,V=b.value,Y=b.label,X=b.choiceId,le=b.groupId,he=le>=0?this._store.getGroupById(le):null;return this._store.dispatch(Ue(T,X)),he&&he.value?this.passedElement.triggerEvent(rn.removeItem,{id:T,value:V,label:Y,groupValue:he.value}):this.passedElement.triggerEvent(rn.removeItem,{id:T,value:V,label:Y}),this},k._addChoice=function(b){var T=b.value,V=b.label,Y=V===void 0?null:V,X=b.isSelected,le=X===void 0?!1:X,he=b.isDisabled,Me=he===void 0?!1:he,Ve=b.groupId,Le=Ve===void 0?-1:Ve,Qe=b.customProperties,ot=Qe===void 0?null:Qe,qe=b.placeholder,yt=qe===void 0?!1:qe,st=b.keyCode,lt=st===void 0?null:st;if(!(typeof T=="undefined"||T===null)){var qt=this._store.choices,On=Y||T,Vn=qt?qt.length+1:1,ki=this._baseId+"-"+this._idNames.itemChoice+"-"+Vn;this._store.dispatch(ce({id:Vn,groupId:Le,elementId:ki,value:T,label:On,disabled:Me,customProperties:ot,placeholder:yt,keyCode:lt})),le&&this._addItem({value:T,label:On,choiceId:Vn,customProperties:ot,placeholder:yt,keyCode:lt})}},k._addGroup=function(b){var T=this,V=b.group,Y=b.id,X=b.valueKey,le=X===void 0?"value":X,he=b.labelKey,Me=he===void 0?"label":he,Ve=it("Object",V)?V.choices:Array.from(V.getElementsByTagName("OPTION")),Le=Y||Math.floor(new Date().valueOf()*Math.random()),Qe=V.disabled?V.disabled:!1;if(Ve){this._store.dispatch(Ft({value:V.label,id:Le,active:!0,disabled:Qe}));var ot=function(yt){var st=yt.disabled||yt.parentNode&&yt.parentNode.disabled;T._addChoice({value:yt[le],label:it("Object",yt)?yt[Me]:yt.innerHTML,isSelected:yt.selected,isDisabled:st,groupId:Le,customProperties:yt.customProperties,placeholder:yt.placeholder})};Ve.forEach(ot)}else this._store.dispatch(Ft({value:V.label,id:V.id,active:!1,disabled:V.disabled}))},k._getTemplate=function(b){var T;if(!b)return null;for(var V=this.config.classNames,Y=arguments.length,X=new Array(Y>1?Y-1:0),le=1;le{var IH=typeof Element!="undefined",AH=typeof Map=="function",OH=typeof Set=="function",LH=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function jd(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,i;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!jd(e[n],t[n]))return!1;return!0}var a;if(AH&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;for(a=e.entries();!(n=a.next()).done;)if(!jd(n.value[1],t.get(n.value[0])))return!1;return!0}if(OH&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(LH&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;if(IH&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((i[n]==="_owner"||i[n]==="__v"||i[n]==="__o")&&e.$$typeof)&&!jd(e[i[n]],t[i[n]]))return!1;return!0}return e!==e&&t!==t}pC.exports=function(t,r){try{return jd(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}});var S_=wn((Gne,Dy)=>{(function(){var e;typeof Dy!="undefined"?e=Dy.exports=n:e=function(){return this||(0,eval)("this")}(),e.format=n,e.vsprintf=r,typeof console!="undefined"&&typeof console.log=="function"&&(e.printf=t);function t(){console.log(n.apply(null,arguments))}function r(i,a){return n.apply(null,[i].concat(a))}function n(i){for(var a=1,o=[].slice.call(arguments),s=0,u=i.length,l="",c,d=!1,m,h,g=!1,y,v=function(){return o[a++]},D=function(){for(var I="";/\d/.test(i[s]);)I+=i[s++],c=i[s];return I.length>0?parseInt(I):null};swf});module.exports=ov(HB);function fu(e,t){let r=Object.keys(t).map(n=>mF(e,n,t[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function mF(e,t,r){let n=e[t],i=e.hasOwnProperty(t),a=r(n);return n&&Object.setPrototypeOf(a,n),Object.setPrototypeOf(o,a),e[t]=o,s;function o(...u){return a===n&&e[t]===o&&s(),a.apply(this,u)}function s(){e[t]===o&&(i?e[t]=n:delete e[t]),a!==n&&(a=n,Object.setPrototypeOf(o,n||Function))}}var Rn=require("obsidian");var Ws,Xe,cv,pF,Va,sv,dv,Hf,Wf,Bf,Vf,fv,Us={},hv=[],gF=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,pu=Array.isArray;function Ii(e,t){for(var r in t)e[r]=t[r];return e}function mv(e){var t=e.parentNode;t&&t.removeChild(e)}function xr(e,t,r){var n,i,a,o={};for(a in t)a=="key"?n=t[a]:a=="ref"?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?Ws.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return $s(e,o,n,i,null)}function $s(e,t,r,n,i){var a={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i==null?++cv:i,__i:-1,__u:0};return i==null&&Xe.vnode!=null&&Xe.vnode(a),a}function Yf(){return{current:null}}function ct(e){return e.children}function Br(e,t){this.props=e,this.context=t}function $a(e,t){if(t==null)return e.__?$a(e.__,e.__i+1):null;for(var r;tt&&Va.sort(Hf));mu.__r=0}function gv(e,t,r,n,i,a,o,s,u,l,c){var d,m,h,g,y,v=n&&n.__k||hv,D=t.length;for(r.__d=u,yF(r,t,v),u=r.__d,d=0;d0?$s(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,s=vF(i,r,o,c),i.__i=s,a=null,s!==-1&&(c--,(a=r[s])&&(a.__u|=131072)),a==null||a.__v===null?(s==-1&&d--,typeof i.type!="function"&&(i.__u|=65536)):s!==o&&(s===o+1?d++:s>o?c>u-o?d+=s-o:d--:s(u!=null&&!(131072&u.__u)?1:0))for(;o>=0||s=0){if((u=t[o])&&!(131072&u.__u)&&i==u.key&&a===u.type)return o;o--}if(s2&&(s.children=arguments.length>3?Ws.call(arguments,2):r),$s(e.type,s,n||e.key,i||e.ref,null)}function aa(e,t){var r={__c:t="__cC"+fv++,__:e,Consumer:function(n,i){return n.children(i)},Provider:function(n){var i,a;return this.getChildContext||(i=[],(a={})[t]=this,this.getChildContext=function(){return a},this.shouldComponentUpdate=function(o){this.props.value!==o.value&&i.some(function(s){s.__e=!0,$f(s)})},this.sub=function(o){i.push(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){i.splice(i.indexOf(o),1),s&&s.call(o)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}Ws=hv.slice,Xe={__e:function(e,t,r,n){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),o=i.__d),o)return i.__E=i}catch(s){e=s}throw e}},cv=0,pF=function(e){return e!=null&&e.constructor==null},Br.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Ii({},this.state),typeof e=="function"&&(e=e(Ii({},r),this.props)),e&&Ii(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),$f(this))},Br.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$f(this))},Br.prototype.render=ct,Va=[],dv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):activeWindow.setTimeout,Hf=function(e,t){return e.__v.__b-t.__v.__b},mu.__r=0,Wf=0,Bf=uv(!1),Vf=uv(!0),fv=0;var oa,Qt,qf,bv,Co=0,Mv=[],gu=[],an=Xe,Dv=an.__b,Sv=an.__r,Ev=an.diffed,kv=an.__c,xv=an.unmount,Cv=an.__;function _o(e,t){an.__h&&an.__h(Qt,e,Co||t),Co=0;var r=Qt.__H||(Qt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:gu}),r.__[e]}function Ne(e){return Co=1,Jf(Av,e)}function Jf(e,t,r){var n=_o(oa++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Av(void 0,t),function(s){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,s);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=Qt,!Qt.u)){var i=function(s,u,l){if(!n.__c.__H)return!0;var c=n.__c.__H.__.filter(function(m){return!!m.__c});if(c.every(function(m){return!m.__N}))return!a||a.call(this,s,u,l);var d=!1;return c.forEach(function(m){if(m.__N){var h=m.__[0];m.__=m.__N,m.__N=void 0,h!==m.__[0]&&(d=!0)}}),!(!d&&n.__c.props===s)&&(!a||a.call(this,s,u,l))};Qt.u=!0;var a=Qt.shouldComponentUpdate,o=Qt.componentWillUpdate;Qt.componentWillUpdate=function(s,u,l){if(this.__e){var c=a;a=void 0,i(s,u,l),a=c}o&&o.call(this,s,u,l)},Qt.shouldComponentUpdate=i}return n.__N||n.__}function Ae(e,t){var r=_o(oa++,3);!an.__s&&Zf(r.__H,t)&&(r.__=e,r.i=t,Qt.__H.__h.push(r))}function Ai(e,t){var r=_o(oa++,4);!an.__s&&Zf(r.__H,t)&&(r.__=e,r.i=t,Qt.__h.push(r))}function Fe(e){return Co=5,Re(function(){return{current:e}},[])}function Tv(e,t,r){Co=6,Ai(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function Re(e,t){var r=_o(oa++,7);return Zf(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function Ye(e,t){return Co=8,Re(function(){return e},t)}function Ee(e){var t=Qt.context[e.__c],r=_o(oa++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(Qt)),t.props.value):e.__}function Fv(e,t){an.useDebugValue&&an.useDebugValue(t?t(e):e)}function Iv(){var e=_o(oa++,11);if(!e.__){for(var t=Qt.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function DF(){for(var e;e=Mv.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(yu),e.__H.__h.forEach(Gf),e.__H.__h=[]}catch(t){e.__H.__h=[],an.__e(t,e.__v)}}an.__b=function(e){Qt=null,Dv&&Dv(e)},an.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Cv&&Cv(e,t)},an.__r=function(e){Sv&&Sv(e),oa=0;var t=(Qt=e.__c).__H;t&&(qf===Qt?(t.__h=[],Qt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=gu,r.__N=r.i=void 0})):(t.__h.forEach(yu),t.__h.forEach(Gf),t.__h=[],oa=0)),qf=Qt},an.diffed=function(e){Ev&&Ev(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Mv.push(t)!==1&&bv===an.requestAnimationFrame||((bv=an.requestAnimationFrame)||SF)(DF)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==gu&&(r.__=r.__V),r.i=void 0,r.__V=gu})),qf=Qt=null},an.__c=function(e,t){t.some(function(r){try{r.__h.forEach(yu),r.__h=r.__h.filter(function(n){return!n.__||Gf(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],an.__e(n,r.__v)}}),kv&&kv(e,t)},an.unmount=function(e){xv&&xv(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{yu(n)}catch(i){t=i}}),r.__H=void 0,t&&an.__e(t,r.__v))};var _v=typeof activeWindow.requestAnimationFrame=="function";function SF(e){var t,r=function(){activeWindow.clearTimeout(n),_v&&activeWindow.cancelAnimationFrame(t),activeWindow.setTimeout(e)},n=activeWindow.setTimeout(r,100);_v&&(t=activeWindow.requestAnimationFrame(r))}function yu(e){var t=Qt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Qt=t}function Gf(e){var t=Qt;e.__c=e.__(),Qt=t}function Zf(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Av(e,t){return typeof t=="function"?t(e):t}function $v(e,t){for(var r in t)e[r]=t[r];return e}function Xf(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function eh(e,t){this.props=e,this.context=t}function zt(e,t){function r(i){var a=this.props.ref,o=a==i.ref;return!o&&a&&(a.call?a(null):a.current=null),t?!t(this.props,i)||!o:Xf(this.props,i)}function n(i){return this.shouldComponentUpdate=r,xr(e,i)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}(eh.prototype=new Br).isPureReactComponent=!0,eh.prototype.shouldComponentUpdate=function(e,t){return Xf(this.props,e)||Xf(this.state,t)};var Ov=Xe.__b;Xe.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ov&&Ov(e)};var EF=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function kF(e){function t(r){var n=$v({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=EF,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Lv=function(e,t){return e==null?null:fi(fi(e).map(t))},xF={map:Lv,forEach:Lv,count:function(e){return e?fi(e).length:0},only:function(e){var t=fi(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:fi},CF=Xe.__e;Xe.__e=function(e,t,r,n){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t)}CF(e,t,r,n)};var Pv=Xe.unmount;function Uv(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=$v({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return Uv(n,t,r)})),e}function Wv(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Wv(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function vu(){this.__u=0,this.t=null,this.__b=null}function Yv(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function _F(e){var t,r,n;function i(a){if(t||(t=e()).then(function(o){r=o.default||o},function(o){n=o}),n)throw n;if(!r)throw t;return xr(r,a)}return i.displayName="Lazy",i.__f=!0,i}function Ys(){this.u=null,this.o=null}Xe.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Pv&&Pv(e)},(vu.prototype=new Br).__c=function(e,t){var r=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(r);var i=Yv(n.__v),a=!1,o=function(){a||(a=!0,r.__R=null,i?i(s):s())};r.__R=o;var s=function(){if(!--n.__u){if(n.state.__a){var u=n.state.__a;n.__v.__k[0]=Wv(u,u.__c.__P,u.__c.__O)}var l;for(n.setState({__a:n.__b=null});l=n.t.pop();)l.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(o,o)},vu.prototype.componentWillUnmount=function(){this.t=[]},vu.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=Uv(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&xr(ct,null,e.fallback);return i&&(i.__u&=-33),[xr(ct,null,t.__a?null:e.children),i]};var Nv=function(e,t,r){if(++r[1]===r[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(r=e.u;r;){for(;r.length>3;)r.pop()();if(r[1]>>1,1),t.i.removeChild(n)}}),xo(xr(MF,{context:t.context},e.__v),t.l)}function Oi(e,t){var r=xr(TF,{__v:e,i:t});return r.containerInfo=t,r}(Ys.prototype=new Br).__a=function(e){var t=this,r=Yv(t.__v),n=t.o.get(e);return n[0]++,function(i){var a=function(){t.props.revealOrder?(n.push(i),Nv(t,e,n)):i()};r?r(a):a()}},Ys.prototype.render=function(e){this.u=null,this.o=new Map;var t=fi(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.o.set(t[r],this.u=[1,0,this.u]);return e.children},Ys.prototype.componentDidUpdate=Ys.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,r){Nv(e,r,t)})};var zv=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,FF=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,IF=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,AF=/[A-Z0-9]/g,OF=typeof document!="undefined",LF=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Li(e,t,r){return t.__k==null&&(t.textContent=""),xo(e,t),typeof r=="function"&&r(),e?e.__c:null}function PF(e,t,r){return jf(e,t),typeof r=="function"&&r(),e?e.__c:null}Br.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Br.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Rv=Xe.event;function NF(){}function RF(){return this.cancelBubble}function HF(){return this.defaultPrevented}Xe.event=function(e){return Rv&&(e=Rv(e)),e.persist=NF,e.isPropagationStopped=RF,e.isDefaultPrevented=HF,e.nativeEvent=e};var th,BF={enumerable:!1,configurable:!0,get:function(){return this.class}},Hv=Xe.vnode;Xe.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={};for(var a in r){var o=r[a];if(!(a==="value"&&"defaultValue"in r&&o==null||OF&&a==="children"&&n==="noscript"||a==="class"||a==="className")){var s=a.toLowerCase();a==="defaultValue"&&"value"in r&&r.value==null?a="value":a==="download"&&o===!0?o="":s==="translate"&&o==="no"?o=!1:s==="ondoubleclick"?a="ondblclick":s!=="onchange"||n!=="input"&&n!=="textarea"||LF(r.type)?s==="onfocus"?a="onfocusin":s==="onblur"?a="onfocusout":IF.test(a)?a=s:n.indexOf("-")===-1&&FF.test(a)?a=a.replace(AF,"-$&").toLowerCase():o===null&&(o=void 0):s=a="oninput",s==="oninput"&&i[a=s]&&(a="oninputCapture"),i[a]=o}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=fi(r.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=fi(r.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value})),r.class&&!r.className?(i.class=r.class,Object.defineProperty(i,"className",BF)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=zv,Hv&&Hv(e)};var Bv=Xe.__r;Xe.__r=function(e){Bv&&Bv(e),th=e.__c};var Vv=Xe.diffed;Xe.diffed=function(e){Vv&&Vv(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),th=null};var VF={ReactCurrentDispatcher:{current:{readContext:function(e){return th.__n[e.__c].props.value}}}};function $F(e){return xr.bind(null,e)}function wu(e){return!!e&&e.$$typeof===zv}function UF(e){return wu(e)&&e.type===ct}function WF(e){return!!e&&!!e.displayName&&(typeof e.displayName=="string"||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function YF(e){return wu(e)?wv.apply(null,arguments):e}function Pi(e){return!!e.__k&&(xo(null,e),!0)}function zF(e){return e&&(e.base||e.nodeType===1&&e)||null}var KF=function(e,t){return e(t)},jF=function(e,t){return e(t)},qF=ct;function Kv(e){e()}function GF(e){return e}function JF(){return[!1,Kv]}var ZF=Ai,QF=wu;function XF(e,t){var r=t(),n=Ne({h:{__:r,v:t}}),i=n[0].h,a=n[1];return Ai(function(){i.__=r,i.v=t,Qf(i)&&a({h:i})},[e,r,t]),Ae(function(){return Qf(i)&&a({h:i}),e(function(){Qf(i)&&a({h:i})})},[e]),r}function Qf(e){var t,r,n=e.v,i=e.__;try{var a=n();return!((t=i)===(r=a)&&(t!==0||1/t==1/r)||t!=t&&r!=r)}catch(o){return!0}}var $e={useState:Ne,useId:Iv,useReducer:Jf,useEffect:Ae,useLayoutEffect:Ai,useInsertionEffect:ZF,useTransition:JF,useDeferredValue:GF,useSyncExternalStore:XF,startTransition:Kv,useRef:Fe,useImperativeHandle:Tv,useMemo:Re,useCallback:Ye,useContext:Ee,useDebugValue:Fv,version:"17.0.2",Children:xF,render:Li,hydrate:PF,unmountComponentAtNode:Pi,createPortal:Oi,createElement:xr,createContext:aa,createFactory:$F,cloneElement:YF,createRef:Yf,Fragment:ct,isValidElement:wu,isElement:QF,isFragment:UF,isMemo:WF,findDOMNode:zF,Component:Br,PureComponent:eh,memo:zt,forwardRef:kF,flushSync:jF,unstable_batchedUpdates:KF,StrictMode:qF,Suspense:vu,SuspenseList:Ys,lazy:_F,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:VF};function Ge(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,n;rn===i.length-1?r!==t[n]:r===t[n])}function SI(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function js(e,t){if(SI(e,t))return 2;if(!DI(e,t))return 3;let r=e.length-1;return e[r]=0;n--)r={children:{[e[n]]:r}};return r}function qs(e,t){let r=t;for(let n=e.length-2;n>=0;n--)r={children:{[e[n]]:r}};return r}function iw(e,t){let r=t?[e.last(),1,t]:[e.last(),1];return qs(e,{children:{$splice:[r]}})}function aw(e,t,r=0){return qs(e,{children:{$splice:[[e.last()+r,0,...t]]}})}function xI(e,t){return qs(e,{children:{$push:t}})}function CI(e,t){return qs(e,{children:{$unshift:t}})}function Ri(e,t,r,n,i){let a=n?n(un(e,t)):un(e,t),s=js(t,r)===1?-1:0,u=i==null?void 0:i(un(e,t)),l=iw(t,u),c=aw(r,Array.isArray(a)?a:[a],s),d=(0,rw.default)(l,c,{isMergeableObject:h=>Ni(h)||Array.isArray(h)});return(0,la.default)(e,d)}function mi(e,t,r){return(0,la.default)(e,iw(t,r))}function Xr(e,t,r){return(0,la.default)(e,aw(t,r))}function ah(e,t,r){return(0,la.default)(e,xI(t,r))}function ow(e,t,r){return(0,la.default)(e,CI(t,r))}function Du(e,t,r){return(0,la.default)(e,kI(t,r))}function oh(e,t,r){return(0,la.default)(e,qs(t,r))}var Gs=["MO","TU","WE","TH","FR","SA","SU"],Mn=function(){function e(t,r){if(r===0)throw new Error("Can't create weekday with n == 0");this.weekday=t,this.n=r}return e.fromStr=function(t){return new e(Gs.indexOf(t))},e.prototype.nth=function(t){return this.n===t?this:new e(this.weekday,t)},e.prototype.equals=function(t){return this.weekday===t.weekday&&this.n===t.n},e.prototype.toString=function(){var t=Gs[this.weekday];return this.n&&(t=(this.n>0?"+":"")+String(this.n)+t),t},e.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},e}();var Gt=function(e){return e!=null},Cr=function(e){return typeof e=="number"},sh=function(e){return typeof e=="string"&&Gs.includes(e)},$n=Array.isArray,$r=function(e,t){t===void 0&&(t=e),arguments.length===1&&(t=e,e=0);for(var r=[],n=e;n>0,n.length>t?String(n):(t=t-n.length,t>r.length&&(r+=wt(r,t/r.length)),r.slice(0,t)+String(n))}var lw=function(e,t,r){var n=e.split(t);return r?n.slice(0,r).concat([n.slice(r).join(t)]):n},qn=function(e,t){var r=e%t;return r*t<0?r+t:r},Su=function(e,t){return{div:Math.floor(e/t),mod:qn(e,t)}},_r=function(e){return!Gt(e)||e.length===0},bn=function(e){return!_r(e)},Et=function(e,t){return bn(e)&&e.indexOf(t)!==-1};var pi=function(e,t,r,n,i,a){return n===void 0&&(n=0),i===void 0&&(i=0),a===void 0&&(a=0),new Date(Date.UTC(e,t-1,r,n,i,a))},_I=[31,28,31,30,31,30,31,31,30,31,30,31],cw=1e3*60*60*24,Eu=9999,dw=pi(1970,1,1),MI=[6,0,1,2,3,4,5];var To=function(e){return e%4===0&&e%100!==0||e%400===0},lh=function(e){return e instanceof Date},Ya=function(e){return lh(e)&&!isNaN(e.getTime())};var TI=function(e,t){var r=e.getTime(),n=t.getTime(),i=r-n;return Math.round(i/cw)},Js=function(e){return TI(e,dw)},ku=function(e){return new Date(dw.getTime()+e*cw)},FI=function(e){var t=e.getUTCMonth();return t===1&&To(e.getUTCFullYear())?29:_I[t]},Hi=function(e){return MI[e.getUTCDay()]},uh=function(e,t){var r=pi(e,t+1,1);return[Hi(r),FI(r)]},xu=function(e,t){return t=t||e,new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))},Cu=function(e){var t=new Date(e.getTime());return t},ch=function(e){for(var t=[],r=0;rthis.maxDate;if(this.method==="between"){if(r)return!0;if(n)return!1}else if(this.method==="before"){if(n)return!1}else if(this.method==="after")return r?!0:(this.add(t),!1);return this.add(t)},e.prototype.add=function(t){return this._result.push(t),!0},e.prototype.getValue=function(){var t=this._result;switch(this.method){case"all":case"between":return t;case"before":case"after":default:return t.length?t[t.length-1]:null}},e.prototype.clone=function(){return new e(this.method,this.args)},e}(),Vi=II;var dh=function(e,t){return dh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},dh(e,t)};function Io(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");dh(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Un=function(){return Un=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0&&a[a.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function hw(){for(var e=[],t=0;tt[0].length)&&(t=a,r=i)}if(t!=null&&(this.text=this.text.substr(t[0].length),this.text===""&&(this.done=!0)),t==null){this.done=!0,this.symbol=null,this.value=null;return}}while(r==="SKIP");return this.symbol=r,this.value=t,!0},e.prototype.accept=function(t){if(this.symbol===t){if(this.value){var r=this.value;return this.nextSymbol(),r}return this.nextSymbol(),!0}return!1},e.prototype.acceptNumber=function(){return this.accept("number")},e.prototype.expect=function(t){if(this.accept(t))return!0;throw new Error("expected "+t+" but found "+this.symbol)},e}();function Qs(e,t){t===void 0&&(t=za);var r={},n=new HI(t.tokens);if(!n.start(e))return null;return i(),r;function i(){n.expect("every");var m=n.acceptNumber();if(m&&(r.interval=parseInt(m[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":r.freq=Oe.DAILY,n.nextSymbol()&&(o(),d());break;case"weekday(s)":r.freq=Oe.WEEKLY,r.byweekday=[Oe.MO,Oe.TU,Oe.WE,Oe.TH,Oe.FR],n.nextSymbol(),o(),d();break;case"week(s)":r.freq=Oe.WEEKLY,n.nextSymbol()&&(a(),o(),d());break;case"hour(s)":r.freq=Oe.HOURLY,n.nextSymbol()&&(a(),d());break;case"minute(s)":r.freq=Oe.MINUTELY,n.nextSymbol()&&(a(),d());break;case"month(s)":r.freq=Oe.MONTHLY,n.nextSymbol()&&(a(),d());break;case"year(s)":r.freq=Oe.YEARLY,n.nextSymbol()&&(a(),d());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":r.freq=Oe.WEEKLY;var h=n.symbol.substr(0,2).toUpperCase();if(r.byweekday=[Oe[h]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var g=u();if(!g)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");r.byweekday.push(Oe[g]),n.nextSymbol()}o(),c(),d();break;case"january":case"february":case"march":case"april":case"may":case"june":case"july":case"august":case"september":case"october":case"november":case"december":if(r.freq=Oe.YEARLY,r.bymonth=[s()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var y=s();if(!y)throw new Error("Unexpected symbol "+n.symbol+", expected month");r.bymonth.push(y),n.nextSymbol()}a(),d();break;default:throw new Error("Unknown symbol")}}function a(){var m=n.accept("on"),h=n.accept("the");if(m||h)do{var g=l(),y=u(),v=s();if(g)y?(n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Oe[y].nth(g))):(r.bymonthday||(r.bymonthday=[]),r.bymonthday.push(g),n.accept("day(s)"));else if(y)n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Oe[y]);else if(n.symbol==="weekday(s)")n.nextSymbol(),r.byweekday||(r.byweekday=[Oe.MO,Oe.TU,Oe.WE,Oe.TH,Oe.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var D=n.acceptNumber();if(!D)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(r.byweekno=[parseInt(D[0],10)];n.accept("comma");){if(D=n.acceptNumber(),!D)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.byweekno.push(parseInt(D[0],10))}}else if(v)n.nextSymbol(),r.bymonth||(r.bymonth=[]),r.bymonth.push(v);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function o(){var m=n.accept("at");if(m)do{var h=n.acceptNumber();if(!h)throw new Error("Unexpected symbol "+n.symbol+", expected hour");for(r.byhour=[parseInt(h[0],10)];n.accept("comma");){if(h=n.acceptNumber(),!h)throw new Error("Unexpected symbol "+n.symbol+"; expected hour");r.byhour.push(parseInt(h[0],10))}}while(n.accept("comma")||n.accept("at"))}function s(){switch(n.symbol){case"january":return 1;case"february":return 2;case"march":return 3;case"april":return 4;case"may":return 5;case"june":return 6;case"july":return 7;case"august":return 8;case"september":return 9;case"october":return 10;case"november":return 11;case"december":return 12;default:return!1}}function u(){switch(n.symbol){case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":return n.symbol.substr(0,2).toUpperCase();default:return!1}}function l(){switch(n.symbol){case"last":return n.nextSymbol(),-1;case"first":return n.nextSymbol(),1;case"second":return n.nextSymbol(),n.accept("last")?-2:2;case"third":return n.nextSymbol(),n.accept("last")?-3:3;case"nth":var m=parseInt(n.value[1],10);if(m<-366||m>366)throw new Error("Nth out of range: "+m);return n.nextSymbol(),n.accept("last")?-m:m;default:return!1}}function c(){n.accept("on"),n.accept("the");var m=l();if(m)for(r.bymonthday=[m],n.nextSymbol();n.accept("comma");){if(m=l(),!m)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.bymonthday.push(m),n.nextSymbol()}}function d(){if(n.symbol==="until"){var m=Date.parse(n.text);if(!m)throw new Error("Cannot parse until date:"+n.text);r.until=new Date(m)}else n.accept("for")&&(r.count=parseInt(n.value[0],10),n.expect("number"))}}var pt;(function(e){e[e.YEARLY=0]="YEARLY",e[e.MONTHLY=1]="MONTHLY",e[e.WEEKLY=2]="WEEKLY",e[e.DAILY=3]="DAILY",e[e.HOURLY=4]="HOURLY",e[e.MINUTELY=5]="MINUTELY",e[e.SECONDLY=6]="SECONDLY"})(pt||(pt={}));function Xs(e){return e12){var n=Math.floor(this.month/12),i=qn(this.month,12);this.month=i,this.year+=n,this.month===0&&(this.month=12,--this.year)}},t.prototype.addWeekly=function(r,n){n>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-n))+r*7:this.day+=-(this.getWeekday()-n)+r*7,this.fixDay()},t.prototype.addDaily=function(r){this.day+=r,this.fixDay()},t.prototype.addHours=function(r,n,i){for(n&&(this.hour+=Math.floor((23-this.hour)/r)*r);;){this.hour+=r;var a=Su(this.hour,24),o=a.div,s=a.mod;if(o&&(this.hour=s,this.addDaily(o)),_r(i)||Et(i,this.hour))break}},t.prototype.addMinutes=function(r,n,i,a){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/r)*r);;){this.minute+=r;var o=Su(this.minute,60),s=o.div,u=o.mod;if(s&&(this.minute=u,this.addHours(s,!1,i)),(_r(i)||Et(i,this.hour))&&(_r(a)||Et(a,this.minute)))break}},t.prototype.addSeconds=function(r,n,i,a,o){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/r)*r);;){this.second+=r;var s=Su(this.second,60),u=s.div,l=s.mod;if(u&&(this.second=l,this.addMinutes(u,!1,i,a)),(_r(i)||Et(i,this.hour))&&(_r(a)||Et(a,this.minute))&&(_r(o)||Et(o,this.second)))break}},t.prototype.fixDay=function(){if(!(this.day<=28)){var r=uh(this.year,this.month-1)[1];if(!(this.day<=r))for(;this.day>r;){if(this.day-=r,++this.month,this.month===13&&(this.month=1,++this.year,this.year>Eu))return;r=uh(this.year,this.month-1)[1]}}},t.prototype.add=function(r,n){var i=r.freq,a=r.interval,o=r.wkst,s=r.byhour,u=r.byminute,l=r.bysecond;switch(i){case pt.YEARLY:return this.addYears(a);case pt.MONTHLY:return this.addMonths(a);case pt.WEEKLY:return this.addWeekly(a,o);case pt.DAILY:return this.addDaily(a);case pt.HOURLY:return this.addHours(a,n,s);case pt.MINUTELY:return this.addMinutes(a,n,s,u);case pt.SECONDLY:return this.addSeconds(a,n,s,u,l)}},t}(Po);function hh(e){for(var t=[],r=Object.keys(e),n=0,i=r;n=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(t.byweekno||bn(t.byweekno)||bn(t.byyearday)||t.bymonthday||bn(t.bymonthday)||Gt(t.byweekday)||Gt(t.byeaster)))switch(t.freq){case Oe.YEARLY:t.bymonth||(t.bymonth=t.dtstart.getUTCMonth()+1),t.bymonthday=t.dtstart.getUTCDate();break;case Oe.MONTHLY:t.bymonthday=t.dtstart.getUTCDate();break;case Oe.WEEKLY:t.byweekday=[Hi(t.dtstart)];break}if(Gt(t.bymonth)&&!$n(t.bymonth)&&(t.bymonth=[t.bymonth]),Gt(t.byyearday)&&!$n(t.byyearday)&&Cr(t.byyearday)&&(t.byyearday=[t.byyearday]),!Gt(t.bymonthday))t.bymonthday=[],t.bynmonthday=[];else if($n(t.bymonthday)){for(var i=[],a=[],r=0;r0?i.push(n):n<0&&a.push(n)}t.bymonthday=i,t.bynmonthday=a}else t.bymonthday<0?(t.bynmonthday=[t.bymonthday],t.bymonthday=[]):(t.bynmonthday=[],t.bymonthday=[t.bymonthday]);if(Gt(t.byweekno)&&!$n(t.byweekno)&&(t.byweekno=[t.byweekno]),!Gt(t.byweekday))t.bynweekday=null;else if(Cr(t.byweekday))t.byweekday=[t.byweekday],t.bynweekday=null;else if(sh(t.byweekday))t.byweekday=[Mn.fromStr(t.byweekday).weekday],t.bynweekday=null;else if(t.byweekday instanceof Mn)!t.byweekday.n||t.freq>Oe.MONTHLY?(t.byweekday=[t.byweekday.weekday],t.bynweekday=null):(t.bynweekday=[[t.byweekday.weekday,t.byweekday.n]],t.byweekday=null);else{for(var o=[],s=[],r=0;rOe.MONTHLY?o.push(u.weekday):s.push([u.weekday,u.n])}t.byweekday=bn(o)?o:null,t.bynweekday=bn(s)?s:null}return Gt(t.byhour)?Cr(t.byhour)&&(t.byhour=[t.byhour]):t.byhour=t.freq=4?(c=0,l=s.yearlen+qn(o-t.wkst,7)):l=n-c;for(var d=Math.floor(l/7),m=qn(l,7),h=Math.floor(d+m/4),g=0;g0&&y<=h){var v=void 0;y>1?(v=c+(y-1)*7,c!==u&&(v-=7-u)):v=c;for(var D=0;D<7&&(s.wnomask[v]=1,v++,s.wdaymask[v]!==t.wkst);D++);}}if(Et(t.byweekno,1)){var v=c+h*7;if(c!==u&&(v-=7-u),v=4?(x=0,A=O+qn(C-t.wkst,7)):A=n-c,I=Math.floor(52+qn(A,7)/4)}if(Et(t.byweekno,I))for(var v=0;va)return $i(e);if(I>=r){var C=Hw(I,t);if(!e.accept(C)||s&&(--s,!s))return $i(e)}}else for(var D=h;Da)return $i(e);if(I>=r){var C=Hw(I,t);if(!e.accept(C)||s&&(--s,!s))return $i(e)}}}if(t.interval===0||(u.add(t,y),u.year>Eu))return $i(e);Xs(n)||(c=l.gettimeset(n)(u.hour,u.minute,u.second,0)),l.rebuild(u.year,u.month)}}function JI(e,t,r){var n=r.bymonth,i=r.byweekno,a=r.byweekday,o=r.byeaster,s=r.bymonthday,u=r.bynmonthday,l=r.byyearday;return bn(n)&&!Et(n,e.mmask[t])||bn(i)&&!e.wnomask[t]||bn(a)&&!Et(a,e.wdaymask[t])||bn(e.nwdaymask)&&!e.nwdaymask[t]||o!==null&&!Et(e.eastermask,t)||(bn(s)||bn(u))&&!Et(s,e.mdaymask[t])&&!Et(u,e.nmdaymask[t])||bn(l)&&(t=e.yearlen&&!Et(l,t+1-e.yearlen)&&!Et(l,-e.nextyearlen+t-e.yearlen))}function Hw(e,t){return new Ka(e,t.tzid).rezonedDate()}function $i(e){return e.getValue()}function ZI(e,t,r,n,i){for(var a=!1,o=t;o=Oe.HOURLY&&bn(i)&&!Et(i,t.hour)||n>=Oe.MINUTELY&&bn(a)&&!Et(a,t.minute)||n>=Oe.SECONDLY&&bn(o)&&!Et(o,t.second)?[]:e.gettimeset(n)(t.hour,t.minute,t.second,t.millisecond)}var Ur={MO:new Mn(0),TU:new Mn(1),WE:new Mn(2),TH:new Mn(3),FR:new Mn(4),SA:new Mn(5),SU:new Mn(6)},el={freq:pt.YEARLY,dtstart:null,interval:1,wkst:Ur.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},Dw=Object.keys(el),Oe=function(){function e(t,r){t===void 0&&(t={}),r===void 0&&(r=!1),this._cache=r?null:new kw,this.origOptions=hh(t);var n=ww(t).parsedOptions;this.options=n}return e.parseText=function(t,r){return Qs(t,r)},e.fromText=function(t,r){return pw(t,r)},e.fromString=function(t){return new e(e.parseString(t)||void 0)},e.prototype._iter=function(t){return _u(t,this.options)},e.prototype._cacheGet=function(t,r){return this._cache?this._cache._cacheGet(t,r):!1},e.prototype._cacheAdd=function(t,r,n){if(this._cache)return this._cache._cacheAdd(t,r,n)},e.prototype.all=function(t){if(t)return this._iter(new fh("all",{},t));var r=this._cacheGet("all");return r===!1&&(r=this._iter(new Vi("all",{})),this._cacheAdd("all",r)),r},e.prototype.between=function(t,r,n,i){if(n===void 0&&(n=!1),!Ya(t)||!Ya(r))throw new Error("Invalid date passed in to RRule.between");var a={before:r,after:t,inc:n};if(i)return this._iter(new fh("between",a,i));var o=this._cacheGet("between",a);return o===!1&&(o=this._iter(new Vi("between",a)),this._cacheAdd("between",o,a)),o},e.prototype.before=function(t,r){if(r===void 0&&(r=!1),!Ya(t))throw new Error("Invalid date passed in to RRule.before");var n={dt:t,inc:r},i=this._cacheGet("before",n);return i===!1&&(i=this._iter(new Vi("before",n)),this._cacheAdd("before",i,n)),i},e.prototype.after=function(t,r){if(r===void 0&&(r=!1),!Ya(t))throw new Error("Invalid date passed in to RRule.after");var n={dt:t,inc:r},i=this._cacheGet("after",n);return i===!1&&(i=this._iter(new Vi("after",n)),this._cacheAdd("after",i,n)),i},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return rl(this.origOptions)},e.prototype.toText=function(t,r,n){return gw(this,t,r,n)},e.prototype.isFullyConvertibleToText=function(){return yw(this)},e.prototype.clone=function(){return new e(this.origOptions)},e.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],e.YEARLY=pt.YEARLY,e.MONTHLY=pt.MONTHLY,e.WEEKLY=pt.WEEKLY,e.DAILY=pt.DAILY,e.HOURLY=pt.HOURLY,e.MINUTELY=pt.MINUTELY,e.SECONDLY=pt.SECONDLY,e.MO=Ur.MO,e.TU=Ur.TU,e.WE=Ur.WE,e.TH=Ur.TH,e.FR=Ur.FR,e.SA=Ur.SA,e.SU=Ur.SU,e.parseString=nl,e.optionsToString=rl,e}();function Bw(e,t,r,n,i,a){var o={},s=e.accept;function u(m,h){r.forEach(function(g){g.between(m,h,!0).forEach(function(y){o[Number(y)]=!0})})}i.forEach(function(m){var h=new Ka(m,a).rezonedDate();o[Number(h)]=!0}),e.accept=function(m){var h=Number(m);return isNaN(h)?s.call(this,m):!o[h]&&(u(new Date(h-1),new Date(h+1)),!o[h])?(o[h]=!0,s.call(this,m)):!0},e.method==="between"&&(u(e.args.after,e.args.before),e.accept=function(m){var h=Number(m);return o[h]?!0:(o[h]=!0,s.call(this,m))});for(var l=0;l1||i.length||a.length||o.length){var c=new gh(l);return c.dtstart(s),c.tzid(u||void 0),n.forEach(function(m){c.rrule(new Oe(ph(m,s,u),l))}),i.forEach(function(m){c.rdate(m)}),a.forEach(function(m){c.exrule(new Oe(ph(m,s,u),l))}),o.forEach(function(m){c.exdate(m)}),t.compatible&&t.dtstart&&c.rdate(s),c}var d=n[0]||{};return new Oe(ph(d,d.dtstart||t.dtstart||s,d.tzid||t.tzid||u),l)}function Mu(e,t){return t===void 0&&(t={}),eA(e,tA(t))}function ph(e,t,r){return Un(Un({},e),{dtstart:t,tzid:r})}function tA(e){var t=[],r=Object.keys(e),n=Object.keys(Vw);if(r.forEach(function(i){Et(n,i)||t.push(i)}),t.length)throw new Error("Invalid options: "+t.join(", "));return Un(Un({},Vw),e)}function nA(e){if(e.indexOf(":")===-1)return{name:"RRULE",value:e};var t=lw(e,":",1),r=t[0],n=t[1];return{name:r,value:n}}function rA(e){var t=nA(e),r=t.name,n=t.value,i=r.split(";");if(!i)throw new Error("empty property name");return{name:i[0].toUpperCase(),parms:i.slice(1),value:n}}function iA(e,t){if(t===void 0&&(t=!1),e=e&&e.trim(),!e)throw new Error("Invalid empty string");if(!t)return e.split(/\s/);for(var r=e.split(` +`),n=0;n0&&i[0]===" "?(r[n-1]+=i.slice(1),r.splice(n,1)):n+=1:r.splice(n,1)}return r}function aA(e){e.forEach(function(t){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(t))throw new Error("unsupported RDATE/EXDATE parm: "+t)})}function $w(e,t){return aA(t),e.split(",").map(function(r){return Zs(r)})}function Uw(e){var t=this;return function(r){if(r!==void 0&&(t["_".concat(e)]=r),t["_".concat(e)]!==void 0)return t["_".concat(e)];for(var n=0;n