/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin String.fromCharCode/atob/btoa usage originates from bundled dependencies: - isomorphic-git (Git protocol binary operations) - buffer polyfill (base64 encoding) - unified/remark (Markdown parser) */ "use strict";var EF=Object.create;var Fd=Object.defineProperty;var CF=Object.getOwnPropertyDescriptor;var TF=Object.getOwnPropertyNames;var AF=Object.getPrototypeOf,IF=Object.prototype.hasOwnProperty;var K=(t,e)=>()=>(t&&(e=t(t=0)),e);var U=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lu=(t,e)=>{for(var r in e)Fd(t,r,{get:e[r],enumerable:!0})},h0=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of TF(e))!IF.call(t,i)&&i!==r&&Fd(t,i,{get:()=>e[i],enumerable:!(n=CF(e,i))||n.enumerable});return t};var cu=(t,e,r)=>(r=t!=null?EF(AF(t)):{},h0(e||!t||!t.__esModule?Fd(r,"default",{value:t,enumerable:!0}):r,t)),PF=t=>h0(Fd({},"__esModule",{value:!0}),t);var g0=U(Dd=>{"use strict";p();Dd.byteLength=RF;Dd.toByteArray=NF;Dd.fromByteArray=zF;var bi=[],On=[],$F=typeof Uint8Array<"u"?Uint8Array:Array,Rg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(No=0,p0=Rg.length;No0)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 RF(t){var e=m0(t),r=e[0],n=e[1];return(r+n)*3/4-n}function OF(t,e,r){return(e+r)*3/4-r}function NF(t){var e,r=m0(t),n=r[0],i=r[1],s=new $F(OF(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=On[t.charCodeAt(l)]<<2|On[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=On[t.charCodeAt(l)]<<10|On[t.charCodeAt(l+1)]<<4|On[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function FF(t){return bi[t>>18&63]+bi[t>>12&63]+bi[t>>6&63]+bi[t&63]}function DF(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(bi[e>>2]+bi[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(bi[e>>10]+bi[e>>4&63]+bi[e<<2&63]+"=")),i.join("")}});var y0=U(Og=>{p();Og.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,l=(1<>1,u=-7,f=r?i-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=a;u>0;s=s*256+t[e+f],f+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=o*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(h?-1:1)*o*Math.pow(2,s-n)};Og.write=function(t,e,r,n,i,s){var o,a,l,c=s*8-i-1,u=(1<>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,g=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(e*l-1)*Math.pow(2,i),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+h]=a&255,h+=g,a/=256,i-=8);for(o=o<0;t[r+h]=o&255,h+=g,o/=256,c-=8);t[r+h-g]|=m*128}});var Ld=U(il=>{"use strict";p();var Ng=g0(),rl=y0(),w0=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;il.Buffer=z;il.SlowBuffer=qF;il.INSPECT_MAX_BYTES=50;var zd=2147483647;il.kMaxLength=zd;z.TYPED_ARRAY_SUPPORT=MF();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u";function MF(){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{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function ts(t){if(t>zd)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(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 Mg(t)}return x0(t,e,r)}z.poolSize=8192;function x0(t,e,r){if(typeof t=="string")return BF(t,e);if(ArrayBuffer.isView(t))return UF(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(_i(t,ArrayBuffer)||t&&_i(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_i(t,SharedArrayBuffer)||t&&_i(t.buffer,SharedArrayBuffer)))return Dg(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 z.from(n,e,r);let i=jF(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.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)}z.from=function(t,e,r){return x0(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function k0(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 LF(t,e,r){return k0(t),t<=0?ts(t):e!==void 0?typeof r=="string"?ts(t).fill(e,r):ts(t).fill(e):ts(t)}z.alloc=function(t,e,r){return LF(t,e,r)};function Mg(t){return k0(t),ts(t<0?0:Lg(t)|0)}z.allocUnsafe=function(t){return Mg(t)};z.allocUnsafeSlow=function(t){return Mg(t)};function BF(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=S0(t,e)|0,n=ts(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Fg(t){let e=t.length<0?0:Lg(t.length)|0,r=ts(e);for(let n=0;n=zd)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+zd.toString(16)+" bytes");return t|0}function qF(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(_i(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),_i(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.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 s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function S0(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||_i(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 zg(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return O0(t).length;default:if(i)return n?-1:zg(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=S0;function VF(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 eD(this,e,r);case"utf8":case"utf-8":return C0(this,e,r);case"ascii":return JF(this,e,r);case"latin1":case"binary":return XF(this,e,r);case"base64":return YF(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tD(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function Fo(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.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+=" ... "),""};w0&&(z.prototype[w0]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(_i(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.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),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,l=Math.min(o,a),c=this.slice(i,s),u=e.slice(r,n);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ug(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=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:v0(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):v0(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v0(t,e,r,n,i){let s=1,o=t.length,a=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;s=2,o/=2,a/=2,r/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(i){let u=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){let u=!0;for(let f=0;fi&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>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 s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return HF(this,e,r,n);case"utf8":case"utf-8":return GF(this,e,r,n);case"ascii":case"latin1":case"binary":return QF(this,e,r,n);case"base64":return WF(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return KF(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function YF(t,e,r){return e===0&&r===t.length?Ng.fromByteArray(t):Ng.fromByteArray(t.slice(e,r))}function C0(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let l,c,u,f;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[i+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(o=f));break;case 3:l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return ZF(n)}var b0=4096;function ZF(t){let e=t.length;if(e<=b0)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Mt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Mt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Mt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=Cs(function(e){e=e>>>0,nl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&uu(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,nl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&uu(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Mt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Mt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Mt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Mt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=Cs(function(e){e=e>>>0,nl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&uu(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,nl(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&uu(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Mt(e,4,this.length),rl.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),rl.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Mt(e,8,this.length),rl.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Mt(e,8,this.length),rl.read(this,e,!1,52,8)};function Dr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Dr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Dr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Dr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(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};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(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 T0(t,e,r,n,i){R0(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function A0(t,e,r,n,i){R0(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=Cs(function(e,r=0){return T0(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=Cs(function(e,r=0){return A0(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Dr(this,e,r,n,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Dr(this,e,r,n,l-1,-l)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Dr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(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};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Dr(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};z.prototype.writeBigInt64LE=Cs(function(e,r=0){return T0(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=Cs(function(e,r=0){return A0(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function I0(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P0(t,e,r,n,i){return e=+e,r=r>>>0,i||I0(t,e,r,4,34028234663852886e22,-34028234663852886e22),rl.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return P0(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return P0(this,e,r,!1,n)};function $0(t,e,r,n,i){return e=+e,r=r>>>0,i||I0(t,e,r,8,17976931348623157e292,-17976931348623157e292),rl.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return $0(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return $0(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.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 s;if(typeof e=="number")for(s=r;s2**32?i=_0(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=_0(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function _0(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 rD(t,e,r){nl(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&uu(e,t.length-(r+1))}function R0(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new tl.ERR_OUT_OF_RANGE("value",a,t)}rD(n,i,s)}function nl(t,e){if(typeof t!="number")throw new tl.ERR_INVALID_ARG_TYPE(e,"number",t)}function uu(t,e,r){throw Math.floor(t)!==t?(nl(t,r),new tl.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new tl.ERR_BUFFER_OUT_OF_BOUNDS:new tl.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var nD=/[^+/0-9A-Za-z-_]/g;function iD(t){if(t=t.split("=")[0],t=t.trim().replace(nD,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function zg(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function sD(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function O0(t){return Ng.toByteArray(iD(t))}function Md(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function _i(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ug(t){return t!==t}var aD=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 Cs(t){return typeof BigInt>"u"?lD:t}function lD(){throw new Error("BigInt not supported")}});var N0,jg,w,p=K(()=>{"use strict";N0=require("obsidian");N0.Platform.isMobileApp?jg=Ld().Buffer:jg=globalThis.Buffer;w=jg});var M0=U((OG,z0)=>{"use strict";p();z0.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}});var q0=U((FG,j0)=>{p();var cD=1/0,uD="[object Symbol]",fD=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,dD="\\u0300-\\u036f\\ufe20-\\ufe23",hD="\\u20d0-\\u20f0",pD="["+dD+hD+"]",mD=RegExp(pD,"g"),gD={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},yD=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,wD=typeof self=="object"&&self&&self.Object===Object&&self,vD=yD||wD||Function("return this")();function bD(t){return function(e){return t?.[e]}}var _D=bD(gD),xD=Object.prototype,kD=xD.toString,L0=vD.Symbol,B0=L0?L0.prototype:void 0,U0=B0?B0.toString:void 0;function SD(t){if(typeof t=="string")return t;if(CD(t))return U0?U0.call(t):"";var e=t+"";return e=="0"&&1/t==-cD?"-0":e}function ED(t){return!!t&&typeof t=="object"}function CD(t){return typeof t=="symbol"||ED(t)&&kD.call(t)==uD}function TD(t){return t==null?"":SD(t)}function AD(t){return t=TD(t),t&&t.replace(fD,_D).replace(mD,"")}j0.exports=AD});var H0=U((zG,V0)=>{"use strict";p();var ID=/[|\\{}()[\]^$+*?.-]/g;V0.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(ID,"\\$&")}});var Q0=U((LG,G0)=>{"use strict";p();G0.exports=[["\xDF","ss"],["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xC0","A"],["\xC1","A"],["\xC2","A"],["\xC3","A"],["\xC4","Ae"],["\xC5","A"],["\xC6","AE"],["\xC7","C"],["\xC8","E"],["\xC9","E"],["\xCA","E"],["\xCB","E"],["\xCC","I"],["\xCD","I"],["\xCE","I"],["\xCF","I"],["\xD0","D"],["\xD1","N"],["\xD2","O"],["\xD3","O"],["\xD4","O"],["\xD5","O"],["\xD6","Oe"],["\u0150","O"],["\xD8","O"],["\xD9","U"],["\xDA","U"],["\xDB","U"],["\xDC","Ue"],["\u0170","U"],["\xDD","Y"],["\xDE","TH"],["\xDF","ss"],["\xE0","a"],["\xE1","a"],["\xE2","a"],["\xE3","a"],["\xE4","ae"],["\xE5","a"],["\xE6","ae"],["\xE7","c"],["\xE8","e"],["\xE9","e"],["\xEA","e"],["\xEB","e"],["\xEC","i"],["\xED","i"],["\xEE","i"],["\xEF","i"],["\xF0","d"],["\xF1","n"],["\xF2","o"],["\xF3","o"],["\xF4","o"],["\xF5","o"],["\xF6","oe"],["\u0151","o"],["\xF8","o"],["\xF9","u"],["\xFA","u"],["\xFB","u"],["\xFC","ue"],["\u0171","u"],["\xFD","y"],["\xFE","th"],["\xFF","y"],["\u1E9E","SS"],["\xE0","a"],["\xC0","A"],["\xE1","a"],["\xC1","A"],["\xE2","a"],["\xC2","A"],["\xE3","a"],["\xC3","A"],["\xE8","e"],["\xC8","E"],["\xE9","e"],["\xC9","E"],["\xEA","e"],["\xCA","E"],["\xEC","i"],["\xCC","I"],["\xED","i"],["\xCD","I"],["\xF2","o"],["\xD2","O"],["\xF3","o"],["\xD3","O"],["\xF4","o"],["\xD4","O"],["\xF5","o"],["\xD5","O"],["\xF9","u"],["\xD9","U"],["\xFA","u"],["\xDA","U"],["\xFD","y"],["\xDD","Y"],["\u0103","a"],["\u0102","A"],["\u0110","D"],["\u0111","d"],["\u0129","i"],["\u0128","I"],["\u0169","u"],["\u0168","U"],["\u01A1","o"],["\u01A0","O"],["\u01B0","u"],["\u01AF","U"],["\u1EA1","a"],["\u1EA0","A"],["\u1EA3","a"],["\u1EA2","A"],["\u1EA5","a"],["\u1EA4","A"],["\u1EA7","a"],["\u1EA6","A"],["\u1EA9","a"],["\u1EA8","A"],["\u1EAB","a"],["\u1EAA","A"],["\u1EAD","a"],["\u1EAC","A"],["\u1EAF","a"],["\u1EAE","A"],["\u1EB1","a"],["\u1EB0","A"],["\u1EB3","a"],["\u1EB2","A"],["\u1EB5","a"],["\u1EB4","A"],["\u1EB7","a"],["\u1EB6","A"],["\u1EB9","e"],["\u1EB8","E"],["\u1EBB","e"],["\u1EBA","E"],["\u1EBD","e"],["\u1EBC","E"],["\u1EBF","e"],["\u1EBE","E"],["\u1EC1","e"],["\u1EC0","E"],["\u1EC3","e"],["\u1EC2","E"],["\u1EC5","e"],["\u1EC4","E"],["\u1EC7","e"],["\u1EC6","E"],["\u1EC9","i"],["\u1EC8","I"],["\u1ECB","i"],["\u1ECA","I"],["\u1ECD","o"],["\u1ECC","O"],["\u1ECF","o"],["\u1ECE","O"],["\u1ED1","o"],["\u1ED0","O"],["\u1ED3","o"],["\u1ED2","O"],["\u1ED5","o"],["\u1ED4","O"],["\u1ED7","o"],["\u1ED6","O"],["\u1ED9","o"],["\u1ED8","O"],["\u1EDB","o"],["\u1EDA","O"],["\u1EDD","o"],["\u1EDC","O"],["\u1EDF","o"],["\u1EDE","O"],["\u1EE1","o"],["\u1EE0","O"],["\u1EE3","o"],["\u1EE2","O"],["\u1EE5","u"],["\u1EE4","U"],["\u1EE7","u"],["\u1EE6","U"],["\u1EE9","u"],["\u1EE8","U"],["\u1EEB","u"],["\u1EEA","U"],["\u1EED","u"],["\u1EEC","U"],["\u1EEF","u"],["\u1EEE","U"],["\u1EF1","u"],["\u1EF0","U"],["\u1EF3","y"],["\u1EF2","Y"],["\u1EF5","y"],["\u1EF4","Y"],["\u1EF7","y"],["\u1EF6","Y"],["\u1EF9","y"],["\u1EF8","Y"],["\u0621","e"],["\u0622","a"],["\u0623","a"],["\u0624","w"],["\u0625","i"],["\u0626","y"],["\u0627","a"],["\u0628","b"],["\u0629","t"],["\u062A","t"],["\u062B","th"],["\u062C","j"],["\u062D","h"],["\u062E","kh"],["\u062F","d"],["\u0630","dh"],["\u0631","r"],["\u0632","z"],["\u0633","s"],["\u0634","sh"],["\u0635","s"],["\u0636","d"],["\u0637","t"],["\u0638","z"],["\u0639","e"],["\u063A","gh"],["\u0640","_"],["\u0641","f"],["\u0642","q"],["\u0643","k"],["\u0644","l"],["\u0645","m"],["\u0646","n"],["\u0647","h"],["\u0648","w"],["\u0649","a"],["\u064A","y"],["\u064E\u200E","a"],["\u064F","u"],["\u0650\u200E","i"],["\u0660","0"],["\u0661","1"],["\u0662","2"],["\u0663","3"],["\u0664","4"],["\u0665","5"],["\u0666","6"],["\u0667","7"],["\u0668","8"],["\u0669","9"],["\u0686","ch"],["\u06A9","k"],["\u06AF","g"],["\u067E","p"],["\u0698","zh"],["\u06CC","y"],["\u06F0","0"],["\u06F1","1"],["\u06F2","2"],["\u06F3","3"],["\u06F4","4"],["\u06F5","5"],["\u06F6","6"],["\u06F7","7"],["\u06F8","8"],["\u06F9","9"],["\u067C","p"],["\u0681","z"],["\u0685","c"],["\u0689","d"],["\uFEAB","d"],["\uFEAD","r"],["\u0693","r"],["\uFEAF","z"],["\u0696","g"],["\u069A","x"],["\u06AB","g"],["\u06BC","n"],["\u06C0","e"],["\u06D0","e"],["\u06CD","ai"],["\u0679","t"],["\u0688","d"],["\u0691","r"],["\u06BA","n"],["\u06C1","h"],["\u06BE","h"],["\u06D2","e"],["\u0410","A"],["\u0430","a"],["\u0411","B"],["\u0431","b"],["\u0412","V"],["\u0432","v"],["\u0413","G"],["\u0433","g"],["\u0414","D"],["\u0434","d"],["\u0415","E"],["\u0435","e"],["\u0416","Zh"],["\u0436","zh"],["\u0417","Z"],["\u0437","z"],["\u0418","I"],["\u0438","i"],["\u0419","J"],["\u0439","j"],["\u041A","K"],["\u043A","k"],["\u041B","L"],["\u043B","l"],["\u041C","M"],["\u043C","m"],["\u041D","N"],["\u043D","n"],["\u041E","O"],["\u043E","o"],["\u041F","P"],["\u043F","p"],["\u0420","R"],["\u0440","r"],["\u0421","S"],["\u0441","s"],["\u0422","T"],["\u0442","t"],["\u0423","U"],["\u0443","u"],["\u0424","F"],["\u0444","f"],["\u0425","H"],["\u0445","h"],["\u0426","Cz"],["\u0446","cz"],["\u0427","Ch"],["\u0447","ch"],["\u0428","Sh"],["\u0448","sh"],["\u0429","Shh"],["\u0449","shh"],["\u042A",""],["\u044A",""],["\u042B","Y"],["\u044B","y"],["\u042C",""],["\u044C",""],["\u042D","E"],["\u044D","e"],["\u042E","Yu"],["\u044E","yu"],["\u042F","Ya"],["\u044F","ya"],["\u0401","Yo"],["\u0451","yo"],["\u0103","a"],["\u0102","A"],["\u0219","s"],["\u0218","S"],["\u021B","t"],["\u021A","T"],["\u0163","t"],["\u0162","T"],["\u015F","s"],["\u015E","S"],["\xE7","c"],["\xC7","C"],["\u011F","g"],["\u011E","G"],["\u0131","i"],["\u0130","I"],["\u0561","a"],["\u0531","A"],["\u0562","b"],["\u0532","B"],["\u0563","g"],["\u0533","G"],["\u0564","d"],["\u0534","D"],["\u0565","ye"],["\u0535","Ye"],["\u0566","z"],["\u0536","Z"],["\u0567","e"],["\u0537","E"],["\u0568","y"],["\u0538","Y"],["\u0569","t"],["\u0539","T"],["\u056A","zh"],["\u053A","Zh"],["\u056B","i"],["\u053B","I"],["\u056C","l"],["\u053C","L"],["\u056D","kh"],["\u053D","Kh"],["\u056E","ts"],["\u053E","Ts"],["\u056F","k"],["\u053F","K"],["\u0570","h"],["\u0540","H"],["\u0571","dz"],["\u0541","Dz"],["\u0572","gh"],["\u0542","Gh"],["\u0573","tch"],["\u0543","Tch"],["\u0574","m"],["\u0544","M"],["\u0575","y"],["\u0545","Y"],["\u0576","n"],["\u0546","N"],["\u0577","sh"],["\u0547","Sh"],["\u0578","vo"],["\u0548","Vo"],["\u0579","ch"],["\u0549","Ch"],["\u057A","p"],["\u054A","P"],["\u057B","j"],["\u054B","J"],["\u057C","r"],["\u054C","R"],["\u057D","s"],["\u054D","S"],["\u057E","v"],["\u054E","V"],["\u057F","t"],["\u054F","T"],["\u0580","r"],["\u0550","R"],["\u0581","c"],["\u0551","C"],["\u0578\u0582","u"],["\u0548\u0552","U"],["\u0548\u0582","U"],["\u0583","p"],["\u0553","P"],["\u0584","q"],["\u0554","Q"],["\u0585","o"],["\u0555","O"],["\u0586","f"],["\u0556","F"],["\u0587","yev"],["\u10D0","a"],["\u10D1","b"],["\u10D2","g"],["\u10D3","d"],["\u10D4","e"],["\u10D5","v"],["\u10D6","z"],["\u10D7","t"],["\u10D8","i"],["\u10D9","k"],["\u10DA","l"],["\u10DB","m"],["\u10DC","n"],["\u10DD","o"],["\u10DE","p"],["\u10DF","zh"],["\u10E0","r"],["\u10E1","s"],["\u10E2","t"],["\u10E3","u"],["\u10E4","ph"],["\u10E5","q"],["\u10E6","gh"],["\u10E7","k"],["\u10E8","sh"],["\u10E9","ch"],["\u10EA","ts"],["\u10EB","dz"],["\u10EC","ts"],["\u10ED","tch"],["\u10EE","kh"],["\u10EF","j"],["\u10F0","h"],["\u010D","c"],["\u010F","d"],["\u011B","e"],["\u0148","n"],["\u0159","r"],["\u0161","s"],["\u0165","t"],["\u016F","u"],["\u017E","z"],["\u010C","C"],["\u010E","D"],["\u011A","E"],["\u0147","N"],["\u0158","R"],["\u0160","S"],["\u0164","T"],["\u016E","U"],["\u017D","Z"],["\u0780","h"],["\u0781","sh"],["\u0782","n"],["\u0783","r"],["\u0784","b"],["\u0785","lh"],["\u0786","k"],["\u0787","a"],["\u0788","v"],["\u0789","m"],["\u078A","f"],["\u078B","dh"],["\u078C","th"],["\u078D","l"],["\u078E","g"],["\u078F","gn"],["\u0790","s"],["\u0791","d"],["\u0792","z"],["\u0793","t"],["\u0794","y"],["\u0795","p"],["\u0796","j"],["\u0797","ch"],["\u0798","tt"],["\u0799","hh"],["\u079A","kh"],["\u079B","th"],["\u079C","z"],["\u079D","sh"],["\u079E","s"],["\u079F","d"],["\u07A0","t"],["\u07A1","z"],["\u07A2","a"],["\u07A3","gh"],["\u07A4","q"],["\u07A5","w"],["\u07A6","a"],["\u07A7","aa"],["\u07A8","i"],["\u07A9","ee"],["\u07AA","u"],["\u07AB","oo"],["\u07AC","e"],["\u07AD","ey"],["\u07AE","o"],["\u07AF","oa"],["\u07B0",""],["\u03B1","a"],["\u03B2","v"],["\u03B3","g"],["\u03B4","d"],["\u03B5","e"],["\u03B6","z"],["\u03B7","i"],["\u03B8","th"],["\u03B9","i"],["\u03BA","k"],["\u03BB","l"],["\u03BC","m"],["\u03BD","n"],["\u03BE","ks"],["\u03BF","o"],["\u03C0","p"],["\u03C1","r"],["\u03C3","s"],["\u03C4","t"],["\u03C5","y"],["\u03C6","f"],["\u03C7","x"],["\u03C8","ps"],["\u03C9","o"],["\u03AC","a"],["\u03AD","e"],["\u03AF","i"],["\u03CC","o"],["\u03CD","y"],["\u03AE","i"],["\u03CE","o"],["\u03C2","s"],["\u03CA","i"],["\u03B0","y"],["\u03CB","y"],["\u0390","i"],["\u0391","A"],["\u0392","B"],["\u0393","G"],["\u0394","D"],["\u0395","E"],["\u0396","Z"],["\u0397","I"],["\u0398","TH"],["\u0399","I"],["\u039A","K"],["\u039B","L"],["\u039C","M"],["\u039D","N"],["\u039E","KS"],["\u039F","O"],["\u03A0","P"],["\u03A1","R"],["\u03A3","S"],["\u03A4","T"],["\u03A5","Y"],["\u03A6","F"],["\u03A7","X"],["\u03A8","PS"],["\u03A9","O"],["\u0386","A"],["\u0388","E"],["\u038A","I"],["\u038C","O"],["\u038E","Y"],["\u0389","I"],["\u038F","O"],["\u03AA","I"],["\u03AB","Y"],["\u0101","a"],["\u0113","e"],["\u0123","g"],["\u012B","i"],["\u0137","k"],["\u013C","l"],["\u0146","n"],["\u016B","u"],["\u0100","A"],["\u0112","E"],["\u0122","G"],["\u012A","I"],["\u0136","K"],["\u013B","L"],["\u0145","N"],["\u016A","U"],["\u010D","c"],["\u0161","s"],["\u017E","z"],["\u010C","C"],["\u0160","S"],["\u017D","Z"],["\u0105","a"],["\u010D","c"],["\u0119","e"],["\u0117","e"],["\u012F","i"],["\u0161","s"],["\u0173","u"],["\u016B","u"],["\u017E","z"],["\u0104","A"],["\u010C","C"],["\u0118","E"],["\u0116","E"],["\u012E","I"],["\u0160","S"],["\u0172","U"],["\u016A","U"],["\u040C","Kj"],["\u045C","kj"],["\u0409","Lj"],["\u0459","lj"],["\u040A","Nj"],["\u045A","nj"],["\u0422\u0441","Ts"],["\u0442\u0441","ts"],["\u0105","a"],["\u0107","c"],["\u0119","e"],["\u0142","l"],["\u0144","n"],["\u015B","s"],["\u017A","z"],["\u017C","z"],["\u0104","A"],["\u0106","C"],["\u0118","E"],["\u0141","L"],["\u0143","N"],["\u015A","S"],["\u0179","Z"],["\u017B","Z"],["\u0404","Ye"],["\u0406","I"],["\u0407","Yi"],["\u0490","G"],["\u0454","ye"],["\u0456","i"],["\u0457","yi"],["\u0491","g"]]});var K0=U((UG,W0)=>{"use strict";p();var PD=q0(),$D=H0(),RD=Q0(),OD=(t,e)=>{for(let[r,n]of e)t=t.replace(new RegExp($D(r),"g"),n);return t};W0.exports=(t,e)=>{if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={customReplacements:[],...e};let r=new Map([...RD,...e.customReplacements]);return t=t.normalize(),t=OD(t,r),t=PD(t),t}});var Z0=U((qG,Y0)=>{"use strict";p();Y0.exports=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]]});var X0=U((HG,qg)=>{"use strict";p();var ND=M0(),FD=K0(),DD=Z0(),zD=t=>t.replace(/([A-Z]{2,})(\d+)/g,"$1 $2").replace(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1 $2"),MD=(t,e)=>{let r=ND(e);return t.replace(new RegExp(`${r}{2,}`,"g"),e).replace(new RegExp(`^${r}|${r}$`,"g"),"")},J0=(t,e)=>{if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,...e};let r=e.preserveLeadingUnderscore&&t.startsWith("_"),n=new Map([...DD,...e.customReplacements]);t=FD(t,{customReplacements:n}),e.decamelize&&(t=zD(t));let i=/[^a-zA-Z\d]+/g;return e.lowercase&&(t=t.toLowerCase(),i=/[^a-z\d]+/g),t=t.replace(i,e.separator),t=t.replace(/\\/g,""),e.separator&&(t=MD(t,e.separator)),r&&(t=`_${t}`),t},LD=()=>{let t=new Map,e=(r,n)=>{if(r=J0(r,n),!r)return"";let i=r.toLowerCase(),s=t.get(i.replace(/(?:-\d+?)+?$/,""))||0,o=t.get(i);t.set(i,typeof o=="number"?o+1:1);let a=t.get(i)||2;return(a>=2||s>2)&&(r=`${r}-${a}`),r};return e.reset=()=>{t.clear()},e};qg.exports=J0;qg.exports.counter=LD});var hx=U((XG,dx)=>{"use strict";p();var qd=Object.prototype.hasOwnProperty,fx=Object.prototype.toString,sx=Object.defineProperty,ox=Object.getOwnPropertyDescriptor,ax=function(e){return typeof Array.isArray=="function"?Array.isArray(e):fx.call(e)==="[object Array]"},lx=function(e){if(!e||fx.call(e)!=="[object Object]")return!1;var r=qd.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&qd.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||qd.call(e,i)},cx=function(e,r){sx&&r.name==="__proto__"?sx(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},ux=function(e,r){if(r==="__proto__")if(qd.call(e,r)){if(ox)return ox(e,r).value}else return;return e[r]};dx.exports=function t(){var e,r,n,i,s,o,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l{p();(function(){var t;typeof Oy<"u"?t=Oy.exports=n:t=function(){return this||(0,eval)("this")}(),t.format=n,t.vsprintf=r,typeof console<"u"&&typeof console.log=="function"&&(t.printf=e);function e(){}function r(i,s){return n.apply(null,[i].concat(s))}function n(i){for(var s=1,o=[].slice.call(arguments),a=0,l=i.length,c="",u,f=!1,d,h,g=!1,m,y=function(){return o[s++]},v=function(){for(var b="";/\d/.test(i[a]);)b+=i[a++],u=i[a];return b.length>0?parseInt(b):null};a{"use strict";p();var sn=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>"u"||typeof process.domain>"u")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||sn.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||sn.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||sn.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=sn.DEFAULT_MAX_PENDING};sn.DEFAULT_TIMEOUT=0;sn.DEFAULT_MAX_OCCUPATION_TIME=0;sn.DEFAULT_MAX_EXECUTION_TIME=0;sn.DEFAULT_MAX_PENDING=1e3;sn.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,s=null,o=null;typeof r!="function"&&(n=r,r=null,o=new this.Promise(function(b,k){i=b,s=k})),n=n||{};var a=!1,l=null,c=null,u=null,f=this,d=function(b,k,E){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),a||(o?k?s(k):i(E):typeof r=="function"&&r(k,E),a=!0),b&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},h=function(b){if(a)return d(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[t]=process.domain);var k=n.maxExecutionTime||f.maxExecutionTime;if(k&&(u=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},k)),e.length===1){var E=!1;try{e(function(_,x){E||(E=!0,d(b,_,x))})}catch(_){E||(E=!0,d(b,_))}}else f._promiseTry(function(){return e()}).then(function(_){d(b,void 0,_)},function(_){d(b,_)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var g=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>=g)d(!1,new Error("Too many pending tasks in queue "+t));else{var m=function(){h(!0)};n.skipQueue?f.queues[t].unshift(m):f.queues[t].push(m);var y=n.timeout||f.timeout;y&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},y))}var v=n.maxOccupationTime||f.maxOccupationTime;if(v&&(c=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},v)),o)return o};sn.prototype._acquireBatch=function(t,e,r,n){typeof r!="function"&&(n=r,r=null);var i=this,s=function(a,l){return function(c){i.acquire(a,l,c,n)}},o=t.reduceRight(function(a,l){return s(l,a)},e);if(typeof r=="function")o(r);else return new this.Promise(function(a,l){o.length===1?o(function(c,u){c?l(c):a(u)}):a(o())})};sn.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};sn.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};hS.exports=sn});var gS=U((bre,mS)=>{"use strict";p();mS.exports=pS()});var yS=U((xre,Wy)=>{p();typeof Object.create=="function"?Wy.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Wy.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 Yy=U((Ky,vS)=>{p();var Ah=Ld(),ki=Ah.Buffer;function wS(t,e){for(var r in t)e[r]=t[r]}ki.from&&ki.alloc&&ki.allocUnsafe&&ki.allocUnsafeSlow?vS.exports=Ah:(wS(Ah,Ky),Ky.Buffer=Wo);function Wo(t,e,r){return ki(t,e,r)}Wo.prototype=Object.create(ki.prototype);wS(ki,Wo);Wo.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ki(t,e,r)};Wo.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ki(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Wo.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ki(t)};Wo.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Ah.SlowBuffer(t)}});var xS=U((Zy,_S)=>{p();var Ih=Ld(),Si=Ih.Buffer;function bS(t,e){for(var r in t)e[r]=t[r]}Si.from&&Si.alloc&&Si.allocUnsafe&&Si.allocUnsafeSlow?_S.exports=Ih:(bS(Ih,Zy),Zy.Buffer=Ko);function Ko(t,e,r){return Si(t,e,r)}Ko.prototype=Object.create(Si.prototype);bS(Si,Ko);Ko.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Si(t,e,r)};Ko.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Si(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ko.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Si(t)};Ko.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Ih.SlowBuffer(t)}});var SS=U((Cre,kS)=>{p();var bL={}.toString;kS.exports=Array.isArray||function(t){return bL.call(t)=="[object Array]"}});var xl=U((Are,ES)=>{"use strict";p();ES.exports=TypeError});var Jy=U((Pre,CS)=>{"use strict";p();CS.exports=Object});var AS=U((Rre,TS)=>{"use strict";p();TS.exports=Error});var PS=U((Nre,IS)=>{"use strict";p();IS.exports=EvalError});var RS=U((Dre,$S)=>{"use strict";p();$S.exports=RangeError});var NS=U((Mre,OS)=>{"use strict";p();OS.exports=ReferenceError});var Xy=U((Bre,FS)=>{"use strict";p();FS.exports=SyntaxError});var zS=U((jre,DS)=>{"use strict";p();DS.exports=URIError});var LS=U((Vre,MS)=>{"use strict";p();MS.exports=Math.abs});var US=U((Gre,BS)=>{"use strict";p();BS.exports=Math.floor});var qS=U((Wre,jS)=>{"use strict";p();jS.exports=Math.max});var HS=U((Yre,VS)=>{"use strict";p();VS.exports=Math.min});var QS=U((Jre,GS)=>{"use strict";p();GS.exports=Math.pow});var KS=U((ene,WS)=>{"use strict";p();WS.exports=Math.round});var ZS=U((rne,YS)=>{"use strict";p();YS.exports=Number.isNaN||function(e){return e!==e}});var XS=U((ine,JS)=>{"use strict";p();var _L=ZS();JS.exports=function(e){return _L(e)||e===0?e:e<0?-1:1}});var t1=U((one,e1)=>{"use strict";p();e1.exports=Object.getOwnPropertyDescriptor});var kl=U((lne,r1)=>{"use strict";p();var Ph=t1();if(Ph)try{Ph([],"length")}catch{Ph=null}r1.exports=Ph});var Su=U((une,n1)=>{"use strict";p();var $h=Object.defineProperty||!1;if($h)try{$h({},"a",{value:1})}catch{$h=!1}n1.exports=$h});var ew=U((dne,i1)=>{"use strict";p();i1.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 s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==i||a.enumerable!==!0)return!1}return!0}});var a1=U((pne,o1)=>{"use strict";p();var s1=typeof Symbol<"u"&&Symbol,xL=ew();o1.exports=function(){return typeof s1!="function"||typeof Symbol!="function"||typeof s1("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:xL()}});var tw=U((gne,l1)=>{"use strict";p();l1.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var rw=U((wne,c1)=>{"use strict";p();var kL=Jy();c1.exports=kL.getPrototypeOf||null});var d1=U((bne,f1)=>{"use strict";p();var SL="Function.prototype.bind called on incompatible ",EL=Object.prototype.toString,CL=Math.max,TL="[object Function]",u1=function(e,r){for(var n=[],i=0;i{"use strict";p();var PL=d1();h1.exports=Function.prototype.bind||PL});var Rh=U((Sne,p1)=>{"use strict";p();p1.exports=Function.prototype.call});var Oh=U((Cne,m1)=>{"use strict";p();m1.exports=Function.prototype.apply});var y1=U((Ane,g1)=>{"use strict";p();g1.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var nw=U((Pne,w1)=>{"use strict";p();var $L=Sl(),RL=Oh(),OL=Rh(),NL=y1();w1.exports=NL||$L.call(OL,RL)});var Nh=U((Rne,v1)=>{"use strict";p();var FL=Sl(),DL=xl(),zL=Rh(),ML=nw();v1.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new DL("a function is required");return ML(FL,zL,e)}});var E1=U((Nne,S1)=>{"use strict";p();var LL=Nh(),b1=kl(),x1;try{x1=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var iw=!!x1&&b1&&b1(Object.prototype,"__proto__"),k1=Object,_1=k1.getPrototypeOf;S1.exports=iw&&typeof iw.get=="function"?LL([iw.get]):typeof _1=="function"?function(e){return _1(e==null?e:k1(e))}:!1});var sw=U((Dne,I1)=>{"use strict";p();var C1=tw(),T1=rw(),A1=E1();I1.exports=C1?function(e){return C1(e)}:T1?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return T1(e)}:A1?function(e){return A1(e)}:null});var $1=U((Mne,P1)=>{"use strict";p();var BL=Function.prototype.call,UL=Object.prototype.hasOwnProperty,jL=Sl();P1.exports=jL.call(BL,UL)});var lw=U((Bne,z1)=>{"use strict";p();var Fe,qL=Jy(),VL=AS(),HL=PS(),GL=RS(),QL=NS(),Al=Xy(),Tl=xl(),WL=zS(),KL=LS(),YL=US(),ZL=qS(),JL=HS(),XL=QS(),eB=KS(),tB=XS(),F1=Function,ow=function(t){try{return F1('"use strict"; return ('+t+").constructor;")()}catch{}},Eu=kl(),rB=Su(),aw=function(){throw new Tl},nB=Eu?function(){try{return arguments.callee,aw}catch{try{return Eu(arguments,"callee").get}catch{return aw}}}():aw,El=a1()(),Ut=sw(),iB=rw(),sB=tw(),D1=Oh(),Cu=Rh(),Cl={},oB=typeof Uint8Array>"u"||!Ut?Fe:Ut(Uint8Array),Yo={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Fe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Fe:ArrayBuffer,"%ArrayIteratorPrototype%":El&&Ut?Ut([][Symbol.iterator]()):Fe,"%AsyncFromSyncIteratorPrototype%":Fe,"%AsyncFunction%":Cl,"%AsyncGenerator%":Cl,"%AsyncGeneratorFunction%":Cl,"%AsyncIteratorPrototype%":Cl,"%Atomics%":typeof Atomics>"u"?Fe:Atomics,"%BigInt%":typeof BigInt>"u"?Fe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Fe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Fe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Fe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":VL,"%eval%":eval,"%EvalError%":HL,"%Float16Array%":typeof Float16Array>"u"?Fe:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Fe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Fe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Fe:FinalizationRegistry,"%Function%":F1,"%GeneratorFunction%":Cl,"%Int8Array%":typeof Int8Array>"u"?Fe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Fe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Fe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":El&&Ut?Ut(Ut([][Symbol.iterator]())):Fe,"%JSON%":typeof JSON=="object"?JSON:Fe,"%Map%":typeof Map>"u"?Fe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!El||!Ut?Fe:Ut(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":qL,"%Object.getOwnPropertyDescriptor%":Eu,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Fe:Promise,"%Proxy%":typeof Proxy>"u"?Fe:Proxy,"%RangeError%":GL,"%ReferenceError%":QL,"%Reflect%":typeof Reflect>"u"?Fe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Fe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!El||!Ut?Fe:Ut(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Fe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":El&&Ut?Ut(""[Symbol.iterator]()):Fe,"%Symbol%":El?Symbol:Fe,"%SyntaxError%":Al,"%ThrowTypeError%":nB,"%TypedArray%":oB,"%TypeError%":Tl,"%Uint8Array%":typeof Uint8Array>"u"?Fe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Fe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Fe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Fe:Uint32Array,"%URIError%":WL,"%WeakMap%":typeof WeakMap>"u"?Fe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Fe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Fe:WeakSet,"%Function.prototype.call%":Cu,"%Function.prototype.apply%":D1,"%Object.defineProperty%":rB,"%Object.getPrototypeOf%":iB,"%Math.abs%":KL,"%Math.floor%":YL,"%Math.max%":ZL,"%Math.min%":JL,"%Math.pow%":XL,"%Math.round%":eB,"%Math.sign%":tB,"%Reflect.getPrototypeOf%":sB};if(Ut)try{null.error}catch(t){R1=Ut(Ut(t)),Yo["%Error.prototype%"]=R1}var R1,aB=function t(e){var r;if(e==="%AsyncFunction%")r=ow("async function () {}");else if(e==="%GeneratorFunction%")r=ow("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=ow("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ut&&(r=Ut(i.prototype))}return Yo[e]=r,r},O1={__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"]},Tu=Sl(),Fh=$1(),lB=Tu.call(Cu,Array.prototype.concat),cB=Tu.call(D1,Array.prototype.splice),N1=Tu.call(Cu,String.prototype.replace),Dh=Tu.call(Cu,String.prototype.slice),uB=Tu.call(Cu,RegExp.prototype.exec),fB=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,dB=/\\(\\)?/g,hB=function(e){var r=Dh(e,0,1),n=Dh(e,-1);if(r==="%"&&n!=="%")throw new Al("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Al("invalid intrinsic syntax, expected opening `%`");var i=[];return N1(e,fB,function(s,o,a,l){i[i.length]=a?N1(l,dB,"$1"):o||s}),i},pB=function(e,r){var n=e,i;if(Fh(O1,n)&&(i=O1[n],n="%"+i[0]+"%"),Fh(Yo,n)){var s=Yo[n];if(s===Cl&&(s=aB(n)),typeof s>"u"&&!r)throw new Tl("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Al("intrinsic "+e+" does not exist!")};z1.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Tl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Tl('"allowMissing" argument must be a boolean');if(uB(/^%?[^%]*%?$/,e)===null)throw new Al("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=hB(e),i=n.length>0?n[0]:"",s=pB("%"+i+"%",r),o=s.name,a=s.value,l=!1,c=s.alias;c&&(i=c[0],cB(n,lB([0,1],c)));for(var u=1,f=!0;u=n.length){var m=Eu(a,d);f=!!m,f&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else f=Fh(a,d),a=a[d];f&&!l&&(Yo[o]=a)}}return a}});var cw=U((jne,B1)=>{"use strict";p();var M1=lw(),L1=Nh(),mB=L1([M1("%String.prototype.indexOf%")]);B1.exports=function(e,r){var n=M1(e,!!r);return typeof n=="function"&&mB(e,".prototype.")>-1?L1([n]):n}});var V1=U((Vne,q1)=>{"use strict";p();var j1=Function.prototype.toString,Il=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,fw,zh;if(typeof Il=="function"&&typeof Object.defineProperty=="function")try{fw=Object.defineProperty({},"length",{get:function(){throw zh}}),zh={},Il(function(){throw 42},null,fw)}catch(t){t!==zh&&(Il=null)}else Il=null;var gB=/^\s*class\b/,dw=function(e){try{var r=j1.call(e);return gB.test(r)}catch{return!1}},uw=function(e){try{return dw(e)?!1:(j1.call(e),!0)}catch{return!1}},Mh=Object.prototype.toString,yB="[object Object]",wB="[object Function]",vB="[object GeneratorFunction]",bB="[object HTMLAllCollection]",_B="[object HTML document.all class]",xB="[object HTMLCollection]",kB=typeof Symbol=="function"&&!!Symbol.toStringTag,SB=!(0 in[,]),hw=function(){return!1};typeof document=="object"&&(U1=document.all,Mh.call(U1)===Mh.call(document.all)&&(hw=function(e){if((SB||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=Mh.call(e);return(r===bB||r===_B||r===xB||r===yB)&&e("")==null}catch{}return!1}));var U1;q1.exports=Il?function(e){if(hw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Il(e,null,fw)}catch(r){if(r!==zh)return!1}return!dw(e)&&uw(e)}:function(e){if(hw(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(kB)return uw(e);if(dw(e))return!1;var r=Mh.call(e);return r!==wB&&r!==vB&&!/^\[object HTML/.test(r)?!1:uw(e)}});var Q1=U((Gne,G1)=>{"use strict";p();var EB=V1(),CB=Object.prototype.toString,H1=Object.prototype.hasOwnProperty,TB=function(e,r,n){for(var i=0,s=e.length;i=3&&(i=n),PB(e)?TB(e,r,i):typeof e=="string"?AB(e,r,i):IB(e,r,i)}});var K1=U((Wne,W1)=>{"use strict";p();W1.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Z1=U((Yne,Y1)=>{"use strict";p();var pw=K1(),$B=globalThis;Y1.exports=function(){for(var e=[],r=0;r{"use strict";p();var J1=Su(),RB=Xy(),Pl=xl(),X1=kl();eE.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Pl("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Pl("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Pl("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Pl("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Pl("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Pl("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!X1&&X1(e,r);if(J1)J1(e,r,{configurable:o===null&&l?l.configurable:!o,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:s===null&&l?l.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new RB("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var iE=U((eie,nE)=>{"use strict";p();var mw=Su(),rE=function(){return!!mw};rE.hasArrayLengthDefineBug=function(){if(!mw)return null;try{return mw([],"length",{value:1}).length!==1}catch{return!0}};nE.exports=rE});var cE=U((rie,lE)=>{"use strict";p();var OB=lw(),sE=tE(),NB=iE()(),oE=kl(),aE=xl(),FB=OB("%Math.floor%");lE.exports=function(e,r){if(typeof e!="function")throw new aE("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||FB(r)!==r)throw new aE("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&oE){var o=oE(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(NB?sE(e,"length",r,!0,!0):sE(e,"length",r)),e}});var fE=U((iie,uE)=>{"use strict";p();var DB=Sl(),zB=Oh(),MB=nw();uE.exports=function(){return MB(DB,zB,arguments)}});var pE=U((oie,Lh)=>{"use strict";p();var LB=cE(),dE=Su(),BB=Nh(),hE=fE();Lh.exports=function(e){var r=BB(arguments),n=1+e.length-(arguments.length-1);return LB(r,n>0?n:0,!0)};dE?dE(Lh.exports,"apply",{value:hE}):Lh.exports.apply=hE});var gE=U((lie,mE)=>{"use strict";p();var UB=ew();mE.exports=function(){return UB()&&!!Symbol.toStringTag}});var _E=U((uie,bE)=>{"use strict";p();var jh=Q1(),jB=Z1(),yE=pE(),yw=cw(),Uh=kl(),Bh=sw(),qB=yw("Object.prototype.toString"),vE=gE()(),wE=globalThis,gw=jB(),ww=yw("String.prototype.slice"),VB=yw("Array.prototype.indexOf",!0)||function(e,r){for(var n=0;n-1?r:r!=="Object"?!1:GB(e)}return Uh?HB(e):null}});var kE=U((die,xE)=>{"use strict";p();var QB=_E();xE.exports=function(e){return!!QB(e)}});var EE=U((pie,SE)=>{"use strict";p();var WB=xl(),KB=cw(),YB=KB("TypedArray.prototype.buffer",!0),ZB=kE();SE.exports=YB||function(e){if(!ZB(e))throw new WB("Not a Typed Array");return e.buffer}});var AE=U((gie,TE)=>{"use strict";p();var Xn=xS().Buffer,JB=SS(),XB=EE(),eU=ArrayBuffer.isView||function(e){try{return XB(e),!0}catch{return!1}},tU=typeof Uint8Array<"u",CE=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",rU=CE&&(Xn.prototype instanceof Uint8Array||Xn.TYPED_ARRAY_SUPPORT);TE.exports=function(e,r){if(Xn.isBuffer(e))return e.constructor&&!("isBuffer"in e)?Xn.from(e):e;if(typeof e=="string")return Xn.from(e,r);if(CE&&eU(e)){if(e.byteLength===0)return Xn.alloc(0);if(rU){var n=Xn.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),s=Xn.from(i);if(s.length===e.byteLength)return s}if(tU&&e instanceof Uint8Array)return Xn.from(e);var o=JB(e);if(o)for(var a=0;a255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(o||Xn.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Xn.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var PE=U((wie,IE)=>{"use strict";p();var nU=Yy().Buffer,iU=AE();function Vh(t,e){this._block=nU.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Vh.prototype.update=function(t,e){t=iU(t,e||"utf8");for(var r=this._block,n=this._blockSize,i=t.length,s=this._len,o=0;o=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 s=this._hash();return t?s.toString(t):s};Vh.prototype._update=function(){throw new Error("_update must be implemented by subclass")};IE.exports=Vh});var OE=U((bie,RE)=>{"use strict";p();var sU=yS(),$E=PE(),oU=Yy().Buffer,aU=[1518500249,1859775393,-1894007588,-899497514],lU=new Array(80);function Au(){this.init(),this._w=lU,$E.call(this,64,56)}sU(Au,$E);Au.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function cU(t){return t<<1|t>>>31}function uU(t){return t<<5|t>>>27}function fU(t){return t<<30|t>>>2}function dU(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}Au.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=cU(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=uU(r)+dU(c,n,i,s)+o+e[l]+aU[c]|0;o=s,s=i,i=fU(n),n=r,r=u}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};Au.prototype._hash=function(){var t=oU.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};RE.exports=Au});var FE=U(vw=>{p();var NE;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof vw=="object"?t(vw):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(NE={}):t(NE={})})(function(t){t.version="1.2.2";function e(){for(var S=0,C=new Array(256),T=0;T!=256;++T)S=T,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,C[T]=S;return typeof Int32Array<"u"?new Int32Array(C):C}var r=e();function n(S){var C=0,T=0,P=0,R=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(P=0;P!=256;++P)R[P]=S[P];for(P=0;P!=256;++P)for(T=S[P],C=256+P;C<4096;C+=256)T=R[C]=T>>>8^S[T&255];var N=[];for(P=1;P!=16;++P)N[P-1]=typeof Int32Array<"u"?R.subarray(P*256,P*256+256):R.slice(P*256,P*256+256);return N}var i=n(r),s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],f=i[6],d=i[7],h=i[8],g=i[9],m=i[10],y=i[11],v=i[12],b=i[13],k=i[14];function E(S,C){for(var T=C^-1,P=0,R=S.length;P>>8^r[(T^S.charCodeAt(P++))&255];return~T}function _(S,C){for(var T=C^-1,P=S.length-15,R=0;R>8&255]^v[S[R++]^T>>16&255]^y[S[R++]^T>>>24]^m[S[R++]]^g[S[R++]]^h[S[R++]]^d[S[R++]]^f[S[R++]]^u[S[R++]]^c[S[R++]]^l[S[R++]]^a[S[R++]]^o[S[R++]]^s[S[R++]]^r[S[R++]];for(P+=15;R>>8^r[(T^S[R++])&255];return~T}function x(S,C){for(var T=C^-1,P=0,R=S.length,N=0,F=0;P>>8^r[(T^N)&255]:N<2048?(T=T>>>8^r[(T^(192|N>>6&31))&255],T=T>>>8^r[(T^(128|N&63))&255]):N>=55296&&N<57344?(N=(N&1023)+64,F=S.charCodeAt(P++)&1023,T=T>>>8^r[(T^(240|N>>8&7))&255],T=T>>>8^r[(T^(128|N>>2&63))&255],T=T>>>8^r[(T^(128|F>>6&15|(N&3)<<4))&255],T=T>>>8^r[(T^(128|F&63))&255]):(T=T>>>8^r[(T^(224|N>>12&15))&255],T=T>>>8^r[(T^(128|N>>6&63))&255],T=T>>>8^r[(T^(128|N&63))&255]);return~T}t.table=r,t.bstr=E,t.buf=_,t.str=x})});var ss=U(xr=>{"use strict";p();var hU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function pU(t,e){return Object.prototype.hasOwnProperty.call(t,e)}xr.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)pU(r,n)&&(t[n]=r[n])}}return t};xr.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var mU={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+n),i);return}for(var s=0;s{"use strict";p();var yU=ss(),wU=4,DE=0,zE=1,vU=2;function Rl(t){for(var e=t.length;--e>=0;)t[e]=0}var bU=0,qE=1,_U=2,xU=3,kU=258,Cw=29,Nu=256,Pu=Nu+1+Cw,$l=30,Tw=19,VE=2*Pu+1,Zo=15,bw=16,SU=7,Aw=256,HE=16,GE=17,QE=18,Sw=[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],Hh=[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],EU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],WE=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],CU=512,os=new Array((Pu+2)*2);Rl(os);var Iu=new Array($l*2);Rl(Iu);var $u=new Array(CU);Rl($u);var Ru=new Array(kU-xU+1);Rl(Ru);var Iw=new Array(Cw);Rl(Iw);var Gh=new Array($l);Rl(Gh);function _w(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 KE,YE,ZE;function xw(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function JE(t){return t<256?$u[t]:$u[256+(t>>>7)]}function Ou(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function zr(t,e,r){t.bi_valid>bw-r?(t.bi_buf|=e<>bw-t.bi_valid,t.bi_valid+=r-bw):(t.bi_buf|=e<>>=1,r<<=1;while(--e>0);return r>>>1}function TU(t){t.bi_valid===16?(Ou(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 AU(t,e){var r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,g,m=0;for(d=0;d<=Zo;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(d=l,m++),r[u*2+1]=d,!(u>n)&&(t.bl_count[d]++,h=0,u>=a&&(h=o[u-a]),g=r[u*2],t.opt_len+=g*(d+h),s&&(t.static_len+=g*(i[u*2+1]+h)));if(m!==0){do{for(d=l-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,m-=2}while(m>0);for(d=l;d!==0;d--)for(u=t.bl_count[d];u!==0;)f=t.heap[--c],!(f>n)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),u--)}}function eC(t,e,r){var n=new Array(Zo+1),i=0,s,o;for(s=1;s<=Zo;s++)n[s]=i=i+r[s-1]<<1;for(o=0;o<=e;o++){var a=t[o*2+1];a!==0&&(t[o*2]=XE(n[a]++,a))}}function IU(){var t,e,r,n,i,s=new Array(Zo+1);for(r=0,n=0;n>=7;n<$l;n++)for(Gh[n]=i<<7,t=0;t<1<8?Ou(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 PU(t,e,r,n){rC(t),n&&(Ou(t,r),Ou(t,~r)),yU.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function ME(t,e,r,n){var i=e*2,s=r*2;return t[i]>1;o>=1;o--)kw(t,r,o);c=s;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],kw(t,r,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,r[c*2]=r[o*2]+r[a*2],t.depth[c]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,r[o*2+1]=r[a*2+1]=c,t.heap[1]=c++,kw(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],AU(t,e),eC(r,l,t.bl_count)}function BE(t,e,r){var n,i=-1,s,o=e[0*2+1],a=0,l=7,c=4;for(o===0&&(l=138,c=3),e[(r+1)*2+1]=65535,n=0;n<=r;n++)s=o,o=e[(n+1)*2+1],!(++a=3&&t.bl_tree[WE[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function RU(t,e,r,n){var i;for(zr(t,e-257,5),zr(t,r-1,5),zr(t,n-4,4),i=0;i>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return DE;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return zE;for(r=32;r0?(t.strm.data_type===vU&&(t.strm.data_type=OU(t)),Ew(t,t.l_desc),Ew(t,t.d_desc),o=$U(t),i=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=i&&(i=s)):i=s=r+5,r+4<=i&&e!==-1?nC(t,e,r,n):t.strategy===wU||s===i?(zr(t,(qE<<1)+(n?1:0),3),LE(t,os,Iu)):(zr(t,(_U<<1)+(n?1:0),3),RU(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),LE(t,t.dyn_ltree,t.dyn_dtree)),tC(t),n&&rC(t)}function zU(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[(Ru[r]+Nu+1)*2]++,t.dyn_dtree[JE(e)*2]++),t.last_lit===t.lit_bufsize-1}Ol._tr_init=NU;Ol._tr_stored_block=nC;Ol._tr_flush_block=DU;Ol._tr_tally=zU;Ol._tr_align=FU});var Pw=U((Aie,sC)=>{"use strict";p();function MU(t,e,r,n){for(var i=t&65535|0,s=t>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+e[n++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0}sC.exports=MU});var $w=U((Pie,oC)=>{"use strict";p();function LU(){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 BU=LU();function UU(t,e,r,n){var i=BU,s=n+r;t^=-1;for(var o=n;o>>8^i[(t^e[o])&255];return t^-1}oC.exports=UU});var Qh=U((Rie,aC)=>{"use strict";p();aC.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 gC=U(Ai=>{"use strict";p();var kr=ss(),Nn=iC(),fC=Pw(),Fs=$w(),jU=Qh(),ta=0,qU=1,VU=3,Bs=4,lC=5,Ti=0,cC=1,Fn=-2,HU=-3,Rw=-5,GU=-1,QU=1,Wh=2,WU=3,KU=4,YU=0,ZU=2,Jh=8,JU=9,XU=15,ej=8,tj=29,rj=256,Nw=rj+1+tj,nj=30,ij=19,sj=2*Nw+1,oj=15,Me=3,Ms=258,ei=Ms+Me+1,aj=32,Xh=42,Fw=69,Kh=73,Yh=91,Zh=103,Jo=113,Du=666,At=1,zu=2,Xo=3,Dl=4,lj=3;function Ls(t,e){return t.msg=jU[e],e}function uC(t){return(t<<1)-(t>4?9:0)}function zs(t){for(var e=t.length;--e>=0;)t[e]=0}function Ds(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(kr.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 Jt(t,e){Nn._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ds(t.strm)}function Ve(t,e){t.pending_buf[t.pending++]=e}function Fu(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function cj(t,e,r,n){var i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,kr.arraySet(e,t.input,t.next_in,i,r),t.state.wrap===1?t.adler=fC(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Fs(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)}function dC(t,e){var r=t.max_chain_length,n=t.strstart,i,s,o=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-ei?t.strstart-(t.w_size-ei):0,c=t.window,u=t.w_mask,f=t.prev,d=t.strstart+Ms,h=c[n+o-1],g=c[n+o];t.prev_length>=t.good_match&&(r>>=2),a>t.lookahead&&(a=t.lookahead);do if(i=e,!(c[i+o]!==g||c[i+o-1]!==h||c[i]!==c[n]||c[++i]!==c[n+1])){n+=2,i++;do;while(c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&no){if(t.match_start=e,o=s,s>=a)break;h=c[n+o-1],g=c[n+o]}}while((e=f[e&u])>l&&--r!==0);return o<=t.lookahead?o:t.lookahead}function ea(t){var e=t.w_size,r,n,i,s,o;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ei)){kr.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);s+=e}if(t.strm.avail_in===0)break;if(n=cj(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=n,t.lookahead+t.insert>=Me)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ea(t),t.lookahead===0&&e===ta)return At;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,Jt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-ei&&(Jt(t,!1),t.strm.avail_out===0))return At}return t.insert=0,e===Bs?(Jt(t,!0),t.strm.avail_out===0?Xo:Dl):(t.strstart>t.block_start&&(Jt(t,!1),t.strm.avail_out===0),At)}function Ow(t,e){for(var r,n;;){if(t.lookahead=Me&&(t.ins_h=(t.ins_h<=Me)if(n=Nn._tr_tally(t,t.strstart-t.match_start,t.match_length-Me),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Me){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=Me&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=Me-1)),t.prev_length>=Me&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-Me,n=Nn._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Me),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<=Me&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){s=t.strstart+Ms;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Me?(r=Nn._tr_tally(t,1,t.match_length-Me),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Nn._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Jt(t,!1),t.strm.avail_out===0))return At}return t.insert=0,e===Bs?(Jt(t,!0),t.strm.avail_out===0?Xo:Dl):t.last_lit&&(Jt(t,!1),t.strm.avail_out===0)?At:zu}function dj(t,e){for(var r;;){if(t.lookahead===0&&(ea(t),t.lookahead===0)){if(e===ta)return At;break}if(t.match_length=0,r=Nn._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Jt(t,!1),t.strm.avail_out===0))return At}return t.insert=0,e===Bs?(Jt(t,!0),t.strm.avail_out===0?Xo:Dl):t.last_lit&&(Jt(t,!1),t.strm.avail_out===0)?At:zu}function Ci(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 Fl;Fl=[new Ci(0,0,0,0,uj),new Ci(4,4,8,4,Ow),new Ci(4,5,16,8,Ow),new Ci(4,6,32,32,Ow),new Ci(4,4,16,16,Nl),new Ci(8,16,32,32,Nl),new Ci(8,16,128,128,Nl),new Ci(8,32,128,256,Nl),new Ci(32,128,258,1024,Nl),new Ci(32,258,258,4096,Nl)];function hj(t){t.window_size=2*t.w_size,zs(t.head),t.max_lazy_match=Fl[t.level].max_lazy,t.good_match=Fl[t.level].good_length,t.nice_match=Fl[t.level].nice_length,t.max_chain_length=Fl[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Me-1,t.match_available=0,t.ins_h=0}function pj(){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=Jh,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 kr.Buf16(sj*2),this.dyn_dtree=new kr.Buf16((2*nj+1)*2),this.bl_tree=new kr.Buf16((2*ij+1)*2),zs(this.dyn_ltree),zs(this.dyn_dtree),zs(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new kr.Buf16(oj+1),this.heap=new kr.Buf16(2*Nw+1),zs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new kr.Buf16(2*Nw+1),zs(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 hC(t){var e;return!t||!t.state?Ls(t,Fn):(t.total_in=t.total_out=0,t.data_type=ZU,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?Xh:Jo,t.adler=e.wrap===2?0:1,e.last_flush=ta,Nn._tr_init(e),Ti)}function pC(t){var e=hC(t);return e===Ti&&hj(t.state),e}function mj(t,e){return!t||!t.state||t.state.wrap!==2?Fn:(t.state.gzhead=e,Ti)}function mC(t,e,r,n,i,s){if(!t)return Fn;var o=1;if(e===GU&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>JU||r!==Jh||n<8||n>15||e<0||e>9||s<0||s>KU)return Ls(t,Fn);n===8&&(n=9);var a=new pj;return t.state=a,a.strm=t,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<lC||e<0)return t?Ls(t,Fn):Fn;if(n=t.state,!t.output||!t.input&&t.avail_in!==0||n.status===Du&&e!==Bs)return Ls(t,t.avail_out===0?Rw:Fn);if(n.strm=t,r=n.last_flush,n.last_flush=e,n.status===Xh)if(n.wrap===2)t.adler=0,Ve(n,31),Ve(n,139),Ve(n,8),n.gzhead?(Ve(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)),Ve(n,n.gzhead.time&255),Ve(n,n.gzhead.time>>8&255),Ve(n,n.gzhead.time>>16&255),Ve(n,n.gzhead.time>>24&255),Ve(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Ve(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Ve(n,n.gzhead.extra.length&255),Ve(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Fs(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Fw):(Ve(n,0),Ve(n,0),Ve(n,0),Ve(n,0),Ve(n,0),Ve(n,n.level===9?2:n.strategy>=Wh||n.level<2?4:0),Ve(n,lj),n.status=Jo);else{var o=Jh+(n.w_bits-8<<4)<<8,a=-1;n.strategy>=Wh||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,o|=a<<6,n.strstart!==0&&(o|=aj),o+=31-o%31,n.status=Jo,Fu(n,o),n.strstart!==0&&(Fu(n,t.adler>>>16),Fu(n,t.adler&65535)),t.adler=1}if(n.status===Fw)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=Fs(t.adler,n.pending_buf,n.pending-i,i)),Ds(t),i=n.pending,n.pending===n.pending_buf_size));)Ve(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(t.adler=Fs(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Kh)}else n.status=Kh;if(n.status===Kh)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Fs(t.adler,n.pending_buf,n.pending-i,i)),Ds(t),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindexi&&(t.adler=Fs(t.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.gzindex=0,n.status=Yh)}else n.status=Yh;if(n.status===Yh)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Fs(t.adler,n.pending_buf,n.pending-i,i)),Ds(t),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindexi&&(t.adler=Fs(t.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.status=Zh)}else n.status=Zh;if(n.status===Zh&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&Ds(t),n.pending+2<=n.pending_buf_size&&(Ve(n,t.adler&255),Ve(n,t.adler>>8&255),t.adler=0,n.status=Jo)):n.status=Jo),n.pending!==0){if(Ds(t),t.avail_out===0)return n.last_flush=-1,Ti}else if(t.avail_in===0&&uC(e)<=uC(r)&&e!==Bs)return Ls(t,Rw);if(n.status===Du&&t.avail_in!==0)return Ls(t,Rw);if(t.avail_in!==0||n.lookahead!==0||e!==ta&&n.status!==Du){var l=n.strategy===Wh?dj(n,e):n.strategy===WU?fj(n,e):Fl[n.level].func(n,e);if((l===Xo||l===Dl)&&(n.status=Du),l===At||l===Xo)return t.avail_out===0&&(n.last_flush=-1),Ti;if(l===zu&&(e===qU?Nn._tr_align(n):e!==lC&&(Nn._tr_stored_block(n,0,0,!1),e===VU&&(zs(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Ds(t),t.avail_out===0))return n.last_flush=-1,Ti}return e!==Bs?Ti:n.wrap<=0?cC:(n.wrap===2?(Ve(n,t.adler&255),Ve(n,t.adler>>8&255),Ve(n,t.adler>>16&255),Ve(n,t.adler>>24&255),Ve(n,t.total_in&255),Ve(n,t.total_in>>8&255),Ve(n,t.total_in>>16&255),Ve(n,t.total_in>>24&255)):(Fu(n,t.adler>>>16),Fu(n,t.adler&65535)),Ds(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ti:cC)}function wj(t){var e;return!t||!t.state?Fn:(e=t.state.status,e!==Xh&&e!==Fw&&e!==Kh&&e!==Yh&&e!==Zh&&e!==Jo&&e!==Du?Ls(t,Fn):(t.state=null,e===Jo?Ls(t,HU):Ti))}function vj(t,e){var r=e.length,n,i,s,o,a,l,c,u;if(!t||!t.state||(n=t.state,o=n.wrap,o===2||o===1&&n.status!==Xh||n.lookahead))return Fn;for(o===1&&(t.adler=fC(t.adler,e,r,0)),n.wrap=0,r>=n.w_size&&(o===0&&(zs(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new kr.Buf8(n.w_size),kr.arraySet(u,e,r-n.w_size,n.w_size,0),e=u,r=n.w_size),a=t.avail_in,l=t.next_in,c=t.input,t.avail_in=r,t.next_in=0,t.input=e,ea(n);n.lookahead>=Me;){i=n.strstart,s=n.lookahead-(Me-1);do n.ins_h=(n.ins_h<{"use strict";p();var ep=ss(),yC=!0,wC=!0;try{String.fromCharCode.apply(null,[0])}catch{yC=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{wC=!1}var Mu=new ep.Buf8(256);for(as=0;as<256;as++)Mu[as]=as>=252?6:as>=248?5:as>=240?4:as>=224?3:as>=192?2:1;var as;Mu[254]=Mu[254]=1;zl.string2buf=function(t){var e,r,n,i,s,o=t.length,a=0;for(i=0;i>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function vC(t,e){if(e<65534&&(t.subarray&&wC||!t.subarray&&yC))return String.fromCharCode.apply(null,ep.shrinkBuf(t,e));for(var r="",n=0;n4){a[n++]=65533,r+=s-1;continue}for(i&=s===2?31:s===3?15:7;s>1&&r1){a[n++]=65533;continue}i<65536?a[n++]=i:(i-=65536,a[n++]=55296|i>>10&1023,a[n++]=56320|i&1023)}return vC(a,n)};zl.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+Mu[t[r]]>e?r:e}});var zw=U((Mie,bC)=>{"use strict";p();function bj(){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}bC.exports=bj});var SC=U(Uu=>{"use strict";p();var Lu=gC(),Bu=ss(),Lw=Dw(),Bw=Qh(),_j=zw(),kC=Object.prototype.toString,xj=0,Mw=4,Ml=0,_C=1,xC=2,kj=-1,Sj=0,Ej=8;function ra(t){if(!(this instanceof ra))return new ra(t);this.options=Bu.assign({level:kj,method:Ej,chunkSize:16384,windowBits:15,memLevel:8,strategy:Sj,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 _j,this.strm.avail_out=0;var r=Lu.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Ml)throw new Error(Bw[r]);if(e.header&&Lu.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(typeof e.dictionary=="string"?n=Lw.string2buf(e.dictionary):kC.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=Lu.deflateSetDictionary(this.strm,n),r!==Ml)throw new Error(Bw[r]);this._dict_set=!0}}ra.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Mw:xj,typeof t=="string"?r.input=Lw.string2buf(t):kC.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 Bu.Buf8(n),r.next_out=0,r.avail_out=n),i=Lu.deflate(r,s),i!==_C&&i!==Ml)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Mw||s===xC))&&(this.options.to==="string"?this.onData(Lw.buf2binstring(Bu.shrinkBuf(r.output,r.next_out))):this.onData(Bu.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==_C);return s===Mw?(i=Lu.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Ml):(s===xC&&(this.onEnd(Ml),r.avail_out=0),!0)};ra.prototype.onData=function(t){this.chunks.push(t)};ra.prototype.onEnd=function(t){t===Ml&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Bu.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Uw(t,e){var r=new ra(e);if(r.push(t,!0),r.err)throw r.msg||Bw[r.err];return r.result}function Cj(t,e){return e=e||{},e.raw=!0,Uw(t,e)}function Tj(t,e){return e=e||{},e.gzip=!0,Uw(t,e)}Uu.Deflate=ra;Uu.deflate=Uw;Uu.deflateRaw=Cj;Uu.gzip=Tj});var CC=U((jie,EC)=>{"use strict";p();var tp=30,Aj=12;EC.exports=function(e,r){var n,i,s,o,a,l,c,u,f,d,h,g,m,y,v,b,k,E,_,x,S,C,T,P,R;n=e.state,i=e.next_in,P=e.input,s=i+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(r-e.avail_out),l=o+(e.avail_out-257),c=n.dmax,u=n.wsize,f=n.whave,d=n.wnext,h=n.window,g=n.hold,m=n.bits,y=n.lencode,v=n.distcode,b=(1<>>24,g>>>=_,m-=_,_=E>>>16&255,_===0)R[o++]=E&65535;else if(_&16){x=E&65535,_&=15,_&&(m<_&&(g+=P[i++]<>>=_,m-=_),m<15&&(g+=P[i++]<>>24,g>>>=_,m-=_,_=E>>>16&255,_&16){if(S=E&65535,_&=15,m<_&&(g+=P[i++]<c){e.msg="invalid distance too far back",n.mode=tp;break e}if(g>>>=_,m-=_,_=o-a,S>_){if(_=S-_,_>f&&n.sane){e.msg="invalid distance too far back",n.mode=tp;break e}if(C=0,T=h,d===0){if(C+=u-_,_2;)R[o++]=T[C++],R[o++]=T[C++],R[o++]=T[C++],x-=3;x&&(R[o++]=T[C++],x>1&&(R[o++]=T[C++]))}else{C=o-S;do R[o++]=R[C++],R[o++]=R[C++],R[o++]=R[C++],x-=3;while(x>2);x&&(R[o++]=R[C++],x>1&&(R[o++]=R[C++]))}}else if((_&64)===0){E=v[(E&65535)+(g&(1<<_)-1)];continue r}else{e.msg="invalid distance code",n.mode=tp;break e}break}}else if((_&64)===0){E=y[(E&65535)+(g&(1<<_)-1)];continue t}else if(_&32){n.mode=Aj;break e}else{e.msg="invalid literal/length code",n.mode=tp;break e}break}}while(i>3,i-=x,m-=x<<3,g&=(1<{"use strict";p();var TC=ss(),Ll=15,AC=852,IC=592,PC=0,jw=1,$C=2,Ij=[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],Pj=[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],$j=[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],Rj=[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];RC.exports=function(e,r,n,i,s,o,a,l){var c=l.bits,u=0,f=0,d=0,h=0,g=0,m=0,y=0,v=0,b=0,k=0,E,_,x,S,C,T=null,P=0,R,N=new TC.Buf16(Ll+1),F=new TC.Buf16(Ll+1),j=null,Q=0,ge,ie,pe;for(u=0;u<=Ll;u++)N[u]=0;for(f=0;f=1&&N[h]===0;h--);if(g>h&&(g=h),h===0)return s[o++]=1<<24|64<<16|0,s[o++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===PC||h!==1))return-1;for(F[1]=0,u=1;uAC||e===$C&&b>IC)return 1;for(;;){ge=u-y,a[f]R?(ie=j[Q+a[f]],pe=T[P+a[f]]):(ie=96,pe=0),E=1<>y)+_]=ge<<24|ie<<16|pe|0;while(_!==0);for(E=1<>=1;if(E!==0?(k&=E-1,k+=E):k=0,f++,--N[u]===0){if(u===h)break;u=r[n+a[f]]}if(u>g&&(k&S)!==x){for(y===0&&(y=g),C+=d,m=u-y,v=1<AC||e===$C&&b>IC)return 1;x=k&S,s[x]=g<<24|m<<16|C-o|0}}return k!==0&&(s[C+k]=u-y<<24|64<<16|0),l.bits=g,0}});var pT=U(ti=>{"use strict";p();var on=ss(),Ww=Pw(),Ii=$w(),Oj=CC(),ju=OC(),Nj=0,sT=1,oT=2,NC=4,Fj=5,rp=6,na=0,Dj=1,zj=2,Dn=-2,aT=-3,Kw=-4,Mj=-5,FC=8,lT=1,DC=2,zC=3,MC=4,LC=5,BC=6,UC=7,jC=8,qC=9,VC=10,sp=11,ls=12,qw=13,HC=14,Vw=15,GC=16,QC=17,WC=18,KC=19,np=20,ip=21,YC=22,ZC=23,JC=24,XC=25,eT=26,Hw=27,tT=28,rT=29,ct=30,Yw=31,Lj=32,Bj=852,Uj=592,jj=15,qj=jj;function nT(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function Vj(){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 on.Buf16(320),this.work=new on.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function cT(t){var e;return!t||!t.state?Dn:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=lT,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new on.Buf32(Bj),e.distcode=e.distdyn=new on.Buf32(Uj),e.sane=1,e.back=-1,na)}function uT(t){var e;return!t||!t.state?Dn:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,cT(t))}function fT(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))?Dn:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,uT(t))}function dT(t,e){var r,n;return t?(n=new Vj,t.state=n,n.window=null,r=fT(t,e),r!==na&&(t.state=null),r):Dn}function Hj(t){return dT(t,qj)}var iT=!0,Gw,Qw;function Gj(t){if(iT){var e;for(Gw=new on.Buf32(512),Qw=new on.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(ju(sT,t.lens,0,288,Gw,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ju(oT,t.lens,0,32,Qw,0,t.work,{bits:5}),iT=!1}t.lencode=Gw,t.lenbits=9,t.distcode=Qw,t.distbits=5}function hT(t,e,r,n){var i,s=t.state;return s.window===null&&(s.wsize=1<=s.wsize?(on.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),on.arraySet(s.window,e,r-n,i,s.wnext),n-=i,n?(on.arraySet(s.window,e,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=Ii(r.check,T,2,0),c=0,u=0,r.mode=DC;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=ct;break}if((c&15)!==FC){t.msg="unknown compression method",r.mode=ct;break}if(c>>>=4,u-=4,S=(c&15)+8,r.wbits===0)r.wbits=S;else if(S>r.wbits){t.msg="invalid window size",r.mode=ct;break}r.dmax=1<>8&1),r.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,r.check=Ii(r.check,T,2,0)),c=0,u=0,r.mode=zC;case zC:for(;u<32;){if(a===0)break e;a--,c+=n[s++]<>>8&255,T[2]=c>>>16&255,T[3]=c>>>24&255,r.check=Ii(r.check,T,4,0)),c=0,u=0,r.mode=MC;case MC:for(;u<16;){if(a===0)break e;a--,c+=n[s++]<>8),r.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,r.check=Ii(r.check,T,2,0)),c=0,u=0,r.mode=LC;case LC:if(r.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=n[s++]<>>8&255,r.check=Ii(r.check,T,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=BC;case BC:if(r.flags&1024&&(h=r.length,h>a&&(h=a),h&&(r.head&&(S=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),on.arraySet(r.head.extra,n,s,h,S)),r.flags&512&&(r.check=Ii(r.check,n,h,s)),a-=h,s+=h,r.length-=h),r.length))break e;r.length=0,r.mode=UC;case UC:if(r.flags&2048){if(a===0)break e;h=0;do S=n[s+h++],r.head&&S&&r.length<65536&&(r.head.name+=String.fromCharCode(S));while(S&&h>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=ls;break;case VC:for(;u<32;){if(a===0)break e;a--,c+=n[s++]<>>=u&7,u-=u&7,r.mode=Hw;break}for(;u<3;){if(a===0)break e;a--,c+=n[s++]<>>=1,u-=1,c&3){case 0:r.mode=HC;break;case 1:if(Gj(r),r.mode=np,e===rp){c>>>=2,u-=2;break e}break;case 2:r.mode=QC;break;case 3:t.msg="invalid block type",r.mode=ct}c>>>=2,u-=2;break;case HC:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=n[s++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=ct;break}if(r.length=c&65535,c=0,u=0,r.mode=Vw,e===rp)break e;case Vw:r.mode=GC;case GC:if(h=r.length,h){if(h>a&&(h=a),h>l&&(h=l),h===0)break e;on.arraySet(i,n,s,h,o),a-=h,s+=h,l-=h,o+=h,r.length-=h;break}r.mode=ls;break;case QC:for(;u<14;){if(a===0)break e;a--,c+=n[s++]<>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=ct;break}r.have=0,r.mode=WC;case WC:for(;r.have>>=3,u-=3}for(;r.have<19;)r.lens[N[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},C=ju(Nj,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,C){t.msg="invalid code lengths set",r.mode=ct;break}r.have=0,r.mode=KC;case KC:for(;r.have>>24,b=y>>>16&255,k=y&65535,!(v<=u);){if(a===0)break e;a--,c+=n[s++]<>>=v,u-=v,r.lens[r.have++]=k;else{if(k===16){for(R=v+2;u>>=v,u-=v,r.have===0){t.msg="invalid bit length repeat",r.mode=ct;break}S=r.lens[r.have-1],h=3+(c&3),c>>>=2,u-=2}else if(k===17){for(R=v+3;u>>=v,u-=v,S=0,h=3+(c&7),c>>>=3,u-=3}else{for(R=v+7;u>>=v,u-=v,S=0,h=11+(c&127),c>>>=7,u-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=ct;break}for(;h--;)r.lens[r.have++]=S}}if(r.mode===ct)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=ct;break}if(r.lenbits=9,P={bits:r.lenbits},C=ju(sT,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,C){t.msg="invalid literal/lengths set",r.mode=ct;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},C=ju(oT,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,C){t.msg="invalid distances set",r.mode=ct;break}if(r.mode=np,e===rp)break e;case np:r.mode=ip;case ip:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,r.hold=c,r.bits=u,Oj(t,d),o=t.next_out,i=t.output,l=t.avail_out,s=t.next_in,n=t.input,a=t.avail_in,c=r.hold,u=r.bits,r.mode===ls&&(r.back=-1);break}for(r.back=0;y=r.lencode[c&(1<>>24,b=y>>>16&255,k=y&65535,!(v<=u);){if(a===0)break e;a--,c+=n[s++]<>E)],v=y>>>24,b=y>>>16&255,k=y&65535,!(E+v<=u);){if(a===0)break e;a--,c+=n[s++]<>>=E,u-=E,r.back+=E}if(c>>>=v,u-=v,r.back+=v,r.length=k,b===0){r.mode=eT;break}if(b&32){r.back=-1,r.mode=ls;break}if(b&64){t.msg="invalid literal/length code",r.mode=ct;break}r.extra=b&15,r.mode=YC;case YC:if(r.extra){for(R=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=ZC;case ZC:for(;y=r.distcode[c&(1<>>24,b=y>>>16&255,k=y&65535,!(v<=u);){if(a===0)break e;a--,c+=n[s++]<>E)],v=y>>>24,b=y>>>16&255,k=y&65535,!(E+v<=u);){if(a===0)break e;a--,c+=n[s++]<>>=E,u-=E,r.back+=E}if(c>>>=v,u-=v,r.back+=v,b&64){t.msg="invalid distance code",r.mode=ct;break}r.offset=k,r.extra=b&15,r.mode=JC;case JC:if(r.extra){for(R=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=ct;break}r.mode=XC;case XC: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=ct;break}h>r.wnext?(h-=r.wnext,g=r.wsize-h):g=r.wnext-h,h>r.length&&(h=r.length),m=r.window}else m=i,g=o-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do i[o++]=m[g++];while(--h);r.length===0&&(r.mode=ip);break;case eT:if(l===0)break e;i[o++]=r.length,l--,r.mode=ip;break;case Hw:if(r.wrap){for(;u<32;){if(a===0)break e;a--,c|=n[s++]<{"use strict";p();mT.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 yT=U((Yie,gT)=>{"use strict";p();function Zj(){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}gT.exports=Zj});var vT=U(Vu=>{"use strict";p();var Bl=pT(),qu=ss(),op=Dw(),xt=Zw(),Jw=Qh(),Jj=zw(),Xj=yT(),wT=Object.prototype.toString;function ia(t){if(!(this instanceof ia))return new ia(t);this.options=qu.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Jj,this.strm.avail_out=0;var r=Bl.inflateInit2(this.strm,e.windowBits);if(r!==xt.Z_OK)throw new Error(Jw[r]);if(this.header=new Xj,Bl.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=op.string2buf(e.dictionary):wT.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Bl.inflateSetDictionary(this.strm,e.dictionary),r!==xt.Z_OK)))throw new Error(Jw[r])}ia.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,s,o,a,l,c,u=!1;if(this.ended)return!1;o=e===~~e?e:e===!0?xt.Z_FINISH:xt.Z_NO_FLUSH,typeof t=="string"?r.input=op.binstring2buf(t):wT.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 qu.Buf8(n),r.next_out=0,r.avail_out=n),s=Bl.inflate(r,xt.Z_NO_FLUSH),s===xt.Z_NEED_DICT&&i&&(s=Bl.inflateSetDictionary(this.strm,i)),s===xt.Z_BUF_ERROR&&u===!0&&(s=xt.Z_OK,u=!1),s!==xt.Z_STREAM_END&&s!==xt.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===xt.Z_STREAM_END||r.avail_in===0&&(o===xt.Z_FINISH||o===xt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=op.utf8border(r.output,r.next_out),l=r.next_out-a,c=op.buf2string(r.output,a),r.next_out=l,r.avail_out=n-l,l&&qu.arraySet(r.output,r.output,a,l,0),this.onData(c)):this.onData(qu.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==xt.Z_STREAM_END);return s===xt.Z_STREAM_END&&(o=xt.Z_FINISH),o===xt.Z_FINISH?(s=Bl.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===xt.Z_OK):(o===xt.Z_SYNC_FLUSH&&(this.onEnd(xt.Z_OK),r.avail_out=0),!0)};ia.prototype.onData=function(t){this.chunks.push(t)};ia.prototype.onEnd=function(t){t===xt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=qu.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Xw(t,e){var r=new ia(e);if(r.push(t,!0),r.err)throw r.msg||Jw[r.err];return r.result}function eq(t,e){return e=e||{},e.raw=!0,Xw(t,e)}Vu.Inflate=ia;Vu.inflate=Xw;Vu.inflateRaw=eq;Vu.ungzip=Xw});var xT=U((ese,_T)=>{"use strict";p();var tq=ss().assign,rq=SC(),nq=vT(),iq=Zw(),bT={};tq(bT,rq,nq,iq);_T.exports=bT});var ET=U((rse,ST)=>{"use strict";p();var kT=(t,e)=>function(...r){let n=e.promiseModule;return new n((i,s)=>{e.multiArgs?r.push((...o)=>{e.errorFirst?o[0]?s(o):(o.shift(),i(o)):i(o)}):e.errorFirst?r.push((o,a)=>{o?s(o):i(a)}):r.push(i),t.apply(this,r)})};ST.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=s=>{let o=a=>typeof a=="string"?s===a:a.test(s);return e.include?e.include.some(o):!e.exclude.some(o)},i;r==="function"?i=function(...s){return e.excludeMain?t(...s):kT(t,e).apply(this,s)}:i=Object.create(Object.getPrototypeOf(t));for(let s in t){let o=t[s];i[s]=typeof o=="function"&&n(s)?kT(o,e):o}return i}});var NT=U((ise,OT)=>{p();function CT(t){return Array.isArray(t)?t:[t]}var rv="",TT=" ",ev="\\",sq=/^\s+$/,oq=/(?:[^\\]|^)\\$/,aq=/^\\!/,lq=/^\\#/,cq=/\r?\n/g,uq=/^\.*\/|^\.+$/,tv="/",PT="node-ignore";typeof Symbol<"u"&&(PT=Symbol.for("node-ignore"));var AT=PT,fq=(t,e,r)=>Object.defineProperty(t,e,{value:r}),dq=/([0-z])-([0-z])/g,$T=()=>!1,hq=t=>t.replace(dq,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:rv),pq=t=>{let{length:e}=t;return t.slice(0,e-e%2)},mq=[[/^\uFEFF/,()=>rv],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?TT:rv)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+TT}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>ev],[/\\\\/g,()=>ev],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===ev?`\\[${r}${pq(n)}${i}`:i==="]"&&n.length%2===0?`[${hq(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],IT=Object.create(null),gq=(t,e)=>{let r=IT[t];return r||(r=mq.reduce((n,[i,s])=>n.replace(i,s.bind(t)),t),IT[t]=r),e?new RegExp(r,"i"):new RegExp(r)},sv=t=>typeof t=="string",yq=t=>t&&sv(t)&&!sq.test(t)&&!oq.test(t)&&t.indexOf("#")!==0,wq=t=>t.split(cq),nv=class{constructor(e,r,n,i){this.origin=e,this.pattern=r,this.negative=n,this.regex=i}},vq=(t,e)=>{let r=t,n=!1;t.indexOf("!")===0&&(n=!0,t=t.substr(1)),t=t.replace(aq,"!").replace(lq,"#");let i=gq(t,e);return new nv(r,t,n,i)},bq=(t,e)=>{throw new e(t)},cs=(t,e,r)=>sv(t)?t?cs.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),RT=t=>uq.test(t);cs.isNotRelative=RT;cs.convert=t=>t;var iv=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){fq(this,AT,!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[AT]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(yq(e)){let r=vq(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,CT(sv(e)?wq(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(s=>{let{negative:o}=s;if(i===o&&n!==i||o&&!n&&!i&&!r)return;s.regex.test(e)&&(n=!o,i=o)}),{ignored:n,unignored:i}}_test(e,r,n,i){let s=e&&cs.convert(e);return cs(s,e,this._allowRelativePaths?$T:bq),this._t(s,r,n,i)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(tv)),i.pop(),!i.length)return r[e]=this._testOne(e,n);let s=this._t(i.join(tv)+tv,r,n,i);return r[e]=s.ignored?s:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return CT(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},ap=t=>new iv(t),_q=t=>cs(t&&cs.convert(t),t,$T);ap.isPathValid=_q;ap.default=ap;OT.exports=ap;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");cs.convert=t;let e=/^[a-z]:\//i;cs.isNotRelative=r=>e.test(r)||RT(r)}});var DT=U((ose,FT)=>{"use strict";p();function xq(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pi(t,e,r){return e=e instanceof RegExp?e:new RegExp(xq(e),"g"),t.replace(e,r)}var kq={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Pi(e,"./","/"),e=Pi(e,"..","."),e=Pi(e," ","-"),e=Pi(e,/^[~^:?*\\\-]/g,""),e=Pi(e,/[~^:?*\\]/g,"-"),e=Pi(e,/[~^:?*\\\-]$/g,""),e=Pi(e,"@{","-"),e=Pi(e,/\.$/g,""),e=Pi(e,/\/$/g,""),e=Pi(e,/\.lock$/g,""),e}};FT.exports=kq});var MT=U((lse,zT)=>{p();zT.exports=function(t,e){var r=t,n=e,i=r.length,s=n.length,o=!1,a=null,l=i+1,c=[],u=[],f=[],d="",h=-1,g=0,m=1,y,v,b=function(){i>=s&&(y=r,v=i,r=n,n=y,i=s,s=v,o=!0,l=i+1)},k=function(S,C,T){return{x:S,y:C,k:T}},E=function(S,C){return{elem:S,t:C}},_=function(S,C,T){var P,R,N;for(C>T?P=c[S-1+l]:P=c[S+1+l],N=Math.max(C,T),R=N-S;R=0;--N)for(;PR-P?(o?f[f.length]=new E(n[R],h):f[f.length]=new E(n[R],m),++T,++R):S[N].y-S[N].x=S+1;--j)T[j+l]=_(j,T[j-1+l]+1,T[j+1+l]);T[S+l]=_(S,T[S-1+l]+1,T[S+1+l])}while(T[S+l]!==s);for(a=S+2*P,R=c[S+l],N=[];R!==-1;)N[N.length]=new k(u[R].x,u[R].y,null),R=u[R].k;x(N)}}}});var UT=U((use,BT)=>{p();var Sq=MT();function Eq(t,e){var r=new Sq(t,e);r.compose();for(var n=r.getses(),i,s,o=t.length-1,a=e.length-1,l=n.length-1;l>=0;--l)n[l].t===r.SES_COMMON?(s?(s.chain={file1index:o,file2index:a,chain:null},s=s.chain):(i={file1index:o,file2index:a,chain:null},s=i),o--,a--):n[l].t===r.SES_DELETE?o--:n[l].t===r.SES_ADD&&a--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,i):c}function LT(t,e){for(var r=[],n=t.length,i=e.length,s=Eq(t,e);s!==null;s=s.chain){var o=n-s.file1index-1,a=i-s.file2index-1;n=s.file1index,i=s.file2index,(o||a)&&r.push({file1:[n+1,o],file2:[i+1,a]})}return r.reverse(),r}function Cq(t,e,r){var n,i=LT(e,t),s=LT(e,r),o=[];function a(F,j){o.push([F.file1[0],j,F.file1[1],F.file2[0],F.file2[1]])}for(n=0;nc&&(l.push([1,c,F-c]),c=F)}for(var f=0;fm)break;m=Math.max(m,v+y[2]),f++}if(u(g),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=o[n];var k=h[1],E=b[k],_=h[0],x=_+h[2],S=h[3],C=S+h[4];E[0]=Math.min(S,E[0]),E[1]=Math.max(C,E[1]),E[2]=Math.min(_,E[2]),E[3]=Math.max(x,E[3])}var T=b[0][0]+(g-b[0][2]),P=b[0][1]+(m-b[0][3]),R=b[2][0]+(g-b[2][2]),N=b[2][1]+(m-b[2][3]);l.push([-1,T,P-T,g,m-g,R,N-R])}c=m}return u(e.length),l}function Tq(t,e,r){var n=[],i=[t,e,r],s=Cq(t,e,r),o=[];function a(){o.length&&n.push({ok:o}),o=[]}function l(h){for(var g=0;g{"use strict";p();Object.defineProperty(Y,"__esModule",{value:!0});function Ks(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Gu=Ks(gS()),uA=Ks(OE()),Aq=Ks(FE()),Pv=Ks(xT()),lp=Ks(ET()),Iq=Ks(NT()),Qu=Ks(DT()),Pq=Ks(UT()),Le=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}},Wu=class t extends Le{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}}};Wu.code="UnmergedPathsError";var Se=class t extends Le{constructor(e){super(`An internal error caused this command to fail. If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};Se.code="InternalError";var jl=class t extends Le{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};jl.code="UnsafeFilepathError";var zn=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 _p(t,e){return-(te)}function fA(t,e){return _p(t.path,e.path)}function dA(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 $i=2**32;function jT(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),s=(r-i*1e3)*1e6;return[i,s]}function ql(t){let[e,r]=jT(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[n,i]=jT(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%$i,ctimeNanoseconds:r%$i,mtimeSeconds:n%$i,mtimeNanoseconds:i%$i,dev:t.dev%$i,ino:t.ino%$i,mode:dA(t.mode%$i),uid:t.uid%$i,gid:t.gid%$i,size:t.size>-1?t.size%$i:0}}function $q(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var ov=null;async function fs(t){return ov===null&&(ov=await Oq()),ov?hA(t):Rq(t)}function Rq(t){return new uA().update(t).digest("hex")}async function hA(t){let e=await crypto.subtle.digest("SHA-1",t);return $q(e)}async function Oq(){try{return await hA(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}function Nq(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function Fq(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(w.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var wv=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(w.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new Se("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new Se("Index file is empty (.git/index)");let r=new t,n=new zn(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new Se(`Invalid dircache magic file number: ${i}`);let s=await fs(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new Se(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let a=n.readUInt32BE();if(a!==2)throw new Se(`Unsupported dircache version: ${a}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&ce.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid: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=ql(r);let s=w.from(e),o={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:s.length<4095?s.length:4095},stages:[]};this._addEntry(o),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=w.from(e.path),n=Math.ceil((62+r.length+1)/8)*8,i=w.alloc(n),s=new zn(i),o=ql(e);return s.writeUInt32BE(o.ctimeSeconds),s.writeUInt32BE(o.ctimeNanoseconds),s.writeUInt32BE(o.mtimeSeconds),s.writeUInt32BE(o.mtimeNanoseconds),s.writeUInt32BE(o.dev),s.writeUInt32BE(o.ino),s.writeUInt32BE(o.mode),s.writeUInt32BE(o.uid),s.writeUInt32BE(o.gid),s.writeUInt32BE(o.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(Fq(e)),s.write(e.path,r.length,"utf8"),i}async toObject(){let e=w.alloc(12),r=new zn(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let a of this.entries)if(n.push(t._entryToBuffer(a)),a.stages.length>1)for(let l of a.stages)l&&l!==a&&n.push(t._entryToBuffer(l));n=await Promise.all(n);let i=w.concat(n),s=w.concat([e,i]),o=await fs(s);return w.concat([s,w.from(o,"hex")])}};function fp(t,e,r=!0,n=!0){let i=ql(t),s=ql(e);return r&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.ctimeSeconds!==s.ctimeSeconds||i.uid!==s.uid||i.gid!==s.gid||n&&i.ino!==s.ino||i.size!==s.size}var av=null,lv=Symbol("IndexCache");function Dq(){return{map:new Map,stats:new Map}}async function zq(t,e,r){let[n,i]=await Promise.all([t.lstat(e),t.read(e)]),s=await wv.from(i);r.map.set(e,s),r.stats.set(e,n)}async function Mq(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:fp(n,i)}var kt=class{static async acquire({fs:e,gitdir:r,cache:n,allowUnmerged:i=!0},s){n[lv]||(n[lv]=Dq());let o=`${r}/index`;av===null&&(av=new Gu({maxPending:1/0}));let a,l=[];return await av.acquire(o,async()=>{let c=n[lv];await Mq(e,o,c)&&await zq(e,o,c);let u=c.map.get(o);if(l=u.unmergedPaths,l.length&&!i)throw new Wu(l);if(a=await s(u),u._dirty){let f=await u.toObject();await e.write(o,f),c.stats.set(o,await e.lstat(o)),u._dirty=!1}}),a}};function dp(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function aa(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function pA(t){let e=new Map,r=function(i){if(!e.has(i)){let s={type:"tree",fullpath:i,basename:dp(i),metadata:{},children:[]};e.set(i,s),s.parent=r(aa(i)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(i)},n=function(i,s){if(!e.has(i)){let o={type:"blob",fullpath:i,basename:dp(i),metadata:s,parent:r(aa(i)),children:[]};o.parent&&o.parent.children.push(o),e.set(i,o)}return e.get(i)};r(".");for(let i of t)n(i.path,i);return e}function Lq(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 Se(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var vv=class{constructor({fs:e,gitdir:r,cache:n}){this.treePromise=kt.acquire({fs:e,gitdir:r,cache:n},async function(s){return pA(s.entries)});let i=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,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 s=i.children.map(o=>o.fullpath);return s.sort(_p),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:ql(n.metadata);e._type=n.type==="tree"?"tree":Lq(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}},xp=Symbol("GitWalkSymbol");function fa(){let t=Object.create(null);return Object.defineProperty(t,xp,{value:function({fs:e,gitdir:r,cache:n}){return new vv({fs:e,gitdir:r,cache:n})}}),Object.freeze(t),t}var Je=class t extends Le{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Je.code="NotFoundError";var Sr=class t extends Le{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}}};Sr.code="ObjectTypeError";var qs=class t extends Le{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};qs.code="InvalidOidError";var Ku=class t extends Le{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}}};Ku.code="NoRefspecError";var hp=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 s=n.slice(1);return this.refs.set(r+"^{}",s),{line:n,ref:r,peeled:s}}else{let s=n.slice(0,i);return r=n.slice(i+1),this.refs.set(r,s),{line:n,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` `)+` `}},pp=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,s,o]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),a=r==="+",l=i==="*";if(l!==(o==="*"))throw new Se("Invalid refspec");return new t({remotePath:n,localPath:s,force:a,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}},bv=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let n of e)r.push(pp.from(n));return new t(r)}add(e){let r=pp.from(e);this.rules.push(r)}translate(e){let r=[];for(let n of this.rules)for(let i of e){let s=n.translate(i);s&&r.push([i,s])}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 Bq(t,e){let r=t.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(rn);return i===0?t.endsWith("^{}")?1:-1:i}function Uq(t,e){let r="",n=0,i=-1,s=0,o="\0";for(let a=0;a<=t.length;++a){if(a2){let l=r.lastIndexOf("/");l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=a,s=0;continue}else if(r.length!==0){r="",n=0,i=a,s=0;continue}}e&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,a):r=t.slice(i+1,a),n=a-i-1;i=a,s=0}else o==="."&&s!==-1?++s:s=-1}return r}function jq(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=Uq(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}function M(...t){if(t.length===0)return".";let e;for(let r=0;r0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":jq(e)}var qq=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},Hu=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}`)},qT={core:{filemode:Hu,bare:Hu,logallrefupdates:Hu,symlinks:Hu,ignorecase:Hu,bigFileThreshold:qq}},Vq=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,Hq=/^[A-Za-z0-9-.]+$/,Gq=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,Qq=/^[A-Za-z][A-Za-z-]*$/,Wq=/^(.*?)( *[#;].*)$/,Kq=t=>{let e=Vq.exec(t);if(e!=null){let[r,n]=e.slice(1);return[r,n]}return null},Yq=t=>{let e=Gq.exec(t);if(e!=null){let[r,n="true"]=e.slice(1),i=Zq(n),s=Jq(i);return[r,s]}return null},Zq=t=>{let e=Wq.exec(t);if(e==null)return t;let[r,n]=e.slice(1);return VT(r)&&VT(n)?`${r}${n}`:r},VT=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,Jq=t=>t.split("").reduce((e,r,n,i)=>{let s=r==='"'&&i[n-1]!=="\\",o=r==="\\"&&i[n+1]==='"';return s||o?e:e+r},""),HT=t=>t!=null?t.toLowerCase():null,_v=(t,e,r)=>[HT(t),e,HT(r)].filter(n=>n!=null).join("."),GT=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:_v(r,i,n),sectionPath:_v(r,i,null),isSection:!!r}},Xq=(t,e)=>t.reduce((r,n,i)=>e(n)?i:r,-1),xv=class t{constructor(e){let r=null,n=null;this.parsedConfig=e?e.split(` `).map(i=>{let s=null,o=null,a=i.trim(),l=Kq(a),c=l!=null;if(c)[r,n]=l;else{let f=Yq(a);f!=null&&([s,o]=f)}let u=_v(r,n,s);return{line:i,isSection:c,section:r,subsection:n,name:s,value:o,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let n=GT(e).path,i=this.parsedConfig.filter(s=>s.path===n).map(({section:s,name:o,value:a})=>{let l=qT[s]&&qT[s][o];return l?l(a):a});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:s,name:o,path:a,sectionPath:l,isSection:c}=GT(e),u=Xq(this.parsedConfig,f=>f.path===a);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:o,value:r,modified:!0});n?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:s,name:o,value:r,modified:!0,path:a};if(Hq.test(i)&&Qq.test(o))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:i,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:n,name:i,value:s,modified:o=!1})=>o?i!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${i} = "${s}"`:` ${i} = ${s}`:n!=null?`[${r} "${n}"]`:`[${r}]`:e).join(` `)}},yt=class{static async get({fs:e,gitdir:r}){let n=await e.read(`${r}/config`,{encoding:"utf8"});return xv.from(n)}static async save({fs:e,gitdir:r,config:n}){await e.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},cp=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],e6=["config","description","index","shallow","commondir"],cv;async function Us(t,e){return cv===void 0&&(cv=new Gu),cv.acquire(t,e)}var W=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:n,refs:i,symrefs:s,tags:o,refspecs:a=void 0,prune:l=!1,pruneTags:c=!1}){for(let y of i.values())if(!y.match(/[0-9a-f]{40}/))throw new qs(y);let u=await yt.get({fs:e,gitdir:r});if(!a){if(a=await u.getall(`remote.${n}.fetch`),a.length===0)throw new Ku(n);a.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=bv.from(a),d=new Map;if(c){let y=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:y.map(v=>`refs/tags/${v}`)})}if(o){for(let y of i.keys())if(y.startsWith("refs/tags")&&!y.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:y})){let v=i.get(y);d.set(y,v)}}let h=f.translate([...i.keys()]);for(let[y,v]of h){let b=i.get(y);d.set(v,b)}let g=f.translate([...s.keys()]);for(let[y,v]of g){let b=s.get(y),k=f.translateOne(b);k&&d.set(v,`ref: ${k}`)}let m=[];if(l){for(let y of f.localNamespaces()){let v=(await t.listRefs({fs:e,gitdir:r,filepath:y})).map(b=>`${y}/${b}`);for(let b of v)d.has(b)||m.push(b)}m.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:m})}for(let[y,v]of d)await Us(y,async()=>e.write(M(r,y),`${v.trim()} `,"utf8"));return{pruned:m}}static async writeRef({fs:e,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new qs(i);await Us(n,async()=>e.write(M(r,n),`${i.trim()} `,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:n,value:i}){await Us(n,async()=>e.write(M(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(a=>e.rm(M(r,a))));let i=await Us("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=hp.from(i),o=s.refs.size;for(let a of n)s.refs.has(a)&&s.delete(a);s.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 s=await t.packedRefs({fs:e,gitdir:r}),o=cp(n).filter(a=>!e6.includes(a));for(let a of o){let l=await Us(a,async()=>await e.read(`${r}/${a}`,{encoding:"utf8"})||s.get(a));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:i})}throw new Je(n)}static async exists({fs:e,gitdir:r,ref:n}){try{return await t.expand({fs:e,gitdir:r,ref:n}),!0}catch{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}),s=cp(n);for(let o of s)if(await Us(o,async()=>e.exists(`${r}/${o}`))||i.has(o))return o;throw new Je(n)}static async expandAgainstMap({ref:e,map:r}){let n=cp(e);for(let i of n)if(await r.has(i))return i;throw new Je(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 s=cp(e);for(let o of s){let a=i.get(o);if(a)return t.resolveAgainstMap({ref:a.trim(),fullref:o,depth:n,map:i})}throw new Je(e)}static async packedRefs({fs:e,gitdir:r}){let n=await Us("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return hp.from(n).refs}static async listRefs({fs:e,gitdir:r,filepath:n}){let i=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${n}`),s=s.map(o=>o.replace(`${r}/${n}/`,""))}catch{s=[]}for(let o of(await i).keys())o.startsWith(n)&&(o=o.replace(n+"/",""),s.includes(o)||s.push(o));return s.sort(Bq),s}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 t6(t,e){return _p(QT(t),QT(e))}function QT(t){return t.mode==="040000"?t.path+"/":t.path}function mA(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 Se(`Unexpected GitTree entry mode: ${t}`)}function r6(t){let e=[],r=0;for(;r`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` `)}toObject(){let e=[...this._entries];return e.sort(t6),w.concat(e.map(r=>{let n=w.from(r.mode.replace(/^0/,"")),i=w.from(" "),s=w.from(r.path,"utf8"),o=w.from([0]),a=w.from(r.oid,"hex");return w.concat([n,i,s,o,a])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Vs=class{static wrap({type:e,object:r}){let n=`${e} ${r.length}\0`,i=n.length,s=i+r.length,o=new Uint8Array(s);for(let a=0;a>=1,i+=8;return n}function YT(t,e){let r=t.readUInt8(),n=128,i=15,s=112;if(r&n){let o=KT(t,r&i,4),a=KT(t,(r&s)>>4,3);return a===0&&(a=65536),e.slice(o,o+a)}else return t.slice(r)}function o6(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function yA(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:o6(t)}var mp=class{constructor(e){if(typeof w>"u")throw new Error("Missing Buffer dependency");this.stream=yA(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)?w.alloc(0):(r&&(r=w.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>a6(r);){let n=await this._next();if(this._ended)break;r.push(n)}this.buffer=w.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 a6(t){return t.reduce((e,r)=>e+r.length,0)}async function l6(t,e){let r=new mp(t),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new Se(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new Se(`Invalid packfile version: ${i}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let o=r.tell(),{type:a,length:l,ofs:c,reference:u}=await c6(r),f=new Pv.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new Se(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new Se("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:a,num:s,offset:o,end:h,reference:u,ofs:c})}}}}async function c6(t){let e=await t.byte(),r=e>>4&7,n=e&15;if(e&128){let o=4;do e=await t.byte(),n|=(e&127)<i+1<<7|s,-1)}function h6(t,e){let r=e,n=4,i=null;do i=t.readUInt8(),r|=(i&127)<2048*1024*1024)throw new Se("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 o=n.readUInt32BE(),a=[];for(let u=0;u{u===null&&(u=E);let _=Math.floor((u-E)*100/u);_!==f&&n&&await n({phase:"Receiving objects",loaded:u-E,total:u}),f=_,v=i[v],["commit","tree","blob","tag"].includes(v)?s[k]={type:v,offset:k}:v==="ofs-delta"?s[k]={type:v,offset:k}:v==="ref-delta"&&(s[k]={type:v,offset:k})});let d=Object.keys(s).map(Number);for(let[y,v]of d.entries()){let b=y+1===d.length?e.byteLength-20:d[y+1],k=s[v],E=Aq.buf(e.slice(v,b))>>>0;k.end=b,k.crc=E}let h=new t({pack:Promise.resolve(e),packfileSha:o,crcs:l,hashes:a,offsets:c,getExternalRefDelta:r});f=null;let g=0,m=[0,0,0,0,0,0,0,0,0,0,0,0];for(let y in s){y=Number(y);let v=Math.floor(g*100/u);v!==f&&n&&await n({phase:"Resolving deltas",loaded:g,total:u}),g++,f=v;let b=s[y];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:k,object:E}=await h.readSlice({start:y});m[h.readDepth]+=1;let _=await fs(Vs.wrap({type:k,object:E}));b.oid=_,a.push(_),c.set(_,y),l[_]=b.crc}catch{continue}}return a.sort(),h}async toBuffer(){let e=[],r=(c,u)=>{e.push(w.from(c,u))};r("ff744f63","hex"),r("00000002","hex");let n=new zn(w.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=c&&u++;n.writeUInt32BE(u)}e.push(n.buffer);for(let c of this.hashes)r(c,"hex");let i=new zn(w.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);e.push(i.buffer);let s=new zn(w.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),r(this.packfileSha,"hex");let o=w.concat(e),a=await fs(o),l=w.alloc(20);return l.write(a,"hex"),w.concat([o,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 Se(`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 Se("Tried to read from a GitPackIndex with no packfile loaded into memory");let n=(await this.pack).slice(e),i=new zn(n),s=i.readUInt8(),o=s&112,a=r[o];if(a===void 0)throw new Se("Unrecognized type: 0b"+o.toString(2));let l=s&15,c=l;s&128&&(c=h6(i,l));let f=null,d=null;if(a==="ofs_delta"){let g=d6(i),m=e-g;({object:f,type:a}=await this.readSlice({start:m}))}if(a==="ref_delta"){let g=i.slice(20).toString("hex");({object:f,type:a}=await this.read({oid:g}))}let h=n.slice(i.tell());if(d=w.from(await wA(h)),d.byteLength!==c)throw new Se(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return f&&(d=w.from(s6(d,f))),this.readDepth>3&&(this.offsetCache[e]={type:a,object:d}),{type:a,format:"content",object:d}}},up=Symbol("PackfileCache");async function p6({fs:t,filename:e,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){let s=await t.read(e);return Yu.fromIdx({idx:s,getExternalRefDelta:r})}function $v({fs:t,cache:e,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:s}){e[up]||(e[up]=new Map);let o=e[up].get(r);return o||(o=p6({fs:t,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:s}),e[up].set(r,o)),o}async function m6({fs:t,cache:e,gitdir:r,oid:n,format:i="content",getExternalRefDelta:s}){let o=await t.readdir(M(r,"objects/pack"));o=o.filter(a=>a.endsWith(".idx"));for(let a of o){let l=`${r}/objects/pack/${a}`,c=await $v({fs:t,cache:e,filename:l,getExternalRefDelta:s});if(c.error)throw new Se(c.error);if(c.offsets.has(n)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=t.read(f)}let u=await c.read({oid:n,getExternalRefDelta:s});return u.format="content",u.source=`objects/pack/${a.replace(/idx$/,"pack")}`,u}}return null}async function st({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let s=u=>st({fs:t,cache:e,gitdir:r,oid:u}),o;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(o={format:"wrapped",object:w.from("tree 0\0")}),o||(o=await gA({fs:t,gitdir:r,oid:n})),!o){if(o=await m6({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:s}),!o)throw new Je(n);return o}if(i==="deflated"||(o.format==="deflated"&&(o.object=w.from(await wA(o.object)),o.format="wrapped"),i==="wrapped"))return o;let a=await fs(o.object);if(a!==n)throw new Se(`SHA check failed! Expected ${n}, computed ${a}`);let{object:l,type:c}=Vs.unwrap(o.object);if(o.type=c,o.object=l,o.format="content",i==="content")return o;throw new Se(`invalid requested format "${i}"`)}var ri=class t extends Le{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}}};ri.code="AlreadyExistsError";var Zu=class t extends Le{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}}};Zu.code="AmbiguousError";var Ju=class t extends Le{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}}};Ju.code="CheckoutConflictError";var Xu=class t extends Le{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}}};Xu.code="CommitNotFetchedError";var ef=class t extends Le{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};ef.code="EmptyServerResponseError";var tf=class t extends Le{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};tf.code="FastForwardError";var rf=class t extends Le{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};rf.code="GitPushError";var Vl=class t extends Le{constructor(e,r,n){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:n}}};Vl.code="HttpError";var Hs=class t extends Le{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}}};Hs.code="InvalidFilepathError";var ni=class t extends Le{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}}};ni.code="InvalidRefNameError";var nf=class t extends Le{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};nf.code="MaxDepthError";var Hl=class t extends Le{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Hl.code="MergeNotSupportedError";var Gl=class t extends Le{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}}};Gl.code="MergeConflictError";var lr=class t extends Le{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}}};lr.code="MissingNameError";var Mr=class t extends Le{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Mr.code="MissingParameterError";var sf=class t extends Le{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}};sf.code="MultipleGitError";var la=class t extends Le{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};la.code="ParseError";var Ql=class t extends Le{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}}};Ql.code="PushRejectedError";var js=class t extends Le{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}}};js.code="RemoteCapabilityError";var of=class t extends Le{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}}};of.code="SmartHttpError";var af=class t extends Le{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}}};af.code="UnknownTransportError";var lf=class t extends Le{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};lf.code="UrlParseError";var Wl=class t extends Le{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Wl.code="UserCanceledError";var cf=class t extends Le{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}}};cf.code="IndexResetError";var uf=class t extends Le{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}}};uf.code="NoCommitError";var vA=Object.freeze({__proto__:null,AlreadyExistsError:ri,AmbiguousError:Zu,CheckoutConflictError:Ju,CommitNotFetchedError:Xu,EmptyServerResponseError:ef,FastForwardError:tf,GitPushError:rf,HttpError:Vl,InternalError:Se,InvalidFilepathError:Hs,InvalidOidError:qs,InvalidRefNameError:ni,MaxDepthError:nf,MergeNotSupportedError:Hl,MergeConflictError:Gl,MissingNameError:lr,MissingParameterError:Mr,MultipleGitError:sf,NoRefspecError:Ku,NotFoundError:Je,ObjectTypeError:Sr,ParseError:la,PushRejectedError:Ql,RemoteCapabilityError:js,SmartHttpError:of,UnknownTransportError:af,UnsafeFilepathError:jl,UrlParseError:lf,UserCanceledError:Wl,UnmergedPathsError:Wu,IndexResetError:cf,NoCommitError:uf});function kv({name:t,email:e,timestamp:r,timezoneOffset:n}){return n=g6(n),`${t} <${e}> ${r} ${n}`}function g6(t){let e=y6(w6(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 y6(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function w6(t){return t===0?t:-t}function us(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` `,t}function gp(t){let[,e,r,n,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(n),timezoneOffset:v6(i)}}function v6(t){let[,e,r,n]=t.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(r)*60+Number(n)),b6(n)}function b6(t){return t===0?t:-t}var ln=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(w.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new Se("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 ${kv(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 s=i.slice(0,i.indexOf(" ")),o=i.slice(i.indexOf(" ")+1);Array.isArray(n[s])?n[s].push(o):n[s]=o}return n.tagger&&(n.tagger=gp(n.tagger)),n.committer&&(n.committer=gp(n.committer)),n}withoutSignature(){let e=us(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 us(e)}payload(){return this.withoutSignature()+` `}toObject(){return w.from(this._tag,"utf8")}static async sign(e,r,n){let i=e.payload(),{signature:s}=await r({payload:i,secretKey:n});s=us(s);let o=i+s;return t.from(o)}};function fv(t){return t.trim().split(` `).map(e=>" "+e).join(` `)+` `}function _6(t){return t.split(` `).map(e=>e.replace(/^ /,"")).join(` `)}var Br=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(w.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new Se("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let n=t.justHeaders(e),i=t.justMessage(e),s=us(n+` gpgsig`+fv(r)+` `+i);return new t(s)}static from(e){return new t(e)}toObject(){return w.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 us(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 s=i.slice(0,i.indexOf(" ")),o=i.slice(i.indexOf(" ")+1);Array.isArray(n[s])?n[s].push(o):n[s]=o}return n.author&&(n.author=gp(n.author)),n.committer&&(n.committer=gp(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 Se("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s} `}let n=e.author;r+=`author ${kv(n)} `;let i=e.committer||e.author;return r+=`committer ${kv(i)} `,e.gpgsig&&(r+="gpgsig"+fv(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+` `+us(e.message)}render(){return this._commit}withoutSignature(){let e=us(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 us(r+` `+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return _6(e)}static async sign(e,r,n){let i=e.withoutSignature(),s=t.justMessage(e._commit),{signature:o}=await r({payload:i,secretKey:n});o=us(o);let l=t.justHeaders(e._commit)+` gpgsig`+fv(o)+` `+s;return t.from(l)}};async function Kl({fs:t,cache:e,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Lr.from([]),oid:n};let{type:i,object:s}=await st({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=ln.from(s).parse().object,Kl({fs:t,cache:e,gitdir:r,oid:n});if(i==="commit")return n=Br.from(s).parse().tree,Kl({fs:t,cache:e,gitdir:r,oid:n});if(i!=="tree")throw new Sr(n,i,"tree");return{tree:Lr.from(s),oid:n}}var Sv=class{constructor({fs:e,gitdir:r,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let o=new Map,a;try{a=await W.resolve({fs:e,gitdir:r,ref:n})}catch(c){c instanceof Je&&(a="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Kl({fs:e,cache:this.cache,gitdir:r,oid:a});return l.type="tree",l.mode="40000",o.set(".",l),o})();let s=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:n,cache:i,gitdir:s}=this,o=await this.mapPromise,a=o.get(r);if(!a)throw new Error(`No obj for ${r}`);let l=a.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(a)}`);if(a.type!=="tree")return null;let{type:c,object:u}=await st({fs:n,cache:i,gitdir:s,oid:l});if(c!==a.type)throw new Sr(l,c,a.type);let f=Lr.from(u);for(let d of f)o.set(M(r,d.path),d);return f.entries().map(d=>M(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=dA(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:s}=this,a=r.get(e._fullpath).oid,{type:l,object:c}=await st({fs:n,cache:i,gitdir:s,oid:a});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function an({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,xp,{value:function({fs:r,gitdir:n,cache:i}){return new Sv({fs:r,gitdir:n,ref:t,cache:i})}}),Object.freeze(e),e}var Ev=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 s=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:n,dir:i}=this,s=await n.readdir(M(i,r));return s===null?null:s.map(o=>M(r,o))}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 s=i.isDirectory()?"tree":"blob";s==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(s="special"),e._type=s,i=ql(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 o=await(await this._getGitConfig(r,i)).get("core.autocrlf"),a=await r.read(`${n}/${e._fullpath}`,{autocrlf:o});e._actualSize=a.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(a)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:n,gitdir:i,cache:s}=this,o;await kt.acquire({fs:n,gitdir:i,cache:s},async function(a){let l=a.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(n,i)).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;if(!l||fp(c,l,f,d)){let h=await e.content();h===void 0?o=void 0:(o=await fs(Vs.wrap({type:"blob",object:h})),l&&o===l.oid&&(!f||c.mode===l.mode)&&fp(c,l,f,d)&&a.insert({filepath:e._fullpath,stats:c,oid:o}))}else o=l.oid}),e._oid=o}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await yt.get({fs:e,gitdir:r}),this.config)}};function tc(){let t=Object.create(null);return Object.defineProperty(t,xp,{value:function({fs:e,dir:r,gitdir:n,cache:i}){return new Ev({fs:e,dir:r,gitdir:n,cache:i})}}),Object.freeze(t),t}function x6(t,e){let r=e-t;return Array.from({length:r},(n,i)=>t+i)}var bA=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Cv=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:o=async(l,c)=>{let u=bA(c);return l!==void 0&&u.unshift(l),u},iterate:a=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(h=>h[xp]({fs:t,dir:r,gitdir:n,cache:e})),c=new Array(l.length).fill("."),u=x6(0,l.length),f=async h=>{u.forEach(y=>{let v=h[y];h[y]=v&&new l[y].ConstructEntry(v)});let m=(await Promise.all(u.map(y=>{let v=h[y];return v?l[y].readdir(v):[]}))).map(y=>(y===null?[]:y)[Symbol.iterator]());return{entries:h,children:k6(m)}},d=async h=>{let{entries:g,children:m}=await f(h),y=g.find(b=>b&&b._fullpath)._fullpath,v=await s(y,g);if(v!==null){let b=await a(d,m);return b=b.filter(k=>k!==void 0),o(v,b)}};return d(c)}async function Tv(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(n=>{let i=M(e,n);return t.lstat(i).then(s=>{if(s)return s.isDirectory()?Tv(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function S6(t){return E6(t)&&ZT(t.then)&&ZT(t.catch)}function E6(t){return t&&typeof t=="object"}function ZT(t){return typeof t=="function"}function JT(t){return S6((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(t))}var XT=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function eA(t,e){if(JT(e))for(let r of XT)t[`_${r}`]=e[r].bind(e);else for(let r of XT)t[`_${r}`]=lp(e[r].bind(e));JT(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Tv.bind(null,t)):(e.cp&&(t._cp=lp(e.cp.bind(e))),e.rm?t._rm=lp(e.rm.bind(e)):e.rmdir.length>2?t._rm=lp(e.rmdir.bind(e)):t._rm=Tv.bind(null,t))}var ee=class{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?eA(this,e.promises):eA(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 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{}return typeof n!="string"&&(n=w.from(n)),n}catch{return null}}async write(e,r,n={}){try{await this._writeFile(e,r,n)}catch{await this.mkdir(aa(e)),await this._writeFile(e,r,n)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){let i=aa(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(_p),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 s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(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 w.isBuffer(n)?n:w.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 $(t,e){if(e===void 0)throw new Mr(t)}async function oe({fsp:t,dotgit:e}){$("fsp",t),$("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(n=>n.trimRight().substr(8)).then(n=>M(aa(e),n)):e}async function yp(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 _A({fs:t,dir:e,gitdir:r=M(e,".git"),commit:n="HEAD",cache:i={}}){try{$("fs",t),$("dir",e),$("gitdir",r);let s=new ee(t),o=[an({ref:n}),tc(),fa()],a=[],l=await oe({fsp:s,dotgit:r});await kt.acquire({fs:s,gitdir:l,cache:i},async function(u){a=u.unmergedPaths});let c=await Gs({fs:s,cache:i,dir:e,gitdir:l,trees:o,map:async function(u,[f,d,h]){let g=!await yp(d,h),m=a.includes(u),y=!await yp(h,f);if(g||m)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(y)return!1;throw new cf(u)}});await kt.acquire({fs:s,gitdir:l,cache:i},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Qs=class{static async isIgnored({fs:e,dir:r,gitdir:n=M(r,".git"),filepath:i}){if(dp(i)===".git")return!0;if(i===".")return!1;let s="",o=M(n,"info","exclude");await e.exists(o)&&(s=await e.read(o,"utf8"));let a=[{gitignore:M(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u{let f=await(await yt.get({fs:a,gitdir:l})).get("core.autocrlf");return Av({dir:e,gitdir:l,fs:a,filepath:n,index:c,force:s,parallel:o,autocrlf:f})})}catch(a){throw a.caller="git.add",a}}async function Av({dir:t,gitdir:e,fs:r,filepath:n,index:i,force:s,parallel:o,autocrlf:a}){n=Array.isArray(n)?n:[n];let l=n.map(async d=>{if(!s&&await Qs.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(M(t,d));if(!h)throw new Je(d);if(h.isDirectory()){let g=await r.readdir(M(t,d));if(o){let m=g.map(y=>Av({dir:t,gitdir:e,fs:r,filepath:[M(d,y)],index:i,force:s,parallel:o,autocrlf:a}));await Promise.all(m)}else for(let m of g)await Av({dir:t,gitdir:e,fs:r,filepath:[M(d,m)],index:i,force:s,parallel:o,autocrlf:a})}else{let g=h.isSymbolicLink()?await r.readlink(M(t,d)).then(kA):await r.read(M(t,d),{autocrlf:a});if(g===null)throw new Je(d);let m=await Ur({fs:r,gitdir:e,type:"blob",object:g});i.insert({filepath:d,stats:h,oid:m})}}),c=await Promise.allSettled(l),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new sf(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function ff({fs:t,gitdir:e,path:r}){return(await yt.get({fs:t,gitdir:e})).get(r)}function EA(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 Ws({fs:t,gitdir:e,author:r,commit:n}){let i=Math.floor(Date.now()/1e3),s={name:await ff({fs:t,gitdir:e,path:"user.name"}),email:await ff({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},o=EA({},s,n?n.author:void 0,r);if(o.name!==void 0)return o}async function Yl({fs:t,gitdir:e,author:r,committer:n,commit:i}){let s=Math.floor(Date.now()/1e3),o={name:await ff({fs:t,gitdir:e,path:"user.name"}),email:await ff({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},a=EA({},o,i?i.committer:void 0,r,n);if(a.name!==void 0)return a}async function CA({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:s}=await st({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=ln.from(s).parse().object,CA({fs:t,cache:e,gitdir:r,oid:n});if(i!=="commit")throw new Sr(n,i,"commit");return{commit:Br.from(s),oid:n}}async function Zl({fs:t,cache:e,gitdir:r,oid:n}){let{commit:i,oid:s}=await CA({fs:t,cache:e,gitdir:r,oid:n});return{oid:s,commit:i.parse(),payload:i.withoutSignature()}}async function kp({fs:t,cache:e,onSign:r,gitdir:n,message:i,author:s,committer:o,signingKey:a,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h}){let g=!1;f||(f=await W.resolve({fs:t,gitdir:n,ref:"HEAD",depth:2}));let m,y;try{m=await W.resolve({fs:t,gitdir:n,ref:f}),y=await Zl({fs:t,gitdir:n,oid:m,cache:{}})}catch{g=!0}if(l&&g)throw new uf(f);let v=l?await Ws({fs:t,gitdir:n,author:s,commit:y.commit}):await Ws({fs:t,gitdir:n,author:s});if(!v)throw new lr("author");let b=l?await Yl({fs:t,gitdir:n,author:v,committer:o,commit:y.commit}):await Yl({fs:t,gitdir:n,author:v,committer:o});if(!b)throw new lr("committer");return kt.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async function(k){let _=pA(k.entries).get(".");if(h||(h=await TA({fs:t,gitdir:n,inode:_,dryRun:c})),d?d=await Promise.all(d.map(C=>W.resolve({fs:t,gitdir:n,ref:C}))):l?d=y.commit.parent:d=m?[m]:[],!i)if(l)i=y.commit.message;else throw new Mr("message");let x=Br.from({tree:h,parent:d,author:v,committer:b,message:i});a&&(x=await Br.sign(x,r,a));let S=await Ur({fs:t,gitdir:n,type:"commit",object:x.toObject(),dryRun:c});return!u&&!c&&await W.writeRef({fs:t,gitdir:n,ref:f,value:S}),S})}async function TA({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 TA({fs:t,gitdir:e,inode:l,dryRun:n}));let s=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),o=Lr.from(s);return await Ur({fs:t,gitdir:e,type:"tree",object:o.toObject(),dryRun:n})}async function hf({fs:t,cache:e,gitdir:r,oid:n,filepath:i}){if(i.startsWith("/"))throw new Hs("leading-slash");if(i.endsWith("/"))throw new Hs("trailing-slash");let s=n,o=await Kl({fs:t,cache:e,gitdir:r,oid:n}),a=o.tree;if(i==="")n=o.oid;else{let l=i.split("/");n=await AA({fs:t,cache:e,gitdir:r,tree:a,pathArray:l,oid:s,filepath:i})}return n}async function AA({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:s,filepath:o}){let a=i.shift();for(let l of n)if(l.path===a){if(i.length===0)return l.oid;{let{type:c,object:u}=await st({fs:t,cache:e,gitdir:r,oid:l.oid});if(c!=="tree")throw new Sr(s,c,"tree",o);return n=Lr.from(u),AA({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:s,filepath:o})}}throw new Je(`file or directory found at "${s}:${o}"`)}async function rc({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){i!==void 0&&(n=await hf({fs:t,cache:e,gitdir:r,oid:n,filepath:i}));let{tree:s,oid:o}=await Kl({fs:t,cache:e,gitdir:r,oid:n});return{oid:o,tree:s.entries()}}async function pf({fs:t,gitdir:e,tree:r}){let n=Lr.from(r).toObject();return await Ur({fs:t,gitdir:e,type:"tree",object:n,format:"content"})}async function I6({fs:t,cache:e,onSign:r,gitdir:n,ref:i,oid:s,note:o,force:a,author:l,committer:c,signingKey:u}){let f;try{f=await W.resolve({gitdir:n,fs:t,ref:i})}catch(v){if(!(v instanceof Je))throw v}let h=(await rc({fs:t,cache:e,gitdir:n,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(a)h=h.filter(v=>v.path!==s);else for(let v of h)if(v.path===s)throw new ri("note",s);typeof o=="string"&&(o=w.from(o,"utf8"));let g=await Ur({fs:t,gitdir:n,type:"blob",object:o,format:"content"});h.push({mode:"100644",path:s,oid:g,type:"blob"});let m=await pf({fs:t,gitdir:n,tree:h});return await kp({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:m,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' `,author:l,committer:c,signingKey:u})}async function IA({fs:t,onSign:e,dir:r,gitdir:n=M(r,".git"),ref:i="refs/notes/commits",oid:s,note:o,force:a,author:l,committer:c,signingKey:u,cache:f={}}){try{$("fs",t),$("gitdir",n),$("oid",s),$("note",o),u&&$("onSign",e);let d=new ee(t),h=await Ws({fs:d,gitdir:n,author:l});if(!h)throw new lr("author");let g=await Yl({fs:d,gitdir:n,author:h,committer:c});if(!g)throw new lr("committer");let m=await oe({fsp:d,dotgit:n});return await I6({fs:d,cache:f,onSign:e,gitdir:m,ref:i,oid:s,note:o,force:a,author:h,committer:g,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var P6=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function df(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!P6.test(t)&&(!!e||t.includes("/"))}async function PA({fs:t,gitdir:e,remote:r,url:n,force:i}){if(!df(r,!0))throw new ni(r,Qu.clean(r));let s=await yt.get({fs:t,gitdir:e});if(!i&&(await s.getSubsections("remote")).includes(r)&&n!==await s.get(`remote.${r}.url`))throw new ri("remote",r);await s.set(`remote.${r}.url`,n),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await yt.save({fs:t,gitdir:e,config:s})}async function $A({fs:t,dir:e,gitdir:r=M(e,".git"),remote:n,url:i,force:s=!1}){try{$("fs",t),$("gitdir",r),$("remote",n),$("url",i);let o=new ee(t),a=await oe({fsp:o,dotgit:r});return await PA({fs:o,gitdir:a,remote:n,url:i,force:s})}catch(o){throw o.caller="git.addRemote",o}}async function $6({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await W.exists({fs:t,gitdir:n,ref:i}))throw new ri("tag",i);let f=await W.resolve({fs:t,gitdir:n,ref:l||"HEAD"}),{type:d}=await st({fs:t,cache:e,gitdir:n,oid:f}),h=ln.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:s,message:o,gpgsig:a});c&&(h=await ln.sign(h,r,c));let g=await Ur({fs:t,gitdir:n,type:"tag",object:h.toObject()});await W.writeRef({fs:t,gitdir:n,ref:i,value:g})}async function RA({fs:t,onSign:e,dir:r,gitdir:n=M(r,".git"),ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1,cache:f={}}){try{$("fs",t),$("gitdir",n),$("ref",i),c&&$("onSign",e);let d=new ee(t),h=await oe({fsp:d,dotgit:n}),g=await Ws({fs:d,gitdir:h,author:s});if(!g)throw new lr("tagger");return await $6({fs:d,cache:f,onSign:e,gitdir:h,ref:i,tagger:g,message:o,gpgsig:a,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function R6({fs:t,gitdir:e,ref:r,object:n,checkout:i=!1,force:s=!1}){if(!df(r,!0))throw new ni(r,Qu.clean(r));let o=`refs/heads/${r}`;if(!s&&await W.exists({fs:t,gitdir:e,ref:o}))throw new ri("branch",r,!1);let a;try{a=await W.resolve({fs:t,gitdir:e,ref:n||"HEAD"})}catch{}a&&await W.writeRef({fs:t,gitdir:e,ref:o,value:a}),i&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}async function OA({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n,object:i,checkout:s=!1,force:o=!1}){try{$("fs",t),$("gitdir",r),$("ref",n);let a=new ee(t),l=await oe({fsp:a,dotgit:r});return await R6({fs:a,gitdir:l,ref:n,object:i,checkout:s,force:o})}catch(a){throw a.caller="git.branch",a}}var NA=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Rv({fs:t,cache:e,onProgress:r,onPostCheckout:n,dir:i,gitdir:s,remote:o,ref:a,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:g=!1,batchSize:m=100}){let y;if(n)try{y=await W.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch{y="0000000000000000000000000000000000000000"}let v;try{v=await W.resolve({fs:t,gitdir:s,ref:a})}catch(b){if(a==="HEAD")throw b;let k=`${o}/${a}`;if(v=await W.resolve({fs:t,gitdir:s,ref:k}),h){let E=await yt.get({fs:t,gitdir:s});await E.set(`branch.${a}.remote`,o),await E.set(`branch.${a}.merge`,`refs/heads/${a}`),await yt.save({fs:t,gitdir:s,config:E})}await W.writeRef({fs:t,gitdir:s,ref:`refs/heads/${a}`,value:v})}if(!c){let b;try{b=await O6({fs:t,cache:e,onProgress:r,dir:i,gitdir:s,ref:a,force:d,filepaths:l})}catch(S){throw S instanceof Je&&S.data.what===v?new Xu(a,v):S}let k=b.filter(([S])=>S==="conflict").map(([S,C])=>C);if(k.length>0)throw new Ju(k);let E=b.filter(([S])=>S==="error").map(([S,C])=>C);if(E.length>0)throw new Se(E.join(", "));if(f){n&&await n({previousHead:y,newHead:v,type:l!=null&&l.length>0?"file":"branch"});return}let _=0,x=b.length;if(await kt.acquire({fs:t,gitdir:s,cache:e},async function(S){await Promise.all(b.filter(([C])=>C==="delete"||C==="delete-index").map(async function([C,T]){let P=`${i}/${T}`;C==="delete"&&await t.rm(P),S.delete({filepath:T}),r&&await r({phase:"Updating workdir",loaded:++_,total:x})}))}),await kt.acquire({fs:t,gitdir:s,cache:e},async function(S){for(let[C,T]of b)if(C==="rmdir"||C==="rmdir-index"){let P=`${i}/${T}`;try{C==="rmdir"&&await t.rmdir(P),S.delete({filepath:T}),r&&await r({phase:"Updating workdir",loaded:++_,total:x})}catch(R){if(R.code!=="ENOTEMPTY")throw R}}}),await Promise.all(b.filter(([S])=>S==="mkdir"||S==="mkdir-index").map(async function([S,C]){let T=`${i}/${C}`;await t.mkdir(T),r&&await r({phase:"Updating workdir",loaded:++_,total:x})})),g){let S=b.filter(([T])=>T==="create"||T==="create-index"||T==="update"||T==="mkdir-index"),C=await tA("Update Working Dir",S.map(([T,P,R,N,F])=>()=>F6({fs:t,cache:e,gitdir:s,dir:i},[T,P,R,N,F])),r,m);await kt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(T){await tA("Update Index",C.map(([P,R,N])=>()=>N6({index:T,fullpath:P,oid:R,stats:N})),r,m)})}else await kt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(S){await Promise.all(b.filter(([C])=>C==="create"||C==="create-index"||C==="update"||C==="mkdir-index").map(async function([C,T,P,R,N]){let F=`${i}/${T}`;try{if(C!=="create-index"&&C!=="mkdir-index"){let{object:Q}=await st({fs:t,cache:e,gitdir:s,oid:P});if(N&&await t.rm(F),R===33188)await t.write(F,Q);else if(R===33261)await t.write(F,Q,{mode:511});else if(R===40960)await t.writelink(F,Q);else throw new Se(`Invalid mode 0o${R.toString(8)} detected in blob ${P}`)}let j=await t.lstat(F);R===33261&&(j.mode=493),C==="mkdir-index"&&(j.mode=57344),S.insert({filepath:T,stats:j,oid:P}),r&&await r({phase:"Updating workdir",loaded:++_,total:x})}catch{}}))});n&&await n({previousHead:y,newHead:v,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let b=await W.expand({fs:t,gitdir:s,ref:a});b.startsWith("refs/heads")?await W.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:b}):await W.writeRef({fs:t,gitdir:s,ref:"HEAD",value:v})}}async function O6({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,ref:s,force:o,filepaths:a}){let l=0;return Gs({fs:t,cache:e,dir:n,gitdir:i,trees:[an({ref:s}),tc(),fa()],map:async function(c,[u,f,d]){if(c===".")return;if(a&&!a.some(g=>NA(c,g)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!d,!!u,!!f].map(Number).join("")){case"000":return;case"001":return o&&a&&a.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await f.oid()?o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?o?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir-index",c];case"blob":return await d.oid()!==await f.oid()?o?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!o)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(o)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=bA(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function N6({index:t,fullpath:e,stats:r,oid:n}){try{t.insert({filepath:e,stats:r,oid:n})}catch{}}async function F6({fs:t,cache:e,gitdir:r,dir:n},[i,s,o,a,l]){let c=`${n}/${s}`;if(i!=="create-index"&&i!=="mkdir-index"){let{object:f}=await st({fs:t,cache:e,gitdir:r,oid:o});if(l&&await t.rm(c),a===33188)await t.write(c,f);else if(a===33261)await t.write(c,f,{mode:511});else if(a===40960)await t.writelink(c,f);else throw new Se(`Invalid mode 0o${a.toString(8)} detected in blob ${o}`)}let u=await t.lstat(c);return a===33261&&(u.mode=493),i==="mkdir-index"&&(u.mode=57344),[s,o,u]}async function tA(t,e,r,n){let i=[];try{for(let s=0;sl());(await Promise.allSettled(o)).forEach(l=>{l.status==="fulfilled"&&i.push(l.value)}),r&&await r({phase:"Updating workdir",loaded:s+o.length,total:e.length})}return i}catch{}return i}async function Ov({fs:t,onProgress:e,onPostCheckout:r,dir:n,gitdir:i=M(n,".git"),remote:s="origin",ref:o,filepaths:a,noCheckout:l=!1,noUpdateHead:c=o===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:g=!1,batchSize:m=100}){try{$("fs",t),$("dir",n),$("gitdir",i);let y=o||"HEAD",v=new ee(t),b=await oe({fsp:v,dotgit:i});return await Rv({fs:v,cache:h,onProgress:e,onPostCheckout:r,dir:n,gitdir:b,remote:s,ref:y,filepaths:a,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d,nonBlocking:g,batchSize:m})}catch(y){throw y.caller="git.checkout",y}}var D6=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function oa(t){let e=D6.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function Ys({fs:t,gitdir:e,fullname:r=!1,test:n=!1}){let i=await W.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(n)try{await W.resolve({fs:t,gitdir:e,ref:i})}catch{return}if(i.startsWith("refs/"))return r?i:oa(i)}function z6(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function FA({username:t="",password:e=""}){return`Basic ${w.from(`${t}:${e}`).toString("base64")}`}async function mf(t,e){let r=yA(t);for(;;){let{value:n,done:i}=await r.next();if(n&&await e(n),i)break}r.return&&r.return()}async function wp(t){let e=0,r=[];await mf(t,s=>{r.push(s),e+=s.byteLength});let n=new Uint8Array(e),i=0;for(let s of r)n.set(s,i),i+=s.byteLength;return n}function rA(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 Iv(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var pt=class{static flush(){return w.from("0000","utf8")}static delim(){return w.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=w.from(e));let r=e.length+4,n=Iv(4,r);return w.concat([w.from(n,"utf8"),e])}static streamReader(e){let r=new mp(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 s=await r.read(i-4);return s??!0}catch(i){return e.error=i,!0}}}};async function nA(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),s=r.slice(n+1);e[i]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function iA(t,{service:e}){let r=new Set,n=new Map,i=new Map,s=pt.streamReader(t),o=await s();for(;o===null;)o=await s();if(o===!0)throw new ef;if(o.includes("version 2"))return nA(s);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new la(`# service=${e}\\n`,o.toString("utf8"));let a=await s();for(;a===null;)a=await s();if(a===!0)return{capabilities:r,refs:n,symrefs:i};if(a=a.toString("utf8"),a.includes("version 2"))return nA(s);let[l,c]=hv(a,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=hv(l," "," ");for(n.set(f,u);;){let d=await s();if(d===!0)break;if(d!==null){let[h,g]=hv(d.toString("utf8")," "," ");n.set(g,h)}}}for(let u of r)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:n,symrefs:i}}function hv(t,e,r){let n=t.trim().split(e);if(n.length!==2)throw new la(`Two strings separated by '${r}'`,t.toString("utf8"));return n}var sA=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,oA=(t,e)=>{(e.username||e.password)&&(t.Authorization=FA(e)),e.headers&&Object.assign(t,e.headers)},pv=async t=>{try{let e=w.from(await wp(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},Jl=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:n,onAuthSuccess:i,onAuthFailure:s,corsProxy:o,service:a,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=rA(l),h=o?sA(o,f):f;(d.username||d.password)&&(c.Authorization=FA(d)),u===2&&(c["Git-Protocol"]="version=2");let g,m,y=!1;do if(g=await e.request({onProgress:r,method:"GET",url:`${h}/info/refs?service=${a}`,headers:c}),m=!1,g.statusCode===401||g.statusCode===203){let v=y?s:n;if(v){if(d=await v(f,{...d,headers:{...c}}),d&&d.cancel)throw new Wl;d&&(oA(c,d),y=!0,m=!0)}}else g.statusCode===200&&y&&i&&await i(f,d);while(m);if(g.statusCode!==200){let{response:v}=await pv(g);throw new Vl(g.statusCode,g.statusMessage,v)}if(g.headers["content-type"]===`application/x-${a}-advertisement`){let v=await iA(g.body,{service:a});return v.auth=d,v}else{let{preview:v,response:b,data:k}=await pv(g);try{let E=await iA([k],{service:a});return E.auth=d,E}catch{throw new of(v,b)}}}static async connect({http:e,onProgress:r,corsProxy:n,service:i,url:s,auth:o,body:a,headers:l}){let c=rA(s);c&&(s=c.url),n&&(s=sA(n,s)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,oA(l,o);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${i}`,body:a,headers:l});if(u.statusCode!==200){let{response:f}=pv(u);throw new Vl(u.statusCode,u.statusMessage,f)}return u}},Xl=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",Jl),r.set("https",Jl);let n=M6({url:e});if(!n)throw new lf(e);if(r.has(n.transport))return r.get(n.transport);throw new af(e,n.transport,n.transport==="ssh"?z6(e):void 0)}};function M6({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 sa=null,ca=class{static async read({fs:e,gitdir:r}){sa===null&&(sa=new Gu);let n=M(r,"shallow"),i=new Set;return await sa.acquire(n,async function(){let s=await e.read(n,{encoding:"utf8"});if(s===null||s.trim()==="")return i;s.trim().split(` `).map(o=>i.add(o))}),i}static async write({fs:e,gitdir:r,oids:n}){sa===null&&(sa=new Gu);let i=M(r,"shallow");if(n.size>0){let s=[...n].join(` `)+` `;await sa.acquire(i,async function(){await e.write(i,s,{encoding:"utf8"})})}else await sa.acquire(i,async function(){await e.rm(i)})}};async function L6({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${n}`)}async function B6({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let s=await t.readdir(M(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let a=`${r}/objects/pack/${o}`,l=await $v({fs:t,cache:e,filename:a,getExternalRefDelta:i});if(l.error)throw new Se(l.error);if(l.offsets.has(n))return!0}return!1}async function aA({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let s=a=>st({fs:t,cache:e,gitdir:r,oid:a}),o=await L6({fs:t,gitdir:r,oid:n});return o||(o=await B6({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:s})),o}function U6(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function DA(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 Sp={name:"isomorphic-git",version:"1.36.1",agent:"git/isomorphic-git@1.36.1"},Ul=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 j6(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 zA(t){let e=new Ul,r="";return(async()=>(await mf(t,n=>{for(n=n.toString("utf8"),r+=n;;){let i=j6(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 vp=class{static demux(e){let r=pt.streamReader(e),n=new Ul,i=new Ul,s=new Ul,o=async function(){let a=await r();if(a===null)return o();if(a===!0){n.end(),s.end(),e.error?i.destroy(e.error):i.end();return}switch(a[0]){case 1:{i.write(a.slice(1));break}case 2:{s.write(a.slice(1));break}case 3:{let l=a.slice(1);s.write(l),n.end(),s.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(a)}o()};return o(),{packetlines:n,packfile:i,progress:s}}};async function q6(t){let{packetlines:e,packfile:r,progress:n}=vp.demux(t),i=[],s=[],o=[],a=!1,l=!1;return new Promise((c,u)=>{mf(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new qs(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new qs(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,g]=d.split(" ");o.push({oid:h,status:g}),g||(l=!0)}else d.startsWith("NAK")?(a=!0,l=!0):(l=!0,a=!0);l&&(t.error?u(t.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:r,progress:n}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:r,progress:n}))})})}function V6({capabilities:t=[],wants:e=[],haves:r=[],shallows:n=[],depth:i=null,since:s=null,exclude:o=[]}){let a=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)a.push(pt.encode(`want ${c}${l} `)),l="";for(let c of n)a.push(pt.encode(`shallow ${c} `));i!==null&&a.push(pt.encode(`deepen ${i} `)),s!==null&&a.push(pt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)} `));for(let c of o)a.push(pt.encode(`deepen-not ${c} `));a.push(pt.flush());for(let c of r)a.push(pt.encode(`have ${c} `));return a.push(pt.encode(`done `)),a}async function Nv({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:g=null,since:m=null,exclude:y=[],relative:v=!1,tags:b=!1,singleBranch:k=!1,headers:E={},prune:_=!1,pruneTags:x=!1}){let S=c||await Ys({fs:t,gitdir:l,test:!0}),C=await yt.get({fs:t,gitdir:l}),T=f||S&&await C.get(`branch.${S}.remote`)||"origin",P=d||await C.get(`remote.${T}.url`);if(typeof P>"u")throw new Mr("remote OR url");let R=u||S&&await C.get(`branch.${S}.merge`)||c||"HEAD";h===void 0&&(h=await C.get("http.corsProxy"));let N=Xl.getRemoteHelperFor({url:P}),F=await N.discover({http:r,onAuth:s,onAuthSuccess:o,onAuthFailure:a,corsProxy:h,service:"git-upload-pack",url:P,headers:E,protocolVersion:1}),j=F.auth,Q=F.refs;if(Q.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(g!==null&&!F.capabilities.has("shallow"))throw new js("shallow","depth");if(m!==null&&!F.capabilities.has("deepen-since"))throw new js("deepen-since","since");if(y.length>0&&!F.capabilities.has("deepen-not"))throw new js("deepen-not","exclude");if(v===!0&&!F.capabilities.has("deepen-relative"))throw new js("deepen-relative","relative");let{oid:ge,fullref:ie}=W.resolveAgainstMap({ref:R,map:Q});for(let ye of Q.keys())ye===ie||ye==="HEAD"||ye.startsWith("refs/heads/")||b&&ye.startsWith("refs/tags/")||Q.delete(ye);let pe=DA([...F.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Sp.agent}`]);v&&pe.push("deepen-relative");let Ze=k?[ge]:Q.values(),A=k?[S]:await W.listRefs({fs:t,gitdir:l,filepath:"refs"}),q=[];for(let ye of A)try{ye=await W.expand({fs:t,gitdir:l,ref:ye});let Ce=await W.resolve({fs:t,gitdir:l,ref:ye});await aA({fs:t,cache:e,gitdir:l,oid:Ce})&&q.push(Ce)}catch{}q=[...new Set(q)];let B=await ca.read({fs:t,gitdir:l}),I=F.capabilities.has("shallow")?[...B]:[],ce=V6({capabilities:pe,wants:Ze,haves:q,shallows:I,depth:g,since:m,exclude:y}),ue=w.from(await wp(ce)),Pe=await N.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:P,auth:j,body:[ue],headers:E}),se=await q6(Pe.body);Pe.headers&&(se.headers=Pe.headers);for(let ye of se.shallows)if(!B.has(ye))try{let{object:Ce}=await st({fs:t,cache:e,gitdir:l,oid:ye}),ze=new Br(Ce),je=await Promise.all(ze.headers().parent.map(bt=>aA({fs:t,cache:e,gitdir:l,oid:bt})));je.length===0||je.every(bt=>bt)||B.add(ye)}catch{B.add(ye)}for(let ye of se.unshallows)B.delete(ye);if(await ca.write({fs:t,gitdir:l,oids:B}),k){let ye=new Map([[ie,ge]]),Ce=new Map,ze=10,je=ie;for(;ze--;){let vr=F.symrefs.get(je);if(vr===void 0)break;Ce.set(je,vr),je=vr}let zt=Q.get(je);zt&&ye.set(je,zt);let{pruned:bt}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:T,refs:ye,symrefs:Ce,tags:b,prune:_});_&&(se.pruned=bt)}else{let{pruned:ye}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:T,refs:Q,symrefs:F.symrefs,tags:b,prune:_,pruneTags:x});_&&(se.pruned=ye)}if(se.HEAD=F.symrefs.get("HEAD"),se.HEAD===void 0){let{oid:ye}=W.resolveAgainstMap({ref:"HEAD",map:Q});for(let[Ce,ze]of Q.entries())if(Ce!=="HEAD"&&ze===ye){se.HEAD=Ce;break}}let me=ie.startsWith("refs/tags")?"tag":"branch";if(se.FETCH_HEAD={oid:ge,description:`${me} '${oa(ie)}' of ${P}`},n||i){let ye=zA(se.progress);mf(ye,async Ce=>{if(i&&await i(Ce),n){let ze=Ce.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);ze&&await n({phase:ze[1].trim(),loaded:parseInt(ze[2],10),total:parseInt(ze[3],10)})}})}let We=w.from(await wp(se.packfile));if(Pe.body.error)throw Pe.body.error;let de=We.slice(-20).toString("hex"),$e={defaultBranch:se.HEAD,fetchHead:se.FETCH_HEAD.oid,fetchHeadDescription:se.FETCH_HEAD.description};if(se.headers&&($e.headers=se.headers),_&&($e.pruned=se.pruned),de!==""&&!U6(We)){$e.packfile=`objects/pack/pack-${de}.pack`;let ye=M(l,$e.packfile);await t.write(ye,We);let Ce=je=>st({fs:t,cache:e,gitdir:l,oid:je}),ze=await Yu.fromPack({pack:We,getExternalRefDelta:Ce,onProgress:n});await t.write(ye.replace(/\.pack$/,".idx"),await ze.toBuffer())}return $e}async function MA({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:M(r,".git"),defaultBranch:i="master"}){if(await t.exists(n+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(o=>n+"/"+o);for(let o of s)await t.mkdir(o);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 H6({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:g,depth:m,since:y,exclude:v,relative:b,singleBranch:k,noCheckout:E,noTags:_,headers:x,nonBlocking:S,batchSize:C=100}){try{if(await MA({fs:t,gitdir:u}),await PA({fs:t,gitdir:u,remote:g,url:f,force:!1}),d){let R=await yt.get({fs:t,gitdir:u});await R.set("http.corsProxy",d),await yt.save({fs:t,gitdir:u,config:R})}let{defaultBranch:T,fetchHead:P}=await Nv({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:u,ref:h,remote:g,corsProxy:d,depth:m,since:y,exclude:v,relative:b,singleBranch:k,headers:x,tags:!_});if(P===null)return;h=h||T,h=h.replace("refs/heads/",""),await Rv({fs:t,cache:e,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:g,noCheckout:E,nonBlocking:S,batchSize:C})}catch(T){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),T}}async function LA({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:c=M(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:g=void 0,since:m=void 0,exclude:y=[],relative:v=!1,singleBranch:b=!1,noCheckout:k=!1,noTags:E=!1,headers:_={},cache:x={},nonBlocking:S=!1,batchSize:C=100}){try{$("fs",t),$("http",e),$("gitdir",c),k||$("dir",l),$("url",u);let T=new ee(t),P=await oe({fsp:T,dotgit:c});return await H6({fs:T,cache:x,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:P,url:u,corsProxy:f,ref:d,remote:h,depth:g,since:m,exclude:y,relative:v,singleBranch:b,noCheckout:k,noTags:E,headers:_,nonBlocking:S,batchSize:C})}catch(T){throw T.caller="git.clone",T}}async function BA({fs:t,onSign:e,dir:r,gitdir:n=M(r,".git"),message:i,author:s,committer:o,signingKey:a,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:g={}}){try{$("fs",t),l||$("message",i),a&&$("onSign",e);let m=new ee(t),y=await oe({fsp:m,dotgit:n});return await kp({fs:m,cache:g,onSign:e,gitdir:y,message:i,author:s,committer:o,signingKey:a,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(m){throw m.caller="git.commit",m}}async function UA({fs:t,dir:e,gitdir:r=M(e,".git"),fullname:n=!1,test:i=!1}){try{$("fs",t),$("gitdir",r);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await Ys({fs:s,gitdir:o,fullname:n,test:i})}catch(s){throw s.caller="git.currentBranch",s}}async function G6({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await W.exists({fs:t,gitdir:e,ref:r}))throw new Je(r);let i=await W.expand({fs:t,gitdir:e,ref:r}),s=await Ys({fs:t,gitdir:e,fullname:!0});if(i===s){let l=await W.resolve({fs:t,gitdir:e,ref:i});await W.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await W.deleteRef({fs:t,gitdir:e,ref:i});let o=oa(r),a=await yt.get({fs:t,gitdir:e});await a.deleteSection("branch",o),await yt.save({fs:t,gitdir:e,config:a})}async function jA({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n}){try{$("fs",t),$("ref",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await G6({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function qA({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n}){try{$("fs",t),$("ref",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});await W.deleteRef({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function Q6({fs:t,gitdir:e,remote:r}){let n=await yt.get({fs:t,gitdir:e});await n.deleteSection("remote",r),await yt.save({fs:t,gitdir:e,config:n})}async function VA({fs:t,dir:e,gitdir:r=M(e,".git"),remote:n}){try{$("fs",t),$("remote",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await Q6({fs:i,gitdir:s,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function W6({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await W.deleteRef({fs:t,gitdir:e,ref:r})}async function HA({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n}){try{$("fs",t),$("ref",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await W6({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function K6({fs:t,gitdir:e,oid:r}){let n=r.slice(0,2);return(await t.readdir(`${e}/objects/${n}`)).map(s=>`${n}${s}`).filter(s=>s.startsWith(r))}async function Y6({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let s=[],o=await t.readdir(M(r,"objects/pack"));o=o.filter(a=>a.endsWith(".idx"));for(let a of o){let l=`${r}/objects/pack/${a}`,c=await $v({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new Se(c.error);for(let u of c.offsets.keys())u.startsWith(n)&&s.push(u)}return s}async function Z6({fs:t,cache:e,gitdir:r,oid:n}){let i=a=>st({fs:t,cache:e,gitdir:r,oid:a}),s=await K6({fs:t,gitdir:r,oid:n}),o=await Y6({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i});for(let a of o)s.indexOf(a)===-1&&s.push(a);if(s.length===1)return s[0];throw s.length>1?new Zu("oids",n,s):new Je(`an object matching "${n}"`)}async function GA({fs:t,dir:e,gitdir:r=M(e,".git"),oid:n,cache:i={}}){try{$("fs",t),$("gitdir",r),$("oid",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await Z6({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.expandOid",s}}async function QA({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n}){try{$("fs",t),$("gitdir",r),$("ref",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await W.expand({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function Fv({fs:t,cache:e,gitdir:r,oids:n}){let i={},s=n.length,o=n.map((a,l)=>({index:l,oid:a}));for(;o.length;){let a=new Set;for(let{oid:c,index:u}of o)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===s&&a.add(c);if(a.size>0)return[...a];let l=new Map;for(let{oid:c,index:u}of o)try{let{object:f}=await st({fs:t,cache:e,gitdir:r,oid:c}),d=Br.from(f),{parent:h}=d.parseHeaders();for(let g of h)(!i[g]||!i[g].has(u))&&l.set(g+":"+u,{oid:g,index:u})}catch{}o=Array.from(l.values())}return[]}var mv=/^.*(\r?\n|$)/gm;function J6({branches:t,contents:e}){let r=t[1],n=t[2],i=e[0],s=e[1],o=e[2],a=s.match(mv),l=i.match(mv),c=o.match(mv),u=Pq(a,l,c),f=7,d="",h=!0;for(let g of u)g.ok&&(d+=g.ok.join("")),g.conflict&&(h=!1,d+=`${"<".repeat(f)} ${r} `,d+=g.conflict.a.join(""),d+=`${"=".repeat(f)} `,d+=g.conflict.b.join(""),d+=`${">".repeat(f)} ${n} `);return{cleanMerge:h,mergedText:d}}async function X6({fs:t,cache:e,dir:r,gitdir:n=M(r,".git"),index:i,ourOid:s,baseOid:o,theirOid:a,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let g=an({ref:s}),m=an({ref:o}),y=an({ref:a}),v=[],b=[],k=[],E=[],_=await Gs({fs:t,cache:e,dir:r,gitdir:n,trees:[g,m,y],map:async function(x,[S,C,T]){let P=dp(x),R=await yp(S,C),N=await yp(T,C);switch(`${R}-${N}`){case"false-false":return{mode:await C.mode(),path:P,oid:await C.oid(),type:await C.type()};case"false-true":return!T&&await S.type()==="tree"?{mode:await S.mode(),path:P,oid:await S.oid(),type:await S.type()}:T?{mode:await T.mode(),path:P,oid:await T.oid(),type:await T.type()}:void 0;case"true-false":return!S&&await T.type()==="tree"?{mode:await T.mode(),path:P,oid:await T.oid(),type:await T.type()}:S?{mode:await S.mode(),path:P,oid:await S.oid(),type:await S.type()}:void 0;case"true-true":{if(S&&T&&await S.type()==="tree"&&await T.type()==="tree")return{mode:await S.mode(),path:P,oid:await S.oid(),type:"tree"};if(S&&T&&await S.type()==="blob"&&await T.type()==="blob")return e3({fs:t,gitdir:n,path:P,ours:S,base:C,theirs:T,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async F=>{if(F.cleanMerge)d||i.insert({filepath:x,oid:F.mergeResult.oid,stage:0});else if(v.push(x),b.push(x),!d){let j="";C&&await C.type()==="blob"&&(j=await C.oid());let Q=await S.oid(),ge=await T.oid();i.delete({filepath:x}),j&&i.insert({filepath:x,oid:j,stage:1}),i.insert({filepath:x,oid:Q,stage:2}),i.insert({filepath:x,oid:ge,stage:3})}return F.mergeResult});if(C&&!S&&T&&await C.type()==="blob"&&await T.type()==="blob"){if(v.push(x),k.push(x),!d){let F=await C.oid(),j=await T.oid();i.delete({filepath:x}),i.insert({filepath:x,oid:F,stage:1}),i.insert({filepath:x,oid:j,stage:3})}return{mode:await T.mode(),oid:await T.oid(),type:"blob",path:P}}if(C&&S&&!T&&await C.type()==="blob"&&await S.type()==="blob"){if(v.push(x),E.push(x),!d){let F=await C.oid(),j=await S.oid();i.delete({filepath:x}),i.insert({filepath:x,oid:F,stage:1}),i.insert({filepath:x,oid:j,stage:2})}return{mode:await S.mode(),oid:await S.oid(),type:"blob",path:P}}if(C&&!S&&!T&&(await C.type()==="blob"||await C.type()==="tree"))return;throw new Hl}}},reduce:v.length!==0&&(!r||d)?void 0:async(x,S)=>{let C=S.filter(Boolean);if(x&&!(x&&x.type==="tree"&&C.length===0&&x.path!==".")){if(C.length>0||x.path==="."&&C.length===0){let P=new Lr(C).toObject(),R=await Ur({fs:t,gitdir:n,type:"tree",object:P,dryRun:f});x.oid=R}return x}}});return v.length!==0?(r&&!d&&await Gs({fs:t,cache:e,dir:r,gitdir:n,trees:[an({ref:_.oid})],map:async function(x,[S]){let C=`${r}/${x}`;if(await S.type()==="blob"){let T=await S.mode(),P=new TextDecoder().decode(await S.content());await t.write(C,P,{mode:T})}return!0}}),new Gl(v,b,k,E)):_.oid}async function e3({fs:t,gitdir:e,path:r,ours:n,base:i,theirs:s,ourName:o,theirName:a,baseName:l,dryRun:c,mergeDriver:u=J6}){let f="blob",d="100755",h="",g="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),g=w.from(await i.content()).toString("utf8"));let m=d===await n.mode()?await s.mode():await n.mode();if(await n.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:m,path:r,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:m,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:m,path:r,oid:await n.oid(),type:f}};let y=w.from(await n.content()).toString("utf8"),v=w.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:k}=await u({branches:[l,o,a],contents:[g,y,v],path:r}),E=await Ur({fs:t,gitdir:e,type:"blob",object:w.from(b,"utf8"),dryRun:c});return{cleanMerge:k,mergeResult:{mode:m,path:r,oid:E,type:f}}}async function WA({fs:t,cache:e,dir:r,gitdir:n,ours:i,theirs:s,fastForward:o=!0,fastForwardOnly:a=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:g,onSign:m,mergeDriver:y,allowUnrelatedHistories:v=!1}){i===void 0&&(i=await Ys({fs:t,gitdir:n,fullname:!0})),i=await W.expand({fs:t,gitdir:n,ref:i}),s=await W.expand({fs:t,gitdir:n,ref:s});let b=await W.resolve({fs:t,gitdir:n,ref:i}),k=await W.resolve({fs:t,gitdir:n,ref:s}),E=await Fv({fs:t,cache:e,gitdir:n,oids:[b,k]});if(E.length!==1)if(E.length===0&&v)E.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Hl;let _=E[0];if(_===k)return{oid:b,alreadyMerged:!0};if(o&&_===b)return!l&&!c&&await W.writeRef({fs:t,gitdir:n,ref:i,value:k}),{oid:k,fastForward:!0};{if(a)throw new tf;let x=await kt.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async C=>X6({fs:t,cache:e,dir:r,gitdir:n,index:C,ourOid:b,theirOid:k,baseOid:_,ourName:oa(i),baseName:"base",theirName:oa(s),dryRun:l,abortOnConflict:u,mergeDriver:y}));if(x instanceof Gl)throw x;return f||(f=`Merge branch '${oa(s)}' into ${oa(i)}`),{oid:await kp({fs:t,cache:e,gitdir:n,message:f,ref:i,tree:x,parent:[b,k],author:d,committer:h,signingKey:g,onSign:m,dryRun:l,noUpdateBranch:c}),tree:x,mergeCommit:!0}}}async function KA({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:g,pruneTags:m,fastForward:y,fastForwardOnly:v,corsProxy:b,singleBranch:k,headers:E,author:_,committer:x,signingKey:S}){try{if(!u){let P=await Ys({fs:t,gitdir:c});if(!P)throw new Mr("ref");u=P}let{fetchHead:C,fetchHeadDescription:T}=await Nv({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:c,corsProxy:b,ref:u,url:f,remote:d,remoteRef:h,singleBranch:k,headers:E,prune:g,pruneTags:m});await WA({fs:t,cache:e,gitdir:c,ours:u,theirs:C,fastForward:y,fastForwardOnly:v,message:`Merge ${T}`,author:_,committer:x,signingKey:S,dryRun:!1,noUpdateBranch:!1}),await Rv({fs:t,cache:e,onProgress:n,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(C){throw C.caller="git.pull",C}}async function YA({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=M(a,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:g,headers:m={},cache:y={}}){try{$("fs",t),$("http",e),$("gitdir",l);let v={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},b=new ee(t),k=await oe({fsp:b,dotgit:l});return await KA({fs:b,cache:y,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:k,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:g,headers:m,author:v,committer:v})}catch(v){throw v.caller="git.fastForward",v}}async function ZA({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=M(a,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:g=null,since:m=null,exclude:y=[],relative:v=!1,tags:b=!1,singleBranch:k=!1,headers:E={},prune:_=!1,pruneTags:x=!1,cache:S={}}){try{$("fs",t),$("http",e),$("gitdir",l);let C=new ee(t),T=await oe({fsp:C,dotgit:l});return await Nv({fs:C,cache:S,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,gitdir:T,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:g,since:m,exclude:y,relative:v,tags:b,singleBranch:k,headers:E,prune:_,pruneTags:x})}catch(C){throw C.caller="git.fetch",C}}async function JA({fs:t,dir:e,gitdir:r=M(e,".git"),oids:n,cache:i={}}){try{$("fs",t),$("gitdir",r),$("oids",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await Fv({fs:s,cache:i,gitdir:o,oids:n})}catch(s){throw s.caller="git.findMergeBase",s}}async function XA({fs:t,filepath:e}){if(await t.exists(M(e,".git")))return e;{let r=aa(e);if(r===e)throw new Je(`git root for ${e}`);return XA({fs:t,filepath:r})}}async function eI({fs:t,filepath:e}){try{return $("fs",t),$("filepath",e),await XA({fs:new ee(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function tI({fs:t,dir:e,gitdir:r=M(e,".git"),path:n}){try{$("fs",t),$("gitdir",r),$("path",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await ff({fs:i,gitdir:s,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function t3({fs:t,gitdir:e,path:r}){return(await yt.get({fs:t,gitdir:e})).getall(r)}async function rI({fs:t,dir:e,gitdir:r=M(e,".git"),path:n}){try{$("fs",t),$("gitdir",r),$("path",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await t3({fs:i,gitdir:s,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function nI({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:s,headers:o={},forPush:a=!1}){try{$("http",t),$("url",s);let c=await Xl.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),g=h.pop(),m=u;for(let y of h)m[y]=m[y]||{},m=m[y];m[g]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),g=h.pop(),m=u;for(let y of h)m[y]=m[y]||{},m=m[y];m[g]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function iI(t,e,r,n){let i=[];for(let[s,o]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(n){let l=s.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=o}continue}let a={ref:s,oid:o};r&&t.symrefs.has(s)&&(a.target=t.symrefs.get(s)),i.push(a)}return i}async function sI({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:s,headers:o={},forPush:a=!1,protocolVersion:l=2}){try{$("http",t),$("url",s);let u=await Xl.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let d of u.capabilities){let[h,g]=d.split("=");g?f[h]=g:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:iI(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function r3({type:t,object:e,format:r="content",oid:n=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Vs.wrap({type:t,object:e})),n=await fs(e)),{oid:n,object:e}}async function oI({object:t}){try{$("object",t),typeof t=="string"?t=w.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:n}=await r3({type:e,format:"content",object:t});return{oid:r,type:e,object:n,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function n3({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,filepath:s}){try{s=M(n,s);let o=await t.read(s),a=c=>st({fs:t,cache:e,gitdir:i,oid:c}),l=await Yu.fromPack({pack:o,getExternalRefDelta:a,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(o){throw o.caller="git.indexPack",o}}async function aI({fs:t,onProgress:e,dir:r,gitdir:n=M(r,".git"),filepath:i,cache:s={}}){try{$("fs",t),$("dir",r),$("gitdir",r),$("filepath",i);let o=new ee(t),a=await oe({fsp:o,dotgit:n});return await n3({fs:o,cache:s,onProgress:e,dir:r,gitdir:a,filepath:i})}catch(o){throw o.caller="git.indexPack",o}}async function lI({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:M(r,".git"),defaultBranch:i="master"}){try{$("fs",t),$("gitdir",n),e||$("dir",r);let s=new ee(t),o=await oe({fsp:s,dotgit:n});return await MA({fs:s,bare:e,dir:r,gitdir:o,defaultBranch:i})}catch(s){throw s.caller="git.init",s}}async function cI({fs:t,cache:e,gitdir:r,oid:n,ancestor:i,depth:s}){let o=await ca.read({fs:t,gitdir:r});if(!n)throw new Mr("oid");if(!i)throw new Mr("ancestor");if(n===i)return!1;let a=[n],l=new Set,c=0;for(;a.length;){if(c++===s)throw new nf(s);let u=a.shift(),{type:f,object:d}=await st({fs:t,cache:e,gitdir:r,oid:u});if(f!=="commit")throw new Sr(u,f,"commit");let h=Br.from(d).parse();for(let g of h.parent)if(g===i)return!0;if(!o.has(u))for(let g of h.parent)l.has(g)||(a.push(g),l.add(g))}return!1}async function uI({fs:t,dir:e,gitdir:r=M(e,".git"),oid:n,ancestor:i,depth:s=-1,cache:o={}}){try{$("fs",t),$("gitdir",r),$("oid",n),$("ancestor",i);let a=new ee(t),l=await oe({fsp:a,dotgit:r});return await cI({fs:a,cache:o,gitdir:l,oid:n,ancestor:i,depth:s})}catch(a){throw a.caller="git.isDescendent",a}}async function fI({fs:t,dir:e,gitdir:r=M(e,".git"),filepath:n}){try{$("fs",t),$("dir",e),$("gitdir",r),$("filepath",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return Qs.isIgnored({fs:i,dir:e,gitdir:s,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function dI({fs:t,dir:e,gitdir:r=M(e,".git"),remote:n}){try{$("fs",t),$("gitdir",r);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return W.listBranches({fs:i,gitdir:s,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function i3({fs:t,gitdir:e,ref:r,cache:n}){if(r){let i=await W.resolve({gitdir:e,fs:t,ref:r}),s=[];return await hI({fs:t,cache:n,gitdir:e,oid:i,filenames:s,prefix:""}),s}else return kt.acquire({fs:t,gitdir:e,cache:n},async function(i){return i.entries.map(s=>s.path)})}async function hI({fs:t,cache:e,gitdir:r,oid:n,filenames:i,prefix:s}){let{tree:o}=await rc({fs:t,cache:e,gitdir:r,oid:n});for(let a of o)a.type==="tree"?await hI({fs:t,cache:e,gitdir:r,oid:a.oid,filenames:i,prefix:M(s,a.path)}):i.push(M(s,a.path))}async function pI({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n,cache:i={}}){try{$("fs",t),$("gitdir",r);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await i3({fs:s,cache:i,gitdir:o,ref:n})}catch(s){throw s.caller="git.listFiles",s}}async function s3({fs:t,cache:e,gitdir:r,ref:n}){let i;try{i=await W.resolve({gitdir:r,fs:t,ref:n})}catch(a){if(a instanceof Je)return[]}return(await rc({fs:t,cache:e,gitdir:r,oid:i})).tree.map(a=>({target:a.path,note:a.oid}))}async function mI({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n="refs/notes/commits",cache:i={}}){try{$("fs",t),$("gitdir",r),$("ref",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await s3({fs:s,cache:i,gitdir:o,ref:n})}catch(s){throw s.caller="git.listNotes",s}}async function gI({fs:t,dir:e,gitdir:r=M(e,".git"),filepath:n}){try{$("fs",t),$("gitdir",r);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return W.listRefs({fs:i,gitdir:s,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function o3({fs:t,gitdir:e}){let r=await yt.get({fs:t,gitdir:e}),n=await r.getSubsections("remote");return Promise.all(n.map(async s=>{let o=await r.get(`remote.${s}.url`);return{remote:s,url:o}}))}async function yI({fs:t,dir:e,gitdir:r=M(e,".git")}){try{$("fs",t),$("gitdir",r);let n=new ee(t),i=await oe({fsp:n,dotgit:r});return await o3({fs:n,gitdir:i})}catch(n){throw n.caller="git.listRemotes",n}}async function a3(t){let e=pt.streamReader(t),r=[],n;for(;n=await e(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let[i,s,...o]=n.split(" "),a={ref:s,oid:i};for(let l of o){let[c,u]=l.split(":");c==="symref-target"?a.target=u:c==="peeled"&&(a.peeled=u)}r.push(a)}return r}async function l3({prefix:t,symrefs:e,peelTags:r}){let n=[];return n.push(pt.encode(`command=ls-refs `)),n.push(pt.encode(`agent=${Sp.agent} `)),(r||e||t)&&n.push(pt.delim()),r&&n.push(pt.encode("peel")),e&&n.push(pt.encode("symrefs")),t&&n.push(pt.encode(`ref-prefix ${t}`)),n.push(pt.flush()),n}async function wI({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:s,headers:o={},forPush:a=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{$("http",t),$("url",s);let d=await Jl.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:l});if(d.protocolVersion===1)return iI(d,c,u,f);let h=await l3({prefix:c,symrefs:u,peelTags:f}),g=await Jl.connect({http:t,auth:d.auth,headers:o,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,body:h});return a3(g.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function vI({fs:t,dir:e,gitdir:r=M(e,".git")}){try{$("fs",t),$("gitdir",r);let n=new ee(t),i=await oe({fsp:n,dotgit:r});return W.listTags({fs:n,gitdir:i})}catch(n){throw n.caller="git.listTags",n}}function c3(t,e){return t.committer.timestamp-e.committer.timestamp}var u3="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function lA({fs:t,cache:e,gitdir:r,oid:n,fileId:i}){if(i===u3)return;let s=n,o,a=await Kl({fs:t,cache:e,gitdir:r,oid:n}),l=a.tree;return i===a.oid?o=a.path:(o=await bI({fs:t,cache:e,gitdir:r,tree:l,fileId:i,oid:s}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function bI({fs:t,cache:e,gitdir:r,tree:n,fileId:i,oid:s,filepaths:o=[],parentPath:a=""}){let l=n.entries().map(function(c){let u;return c.oid===i?(u=M(a,c.path),o.push(u)):c.type==="tree"&&(u=st({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return bI({fs:t,cache:e,gitdir:r,tree:Lr.from(f),fileId:i,oid:s,filepaths:o,parentPath:M(a,c.path)})})),u});return await Promise.all(l),o}async function f3({fs:t,cache:e,gitdir:r,filepath:n,ref:i,depth:s,since:o,force:a,follow:l}){let c=typeof o>"u"?void 0:Math.floor(o.valueOf()/1e3),u=[],f=await ca.read({fs:t,gitdir:r}),d=await W.resolve({fs:t,gitdir:r,ref:i}),h=[await Zl({fs:t,cache:e,gitdir:r,oid:d})],g,m,y;function v(b){y&&n&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(n){let k;try{k=await hf({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:n}),m&&g!==k&&u.push(m),g=k,m=b,y=!0}catch(E){if(E instanceof Je){let _=l&&g;if(_&&(_=await lA({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:g}),_))if(Array.isArray(_)){if(m){let x=await lA({fs:t,cache:e,gitdir:r,oid:m.commit.tree,fileId:g});if(Array.isArray(x))if(_=_.filter(S=>x.indexOf(S)===-1),_.length===1)_=_[0],n=_,m&&u.push(m);else{_=!1,m&&u.push(m);break}}}else n=_,m&&u.push(m);if(!_){if(y&&g&&(u.push(m),!a))break;if(!a&&!l)throw E}m=b,y=!1}else throw E}}else u.push(b);if(s!==void 0&&u.length===s){v(b);break}if(!f.has(b.oid))for(let k of b.commit.parent){let E=await Zl({fs:t,cache:e,gitdir:r,oid:k});h.map(_=>_.oid).includes(E.oid)||h.push(E)}h.length===0&&v(b),h.sort((k,E)=>c3(k.commit,E.commit))}return u}async function _I({fs:t,dir:e,gitdir:r=M(e,".git"),filepath:n,ref:i="HEAD",depth:s,since:o,force:a,follow:l,cache:c={}}){try{$("fs",t),$("gitdir",r),$("ref",i);let u=new ee(t),f=await oe({fsp:u,dotgit:r});return await f3({fs:u,cache:c,gitdir:f,filepath:n,ref:i,depth:s,since:o,force:a,follow:l})}catch(u){throw u.caller="git.log",u}}async function xI({fs:t,onSign:e,dir:r,gitdir:n=M(r,".git"),ours:i,theirs:s,fastForward:o=!0,fastForwardOnly:a=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:g,cache:m={},mergeDriver:y,allowUnrelatedHistories:v=!1}){try{$("fs",t),g&&$("onSign",e);let b=new ee(t),k=await oe({fsp:b,dotgit:n}),E=await Ws({fs:b,gitdir:k,author:d});if(!E&&(!a||!o))throw new lr("author");let _=await Yl({fs:b,gitdir:k,author:E,committer:h});if(!_&&(!a||!o))throw new lr("committer");return await WA({fs:b,cache:m,dir:r,gitdir:k,ours:i,theirs:s,fastForward:o,fastForwardOnly:a,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:E,committer:_,signingKey:g,onSign:e,mergeDriver:y,allowUnrelatedHistories:v})}catch(b){throw b.caller="git.merge",b}}var d3={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function kI({fs:t,cache:e,dir:r,gitdir:n=M(r,".git"),oids:i}){let s=new uA,o=[];function a(u,f){let d=w.from(u,f);o.push(d),s.update(d)}async function l({stype:u,object:f}){let d=d3[u],h=f.length,g=h>15?128:0,m=h&15;h=h>>>4;let y=(g|d|m).toString(16);for(a(y,"hex");g;)g=h>127?128:0,y=g|h&127,a(Iv(2,y),"hex"),h=h>>>7;a(w.from(await xA(f)))}a("PACK"),a("00000002","hex"),a(Iv(8,i.length),"hex");for(let u of i){let{type:f,object:d}=await st({fs:t,cache:e,gitdir:n,oid:u});await l({write:a,object:d,stype:f})}let c=s.digest();return o.push(c),o}async function h3({fs:t,cache:e,gitdir:r,oids:n,write:i}){let s=await kI({fs:t,cache:e,gitdir:r,oids:n}),o=w.from(await wp(s)),l=`pack-${o.slice(-20).toString("hex")}.pack`;return i?(await t.write(M(r,`objects/pack/${l}`),o),{filename:l}):{filename:l,packfile:new Uint8Array(o)}}async function SI({fs:t,dir:e,gitdir:r=M(e,".git"),oids:n,write:i=!1,cache:s={}}){try{$("fs",t),$("gitdir",r),$("oids",n);let o=new ee(t),a=await oe({fsp:o,dotgit:r});return await h3({fs:o,cache:s,gitdir:a,oids:n,write:i})}catch(o){throw o.caller="git.packObjects",o}}async function EI({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=M(a,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:g=!1,fastForward:m=!0,fastForwardOnly:y=!1,corsProxy:v,singleBranch:b,headers:k={},author:E,committer:_,signingKey:x,cache:S={}}){try{$("fs",t),$("gitdir",l);let C=new ee(t),T=await oe({fsp:C,dotgit:l}),P=await Ws({fs:C,gitdir:T,author:E});if(!P)throw new lr("author");let R=await Yl({fs:C,gitdir:T,author:P,committer:_});if(!R)throw new lr("committer");return await KA({fs:C,cache:S,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:T,ref:c,url:u,remote:f,remoteRef:d,fastForward:m,fastForwardOnly:y,corsProxy:v,singleBranch:b,headers:k,author:P,committer:R,signingKey:x,prune:h,pruneTags:g})}catch(C){throw C.caller="git.pull",C}}async function p3({fs:t,cache:e,dir:r,gitdir:n=M(r,".git"),start:i,finish:s}){let o=await ca.read({fs:t,gitdir:n}),a=new Set,l=new Set;for(let f of i)a.add(await W.resolve({fs:t,gitdir:n,ref:f}));for(let f of s)try{let d=await W.resolve({fs:t,gitdir:n,ref:f});l.add(d)}catch{}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await st({fs:t,cache:e,gitdir:n,oid:f});if(d==="tag"){let m=ln.from(h).headers().object;return u(m)}if(d!=="commit")throw new Sr(f,d,"commit");if(!o.has(f)){let m=Br.from(h).headers().parent;for(f of m)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of a)await u(f);return c}async function gv({fs:t,cache:e,dir:r,gitdir:n=M(r,".git"),oids:i}){let s=new Set;async function o(a){if(s.has(a))return;s.add(a);let{type:l,object:c}=await st({fs:t,cache:e,gitdir:n,oid:a});if(l==="tag"){let f=ln.from(c).headers().object;await o(f)}else if(l==="commit"){let f=Br.from(c).headers().tree;await o(f)}else if(l==="tree"){let u=Lr.from(c);for(let f of u)f.type==="blob"&&s.add(f.oid),f.type==="tree"&&await o(f.oid)}}for(let a of i)await o(a);return s}async function m3(t){let e={},r="",n=pt.streamReader(t),i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+` `),i=await n();let s=r.toString("utf8").split(` `);if(i=s.shift(),!i.startsWith("unpack "))throw new la('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let o of s){if(o.trim()==="")continue;let a=o.slice(0,2),l=o.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:a==="ok",error:f}}return e}async function g3({capabilities:t=[],triplets:e=[]}){let r=[],n=`\0 ${t.join(" ")}`;for(let i of e)r.push(pt.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n} `)),n="";return r.push(pt.flush()),r}async function y3({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:g=!1,delete:m=!1,corsProxy:y,headers:v={}}){let b=u||await Ys({fs:t,gitdir:c});if(typeof b>"u")throw new Mr("ref");let k=await yt.get({fs:t,gitdir:c});d=d||await k.get(`branch.${b}.pushRemote`)||await k.get("remote.pushDefault")||await k.get(`branch.${b}.remote`)||"origin";let E=h||await k.get(`remote.${d}.pushurl`)||await k.get(`remote.${d}.url`);if(typeof E>"u")throw new Mr("remote OR url");let _=f||await k.get(`branch.${b}.merge`);if(typeof E>"u")throw new Mr("remoteRef");y===void 0&&(y=await k.get("http.corsProxy"));let x=await W.expand({fs:t,gitdir:c,ref:b}),S=m?"0000000000000000000000000000000000000000":await W.resolve({fs:t,gitdir:c,ref:x}),C=Xl.getRemoteHelperFor({url:E}),T=await C.discover({http:r,onAuth:s,onAuthSuccess:o,onAuthFailure:a,corsProxy:y,service:"git-receive-pack",url:E,headers:v,protocolVersion:1}),P=T.auth,R;if(!_)R=x;else try{R=await W.expandAgainstMap({ref:_,map:T.refs})}catch(B){if(B instanceof Je)R=_.startsWith("refs/")?_:`refs/heads/${_}`;else throw B}let N=T.refs.get(R)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:E,localRef:{ref:m?"(delete)":x,oid:S},remoteRef:{ref:R,oid:N}}))throw new Wl;let F=!T.capabilities.has("no-thin"),j=new Set;if(!m){let B=[...T.refs.values()],I=new Set;if(N!=="0000000000000000000000000000000000000000"){let ce=await Fv({fs:t,cache:e,gitdir:c,oids:[S,N]});for(let ue of ce)B.push(ue);F&&(I=await gv({fs:t,cache:e,gitdir:c,oids:ce}))}if(!B.includes(S)){let ce=await p3({fs:t,cache:e,gitdir:c,start:[S],finish:B});j=await gv({fs:t,cache:e,gitdir:c,oids:ce})}if(F){try{let ce=await W.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:ue}=await W.resolveAgainstMap({ref:ce.replace(`refs/remotes/${d}/`,""),fullref:ce,map:T.refs}),Pe=[ue];for(let se of await gv({fs:t,cache:e,gitdir:c,oids:Pe}))I.add(se)}catch{}for(let ce of I)j.delete(ce)}if(S===N&&(g=!0),!g){if(x.startsWith("refs/tags")&&N!=="0000000000000000000000000000000000000000")throw new Ql("tag-exists");if(S!=="0000000000000000000000000000000000000000"&&N!=="0000000000000000000000000000000000000000"&&!await cI({fs:t,cache:e,gitdir:c,oid:S,ancestor:N,depth:-1}))throw new Ql("not-fast-forward")}}let Q=DA([...T.capabilities],["report-status","side-band-64k",`agent=${Sp.agent}`]),ge=await g3({capabilities:Q,triplets:[{oldoid:N,oid:S,fullRef:R}]}),ie=m?[]:await kI({fs:t,cache:e,gitdir:c,oids:[...j]}),pe=await C.connect({http:r,onProgress:n,corsProxy:y,service:"git-receive-pack",url:E,auth:P,headers:v,body:[...ge,...ie]}),{packfile:Ze,progress:A}=await vp.demux(pe.body);if(i){let B=zA(A);mf(B,async I=>{await i(I)})}let q=await m3(Ze);if(pe.headers&&(q.headers=pe.headers),d&&q.ok&&q.refs[R].ok&&!x.startsWith("refs/tags")){let B=`refs/remotes/${d}/${R.replace("refs/heads","")}`;m?await W.deleteRef({fs:t,gitdir:c,ref:B}):await W.writeRef({fs:t,gitdir:c,ref:B,value:S})}if(q.ok&&Object.values(q.refs).every(B=>B.ok))return q;{let B=Object.entries(q.refs).filter(([I,ce])=>!ce.ok).map(([I,ce])=>` - ${I}: ${ce.error}`).join("");throw new rf(B,q)}}async function CI({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,dir:l,gitdir:c=M(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:g=!1,delete:m=!1,corsProxy:y,headers:v={},cache:b={}}){try{$("fs",t),$("http",e),$("gitdir",c);let k=new ee(t),E=await oe({fsp:k,dotgit:c});return await y3({fs:k,cache:b,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,gitdir:E,ref:u,remoteRef:f,remote:d,url:h,force:g,delete:m,corsProxy:y,headers:v})}catch(k){throw k.caller="git.push",k}}async function TI({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:s}=await st({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=ln.from(s).parse().object,TI({fs:t,cache:e,gitdir:r,oid:n});if(i!=="blob")throw new Sr(n,i,"blob");return{oid:n,blob:new Uint8Array(s)}}async function AI({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await hf({fs:t,cache:e,gitdir:r,oid:n,filepath:i})),await TI({fs:t,cache:e,gitdir:r,oid:n})}async function II({fs:t,dir:e,gitdir:r=M(e,".git"),oid:n,filepath:i,cache:s={}}){try{$("fs",t),$("gitdir",r),$("oid",n);let o=new ee(t),a=await oe({fsp:o,dotgit:r});return await AI({fs:o,cache:s,gitdir:a,oid:n,filepath:i})}catch(o){throw o.caller="git.readBlob",o}}async function Dv({fs:t,dir:e,gitdir:r=M(e,".git"),oid:n,cache:i={}}){try{$("fs",t),$("gitdir",r),$("oid",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await Zl({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.readCommit",s}}async function w3({fs:t,cache:e,gitdir:r,ref:n="refs/notes/commits",oid:i}){let s=await W.resolve({gitdir:r,fs:t,ref:n}),{blob:o}=await AI({fs:t,cache:e,gitdir:r,oid:s,filepath:i});return o}async function PI({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n="refs/notes/commits",oid:i,cache:s={}}){try{$("fs",t),$("gitdir",r),$("ref",n),$("oid",i);let o=new ee(t),a=await oe({fsp:o,dotgit:r});return await w3({fs:o,cache:s,gitdir:a,ref:n,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function $I({fs:t,dir:e,gitdir:r=M(e,".git"),oid:n,format:i="parsed",filepath:s=void 0,encoding:o=void 0,cache:a={}}){try{$("fs",t),$("gitdir",r),$("oid",n);let l=new ee(t),c=await oe({fsp:l,dotgit:r});s!==void 0&&(n=await hf({fs:l,cache:a,gitdir:c,oid:n,filepath:s}));let f=await st({fs:l,cache:a,gitdir:c,oid:n,format:i==="parsed"?"content":i});if(f.oid=n,i==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Br.from(f.object).parse();break;case"tree":f.object=Lr.from(f.object).entries();break;case"blob":o?f.object=f.object.toString(o):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=ln.from(f.object).parse();break;default:throw new Sr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function v3({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:s}=await st({fs:t,cache:e,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new Sr(n,i,"tag");let o=ln.from(s);return{oid:n,tag:o.parse(),payload:o.payload()}}async function RI({fs:t,dir:e,gitdir:r=M(e,".git"),oid:n,cache:i={}}){try{$("fs",t),$("gitdir",r),$("oid",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await v3({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.readTag",s}}async function OI({fs:t,dir:e,gitdir:r=M(e,".git"),oid:n,filepath:i=void 0,cache:s={}}){try{$("fs",t),$("gitdir",r),$("oid",n);let o=new ee(t),a=await oe({fsp:o,dotgit:r});return await rc({fs:o,cache:s,gitdir:a,oid:n,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function NI({fs:t,dir:e,gitdir:r=M(e,".git"),filepath:n,cache:i={}}){try{$("fs",t),$("gitdir",r),$("filepath",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});await kt.acquire({fs:s,gitdir:o,cache:i},async function(a){a.delete({filepath:n})})}catch(s){throw s.caller="git.remove",s}}async function b3({fs:t,cache:e,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l}){let c;try{c=await W.resolve({gitdir:n,fs:t,ref:i})}catch(g){if(!(g instanceof Je))throw g}let f=(await rc({fs:t,cache:e,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(g=>g.path!==s);let d=await pf({fs:t,gitdir:n,tree:f});return await kp({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' `,author:o,committer:a,signingKey:l})}async function FI({fs:t,onSign:e,dir:r,gitdir:n=M(r,".git"),ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l,cache:c={}}){try{$("fs",t),$("gitdir",n),$("oid",s);let u=new ee(t),f=await oe({fsp:u,dotgit:n}),d=await Ws({fs:u,gitdir:f,author:o});if(!d)throw new lr("author");let h=await Yl({fs:u,gitdir:f,author:d,committer:a});if(!h)throw new lr("committer");return await b3({fs:u,cache:c,onSign:e,gitdir:f,ref:i,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function _3({fs:t,gitdir:e,oldref:r,ref:n,checkout:i=!1}){if(!df(n,!0))throw new ni(n,Qu.clean(n));if(!df(r,!0))throw new ni(r,Qu.clean(r));let s=`refs/heads/${r}`,o=`refs/heads/${n}`;if(await W.exists({fs:t,gitdir:e,ref:o}))throw new ri("branch",n,!1);let l=await W.resolve({fs:t,gitdir:e,ref:s,depth:1});await W.writeRef({fs:t,gitdir:e,ref:o,value:l}),await W.deleteRef({fs:t,gitdir:e,ref:s});let u=await Ys({fs:t,gitdir:e,fullname:!0})===s;(i||u)&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}async function DI({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n,oldref:i,checkout:s=!1}){try{$("fs",t),$("gitdir",r),$("ref",n),$("oldref",i);let o=new ee(t),a=await oe({fsp:o,dotgit:r});return await _3({fs:o,gitdir:a,ref:n,oldref:i,checkout:s})}catch(o){throw o.caller="git.renameBranch",o}}async function zI({gitdir:t,type:e,object:r}){return fs(Vs.wrap({type:e,object:r}))}async function MI({fs:t,dir:e,gitdir:r=M(e,".git"),filepath:n,ref:i,cache:s={}}){try{$("fs",t),$("gitdir",r),$("filepath",n);let o=new ee(t),a=await oe({fsp:o,dotgit:r}),l,c;try{l=await W.resolve({fs:o,gitdir:a,ref:i||"HEAD"})}catch(d){if(i)throw d}if(l)try{l=await hf({fs:o,cache:s,gitdir:a,oid:l,filepath:n})}catch{l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await o.read(M(e,n));f&&(c=await zI({gitdir:a,type:"blob",object:f}),l===c&&(u=await o.lstat(M(e,n)))),await kt.acquire({fs:o,gitdir:a,cache:s},async function(d){d.delete({filepath:n}),l&&d.insert({filepath:n,stats:u,oid:l})})}catch(o){throw o.caller="git.reset",o}}async function LI({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n,depth:i}){try{$("fs",t),$("gitdir",r),$("ref",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});return await W.resolve({fs:s,gitdir:o,ref:n,depth:i})}catch(s){throw s.caller="git.resolveRef",s}}async function BI({fs:t,dir:e,gitdir:r=M(e,".git"),path:n,value:i,append:s=!1}){try{$("fs",t),$("gitdir",r),$("path",n);let o=new ee(t),a=await oe({fsp:o,dotgit:r}),l=await yt.get({fs:o,gitdir:a});s?await l.append(n,i):await l.set(n,i),await yt.save({fs:o,gitdir:a,config:l})}catch(o){throw o.caller="git.setConfig",o}}async function UI({fs:t,gitdir:e,commit:r}){let n=Br.from(r).toObject();return await Ur({fs:t,gitdir:e,type:"commit",object:n,format:"content"})}var bp=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,""),s="0000000000000000000000000000000000000000",o=Math.floor(Date.now()/1e3),a=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${i} ${e.email} ${o} ${a} ${n} `}static getStashReflogEntry(e,r=!1){return e.split(` `).filter(s=>s).reverse().map((s,o)=>r?`stash@{${o}}: ${s.split(" ")[1]}`:s)}},x3={stage:fa,workdir:tc},yv;async function ec(t,e){return yv===void 0&&(yv=new Gu),yv.acquire(t,e)}async function k3(t,e,r,n,i=null){let s=M(r,n),o=await t.lstat(s);if(!o)throw new Je(s);if(o.isDirectory())throw new Se(`${s}: file expected, but found directory`);let a=i?await gA({fs:t,gitdir:e,oid:i}):void 0,l=a?i:void 0;return a||await ec({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=o.isSymbolicLink()?await t.readlink(s).then(kA):await t.read(s);if(c===null)throw new Je(s);l=await Ur({fs:t,gitdir:e,type:"blob",object:c})}),l}async function S3({fs:t,dir:e,gitdir:r,entries:n}){async function i(s){if(s.type==="tree"){if(!s.oid){let o=await Promise.all(s.children.map(i));s.oid=await pf({fs:t,gitdir:r,tree:o}),s.mode=16384}}else s.type==="blob"&&(s.oid=await k3(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(n.map(i))}async function cA({fs:t,dir:e,gitdir:r,treePair:n}){let i=n[1]==="stage",s=n.map(h=>typeof h=="string"?x3[h]():h),o=[],u=await Gs({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[g,m])=>{if(!(h==="."||await Qs.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&m)return(!g||await g.oid()!==await m.oid()&&await m.oid()!==void 0)&&o.push([g,m]),{mode:await m.mode(),path:h,oid:await m.oid(),type:await m.type()}},reduce:async(h,g)=>(g=g.filter(Boolean),h?(h.children=g,h):g.length>0?g:void 0),iterate:async(h,g)=>{let m=[];for(let y of g){let[v,b]=y;i?b&&(await t.exists(`${e}/${b.toString()}`)?m.push(y):o.push([null,b])):v&&(b?m.push(y):o.push([v,null]))}return m.length?Promise.all(m.map(h)):[]}});if(o.length===0||u.length===0)return null;let d=(await S3({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return pf({fs:t,gitdir:r,tree:d})}async function E3({fs:t,dir:e,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:s}){let o=[],a=[],l=await Gs({fs:t,cache:{},dir:e,gitdir:r,trees:[an({ref:i}),an({ref:n})],map:async(c,[u,f])=>{if(c==="."||await Qs.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=f?await f.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!f&&u){let g=d==="tree"?"rmdir":"rm";return d==="tree"&&o.push(c),d==="blob"&&s&&a.push({filepath:c,oid:await u.oid()}),{method:g,filepath:c}}let h=await f.oid();if(!u||await u.oid()!==h)return d==="tree"?{method:"mkdir",filepath:c}:(s&&a.push({filepath:c,oid:h,stats:await t.lstat(M(e,c))}),{method:"write",filepath:c,oid:h})}});await ec({fs:t,gitdir:r,dirRemoved:o,ops:l},async()=>{for(let c of l){let u=M(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!o.some(f=>u.startsWith(f))){let{object:f}=await st({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,f)}break}}}),await kt.acquire({fs:t,gitdir:r,cache:{}},async c=>{a.forEach(({filepath:u,stats:f,oid:d})=>{c.insert({filepath:u,stats:f,oid:d})})})}var ua=class t{constructor({fs:e,dir:r,gitdir:n=M(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 M(this.gitdir,t.refStash)}get refLogsStashPath(){return M(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Ws({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new lr("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 UI({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 ni(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,r);return n?Zl({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return W.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let n=await this.getAuthor(),i=bp.createStashReflogEntry(n,e,r),s=this.refLogsStashPath;await ec({filepath:s,entry:i},async()=>{let o=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,o+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return bp.getStashReflogEntry(r,e)}};async function jI({fs:t,dir:e,gitdir:r,message:n=""}){let i=new ua({fs:t,dir:e,gitdir:r});await i.getAuthor();let s=await Ys({fs:t,gitdir:r,fullname:!1}),o=await W.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await Dv({fs:t,dir:e,gitdir:r,oid:o})).commit.message,c=[o],u=null,f=an({ref:"HEAD"}),d=await cA({fs:t,dir:e,gitdir:r,treePair:[an({ref:"HEAD"}),"stage"]});if(d){let y=await i.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(y),u=d,f=fa()}let h=await cA({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let y=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(y),u=h}if(!u||!d&&!h)throw new Je("changes, nothing to stash");let g=(n.trim()||`WIP on ${s}`)+`: ${o.substring(0,7)} ${l}`;return{stashCommit:await i.writeStashCommit({message:g,tree:u,parent:c}),stashMsg:g,branch:s,stashMgr:i}}async function C3({fs:t,dir:e,gitdir:r,message:n=""}){let{stashCommit:i,stashMsg:s,branch:o,stashMgr:a}=await jI({fs:t,dir:e,gitdir:r,message:n});return await a.writeStashRef(i),await a.writeStashReflogEntry({stashCommit:i,message:s}),await Ov({fs:t,dir:e,gitdir:r,ref:o,track:!1,force:!0}),i}async function T3({fs:t,dir:e,gitdir:r,message:n=""}){let{stashCommit:i}=await jI({fs:t,dir:e,gitdir:r,message:n});return i}async function qI({fs:t,dir:e,gitdir:r,refIdx:n=0}){let s=await new ua({fs:t,dir:e,gitdir:r}).readStashCommit(n),{parent:o=null}=s.commit?s.commit:{};if(!(!o||!Array.isArray(o)))for(let a=0;a{await t.exists(o)&&await t.rm(o)});let a=await i.readStashReflogs({parsed:!1});if(!a.length)return;a.splice(n,1);let l=i.refLogsStashPath;await ec({reflogEntries:a,stashReflogPath:l,stashMgr:i},async()=>{if(a.length){await t.write(l,a.reverse().join(` `)+` `,"utf8");let c=a[a.length-1].split(" ")[1];await i.writeStashRef(c)}else await t.rm(l)})}async function A3({fs:t,dir:e,gitdir:r}){return new ua({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function I3({fs:t,dir:e,gitdir:r}){let n=new ua({fs:t,dir:e,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await ec(i,async()=>{await Promise.all(i.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function P3({fs:t,dir:e,gitdir:r,refIdx:n=0}){await qI({fs:t,dir:e,gitdir:r,refIdx:n}),await VI({fs:t,dir:e,gitdir:r,refIdx:n})}async function HI({fs:t,dir:e,gitdir:r=M(e,".git"),op:n="push",message:i="",refIdx:s=0}){$("fs",t),$("dir",e),$("gitdir",r),$("op",n);let o={push:C3,apply:qI,drop:VI,list:A3,clear:I3,pop:P3,create:T3},a=["apply","drop","pop"];try{let l=new ee(t),c=await oe({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>M(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=o[n];if(f){if(a.includes(n)&&s<0)throw new ni(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:i,refIdx:s})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function GI({fs:t,dir:e,gitdir:r=M(e,".git"),filepath:n,cache:i={}}){try{$("fs",t),$("gitdir",r),$("filepath",n);let s=new ee(t),o=await oe({fsp:s,dotgit:r});if(await Qs.isIgnored({fs:s,gitdir:o,dir:e,filepath:n}))return"ignored";let l=await $3({fs:s,cache:i,gitdir:o}),c=await QI({fs:s,cache:i,gitdir:o,tree:l,path:n}),u=await kt.acquire({fs:s,gitdir:o,cache:i},async function(y){for(let v of y)if(v.path===n)return v;return null}),f=await s.lstat(M(e,n)),d=c!==null,h=u!==null,g=f!==null,m=async()=>{if(h&&!fp(u,f))return u.oid;{let y=await s.read(M(e,n)),v=await zI({gitdir:o,type:"blob",object:y});return h&&u.oid===v&&f.size!==-1&&kt.acquire({fs:s,gitdir:o,cache:i},async function(b){b.insert({filepath:n,stats:f,oid:v})}),v}};if(!d&&!g&&!h)return"absent";if(!d&&!g&&h)return"*absent";if(!d&&g&&!h)return"*added";if(!d&&g&&h)return await m()===u.oid?"added":"*added";if(d&&!g&&!h)return"deleted";if(d&&!g&&h)return c===u.oid,"*deleted";if(d&&g&&!h)return await m()===c?"*undeleted":"*undeletemodified";if(d&&g&&h){let y=await m();return y===c?y===u.oid?"unmodified":"*unmodified":y===u.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function QI({fs:t,cache:e,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let s=i.shift();for(let o of n)if(o.path===s){if(i.length===0)return o.oid;let{type:a,object:l}=await st({fs:t,cache:e,gitdir:r,oid:o.oid});if(a==="tree"){let c=Lr.from(l);return QI({fs:t,cache:e,gitdir:r,tree:c,path:i})}if(a==="blob")throw new Sr(o.oid,a,"blob",i.join("/"))}return null}async function $3({fs:t,cache:e,gitdir:r}){let n;try{n=await W.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof Je)return[]}let{tree:i}=await rc({fs:t,cache:e,gitdir:r,oid:n});return i}async function WI({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:s,cache:o={},ignored:a=!1}){try{$("fs",t),$("gitdir",r),$("ref",n);let l=new ee(t),c=await oe({fsp:l,dotgit:r});return await Gs({fs:l,cache:o,dir:e,gitdir:c,trees:[an({ref:n}),tc(),fa()],map:async function(u,[f,d,h]){if(!f&&!h&&d&&!a&&await Qs.isIgnored({fs:l,dir:e,filepath:u})||!i.some(S=>NA(u,S)))return null;if(s&&!s(u))return;let[g,m,y]=await Promise.all([f&&f.type(),d&&d.type(),h&&h.type()]),v=[g,m,y].includes("blob");if((g==="tree"||g==="special")&&!v)return;if(g==="commit")return null;if((m==="tree"||m==="special")&&!v)return;if(y==="commit")return null;if((y==="tree"||y==="special")&&!v)return;let b=g==="blob"?await f.oid():void 0,k=y==="blob"?await h.oid():void 0,E;g!=="blob"&&m==="blob"&&y!=="blob"?E="42":m==="blob"&&(E=await d.oid());let _=[void 0,b,E,k],x=_.map(S=>_.indexOf(S));return x.shift(),[u,...x]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function KI({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n,object:i,force:s=!1}){try{$("fs",t),$("gitdir",r),$("ref",n);let o=new ee(t);if(n===void 0)throw new Mr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let a=await oe({fsp:o,dotgit:r}),l=await W.resolve({fs:o,gitdir:a,ref:i||"HEAD"});if(!s&&await W.exists({fs:o,gitdir:a,ref:n}))throw new ri("tag",n);await W.writeRef({fs:o,gitdir:a,ref:n,value:l})}catch(o){throw o.caller="git.tag",o}}async function YI({fs:t,dir:e,gitdir:r=M(e,".git"),cache:n={},filepath:i,oid:s,mode:o,add:a,remove:l,force:c}){try{$("fs",t),$("gitdir",r),$("filepath",i);let u=new ee(t),f=await oe({fsp:u,dotgit:r});if(l)return await kt.acquire({fs:u,gitdir:f,cache:n},async function(h){if(!c){let g=await u.lstat(M(e,i));if(g){if(g.isDirectory())throw new Hs("directory");return}}h.has({filepath:i})&&h.delete({filepath:i})});let d;if(!s){if(d=await u.lstat(M(e,i)),!d)throw new Je(`file at "${i}" on disk and "remove" not set`);if(d.isDirectory())throw new Hs("directory")}return await kt.acquire({fs:u,gitdir:f,cache:n},async function(h){if(!a&&!h.has({filepath:i}))throw new Je(`file at "${i}" in index and "add" not set`);let g;if(s)g={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{g=d;let m=g.isSymbolicLink()?await u.readlink(M(e,i)):await u.read(M(e,i));s=await Ur({fs:u,gitdir:f,type:"blob",format:"content",object:m})}return h.insert({filepath:i,oid:s,stats:g}),s})}catch(u){throw u.caller="git.updateIndex",u}}function ZI(){try{return Sp.version}catch(t){throw t.caller="git.version",t}}async function JI({fs:t,dir:e,gitdir:r=M(e,".git"),trees:n,map:i,reduce:s,iterate:o,cache:a={}}){try{$("fs",t),$("gitdir",r),$("trees",n);let l=new ee(t),c=await oe({fsp:l,dotgit:r});return await Gs({fs:l,cache:a,dir:e,gitdir:c,trees:n,map:i,reduce:s,iterate:o})}catch(l){throw l.caller="git.walk",l}}async function XI({fs:t,dir:e,gitdir:r=M(e,".git"),blob:n}){try{$("fs",t),$("gitdir",r),$("blob",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await Ur({fs:i,gitdir:s,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function eP({fs:t,dir:e,gitdir:r=M(e,".git"),commit:n}){try{$("fs",t),$("gitdir",r),$("commit",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await UI({fs:i,gitdir:s,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function tP({fs:t,dir:e,gitdir:r=M(e,".git"),type:n,object:i,format:s="parsed",oid:o,encoding:a=void 0}){try{let l=new ee(t),c=await oe({fsp:l,dotgit:r});if(s==="parsed"){switch(n){case"commit":i=Br.from(i).toObject();break;case"tree":i=Lr.from(i).toObject();break;case"blob":i=w.from(i,a);break;case"tag":i=ln.from(i).toObject();break;default:throw new Sr(o||"",n,"blob|commit|tag|tree")}s="content"}return o=await Ur({fs:l,gitdir:c,type:n,object:i,oid:o,format:s}),o}catch(l){throw l.caller="git.writeObject",l}}async function rP({fs:t,dir:e,gitdir:r=M(e,".git"),ref:n,value:i,force:s=!1,symbolic:o=!1}){try{$("fs",t),$("gitdir",r),$("ref",n),$("value",i);let a=new ee(t);if(!df(n,!0))throw new ni(n,Qu.clean(n));let l=await oe({fsp:a,dotgit:r});if(!s&&await W.exists({fs:a,gitdir:l,ref:n}))throw new ri("ref",n);o?await W.writeSymbolicRef({fs:a,gitdir:l,ref:n,value:i}):(i=await W.resolve({fs:a,gitdir:l,ref:i}),await W.writeRef({fs:a,gitdir:l,ref:n,value:i}))}catch(a){throw a.caller="git.writeRef",a}}async function R3({fs:t,gitdir:e,tag:r}){let n=ln.from(r).toObject();return await Ur({fs:t,gitdir:e,type:"tag",object:n,format:"content"})}async function nP({fs:t,dir:e,gitdir:r=M(e,".git"),tag:n}){try{$("fs",t),$("gitdir",r),$("tag",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await R3({fs:i,gitdir:s,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function iP({fs:t,dir:e,gitdir:r=M(e,".git"),tree:n}){try{$("fs",t),$("gitdir",r),$("tree",n);let i=new ee(t),s=await oe({fsp:i,dotgit:r});return await pf({fs:i,gitdir:s,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var O3={Errors:vA,STAGE:fa,TREE:an,WORKDIR:tc,add:SA,abortMerge:_A,addNote:IA,addRemote:$A,annotatedTag:RA,branch:OA,checkout:Ov,clone:LA,commit:BA,getConfig:tI,getConfigAll:rI,setConfig:BI,currentBranch:UA,deleteBranch:jA,deleteRef:qA,deleteRemote:VA,deleteTag:HA,expandOid:GA,expandRef:QA,fastForward:YA,fetch:ZA,findMergeBase:JA,findRoot:eI,getRemoteInfo:nI,getRemoteInfo2:sI,hashBlob:oI,indexPack:aI,init:lI,isDescendent:uI,isIgnored:fI,listBranches:dI,listFiles:pI,listNotes:mI,listRefs:gI,listRemotes:yI,listServerRefs:wI,listTags:vI,log:_I,merge:xI,packObjects:SI,pull:EI,push:CI,readBlob:II,readCommit:Dv,readNote:PI,readObject:$I,readTag:RI,readTree:OI,remove:NI,removeNote:FI,renameBranch:DI,resetIndex:MI,updateIndex:YI,resolveRef:LI,status:GI,statusMatrix:WI,tag:KI,version:ZI,walk:JI,writeBlob:XI,writeCommit:eP,writeObject:tP,writeRef:rP,writeTag:nP,writeTree:iP,stash:HI};Y.Errors=vA;Y.STAGE=fa;Y.TREE=an;Y.WORKDIR=tc;Y.abortMerge=_A;Y.add=SA;Y.addNote=IA;Y.addRemote=$A;Y.annotatedTag=RA;Y.branch=OA;Y.checkout=Ov;Y.clone=LA;Y.commit=BA;Y.currentBranch=UA;Y.default=O3;Y.deleteBranch=jA;Y.deleteRef=qA;Y.deleteRemote=VA;Y.deleteTag=HA;Y.expandOid=GA;Y.expandRef=QA;Y.fastForward=YA;Y.fetch=ZA;Y.findMergeBase=JA;Y.findRoot=eI;Y.getConfig=tI;Y.getConfigAll=rI;Y.getRemoteInfo=nI;Y.getRemoteInfo2=sI;Y.hashBlob=oI;Y.indexPack=aI;Y.init=lI;Y.isDescendent=uI;Y.isIgnored=fI;Y.listBranches=dI;Y.listFiles=pI;Y.listNotes=mI;Y.listRefs=gI;Y.listRemotes=yI;Y.listServerRefs=wI;Y.listTags=vI;Y.log=_I;Y.merge=xI;Y.packObjects=SI;Y.pull=EI;Y.push=CI;Y.readBlob=II;Y.readCommit=Dv;Y.readNote=PI;Y.readObject=$I;Y.readTag=RI;Y.readTree=OI;Y.remove=NI;Y.removeNote=FI;Y.renameBranch=DI;Y.resetIndex=MI;Y.resolveRef=LI;Y.setConfig=BI;Y.stash=HI;Y.status=GI;Y.statusMatrix=WI;Y.tag=KI;Y.updateIndex=YI;Y.version=ZI;Y.walk=JI;Y.writeBlob=XI;Y.writeCommit=eP;Y.writeObject=tP;Y.writeRef=rP;Y.writeTag=nP;Y.writeTree=iP});var aP=U((yse,oP)=>{p();oP.exports=N3;function N3(t){var e,r;if(typeof t!="function")throw new Error("expected a function but got "+t);return function(){return e||(e=!0,r=t.apply(this,arguments)),r}}});var cP=U(lP=>{p();(function(t){"use strict";function e(v,b){var k;return v instanceof w?k=v:k=w.from(v.buffer,v.byteOffset,v.byteLength),k.toString(b)}var r=function(v){return w.from(v)};function n(v){for(var b=0,k=Math.min(256*256,v.length+1),E=new Uint16Array(k),_=[],x=0;;){var S=b=k-1){var C=E.subarray(0,x),T=C;if(_.push(String.fromCharCode.apply(null,T)),!S)return _.join("");v=v.subarray(b),b=0,x=0}var P=v[b++];if((P&128)===0)E[x++]=P;else if((P&224)===192){var R=v[b++]&63;E[x++]=(P&31)<<6|R}else if((P&240)===224){var R=v[b++]&63,N=v[b++]&63;E[x++]=(P&31)<<12|R<<6|N}else if((P&248)===240){var R=v[b++]&63,N=v[b++]&63,F=v[b++]&63,j=(P&7)<<18|R<<12|N<<6|F;j>65535&&(j-=65536,E[x++]=j>>>10&1023|55296,j=56320|j&1023),E[x++]=j}}}function i(v){for(var b=0,k=v.length,E=0,_=Math.max(32,k+(k>>>1)+7),x=new Uint8Array(_>>>3<<3);b=55296&&S<=56319){if(b=55296&&S<=56319)continue}if(E+4>x.length){_+=8,_*=1+b/v.length*2,_=_>>>3<<3;var T=new Uint8Array(_);T.set(x),x=T}if((S&4294967168)===0){x[E++]=S;continue}else if((S&4294965248)===0)x[E++]=S>>>6&31|192;else if((S&4294901760)===0)x[E++]=S>>>12&15|224,x[E++]=S>>>6&63|128;else if((S&4292870144)===0)x[E++]=S>>>18&7|240,x[E++]=S>>>12&63|128,x[E++]=S>>>6&63|128;else continue;x[E++]=S&63|128}return x.slice?x.slice(0,E):x.subarray(0,E)}var s="Failed to ",o=function(v,b,k){if(v)throw new Error("".concat(s).concat(b,": the '").concat(k,"' option is unsupported."))},a=typeof w=="function"&&w.from,l=a?r:i;function c(){this.encoding="utf-8"}c.prototype.encode=function(v,b){return o(b&&b.stream,"encode","stream"),l(v)};function u(v){var b;try{var k=new Blob([v],{type:"text/plain;charset=UTF-8"});b=URL.createObjectURL(k);var E=new XMLHttpRequest;return E.open("GET",b,!1),E.send(),E.responseText}finally{b&&URL.revokeObjectURL(b)}}var f=!a&&typeof Blob=="function"&&typeof URL=="function"&&typeof URL.createObjectURL=="function",d=["utf-8","utf8","unicode-1-1-utf-8"],h=n;a?h=e:f&&(h=function(v){try{return u(v)}catch{return n(v)}});var g="construct 'TextDecoder'",m="".concat(s," ").concat(g,": the ");function y(v,b){o(b&&b.fatal,g,"fatal"),v=v||"utf-8";var k;if(a?k=w.isEncoding(v):k=d.indexOf(v.toLowerCase())!==-1,!k)throw new RangeError("".concat(m," encoding label provided ('").concat(v,"') is invalid."));this.encoding=v,this.fatal=!1,this.ignoreBOM=!1}y.prototype.decode=function(v,b){o(b&&b.stream,"decode","stream");var k;return v instanceof Uint8Array?k=v:v.buffer instanceof ArrayBuffer?k=new Uint8Array(v.buffer):k=new Uint8Array(v),h(k,this.encoding)},t.TextEncoder=t.TextEncoder||c,t.TextDecoder=t.TextDecoder||y})(typeof window<"u"?window:typeof globalThis<"u"?globalThis:lP)});var fP=U((_se,uP)=>{p();cP();uP.exports={encode:t=>new TextEncoder().encode(t),decode:t=>new TextDecoder().decode(t)}});var hP=U((kse,dP)=>{p();dP.exports=F3;function F3(t,e,r){var n;return function(){if(!e)return t.apply(this,arguments);var i=this,s=arguments,o=r&&!n;if(clearTimeout(n),n=setTimeout(function(){if(n=null,!o)return t.apply(i,s)},e),o)return t.apply(this,arguments)}}});var Ep=U((Ese,gP)=>{p();function pP(t){if(t.length===0)return".";let e=mP(t);return e=e.reduce(L3,[]),zv(...e)}function D3(...t){let e="";for(let r of t)r.startsWith("/")?e=r:e=pP(zv(e,r));return e}function zv(...t){if(t.length===0)return"";let e=t.join("/");return e=e.replace(/\/{2,}/g,"/"),e}function mP(t){if(t.length===0)return[];if(t==="/")return["/"];let e=t.split("/");return e[e.length-1]===""&&e.pop(),t[0]==="/"?e[0]="/":e[0]!=="."&&e.unshift("."),e}function z3(t){let e=t.lastIndexOf("/");if(e===-1)throw new Error(`Cannot get dirname of "${t}"`);return e===0?"/":t.slice(0,e)}function M3(t){if(t==="/")throw new Error(`Cannot get basename of "${t}"`);let e=t.lastIndexOf("/");return e===-1?t:t.slice(e+1)}function L3(t,e){if(t.length===0)return t.push(e),t;if(e===".")return t;if(e===".."){if(t.length===1){if(t[0]==="/")throw new Error("Unable to normalize path - traverses above root directory");if(t[0]===".")return t.push(e),t}return t[t.length-1]===".."?(t.push(".."),t):(t.pop(),t)}return t.push(e),t}gP.exports={join:zv,normalize:pP,split:mP,basename:M3,dirname:z3,resolve:D3}});var Mv=U((Tse,yP)=>{p();function nc(t){return class extends Error{constructor(...e){super(...e),this.code=t,this.message?this.message=t+": "+this.message:this.message=t}}}var B3=nc("EEXIST"),U3=nc("ENOENT"),j3=nc("ENOTDIR"),q3=nc("ENOTEMPTY"),V3=nc("ETIMEDOUT"),H3=nc("EISDIR");yP.exports={EEXIST:B3,ENOENT:U3,ENOTDIR:j3,ENOTEMPTY:q3,ETIMEDOUT:V3,EISDIR:H3}});var _P=U(($se,bP)=>{p();var Er=Ep(),{EEXIST:wP,ENOENT:G3,ENOTDIR:vP,ENOTEMPTY:Q3,EISDIR:W3}=Mv(),cr=0;bP.exports=class{constructor(){}_makeRoot(e=new Map){return e.set(cr,{mode:511,type:"dir",size:0,ino:0,mtimeMs:Date.now()}),e}activate(e=null){e===null?this._root=new Map([["/",this._makeRoot()]]):typeof e=="string"?this._root=new Map([["/",this._makeRoot(this.parse(e))]]):this._root=e}get activated(){return!!this._root}deactivate(){this._root=void 0}size(){return this._countInodes(this._root.get("/"))-1}_countInodes(e){let r=1;for(let[n,i]of e)n!==cr&&(r+=this._countInodes(i));return r}autoinc(){return this._maxInode(this._root.get("/"))+1}_maxInode(e){let r=e.get(cr).ino;for(let[n,i]of e)n!==cr&&(r=Math.max(r,this._maxInode(i)));return r}print(e=this._root.get("/")){let r="",n=(i,s)=>{for(let[o,a]of i){if(o===0)continue;let l=a.get(cr),c=l.mode.toString(8);r+=`${" ".repeat(s)}${o} ${c}`,l.type==="file"?r+=` ${l.size} ${l.mtimeMs} `:(r+=` `,n(a,s+1))}};return n(e,0),r}parse(e){let r=0;function n(a){let l=++r,c=a.length===1?"dir":"file",[u,f,d]=a;return u=parseInt(u,8),f=f?parseInt(f):0,d=d?parseInt(d):Date.now(),new Map([[cr,{mode:u,type:c,size:f,mtimeMs:d,ino:l}]])}let i=e.trim().split(` `),s=this._makeRoot(),o=[{indent:-1,node:s},{indent:0,node:null}];for(let a of i){let c=a.match(/^\t*/)[0].length;a=a.slice(c);let[u,...f]=a.split(" "),d=n(f);if(c<=o[o.length-1].indent)for(;c<=o[o.length-1].indent;)o.pop();o.push({indent:c,node:d}),o[o.length-2].node.set(u,d)}return s}_lookup(e,r=!0){let n=this._root,i="/",s=Er.split(e);for(let o=0;o1)throw new Q3;let n=this._lookup(Er.dirname(e)),i=Er.basename(e);n.delete(i)}readdir(e){let r=this._lookup(e);if(r.get(cr).type!=="dir")throw new vP;return[...r.keys()].filter(n=>typeof n=="string")}writeStat(e,r,{mode:n}){let i,s;try{s=this.stat(e)}catch{}if(s!==void 0){if(s.type==="dir")throw new W3;n==null&&(n=s.mode),i=s.ino}n==null&&(n=438),i==null&&(i=this.autoinc());let o=this._lookup(Er.dirname(e)),a=Er.basename(e),l={mode:n,type:"file",size:r,mtimeMs:Date.now(),ino:i},c=new Map;return c.set(cr,l),o.set(a,c),l}unlink(e){let r=this._lookup(Er.dirname(e)),n=Er.basename(e);r.delete(n)}rename(e,r){let n=Er.basename(r),i=this._lookup(e);this._lookup(Er.dirname(r)).set(n,i),this.unlink(e)}stat(e){return this._lookup(e).get(cr)}lstat(e){return this._lookup(e,!1).get(cr)}readlink(e){return this._lookup(e,!1).get(cr).target}symlink(e,r){let n,i;try{let c=this.stat(r);i===null&&(i=c.mode),n=c.ino}catch{}i==null&&(i=40960),n==null&&(n=this.autoinc());let s=this._lookup(Er.dirname(r)),o=Er.basename(r),a={mode:i,type:"symlink",target:e,size:0,mtimeMs:Date.now(),ino:n},l=new Map;return l.set(cr,a),s.set(o,l),a}_du(e){let r=0;for(let[n,i]of e.entries())n===cr?r+=i.size:r+=this._du(i);return r}du(e){let r=this._lookup(e);return this._du(r)}}});var Bv=U(Ri=>{"use strict";p();Object.defineProperty(Ri,"__esModule",{value:!0});var Cp=class{constructor(e="keyval-store",r="keyval"){this.storeName=r,this._dbName=e,this._storeName=r,this._init()}_init(){this._dbp||(this._dbp=new Promise((e,r)=>{let n=indexedDB.open(this._dbName);n.onerror=()=>r(n.error),n.onsuccess=()=>e(n.result),n.onupgradeneeded=()=>{n.result.createObjectStore(this._storeName)}}))}_withIDBStore(e,r){return this._init(),this._dbp.then(n=>new Promise((i,s)=>{let o=n.transaction(this.storeName,e);o.oncomplete=()=>i(),o.onabort=o.onerror=()=>s(o.error),r(o.objectStore(this.storeName))}))}_close(){return this._init(),this._dbp.then(e=>{e.close(),this._dbp=void 0})}},Lv;function da(){return Lv||(Lv=new Cp),Lv}function K3(t,e=da()){let r;return e._withIDBStore("readwrite",n=>{r=n.get(t)}).then(()=>r.result)}function Y3(t,e,r=da()){return r._withIDBStore("readwrite",n=>{n.put(e,t)})}function Z3(t,e,r=da()){return r._withIDBStore("readwrite",n=>{let i=n.get(t);i.onsuccess=()=>{n.put(e(i.result),t)}})}function J3(t,e=da()){return e._withIDBStore("readwrite",r=>{r.delete(t)})}function X3(t=da()){return t._withIDBStore("readwrite",e=>{e.clear()})}function e8(t=da()){let e=[];return t._withIDBStore("readwrite",r=>{(r.openKeyCursor||r.openCursor).call(r).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())}}).then(()=>e)}function t8(t=da()){return t._close()}Ri.Store=Cp;Ri.get=K3;Ri.set=Y3;Ri.update=Z3;Ri.del=J3;Ri.clear=X3;Ri.keys=e8;Ri.close=t8});var kP=U((Dse,xP)=>{p();var Zs=Bv();xP.exports=class{constructor(e,r){this._database=e,this._storename=r,this._store=new Zs.Store(this._database,this._storename)}saveSuperblock(e){return Zs.set("!root",e,this._store)}loadSuperblock(){return Zs.get("!root",this._store)}readFile(e){return Zs.get(e,this._store)}writeFile(e,r){return Zs.set(e,r,this._store)}unlink(e){return Zs.del(e,this._store)}wipe(){return Zs.clear(this._store)}close(){return Zs.close(this._store)}}});var EP=U((Lse,SP)=>{p();SP.exports=class{constructor(e){this._url=e}loadSuperblock(){return fetch(this._url+"/.superblock.txt").then(e=>e.ok?e.text():null)}async readFile(e){let r=await fetch(this._url+e);if(r.status===200)return r.arrayBuffer();throw new Error("ENOENT")}async sizeFile(e){let r=await fetch(this._url+e,{method:"HEAD"});if(r.status===200)return r.headers.get("content-length");throw new Error("ENOENT")}}});var TP=U((jse,CP)=>{p();var gf=Bv(),r8=t=>new Promise(e=>setTimeout(e,t));CP.exports=class{constructor(e,r){this._id=Math.random(),this._database=e,this._storename=r,this._store=new gf.Store(this._database,this._storename),this._lock=null}async has({margin:e=2e3}={}){if(this._lock&&this._lock.holder===this._id){let r=Date.now();return this._lock.expires>r+e?!0:await this.renew()}else return!1}async renew({ttl:e=5e3}={}){let r;return await gf.update("lock",n=>{let s=Date.now()+e;return r=n&&n.holder===this._id,this._lock=r?{holder:this._id,expires:s}:n,this._lock},this._store),r}async acquire({ttl:e=5e3}={}){let r,n,i;if(await gf.update("lock",s=>{let o=Date.now(),a=o+e;return n=s&&s.expires(r=e||s&&s.holder===this._id,n=s===void 0,i=s&&s.holder!==this._id,this._lock=r?void 0:s,this._lock),this._store),await gf.close(this._store),!r&&!e){if(n)throw new Error("Mutex double-freed");if(i)throw new Error("Mutex lost ownership")}return r}}});var IP=U((Hse,AP)=>{p();AP.exports=class{constructor(e){this._id=Math.random(),this._database=e,this._has=!1,this._release=null}async has(){return this._has}async acquire(){return new Promise(e=>{navigator.locks.request(this._database+"_lock",{ifAvailable:!0},r=>(this._has=!!r,e(!!r),new Promise(n=>{this._release=n})))})}async wait({timeout:e=6e5}={}){return new Promise((r,n)=>{let i=new AbortController;setTimeout(()=>{i.abort(),n(new Error("Mutex timeout"))},e),navigator.locks.request(this._database+"_lock",{signal:i.signal},s=>(this._has=!!s,r(!!s),new Promise(o=>{this._release=o})))})}async release({force:e=!1}={}){this._has=!1,this._release?this._release():e&&navigator.locks.request(this._database+"_lock",{steal:!0},r=>!0)}}});var RP=U((Wse,$P)=>{p();var{encode:n8,decode:PP}=fP(),i8=hP(),s8=_P(),{ENOENT:o8,ENOTEMPTY:a8,ETIMEDOUT:l8}=Mv(),c8=kP(),u8=EP(),f8=TP(),d8=IP(),yf=Ep();$P.exports=class{constructor(){this.saveSuperblock=i8(()=>{this.flush()},500)}async init(e,{wipe:r,url:n,urlauto:i,fileDbName:s=e,db:o=null,fileStoreName:a=e+"_files",lockDbName:l=e+"_lock",lockStoreName:c=e+"_lock"}={}){this._name=e,this._idb=o||new c8(s,a),this._mutex=navigator.locks?new d8(e):new f8(l,c),this._cache=new s8(e),this._opts={wipe:r,url:n},this._needsWipe=!!r,n&&(this._http=new u8(n),this._urlauto=!!i)}async activate(){if(this._cache.activated)return;this._needsWipe&&(this._needsWipe=!1,await this._idb.wipe(),await this._mutex.release({force:!0})),await this._mutex.has()||await this._mutex.wait();let e=await this._idb.loadSuperblock();if(e)this._cache.activate(e);else if(this._http){let r=await this._http.loadSuperblock();this._cache.activate(r),await this._saveSuperblock()}else this._cache.activate();if(!await this._mutex.has())throw new l8}async deactivate(){await this._mutex.has()&&await this._saveSuperblock(),this._cache.deactivate();try{await this._mutex.release()}catch{}await this._idb.close()}async _saveSuperblock(){this._cache.activated&&(this._lastSavedAt=Date.now(),await this._idb.saveSuperblock(this._cache._root))}_writeStat(e,r,n){let i=yf.split(yf.dirname(e)),s=i.shift();for(let o of i){s=yf.join(s,o);try{this._cache.mkdir(s,{mode:511})}catch{}}return this._cache.writeStat(e,r,n)}async readFile(e,r){let n=typeof r=="string"?r:r&&r.encoding;if(n&&n!=="utf8")throw new Error('Only "utf8" encoding is supported in readFile');let i=null,s=null;try{s=this._cache.stat(e),i=await this._idb.readFile(s.ino)}catch(o){if(!this._urlauto)throw o}if(!i&&this._http){let o=this._cache.lstat(e);for(;o.type==="symlink";)e=yf.resolve(yf.dirname(e),o.target),o=this._cache.lstat(e);i=await this._http.readFile(e)}if(i&&((!s||s.size!=i.byteLength)&&(s=await this._writeStat(e,i.byteLength,{mode:s?s.mode:438}),this.saveSuperblock()),n==="utf8"?i=PP(i):i.toString=()=>PP(i)),!s)throw new o8(e);return i}async writeFile(e,r,n){let{mode:i,encoding:s="utf8"}=n;if(typeof r=="string"){if(s!=="utf8")throw new Error('Only "utf8" encoding is supported in writeFile');r=n8(r)}let o=await this._cache.writeStat(e,r.byteLength,{mode:i});await this._idb.writeFile(o.ino,r)}async unlink(e,r){let n=this._cache.lstat(e);this._cache.unlink(e),n.type!=="symlink"&&await this._idb.unlink(n.ino)}readdir(e,r){return this._cache.readdir(e)}mkdir(e,r){let{mode:n=511}=r;this._cache.mkdir(e,{mode:n})}rmdir(e,r){if(e==="/")throw new a8;this._cache.rmdir(e)}rename(e,r){this._cache.rename(e,r)}stat(e,r){return this._cache.stat(e)}lstat(e,r){return this._cache.lstat(e)}readlink(e,r){return this._cache.readlink(e)}symlink(e,r){this._cache.symlink(e,r)}async backFile(e,r){let n=await this._http.sizeFile(e);await this._writeStat(e,n,r)}du(e){return this._cache.du(e)}flush(){return this._saveSuperblock()}}});var NP=U((Zse,OP)=>{p();OP.exports=class{constructor(e){this.type=e.type,this.mode=e.mode,this.size=e.size,this.ino=e.ino,this.mtimeMs=e.mtimeMs,this.ctimeMs=e.ctimeMs||e.mtimeMs,this.uid=1,this.gid=1,this.dev=1}isFile(){return this.type==="file"}isDirectory(){return this.type==="dir"}isSymbolicLink(){return this.type==="symlink"}}});var MP=U((eoe,zP)=>{p();var h8=RP(),FP=NP(),Tp=Ep();function Oi(t,e,...r){return t=Tp.normalize(t),(typeof e>"u"||typeof e=="function")&&(e={}),typeof e=="string"&&(e={encoding:e}),[t,e,...r]}function p8(t,e,r,...n){return t=Tp.normalize(t),(typeof r>"u"||typeof r=="function")&&(r={}),typeof r=="string"&&(r={encoding:r}),[t,e,r,...n]}function DP(t,e,...r){return[Tp.normalize(t),Tp.normalize(e),...r]}zP.exports=class{constructor(e,r={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,Oi,!1),this.writeFile=this._wrap(this.writeFile,p8,!0),this.unlink=this._wrap(this.unlink,Oi,!0),this.readdir=this._wrap(this.readdir,Oi,!1),this.mkdir=this._wrap(this.mkdir,Oi,!0),this.rmdir=this._wrap(this.rmdir,Oi,!0),this.rename=this._wrap(this.rename,DP,!0),this.stat=this._wrap(this.stat,Oi,!1),this.lstat=this._wrap(this.lstat,Oi,!1),this.readlink=this._wrap(this.readlink,Oi,!1),this.symlink=this._wrap(this.symlink,DP,!0),this.backFile=this._wrap(this.backFile,Oi,!0),this.du=this._wrap(this.du,Oi,!1),this._deactivationPromise=null,this._deactivationTimeout=null,this._activationPromise=null,this._operations=new Set,e&&this.init(e,r)}async init(...e){return this._initPromiseResolve&&await this._initPromise,this._initPromise=this._init(...e),this._initPromise}async _init(e,r={}){await this._gracefulShutdown(),this._activationPromise&&await this._deactivate(),this._backend&&this._backend.destroy&&await this._backend.destroy(),this._backend=r.backend||new h8,this._backend.init&&await this._backend.init(e,r),this._initPromiseResolve&&(this._initPromiseResolve(),this._initPromiseResolve=null),r.defer||this.stat("/")}async _gracefulShutdown(){this._operations.size>0&&(this._isShuttingDown=!0,await new Promise(e=>this._gracefulShutdownResolve=e),this._isShuttingDown=!1,this._gracefulShutdownResolve=null)}_wrap(e,r,n){return async(...i)=>{i=r(...i);let s={name:e.name,args:i};this._operations.add(s);try{return await this._activate(),await e.apply(this,i)}finally{this._operations.delete(s),n&&this._backend.saveSuperblock(),this._operations.size===0&&(this._deactivationTimeout||clearTimeout(this._deactivationTimeout),this._deactivationTimeout=setTimeout(this._deactivate.bind(this),500))}}}async _activate(){this._initPromise,await this._initPromise,this._deactivationTimeout&&(clearTimeout(this._deactivationTimeout),this._deactivationTimeout=null),this._deactivationPromise&&await this._deactivationPromise,this._deactivationPromise=null,this._activationPromise||(this._activationPromise=this._backend.activate?this._backend.activate():Promise.resolve()),await this._activationPromise}async _deactivate(){return this._activationPromise&&await this._activationPromise,this._deactivationPromise||(this._deactivationPromise=this._backend.deactivate?this._backend.deactivate():Promise.resolve()),this._activationPromise=null,this._gracefulShutdownResolve&&this._gracefulShutdownResolve(),this._deactivationPromise}async readFile(e,r){return this._backend.readFile(e,r)}async writeFile(e,r,n){return await this._backend.writeFile(e,r,n),null}async unlink(e,r){return await this._backend.unlink(e,r),null}async readdir(e,r){return this._backend.readdir(e,r)}async mkdir(e,r){return await this._backend.mkdir(e,r),null}async rmdir(e,r){return await this._backend.rmdir(e,r),null}async rename(e,r){return await this._backend.rename(e,r),null}async stat(e,r){let n=await this._backend.stat(e,r);return new FP(n)}async lstat(e,r){let n=await this._backend.lstat(e,r);return new FP(n)}async readlink(e,r){return this._backend.readlink(e,r)}async symlink(e,r){return await this._backend.symlink(e,r),null}async backFile(e,r){return await this._backend.backFile(e,r),null}async du(e){return this._backend.du(e)}async flush(){return this._backend.flush()}}});var BP=U((noe,LP)=>{p();var m8=aP(),g8=MP();function jr(t,e){return typeof t=="function"&&(e=t),e=m8(e),[(...n)=>e(null,...n),e]}LP.exports=class{constructor(...e){this.promises=new g8(...e),this.init=this.init.bind(this),this.readFile=this.readFile.bind(this),this.writeFile=this.writeFile.bind(this),this.unlink=this.unlink.bind(this),this.readdir=this.readdir.bind(this),this.mkdir=this.mkdir.bind(this),this.rmdir=this.rmdir.bind(this),this.rename=this.rename.bind(this),this.stat=this.stat.bind(this),this.lstat=this.lstat.bind(this),this.readlink=this.readlink.bind(this),this.symlink=this.symlink.bind(this),this.backFile=this.backFile.bind(this),this.du=this.du.bind(this),this.flush=this.flush.bind(this)}init(e,r){return this.promises.init(e,r)}readFile(e,r,n){let[i,s]=jr(r,n);this.promises.readFile(e,r).then(i).catch(s)}writeFile(e,r,n,i){let[s,o]=jr(n,i);this.promises.writeFile(e,r,n).then(s).catch(o)}unlink(e,r,n){let[i,s]=jr(r,n);this.promises.unlink(e,r).then(i).catch(s)}readdir(e,r,n){let[i,s]=jr(r,n);this.promises.readdir(e,r).then(i).catch(s)}mkdir(e,r,n){let[i,s]=jr(r,n);this.promises.mkdir(e,r).then(i).catch(s)}rmdir(e,r,n){let[i,s]=jr(r,n);this.promises.rmdir(e,r).then(i).catch(s)}rename(e,r,n){let[i,s]=jr(n);this.promises.rename(e,r).then(i).catch(s)}stat(e,r,n){let[i,s]=jr(r,n);this.promises.stat(e).then(i).catch(s)}lstat(e,r,n){let[i,s]=jr(r,n);this.promises.lstat(e).then(i).catch(s)}readlink(e,r,n){let[i,s]=jr(r,n);this.promises.readlink(e).then(i).catch(s)}symlink(e,r,n){let[i,s]=jr(n);this.promises.symlink(e,r).then(i).catch(s)}backFile(e,r,n){let[i,s]=jr(r,n);this.promises.backFile(e,r).then(i).catch(s)}du(e,r){let[n,i]=jr(r);this.promises.du(e).then(n).catch(i)}flush(e){let[r,n]=jr(e);this.promises.flush().then(r).catch(n)}}});function qe(t){if(t&&typeof t=="object")switch(t[Ir]){case di:case bs:return!0}return!1}function De(t){if(t&&typeof t=="object")switch(t[Ir]){case lm:case di:case xn:case bs:return!0}return!1}var lm,cm,di,Mb,xn,bs,Ir,Qr,kn,Sn,Ne,Ie,En,um,Ue=K(()=>{p();lm=Symbol.for("yaml.alias"),cm=Symbol.for("yaml.document"),di=Symbol.for("yaml.map"),Mb=Symbol.for("yaml.pair"),xn=Symbol.for("yaml.scalar"),bs=Symbol.for("yaml.seq"),Ir=Symbol.for("yaml.node.type"),Qr=t=>!!t&&typeof t=="object"&&t[Ir]===lm,kn=t=>!!t&&typeof t=="object"&&t[Ir]===cm,Sn=t=>!!t&&typeof t=="object"&&t[Ir]===di,Ne=t=>!!t&&typeof t=="object"&&t[Ir]===Mb,Ie=t=>!!t&&typeof t=="object"&&t[Ir]===xn,En=t=>!!t&&typeof t=="object"&&t[Ir]===bs;um=t=>(Ie(t)||qe(t))&&!!t.anchor});function Hn(t,e){let r=vR(e);kn(t)?bc(null,t.contents,r,Object.freeze([t]))===Vi&&(t.contents=null):bc(null,t,r,Object.freeze([]))}function bc(t,e,r,n){let i=bR(t,e,r,n);if(De(i)||Ne(i))return _R(t,n,i),bc(t,i,r,n);if(typeof i!="symbol"){if(qe(e)){n=Object.freeze(n.concat(e));for(let s=0;s{p();Ue();Wr=Symbol("break visit"),wR=Symbol("skip children"),Vi=Symbol("remove node");Hn.BREAK=Wr;Hn.SKIP=wR;Hn.REMOVE=Vi;xc.BREAK=Wr;xc.SKIP=wR;xc.REMOVE=Vi});var wV,vV,Hi,Lb=K(()=>{p();Ue();Qf();wV={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},vV=t=>t.replace(/[!,[\]{}]/g,e=>wV[e]),Hi=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+vV(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&De(e.contents)){let s={};Hn(e.contents,(o,a)=>{De(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(` `)}};Hi.defaultYaml={explicit:!1,version:"1.2"};Hi.defaultTags={"!!":"tag:yaml.org,2002:"}});function fm(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function Bb(t){let e=new Set;return Hn(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function Ub(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function xR(t,e){let r=[],n=new Map,i=null;return{onAnchor:s=>{r.push(s),i??(i=Bb(t));let o=Ub(e,i);return i.add(o),o},setAnchors:()=>{for(let s of r){let o=n.get(s);if(typeof o=="object"&&o.anchor&&(Ie(o.node)||qe(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:n}}var dm=K(()=>{p();Ue();Qf()});function lo(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,s=n.length;i{p()});function Ft(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Ft(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!um(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=s=>{n.res=s,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}var co=K(()=>{p();Ue()});var uo,hm=K(()=>{p();jb();Ue();co();uo=class{constructor(e){Object.defineProperty(this,Ir,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:s}={}){if(!kn(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Ft(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof s=="function"?lo(s,{"":a},"",a):a}}});function pm(t,e,r){if(Qr(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(qe(e)){let n=0;for(let i of e.items){let s=pm(t,i,r);s>n&&(n=s)}return n}else if(Ne(e)){let n=pm(t,e.key,r),i=pm(t,e.value,r);return Math.max(n,i)}return 1}var hi,Wf=K(()=>{p();dm();Qf();Ue();hm();co();hi=class extends uo{constructor(e){super(lm),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Hn(e,{Node:(s,o)=>{(Qr(o)||um(o))&&n.push(o)}}),r&&(r.aliasResolveCache=n));let i;for(let s of n){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:s}=r,o=this.resolve(i,r);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(Ft(o,null,r),a=n.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=pm(i,o,n)),a.count*a.aliasCount>s)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(fm(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}}});var mm,X,Tt=K(()=>{p();Ue();hm();co();mm=t=>!t||typeof t!="function"&&typeof t!="object",X=class extends uo{constructor(e){super(xn),this.value=e}toJSON(e,r){return r?.keep?this.value:Ft(this.value,e,r)}toString(){return String(this.value)}};X.BLOCK_FOLDED="BLOCK_FOLDED";X.BLOCK_LITERAL="BLOCK_LITERAL";X.PLAIN="PLAIN";X.QUOTE_DOUBLE="QUOTE_DOUBLE";X.QUOTE_SINGLE="QUOTE_SINGLE"});function _V(t,e,r){if(e){let n=r.filter(s=>s.tag===e),i=n.find(s=>!s.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function _s(t,e,r){if(kn(t)&&(t=t.contents),De(t))return t;if(Ne(t)){let f=r.schema[di].createNode?.(r.schema,null,r);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:s,schema:o,sourceObjects:a}=r,l;if(n&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=i(t)),new hi(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=bV+e.slice(2));let c=_V(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new X(t);return l&&(l.node=f),f}c=t instanceof Map?o[di]:Symbol.iterator in Object(t)?o[bs]:o[di]}s&&(s(c),delete r.onTagObj);let u=c?.createNode?c.createNode(r.schema,t,r):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(r.schema,t,r):new X(t);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}var bV,Kf=K(()=>{p();Wf();Ue();Tt();bV="tag:yaml.org,2002:"});function Yf(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=n,n=o}else n=new Map([[s,n]])}return _s(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Sc,kc,gm=K(()=>{p();Kf();Ue();hm();Sc=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,kc=class extends uo{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>De(n)||Ne(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Sc(e))this.add(r);else{let[n,...i]=e,s=this.get(n,!0);if(qe(s))s.addIn(i,r);else if(s===void 0&&this.schema)this.set(n,Yf(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(qe(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,s=this.get(n,!0);return i.length===0?!r&&Ie(s)?s.value:s:qe(s)?s.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ne(r))return!1;let n=r.value;return n==null||e&&Ie(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return qe(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let s=this.get(n,!0);if(qe(s))s.setIn(i,r);else if(s===void 0&&this.schema)this.set(n,Yf(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}});function Gn(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var kR,Gi,Zf=K(()=>{p();kR=t=>t.replace(/^(?!$)(?: $)?/gm,"#");Gi=(t,e,r)=>t.endsWith(` `)?Gn(r,e):r.includes(` `)?` `+Gn(r,e):(t.endsWith(" ")?"":" ")+r});function Xf(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,s)?c.push(0):f=i-n);let d,h,g=!1,m=-1,y=-1,v=-1;r===ym&&(m=SR(t,m,e.length),m!==-1&&(f=m+l));for(let k;k=t[m+=1];){if(r===Jf&&k==="\\"){switch(y=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}v=m}if(k===` `)r===ym&&(m=SR(t,m,e.length)),f=m+e.length+l,d=void 0;else{if(k===" "&&h&&h!==" "&&h!==` `&&h!==" "){let E=t[m+1];E&&E!==" "&&E!==` `&&E!==" "&&(d=m)}if(m>=f)if(d)c.push(d),f=d+l,d=void 0;else if(r===Jf){for(;h===" "||h===" ";)h=k,k=t[m+=1],g=!0;let E=m>v+1?m-2:y-1;if(u[E])return t;c.push(E),u[E]=!0,f=E+l,d=void 0}else g=!0}h=k}if(g&&a&&a(),c.length===0)return t;o&&o();let b=t.slice(0,c[0]);for(let k=0;k{p();qb="flow",ym="block",Jf="quoted"});function xV(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let s=0,o=0;sn)return!0;if(o=s+1,i-o<=n)return!1}return!0}function ed(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(bm(t)?" ":""),o="",a=0;for(let l=0,c=r[l];c;c=r[++l])if(c===" "&&r[l+1]==="\\"&&r[l+2]==="n"&&(o+=r.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(r[l+1]){case"u":{o+=r.slice(a,l);let u=r.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||r[l+2]==='"'||r.length `;let f,d;for(d=r.length;d>0;--d){let _=r[d-1];if(_!==` `&&_!==" "&&_!==" ")break}let h=r.substring(d),g=h.indexOf(` `);g===-1?f="-":r===h||g!==h.length-1?(f="+",s&&s()):f="",h&&(r=r.slice(0,-h.length),h[h.length-1]===` `&&(h=h.slice(0,-1)),h=h.replace(Hb,`$&${c}`));let m=!1,y,v=-1;for(y=0;y{x=!0});let C=Xf(`${b}${_}${h}`,c,ym,S);if(!x)return`>${E} ${c}${C}`}return r=r.replace(/\n+/g,`$&${c}`),`|${E} ${c}${b}${r}${h}`}function kV(t,e,r,n){let{type:i,value:s}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&s.includes(` `)||u&&/[[\]{},]/.test(s))return Ec(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||u||!s.includes(` `)?Ec(s,e):wm(t,e,r,n);if(!a&&!u&&i!==X.PLAIN&&s.includes(` `))return wm(t,e,r,n);if(bm(s)){if(l==="")return e.forceBlockIndent=!0,wm(t,e,r,n);if(a&&l===c)return Ec(s,e)}let f=s.replace(/\n+/g,`$& ${l}`);if(o){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h?.some(d))return Ec(s,e)}return a?f:Xf(f,l,qb,vm(e,!1))}function xs(t,e,r,n){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==X.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=X.QUOTE_DOUBLE);let l=u=>{switch(u){case X.BLOCK_FOLDED:case X.BLOCK_LITERAL:return i||s?Ec(o.value,e):wm(o,e,r,n);case X.QUOTE_DOUBLE:return ed(o.value,e);case X.QUOTE_SINGLE:return Vb(o.value,e);case X.PLAIN:return kV(o,e,r,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}var vm,bm,Hb,td=K(()=>{p();Tt();ER();vm=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),bm=t=>/^(%|---|\.\.\.)/m.test(t);try{Hb=new RegExp(`(^|(?s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let r,n;if(Ie(e)){n=e.value;let i=t.filter(s=>s.identify?.(n));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}r=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function EV(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],s=(Ie(t)||qe(t))&&t.anchor;s&&fm(s)&&(r.add(s),i.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function ks(t,e,r,n){if(Ne(t))return t.toString(e,r,n);if(Qr(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,s=De(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=SV(e.doc.schema.tags,s));let o=EV(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(s,e,r,n):Ie(s)?xs(s,e,r,n):s.toString(e,r,n);return o?Ie(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} ${e.indent}${a}`:a}var rd=K(()=>{p();dm();Ue();Zf();td()});function CR({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=r,d=De(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(qe(t)||!De(t)&&typeof t=="object"){let S="With simple keys, collection cannot be used as a key value";throw new Error(S)}}let h=!f&&(!t||d&&e==null&&!r.inFlow||qe(t)||(Ie(t)?t.type===X.BLOCK_FOLDED||t.type===X.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!h&&(f||!s),indent:a+l});let g=!1,m=!1,y=ks(t,r,()=>g=!0,()=>m=!0);if(!h&&!r.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(r.inFlow){if(s||e==null)return g&&n&&n(),y===""?"?":h?`? ${y}`:y}else if(s&&!f||e==null&&h)return y=`? ${y}`,d&&!g?y+=Gi(y,r.indent,c(d)):m&&i&&i(),y;g&&(d=null),h?(d&&(y+=Gi(y,r.indent,c(d))),y=`? ${y} ${a}:`):(y=`${y}:`,d&&(y+=Gi(y,r.indent,c(d))));let v,b,k;De(e)?(v=!!e.spaceBefore,b=e.commentBefore,k=e.comment):(v=!1,b=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!h&&!d&&Ie(e)&&(r.indentAtStart=y.length+1),m=!1,!u&&l.length>=2&&!r.inFlow&&!h&&En(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let E=!1,_=ks(e,r,()=>E=!0,()=>m=!0),x=" ";if(d||v||b){if(x=v?` `:"",b){let S=c(b);x+=` ${Gn(S,r.indent)}`}_===""&&!r.inFlow?x===` `&&k&&(x=` `):x+=` ${r.indent}`}else if(!h&&qe(e)){let S=_[0],C=_.indexOf(` `),T=C!==-1,P=r.inFlow??e.flow??e.items.length===0;if(T||!P){let R=!1;if(T&&(S==="&"||S==="!")){let N=_.indexOf(" ");S==="&"&&N!==-1&&N{p();Ue();Tt();rd();Zf()});var Gb=K(()=>{p()});function Wb(t,e,r){if(r=t&&Qr(r)?r.resolve(t.doc):r,En(r))for(let n of r.items)Qb(t,e,n);else if(Array.isArray(r))for(let n of r)Qb(t,e,n);else Qb(t,e,r)}function Qb(t,e,r){let n=t&&Qr(r)?r.resolve(t.doc):r;if(!Sn(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}var xm,pi,AR,km=K(()=>{p();Ue();Tt();xm="<<",pi={identify:t=>t===xm||typeof t=="symbol"&&t.description===xm,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new X(Symbol(xm)),{addToJSMap:Wb}),stringify:()=>xm},AR=(t,e)=>(pi.identify(e)||Ie(e)&&(!e.type||e.type===X.PLAIN)&&pi.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===pi.tag&&r.default)});function Sm(t,e,{key:r,value:n}){if(De(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(AR(t,r))Wb(t,e,n);else{let i=Ft(r,"",t);if(e instanceof Map)e.set(i,Ft(n,i,t));else if(e instanceof Set)e.add(i);else{let s=TV(r,i,t),o=Ft(n,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function TV(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(De(t)&&r?.doc){let n=_m(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),r.doc.options.logLevel,`${s}`,r.mapKeyWarned=!0}return i}return JSON.stringify(e)}var Kb=K(()=>{p();Gb();km();rd();Ue();co()});function Cc(t,e,r){let n=_s(t,void 0,r),i=_s(e,void 0,r);return new dt(n,i)}var dt,fo=K(()=>{p();Kf();TR();Kb();Ue();dt=class t{constructor(e,r=null){Object.defineProperty(this,Ir,{value:Mb}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return De(r)&&(r=r.clone(e)),De(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Sm(r,n,this)}toString(e,r,n){return e?.doc?CR(this,e,r,n):JSON.stringify(this)}}});function Cm(t,e,r){return(e.inFlow??t.flow?IV:AV)(t,e,r)}function AV({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=r,u=Object.assign({},r,{indent:s,type:null}),f=!1,d=[];for(let g=0;gy=null,()=>f=!0);y&&(v+=Gi(v,s,c(y))),f&&y&&(f=!1),d.push(n+v)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let g=1;gy=null);c||(c=f.length>u||v.includes(` `)),g0&&(c||(c=f.reduce((b,k)=>b+k.length+2,2)+(v.length+2)>e.options.lineWidth)),c&&(v+=",")),y&&(v+=Gi(v,n,a(y))),f.push(v),u=f.length}let{start:d,end:h}=r;if(f.length===0)return d+h;if(!c){let g=f.reduce((m,y)=>m+y.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=d;for(let m of f)g+=m?` ${s}${i}${m}`:` `;return`${g} ${i}${h}`}else return`${d}${o}${f.join(" ")}${o}${h}`}function Em({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let s=Gn(e(n),t);r.push(s.trimStart())}}var Yb=K(()=>{p();Ue();rd();Zf()});function ho(t,e){let r=Ie(e)?e.value:e;for(let n of t)if(Ne(n)&&(n.key===e||n.key===r||Ie(n.key)&&n.key.value===r))return n}var gt,po=K(()=>{p();Yb();Kb();gm();Ue();fo();Tt();gt=class extends kc{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(di,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:s}=n,o=new this(e),a=(l,c)=>{if(typeof s=="function")c=s.call(r,l,c);else if(Array.isArray(s)&&!s.includes(l))return;(c!==void 0||i)&&o.items.push(Cc(l,c,n))};if(r instanceof Map)for(let[l,c]of r)a(l,c);else if(r&&typeof r=="object")for(let l of Object.keys(r))a(l,r[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,r){let n;Ne(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new dt(e,e?.value):n=new dt(e.key,e.value);let i=ho(this.items,n.key),s=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Ie(i.value)&&mm(n.value)?i.value.value=n.value:i.value=n.value}else if(s){let o=this.items.findIndex(a=>s(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let r=ho(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=ho(this.items,e)?.value;return(!r&&Ie(i)?i.value:i)??void 0}has(e){return!!ho(this.items,e)}set(e,r){this.add(new dt(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let s of this.items)Sm(r,i,s);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ne(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Cm(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}}});var mi,Tc=K(()=>{p();Ue();po();mi={collection:"map",default:!0,nodeClass:gt,tag:"tag:yaml.org,2002:map",resolve(t,e){return Sn(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>gt.from(t,e,r)}});function Tm(t){let e=Ie(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Kt,mo=K(()=>{p();Kf();Yb();gm();Ue();Tt();co();Kt=class extends kc{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(bs,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Tm(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Tm(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Ie(i)?i.value:i}has(e){let r=Tm(e);return typeof r=="number"&&r{p();Ue();mo();gi={collection:"seq",default:!0,nodeClass:Kt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return En(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>Kt.from(t,e,r)}});var go,nd=K(()=>{p();td();go={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),xs(t,e,r,n)}}});var za,Am=K(()=>{p();Tt();za={identify:t=>t==null,createNode:()=>new X(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new X(null),stringify:({source:t},e)=>typeof t=="string"&&za.test.test(t)?t:e.options.nullStr}});var id,Zb=K(()=>{p();Tt();id={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new X(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&id.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}}});function gr({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^\d/.test(s)){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}var Ic=K(()=>{p()});var Im,Pm,$m,Jb=K(()=>{p();Tt();Ic();Im={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:gr},Pm={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():gr(t)}},$m={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new X(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:gr}});function IR(t,e,r){let{value:n}=t;return Rm(n)&&n>=0?r+n.toString(e):gr(t)}var Rm,Xb,Om,Nm,Fm,e_=K(()=>{p();Ic();Rm=t=>typeof t=="bigint"||Number.isInteger(t),Xb=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);Om={identify:t=>Rm(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>Xb(t,2,8,r),stringify:t=>IR(t,8,"0o")},Nm={identify:Rm,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>Xb(t,0,10,r),stringify:gr},Fm={identify:t=>Rm(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>Xb(t,2,16,r),stringify:t=>IR(t,16,"0x")}});var PR,$R=K(()=>{p();Tc();Am();Ac();nd();Zb();Jb();e_();PR=[mi,gi,go,za,id,Om,Nm,Fm,Im,Pm,$m]});function RR(t){return typeof t=="bigint"||Number.isInteger(t)}var Dm,PV,$V,OR,NR=K(()=>{p();Tt();Tc();Ac();Dm=({value:t})=>JSON.stringify(t),PV=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Dm},{identify:t=>t==null,createNode:()=>new X(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Dm},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Dm},{identify:RR,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>RR(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Dm}],$V={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},OR=[mi,gi].concat(PV,$V)});var sd,t_=K(()=>{p();Tt();td();sd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new dt(new X(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let s=i.value??i.key;s.comment=s.comment?`${n.comment} ${s.comment}`:n.comment}n=i}t.items[r]=Ne(n)?n:new dt(n)}}else e("Expected a sequence for this tag");return t}function n_(t,e,r){let{replacer:n}=r,i=new Kt(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(s++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(Cc(a,l,r))}return i}var od,zm=K(()=>{p();Ue();fo();Tt();mo();od={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:r_,createNode:n_}});var Pc,ad,i_=K(()=>{p();Ue();co();po();mo();zm();Pc=class t extends Kt{constructor(){super(),this.add=gt.prototype.add.bind(this),this.delete=gt.prototype.delete.bind(this),this.get=gt.prototype.get.bind(this),this.has=gt.prototype.has.bind(this),this.set=gt.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let s,o;if(Ne(i)?(s=Ft(i.key,"",r),o=Ft(i.value,s,r)):s=Ft(i,"",r),n.has(s))throw new Error("Ordered maps must not include duplicate keys");n.set(s,o)}return n}static from(e,r,n){let i=n_(e,r,n),s=new this;return s.items=i.items,s}};Pc.tag="tag:yaml.org,2002:omap";ad={collection:"seq",identify:t=>t instanceof Map,nodeClass:Pc,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=r_(t,e),n=[];for(let{key:i}of r.items)Ie(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Pc,r)},createNode:(t,e,r)=>Pc.from(t,e,r)}});function FR({value:t,source:e},r){return e&&(t?s_:o_).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var s_,o_,DR=K(()=>{p();Tt();s_={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new X(!0),stringify:FR},o_={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new X(!1),stringify:FR}});var zR,MR,LR,BR=K(()=>{p();Tt();Ic();zR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:gr},MR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():gr(t)}},LR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new X(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:gr}});function Mm(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,r);return i==="-"?-1*s:s}function a_(t,e,r){let{value:n}=t;if(ld(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return gr(t)}var ld,UR,jR,qR,VR,HR=K(()=>{p();Ic();ld=t=>typeof t=="bigint"||Number.isInteger(t);UR={identify:ld,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Mm(t,2,2,r),stringify:t=>a_(t,2,"0b")},jR={identify:ld,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Mm(t,1,8,r),stringify:t=>a_(t,8,"0")},qR={identify:ld,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Mm(t,0,10,r),stringify:gr},VR={identify:ld,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Mm(t,2,16,r),stringify:t=>a_(t,16,"0x")}});var $c,cd,l_=K(()=>{p();Ue();fo();po();$c=class t extends gt{constructor(e){super(e),this.tag=t.tag}add(e){let r;Ne(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new dt(e.key,null):r=new dt(e,null),ho(this.items,r.key)||this.items.push(r)}get(e,r){let n=ho(this.items,e);return!r&&Ne(n)?Ie(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=ho(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new dt(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof i=="function"&&(o=i.call(r,o,o)),s.items.push(Cc(o,null,n));return s}};$c.tag="tag:yaml.org,2002:set";cd={collection:"map",identify:t=>t instanceof Set,nodeClass:$c,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>$c.from(t,e,r),resolve(t,e){if(Sn(t)){if(t.hasAllNullValues(!0))return Object.assign(new $c,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}}});function c_(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return r==="-"?i(-1)*s:s}function GR(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return gr(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),n+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Lm,Bm,Rc,u_=K(()=>{p();Ic();Lm={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>c_(t,r),stringify:GR},Bm={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>c_(t,!1),stringify:GR},Rc={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Rc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,s,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(r,n-1,i,s||0,o||0,a||0,l),u=e[8];if(u&&u!=="Z"){let f=c_(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""}});var f_,QR=K(()=>{p();Tc();Am();Ac();nd();t_();DR();BR();HR();km();i_();zm();l_();u_();f_=[mi,gi,go,za,s_,o_,UR,jR,qR,VR,zR,MR,LR,sd,pi,ad,od,cd,Lm,Bm,Rc]});function Um(t,e,r){let n=WR.get(e);if(n&&!t)return r&&!n.includes(pi)?n.concat(pi):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(WR.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(pi)),i.reduce((s,o)=>{let a=typeof o=="string"?KR[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(KR).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return s.includes(a)||s.push(a),s},[])}var WR,KR,YR,ZR=K(()=>{p();Tc();Am();Ac();nd();Zb();Jb();e_();$R();NR();t_();km();i_();zm();QR();l_();u_();WR=new Map([["core",PR],["failsafe",[mi,gi,go]],["json",OR],["yaml11",f_],["yaml-1.1",f_]]),KR={binary:sd,bool:id,float:$m,floatExp:Pm,floatNaN:Im,floatTime:Bm,int:Nm,intHex:Fm,intOct:Om,intTime:Lm,map:mi,merge:pi,null:za,omap:ad,pairs:od,seq:gi,set:cd,timestamp:Rc},YR={"tag:yaml.org,2002:binary":sd,"tag:yaml.org,2002:merge":pi,"tag:yaml.org,2002:omap":ad,"tag:yaml.org,2002:pairs":od,"tag:yaml.org,2002:set":cd,"tag:yaml.org,2002:timestamp":Rc}});var RV,Ma,d_=K(()=>{p();Ue();Tc();Ac();nd();ZR();RV=(t,e)=>t.keye.key?1:0,Ma=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Um(e,"compat"):e?Um(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?YR:{},this.tags=Um(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,di,{value:mi}),Object.defineProperty(this,xn,{value:go}),Object.defineProperty(this,bs,{value:gi}),this.sortMapEntries=typeof o=="function"?o:o===!0?RV:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}});function JR(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(r.push(l),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=_m(t,e),{commentString:s}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let l=s(t.commentBefore);r.unshift(Gn(l,""))}let o=!1,a=null;if(t.contents){if(De(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);r.push(Gn(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=ks(t.contents,i,()=>a=null,l);a&&(c+=Gi(c,"",s(a))),(c[0]==="|"||c[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${c}`:r.push(c)}else r.push(ks(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=s(t.comment);l.includes(` `)?(r.push("..."),r.push(Gn(l,""))):r.push(`... ${l}`)}else r.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&r[r.length-1]!==""&&r.push(""),r.push(Gn(s(l),"")))}return r.join(` `)+` `}var XR=K(()=>{p();Ue();rd();Zf()});function Oc(t){if(qe(t))return!0;throw new Error("Expected a YAML collection as document contents")}var Cn,ud=K(()=>{p();Wf();gm();Ue();fo();co();d_();XR();dm();jb();Kf();Lb();Cn=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Ir,{value:cm});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Hi({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Ir]:{value:cm}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=De(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Oc(this.contents)&&this.contents.add(e)}addIn(e,r){Oc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=Bb(this);e.anchor=!r||n.has(r)?Ub(r||"a",n):r}return new hi(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let y=b=>typeof b=="number"||b instanceof String||b instanceof Number,v=r.filter(y).map(String);v.length>0&&(r=r.concat(v)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=n??{},{onAnchor:f,setAnchors:d,sourceObjects:h}=xR(this,o||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:h},m=_s(e,u,g);return a&&qe(m)&&(m.flow=!0),d(),m}createPair(e,r,n={}){let i=this.createNode(e,null,n),s=this.createNode(r,null,n);return new dt(i,s)}delete(e){return Oc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Sc(e)?this.contents==null?!1:(this.contents=null,!0):Oc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return qe(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Sc(e)?!r&&Ie(this.contents)?this.contents.value:this.contents:qe(this.contents)?this.contents.getIn(e,r):void 0}has(e){return qe(this.contents)?this.contents.has(e):!1}hasIn(e){return Sc(e)?this.contents!==void 0:qe(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Yf(this.schema,[e],r):Oc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Sc(e)?this.contents=r:this.contents==null?this.contents=Yf(this.schema,Array.from(e),r):Oc(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Hi({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Hi({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Ma(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Ft(this.contents,r??"",a);if(typeof s=="function")for(let{count:c,res:u}of a.anchors.values())s(u,c);return typeof o=="function"?lo(o,{"":l},"",l):l}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return JR(this,e)}}});var La,Kr,Ba,fd,dd=K(()=>{p();La=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},Kr=class extends La{constructor(e,r,n){super("YAMLParseError",e,r,n)}},Ba=class extends La{constructor(e,r,n){super("YAMLWarning",e,r,n)}},fd=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="\u2026"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),o=a+o}if(/[^ ]/.test(o)){let a=1,l=r.linePos[1];l?.line===n&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-s)));let c=" ".repeat(s)+"^".repeat(a);r.message+=`: ${o} ${c} `}}});function Qi(t,{flow:e,indicator:r,next:n,offset:i,onError:s,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,f="",d="",h=!1,g=!1,m=null,y=null,v=null,b=null,k=null,E=null,_=null;for(let C of t)switch(g&&(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma"&&s(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),m&&(c&&C.type!=="comment"&&C.type!=="newline"&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),C.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&C.source.includes(" ")&&(m=C),u=!0;break;case"comment":{u||s(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let T=C.source.substring(1)||" ";f?f+=d+T:f=T,d="",c=!1;break}case"newline":c?f?f+=C.source:(!E||r!=="seq-item-ind")&&(l=!0):d+=C.source,c=!0,h=!0,(y||v)&&(b=C),u=!0;break;case"anchor":y&&s(C,"MULTIPLE_ANCHORS","A node can have at most one anchor"),C.source.endsWith(":")&&s(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=C,_??(_=C.offset),c=!1,u=!1,g=!0;break;case"tag":{v&&s(C,"MULTIPLE_TAGS","A node can have at most one tag"),v=C,_??(_=C.offset),c=!1,u=!1,g=!0;break}case r:(y||v)&&s(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`),E&&s(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${e??"collection"}`),E=C,c=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){k&&s(C,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=C,c=!1,u=!1;break}default:s(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),c=!1,u=!1}let x=t[t.length-1],S=x?x.offset+x.source.length:i;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&s(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:E,spaceBefore:l,comment:f,hasNewline:h,anchor:y,tag:v,newlineAfterProp:b,end:S,start:_??S}}var hd=K(()=>{p()});function yo(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(yo(e.key)||yo(e.value))return!0}return!1;default:return!0}}var jm=K(()=>{p()});function pd(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&yo(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var h_=K(()=>{p();jm()});function qm(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(s,o)=>s===o||Ie(s)&&Ie(o)&&s.value===o.value;return e.some(s=>i(s.key,r))}var p_=K(()=>{p();Ue()});function tO({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??gt,a=new o(r.schema);r.atRoot&&(r.atRoot=!1);let l=n.offset,c=null;for(let u of n.items){let{start:f,key:d,sep:h,value:g}=u,m=Qi(f,{indicator:"explicit-key-ind",next:d??h?.[0],offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0}),y=!m.found;if(y){if(d&&(d.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==n.indent&&i(l,"BAD_INDENT",eO)),!m.anchor&&!m.tag&&!h){c=m.end,m.comment&&(a.comment?a.comment+=` `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||yo(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==n.indent&&i(l,"BAD_INDENT",eO);r.atKey=!0;let v=m.end,b=d?t(r,d,m,i):e(r,v,f,null,m,i);r.schema.compat&&pd(n.indent,d,i),r.atKey=!1,qm(r,a.items,b)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let k=Qi(h??[],{indicator:"map-value-ind",next:g,offset:b.range[2],onError:i,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=k.end,k.found){y&&(g?.type==="block-map"&&!k.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&m.start{p();fo();po();hd();jm();h_();p_();eO="All mapping items must start at the same column"});function nO({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??Kt,a=new o(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let l=n.offset,c=null;for(let{start:u,value:f}of n.items){let d=Qi(u,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let h=f?t(r,f,d,i):e(r,d.end,u,null,d,i);r.schema.compat&&pd(n.indent,f,i),l=h.range[2],a.items.push(h)}return a.range=[n.offset,l,c??l],a}var iO=K(()=>{p();mo();hd();h_()});function Wi(t,e,r,n){let i="";if(t){let s=!1,o="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":s=!0;break;case"comment":{r&&!s&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=l),s=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}var Nc=K(()=>{p()});function sO({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=n.start.source==="{",a=o?"flow map":"flow sequence",l=s?.nodeClass??(o?gt:Kt),c=new l(r.schema);c.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let f=n.offset+n.start.source.length;for(let y=0;y0){let y=Wi(g,m,r.options.strict,i);y.comment&&(c.comment?c.comment+=` `+y.comment:c.comment=y.comment),c.range=[n.offset,m,y.offset]}else c.range=[n.offset,m,m];return c}var m_,g_,oO=K(()=>{p();Ue();fo();po();mo();Nc();hd();jm();p_();m_="Block collections are not allowed within flow collections",g_=t=>t&&(t.type==="block-map"||t.type==="block-seq")});function y_(t,e,r,n,i,s){let o=r.type==="block-map"?tO(t,e,r,n,s):r.type==="block-seq"?nO(t,e,r,n,s):sO(t,e,r,n,s),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function aO(t,e,r,n,i){let s=n.tag,o=s?e.directives.tagName(s.source,d=>i(s,"TAG_RESOLVE_FAILED",d)):null;if(r.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=n,g=d&&s?d.offset>s.offset?d:s:d??s;g&&(!h||h.offsetd.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?i(s,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),y_(t,e,r,i,o)}let c=y_(t,e,r,i,o,l),u=l.resolve?.(c,d=>i(s,"TAG_RESOLVE_FAILED",d),e.options)??c,f=De(u)?u:new X(u);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}var lO=K(()=>{p();Ue();Tt();po();mo();rO();iO();oO()});function Vm(t,e,r){let n=e.offset,i=OV(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let s=i.mode===">"?X.BLOCK_FOLDED:X.BLOCK_LITERAL,o=e.source?NV(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let y=o[m][1];if(y===""||y==="\r")a=m;else break}if(a===0){let m=i.chomp==="+"&&o.length>0?` `.repeat(Math.max(1,o.length-1)):"",y=n+i.length;return e.source&&(y+=e.source.length),{value:m,type:s,comment:i.comment,range:[n,y,y]}}let l=e.indent+i.indent,c=e.offset+i.length,u=0;for(let m=0;ml&&(l=y.length);else{y.length=a;--m)o[m][0].length>l&&(a=m+1);let f="",d="",h=!1;for(let m=0;ml||v[0]===" "?(d===" "?d=` `:!h&&d===` `&&(d=` `),f+=d+y.slice(l)+v,d=` `,h=!0):v===""?d===` `?f+=` `:d=` `:(f+=d+v,d=" ",h=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;m{p();Tt()});function Hm(t,e,r){let{offset:n,type:i,source:s,end:o}=t,a,l,c=(d,h,g)=>r(n+d,h,g);switch(i){case"scalar":a=X.PLAIN,l=FV(s,c);break;case"single-quoted-scalar":a=X.QUOTE_SINGLE,l=DV(s,c);break;case"double-quoted-scalar":a=X.QUOTE_DOUBLE,l=zV(s,c);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+s.length,n+s.length]}}let u=n+s.length,f=Wi(o,u,e,r);return{value:l,type:a,comment:f.comment,range:[n,u,f.offset]}}function FV(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),cO(t)}function DV(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),cO(t.slice(1,-1)).replace(/''/g,"'")}function cO(t){let e,r;try{e=new RegExp(`(.*?)(?s?t.slice(s,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function MV(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` `),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}function BV(t,e,r,n){let i=t.substr(e,r),o=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}var LV,v_=K(()=>{p();Tt();Nc();LV={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "}});function b_(t,e,r,n){let{value:i,type:s,comment:o,range:a}=e.type==="block-scalar"?Vm(t,e,n):Hm(e,t.options.strict,n),l=r?t.directives.tagName(r.source,f=>n(r,"TAG_RESOLVE_FAILED",f)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[xn]:l?c=UV(t.schema,i,l,r,n):e.type==="scalar"?c=jV(t,i,e,n):c=t.schema[xn];let u;try{let f=c.resolve(i,d=>n(r??e,"TAG_RESOLVE_FAILED",d),t.options);u=Ie(f)?f:new X(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(r??e,"TAG_RESOLVE_FAILED",d),u=new X(i)}return u.range=a,u.source=i,s&&(u.type=s),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function UV(t,e,r,n,i){if(r==="!")return t[xn];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[r];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[xn])}function jV({atKey:t,directives:e,schema:r},n,i,s){let o=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[xn];if(r.compat){let a=r.compat.find(l=>l.default&&l.test?.test(n))??r[xn];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;s(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}var uO=K(()=>{p();Ue();Tt();w_();v_()});function fO(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}var dO=K(()=>{p()});function __(t,e,r,n){let i=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:l}=r,c,u=!0;switch(e.type){case"alias":c=VV(t,e,n),(a||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=b_(t,e,l,n),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=aO(qV,t,e,r,n),a&&(c.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=Gm(t,e.offset,void 0,null,r,n)),a&&c.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Ie(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),t.options.keepSourceTokens&&u&&(c.srcToken=e),c}function Gm(t,e,r,n,{spaceBefore:i,comment:s,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:fO(e,r,n),indent:-1,source:""},f=b_(t,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=l),f}function VV({options:t},{offset:e,source:r,end:n},i){let s=new hi(r.substring(1));s.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+r.length,a=Wi(n,o,t.strict,i);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}var qV,hO=K(()=>{p();Wf();Ue();lO();uO();Nc();dO();qV={composeNode:__,composeEmptyNode:Gm}});function pO(t,e,{offset:r,start:n,value:i,end:s},o){let a=Object.assign({_directives:e},t),l=new Cn(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=Qi(n,{indicator:"doc-start",next:i??s?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?__(c,i,u,o):Gm(c,u.end,n,null,u,o);let f=l.contents.range[2],d=Wi(s,f,!1,o);return d.comment&&(l.comment=d.comment),l.range=[r,f,d.offset],l}var mO=K(()=>{p();ud();hO();Nc();hd()});function md(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function gO(t){let e="",r=!1,n=!1;for(let i=0;i{p();Lb();ud();dd();Ue();mO();Nc();wo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,s)=>{let o=md(r);s?this.warnings.push(new Ba(o,n,i)):this.errors.push(new Kr(o,n,i))},this.directives=new Hi({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=gO(this.prelude);if(n){let s=e.contents;if(r)e.comment=e.comment?`${e.comment} ${n}`:n;else if(i||e.directives.docStart||!s)e.commentBefore=n;else if(qe(s)&&!s.flow&&s.items.length>0){let o=s.items[0];Ne(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n} ${a}`:n}else{let o=s.commentBefore;s.commentBefore=o?`${n} ${o}`:n}}r?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:gO(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(r,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(r,n,i)=>{let s=md(e);s[0]+=r,this.onError(s,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=pO(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Kr(md(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Kr(md(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Wi(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Kr(md(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Cn(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}}});function yO(t,e=!0,r){if(t){let n=(i,s,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,s,o);else throw new Kr([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Hm(t,e,n);case"block-scalar":return Vm({options:{strict:e}},t,n)}}return null}function wO(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:s=-1,type:o="PLAIN"}=e,a=xs({type:o,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let c=a.indexOf(` `),u=a.substring(0,c),f=a.substring(c+1)+` `,d=[{type:"block-scalar-header",offset:s,indent:n,source:u}];return bO(d,l)||d.push({type:"newline",offset:-1,indent:n,source:` `}),{type:"block-scalar",offset:s,indent:n,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:s,indent:n,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:s,indent:n,source:a,end:l};default:return{type:"scalar",offset:s,indent:n,source:a,end:l}}}function vO(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:s=!1,type:o}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=xs({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":HV(t,l);break;case'"':k_(t,l,"double-quoted-scalar");break;case"'":k_(t,l,"single-quoted-scalar");break;default:k_(t,l,"scalar")}}function HV(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` `;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=n,t.source=i}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:n}];bO(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` `});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function bO(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function k_(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let s of n)s.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` `};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}var _O=K(()=>{p();w_();v_();dd();td()});function Wm(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Wm(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Qm(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Qm(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Qm(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Qm({start:t,key:e,sep:r,value:n}){let i="";for(let s of t)i+=s.source;if(e&&(i+=Wm(e)),r)for(let s of r)i+=s.source;return n&&(i+=Wm(n)),i}var xO,kO=K(()=>{p();xO=t=>"type"in t?Wm(t):Qm(t)});function vo(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),EO(Object.freeze([]),t,e)}function EO(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let s=e[i];if(s&&"items"in s){for(let o=0;o{p();S_=Symbol("break visit"),GV=Symbol("skip children"),SO=Symbol("remove item");vo.BREAK=S_;vo.SKIP=GV;vo.REMOVE=SO;vo.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let s=r?.[n];if(s&&"items"in s)r=s.items[i];else return}return r};vo.parentCollection=(t,e)=>{let r=vo.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")}});var Km={};lu(Km,{BOM:()=>gd,DOCUMENT:()=>yd,FLOW_END:()=>wd,SCALAR:()=>Fc,createScalarToken:()=>wO,isCollection:()=>QV,isScalar:()=>WV,prettyToken:()=>KV,resolveAsScalar:()=>yO,setScalarValue:()=>vO,stringify:()=>xO,tokenType:()=>E_,visit:()=>vo});function KV(t){switch(t){case gd:return"";case yd:return"";case wd:return"";case Fc:return"";default:return JSON.stringify(t)}}function E_(t){switch(t){case gd:return"byte-order-mark";case yd:return"doc-mode";case wd:return"flow-error-end";case Fc:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}var gd,yd,wd,Fc,QV,WV,Ym=K(()=>{p();_O();kO();CO();gd="\uFEFF",yd="",wd="",Fc="",QV=t=>!!t&&"items"in t,WV=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar")});function yi(t){switch(t){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}var TO,YV,Zm,ZV,C_,Ua,T_=K(()=>{p();Ym();TO=new Set("0123456789ABCDEFabcdef"),YV=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Zm=new Set(",[]{}"),ZV=new Set(` ,[]{} \r `),C_=t=>!t||ZV.has(t),Ua=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` `||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&yi(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!yi(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&yi(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(C_),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>yi(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let s=this.pos;n=this.buffer[s];++s)switch(n){case" ":r+=1;break;case` `:e=s,r=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(` `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===` `&&s>=this.pos&&s+1+r>a)e=s;else break}while(!0);return yield Fc,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let s=this.buffer[n+1];if(yi(s)||e&&Zm.has(s))break;r=n}else if(yi(i)){let s=this.buffer[n+1];if(i==="\r"&&(s===` `?(n+=1,i=` `,s=this.buffer[n+1]):r=n),s==="#"||e&&Zm.has(s))break;if(i===` `){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Zm.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Fc,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(C_))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,r=this.charAt(1);if(yi(r)||e&&Zm.has(r))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!yi(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(YV.has(r))r=this.buffer[++e];else if(r==="%"&&TO.has(this.buffer[e+1])&&TO.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` `?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}}});var ja,A_=K(()=>{p();ja=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[s]=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function IO(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!bo(e.start,"explicit-key-ind")&&!bo(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,PO(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var _o,I_=K(()=>{p();Ym();T_();_o=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ua,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=E_(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&IO(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&AO(i.start)===-1&&(r.indent===0||i.start.every(s=>s.type!=="comment"||s.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&r.sep&&!r.value){let o=[];for(let a=0;ae.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(bo(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(PO(r.key)&&!bo(r.sep,"newline")){let o=Dc(r.start),a=r.key,l=r.sep;l.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else s.length>0?r.sep=r.sep.concat(s,this.sourceToken):r.sep.push(this.sourceToken);else if(bo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=Dc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):bo(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||r.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!bo(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||bo(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Jm(n),s=Dc(i);IO(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Jm(e),n=Dc(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Jm(e),n=Dc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}});function $O(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new ja||null,prettyErrors:e}}function P_(t,e={}){let{lineCounter:r,prettyErrors:n}=$O(e),i=new _o(r?.addNewLine),s=new wo(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(fd(t,r)),a.warnings.forEach(fd(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function zc(t,e={}){let{lineCounter:r,prettyErrors:n}=$O(e),i=new _o(r?.addNewLine),s=new wo(e),o=null;for(let a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Kr(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(fd(t,r)),o.warnings.forEach(fd(t,r))),o}function $_(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=zc(t,r);if(!i)return null;if(i.warnings.forEach(s=>(i.options.logLevel,void 0)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function R_(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return kn(t)&&!n?t.toString(r):new Cn(t,n,r).toString(r)}var RO=K(()=>{p();x_();ud();dd();Gb();Ue();A_();I_()});var O_={};lu(O_,{Alias:()=>hi,CST:()=>Km,Composer:()=>wo,Document:()=>Cn,Lexer:()=>Ua,LineCounter:()=>ja,Pair:()=>dt,Parser:()=>_o,Scalar:()=>X,Schema:()=>Ma,YAMLError:()=>La,YAMLMap:()=>gt,YAMLParseError:()=>Kr,YAMLSeq:()=>Kt,YAMLWarning:()=>Ba,isAlias:()=>Qr,isCollection:()=>qe,isDocument:()=>kn,isMap:()=>Sn,isNode:()=>De,isPair:()=>Ne,isScalar:()=>Ie,isSeq:()=>En,parse:()=>$_,parseAllDocuments:()=>P_,parseDocument:()=>zc,stringify:()=>R_,visit:()=>Hn,visitAsync:()=>xc});var N_=K(()=>{p();x_();ud();d_();dd();Wf();Ue();fo();Tt();po();mo();Ym();T_();A_();I_();RO();Qf()});var OO={};lu(OO,{Alias:()=>hi,CST:()=>Km,Composer:()=>wo,Document:()=>Cn,Lexer:()=>Ua,LineCounter:()=>ja,Pair:()=>dt,Parser:()=>_o,Scalar:()=>X,Schema:()=>Ma,YAMLError:()=>La,YAMLMap:()=>gt,YAMLParseError:()=>Kr,YAMLSeq:()=>Kt,YAMLWarning:()=>Ba,default:()=>JV,isAlias:()=>Qr,isCollection:()=>qe,isDocument:()=>kn,isMap:()=>Sn,isNode:()=>De,isPair:()=>Ne,isScalar:()=>Ie,isSeq:()=>En,parse:()=>$_,parseAllDocuments:()=>P_,parseDocument:()=>zc,stringify:()=>R_,visit:()=>Hn,visitAsync:()=>xc});var JV,F_=K(()=>{p();N_();N_();JV=O_});var bG={};lu(bG,{default:()=>$g});module.exports=PF(bG);p();var Es=require("obsidian");p();p();var F0=require("obsidian"),sl=(t,e,r=!1)=>!!e?.[t]||r;function D0(t,e,r=!1){return sl(t,e,r)?!0:(new F0.Notice("Quartz Syncer: Note does not have the publish: true set. Please add this and try again."),!1)}p();var Go=require("obsidian");p();var BD=cu(X0()),Bd=require("obsidian");async function ol(t){let e=new TextEncoder,r=e.encode(t),n=r.byteLength,i=e.encode(`blob ${n}\0`),s=new Uint8Array(i.length+r.length);s.set(i,0),s.set(r,i.length);let o=await crypto.subtle.digest("SHA-1",s);return Array.from(new Uint8Array(o)).map(a=>a.toString(16).padStart(2,"0")).join("")}function rs(t){return t.startsWith("/")?t.slice(1):t}function Yn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ex(t){return t.endsWith("/")&&t.slice(0,-1),t.startsWith("/")||(t="/"+t),t}function Ts(t){let e=app.plugins.enabledPlugins;return e.has(t)||e.has(t.toLowerCase())}function Vg(t){return t=decodeURI(t),t=t.replace(/\[#([^\]]+)\]\(#([^)]+)\)/g,'$1'),t=t.replace(/#([\w\\/]+)/g,'$1'),t=t.replace(/(\[.*?\]\()(.+?)\.md(\))/g,"$1$2$3"),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"[[$2|$1]]"),t.trim()}function ns(t,e,r=5e3,n=500){return new Promise((i,s)=>{let o,a=()=>{window.clearTimeout(o)},l=new MutationObserver(()=>{a(),o=window.setTimeout(()=>{c(),i()},n)}),c=()=>{l.disconnect(),a(),window.clearTimeout(u)};l.observe(t,{childList:!0,subtree:!0});let u=window.setTimeout(()=>{c(),s(new Error(`Timeout waiting for selector: ${e}`))},r)})}function Ud(t,e=1){let r=t.split(` `),n="> ".repeat(e);return" "+r.join(` ${n}`)}function jd(t){let e=0,r=t.split(` `),n=[];for(let s of r){let o=0;if(s.startsWith(">")){o+=1;let a=s.substring(1).trim();for(;a.startsWith(">");)a=a.substring(1).trim(),o+=1;n.push(a)}else n.push(s);e=Math.max(e,o)}let i=t;return e>0&&(i=n.join(` `)),{isInsideCalloutDepth:e,finalQuery:i}}function fu(t,e){let r=t.querySelectorAll("style"),n=(0,Bd.sanitizeHTMLToDom)(t.innerHTML),i=document.createElement("div");i.appendChild(n),VD(i,"link, meta, title"),i.querySelectorAll("a.internal-link, a.tag, a:not(.external-link):not(.internal-link):not(.tag)").length>0&&qD(i),i=jD(i),i=HD(i);let o=i.classList,a=["datacore-table","datacore-list"],l=["p","h1","h2","h3","h4","h5","h6","ul","ol","li","table","thead","tbody","tr","td","th"];if(o.length>0&&Array.from(o).some(u=>a.includes(u))||l.includes(i.tagName.toLowerCase())){let u=(0,Bd.htmlToMarkdown)(i)||"";return Vg(u)}return r.forEach(u=>{i.append(u)}),UD(i),e.serializeToString(i).replace(' xmlns="http://www.w3.org/1999/xhtml"',"")}function UD(t){let e=["__source","__self"];t.querySelectorAll(`${e.map(n=>`[${n}]`).join(", ")}`).forEach(n=>{e.forEach(i=>{n.removeAttribute(i)})})}function jD(t){let e=t.querySelectorAll(".callout");return e.length===0||e.forEach(r=>{let n=document.createElement("blockquote");r.hasAttribute("data-callout-fold")&&(r.getAttribute("data-callout-fold")==="-"&&n.classList.add("is-collapsed"),r.setAttribute("data-callout-fold","")),r.hasAttribute("data-callout")||r.setAttribute("data-callout","note");for(let a=0;aa.cloneNode(!0))),n.classList.remove("datacore");let i=n.querySelector(".callout-content");if(i){let a=document.createElement("div");a.classList.add("callout-content-inner"),a.replaceChildren(...Array.from(i.childNodes,l=>l.cloneNode(!0))),i.replaceChildren(),i.appendChild(a)}let s=n.querySelector(".callout-fold");if(s){s.classList.replace("callout-fold","fold-callout-icon");let a=s.querySelector("svg");a&&s.removeChild(a)}let o=n.querySelector(".callout-title");if(o&&o.children&&!o.children[0].classList.contains("callout-icon")){let a=document.createElement("div");a.classList.add("callout-icon"),o.prepend(a)}r.replaceWith(n)}),t}function qD(t){t.querySelectorAll("a.internal-link, a.tag, a:not(.external-link):not(.internal-link):not(.tag)").forEach(r=>{r.removeAttribute("target"),r.removeAttribute("rel"),r.removeAttribute("data-href"),r.hasAttribute("href")&&(r.getAttribute("href")?.startsWith("http")?r.classList.add("external-link"):r.classList.add("internal-link"))})}function VD(t,e){t.querySelectorAll(e).forEach(n=>{n.remove()})}function HD(t){for(;t.attributes.length===0&&t.children.length===1;){let e=t.firstElementChild;if(e)t.replaceWith(e),t=e;else break}return t}async function Hg(t,e,r=10,n){let i=[],s=t.length;for(let o=0;owindow.setTimeout(c,0))}return i}p();var tx=/^\s*?---\n([\s\S]*?)\n---/g;var rx=/target=["']_blank["'] rel=["']noopener["']/g,nx=/^([^:]+)::\s(.*?)$/gm,ix=/\[([^:\][]+)::\s(.*?)\]|\(([^:)(]+)::\s(.*?)\)/g;p();p();p();function Gg(t){if(t)throw t}var Hd=cu(hx(),1);p();function du(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}p();p();function Qg(){let t=[],e={run:r,use:n};return e;function r(...i){let s=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){let u=t[++s],f=-1;if(l){o(l);return}for(;++fo.length,l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){let u=c;if(a&&r)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){r||(r=!0,e(o,...a))}function s(o){i(null,o)}}p();p();p();p();p();p();function As(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?mx(t.position):"start"in t||"end"in t?mx(t):"line"in t||"column"in t?Wg(t):""}function Wg(t){return gx(t&&t.line)+":"+gx(t&&t.column)}function mx(t){return Wg(t&&t.start)+"-"+Wg(t&&t.end)}function gx(t){return t&&typeof t=="number"?t:1}var Lt=class extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){let l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}let a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=As(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Lt.prototype.file="";Lt.prototype.name="";Lt.prototype.reason="";Lt.prototype.message="";Lt.prototype.stack="";Lt.prototype.column=void 0;Lt.prototype.line=void 0;Lt.prototype.ancestors=void 0;Lt.prototype.cause=void 0;Lt.prototype.fatal=void 0;Lt.prototype.place=void 0;Lt.prototype.ruleId=void 0;Lt.prototype.source=void 0;p();var Zn={basename:GD,dirname:QD,extname:WD,join:KD,sep:"/"};function GD(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');hu(t);let r=0,n=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function QD(t){if(hu(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function WD(t){hu(t);let e=t.length,r=-1,n=0,i=-1,s=0,o;for(;e--;){let a=t.codePointAt(e);if(a===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function KD(...t){let e=-1,r;for(;++e0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function ZD(t,e){let r="",n=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}e&&(r=r.length>0?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,s=0}else a===46&&s>-1?s++:s=-1}return r}function hu(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}p();var yx={cwd:JD};function JD(){return"/"}p();p();function al(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function wx(t){if(typeof t=="string")t=new URL(t);else if(!al(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return XD(t)}function XD(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,r=-1;for(;++r0){let[h,...g]=u,m=n[d][1];du(m)&&du(h)&&(h=(0,Hd.default)(!0,m,h)),n[d]=[c,h,...g]}}}},ry=new ty().freeze();function Jg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Xg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ey(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _x(t){if(!du(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function xx(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Vd(t){return r2(t)?t:new pu(t)}function r2(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function n2(t){return typeof t=="string"||i2(t)}function i2(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}p();p();p();p();p();p();var s2={};function Do(t,e){let r=e||s2,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Sx(t,n,i)}function Sx(t,e,r){if(o2(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return kx(t.children,e,r)}return Array.isArray(t)?kx(t,e,r):""}function kx(t,e,r){let n=[],i=-1;for(;++ii?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);s0?(Zt(t,t.length,0,e),t):e}p();var Cx={}.hasOwnProperty;function Tx(t){let e={},r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}p();function is(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}p();var tn=Is(/[A-Za-z]/),_r=Is(/[\dA-Za-z]/),Ax=Is(/[#-'*+\--9=?A-Z^-~]/);function mu(t){return t!==null&&(t<32||t===127)}var gu=Is(/\d/),Ix=Is(/[\dA-Fa-f]/),Px=Is(/[!-/:-@[-`{-~]/);function Z(t){return t!==null&&t<-2}function _t(t){return t!==null&&(t<0||t===32)}function we(t){return t===-2||t===-1||t===32}var $x=Is(/\p{P}|\p{S}/u),Rx=Is(/\s/);function Is(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}p();p();p();function Te(t,e,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,s=0;return o;function o(l){return we(l)?(t.enter(r),a(l)):e(l)}function a(l){return we(l)&&s++o))return;let S=e.events.length,C=S,T,P;for(;C--;)if(e.events[C][0]==="exit"&&e.events[C][1].type==="chunkFlow"){if(T){P=e.events[C][1].end;break}T=!0}for(v(n),x=S;xk;){let _=r[E];e.containerState=_[1],_[0].exit.call(e,t)}r.length=k}function b(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function f2(t,e,r){return Te(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}p();p();p();p();function cl(t){if(t===null||_t(t)||Rx(t))return 1;if($x(t))return 2}p();function ul(t,e,r){let n=[],i=-1;for(;++i1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;let f={...t[n][1].end},d={...t[r][1].start};Dx(f,-l),Dx(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:d},s={type:l>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[n][1].end={...o.start},t[r][1].start={...a.end},c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=br(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=br(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=br(c,ul(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=br(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=br(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,Zt(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r0&&we(x)?Te(t,b,"linePrefix",s+1)(x):b(x)}function b(x){return x===null||Z(x)?t.check(zx,m,E)(x):(t.enter("codeFlowValue"),k(x))}function k(x){return x===null||Z(x)?(t.exit("codeFlowValue"),b(x)):(t.consume(x),k)}function E(x){return t.exit("codeFenced"),e(x)}function _(x,S,C){let T=0;return P;function P(Q){return x.enter("lineEnding"),x.consume(Q),x.exit("lineEnding"),R}function R(Q){return x.enter("codeFencedFence"),we(Q)?Te(x,N,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Q):N(Q)}function N(Q){return Q===a?(x.enter("codeFencedFenceSequence"),F(Q)):C(Q)}function F(Q){return Q===a?(T++,x.consume(Q),F):T>=o?(x.exit("codeFencedFenceSequence"),we(Q)?Te(x,j,"whitespace")(Q):j(Q)):C(Q)}function j(Q){return Q===null||Z(Q)?(x.exit("codeFencedFence"),S(Q)):C(Q)}}}function x2(t,e,r){let n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}p();var wu={name:"codeIndented",tokenize:S2},k2={partial:!0,tokenize:E2};function S2(t,e,r){let n=this;return i;function i(c){return t.enter("codeIndented"),Te(t,s,"linePrefix",5)(c)}function s(c){let u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?l(c):Z(c)?t.attempt(k2,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Z(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function E2(t,e,r){let n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Z(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Te(t,s,"linePrefix",5)(o)}function s(o){let a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Z(o)?i(o):r(o)}}p();var iy={name:"codeText",previous:T2,resolve:C2,tokenize:A2};function C2(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){let i=r||0;this.setCursor(Math.trunc(e));let s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&vu(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),vu(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),vu(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}p();p();function Xd(t,e,r,n,i,s,o,a,l){let c=l||Number.POSITIVE_INFINITY,u=0;return f;function f(v){return v===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(v),t.exit(s),d):v===null||v===32||v===41||mu(v)?r(v):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),m(v))}function d(v){return v===62?(t.enter(s),t.consume(v),t.exit(s),t.exit(i),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===62?(t.exit("chunkString"),t.exit(a),d(v)):v===null||v===60||Z(v)?r(v):(t.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(t.consume(v),h):h(v)}function m(v){return!u&&(v===null||v===41||_t(v))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(v)):u999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(h):h===93?(t.exit(s),t.enter(i),t.consume(h),t.exit(i),t.exit(n),e):Z(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||Z(h)||a++>999?(t.exit("chunkString"),u(h)):(t.consume(h),l||(l=!we(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(t.consume(h),a++,f):f(h)}}p();function th(t,e,r,n,i,s){let o;return a;function a(d){return d===34||d===39||d===40?(t.enter(n),t.enter(i),t.consume(d),t.exit(i),o=d===40?41:d,l):r(d)}function l(d){return d===o?(t.enter(i),t.consume(d),t.exit(i),t.exit(n),e):(t.enter(s),c(d))}function c(d){return d===o?(t.exit(s),l(o)):d===null?r(d):Z(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Te(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(d))}function u(d){return d===o||d===null||Z(d)?(t.exit("chunkString"),c(d)):(t.consume(d),d===92?f:u)}function f(d){return d===o||d===92?(t.consume(d),u):u(d)}}p();function zo(t,e){let r;return n;function n(i){return Z(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):we(i)?Te(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}var oy={name:"definition",tokenize:F2},N2={partial:!0,tokenize:D2};function F2(t,e,r){let n=this,i;return s;function s(h){return t.enter("definition"),o(h)}function o(h){return eh.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=is(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),l):r(h)}function l(h){return _t(h)?zo(t,c)(h):c(h)}function c(h){return Xd(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return t.attempt(N2,f,f)(h)}function f(h){return we(h)?Te(t,d,"whitespace")(h):d(h)}function d(h){return h===null||Z(h)?(t.exit("definition"),n.parser.defined.push(i),e(h)):r(h)}}function D2(t,e,r){return n;function n(a){return _t(a)?zo(t,i)(a):r(a)}function i(a){return th(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return we(a)?Te(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Z(a)?e(a):r(a)}}p();var ay={name:"hardBreakEscape",tokenize:z2};function z2(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Z(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}p();var ly={name:"headingAtx",resolve:M2,tokenize:L2};function M2(t,e){let r=t.length-2,n=3,i,s;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},s={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},Zt(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function L2(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(t.consume(u),o):u===null||_t(u)?(t.exit("atxHeadingSequence"),a(u)):r(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Z(u)?(t.exit("atxHeading"),e(u)):we(u)?Te(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||_t(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}p();p();var Mx=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],cy=["pre","script","style","textarea"];var uy={concrete:!0,name:"htmlFlow",resolveTo:j2,tokenize:q2},B2={partial:!0,tokenize:H2},U2={partial:!0,tokenize:V2};function j2(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function q2(t,e,r){let n=this,i,s,o,a,l;return c;function c(I){return u(I)}function u(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),f}function f(I){return I===33?(t.consume(I),d):I===47?(t.consume(I),s=!0,m):I===63?(t.consume(I),i=3,n.interrupt?e:A):tn(I)?(t.consume(I),o=String.fromCharCode(I),y):r(I)}function d(I){return I===45?(t.consume(I),i=2,h):I===91?(t.consume(I),i=5,a=0,g):tn(I)?(t.consume(I),i=4,n.interrupt?e:A):r(I)}function h(I){return I===45?(t.consume(I),n.interrupt?e:A):r(I)}function g(I){let ce="CDATA[";return I===ce.charCodeAt(a++)?(t.consume(I),a===ce.length?n.interrupt?e:N:g):r(I)}function m(I){return tn(I)?(t.consume(I),o=String.fromCharCode(I),y):r(I)}function y(I){if(I===null||I===47||I===62||_t(I)){let ce=I===47,ue=o.toLowerCase();return!ce&&!s&&cy.includes(ue)?(i=1,n.interrupt?e(I):N(I)):Mx.includes(o.toLowerCase())?(i=6,ce?(t.consume(I),v):n.interrupt?e(I):N(I)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(I):s?b(I):k(I))}return I===45||_r(I)?(t.consume(I),o+=String.fromCharCode(I),y):r(I)}function v(I){return I===62?(t.consume(I),n.interrupt?e:N):r(I)}function b(I){return we(I)?(t.consume(I),b):P(I)}function k(I){return I===47?(t.consume(I),P):I===58||I===95||tn(I)?(t.consume(I),E):we(I)?(t.consume(I),k):P(I)}function E(I){return I===45||I===46||I===58||I===95||_r(I)?(t.consume(I),E):_(I)}function _(I){return I===61?(t.consume(I),x):we(I)?(t.consume(I),_):k(I)}function x(I){return I===null||I===60||I===61||I===62||I===96?r(I):I===34||I===39?(t.consume(I),l=I,S):we(I)?(t.consume(I),x):C(I)}function S(I){return I===l?(t.consume(I),l=null,T):I===null||Z(I)?r(I):(t.consume(I),S)}function C(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||_t(I)?_(I):(t.consume(I),C)}function T(I){return I===47||I===62||we(I)?k(I):r(I)}function P(I){return I===62?(t.consume(I),R):r(I)}function R(I){return I===null||Z(I)?N(I):we(I)?(t.consume(I),R):r(I)}function N(I){return I===45&&i===2?(t.consume(I),ge):I===60&&i===1?(t.consume(I),ie):I===62&&i===4?(t.consume(I),q):I===63&&i===3?(t.consume(I),A):I===93&&i===5?(t.consume(I),Ze):Z(I)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(B2,B,F)(I)):I===null||Z(I)?(t.exit("htmlFlowData"),F(I)):(t.consume(I),N)}function F(I){return t.check(U2,j,B)(I)}function j(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),Q}function Q(I){return I===null||Z(I)?F(I):(t.enter("htmlFlowData"),N(I))}function ge(I){return I===45?(t.consume(I),A):N(I)}function ie(I){return I===47?(t.consume(I),o="",pe):N(I)}function pe(I){if(I===62){let ce=o.toLowerCase();return cy.includes(ce)?(t.consume(I),q):N(I)}return tn(I)&&o.length<8?(t.consume(I),o+=String.fromCharCode(I),pe):N(I)}function Ze(I){return I===93?(t.consume(I),A):N(I)}function A(I){return I===62?(t.consume(I),q):I===45&&i===2?(t.consume(I),A):N(I)}function q(I){return I===null||Z(I)?(t.exit("htmlFlowData"),B(I)):(t.consume(I),q)}function B(I){return t.exit("htmlFlow"),e(I)}}function V2(t,e,r){let n=this;return i;function i(o){return Z(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function H2(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Ps,e,r)}}p();var fy={name:"htmlText",tokenize:G2};function G2(t,e,r){let n=this,i,s,o;return a;function a(A){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(A),l}function l(A){return A===33?(t.consume(A),c):A===47?(t.consume(A),_):A===63?(t.consume(A),k):tn(A)?(t.consume(A),C):r(A)}function c(A){return A===45?(t.consume(A),u):A===91?(t.consume(A),s=0,g):tn(A)?(t.consume(A),b):r(A)}function u(A){return A===45?(t.consume(A),h):r(A)}function f(A){return A===null?r(A):A===45?(t.consume(A),d):Z(A)?(o=f,ie(A)):(t.consume(A),f)}function d(A){return A===45?(t.consume(A),h):f(A)}function h(A){return A===62?ge(A):A===45?d(A):f(A)}function g(A){let q="CDATA[";return A===q.charCodeAt(s++)?(t.consume(A),s===q.length?m:g):r(A)}function m(A){return A===null?r(A):A===93?(t.consume(A),y):Z(A)?(o=m,ie(A)):(t.consume(A),m)}function y(A){return A===93?(t.consume(A),v):m(A)}function v(A){return A===62?ge(A):A===93?(t.consume(A),v):m(A)}function b(A){return A===null||A===62?ge(A):Z(A)?(o=b,ie(A)):(t.consume(A),b)}function k(A){return A===null?r(A):A===63?(t.consume(A),E):Z(A)?(o=k,ie(A)):(t.consume(A),k)}function E(A){return A===62?ge(A):k(A)}function _(A){return tn(A)?(t.consume(A),x):r(A)}function x(A){return A===45||_r(A)?(t.consume(A),x):S(A)}function S(A){return Z(A)?(o=S,ie(A)):we(A)?(t.consume(A),S):ge(A)}function C(A){return A===45||_r(A)?(t.consume(A),C):A===47||A===62||_t(A)?T(A):r(A)}function T(A){return A===47?(t.consume(A),ge):A===58||A===95||tn(A)?(t.consume(A),P):Z(A)?(o=T,ie(A)):we(A)?(t.consume(A),T):ge(A)}function P(A){return A===45||A===46||A===58||A===95||_r(A)?(t.consume(A),P):R(A)}function R(A){return A===61?(t.consume(A),N):Z(A)?(o=R,ie(A)):we(A)?(t.consume(A),R):T(A)}function N(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(t.consume(A),i=A,F):Z(A)?(o=N,ie(A)):we(A)?(t.consume(A),N):(t.consume(A),j)}function F(A){return A===i?(t.consume(A),i=void 0,Q):A===null?r(A):Z(A)?(o=F,ie(A)):(t.consume(A),F)}function j(A){return A===null||A===34||A===39||A===60||A===61||A===96?r(A):A===47||A===62||_t(A)?T(A):(t.consume(A),j)}function Q(A){return A===47||A===62||_t(A)?T(A):r(A)}function ge(A){return A===62?(t.consume(A),t.exit("htmlTextData"),t.exit("htmlText"),e):r(A)}function ie(A){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),pe}function pe(A){return we(A)?Te(t,Ze,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):Ze(A)}function Ze(A){return t.enter("htmlTextData"),o(A)}}p();var Mo={name:"labelEnd",resolveAll:Y2,resolveTo:Z2,tokenize:J2},Q2={tokenize:X2},W2={tokenize:ez},K2={tokenize:tz};function Y2(t){let e=-1,r=[];for(;++e=3&&(c===null||Z(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),we(c)?Te(t,a,"whitespace")(c):a(c))}}var ar={continuation:{tokenize:cz},exit:fz,name:"list",tokenize:lz},oz={partial:!0,tokenize:dz},az={partial:!0,tokenize:uz};function lz(t,e,r){let n=this,i=n.events[n.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(h){let g=n.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||h===n.containerState.marker:gu(h)){if(n.containerState.type||(n.containerState.type=g,t.enter(g,{_container:!0})),g==="listUnordered")return t.enter("listItemPrefix"),h===42||h===45?t.check(Lo,r,c)(h):c(h);if(!n.interrupt||h===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(h)}return r(h)}function l(h){return gu(h)&&++o<10?(t.consume(h),l):(!n.interrupt||o<2)&&(n.containerState.marker?h===n.containerState.marker:h===41||h===46)?(t.exit("listItemValue"),c(h)):r(h)}function c(h){return t.enter("listItemMarker"),t.consume(h),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||h,t.check(Ps,n.interrupt?r:u,t.attempt(oz,d,f))}function u(h){return n.containerState.initialBlankLine=!0,s++,d(h)}function f(h){return we(h)?(t.enter("listItemPrefixWhitespace"),t.consume(h),t.exit("listItemPrefixWhitespace"),d):r(h)}function d(h){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(h)}}function cz(t,e,r){let n=this;return n.containerState._closeFlow=void 0,t.check(Ps,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Te(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!we(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(az,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Te(t,t.attempt(ar,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function uz(t,e,r){let n=this;return Te(t,i,"listItemIndent",n.containerState.size+1);function i(s){let o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(s):r(s)}}function fz(t){t.exit(this.containerState.type)}function dz(t,e,r){let n=this;return Te(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){let o=n.events[n.events.length-1];return!we(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}p();var rh={name:"setextUnderline",resolveTo:hz,tokenize:pz};function hz(t,e){let r=t.length,n,i,s;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!s&&t[r][1].type==="definition"&&(s=r);let o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[n][1],e]),t[n][1].end={...t[s][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function pz(t,e,r){let n=this,i;return s;function s(c){let u=n.events.length,f;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){f=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||f)?(t.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),we(c)?Te(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Z(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}var Lx={tokenize:mz};function mz(t){let e=this,r=t.attempt(Ps,n,t.attempt(this.parser.constructs.flowInitial,i,Te(t,t.attempt(this.parser.constructs.flow,i,t.attempt(sy,i)),"linePrefix")));return r;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,r}}p();var Bx={resolveAll:Vx()},Ux=qx("string"),jx=qx("text");function qx(t){return{resolveAll:Vx(t==="text"?gz:void 0),tokenize:e};function e(r){let n=this,i=this.parser.constructs[t],s=r.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),s(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;let f=i[u],d=-1;if(f)for(;++dSz,contentInitial:()=>wz,disable:()=>Ez,document:()=>yz,flow:()=>bz,flowInitial:()=>vz,insideSpan:()=>kz,string:()=>_z,text:()=>xz});p();var yz={42:ar,43:ar,45:ar,48:ar,49:ar,50:ar,51:ar,52:ar,53:ar,54:ar,55:ar,56:ar,57:ar,62:Qd},wz={91:oy},vz={[-2]:wu,[-1]:wu,32:wu},bz={35:ly,42:Lo,45:[rh,Lo],60:uy,61:rh,95:Lo,96:Yd,126:Yd},_z={38:Kd,92:Wd},xz={[-5]:bu,[-4]:bu,[-3]:bu,33:dy,38:Kd,42:yu,60:[ny,fy],91:hy,92:[ay,Wd],93:Mo,95:yu,96:iy},kz={null:[yu,Bx]},Sz={null:[42,95]},Ez={null:[]};p();function Hx(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},i={},s=[],o=[],a=[],l=!0,c={attempt:T(S),check:T(C),consume:E,enter:_,exit:x,interrupt:T(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:v,events:[],now:y,parser:t,previous:null,sliceSerialize:g,sliceStream:m,write:h},f=e.tokenize.call(u,c),d;return e.resolveAll&&s.push(e),u;function h(F){return o=br(o,F),b(),o[o.length-1]!==null?[]:(P(e,0),u.events=ul(s,u.events,u),u.events)}function g(F,j){return Tz(m(F),j)}function m(F){return Cz(o,F)}function y(){let{_bufferIndex:F,_index:j,line:Q,column:ge,offset:ie}=n;return{_bufferIndex:F,_index:j,line:Q,column:ge,offset:ie}}function v(F){i[F.line]=F.column,N()}function b(){let F;for(;n._index-1){let a=o[0];typeof a=="string"?o[0]=a.slice(n):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function Tz(t,e){let r=-1,n=[],i;for(;++r0){let Kn=te.tokenStack[te.tokenStack.length-1];(Kn[1]||Qx).call(te,void 0,Kn[0])}for(H.position={start:$s(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:$s(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke "),s.shift(2);let o=r.indentLines(r.containerFlow(t,s.current()),Nz);return i(),o}function Nz(t,e,r){return">"+(r?"":" ")+t}p();p();function sh(t,e){return ek(t,e.inConstruct,!0)&&!ek(t,e.notInConstruct,!1)}function ek(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let n=-1;for(;++no&&(o=s):s=1,i=n+e.length,n=r.indexOf(e,i);return o}p();function _u(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}p();function rk(t){let e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function nk(t,e,r,n){let i=rk(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(_u(t,r)){let f=r.enter("codeIndented"),d=r.indentLines(s,Fz);return f(),d}let a=r.createTracker(n),l=i.repeat(Math.max(tk(s,i)+1,3)),c=r.enter("codeFenced"),u=a.move(l);if(t.lang){let f=r.enter(`codeFencedLang${o}`);u+=a.move(r.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),f()}if(t.lang&&t.meta){let f=r.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(r.safe(t.meta,{before:u,after:` `,encode:["`"],...a.current()})),f()}return u+=a.move(` `),s&&(u+=a.move(s+` `)),u+=a.move(l),c(),u}function Fz(t,e,r){return(r?"":" ")+t}p();p();function fl(t){let e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function ik(t,e,r,n){let i=fl(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition"),a=r.enter("label"),l=r.createTracker(n),c=l.move("[");return c+=l.move(r.safe(r.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":` `,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}p();p();function sk(t){let e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}p();function rn(t){return"&#x"+t.toString(16).toUpperCase()+";"}p();function dl(t,e,r){let n=cl(t),i=cl(e);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_y.peek=Dz;function _y(t,e,r,n){let i=sk(r),s=r.enter("emphasis"),o=r.createTracker(n),a=o.move(i),l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()})),c=l.charCodeAt(0),u=dl(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=rn(c)+l.slice(1));let f=l.charCodeAt(l.length-1),d=dl(n.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+rn(f));let h=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:u.outside},a+l+h}function Dz(t,e,r){return r.options.emphasis||"*"}p();p();p();p();p();p();p();p();var hl=function(t){if(t==null)return Bz;if(typeof t=="function")return oh(t);if(typeof t=="object")return Array.isArray(t)?zz(t):Mz(t);if(typeof t=="string")return Lz(t);throw new Error("Expected function, string, or object as test")};function zz(t){let e=[],r=-1;for(;++r":""))+")"})}return d;function d(){let h=ok,g,m,y;if((!e||s(l,c,u[u.length-1]||void 0))&&(h=jz(r(l,u)),h[0]===Bo))return h;if("children"in l&&l.children){let v=l;if(v.children&&h[0]!==lh)for(m=(n?v.children.length:-1)+o,y=u.concat(v);m>-1&&m",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function Vz(){return"!"}p();Ey.peek=Hz;function Ey(t,e,r,n){let i=t.referenceType,s=r.enter("imageReference"),o=r.enter("label"),a=r.createTracker(n),l=a.move("!["),c=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();let u=r.stack;r.stack=[],o=r.enter("reference");let f=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!c||c!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Hz(){return"!"}p();Cy.peek=Gz;function Cy(t,e,r){let n=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s\u007F]/.test(t.url))}Ay.peek=Qz;function Ay(t,e,r,n){let i=fl(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n),a,l;if(Ty(t,r)){let u=r.stack;r.stack=[],a=r.enter("autolink");let f=o.move("<");return f+=o.move(r.containerPhrasing(t,{before:f,after:">",...o.current()})),f+=o.move(">"),a(),r.stack=u,f}a=r.enter("link"),l=r.enter("label");let c=o.move("[");return c+=o.move(r.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=r.enter("destinationRaw"),c+=o.move(r.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(t.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function Qz(t,e,r){return Ty(t,r)?"<":"["}p();Iy.peek=Wz;function Iy(t,e,r,n){let i=t.referenceType,s=r.enter("linkReference"),o=r.enter("label"),a=r.createTracker(n),l=a.move("["),c=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();let u=r.stack;r.stack=[],o=r.enter("reference");let f=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!c||c!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Wz(){return"["}p();p();function ml(t){let e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}p();function lk(t){let e=ml(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}p();function ck(t){let e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}p();function uh(t){let e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function uk(t,e,r,n){let i=r.enter("list"),s=r.bulletCurrent,o=t.ordered?ck(r):ml(r),a=t.ordered?o==="."?")":".":lk(r),l=e&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!t.ordered){let u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),uh(r)===o&&u){let f=-1;for(;++f-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);let a=r.createTracker(n);a.move(s+" ".repeat(o-s.length)),a.shift(o);let l=r.enter("listItem"),c=r.indentLines(r.containerFlow(t,a.current()),u);return l(),c;function u(f,d,h){return d?(h?"":" ".repeat(o))+f:(h?s:s+" ".repeat(o-s.length))+f}}p();function hk(t,e,r,n){let i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}p();p();p();var Py=hl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function pk(t,e,r,n){return(t.children.some(function(o){return Py(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}p();p();function mk(t){let e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}$y.peek=Kz;function $y(t,e,r,n){let i=mk(r),s=r.enter("strong"),o=r.createTracker(n),a=o.move(i+i),l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()})),c=l.charCodeAt(0),u=dl(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=rn(c)+l.slice(1));let f=l.charCodeAt(l.length-1),d=dl(n.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+rn(f));let h=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:u.outside},a+l+h}function Kz(t,e,r){return r.options.strong||"*"}p();function gk(t,e,r,n){return r.safe(t.value,n)}p();p();function yk(t){let e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function wk(t,e,r){let n=(uh(r)+(r.options.ruleSpaces?" ":"")).repeat(yk(r));return r.options.ruleSpaces?n.slice(0,-1):n}var vk={blockquote:Xx,break:by,code:nk,definition:ik,emphasis:_y,hardBreak:by,heading:ak,html:ky,image:Sy,imageReference:Ey,inlineCode:Cy,link:Ay,linkReference:Iy,list:uk,listItem:dk,paragraph:hk,root:pk,strong:$y,text:gk,thematicBreak:wk};p();var bk=[Yz];function Yz(t,e,r,n){if(e.type==="code"&&_u(e,n)&&(t.type==="list"||t.type===e.type&&_u(t,n)))return!1;if("spread"in r&&typeof r.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&ch(e,n))?void 0:r.spread?1:0}p();var Uo=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],_k=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:` `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:Uo},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:Uo},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r *])`},{character:"*",inConstruct:"phrasing",notInConstruct:Uo},{atBreak:!0,character:"+",after:`(?:[ \r ])`},{atBreak:!0,character:"-",after:`(?:[ \r -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:Uo},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:Uo},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:Uo},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:Uo},{atBreak:!0,character:"~"}];p();function xk(t){return t.label||!t.identifier?t.label||"":nh(t.identifier)}p();function kk(t){if(!t._compiled){let e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}p();function Sk(t,e,r){let n=e.indexStack,i=t.children||[],s=[],o=-1,a=r.before,l;n.push(-1);let c=e.createTracker(r);for(;++o0&&(a==="\r"||a===` `)&&u.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),a=" ",c=e.createTracker(r),c.move(s.join("")));let d=e.handle(u,t,e,{...c.current(),after:f,before:a});l&&l===d.slice(0,1)&&(d=rn(l.charCodeAt(0))+d.slice(1));let h=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,l=void 0,h&&(s.length>0&&h.before&&a===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+rn(a.charCodeAt(0))),h.after&&(l=f)),c.move(d),s.push(d),a=d.slice(-1)}return n.pop(),s.join("")}p();function Ek(t,e,r){let n=e.indexStack,i=t.children||[],s=e.createTracker(r),o=[],a=-1;for(n.push(-1);++a `}return` `}p();var Jz=/\r?\n|\r/g;function Ck(t,e){let r=[],n=0,i=0,s;for(;s=Jz.exec(t);)o(t.slice(n,s.index)),r.push(s[0]),n=s.index+s[0].length,i++;return o(t.slice(n)),r.join("");function o(a){r.push(e(a,i,!a))}}p();function Ak(t,e,r){let n=(r.before||"")+(e||"")+(r.after||""),i=[],s=[],o={},a=-1;for(;++a=c||u+1":""))+")"})}return d;function d(){let h=jk,g,m,y;if((!e||s(l,c,u[u.length-1]||void 0))&&(h=xM(r(l,u)),h[0]===Fk))return h;if("children"in l&&l.children){let v=l;if(v.children&&h[0]!==bM)for(m=(n?v.children.length:-1)+o,y=u.concat(v);m>-1&&m=48&&t<=57||t===FM||t===DM?!0:zM.test(String.fromCodePoint(t))}function qy(t){return t===null?!1:!(t>=48&&t<=57)}function LM(){return{text:{[Vy]:{name:"tag",tokenize:BM}}}}function BM(t,e,r){let n=!1,i=this;return s;function s(u){let f=i.previous;return!(f===null||MM(f)||f===Vy)||u!==Vy?r(u):(t.enter("tag"),t.enter("tagMarker"),t.consume(u),t.exit("tagMarker"),o)}function o(u){return jy(u)?(t.enter("tagContent"),qy(u)&&(n=!0),t.consume(u),a):r(u)}function a(u){return u===NM?(t.consume(u),l):jy(u)?(qy(u)&&(n=!0),t.consume(u),a):c(u)}function l(u){return jy(u)?(qy(u)&&(n=!0),t.consume(u),a):r(u)}function c(u){return n?(t.exit("tagContent"),t.exit("tag"),e(u)):r(u)}}function UM(){return{enter:{wikilink(t){this.enter({type:"wikilink",value:"",embedded:!1,path:"",heading:"",alias:""},t)},wikilinkEmbedMarker(){let t=this.stack[this.stack.length-1];t.embedded=!0},wikilinkPath(t){let e=this.stack[this.stack.length-1];e.path=this.sliceSerialize(t).replace(/\\([#\[\]])/g,"$1")},wikilinkHeading(t){let e=this.stack[this.stack.length-1];e.heading=this.sliceSerialize(t).replace(/\\([#\[\]])/g,"$1")},wikilinkAlias(t){let e=this.stack[this.stack.length-1];e.alias=this.sliceSerialize(t)}},exit:{wikilink(t){let e=this.stack[this.stack.length-1];e.alias&&(e.path.endsWith("\\")&&(e.path=e.path.slice(0,-1)),e.heading.endsWith("\\")&&(e.heading=e.heading.slice(0,-1))),this.exit(t)}}}}function jM(){return{enter:{highlight(t){this.enter({type:"highlight",children:[]},t)}},exit:{highlightContent(t){let e=this.stack[this.stack.length-1];e.children=[{type:"text",value:this.sliceSerialize(t)}]},highlight(t){this.exit(t)}}}}function qM(){return{enter:{comment(t){this.enter({type:"comment",value:""},t)}},exit:{commentContent(t){let e=this.stack[this.stack.length-1];e.value+=this.sliceSerialize(t)},comment(t){this.exit(t)}}}}function VM(){return{enter:{tag(t){this.enter({type:"tag",value:""},t)},tagContent(t){let e=this.stack[this.stack.length-1];e.type==="tag"&&(e.value=this.sliceSerialize(t))}},exit:{tag(t){this.exit(t)}}}}function HM(){return{handlers:{wikilink(t){let e=t.embedded?"!":"",r=t.heading?`#${t.heading}`:"",n=t.alias?`|${t.alias}`:"";return`${e}[[${t.path}${r}${n}]]`}}}}function GM(){return{handlers:{highlight(t,e,r,n){let i=r.enter("highlight"),s=r.containerPhrasing(t,n);return i(),`==${s}==`}}}}function QM(){return{handlers:{comment(t){return`%%${t.value}%%`}}}}function WM(){return{handlers:{tag(t){return`#${t.value}`}}}}function KM(t,e){qk(t,"listItem",r=>{if(typeof r.checked=="boolean"){let a=r.checked?"x":" ";if(e&&r.position?.start?.offset!=null){let c=e.slice(r.position.start.offset,r.position.start.offset+20).match(/\[([^\]])\]/);c&&(a=c[1])}r.data??={},r.data.taskChar=a,r.data.hProperties??={},r.data.hProperties.dataTaskChar=a;return}let n=r.children?.[0];if(!n||n.type!=="paragraph")return;let i=n.children?.[0];if(!i||i.type!=="text")return;let s=i.value.match(/^\[([^\]])\]\s/);if(!s)return;let o=s[1];r.checked=o!==" ",r.data??={},r.data.taskChar=o,r.data.hProperties??={},r.data.hProperties.dataTaskChar=o,i.value=i.value.slice(s[0].length),i.value.length===0?n.children.shift():i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column+=s[0].length,i.position.start.offset+=s[0].length)})}var Aee=Ns(/[A-Za-z]/),Iee=Ns(/[\dA-Za-z]/),Pee=Ns(/[#-'*+\--9=?A-Z^-~]/),$ee=Ns(/\d/),Ree=Ns(/[\dA-Fa-f]/),Oee=Ns(/[!-/:-@[-`{-~]/);function Ho(t){return t!==null&&t<-2}function Lk(t){return t===-2||t===-1||t===32}var Nee=Ns(/\p{P}|\p{S}/u),Fee=Ns(/\s/);function Ns(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function ph(t,e,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,s=0;return o;function o(l){return Lk(l)?(t.enter(r),a(l)):e(l)}function a(l){return Lk(l)&&s++o&&(o=s):s=1,i=n+e.length,n=r.indexOf(e,i);return o}function iL(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:a,mathText:o,mathTextData:a}};function t(l){let c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function e(){this.buffer()}function r(){let l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){let c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c;let f=u.data.hChildren[0];f.type,f.tagName,f.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){let c=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c,u.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function sL(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),n.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:n}};function r(s,o,a,l){let c=s.value||"",u=a.createTracker(l),f="$".repeat(Math.max(nL(c,"$")+1,2)),d=a.enter("mathFlow"),h=u.move(f);if(s.meta){let g=a.enter("mathFlowMeta");h+=u.move(a.safe(s.meta,{after:` `,before:h,encode:["$"],...u.current()})),g()}return h+=u.move(` `),c&&(h+=u.move(c+` `)),h+=u.move(f),d(),h}function n(s,o,a){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;let u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let f=-1;for(;++f{e.comments&&qk(i,"comment",(o,a,l)=>{if(l&&typeof a=="number")return l.children.splice(a,1),a}),e.customTaskChars&&KM(i,String(s))}}p();p();p();p();var wh=class{integrations=[];register(e){this.integrations.push(e)}getAll(){return[...this.integrations]}getByCategory(e){return this.integrations.filter(r=>r.category===e)}getEnabled(e){return this.integrations.filter(r=>e[r.settingKey]&&r.isAvailable()).sort((r,n)=>r.priority-n.priority)}getAvailable(){return this.integrations.filter(e=>e.isAvailable())}getAllPatterns(e){return this.getEnabled(e).flatMap(r=>r.getPatterns())}getCollectedAssets(e){let r=new Map;for(let n of this.getEnabled(e))n.assets.scss&&r.set(n.id,n.assets);return r}getById(e){return this.integrations.find(r=>r.id===e)}},Bt=new wh;p();var Gk=require("obsidian");var Hy="quartz/styles/syncer",aL="_index.scss",vh="quartz/styles/custom.scss",yl='@use "./syncer";',ku=class{settings;constructor(e){this.settings=e}async collectAssets(e){let r={success:!1,filesToStage:new Map,filesToDelete:[]};try{if(!this.settings.manageSyncerStyles){let i=await this.collectCleanup(e);return r.filesToDelete=i.filesToDelete,i.customScssUpdate&&r.filesToStage.set(vh,i.customScssUpdate),r.filesToDelete.length>0||r.filesToStage.size>0,r.success=!0,r}let n=this.getScssFiles();if(n.size>0){for(let[s,o]of n)r.filesToStage.set(s,o);let i=await this.getCustomScssUpdate(e);i&&r.filesToStage.set(vh,i)}r.success=!0}catch{new Gk.Notice("Quartz Syncer: Failed to collect integration styles. Check console for details.",1e4),r.success=!1}return r}async collectCleanup(e){let r=[],n=null;try{let i=await e.getContent();if(i){let s=i.tree.filter(o=>o.path.startsWith(Hy)&&o.type==="blob");for(let o of s)r.push(o.path)}}catch{}try{let i=await e.getRawFile(vh);if(i){let s=w.from(i.content,"base64").toString("utf-8");s.includes(yl)&&(n=this.removeSyncerImport(s))}}catch{}return{filesToDelete:r,customScssUpdate:n}}async getCustomScssUpdate(e){try{let r="";try{let n=await e.getRawFile(vh);n&&(r=w.from(n.content,"base64").toString("utf-8"))}catch{}return r.includes(yl)?null:this.insertSyncerImport(r)}catch(r){throw r}}insertSyncerImport(e){if(!e.trim())return`${yl} `;let r=/@use\s+["']\.\/(?:base|variables)(?:\.scss)?["'](?:\s+as\s+\*)?;?/,n=e.match(r);if(n){let i=n.index+n[0].length,s=e.slice(0,i),o=e.slice(i);return`${s} ${yl}${o}`}return`${yl} ${e}`}removeSyncerImport(e){let r=new RegExp(`\\n?${yl.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\n?`,"g");return e.replace(r,` `).replace(/^\n+/,"")}getScssFiles(){let e=new Map,r=Bt.getCollectedAssets(this.settings),n=[];for(let[i,s]of r)if(s.scss){let o=`_${i}.scss`,a=`${Hy}/${o}`;e.set(a,s.scss),n.push(`@use "./${i}";`)}if(n.length>0){let i=`// Quartz Syncer Integration Styles // This file is auto-generated. Do not edit manually. ${n.join(` `)} `;e.set(`${Hy}/${aL}`,i)}return e}};p();var vl=require("obsidian");p();p();var Qk="auto-card-link",Wk="obsidian-excalidraw-plugin",Kk="datacore",Yk="dataview",Zk="obsidian-5e-statblocks";function wl(){return app.plugins.plugins[Yk]?.api}function Jk(t,e,r){let n="";try{n=r.tryEvaluate(t.trim(),{this:r.page(e)??{}})?.toString()??""}catch{}return n}async function Xk(t,e,r){let n=activeDocument.createElement("div"),i=new vl.Component;i.load(),await r.executeJs(t,n,i,e),await ns(n,"[data-tag-name]");let s=(0,vl.htmlToMarkdown)(n)||"";return Vg(s)}var eS={id:"dataview",name:"Dataview",settingKey:"useDataview",priority:100,category:"community",assets:{},isAvailable(){return!!wl()},getPatterns(){let t=wl(),e=[{id:"dv-block",pattern:/```dataview\s(.+?)```/gms,type:"block"}];if(t){let r=t.settings.dataviewJsKeyword||"dataviewjs",n=t.settings.inlineQueryPrefix||"=",i=t.settings.inlineJsQueryPrefix||"$=";e.push({id:"dv-js-block",pattern:new RegExp("```"+Yn(r)+"\\s(.+?)```","gms"),type:"block"},{id:"dv-inline",pattern:new RegExp("`"+Yn(n)+"(.+?)`","gms"),type:"inline"},{id:"dv-inline-js",pattern:new RegExp("`"+Yn(i)+"(.+?)`","gms"),type:"inline"})}return e},async compile(t,e){let r=wl();if(!r)return t.fullMatch;let n=e.file.getPath(),i=t.captures[0],{isInsideCalloutDepth:s,finalQuery:o}=jd(i);try{let a="";switch(t.descriptor.id){case"dv-block":{let l=await r.tryQueryMarkdown(o,n);return s>0&&(l=Ud(l,s)),l}case"dv-js-block":return await Xk(o,n,r)??"";case"dv-inline":return a=Jk(i.trim(),n,r),a?.toString()??"";case"dv-inline-js":return a=Jk(i,n,r),a||(a=await Xk(i,n,r)),a??"Unable to render query";default:return t.fullMatch}}catch{return new vl.Notice("Quartz Syncer: Unable to render dataview query. Please update the dataview plugin to the latest version."),t.fullMatch}}};p();var Jn=require("obsidian");var lL=` /* Card styles */ .datacore-card { display: flex; flex-direction: column; padding: 1.2rem; border-radius: 0.5em; background-color: var(--background-secondary); min-width: 89%; border: 2px solid var(--table-border-color); overflow-y: scroll; transition: all 0.3s cubic-bezier(0.65, 0.05, 0.36, 1); } .datacore-card-title { margin-bottom: 0.6em; display: flex; justify-content: space-between; font-size: 1.8em; } .datacore-card-title.centered { justify-content: center !important; } .datacore-card-content, .datacore-card-inner { transition: all 0.3s cubic-bezier(0.65, 0.05, 0.36, 1); } .datacore-card-inner { overflow-y: scroll; overflow-x: hidden; max-height: 500px; display: flex; } .datacore-card .datacore-card-collapser, .datacore-card.is-collapsed .datacore-card-collapser { transition: all 0.5s cubic-bezier(0.65, 0.05, 0.36, 1); } .datacore-card-content { flex-grow: 1; } .datacore-card:not(.datacore-card.is-collapsed) .datacore-card-collapser { transform: rotate(180deg); } .datacore-card.is-collapsed .datacore-card-collapser { transform: rotate(0deg) !important; } .datacore-card-collapse, .datacore-card-collapser svg { min-width: 1em; min-height: 1em; fill: currentColor; vertical-align: middle; } .datacore-card .datacore-card-footer { font-size: 0.7em; text-align: right; padding: 0; } /* Table styles */ .datacore-table { width: 100%; } .datacore-table > thead > tr, .datacore-table > tbody > tr { margin-top: 1em; margin-bottom: 1em; text-align: left; } .datacore-table > tbody > tr:hover { background-color: var(--text-selection) !important; } .datacore-table > thead > tr > th { font-weight: 700; font-size: larger; border-top: none; border-left: none; border-right: none; border-bottom: solid; max-width: 100%; } .datacore-table > tbody > tr > td { text-align: left; border: none; font-weight: 400; max-width: 100%; } .datacore-table ul, .datacore-table ol { margin-block-start: 0.2em !important; margin-block-end: 0.2em !important; } .datacore-table-header-cell-content { width: auto; display: inline-flex; flex-direction: row; } .datacore-table-sort { flex-grow: 0; margin-right: 0.25em; align-items: center; } .datacore-table-header-title { align-items: center; flex-grow: 1; } /* Layout styles */ .dc-stack { display: flex; flex-direction: column; margin: 4px; } .dc-group { display: flex; flex-direction: row; margin: 4px; } /* Basic UI elements */ .dc-button { padding: 4px; margin-left: 4px; margin-right: 4px; margin-top: 2px; margin-bottom: 2px; } .dc-intent-error { background-color: var(--color-red) !important; } .dc-intent-warn { background-color: var(--color-orange) !important; } .dc-intent-info { background-color: var(--color-blue) !important; } .dc-intent-success { background-color: var(--color-green) !important; } .dc-textbox { padding: 4px; margin-left: 4px; margin-right: 4px; margin-top: 2px; margin-bottom: 2px; } .dc-checkbox { display: inline-flex; align-items: center; cursor: pointer; margin: 4px 0; font-size: 16px; } .dc-checkbox input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; } .dc-checkbox:hover { opacity: 0.8; } .dc-checkbox input[type="checkbox"]:focus { outline: none; box-shadow: var(--shadow-s); } .dc-checkbox-disabled { cursor: not-allowed; opacity: 0.6; } .dc-checkbox-disabled input[type="checkbox"] { cursor: not-allowed; } .dc-slider { -webkit-appearance: none; appearance: none; transition: background 0.3s; } .dc-switch.dc-switch-disabled { cursor: not-allowed; opacity: 0.6; } .dc-icon { display: inline-flex; align-items: center; } /* Paging controls */ .dc-paging-control { width: 100%; display: flex; justify-content: center; align-items: center; margin-top: 10px; margin-bottom: 10px; gap: 10px; } button.dc-paging-control-page { width: var(--input-height); height: var(--input-height); padding: 0; cursor: pointer; background-color: unset; box-shadow: none; } button.dc-paging-control-page:hover { background-color: var(--text-selection); } button.dc-paging-control-page-active { background-color: var(--text-selection); } button.dc-paging-control-page[disabled] { cursor: inherit; opacity: 0.5; } button.dc-paging-control-page[disabled]:hover { background-color: unset; box-shadow: none; } .dc-paging-control-separator:hover > .dc-paging-control-ellipsis { display: none; } .dc-paging-control-separator > .dc-paging-control-leap-left, .dc-paging-control-separator > .dc-paging-control-leap-right { display: none; } .dc-paging-control-separator:hover > .dc-paging-control-leap-left, .dc-paging-control-separator:hover > .dc-paging-control-leap-right { display: flex; } .dc-paging-control-separator > .dc-paging-control-leap-left { transform: rotate(180deg); } /* Callout styles */ .datacore .callout-content, .datacore.callout { transition: all 100ms cubic-bezier(0.02, 0.01, 0.47, 1); margin-top: 10px; margin-bottom: 10px; } .datacore .callout-fold { align-self: center; } /* Embed styles */ .datacore-span-embed { position: relative; padding: 1px 8px 1px 8px; margin: 4px 0px 4px 0px; background-color: var(--color-base-25); } .datacore-embed-source { position: absolute; top: 4px; right: 4px; padding-left: 4px; padding-right: 4px; background-color: var(--background-secondary-alt); color: var(--text-faint); font-size: var(--font-smallest); } /* Error and loading styles */ .datacore-error-retry { margin-top: 1em; text-align: center; } .datacore-error-box { width: 100%; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 4px dashed var(--background-secondary); } .datacore-error-title { text-align: center; } .datacore-error-message { color: var(--text-muted); text-align: center; } .datacore-loading-boundary { width: 100%; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 4px dashed var(--background-secondary); } .datacore-loading-title { text-align: center; } .datacore-loading-content { color: var(--text-muted); text-align: center; } /* Language block styles */ .block-language-datacore li.selected, .block-language-datacorejs li.selected { background: var(--text-accent); padding: 0.2em; border-radius: 50%; width: 2em; height: 2em; } .block-language-datacore li.selected a, .block-language-datacorejs li.selected a { color: var(--text-on-accent-inverted); display: block; text-align: center; font-weight: bold; } .block-language-datacore .datacore-pager, .block-language-datacorejs .datacore-pager { display: flex; justify-content: space-between; list-style: none; min-width: 90%; margin-right: 1.7em; } .block-language-datacore li.previous, .block-language-datacore li.next, .block-language-datacorejs li.previous, .block-language-datacorejs li.next { min-height: 1.4em; min-width: 1.4em; } .block-language-datacore li.previous svg, .block-language-datacore li.next svg, .block-language-datacorejs li.previous svg, .block-language-datacorejs li.next svg { color: currentColor; fill: currentColor !important; } `;function tS(){if(Ts(Kk))return window.datacore}async function cL(t,e,r){let n=activeDocument.createElement("div"),i=new Jn.Component;try{r.executeJs(t,n,i,e)}catch(s){return new Jn.Notice(`Quartz Syncer: DatacoreJS execution error: ${String(s)}, trying JSX...`),rS(t,e,r)}return i.load(),await ns(n,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),n}async function rS(t,e,r){let n=activeDocument.createElement("div"),i=new Jn.Component;try{r.executeJsx(t,n,i,e)}catch(s){return new Jn.Notice(`Quartz Syncer: DatacoreJSX execution error: ${String(s)}`),n}return i.load(),await ns(n,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),n}async function uL(t,e,r){let n=activeDocument.createElement("div"),i=new Jn.Component;try{r.executeTs(t,n,i,e)}catch(s){return new Jn.Notice(`Quartz Syncer: DatacoreTS execution error: ${String(s)}, trying TSX...`),nS(t,e,r)}return i.load(),await ns(n,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),n}async function nS(t,e,r){let n=activeDocument.createElement("div"),i=new Jn.Component;try{r.executeTsx(t,n,i,e)}catch(s){return new Jn.Notice(`Quartz Syncer: DatacoreTSX execution error: ${String(s)}`),n}return i.load(),await ns(n,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),n}var iS={id:"datacore",name:"Datacore",settingKey:"useDatacore",priority:100,category:"community",assets:{scss:lL},isAvailable(){return!!tS()},getPatterns(){return[{id:"dc-js",pattern:/```datacorejs\s(.+?)```/gms,type:"block"},{id:"dc-jsx",pattern:/```datacorejsx\s(.+?)```/gms,type:"block"},{id:"dc-ts",pattern:/```datacorets\s(.+?)```/gms,type:"block"},{id:"dc-tsx",pattern:/```datacoretsx\s(.+?)```/gms,type:"block"}]},async compile(t,e){let r=tS();if(!r)return t.fullMatch;let n=e.file.getPath(),i=t.captures[0],{isInsideCalloutDepth:s,finalQuery:o}=jd(i),a=new XMLSerializer;try{let l;switch(t.descriptor.id){case"dc-js":l=await cL(o,n,r);break;case"dc-jsx":l=await rS(o,n,r);break;case"dc-ts":l=await uL(o,n,r);break;case"dc-tsx":l=await nS(o,n,r);break;default:return t.fullMatch}let c=fu(l,a);return s>0?Ud(c,s):c}catch(l){return new Jn.Notice(`Quartz Syncer: Datacore query error: ${String(l)}`),t.fullMatch}}};p();var sS={id:"excalidraw",name:"Excalidraw",settingKey:"useExcalidraw",priority:50,category:"community",assets:{},isAvailable(){return Ts(Wk)},getPatterns(){return[]},async compile(t){return t.fullMatch}};p();var bh=require("obsidian");var fL=` // Quartz fixes .statblock { .statblock-item-container div { display: inline; &.tapered-rule, span.statblock-table-header { display: block; } &.statblock-table { display: flex; } &.traits { font-family: var(--active-traits-font); color: var(--active-traits-font-color); font-size: var(--active-traits-font-size); font-weight: var(--active-traits-font-weight); font-style: var(--active-traits-font-style); } } p { color: inherit; display: inline; font: inherit; } } // Quartz fixes end :root { --statblock-primary-color: #7a200d; --statblock-rule-color: #922610; --statblock-background-color: #fdf1dc; --statblock-bar-color: #e69a28; --statblock-bar-border-size: 1px; --statblock-bar-border-color: #000; --statblock-image-width: 75px; --statblock-image-height: 75px; --statblock-image-border-size: 2px; --statblock-image-border-color: var(--statblock-primary-color); --statblock-border-size: 1px; --statblock-border-color: #ddd; --statblock-box-shadow-color: #ddd; --statblock-box-shadow-x-offset: 0; --statblock-box-shadow-y-offset: 0; --statblock-box-shadow-blur: 1.5em; --statblock-font-color: var(--statblock-primary-color); --statblock-font-weight: 700; --statblock-content-font: "Noto Sans", "Myriad Pro", Calibri, Helvetica, Arial, sans-serif; --statblock-content-font-size: 14px; --statblock-heading-font: "Libre Baskerville", "Lora", "Calisto MT", "Bookman Old Style", Bookman, "Goudy Old Style", Garamond, "Hoefler Text", "Bitstream Charter", Georgia, serif; --statblock-heading-font-color: var(--statblock-font-color); --statblock-heading-font-size: 23px; --statblock-heading-font-variant: small-caps; --statblock-heading-font-weight: var(--statblock-font-weight); --statblock-heading-line-height: inherit; --statblock-property-line-height: 1.4; --statblock-property-font-color: var(--statblock-font-color); --statblock-property-name-font-color: var(--statblock-font-color); --statblock-property-name-font-weight: bold; --statblock-section-heading-border-size: 1px; --statblock-section-heading-border-color: var(--statblock-primary-color); --statblock-section-heading-font-color: var(--statblock-font-color); --statblock-section-heading-font-size: 21px; --statblock-section-heading-font-variant: small-caps; --statblock-section-heading-font-weight: normal; --statblock-saves-line-height: 1.4; --statblock-spells-font-style: italic; --statblock-subheading-font-size: 12px; --statblock-subheading-font-style: italic; --statblock-subheading-font-weight: normal; --statblock-table-header-font-weight: bold; --statblock-traits-name-font-weight: bold; --statblock-traits-name-font-style: italic; --statblock-link-style: italic; } .statblock-item-container { margin-bottom: 0.25rem; } .statblock-item-inline { display: flex; justify-content: space-between; } .statblock { --active-primary-color: var(--statblock-primary-color); --active-rule-color: var(--statblock-rule-color); --active-background-color: var(--statblock-background-color); --active-bar-color: var(--statblock-bar-color); --active-bar-border-size: var(--statblock-bar-border-size); --active-bar-border-color: var(--statblock-bar-border-color); --active-image-width: var(--statblock-image-width); --active-image-height: var(--statblock-image-height); --active-image-border-size: var(--statblock-image-border-size); --active-image-border-color: var(--statblock-image-border-color, var(--active-primary-color)); --active-border-size: var(--statblock-border-size); --active-border-color: var(--statblock-border-color); --active-box-shadow-color: var(--statblock-box-shadow-color); --active-box-shadow-x-offset: var(--statblock-box-shadow-x-offset); --active-box-shadow-y-offset: var(--statblock-box-shadow-y-offset); --active-box-shadow-blur: var(--statblock-box-shadow-blur); --active-font-color: var(--statblock-font-color, var(--active-primary-color)); --active-font-weight: var(--statblock-font-weight); --active-content-font: var(--statblock-content-font); --active-content-font-size: var(--statblock-content-font-size); --active-heading-font: var(--statblock-heading-font); --active-heading-font-color: var(--statblock-heading-font-color); --active-heading-font-size: var(--statblock-heading-font-size); --active-heading-font-variant: var(--statblock-heading-font-variant); --active-heading-font-weight: var(--statblock-heading-font-weight); --active-heading-line-height: var(--statblock-heading-line-height); --active-property-line-height: var(--statblock-property-line-height); --active-property-font: var(--statblock-property-font); --active-property-font-color: var(--statblock-property-font-color); --active-property-font-variant: var(--statblock-property-font-variant); --active-property-font-size: var(--statblock-property-font-size); --active-property-font-weight: var(--statblock-property-font-weight); --active-property-name-font: var(--statblock-property-name-font); --active-property-name-font-color: var(--statblock-property-name-font-color); --active-property-name-font-variant: var(--statblock-property-name-font-variant); --active-property-name-font-size: var(--statblock-property-name-font-size); --active-property-name-font-weight: var(--statblock-property-name-font-weight); --active-section-heading-border-size: var(--statblock-section-heading-border-size); --active-section-heading-border-color: var(--statblock-section-heading-border-color); --active-section-heading-font: var(--statblock-section-heading-font); --active-section-heading-font-color: var(--statblock-section-heading-font-color); --active-section-heading-font-size: var(--statblock-section-heading-font-size); --active-section-heading-font-variant: var(--statblock-section-heading-font-variant); --active-section-heading-font-weight: var(--statblock-section-heading-font-weight); --active-saves-line-height: var(--statblock-saves-line-height); --active-spells-font-style: var(--statblock-spells-font-style); --active-subheading-font: var(--statblock-subheading-font); --active-subheading-font-color: var(--statblock-subheading-font-color); --active-subheading-font-size: var(--statblock-subheading-font-size); --active-subheading-font-style: var(--statblock-subheading-font-style); --active-subheading-font-weight: var(--statblock-subheading-font-weight); --active-table-header-font-weight: var(--statblock-table-header-font-weight); --active-traits-font: var(--statblock-traits-font); --active-traits-font-color: var(--statblock-traits-font-color); --active-traits-font-size: var(--statblock-traits-font-size); --active-traits-font-weight: var(--statblock-traits-font-weight); --active-traits-font-style: var(--statblock-traits-font-style); --active-traits-name-font: var(--statblock-traits-name-font); --active-traits-name-font-color: var(--statblock-traits-name-font-color); --active-traits-name-font-size: var(--statblock-traits-name-font-size); --active-traits-name-font-weight: var(--statblock-traits-name-font-weight); --active-traits-name-font-style: var(--statblock-traits-name-font-style); --active-link-style: var(--statblock-link-style); margin: 0 auto; position: relative; a { font-style: var(--statblock-link-style); } } .statblock-content-container { .statblock-content { font-family: var(--active-content-font); font-size: var(--active-content-font-size); color: var(--active-font-color); background-color: var(--active-background-color); padding: 0.5em; border: var(--active-border-size) var(--active-border-color) solid; box-shadow: var(--active-box-shadow-x-offset) var(--active-box-shadow-y-offset) var(--active-box-shadow-blur) var(--active-box-shadow-color); margin-left: 2px; margin-right: 2px; display: flex; gap: 1rem; > .column { width: var(--statblock-column-width, 400px); } @media screen and (max-width: 400px) { > .column { width: 75vw; } } } } .bar { height: 5px; background: var(--active-bar-color); border: var(--active-bar-border-size) solid var(--active-bar-border-color); z-index: 1; width: auto; } .heading, .statblock-heading { font-family: var(--active-heading-font); color: var(--active-heading-font-color); font-weight: var(--active-heading-font-weight); font-variant: var(--active-heading-font-variant); font-size: var(--active-heading-font-size); line-height: var(--active-heading-line-height); margin: 0px; letter-spacing: 1px; display: flex; justify-content: space-between; align-items: center; } .flex-container { display: flex; justify-content: space-between; align-items: center; } .subheading { font-weight: var(--active-subheading-font-weight); font-style: var(--active-subheading-font-style); font-size: var(--active-subheading-font-size); font-family: var(--active-subheading-font-family); color: var(--active-subheading-font-color); margin: 0; } .line { line-height: var(--active-property-line-height); display: block; font-family: var(--active-property-font); color: var(--active-property-font-color); font-variant: var(--active-property-font-variant); font-size: var(--active-property-font-size); font-weight: var(--active-property-font-weight); } .property-name { margin: 0; margin-right: 0.25em; display: inline; font-family: var(--active-property-name-font); color: var(--active-property-name-font-color); font-variant: var(--active-property-name-font-variant); font-size: var(--active-property-name-font-size); font-weight: var(--active-property-name-font-weight); } .section-header { border-bottom: var(--active-section-heading-border-size) solid var(--active-section-heading-border-color); color: var(--active-section-heading-font-color); font-size: var(--active-section-heading-font-size); font-variant: var(--active-section-heading-font-variant); font-weight: var(--active-section-heading-font-weight); font-family: var(--active-section-heading-font); letter-spacing: 1px; margin: 0; margin-bottom: 0.3em; break-inside: avoid-column; break-after: avoid-column; } .tapered-rule { width: auto; margin: 0.5em 0; height: 5px; background: linear-gradient( 90deg, var(--active-rule-color) 0%, var(--active-rule-color) 50%, var(--active-background-color) 95%, var(--active-background-color) 100% ); clip-path: polygon(0 0, 0 100%, 95% 50%); } .trait { font-family: var(--active-traits-font); color: var(--active-traits-font-color); font-size: var(--active-traits-font-size); font-weight: var(--active-traits-font-weight); font-style: var(--active-traits-font-style); } .trait-name { font-family: var(--active-traits-name-font); color: var(--active-traits-name-font-color); font-size: var(--active-traits-name-font-size); font-weight: var(--active-traits-name-font-weight); font-style: var(--active-traits-name-font-style); } .statblock-nested-traits { margin-left: 1rem; } .statblock-table { display: flex; justify-content: space-evenly; align-items: center; flex-wrap: wrap; } .table-item { display: flex; justify-content: center; align-items: center; flex-flow: column nowrap; } .statblock-table-header { font-weight: var(--active-table-header-font-weight); } .calculated-modifier::before { content: "("; } .calculated-modifier::after { content: ")"; } .info { .line { line-height: var(--active-saves-line-height); display: block; color: var(--active-font-color); .property-name { color: var(--active-property-name-font-color); margin: 0; margin-right: 0.25em; display: inline; font-weight: bold; } .property-text { display: inline; margin: 0; } } } .save-entry, .save-name, .save-value { display: inline; } .save-entry:not(:last-child) .save-value::after { content: ", "; } .image { width: var(--active-image-width); height: var(--active-image-height); &.pointer { cursor: pointer; } img { object-fit: cover; width: 100%; height: 100%; border-radius: 100%; border: var(--active-image-border-size) solid var(--active-image-border-color); object-position: center; } } `;function oS(){if(Ts(Zk))return window.FantasyStatblocks}async function dL(t,e,r){let n=activeDocument.createElement("div"),i=new bh.Component;i.load();try{r.renderMarkdown(t,n,e,i)}catch(s){return new bh.Notice(`Quartz Syncer: Fantasy Statblocks execution error: ${String(s)}.`),n}return await ns(n,".statblock",5e3),n}var aS={id:"fantasy-statblocks",name:"Fantasy Statblocks",settingKey:"useFantasyStatblocks",priority:100,category:"community",assets:{scss:fL},isAvailable(){return!!oS()},getPatterns(){return[{id:"statblock",pattern:/(```statblock\s.+?```)/gms,type:"block"}]},async compile(t,e){let r=oS();if(!r)return t.fullMatch;let n=t.fullMatch.trim();if(!n)return t.fullMatch;try{let i=await dL(n,e.file.getPath(),r);return[".clickable-icon.extra-setting-button",".statblock-inline-item.action-container"].forEach(c=>{i.querySelectorAll(c).forEach(u=>u.remove())}),i.querySelectorAll("span.calculated-modifier").forEach(c=>{c.textContent&&(c.textContent=`(${c.textContent})`)}),new XMLSerializer().serializeToString(i).replace(' xmlns="http://www.w3.org/1999/xhtml"',"")}catch{return t.fullMatch}}};p();var bl=require("obsidian");var hL=` .auto-card-link-container { background-color: transparent; container-type: inline-size; position: relative; overflow: hidden; user-select: none; --auto-card-link-button-width: calc(var(--icon-size, 18px) + var(--size-2-3, 6px)); --auto-card-link-indent-size: 2.5em; @for $i from 1 through 7 { &[data-auto-card-link-depth="#{$i}"] { margin-left: calc(var(--auto-card-link-indent-size) * #{$i}); } } } .auto-card-link-title { white-space: normal !important; --lh: 1.5em; line-height: var(--lh); height: calc(var(--lh) * 3); overflow: hidden; text-overflow: ellipsis; } .auto-card-link-card { display: flex; flex-direction: row-reverse; height: 8em; transition: 20ms ease-in; cursor: pointer; text-decoration: none; color: var(--link-external-color, var(--highlight)); background: var(--background-primary-alt, var(--darkgray)); border: solid var(--border-width) var(--divider-color, var(--lightgray)); border-radius: var(--radius-s, 4px); &:hover { color: var(--link-external-color-hover, var(--tertiary)); } } .auto-card-link-main { display: flex; flex-grow: 1; flex-direction: column; justify-content: space-between; gap: 0.18em; padding: 0.5em 0.6em; overflow: hidden; text-align: left; } .auto-card-link-description { overflow: hidden; --lh: 1.4em; line-height: var(--lh); height: calc(var(--lh) * 3); color: var(--text-muted, var(--darkgray)); font-size: var(--font-smallest, 0.9em); } .auto-card-link-host { font-size: var(--font-smallest, 0.9em); display: flex; flex-direction: row; align-items: center; text-overflow: ellipsis; white-space: nowrap; } .auto-card-link-thumbnail { margin: 0; width: unset !important; max-height: 100%; object-fit: cover; } .auto-card-link-error-container { color: var(--text-error); padding: 0.5em; border: 1px solid var(--text-error); border-radius: var(--radius-s, 4px); } `,_h=class extends Error{},xh=class extends Error{},pL=/^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})$/i;function mL(t){return new RegExp(pL).test(t)}function gL(t){let e,r=-1;t=t.split(/\r?\n|\r|\n/g).map(n=>n.replace(/^\t+/g,i=>{let s=i.length;return r<0&&(r=s)," ".repeat(s)})).join(` `);try{e=(0,bl.parseYaml)(t)}catch{throw new _h("failed to parse yaml. Check debug console for more detail.")}if(!e||!e.url||!e.title)throw new xh("required params[url, title] are not found.");return{url:e.url,title:e.title,description:e.description,host:e.host,favicon:e.favicon,image:e.image,indent:r}}function Gy(t){let e=activeDocument.createElement("div");e.addClass("auto-card-link-error-container");let r=activeDocument.createElement("span");return r.textContent=`cardlink error: ${t}`,e.appendChild(r),e}function yL(t,e){let r=activeDocument.createElement("div");r.addClass("auto-card-link-container"),r.setAttr("data-auto-card-link-depth",t.indent);let n=activeDocument.createElement("a");n.addClass("auto-card-link-card"),n.setAttr("href",t.url),r.appendChild(n);let i=activeDocument.createElement("div");i.addClass("auto-card-link-main"),n.appendChild(i);let s=activeDocument.createElement("div");if(s.addClass("auto-card-link-title"),s.textContent=t.title,i.appendChild(s),t.description){let a=activeDocument.createElement("div");a.addClass("auto-card-link-description"),a.textContent=t.description,i.appendChild(a)}let o=activeDocument.createElement("div");if(o.addClass("auto-card-link-host"),i.appendChild(o),t.host){let a=activeDocument.createElement("span");a.textContent=t.host,o.appendChild(a)}if(t.image){let a=t.image;if(!mL(a)){let c=a.slice(2,-2),u=e.metadataCache.getFirstLinkpathDest((0,bl.getLinkpath)(c),"")?.path;u&&(a=e.vault.adapter.getResourcePath(u))}let l=activeDocument.createElement("img");l.addClass("auto-card-link-thumbnail"),l.setAttr("src",a),l.setAttr("draggable","false"),n.appendChild(l)}return r}var lS={id:"auto-card-link",name:"Auto Card Link",settingKey:"useAutoCardLink",priority:100,category:"community",assets:{scss:hL},isAvailable(){return Ts(Qk)},getPatterns(){return[{id:"cardlink",pattern:/```cardlink\s(.+?)```/gms,type:"block"}]},async compile(t,e){let r=t.captures[0];if(!r)return t.fullMatch;let n=new XMLSerializer;try{let i=activeDocument.createElement("div");try{let s=gL(r);i.appendChild(yL(s,e.app))}catch(s){return s instanceof xh||s instanceof _h?i.appendChild(Gy(s.message)):s instanceof TypeError&&i.appendChild(Gy("internal links must be surrounded by quotes.")),fu(i,n)}return fu(i,n)}catch(i){return new bl.Notice(`Quartz Syncer: Auto Card Link error: ${String(i)}`),t.fullMatch}}};p();function wL(){let t=app?.internalPlugins;return t?t.getPluginById("bases")?.enabled??!1:!1}var cS={id:"bases",name:"Bases",settingKey:"useBases",priority:200,category:"core",assets:{},isAvailable(){return wL()},getPatterns(){return[]},async compile(t){return t.fullMatch}};p();function vL(){let t=app?.internalPlugins;return t?t.getPluginById("canvas")?.enabled??!1:!1}var uS={id:"canvas",name:"Canvas",settingKey:"useCanvas",priority:200,category:"core",assets:{},isAvailable(){return vL()},getPatterns(){return[]},async compile(t){return t.fullMatch}};Bt.register(lS);Bt.register(eS);Bt.register(iS);Bt.register(sS);Bt.register(aS);Bt.register(cS);Bt.register(uS);var kh=class{app;settings;constructor(e,r){this.app=e,this.settings=r}compile=e=>async r=>{let n=r,i=Bt.getEnabled(this.settings),s={app:this.app,file:e};for(let o of i)o.shouldTransformFile?.(e)&&(n=await o.transformFile(e,n,s));for(let o of i)n=await this.compilePatterns(o,n,s);return n};async compilePatterns(e,r,n){let i=r,s=e.getPatterns();for(let o of s){let a=new RegExp(o.pattern.source,o.pattern.flags),l=[],c;for(;(c=a.exec(r))!==null;)l.push({descriptor:o,fullMatch:c[0],captures:c.slice(1)});for(let u of l){let f=await e.compile(u,n);i=i.replace(u.fullMatch,f)}}return i}getEnabledIntegrations(){return Bt.getEnabled(this.settings)}getCollectedAssets(){return Bt.getCollectedAssets(this.settings)}};var Sh=class t{app;vault;settings;metadataCache;datastore;constructor(e,r,n,i,s){this.app=e,this.vault=r,this.settings=n,this.metadataCache=i,this.datastore=s,this.datastore}runCompilerSteps=(e,r)=>async n=>await r.reduce(async(i,s)=>{let o=await i;return s(e)(o)},Promise.resolve(n));async resolveEmbeddedAssets(e){let r=await this.extractBlobLinks(e),n=[];for(let i of r)try{let s=this.vault.getFileByPath(i);if(!s)continue;let o=await this.vault.readBinary(s);n.push({path:s.path,content:(0,Go.arrayBufferToBase64)(o)})}catch{continue}return n}async generateMarkdown(e){let r=await e.cachedRead(),n=e.getType();if(n==="base"||n==="canvas"||n==="excalidraw"){let l=await this.resolveEmbeddedAssets(e);return[r,{blobs:l}]}let i=[this.convertFrontMatter,this.convertIntegrations,this.linkTargeting,this.astTransform],s=await this.runCompilerSteps(e,i)(r),[o,a]=await this.convertFileLinks(e)(s);return[o,{blobs:a}]}stripVaultPath(e){if(this.settings.vaultPath==="/"||this.settings.vaultPath==="")return e;let r=new RegExp("\\[\\["+Yn(this.settings.vaultPath)+"(.*?)\\]\\]","g"),n=new RegExp("\\[(.*?)\\]\\("+Yn(this.settings.vaultPath)+"(.*?)\\)","g");try{e=e.replace(r,"[[$1]]"),e=e.replace(n,"[$1]($2)")}catch{}return e}astTransform=()=>async e=>{let r=this.settings.vaultPath,n=r!=="/"&&r!=="",i=ry().use(ih).use(hh,["yaml"]).use(Hk).use(fh,{bullet:"-",emphasis:"_",rule:"-"}),s=i.parse(e),o=await i.run(s);n&&(pl(o,"link",l=>{l.url.startsWith(r)&&(l.url=l.url.substring(r.length))}),pl(o,"image",l=>{l.url.startsWith(r)&&(l.url=l.url.substring(r.length))}));let a=i.stringify(o);return a=a.replace(/^((?:> ?)+)\\\[(![\w-]+(?:\|[^\]\r\n]*)?)]/gm,"$1[$2]"),a=a.replace(/\\\[(\^[\w-]+)\]/g,"[$1]"),a=a.replace(/^(\|.*)/gm,l=>l.replace(/(!?\[\[[^\]]*?)(?r=>{let n=e.getCompiledFrontmatter(r);return r.replace(tx,()=>n)};convertIntegrations=e=>async r=>(r=await new kh(this.app,this.settings).compile(e)(r),r);linkTargeting=()=>e=>e.replace(rx,"");static ASSET_EXTENSIONS=new Set(["png","jpg","jpeg","gif","webp","mp4","mkv","mov","avi","mp3","wav","ogg","pdf"]);extractBlobLinks=async e=>{let r=[];if(e.getType()==="canvas"){let i=await e.cachedRead();try{let s=JSON.parse(i);if(Array.isArray(s?.nodes)){for(let o of s.nodes)if(o.type==="file"&&typeof o.file=="string"){let a=this.metadataCache.getFirstLinkpathDest(o.file,e.getPath());a&&t.ASSET_EXTENSIONS.has(a.extension)&&r.push(a.path)}}}catch{}return r}let n=this.metadataCache.getCache(e.getPath());if(e.getType()==="excalidraw"&&n?.links){for(let i of n.links)try{let s=this.metadataCache.getFirstLinkpathDest((0,Go.getLinkpath)(i.link),e.getPath());if(!s||!t.ASSET_EXTENSIONS.has(s.extension))continue;r.push(s.path)}catch{continue}return r}if(!n?.embeds)return r;for(let i of n.embeds)try{let s=this.metadataCache.getFirstLinkpathDest((0,Go.getLinkpath)(i.link),e.getPath());if(!s||!t.ASSET_EXTENSIONS.has(s.extension))continue;r.push(s.path)}catch{continue}return r};convertFileLinks=e=>async r=>{let n=e.getPath(),i=[],s=this.metadataCache.getCache(n);if(!s?.embeds)return[this.stripVaultPath(r),i];let o=r;for(let a of s.embeds)try{let l=this.metadataCache.getFirstLinkpathDest((0,Go.getLinkpath)(a.link),n);if(!l||!t.ASSET_EXTENSIONS.has(l.extension))continue;let c=await this.vault.readBinary(l),u=(0,Go.arrayBufferToBase64)(c),f=this.metadataCache.fileToLinktext(l,this.settings.vaultPath),d=this.metadataCache.getFirstLinkpathDest(l.path,this.settings.vaultPath)?.path??f;i.push({path:d,content:u});let h=a.original.startsWith("![["),g;if(h){let y=a.original.slice(3,-2),v=y.indexOf("|"),b=v>=0?y.substring(0,v):y,k=v>=0?y.substring(v):"",E=b.indexOf("#"),_=E>=0?b.substring(E):"";g=`![[${d}${_}${k}]]`}else{let y=a.original.indexOf("[")+1,v=a.original.indexOf("]"),b=a.original.substring(y,v),k=a.original.lastIndexOf("(")+1,E=a.original.lastIndexOf(")"),_=a.original.substring(k,E),x=_.indexOf("#"),S=x>=0?_.substring(x):"";g=`![${b}](${d}${S})`}let m=a.original.replace(/(\[\[[^\]]*?)\|([^\]]*?\]\])/g,"$1\\|$2");o.includes(a.original)?o=o.replace(a.original,g):o.includes(m)&&(o=o.replace(m,g))}catch{continue}return o=this.stripVaultPath(o),[o,i]}};p();p();var fS=require("obsidian");function _l(t,e=/,\s*/){return typeof t=="string"?t.split(e).filter(Boolean):Array.isArray(t)?t:[]}var Eh=class{settings;constructor(e){this.settings=e}compile(e,r){let n={...r};delete n.position;let i={publish:!0};i=this.addPermalink(e)(n,i),i=this.addDefaultPassThrough(n,i),i=this.addTimestampsFrontmatter(e)(n,i),i=this.addTags(n,i),i=this.addCSSClasses(n,i),i=this.addSocialImage(n,i);let s=this.settings.includeAllFrontmatter?{...i,...n}:i;return`--- ${this.settings.frontmatterFormat==="json"?JSON.stringify(s)+` `:(0,fS.stringifyYaml)(s)}--- `}addPermalink=e=>(r,n)=>{let i={...n};if(r&&(r.permalink?i.permalink=r.permalink:this.settings.usePermalink&&(i.permalink=ex(r.permalink??e.getVaultPath())),r.aliases||r.alias)){let s=[..._l(r.aliases),..._l(r.alias)];s.length>0&&(i.aliases=[...new Set(s)])}return i};addDefaultPassThrough(e,r){let n={...r};return e&&(e.title&&(n.title=e.title),e.description&&(n.description=e.description),e.draft&&(n.draft=e.draft),e.comments&&(n.comments=e.comments),e.lang&&(n.lang=e.lang),e.enableToc&&(n.enableToc=e.enableToc)),n}addTags(e,r){let n={...r};if(e){let i=[..._l(e.tags),..._l(e.tag)];i.length>0&&(n.tags=[...new Set(i)])}return n}addCSSClasses(e,r){let n={...r};if(e){let i=[..._l(e.cssclasses,/\s+/),..._l(e.cssclass,/\s+/)];i.length>0&&(n.cssclasses=[...new Set(i)])}return n}addSocialImage(e,r){let n={...r};if(e){let i=e.socialImage??e.image??e.cover??"",s=e.socialDescription??"";i&&i!==""&&(n.socialImage=i),s&&s!==""&&(n.socialDescription=s)}return n}addTimestampsFrontmatter=e=>(r,n)=>{let{showCreatedTimestamp:i,showUpdatedTimestamp:s,showPublishedTimestamp:o}=this.settings,a=this.settings.includeAllFrontmatter,l=e.meta.getCreatedAt(),c=e.meta.getUpdatedAt(),u=e.meta.getPublishedAt();return l&&(i||a)&&(n.created=a?r.created??r.date??l:l),c&&(s||a)&&(n.modified=a?r.modified??r.lastmod??r.updated??r["last-modified"]??c:c),u&&(o||a)&&(n.published=a?r.published??r.publishDate??r.date??u:u),n}};p();var Ch=class{file;frontmatter;settings;constructor(e,r,n){this.file=e,this.frontmatter=r,this.settings=n}getCreatedAt(){let e=this.settings.createdTimestampKey.split(",");for(let r of e){let n=this.frontmatter[r.trim()];if(n)return n}return new Date(this.file.stat.ctime).toISOString()}getUpdatedAt(){let e=this.settings.updatedTimestampKey.split(",");for(let r of e){let n=this.frontmatter[r.trim()];if(n)return n}return new Date(this.file.stat.mtime).toISOString()}getPublishedAt(){let e=this.settings.publishedTimestampKey.split(",");for(let r of e){let n=this.frontmatter[r.trim()];if(n)return n}return new Date(this.file.stat.mtime).toISOString()}};p();function dS(t){if(/```dataview\s/ms.test(t)||/```datacorejs\s/ms.test(t)||/```datacorejsx\s/ms.test(t)||/```datacorets\s/ms.test(t)||/```datacoretsx\s/ms.test(t))return!0;let e=wl();if(e){let r=e.settings.dataviewJsKeyword||"dataviewjs";if(new RegExp("```"+Yn(r)+"\\s","ms").test(t))return!0;let i=e.settings.inlineQueryPrefix||"=";if(new RegExp("`"+Yn(i)+".+?`","ms").test(t))return!0;let o=e.settings.inlineJsQueryPrefix||"$=";if(new RegExp("`"+Yn(o)+".+?`","ms").test(t))return!0}return!1}function Th(t){return t.extension==="base"?"base":t.extension==="canvas"?"canvas":t.name.endsWith(".excalidraw")||t.name.endsWith(".excalidraw.md")?"excalidraw":null}var Qo=class{file;compiler;vault;compiledFile;metadataCache;frontmatter;settings;meta;datastore;constructor({file:e,compiler:r,metadataCache:n,vault:i,settings:s,datastore:o}){this.compiler=r,this.metadataCache=n,this.file=e,this.settings=s,this.vault=i,this.frontmatter=this.getFrontmatter(),this.datastore=o,this.meta=new Ch(e,this.frontmatter,s)}async compile(){let e;if(this.settings.useCache){let r=await this.datastore.loadLocalFile(this.file.path),n=r?await this.datastore.isLocalFileOutdated(this.file.path,this.file.stat.mtime):!0,i=null;if(r&&!n)i=r;else{let s=await this.vault.cachedRead(this.file),o=dS(s);if(i=await this.compiler.generateMarkdown(this),!i)throw new Error(`Failed to compile file: ${this.file.path}. Compiler returned null.`);let a=await ol(i[0]);await this.datastore.storeLocalFile(this.file.path,this.file.stat.mtime,i,o),await this.datastore.storeLocalHash(this.file.path,this.file.stat.mtime,a)}e=i}else e=await this.compiler.generateMarkdown(this);return new Qy({file:this.file,compiler:this.compiler,metadataCache:this.metadataCache,vault:this.vault,settings:this.settings,datastore:this.datastore},e)}getType(){return this.file.name.endsWith(".excalidraw")||this.file.name.endsWith(".excalidraw.md")?"excalidraw":this.file.extension==="base"?"base":this.file.extension==="canvas"?"canvas":"markdown"}shouldPublish(){let e=Th(this.file);return e==="base"?this.settings.useBases:e==="canvas"?this.settings.useCanvas:e==="excalidraw"?this.settings.useExcalidraw:sl(this.settings.publishFrontmatterKey,this.frontmatter,this.settings.allNotesPublishableByDefault)}async getBlobLinks(){return this.compiler.extractBlobLinks(this)}async cachedRead(){return this.vault.cachedRead(this.file)}getMetadata(){return this.metadataCache.getCache(this.file.path)??{}}getBlock(e){return this.getMetadata().blocks?.[e]}getFrontmatter(){return this.metadataCache.getCache(this.file.path)?.frontmatter??{}}compare(e){return this.file.path.localeCompare(e.file.path)}getPath=()=>this.file.path;getVaultPath=()=>this.settings.vaultPath!=="/"&&this.file.path.startsWith(this.settings.vaultPath)?this.file.path.replace(this.settings.vaultPath,""):this.file.path;getCompiledFrontmatter(e){let r=!!this.settings.useDataview,n=new Eh(this.settings),i=this.metadataCache.getCache(this.file.path)?.frontmatter??{};if(r){let s=e.matchAll(nx),o=e.matchAll(ix);for(let a of s)a[1]&&a[2]&&(i[a[1]]=a[2]);for(let a of o)a[1]&&a[2]?i[a[1]]=a[2]:a[3]&&a[4]&&(i[a[3]]=a[4])}return n.compile(this,i)}},Qy=class extends Qo{compiledFile;remoteHash;constructor(e,r){super(e),this.compiledFile=r}getCompiledFile(){return this.compiledFile}setRemoteHash(e){this.remoteHash=e}};p();var re=cu(sP()),jP=cu(BP()),vf=require("obsidian");p();var Uv=new Set(["quartz.config.yaml","quartz.lock.json","quartz.ts","quartz/styles/custom.scss"]),y8=["content/",".github/","quartz/static/","quartz/styles/syncer/"],w8=new Set(["quartz.config.default.yaml"]);function jv(t){return Uv.has(t)?!0:y8.some(e=>t.startsWith(e))}function UP(t){return jv(t)||w8.has(t)}async function v8(t){if(!t)return;let e=[];for await(let s of t)e.push(s);let r=e.reduce((s,o)=>s+o.length,0),n=new Uint8Array(r),i=0;for(let s of e)n.set(s,i),i+=s.length;return n}var wf={async request(t){let{url:e,method:r="GET",headers:n={},body:i}=t;try{let s=await v8(i),o=await(0,vf.requestUrl)({url:e,method:r,headers:n,body:s?s.buffer:void 0,throw:!1}),a={};if(o.headers)for(let[u,f]of Object.entries(o.headers))a[u.toLowerCase()]=f;let l=new Uint8Array(o.arrayBuffer);async function*c(){yield l}return{url:e,method:r,headers:a,body:c(),statusCode:o.status,statusMessage:o.status>=200&&o.status<300?"OK":"Error"}}catch(s){throw s}}},et=class t{static COMMIT_AUTHOR={name:"Quartz Syncer",email:"268450573+quartz-syncer-publisher[bot]@users.noreply.github.com"};remoteUrl;branch;corsProxyUrl;auth;fs=null;dir;contentFolder;vaultPath;initialized=!1;constructor({gitSettings:e,contentFolder:r,vaultPath:n}){this.remoteUrl=e.remoteUrl,this.branch=e.branch||"main",this.corsProxyUrl=e.corsProxyUrl||void 0,this.auth=e.auth,this.contentFolder=r,this.vaultPath=n,this.dir="/repo"}getFs(){if(!this.fs)try{let e=this.getFsName();this.fs=new jP.default(e)}catch{throw new Error("Failed to initialize filesystem. IndexedDB may not be available on this platform.")}return this.fs}getFsName(){return`quartz-syncer-${this.hashString(this.remoteUrl+this.branch)}`}hashString(e){let r=0;for(let n=0;n{if(this.auth.type!=="none")return this.auth.type==="bearer"?{username:"x-access-token",password:this.auth.secret||""}:{username:this.auth.username||"",password:this.auth.secret||""}}}async pushWithRetry(e=3){for(let r=0;r<=e;r++)try{await re.default.push({...this.getGitConfig(),url:this.remoteUrl,remote:"origin",ref:this.branch});return}catch(n){if(!(n instanceof Error&&(n.message.includes("401")||n.message.includes("403")||n.message.includes("429")||n.message.includes("5")))||r===e)throw n;let s=Math.pow(2,r)*1e3;await new Promise(o=>window.setTimeout(o,s))}}getGitConfig(){let e={fs:this.getFs(),http:wf,dir:this.dir};return this.corsProxyUrl&&(e.corsProxy=this.corsProxyUrl),this.auth.type!=="none"&&(e.onAuth=this.getOnAuth()),e}getRepositoryName(){try{return new URL(this.remoteUrl).pathname.replace(/^\//,"").replace(/\.git$/,"")}catch{return this.remoteUrl}}getRepositoryPath(e){let r=e.startsWith(this.contentFolder)?e.replace(this.contentFolder,""):e;return rs(r)}getVaultPath(e){e=(0,vf.normalizePath)(e);let r=e.startsWith(this.vaultPath)?e.replace(this.vaultPath,""):e;return rs(r)}setRepositoryPath(e){e=(0,vf.normalizePath)(e);let r=e.startsWith(this.contentFolder)?e:`${this.contentFolder}/${e}`;return rs(r)}setVaultPath(e){let r=e.startsWith("/")?"":"/",n=e.startsWith(this.vaultPath)?e:`${this.vaultPath}${r}${e}`;return rs(n)}repositoryToVaultPath(e){return this.setVaultPath(this.getRepositoryPath(e))}repositoryToRepositoryPath(e){return this.setRepositoryPath(this.getVaultPath(e))}async checkExistingRepo(){try{return await this.getFs().promises.stat(this.dir),(await re.default.listRemotes({...this.getGitConfig()})).length>0}catch{return!1}}async createDirIfNotExists(e){try{await this.getFs().promises.mkdir(e)}catch{}}async ensureRepoInitialized(){if(this.initialized)return;if(await this.checkExistingRepo()){this.initialized=!0;return}await this.createDirIfNotExists(this.dir);try{await re.default.clone({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0,depth:1,noCheckout:!1}),this.initialized=!0}catch(r){throw new Error(`Could not clone repository ${this.getRepositoryName()}: ${String(r)}`)}}async getContent(e){try{await this.ensureRepoInitialized(),await re.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let r=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{commit:n}=await re.default.readCommit({...this.getGitConfig(),oid:r}),i=[],s=async(o,a="")=>{let{tree:l}=await re.default.readTree({...this.getGitConfig(),oid:o});for(let c of l){let u=a?`${a}/${c.path}`:c.path;i.push({path:u,oid:c.oid,type:c.type}),c.type==="tree"&&await s(c.oid,u)}};return await s(n.tree),{tree:i,sha:r,truncated:!1}}catch{throw new Error(`Could not get files from repository ${this.getRepositoryName()}`)}}async getAllBlobContents(e){try{await this.ensureRepoInitialized();let r=`origin/${this.branch}`,n=new Map;return await re.default.walk({...this.getGitConfig(),trees:[re.default.TREE({ref:r})],map:async(i,[s])=>{if(!s||i===".")return;let o=await s.type();if(o==="tree")return e&&!e.startsWith(i)&&!i.startsWith(e)?void 0:i;if(o!=="blob"||e&&!i.startsWith(e))return;let a=await s.content();if(a){let l=new TextDecoder().decode(a);n.set(i,l)}return i}}),n}catch{throw new Error(`Could not bulk-read blob contents from repository ${this.getRepositoryName()}`)}}async getFile(e,r){e=this.setRepositoryPath(this.getVaultPath(this.getRepositoryPath(e)));try{await this.ensureRepoInitialized();let n=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{blob:i,oid:s}=await re.default.readBlob({...this.getGitConfig(),oid:n,filepath:e});return{content:w.from(i).toString("base64"),sha:s,path:e,type:"file"}}catch{throw new Error(`Could not get file ${e} from repository ${this.getRepositoryName()}`)}}async getRawFile(e){try{await this.ensureRepoInitialized();let r=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{blob:n,oid:i}=await re.default.readBlob({...this.getGitConfig(),oid:r,filepath:e});return{content:w.from(n).toString("base64"),sha:i,path:e,type:"file"}}catch{throw new Error(`Could not get file ${e} from repository ${this.getRepositoryName()}`)}}async listDirectory(e){try{await this.ensureRepoInitialized();let r=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{commit:n}=await re.default.readCommit({...this.getGitConfig(),oid:r}),i=n.tree,s=e.split("/").filter(a=>a.length>0);for(let a of s){let{tree:l}=await re.default.readTree({...this.getGitConfig(),oid:i}),c=l.find(u=>u.path===a&&u.type==="tree");if(!c)return[];i=c.oid}let{tree:o}=await re.default.readTree({...this.getGitConfig(),oid:i});return o.map(a=>({name:a.path,type:a.type}))}catch{return[]}}async getLatestCommit(){try{await this.ensureRepoInitialized(),await re.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0,depth:1});let e=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{commit:r}=await re.default.readCommit({...this.getGitConfig(),oid:e});return{sha:e,commit:{tree:{sha:r.tree}}}}catch{return}}async hasCommitInHistory(e,r=100){try{return await this.ensureRepoInitialized(),await re.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0,depth:r}),(await re.default.log({...this.getGitConfig(),ref:`origin/${this.branch}`,depth:r})).some(i=>i.oid===e)}catch{return!1}}async detectFrameworkModifications(e,r){let n=[];return await re.default.walk({...this.getGitConfig(),trees:[re.default.TREE({ref:e}),re.default.TREE({ref:r})],map:async(i,[s,o])=>{if(i===".")return;let a=s?await s.type():void 0,l=o?await o.type():void 0;if(a==="tree"||l==="tree")return i;if(UP(i))return;let c=s?await s.oid():void 0,u=o?await o.oid():void 0;c!==u&&n.push(i)}}),n}async snapshotUserOwnedFiles(e){let r=new Map;for(let n of Uv)try{let{blob:i}=await re.default.readBlob({...this.getGitConfig(),oid:e,filepath:n});r.set(n,i)}catch{}return r}async restoreUserOwnedFiles(e){let r=!1;for(let[n,i]of e){let s=`${this.dir}/${n}`;try{let o=await this.getFs().promises.readFile(s);if(o.length===i.length&&o.every((a,l)=>a===i[l]))continue}catch{}await this.ensureDirectory(n),await this.getFs().promises.writeFile(s,i),await re.default.add({...this.getGitConfig(),filepath:n}),r=!0}return r}createUpgradeMergeDriver(){let e=new Map;return{driver:async({contents:n,path:i})=>{let[,s,o]=n;return jv(i)?(e.set(i,"ours"),{cleanMerge:!0,mergedText:s??""}):(e.set(i,"theirs"),{cleanMerge:!0,mergedText:o??""})},resolutions:e}}async upgradeFromUpstream(e,r){await this.ensureRepoInitialized(),await re.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let n=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await this.resetToRemoteCommit(n);let i="upstream";(await re.default.listRemotes({...this.getGitConfig()})).some(k=>k.remote===i)&&await re.default.deleteRemote({...this.getGitConfig(),remote:i}),await re.default.addRemote({...this.getGitConfig(),remote:i,url:e}),await re.default.fetch({...this.getGitConfig(),url:e,remote:i,ref:r,singleBranch:!0});let o=`remotes/${i}/${r}`,a=t.COMMIT_AUTHOR,l=await re.default.resolveRef({...this.getGitConfig(),ref:this.branch}),c=await re.default.resolveRef({...this.getGitConfig(),ref:o}),u=await re.default.findMergeBase({...this.getGitConfig(),oids:[l,c]});if(u.length===0)throw new Error("Cannot determine merge base between your repository and upstream. Run `npx quartz upgrade` manually.");let f=u[0],d=await this.detectFrameworkModifications(l,f);if(d.length>0){let k=d.map(E=>` - ${E}`).join(` `);throw new Error(`Cannot auto-upgrade: you have modified framework files that would conflict with upstream changes: ${k} Run \`npx quartz upgrade\` manually to resolve these conflicts.`)}let h=await this.snapshotUserOwnedFiles(l),{driver:g,resolutions:m}=this.createUpgradeMergeDriver(),y;try{y=await re.default.merge({...this.getGitConfig(),ours:this.branch,theirs:o,abortOnConflict:!1,mergeDriver:g,author:a})}catch(k){if(!this.extractConflictFiles(k))throw k;return await this.restoreUserOwnedFiles(h),y={oid:await re.default.commit({...this.getGitConfig(),message:`Merge upstream/${r} (auto-resolved conflicts)`,author:a,parent:[l,c]}),alreadyMerged:!1},m.size>0,await re.default.checkout({...this.getGitConfig(),ref:this.branch}),await this.pushWithRetry(),{oid:y.oid,alreadyMerged:!1}}if(y.alreadyMerged)return{oid:y.oid??n,alreadyMerged:!0};let v=await this.restoreUserOwnedFiles(h),b=y.oid;return v&&(b=await re.default.commit({...this.getGitConfig(),message:`Merge upstream/${r}`,author:a,parent:[l,c]})),m.size>0,await re.default.checkout({...this.getGitConfig(),ref:this.branch}),await this.pushWithRetry(),{oid:b,alreadyMerged:!1}}extractConflictFiles(e){return e&&typeof e=="object"&&"data"in e&&e.data&&typeof e.data=="object"&&"filepaths"in e.data&&Array.isArray(e.data.filepaths)?e.data.filepaths:null}normalizeFilePath(e){let r;do r=e,e=e.replace(/\.\.\//g,"");while(e!==r);return e=this.getVaultPath(e),e.startsWith("/")?`${this.contentFolder}${e}`:`${this.contentFolder}/${e}`}async ensureDirectory(e){let r=e.split("/");r.pop();let n=this.dir;for(let i of r)if(i){n=`${n}/${i}`;try{await this.getFs().promises.mkdir(n)}catch{}}}async resetToRemoteCommit(e){await re.default.checkout({...this.getGitConfig(),ref:e,force:!0}),await re.default.branch({...this.getGitConfig(),ref:this.branch,object:e,force:!0}),await re.default.checkout({...this.getGitConfig(),ref:this.branch})}async deleteFiles(e,r){if(e.length!==0)try{await this.ensureRepoInitialized(),await re.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let n=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await this.resetToRemoteCommit(n);let i={};for(let s=0;swindow.setTimeout(l,0))}await re.default.commit({...this.getGitConfig(),message:`Deleted ${e.length} file${e.length===1?"":"s"}`,author:t.COMMIT_AUTHOR,cache:i}),await this.pushWithRetry()}catch(n){throw n}}async updateFiles(e,r,n,i){let s=e.length>0,o=r&&r.size>0,a=n&&n.length>0;if(!(!s&&!o&&!a))try{await this.ensureRepoInitialized(),await re.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let l=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await this.resetToRemoteCommit(l);let c={},u=[],f=e.length,d=0;for(let h of e){let[g,m]=h.compiledFile,y=this.normalizeFilePath(h.getPath()),v=`${this.dir}/${y}`;await this.ensureDirectory(y),await this.getFs().promises.writeFile(v,g),u.push(y);for(let b of m.blobs){let k=this.normalizeFilePath(b.path),E=`${this.dir}/${k}`;await this.ensureDirectory(k);let _=w.from(b.content,"base64");await this.getFs().promises.writeFile(E,_),u.push(k)}d++,i&&await i(d,f),(f<=100||d%50===0)&&await new Promise(b=>window.requestAnimationFrame(b))}u.length>0&&await re.default.add({...this.getGitConfig(),filepath:u,cache:c}),r&&r.size>0&&await this.stageRawFiles(r,c),n&&n.length>0&&await this.stageRawFileDeletions(n,c),await re.default.commit({...this.getGitConfig(),message:`Published ${e.length} file${e.length===1?"":"s"}`,author:t.COMMIT_AUTHOR,cache:c}),await this.pushWithRetry()}catch(l){throw l}}async stageRawFiles(e,r={}){if(e.size===0)return;let n=[];for(let[i,s]of e){let o=`${this.dir}/${i}`;await this.ensureDirectory(i),await this.getFs().promises.writeFile(o,s),n.push(i)}n.length>0&&await re.default.add({...this.getGitConfig(),filepath:n,cache:r})}async stageRawFileDeletions(e,r={}){if(e.length!==0)for(let n of e){let i=`${this.dir}/${n}`;try{await this.getFs().promises.unlink(i),await re.default.remove({...this.getGitConfig(),filepath:n,cache:r})}catch{}}}async writeRawFiles(e,r="Updated integration styles"){if(e.size!==0)try{await this.ensureRepoInitialized(),await re.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let n=await re.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await this.resetToRemoteCommit(n),await this.stageRawFiles(e),await re.default.commit({...this.getGitConfig(),message:r,author:t.COMMIT_AUTHOR}),await this.pushWithRetry()}catch(n){throw n}}async testConnection(){try{return await re.default.getRemoteInfo({http:wf,url:this.remoteUrl,corsProxy:this.corsProxyUrl,onAuth:this.getOnAuth()}),!0}catch{return!1}}async clearLocalCache(){let e=this.getFsName();try{typeof indexedDB<"u"&&indexedDB.deleteDatabase(e),this.fs=null,this.initialized=!1}catch{}}static getOnAuth(e){if(e.type!=="none")return e.type==="bearer"?()=>({username:"x-access-token",password:e.secret||""}):()=>({username:e.username||"",password:e.secret||""})}static async fetchRemoteHeadCommit(e,r,n,i){try{let s=n?`refs/heads/${n}`:"HEAD",o=await re.default.listServerRefs({http:wf,url:e,corsProxy:i,onAuth:this.getOnAuth(r),prefix:s,symrefs:!0});return n?o.find(c=>c.ref===`refs/heads/${n}`)?.oid??null:o.find(l=>l.ref==="HEAD")?.oid??null}catch{return null}}static async fetchRemoteBranches(e,r,n){try{let i=await re.default.listServerRefs({http:wf,url:e,corsProxy:n,onAuth:this.getOnAuth(r),prefix:"refs/heads/",symrefs:!0}),s=i.filter(l=>l.ref.startsWith("refs/heads/")).map(l=>l.ref.replace("refs/heads/","")),o=null,a=i.find(l=>l.ref==="HEAD");return a?.target&&(o=a.target.replace("refs/heads/","")),{branches:s,defaultBranch:o}}catch{return{branches:[],defaultBranch:null}}}static async checkWriteAccess(e,r,n){try{return await re.default.listServerRefs({http:wf,url:e,corsProxy:n,onAuth:this.getOnAuth(r),forPush:!0,prefix:"refs/heads/"}),!0}catch{return!1}}};var ha=class{app;plugin;vault;metadataCache;compiler;settings;vaultPath;datastore;extendedCache;constructor(e,r,n,i,s,o,a){this.app=e,this.plugin=r,this.vault=n,this.metadataCache=i,this.settings=s,this.vaultPath=s.vaultPath,this.datastore=o,this.extendedCache=a,this.compiler=new Sh(e,n,s,i,o)}shouldPublish(e){let r=Th(e);if(r)return this.isSpecialTypeEnabled(r);let n=this.metadataCache.getCache(e.path)?.frontmatter;return sl(this.settings.publishFrontmatterKey,n,this.settings.allNotesPublishableByDefault)}async getFilesMarkedForPublishing(){let e=this.settings.vaultPath==="/",r=f=>e||f.startsWith(this.settings.vaultPath),n;if(this.settings.allNotesPublishableByDefault)n=new Set(this.vault.getMarkdownFiles().filter(f=>r(f.path)).map(f=>f.path));else if(this.extendedCache.isReady){let f=this.extendedCache.api.getFilesWithFrontmatterKey(this.settings.publishFrontmatterKey);n=new Set;for(let d of f){if(!r(d))continue;this.metadataCache.getCache(d)?.frontmatter?.[this.settings.publishFrontmatterKey]&&n.add(d)}}else n=new Set(this.vault.getMarkdownFiles().filter(f=>{if(!r(f.path))return!1;let d=this.metadataCache.getCache(f.path)?.frontmatter;return sl(this.settings.publishFrontmatterKey,d,!1)}).map(f=>f.path));let i=[],s=[];if(this.settings.useBases||this.settings.useCanvas)for(let f of this.vault.getFiles())r(f.path)&&(this.settings.useBases&&f.extension==="base"?i.push(f):this.settings.useCanvas&&f.extension==="canvas"&&s.push(f));let o=this.settings.useExcalidraw?this.vault.getMarkdownFiles().filter(f=>(f.path.endsWith(".excalidraw")||f.path.endsWith(".excalidraw.md"))&&r(f.path)):[];for(let f of o)n.delete(f.path);let l=[...[...n].map(f=>this.vault.getFileByPath(f)).filter(f=>f!==null),...i,...s,...o],c=[],u=new Set;for(let f of l)try{let d=new Qo({file:f,compiler:this.compiler,metadataCache:this.metadataCache,vault:this.vault,settings:this.settings,datastore:this.datastore});c.push(d),(await d.getBlobLinks()).forEach(g=>u.add(g))}catch{}return{notes:c.sort((f,d)=>f.compare(d)),blobs:Array.from(u)}}createConnection(){return new et({gitSettings:this.plugin.getGitSettingsWithSecret(),contentFolder:this.settings.contentFolder,vaultPath:this.settings.vaultPath})}async deleteBatch(e,r,n){if(e.length===0)return!0;try{if(await(r??this.createConnection()).deleteFiles(e,n),this.settings.useCache)for(let s of e)await this.datastore.dropFile(s);return!0}catch{return!1}}async publishBatch(e,r,n){let i=e.filter(s=>{let o=Th(s.file);return o?this.isSpecialTypeEnabled(o):D0(this.settings.publishFrontmatterKey,s.frontmatter,this.settings.allNotesPublishableByDefault)});if(i.length===0)return!0;try{let s=r??this.createConnection(),a=await new ku(this.settings).collectAssets(s);if(await s.updateFiles(i,a.filesToStage,a.filesToDelete,n),this.settings.useCache)for(let l of i){let c=await this.datastore.loadFile(l.file.path);c&&c.localData&&await this.datastore.storeRemoteFile(l.file.path,l.file.stat.mtime,c.localData)}return!0}catch{return!1}}isSpecialTypeEnabled(e){switch(e){case"base":return this.settings.useBases;case"canvas":return this.settings.useCanvas;case"excalidraw":return this.settings.useExcalidraw}}};p();var Fa=require("obsidian");p();p();p();p();p();var qP=globalThis.process?.env?.NODE_ENV,L=qP&&!qP.toLowerCase().startsWith("prod");p();p();var ds=Array.isArray,VP=Array.prototype.indexOf,Mn=Array.prototype.includes,ic=Array.from,qv=Object.keys,Xt=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,Ap=Object.getOwnPropertyDescriptors,Vv=Object.prototype,HP=Array.prototype,pa=Object.getPrototypeOf,Hv=Object.isExtensible;var Ni=()=>{};function Ip(t){for(var e=0;e{t=n,e=i});return{promise:r,resolve:t,reject:e}}p();p();var er=Symbol("$state"),bf=Symbol("legacy props"),GP=Symbol(""),$p=Symbol("proxy path"),Rp=Symbol("attributes"),_f=Symbol("class"),Gv=Symbol("style"),xf=Symbol("text"),kf=Symbol("form reset"),Qv=Symbol("hmr anchor"),Js=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Wv=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");var ma=3,cn=8;p();p();function QP(t){if(L){let e=new Error(`invariant_violation An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${t}" https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function Op(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 KP(){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 YP(){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 Kv(t,e,r){if(L){let n=new Error(`each_key_duplicate ${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`} https://svelte.dev/e/each_key_duplicate`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function ZP(t,e,r){if(L){let n=new Error(`each_key_volatile Keyed each block has key that is not idempotent \u2014 the key for item at index ${t} was \`${e}\` but is now \`${r}\`. Keys must be the same each time for a given item https://svelte.dev/e/each_key_volatile`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_volatile")}function JP(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 XP(){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 e$(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 t$(){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 r$(){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 n$(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 i$(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 s$(){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 o$(){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 a$(){if(L){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function l$(){if(L){let t=new Error("svelte_boundary_reset_onerror\nA `` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}p();p();p();var sc="[",ga="[!",Yv="[?",ya="]",Fi={};var tt=Symbol("uninitialized"),Vr=Symbol("filename"),c$=Symbol("hmr"),Np="http://www.w3.org/1999/xhtml",Sf="http://www.w3.org/2000/svg",Zv="http://www.w3.org/1998/Math/MathML";p();var ne=!1;function It(t){ne=t}var ve;function Ge(t){if(t===null)throw Fi;return ve=t}function jt(){return Ge(qt(ve))}function le(t){if(ne){if(qt(ve)!==null)throw Fi;ve=t}}function Ef(t=1){if(ne){for(var e=t,r=ve;e--;)r=qt(r);ve=r}}function Di(t=!0){for(var e=0,r=ve;;){if(r.nodeType===cn){var n=r.data;if(n===ya){if(e===0)return r;e-=1}else(n===sc||n===ga||n[0]==="["&&!isNaN(Number(n.slice(1))))&&(e+=1)}var i=qt(r);t&&r.remove(),r=i}}function Cf(t){if(!t||t.nodeType!==cn)throw Fi;return t.data}p();p();p();p();function Fp(t){return t===this.v}function Dp(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function zp(t){return!Dp(t,this.v)}p();var Pt=!1,hs=!1,ii=!1;p();p();p();var Tf=null;function ur(t,e){return t.label=e,Mp(t.v,e),t}function Mp(t,e){return t?.[$p]?.(e),t}p();function si(t){let e=new Error,r=_8();return r.length===0?null:(r.unshift(` `),Xt(e,"stack",{value:r.join(` `)}),Xt(e,"name",{value:t}),e)}function _8(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(` `),n=[];for(let i=0;i{e===wa&&h$()})}wa.push(t)}function p$(){for(;wa.length>0;)h$()}p();var Xv=new WeakMap;function Bp(t){var e=J;if(e===null)return he.f|=8388608,t;if(L&&t instanceof Error&&!Xv.has(t)&&Xv.set(t,x8(t,e)),(e.f&32768)===0&&(e.f&4)===0)throw L&&!e.parent&&t instanceof Error&&m$(t),t;Bn(t,e)}function Bn(t,e){for(;e!==null;){if((e.f&128)!==0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw L&&t instanceof Error&&m$(t),t}function x8(t,e){let r=qr(t,"message");if(!(r&&!r.configurable)){for(var n=If?" ":" ",i=` ${n}in ${e.fn?.name||""}`,s=e.ctx;s!==null;)i+=` ${n}in ${s.function?.[Vr].split("/").pop()}`,s=s.p;return{message:t.message+` ${i} `,stack:t.stack?.split(` `).filter(o=>!o.includes("svelte/src/internal")).join(` `)}}}function m$(t){let e=Xv.get(t);e&&(Xt(t,"message",{value:e.message}),Xt(t,"stack",{value:e.stack}))}p();p();var k8=-7169;function Ye(t,e){t.f=t.f&k8|e}function ac(t){(t.f&512)!==0||t.deps===null?Ye(t,1024):Ye(t,4096)}function g$(t){if(t!==null)for(let e of t)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,g$(e.deps))}function Up(t,e,r){(t.f&2048)!==0?e.add(t):(t.f&4096)!==0&&r.add(t),g$(t.deps),Ye(t,1024)}p();p();p();var y$=!1,jp=!1,hle=Symbol("unmounted");function eb(t){var e=jp;try{return jp=!1,[t(),jp]}finally{jp=e}}p();var qp=null,cc=null,be=null,uc=null,Gt=null,nb=null,va=!1,tb=!1,_a=null,Pf=null,w$=0,rb=new Set,C8=1,pn=class t{id=C8++;#t=!1;linked=!0;#r=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#e=new Set;#i=new Set;#o=new Set;#a=0;#l=new Map;#c=null;#s=[];#h=[];#p=new Set;#u=new Set;#m=new Map;#f=new Set;is_fork=!1;#g=!1;constructor(){cc===null?qp=cc=this:(cc.#n=this,this.#r=cc),cc=this}#_(){if(this.is_fork)return!0;for(let n of this.#l.keys()){for(var e=n,r=!1;e.parent!==null;){if(this.#m.has(e)){r=!0;break}e=e.parent}if(!r)return!0}return!1}skip_effect(e){this.#m.has(e)||this.#m.set(e,{d:[],m:[]}),this.#f.delete(e)}unskip_effect(e,r=n=>this.schedule(n)){var n=this.#m.get(e);if(n){this.#m.delete(e);for(var i of n.d)Ye(i,2048),r(i);for(i of n.m)Ye(i,4096),r(i)}this.#f.add(e)}#y(){if(this.#t=!0,w$++>1e3&&(this.#w(),T8()),L)for(let l of this.current.keys())rb.add(l);for(let l of this.#p)this.#u.delete(l),Ye(l,2048),this.schedule(l);for(let l of this.#u)Ye(l,4096),this.schedule(l);let e=this.#s;this.#s=[],this.apply();var r=_a=[],n=[],i=Pf=[];for(let l of e)try{this.#x(l,r,n)}catch(c){throw x$(l),this.#_()||this.discard(),c}if(be=null,i.length>0){var s=t.ensure();for(let l of i)s.schedule(l)}if(_a=null,Pf=null,this.#_()){this.#d(n),this.#d(r);for(let[l,c]of this.#m)_$(l,c);i.length>0&&be.#y();return}let o=this.#k();if(o){this.#d(n),this.#d(r),o.#v(this);return}this.#p.clear(),this.#u.clear();for(let l of this.#e)l(this);this.#e.clear(),uc=this,v$(n),v$(r),uc=null,this.#c?.resolve();var a=be;if(this.#a===0&&(this.#s.length===0||a!==null)&&(this.#w(),Pt&&(this.#b(),be=a)),this.#s.length>0)if(a!==null){let l=a;l.#s.push(...this.#s.filter(c=>!l.#s.includes(c)))}else a=this;a!==null&&a.#y()}#x(e,r,n){e.f^=1024;for(var i=e.first;i!==null;){var s=i.f,o=(s&96)!==0,a=o&&(s&1024)!==0,l=a||(s&8192)!==0||this.#m.has(i);if(!l&&i.fn!==null){o?i.f^=1024:(s&4)!==0?r.push(i):Pt&&(s&16777224)!==0?n.push(i):to(i)&&((s&16)!==0&&this.#u.add(i),Li(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var u=i.next;if(u!==null){i=u;break}i=i.parent}}}#k(){for(var e=this.#r;e!==null;){if(!e.is_fork){for(let[r,[,n]]of this.current)if(e.current.has(r)&&!n)return e}e=e.#r}return null}#v(e){for(let[n,i]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,i);for(let[n,i]of e.async_deriveds){let s=this.async_deriveds.get(n);s&&i.promise.then(s.resolve).catch(s.reject)}this.transfer_effects(e.#p,e.#u);let r=n=>{var i=n.reactions;if(i!==null)for(let a of i){var s=a.f;if((s&2)!==0)r(a);else{var o=a;s&4194320&&!this.async_deriveds.has(o)&&(this.#u.delete(o),Ye(o,2048),this.schedule(o))}}};for(let n of this.current.keys())r(n);this.oncommit(()=>e.discard()),e.#w(),be=this,this.#y()}#d(e){for(var r=0;r!u.current.get(f)[1]&&!this.current.has(f));if(i.length===0)e&&u.discard();else if(r.length>0){if(L&&!u.#g&&d$(u.#s.length===0,"Batch has scheduled roots"),e)for(let f of this.#f)u.unskip_effect(f,d=>{(d.f&4194320)!==0?u.schedule(d):u.#d([d])});u.activate();var s=new Set,o=new Map;for(var a of r)b$(a,i,s,o);o=new Map;var l=[...u.current].filter(([f,d])=>{let h=this.current.get(f);return h?h[0]!==d[0]||h[1]!==d[1]:!0}).map(([f])=>f);if(l.length>0)for(let f of this.#h)(f.f&155648)===0&&ib(f,l,o)&&((f.f&4194320)!==0?(Ye(f,2048),u.schedule(f)):u.#p.add(f));if(u.#s.length>0&&!u.#g){u.apply();for(var c of u.#s)u.#x(c,[],[]);u.#s=[]}u.deactivate()}}}}increment(e,r){if(this.#a+=1,e){let n=this.#l.get(r)??0;this.#l.set(r,n+1)}}decrement(e,r){if(this.#a-=1,e){let n=this.#l.get(r)??0;n===1?this.#l.delete(r):this.#l.set(r,n-1)}this.#g||(this.#g=!0,Vt(()=>{this.#g=!1,this.linked&&this.flush()}))}transfer_effects(e,r){for(let n of e)this.#p.add(n);for(let n of r)this.#u.add(n);e.clear(),r.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#i.add(e)}on_fork_commit(e){this.#o.add(e)}run_fork_commit_callbacks(){for(let e of this.#o)e(this);this.#o.clear()}settled(){return(this.#c??=Pp()).promise}static ensure(){if(be===null){let e=be=new t;!tb&&!va&&Vt(()=>{e.#t||e.flush()})}return be}apply(){if(!Pt||!this.is_fork&&this.#r===null&&this.#n===null){Gt=null;return}Gt=new Map;for(let[r,[n]]of this.current)Gt.set(r,n);for(let r=qp;r!==null;r=r.#n)if(!(r===this||r.is_fork)){var e=!1;if(r.id0)){gs.clear();for(let i of jn){if((i.f&24576)!==0)continue;let s=[i],o=i.parent;for(;o!==null;)jn.has(o)&&(jn.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){let l=s[a];(l.f&24576)===0&&Li(l)}}jn.clear()}}jn=null}}function b$(t,e,r,n){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(let i of t.reactions){let s=i.f;(s&2)!==0?b$(i,e,r,n):(s&4194320)!==0&&(s&2048)===0&&ib(i,e,n)&&(Ye(i,2048),$f(i))}}function ib(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(t.deps!==null)for(let i of t.deps){if(Mn.call(e,i))return!0;if((i.f&2)!==0&&ib(i,e,r))return r.set(i,!0),!0}return r.set(t,!1),!1}function $f(t){be.schedule(t)}function _$(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):(t.f&4096)!==0&&e.m.push(t),Ye(t,1024);for(var r=t.first;r!==null;)_$(r,e),r=r.next}}function x$(t){Ye(t,1024);for(var e=t.first;e!==null;)x$(e),e=e.next}p();p();p();p();function S$(t){let e=0,r=pr(0),n;return L&&ur(r,"createSubscriber version"),()=>{Xs()&&(O(r),mr(()=>(e===0&&(n=it(()=>t(()=>Sa(r)))),e+=1,()=>{Vt(()=>{e-=1,e===0&&(n?.(),n=void 0,Sa(r))})})))}}var I8=589824;function ab(t,e,r,n){new ob(t,e,r,n)}var ob=class{parent;is_pending=!1;transform_error;#t;#r=ne?ve:null;#n;#e;#i;#o=null;#a=null;#l=null;#c=null;#s=0;#h=0;#p=!1;#u=new Set;#m=new Set;#f=null;#g=S$(()=>(this.#f=pr(this.#s),L&&ur(this.#f,"$effect.pending()"),()=>{this.#f=null}));constructor(e,r,n,i){this.#t=e,this.#n=r,this.#e=s=>{var o=J;o.b=this,o.f|=128,n(s)},this.parent=J.b,this.transform_error=i??this.parent?.transform_error??(s=>s),this.#i=gn(()=>{if(ne){let s=this.#r;jt();let o=s.data===ga;if(s.data.startsWith(Yv)){let l=JSON.parse(s.data.slice(Yv.length));this.#y(l)}else o?this.#x():this.#_()}else this.#k()},I8),ne&&(this.#t=ve)}#_(){try{this.#o=Rt(()=>this.#e(this.#t))}catch(e){this.error(e)}}#y(e){let r=this.#n.failed;r&&(this.#l=Rt(()=>{r(this.#t,()=>e,()=>()=>{})}))}#x(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#a=Rt(()=>e(this.#t)),Vt(()=>{var r=this.#c=document.createDocumentFragment(),n=St();r.append(n),this.#o=this.#d(()=>Rt(()=>this.#e(n))),this.#h===0&&(this.#t.before(r),this.#c=null,Bi(this.#a,()=>{this.#a=null}),this.#v(be))}))}#k(){try{if(this.is_pending=this.has_pending_snippet(),this.#h=0,this.#s=0,this.#o=Rt(()=>{this.#e(this.#t)}),this.#h>0){var e=this.#c=document.createDocumentFragment();dc(this.#o,e);let r=this.#n.pending;this.#a=Rt(()=>r(this.#t))}else this.#v(be)}catch(r){this.error(r)}}#v(e){this.is_pending=!1,e.transfer_effects(this.#u,this.#m)}defer_effect(e){Up(e,this.#u,this.#m)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#d(e){var r=J,n=he,i=Oe;Nt(this.#i),Ot(this.#i),ps(this.#i.ctx);try{return pn.ensure(),e()}catch(s){return Bp(s),null}finally{Nt(r),Ot(n),ps(i)}}#b(e,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#b(e,r);return}this.#h+=e,this.#h===0&&(this.#v(r),this.#a&&Bi(this.#a,()=>{this.#a=null}),this.#c&&(this.#t.before(this.#c),this.#c=null))}update_pending_count(e,r){this.#b(e,r),this.#s+=e,!(!this.#f||this.#p)&&(this.#p=!0,Vt(()=>{this.#p=!1,this.#f&&ai(this.#f,this.#s)}))}get_effect_pending(){return this.#g(),O(this.#f)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;be?.is_fork?(this.#o&&be.skip_effect(this.#o),this.#a&&be.skip_effect(this.#a),this.#l&&be.skip_effect(this.#l),be.on_fork_commit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#o&&(wt(this.#o),this.#o=null),this.#a&&(wt(this.#a),this.#a=null),this.#l&&(wt(this.#l),this.#l=null),ne&&(Ge(this.#r),Ef(),Ge(Di()));var r=this.#n.onerror;let n=this.#n.failed;var i=!1,s=!1;let o=()=>{if(i){return}i=!0,s&&l$(),this.#l!==null&&Bi(this.#l,()=>{this.#l=null}),this.#d(()=>{this.#k()})},a=l=>{try{s=!0,r?.(l,o),s=!1}catch(c){Bn(c,this.#i&&this.#i.parent)}n&&(this.#l=this.#d(()=>{try{return Rt(()=>{var c=J;c.b=this,c.f|=128,n(this.#t,()=>l,()=>o)})}catch(c){return Bn(c,this.#i.parent),null}}))};Vt(()=>{var l;try{l=this.transform_error(e)}catch(c){Bn(c,this.#i&&this.#i.parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(a,c=>Bn(c,this.#i&&this.#i.parent)):a(l)})}};function Qp(t,e,r,n){let i=Mi()?ro:Ea;var s=t.filter(d=>!d.settled);if(r.length===0&&s.length===0){n(e.map(i));return}var o=J,a=E$(),l=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(d=>d.promise)):null;function c(d){if((o.f&16384)===0){a();try{n(d)}catch(h){Bn(h,o)}hc()}}var u=lb();if(r.length===0){l.then(()=>c(e.map(i))).finally(u);return}function f(){Promise.all(r.map(d=>ub(d))).then(d=>c([...e.map(i),...d])).catch(d=>Bn(d,o)).finally(u)}l?l.then(()=>{a(),f(),hc()}):f()}function E$(){var t=J,e=he,r=Oe,n=be;if(L)var i=zi;return function(o=!0){Nt(t),Ot(e),ps(r),o&&(t.f&16384)===0&&(n?.activate(),n?.apply()),L&&(cb(null),oc(i))}}function hc(t=!0){Nt(null),Ot(null),ps(null),t&&be?.deactivate(),L&&(cb(null),oc(null))}function lb(){var t=J,e=t.b,r=be,n=!!e?.is_rendered();return e?.update_pending_count(1,r),r.increment(n,t),()=>{e?.update_pending_count(-1,r),r.decrement(n,t)}}var Gr=null;function cb(t){Gr=t}var Rf=new Set;function ro(t){var e=2050;J!==null&&(J.f|=524288);let r={ctx:Oe,deps:null,effects:null,equals:Fp,f:e,fn:t,reactions:null,rv:0,v:tt,wv:0,parent:J,ac:null};return L&&ii&&(r.created=si("created at")),r}var Wp=Symbol("obsolete");function ub(t,e,r){let n=J;n===null&&KP();var i=void 0,s=pr(tt);L&&(s.label=e??t.toString());var o=!he,a=new Set;return A$(()=>{var l=J;L&&(Gr={effect:l,effect_deps:new Set,warned:!1});var c=Pp();i=c.promise;try{Promise.resolve(t()).then(c.resolve,h=>{h!==Js&&c.reject(h)}).finally(hc)}catch(h){c.reject(h),hc()}if(L){if(Gr){if(l.deps!==null)for(let h=0;h{L&&(Gr=null),f?.(),a.delete(c),g!==Wp&&(u.activate(),g?(s.f|=8388608,ai(s,g)):((s.f&8388608)!==0&&(s.f^=8388608),L&&r!==void 0&&!s.equals(h)&&(Rf.add(s),setTimeout(()=>{Rf.has(s)&&(l.f&16384)===0&&(s.label,Rf.delete(s))})),ai(s,h)),u.deactivate())};c.promise.then(d,h=>d(null,h||"unknown"))}),dr(()=>{for(let l of a)l.reject(Wp)}),L&&(s.f|=4194304),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function ut(t){let e=ro(t);return Pt||Yp(e),e}function Ea(t){let e=ro(t);return e.equals=zp,e}function C$(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r5){let s=si("updated at");if(s!==null){let o=t.updated.get(s.stack);o||(o={error:s,count:0},t.updated.set(s.stack,o)),o.count++}}}J!==null&&(t.set_during_effect=!0)}if((t.f&2)!==0){let i=t;(t.f&2048)!==0&&Of(i),Gt===null&&ac(i)}t.wv=fc(),P$(t,2048,r),Mi()&&J!==null&&(J.f&1024)!==0&&(J.f&96)===0&&(vn===null?$$([t]):vn.push(t)),!n.is_fork&&Ca.size>0&&!pb&&Gp()}return e}function Gp(){pb=!1;for(let t of Ca){(t.f&1024)!==0&&Ye(t,4096);let e;try{e=to(t)}catch{e=!0}e&&Li(t)}Ca.clear()}function Sa(t){Ae(t,t.v+1)}function P$(t,e,r){var n=t.reactions;if(n!==null)for(var i=Mi(),s=n.length,o=0;o{if(no===o)return f();var d=he,h=no;Ot(null),mb(o);var g=f();return Ot(d),mb(h),g};n&&(r.set("length",Xe(t.length,s)),L&&(t=O8(t)));var l="";let c=!1;function u(f){if(!c){c=!0,l=f,ur(i,`${l} version`);for(let[d,h]of r)ur(h,Aa(l,d));c=!1}}return new Proxy(t,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&s$();var g=r.get(d);return g===void 0?a(()=>{var m=Xe(h.value,s);return r.set(d,m),L&&typeof d=="string"&&ur(m,Aa(l,d)),m}):Ae(g,h.value,!0),!0},deleteProperty(f,d){var h=r.get(d);if(h===void 0){if(d in f){let g=a(()=>Xe(tt,s));r.set(d,g),Sa(i),L&&ur(g,Aa(l,d))}}else Ae(h,tt),Sa(i);return!0},get(f,d,h){if(d===er)return t;if(L&&d===$p)return u;var g=r.get(d),m=d in f;if(g===void 0&&(!m||qr(f,d)?.writable)&&(g=a(()=>{var v=Wt(m?f[d]:tt),b=Xe(v,s);return L&&ur(b,Aa(l,d)),b}),r.set(d,g)),g!==void 0){var y=O(g);return y===tt?void 0:y}return Reflect.get(f,d,h)},getOwnPropertyDescriptor(f,d){var h=Reflect.getOwnPropertyDescriptor(f,d);if(h&&"value"in h){var g=r.get(d);g&&(h.value=O(g))}else if(h===void 0){var m=r.get(d),y=m?.v;if(m!==void 0&&y!==tt)return{enumerable:!0,configurable:!0,value:y,writable:!0}}return h},has(f,d){if(d===er)return!0;var h=r.get(d),g=h!==void 0&&h.v!==tt||Reflect.has(f,d);if(h!==void 0||J!==null&&(!g||qr(f,d)?.writable)){h===void 0&&(h=a(()=>{var y=g?Wt(f[d]):tt,v=Xe(y,s);return L&&ur(v,Aa(l,d)),v}),r.set(d,h));var m=O(h);if(m===tt)return!1}return g},set(f,d,h,g){var m=r.get(d),y=d in f;if(n&&d==="length")for(var v=h;vXe(tt,s)),r.set(v+"",b),L&&ur(b,Aa(l,v)))}if(m===void 0)(!y||qr(f,d)?.writable)&&(m=a(()=>Xe(void 0,s)),L&&ur(m,Aa(l,d)),Ae(m,Wt(h)),r.set(d,m));else{y=m.v!==tt;var k=a(()=>Wt(h));Ae(m,k)}var E=Reflect.getOwnPropertyDescriptor(f,d);if(E?.set&&E.set.call(g,h),!y){if(n&&typeof d=="string"){var _=r.get("length"),x=Number(d);Number.isInteger(x)&&x>=_.v&&Ae(_,x+1)}Sa(i)}return!0},ownKeys(f){O(i);var d=Reflect.ownKeys(f).filter(m=>{var y=r.get(m);return y===void 0||y.v!==tt});for(var[h,g]of r)g.v!==tt&&!(h in f)&&d.push(h);return d},setPrototypeOf(){o$()}})}function Aa(t,e){return typeof e=="symbol"?`${t}[Symbol(${e.description??""})]`:$8.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function Zp(t){try{if(t!==null&&typeof t=="object"&&er in t)return t[er]}catch{}return t}var R8=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function O8(t){return new Proxy(t,{get(e,r,n){var i=Reflect.get(e,r,n);return R8.has(r)?function(...s){I$();var o=i.apply(this,s);return Gp(),o}:i}})}function R$(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:n,includes:i}=t;t.indexOf=function(s,o){let a=r.call(this,s,o);if(a===-1){for(let l=o??0;l{t.indexOf=r,t.lastIndexOf=n,t.includes=i}}var gb,O$,If,N$,F$;function Jp(){if(gb===void 0){gb=window,O$=document,If=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;N$=qr(e,"firstChild").get,F$=qr(e,"nextSibling").get,Hv(t)&&(t[_f]=void 0,t[Rp]=null,t[Gv]=void 0,t.__e=void 0),Hv(r)&&(r[xf]=void 0),L&&(t.__svelte_meta=null,R$())}}function St(t=""){return document.createTextNode(t)}function Et(t){return N$.call(t)}function qt(t){return F$.call(t)}function fe(t,e){if(!ne)return Et(t);var r=Et(ve);if(r===null)r=ve.appendChild(St());else if(e&&r.nodeType!==ma){var n=St();return r?.before(n),Ge(n),n}return e&&Df(r),Ge(r),r}function qn(t,e=!1){if(!ne){var r=Et(t);return r instanceof Comment&&r.data===""?qt(r):r}if(e){if(ve?.nodeType!==ma){var n=St();return ve?.before(n),Ge(n),n}Df(ve)}return ve}function _e(t,e=1,r=!1){let n=ne?ve:t;for(var i;e--;)i=n,n=qt(n);if(!ne)return n;if(r){if(n?.nodeType!==ma){var s=St();return n===null?i?.after(s):n.before(s),Ge(s),s}Df(n)}return Ge(n),n}function Ff(t){t.textContent=""}function Xp(){if(!Pt||jn!==null)return!1;var t=J.f;return(t&32768)!==0}function li(t,e,r){let n=r?{is:r}:void 0;return document.createElementNS(e??Np,t,n)}function Df(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===ma;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}p();p();var D$=!1;function yb(){D$||(D$=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(let e of t.target.elements)e[kf]?.()})},{capture:!0}))}function Ia(t){var e=he,r=J;Ot(null),Nt(null);try{return t()}finally{Ot(e),Nt(r)}}function vb(t){J===null&&(he===null&&e$(t),XP()),yn&&JP(t)}function N8(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function ci(t,e){var r=J;if(L)for(;r!==null&&(r.f&131072)!==0;)r=r.parent;r!==null&&(r.f&8192)!==0&&(t|=8192);var n={ctx:Oe,deps:null,nodes:null,f:t|2048|512,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};L&&(n.component_function=un),be?.register_created_effect(n);var i=n;if((t&4)!==0)_a!==null?_a.push(n):pn.ensure().schedule(n);else if(e!==null){try{Li(n)}catch(o){throw wt(n),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&524288)===0&&(i=i.first,(t&16)!==0&&(t&65536)!==0&&i!==null&&(i.f|=65536))}if(i!==null&&(i.parent=r,r!==null&&N8(i,r),he!==null&&(he.f&2)!==0&&(t&64)===0)){var s=he;(s.effects??=[]).push(i)}return n}function Xs(){return he!==null&&!Tr}function dr(t){let e=ci(8,null);return Ye(e,1024),e.teardown=t,e}function ws(t){vb("$effect"),L&&Xt(t,"name",{value:"$effect"});var e=J.f,r=!he&&(e&32)!==0&&Oe!==null&&!Oe.i;if(r){var n=Oe;(n.e??=[]).push(t)}else return Jv(t)}function Jv(t){return ci(1048580,t)}function mc(t){return vb("$effect.pre"),L&&Xt(t,"name",{value:"$effect.pre"}),ci(1048584,t)}function bb(t){pn.ensure();let e=ci(524352,t);return()=>{wt(e)}}function L$(t){pn.ensure();let e=ci(524352,t);return(r={})=>new Promise(n=>{r.outro?Bi(e,()=>{wt(e),n(void 0)}):(wt(e),n(void 0))})}function bn(t){return ci(4,t)}function A$(t){return ci(4718592,t)}function mr(t,e=0){return ci(8|e,t)}function ft(t,e=[],r=[],n=[]){Qp(n,e,r,i=>{ci(8,()=>t(...i.map(O)))})}function gn(t,e=0){var r=ci(16|e,t);return L&&(r.dev_stack=zi),r}function Rt(t){return ci(524320,t)}function _b(t){var e=t.teardown;if(e!==null){let r=yn,n=he;wb(!0),Ot(null);try{e.call(null)}finally{wb(r),Ot(n)}}}function Nf(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){let i=r.ac;i!==null&&Ia(()=>{i.abort(Js)});var n=r.next;(r.f&64)!==0?r.parent=null:wt(r,e),r=n}}function B$(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&32)===0&&wt(e),e=r}}function wt(t,e=!0){var r=!1;(e||(t.f&262144)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(xb(t.nodes.start,t.nodes.end),r=!0),Ye(t,33554432),Nf(t,e&&!r),Ta(t,0);var n=t.nodes&&t.nodes.t;if(n!==null)for(let s of n)s.stop();_b(t),t.f^=33554432,t.f|=16384;var i=t.parent;i!==null&&i.first!==null&&sb(t),L&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function xb(t,e){for(;t!==null;){var r=t===e?null:qt(t);t.remove(),t=r}}function sb(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 Bi(t,e,r=!0){var n=[];U$(t,n,!0);var i=()=>{r&&wt(t),e&&e()},s=n.length;if(s>0){var o=()=>--s||i();for(var a of n)a.out(o)}else i()}function U$(t,e,r){if((t.f&8192)===0){t.f^=8192;var n=t.nodes&&t.nodes.t;if(n!==null)for(let a of n)(a.is_global||r)&&e.push(a);for(var i=t.first;i!==null;){var s=i.next;if((i.f&64)===0){var o=(i.f&65536)!==0||(i.f&32)!==0&&(t.f&16)!==0;U$(i,e,o?r:!1)}i=s}}}function gc(t){j$(t,!0)}function j$(t,e){if((t.f&8192)!==0){t.f^=8192,(t.f&1024)===0&&(Ye(t,2048),pn.ensure().schedule(t));for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;j$(r,i?e:!1),r=n}var s=t.nodes&&t.nodes.t;if(s!==null)for(let o of s)(o.is_global||e)&&o.in()}}function dc(t,e){if(t.nodes)for(var r=t.nodes.start,n=t.nodes.end;r!==null;){var i=r===n?null:qt(r);e.append(r),r=i}}p();var q$=null;var em=!1,yn=!1;function wb(t){yn=t}var he=null,Tr=!1;function Ot(t){he=t}var J=null;function Nt(t){J=t}var wn=null;function Yp(t){he!==null&&(!Pt||(he.f&2)!==0)&&(wn===null?wn=[t]:wn.push(t))}var Qt=null,Cr=0,vn=null;function $$(t){vn=t}var V$=1,Pa=0,no=Pa;function mb(t){no=t}function fc(){return++V$}function to(t){var e=t.f;if((e&2048)!==0)return!0;if(e&2&&(t.f&=-65537),(e&4096)!==0){for(var r=t.deps,n=r.length,i=0;it.wv)return!0}(e&512)!==0&&Gt===null&&Ye(t,1024)}return!1}function H$(t,e,r=!0){var n=t.reactions;if(n!==null&&!(!Pt&&wn!==null&&Mn.call(wn,t)))for(var i=0;i{t.ac.abort(Js)}),t.ac=null);try{t.f|=2097152;var u=t.fn,f=u();t.f|=32768;var d=t.deps,h=be?.is_fork;if(Qt!==null){var g;if(h||Ta(t,Cr),d!==null&&Cr>0)for(d.length=Cr+Qt.length,g=0;g{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),ka()}function O(t){var e=t.f,r=(e&2)!==0;if(q$?.add(t),he!==null&&!Tr){var n=J!==null&&(J.f&16384)!==0;if(!n&&(wn===null||!Mn.call(wn,t))){var i=he.deps;if((he.f&2097152)!==0)t.rv>>0).toString(36)}var M8=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var Dfe=[...M8,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var L8=["touchstart","touchmove"];function K$(t){return L8.includes(t)}var B8=["$state","$state.raw","$derived","$derived.by"],zfe=[...B8,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];function nm(t){return t?.replace(/\//g,"/\u200B")}p();var Y$=new Map;function Z$(t,e){var r=Y$.get(t);r||(r=new Set,Y$.set(t,r)),r.add(e)}p();p();p();p();var zf=Symbol("events"),kb=new Set,im=new Set;function ir(t,e,r){(e[zf]??={})[t]=r}function io(t){for(var e=0;e{throw m});throw d}}finally{t[zf]=e,delete t.currentTarget,Ot(u),Nt(f)}}}p();p();var j8=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function eR(t){return j8?.createHTML(t)??t}function Eb(t){var e=li("template");return e.innerHTML=eR(t.replaceAll("","")),e.content}function Ar(t,e){var r=J;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function Be(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,s=!t.startsWith("");return()=>{if(ne)return Ar(ve,null),ve;i===void 0&&(i=Eb(s?t:""+t),r||(i=Et(i)));var o=n||If?document.importNode(i,!0):i.cloneNode(!0);if(r){var a=Et(o),l=o.lastChild;Ar(a,l)}else Ar(o,o);return o}}function Mf(t=""){if(!ne){var e=St(t+"");return Ar(e,e),e}var r=ve;return r.nodeType!==ma?(r.before(r=St()),Ge(r)):Df(r),Ar(r,r),r}function so(){if(ne)return Ar(ve,null),ve;var t=document.createDocumentFragment(),e=document.createComment(""),r=St();return t.append(e,r),Ar(e,r),t}function Ee(t,e){if(ne){var r=J;((r.f&32768)===0||r.nodes.end===null)&&(r.nodes.end=ve),jt();return}t!==null&&t.before(e)}var Cb=!0;function at(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t[xf]??=t.nodeValue)&&(t[xf]=r,t.nodeValue=`${r}`)}function Ra(t,e){return tR(t,e)}function Ab(t,e){Jp(),e.intro=e.intro??!1;let r=e.target,n=ne,i=ve;try{for(var s=Et(r);s&&(s.nodeType!==cn||s.data!==sc);)s=qt(s);if(!s)throw Fi;It(!0),Ge(s);let o=tR(t,{...e,anchor:s});return It(!1),o}catch(o){if(o instanceof Error&&o.message.split(` `).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return e.recover===!1&&r$(),Jp(),Ff(r),It(!1),Ra(t,e)}finally{It(n),Ge(i)}}var sm=new Map;function tR(t,{target:e,anchor:r,props:n={},events:i,context:s,intro:o=!0,transformError:a}){Jp();var l=void 0,c=L$(()=>{var u=r??e.appendChild(St());ab(u,{pending:()=>{}},h=>{fn({});var g=Oe;if(s&&(g.c=s),i&&(n.$$events=i),ne&&Ar(h,null),Cb=o,l=t(h,n)||{},Cb=!0,ne&&(J.nodes.end=ve,ve===null||ve.nodeType!==cn||ve.data!==ya))throw Fi;dn()},a);var f=new Set,d=h=>{for(var g=0;g{for(var h of f)for(let y of[e,document]){var g=sm.get(y),m=g.get(h);--m==0?(y.removeEventListener(h,Sb),g.delete(h),g.size===0&&sm.delete(y)):g.set(h,m)}im.delete(d),u!==r&&u.parentNode?.removeChild(u)}});return Tb.set(l,c),l}var Tb=new WeakMap;function yc(t,e){let r=Tb.get(t);return r?(Tb.delete(t),r(e)):(L&&(er in t?void 0:void 0),Promise.resolve())}p();p();p();p();p();p();p();var vs=class{anchor;#t=new Map;#r=new Map;#n=new Map;#e=new Set;#i=!0;constructor(e,r=!0){this.anchor=e,this.#i=r}#o=e=>{if(this.#t.has(e)){var r=this.#t.get(e),n=this.#r.get(r);if(n)gc(n),this.#e.delete(r);else{var i=this.#n.get(r);i&&(gc(i.effect),this.#r.set(r,i.effect),this.#n.delete(r),L&&(i.fragment.lastChild[Qv]=this.anchor),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(let[s,o]of this.#t){if(this.#t.delete(s),s===e)break;let a=this.#n.get(o);a&&(wt(a.effect),this.#n.delete(o))}for(let[s,o]of this.#r){if(s===r||this.#e.has(s))continue;let a=()=>{if(Array.from(this.#t.values()).includes(s)){var c=document.createDocumentFragment();dc(o,c),c.append(St()),this.#n.set(s,{effect:o,fragment:c})}else wt(o);this.#e.delete(s),this.#r.delete(s)};this.#i||!n?(this.#e.add(s),Bi(o,a,!1)):a()}}};#a=e=>{this.#t.delete(e);let r=Array.from(this.#t.values());for(let[n,i]of this.#n)r.includes(n)||(wt(i.effect),this.#n.delete(n))};ensure(e,r){var n=be,i=Xp();if(r&&!this.#r.has(e)&&!this.#n.has(e))if(i){var s=document.createDocumentFragment(),o=St();s.append(o),this.#n.set(e,{effect:Rt(()=>r(o)),fragment:s})}else this.#r.set(e,Rt(()=>r(this.anchor)));if(this.#t.set(n,e),i){for(let[a,l]of this.#r)a===e?n.unskip_effect(l):n.skip_effect(l);for(let[a,l]of this.#n)a===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(this.#o),n.ondiscard(this.#a)}else ne&&(this.anchor=ve),this.#o(n)}};p();function mt(t,e,r=!1){var n;ne&&(n=ve,jt());var i=new vs(t),s=r?65536:0;function o(a,l){if(ne){var c=Cf(n);if(a!==parseInt(c.substring(1))){var u=Di();Ge(u),i.anchor=u,It(!1),i.ensure(a,l),It(!0);return}}i.ensure(a,l)}gn(()=>{var a=!1;e((l,c=0)=>{a=!0,o(c,l)}),a||o(-1,null)},s)}p();var lpe=Symbol("NaN");p();p();function ji(t,e){return e}function Z8(t,e,r){for(var n=[],i=e.length,s,o=e.length,a=0;a{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var d=t.outrogroups;Ib(t,ic(s.done)),d.delete(s),d.size===0&&(t.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=n.length===0&&r!==null;if(l){var c=r,u=c.parentNode;Ff(u),u.append(c),t.items.clear()}Ib(t,e,!l)}else s={pending:new Set(e),done:new Set},(t.outrogroups??=new Set).add(s)}function Ib(t,e,r=!0){var n;if(t.pending.size>0){n=new Set;for(let o of t.pending.values())for(let a of o)n.add(t.items.get(a).e)}for(var i=0;i{var k=r();return ds(k)?k:k==null?[]:ic(k)});L&&ur(f,"{#each ...}");var d,h=new Map,g=!0;function m(k){(b.effect.f&16384)===0&&(b.pending.delete(k),b.fallback=u,J8(b,d,o,e,n),u!==null&&(d.length===0?(u.f&33554432)===0?gc(u):(u.f^=33554432,Bf(u,null,o)):Bi(u,()=>{u=null})))}function y(k){b.pending.delete(k)}var v=gn(()=>{d=O(f);var k=d.length;let E=!1;if(ne){var _=Cf(o)===ga;_!==(k===0)&&(o=Di(),Ge(o),It(!1),E=!0)}for(var x=new Set,S=be,C=Xp(),T=0;Ts(o)):(u=Rt(()=>s(nR??=St())),u.f|=33554432)),k>x.size&&(L?e4(d,n):Kv("","","")),ne&&k>0&&Ge(Di()),!g)if(h.set(S,x),C){for(let[j,Q]of a)x.has(j)||S.skip_effect(Q.e);S.oncommit(m),S.ondiscard(y)}else m(S);E&&It(!0),O(f)}),b={effect:v,flags:e,items:a,pending:h,outrogroups:null,fallback:u};g=!1,ne&&(o=ve)}function Lf(t){for(;t!==null&&(t.f&32)===0;)t=t.next;return t}function J8(t,e,r,n,i){var s=(n&8)!==0,o=e.length,a=t.items,l=Lf(t.effect.first),c,u=null,f,d=[],h=[],g,m,y,v;if(s)for(v=0;v0){var T=(n&4)!==0&&o===0?r:null;if(s){for(v=0;v{if(f!==void 0)for(y of f)y.nodes?.a?.apply()})}function X8(t,e,r,n,i,s,o,a){var l=(o&1)!==0?(o&16)===0?ba(r,!1,!1):pr(r):null,c=(o&2)!==0?pr(i):null;return L&&l&&(l.trace=()=>{a()[c?.v??i]}),{v:l,i:c,e:Rt(()=>(s(e,l??r,c??i,a),()=>{t.delete(n)}))}}function Bf(t,e,r){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end,s=e&&(e.f&33554432)===0?e.nodes.start:r;n!==null;){var o=qt(n);if(s.before(n),n===i)return;n=o}}function oo(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}function e4(t,e){let r=new Map,n=t.length;for(let i=0;i{var c=J;if(a===(a=e()??"")){ne&&jt();return}if(r&&!ne){c.nodes=null,l.innerHTML=a,a!==""&&Ar(Et(l),l.lastChild);return}if(c.nodes!==null&&(xb(c.nodes.start,c.nodes.end),c.nodes=null),a!==""){if(ne){for(var u=ve.data,f=jt(),d=f;f!==null&&(f.nodeType!==cn||f.data!=="");)d=f,f=qt(f);if(f===null)throw Fi;L&&!s&&t4(f.parentNode,u,a),Ar(ve,d),o=Ge(f);return}var h=n?Sf:i?Zv:void 0,g=li(n?"svg":i?"math":"template",h);g.innerHTML=a;var m=n||i?g:g.content;if(Ar(Et(m),m.lastChild),n||i)for(;Et(m);)o.before(Et(m));else o.before(m)}})}p();p();p();p();p();p();p();p();p();p();function Pb(t,e){bn(()=>{var r=t.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){let i=li("style");i.id=e.hash,i.textContent=e.code,n.appendChild(i),L&&Z$(e.hash,i)}})}p();function Oa(t,e,r){bn(()=>{var n=it(()=>e(t,r?.())||{});if(r&&n?.update){var i=!1,s={};mr(()=>{var o=r();rm(o),i&&Dp(s,o)&&(s=o,n.update(o))}),i=!0}if(n?.destroy)return()=>n.destroy()})}p();p();p();p();p();var sR=[...` \r\f\xA0\v\uFEFF`];function oR(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i of Object.keys(r))if(r[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,o=0;(o=n.indexOf(i,o))>=0;){var a=o+s;(o===0||sR.includes(n[o-1]))&&(a===n.length||sR.includes(n[a]))?n=(o===0?"":n.substring(0,o))+n.substring(a+1):o=a}}return n===""?null:n}p();function ui(t,e,r,n,i,s){var o=t[_f];if(ne||o!==r||o===void 0){var a=oR(r,n,s);(!ne||a!==t.getAttribute("class"))&&(a==null?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a)),t[_f]=r}else if(s&&i!==s)for(var l in s){var c=!!s[l];(i==null||c!==!!i[l])&&t.classList.toggle(l,c)}return s}p();p();var p4=Symbol("class"),m4=Symbol("style"),g4=Symbol("is custom element"),y4=Symbol("is html"),w4=Wv?"link":"LINK";function Uf(t){if(ne){var e=!1,r=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;Na(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;Na(t,"checked",null),t.checked=i}}};t[kf]=r,Vt(r),yb()}}function jf(t,e){var r=uR(t);r.checked!==(r.checked=e??void 0)&&(t.checked=e)}function Na(t,e,r,n){var i=uR(t);if(ne&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===w4)){n||b4(t,e,r??"");return}i[e]!==(i[e]=r)&&(e==="loading"&&(t[GP]=r),r==null?t.removeAttribute(e):typeof r!="string"&&v4(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function uR(t){return t[Rp]??={[g4]:t.nodeName.includes("-"),[y4]:t.namespaceURI===Np}}var aR=new Map;function v4(t){var e=t.getAttribute("is")||t.nodeName,r=aR.get(e);if(r)return r;aR.set(e,r=[]);for(var n,i=t,s=Element.prototype;s!==i;){n=Ap(i);for(var o in n)n[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&r.push(o);i=pa(i)}return r}function b4(t,e,r){L&&(e==="srcset"&&_4(t,r)||$b(t.getAttribute(e)??"",r)||(t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r),void 0))}function $b(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function lR(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function _4(t,e){var r=lR(t.srcset),n=lR(e);return n.length===r.length&&n.every(([i,s],o)=>s===r[o][1]&&($b(r[o][0],i)||$b(i,r[o][0])))}p();p();p();p();p();p();p();p();p();p();p();p();p();p();function _n(t,e,r,n){var i=!hs||(r&2)!==0,s=(r&8)!==0,o=(r&16)!==0,a=n,l=!0,c=void 0,u=()=>o&&i?(c??=ro(n),O(c)):(l&&(l=!1,a=o?it(n):n),a);let f;if(s){var d=er in t||bf in t;f=qr(t,e)?.set??(d&&e in t?E=>t[e]=E:void 0)}var h,g=!1;s?[h,g]=eb(()=>t[e]):h=t[e],h===void 0&&n!==void 0&&(h=u(),f&&(i&&n$(e),f(h)));var m;if(i?m=()=>{var E=t[e];return E===void 0?u():(l=!0,E)}:m=()=>{var E=t[e];return E!==void 0&&(a=void 0),E===void 0?a:E},i&&(r&4)===0)return m;if(f){var y=t.$$legacy;return function(E,_){return arguments.length>0?((!i||!_||y||g)&&f(_?m():E),E):m()}}var v=!1,b=((r&1)!==0?ro:Ea)(()=>(v=!1,m()));L&&(b.label=e),s&&O(b);var k=J;return function(E,_){if(arguments.length>0){let x=_?O(b):i&&s?Wt(E):E;return Ae(b,x),v=!0,a!==void 0&&(a=x),E}return yn&&v||(k.f&16384)!==0?b.v:O(b)}}p();p();p();function fR(t){return new Rb(t)}var Rb=class{#t;#r;constructor(e){var r=new Map,n=(s,o)=>{var a=ba(o,!1,!1);return r.set(s,a),a};let i=new Proxy({...e.props||{},$$events:{}},{get(s,o){return O(r.get(o)??n(o,Reflect.get(s,o)))},has(s,o){return o===bf?!0:(O(r.get(o)??n(o,Reflect.get(s,o))),Reflect.has(s,o))},set(s,o,a){return Ae(r.get(o)??n(o,a),a),Reflect.set(s,o,a)}});this.#r=(e.hydrate?Ab:Ra)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError}),!Pt&&(!e?.props?.$$host||e.sync===!1)&&ka(),this.#t=i.$$events;for(let s of Object.keys(this.#r))s==="$set"||s==="$destroy"||s==="$on"||Xt(this,s,{get(){return this.#r[s]},set(o){this.#r[s]=o},enumerable:!0});this.#r.$set=s=>{Object.assign(i,s)},this.#r.$destroy=()=>{yc(this.#r)}}$set(e){this.#r.$set(e)}$on(e,r){this.#t[e]=this.#t[e]||[];let n=(...i)=>r.call(this,...i);return this.#t[e].push(n),()=>{this.#t[e]=this.#t[e].filter(i=>i!==n)}}$destroy(){this.#r.$destroy()}};var N4;typeof HTMLElement=="function"&&(N4=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(t,e,r){super(),this.$$ctor=t,this.$$s=e,r&&(this.$$shadowRoot=this.attachShadow(r))}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){let n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){let n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return i=>{let s=li("slot");n!=="default"&&(s.name=n),Ee(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},r=F4(this);for(let n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),e.default=!0):e[n]=t(n));for(let n of this.attributes){let i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Ob(i,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=fR({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=bb(()=>{mr(()=>{this.$$r=!0;for(let n of qv(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=Ob(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(let n in this.$$l)for(let i of this.$$l[n]){let s=this.$$c.$on(n,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Ob(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return qv(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Ob(t,e,r,n){let i=r[t]?.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;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 F4(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}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;i$(e)},set:n=>{r=n}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function dR(t){Oe===null&&Op("onMount"),hs&&Oe.l!==null?D4(Oe).m.push(t):ws(()=>{let e=it(t);if(typeof e=="function")return e})}function D4(t){var e=t.l;return e.u??={a:[],b:[],m:[]}}p();p();p();var hR="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(hR);var Hf=require("obsidian");p();var pR=require("obsidian");function Vn(t,e){fn(e,!0);let r=_n(e,"name",3,"book-heart");var n=so(),i=qn(n);wc(i,()=>(0,pR.getIcon)(r())?.outerHTML),Ee(t,n),dn()}p();p();var mR={},z4=Be(''),M4=Be(" ",1),L4=Be(''),B4=Be(' ',1),U4=Be(" ",1),j4=Be(''),q4=Be('BASE'),V4=Be('CANVAS'),H4=Be(''),G4=Be(' '),Q4=Be("
");function Vf(t,e){fn(e,!0);let r=_n(e,"tree",7),n=_n(e,"readOnly",3,!1),i=_n(e,"enableShowDiff",3,!1),s=ut(()=>r().isRoot),o=ut(()=>r().path),a=Xe(!1);mc(()=>{Ae(a,mR[O(o)]||!1,!0)});let l=()=>{Ae(a,mR[O(o)]=!O(a),!0)},c=ut(()=>O(a)),u=()=>{r().checked=!r().checked,e.ontoggle?.({node:r()})},f=E=>{e.ontoggle?.({node:E})},d=E=>{E.stopPropagation(),e.onshowdiff?.({node:r()})},h=E=>{e.onshowdiff?.({node:E})};var g=Q4();let m;var y=fe(g),v=fe(y);{var b=E=>{var _=U4(),x=qn(_),S=fe(x);let C;var T=fe(S);Vn(T,{name:"chevron-right"}),le(S);var P=_e(S,2);{var R=Q=>{var ge=M4(),ie=qn(ge);Vn(ie,{name:"folder"});var pe=_e(ie,2);{var Ze=B=>{var I=z4();Uf(I),ft(()=>{Na(I,"data-label",r().name),jf(I,r().checked),I.indeterminate=r().indeterminate}),ir("click",I,u),Ee(B,I)};mt(pe,B=>{n()||B(Ze)})}var A=_e(pe,2),q=fe(A,!0);le(A),ft(()=>at(q,r().name)),ir("click",A,l),Ee(Q,ge)},N=Q=>{var ge=B4(),ie=qn(ge);{var pe=q=>{var B=L4();Uf(B),ft(()=>{Na(B,"data-label",r().name),jf(B,r().checked),B.indeterminate=r().indeterminate}),ir("click",B,u),Ee(q,B)};mt(ie,q=>{n()||q(pe)})}var Ze=_e(ie,2),A=fe(Ze,!0);le(Ze),ft(()=>at(A,r().name)),ir("click",Ze,l),Ee(Q,ge)};mt(P,Q=>{O(s)?Q(N,-1):Q(R)})}le(x);var F=_e(x,2);{var j=Q=>{var ge=so(),ie=qn(ge);qi(ie,17,()=>r().children,ji,(pe,Ze)=>{Vf(pe,{ontoggle:A=>f(A.node),onshowdiff:A=>h(A.node),get enableShowDiff(){return i()},get readOnly(){return n()},get tree(){return O(Ze)}})}),Ee(Q,ge)};mt(F,Q=>{O(a)&&Q(j)})}ft(()=>C=ui(S,1,"arrow",null,C,{arrowDown:O(c)})),ir("click",S,l),Ee(E,_)},k=E=>{var _=G4(),x=_e(fe(_),2);Vn(x,{name:"file"});var S=_e(x,2);{var C=ie=>{var pe=j4();Uf(pe),ft(()=>{Na(pe,"data-label",r().name),jf(pe,r().checked),pe.indeterminate=r().indeterminate}),ir("click",pe,u),Ee(ie,pe)};mt(S,ie=>{n()||ie(C)})}var T=_e(S,2),P=fe(T,!0);le(T);var R=_e(T,2);{var N=ie=>{var pe=q4();Ee(ie,pe)};mt(R,ie=>{r().fileType==="base"&&ie(N)})}var F=_e(R,2);{var j=ie=>{var pe=V4();Ee(ie,pe)};mt(F,ie=>{r().fileType==="canvas"&&ie(j)})}var Q=_e(F,2);{var ge=ie=>{var pe=H4(),Ze=fe(pe);Vn(Ze,{name:"file-diff"}),le(pe),ir("click",pe,d),Ee(ie,pe)};mt(Q,ie=>{i()&&ie(ge)})}le(_),ft(()=>at(P,r().name)),ir("click",T,l),Ee(E,_)};mt(v,E=>{r().children?E(b):O(s)||E(k,1)})}le(y),le(g),ft(()=>m=ui(g,1,"",null,m,{isRoot:O(s)})),Ee(t,g),dn()}io(["click"]);var W4=Be("
");function vc(t,e){fn(e,!0);let r=_n(e,"readOnly",3,!1),n=_n(e,"enableShowDiff",3,!1),i={};function s(u){if(u.children)for(let f of u.children)i[f.path]=u,s(f)}ws(()=>{let u=e.tree;it(()=>{i={},s(u),a({node:u},!1)})});function o(u,f=!0){if(u.children){for(let d of u.children)f&&(d.checked=!!u.checked),o(d,f);u.indeterminate=u.children.some(d=>d.indeterminate)||u.children.some(d=>!!d.checked)&&u.children.some(d=>!d.checked)}}function a(u,f=!0){let d=u.node,h=i[d.path];for(o(d,f);h;)h?.children?.every(m=>!!m.checked)?(h.indeterminate=!1,h.checked=!0):(h?.children?.some(y=>!!y.checked||y.indeterminate)?h.indeterminate=!0:h.indeterminate=!1,h.checked=!1),h=i[h.path]}var l=W4(),c=fe(l);Vf(c,{get tree(){return e.tree},get readOnly(){return r()},get enableShowDiff(){return n()},ontoggle:a,onshowdiff:u=>e.showDiff(u.node.path)}),le(l),Ee(t,l),dn()}var K4=Be('
'),Y4=Be('
'),Z4=Be(' ',1),J4=Be("
"),X4=Be('- PUBLISHED'),eV=Be('
'),tV=Be('- DELETED'),rV=Be('
'),nV=Be('
Publishing Notes
'),iV=Be("
");function Nb(t,e){fn(e,!0);let r=Xe(void 0),n=Xe(!1),i=Xe("Preparing to load..."),s=Xe("Notes processed: 0/0"),o,a;async function l(){Ae(r,await e.publishStatusManager.getPublishStatus(o),!0)}dR(l);function c(A){return A.endsWith(".base")?"base":A.endsWith(".canvas")?"canvas":A.endsWith(".excalidraw")||A.endsWith(".excalidraw.md")?"excalidraw":A.endsWith(".md")?"markdown":"unknown"}function u(A,q,B,I,ce){let ue=A,Pe=q.split("/"),se=B.has(q);for(let me=0;meue.path)??[]),ce=new WeakMap;for(let ue of A)u(B,ue,I,ce);return B}function d(A){let q=new Hf.ProgressBarComponent(A);return o={setProgress:B=>{q.setValue(B)},setIndexText:B=>{Ae(s,B,!0)},setText:B=>{Ae(i,B,!0)}},{destroy(){}}}function h(A){let q=new Hf.ProgressBarComponent(A);return a={setProgress:B=>{q.setValue(B)},setIndexText:()=>{},setText:()=>{}},{destroy(){}}}let g=()=>{let A=(0,Hf.getIcon)("cog");return A?.classList.add("quartz-syncer-rotate","quartz-syncer-cog"),A},m=Xe(void 0),y=Xe(void 0),v=Xe(void 0),b=Xe(void 0);ws(()=>{O(r)&&(Ae(m,f(O(r).publishedNotes.map(A=>A.getVaultPath()),"Unchanged notes"+(O(r).publishedNotes.length>0?` (${O(r).publishedNotes.length===1?"1 note":`${O(r).publishedNotes.length} notes`})`:"")),!0),Ae(y,f(O(r).changedNotes.map(A=>A.getVaultPath()),"Changed notes"+(O(r).changedNotes.length>0?` (${O(r).changedNotes.length===1?"1 note":`${O(r).changedNotes.length} notes`})`:"")),!0),Ae(v,f([...O(r).deletedNotePaths,...O(r).deletedBlobPaths].map(A=>A.path),"Published notes (select to unpublish)"+(O(r).changedNotes.length+O(r).publishedNotes.length>0?` (${O(r).changedNotes.length+O(r).publishedNotes.length===1?"1 note":`${O(r).changedNotes.length+O(r).publishedNotes.length} notes`})`:"")),!0),Ae(b,f(O(r).unpublishedNotes.map(A=>A.getVaultPath()),"Unpublished notes"+(O(r).unpublishedNotes.length>0?` (${O(r).unpublishedNotes.length===1?"1 note":`${O(r).unpublishedNotes.length} notes`})`:"")),!0))});let k=Xe(Wt([])),E=Xe(Wt([])),_=Xe(Wt([])),x=Xe(Wt([])),S=Xe(Wt([])),C=Wt([]),T=ut(()=>(O(S).length+C.length)/(O(k).length+O(E).length+O(_).length)*100);ws(()=>{let A=O(T);a&&a.setProgress(A)});let P=A=>{let q=[];if(A.children)for(let B of A.children)q.push(...P(B));else A.checked&&q.push(A.path);return q},R=async()=>{if(!O(b)||!O(y))return;if(!O(r))throw new Error("Publish status is undefined");let A=P(O(b)),q=P(O(y));Ae(_,P(O(v)),!0);let B=O(_).filter(de=>O(r).deletedNotePaths.some($e=>$e.path===de)),I=O(_).filter(de=>O(r).deletedBlobPaths.some($e=>$e.path===de));Ae(k,O(r).unpublishedNotes.filter(de=>A.includes(de.getVaultPath()))??[],!0),Ae(E,O(r)?.changedNotes.filter(de=>q.includes(de.getVaultPath()))??[],!0);let ce=O(k).concat(O(E));Ae(n,!0),await $a();let ue=e.publisher.createConnection(),Pe=ce.map(de=>de.getVaultPath()),se=[...B,...I],me=[...Pe,...se];Ae(x,[...me],!0),ce.length>0&&await e.publisher.publishBatch(ce,ue,async(de,$e)=>{Ae(S,Pe.slice(0,de),!0),Ae(x,[...Pe.slice(de),...se],!0),await $a()});let We=[...Pe];Ae(S,[...We],!0),se.length>0&&(Ae(x,[...se],!0),await e.publisher.deleteBatch(se,ue,async(de,$e)=>{Ae(S,[...We,...se.slice(0,de)],!0),Ae(x,se.slice(de),!0),await $a()})),Ae(S,[...me],!0),Ae(x,[],!0)},N={name:"",isRoot:!1,path:"",indeterminate:!1,checked:!1};var F=iV(),j=fe(F);{var Q=A=>{var q=K4();Ee(A,q)};mt(j,A=>{O(r)&&A(Q)})}var ge=_e(j,2);{var ie=A=>{var q=Y4(),B=fe(q);Oa(B,se=>d?.(se));var I=_e(B,2),ce=fe(I,!0);le(I);var ue=_e(I,2),Pe=fe(ue,!0);le(ue),le(q),ft(()=>{at(ce,O(s)),at(Pe,O(i))}),Ee(A,q)},pe=A=>{var q=Z4(),B=qn(q);{let me=ut(()=>O(b)??N);vc(B,{get tree(){return O(me)},get showDiff(){return e.showDiff}})}var I=_e(B,2);{let me=ut(()=>O(y)??N);vc(I,{get tree(){return O(me)},get showDiff(){return e.showDiff},enableShowDiff:!0})}var ce=_e(I,2);{let me=ut(()=>O(v)??N);vc(ce,{get tree(){return O(me)},get showDiff(){return e.showDiff}})}var ue=_e(ce,2);{let me=ut(()=>O(m)??N);vc(ue,{readOnly:!0,get tree(){return O(me)},get showDiff(){return e.showDiff}})}var Pe=_e(ue,4),se=fe(Pe);le(Pe),ir("click",se,R),Ee(A,q)},Ze=A=>{var q=nV(),B=fe(q),I=_e(fe(B),2),ce=fe(I,!0);le(I);var ue=_e(I,2);{var Pe=Ce=>{var ze=J4(),je=fe(ze,!0);le(ze),ft(()=>at(je,`(${C.length} failed)`)),Ee(Ce,ze)};mt(ue,Ce=>{C.length>0&&Ce(Pe)})}var se=_e(ue,2),me=fe(se);Oa(me,Ce=>h?.(Ce)),le(se),le(B);var We=_e(B,2);qi(We,17,()=>O(k).concat(O(E)),ji,(Ce,ze)=>{var je=eV(),zt=fe(je);{var bt=te=>{var Re=so(),Ke=qn(Re);wc(Ke,()=>g()?.outerHTML),Ee(te,Re)},vr=ut(()=>O(x).includes(O(ze).getVaultPath())),or=te=>{Vn(te,{name:"check"})},Xr=ut(()=>O(S).includes(O(ze).getVaultPath())),nu=te=>{Vn(te,{name:"cross"})},Ja=ut(()=>C.includes(O(ze).getVaultPath())),iu=te=>{Vn(te,{name:"clock"})};mt(zt,te=>{O(vr)?te(bt):O(Xr)?te(or,1):O(Ja)?te(nu,2):te(iu,-1)})}var Xa=_e(zt),su=_e(Xa);{var D=te=>{var Re=X4();Ee(te,Re)},H=ut(()=>O(S).includes(O(ze).getVaultPath()));mt(su,te=>{O(H)&&te(D)})}le(je),ft(()=>at(Xa,` ${O(ze).file.name??""} `)),Ee(Ce,je)});var de=_e(We,2);qi(de,17,()=>O(_),ji,(Ce,ze)=>{var je=rV(),zt=fe(je);{var bt=D=>{var H=so(),te=qn(H);wc(te,()=>g()?.outerHTML),Ee(D,H)},vr=ut(()=>O(x).includes(O(ze))),or=D=>{Vn(D,{name:"check"})},Xr=ut(()=>O(S).includes(O(ze))),nu=D=>{Vn(D,{name:"clock"})};mt(zt,D=>{O(vr)?D(bt):O(Xr)?D(or,1):D(nu,-1)})}var Ja=_e(zt),iu=_e(Ja);{var Xa=D=>{var H=tV();Ee(D,H)},su=ut(()=>O(S).includes(O(ze)));mt(iu,D=>{O(su)&&D(Xa)})}le(je),ft(D=>at(Ja,` ${D??""} `),[()=>O(ze).split("/").last()]),Ee(Ce,je)});var $e=_e(de,4),ye=fe($e);le($e),le(q),ft(()=>at(ce,`${O(S).length} of ${O(k).length+O(E).length+O(_).length} notes published`)),ir("click",ye,function(...Ce){e.close?.apply(this,Ce)}),Ee(A,q)};mt(ge,A=>{O(r)?O(n)?A(Ze,-1):A(pe,1):A(ie)})}le(F),Ee(t,F),dn()}io(["click"]);p();p();p();var Gf=class{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(e,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,r,n,i){var s;let o=b=>{if(b=this.postProcess(b,n),i){setTimeout(function(){i(b)},0);return}else return b},a=r.length,l=e.length,c=1,u=a+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],r,e,0,n);if(h[0].oldPos+1>=l&&g+1>=a)return o(this.buildValues(h[0].lastComponent,r,e));let m=-1/0,y=1/0,v=()=>{for(let b=Math.max(m,-c);b<=Math.min(y,c);b+=2){let k,E=h[b-1],_=h[b+1];E&&(h[b-1]=void 0);let x=!1;if(_){let C=_.oldPos-b;x=_&&0<=C&&C=l&&g+1>=a)return o(this.buildValues(k.lastComponent,r,e))||!0;h[b]=k,k.oldPos+1>=l&&(y=Math.min(y,b-1)),g+1>=a&&(m=Math.max(m,b+1))}c++};if(i)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return i(void 0);v()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=v();if(b)return b}}addToPath(e,r,n,i,s){let o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(e,r,n,i,s){let o=r.length,a=n.length,l=e.oldPos,c=l-i,u=0;for(;c+1d.length?g:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}};p();var Fb=class extends Gf{constructor(){super(...arguments),this.tokenize=sV}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)}},gR=new Fb;function Db(t,e,r){return gR.diff(t,e,r)}function sV(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 '),aV=Be('
'),lV=Be('
'),cV=Be('
Remote (Published)
Local (Current)
'),uV=Be('
'),fV=Be('
'),dV=Be(`
`),hV={hash:"svelte-1f2vmea",code:`.diff-view-wrapper.svelte-1f2vmea {font-family:var(--font-monospace);font-size:12px;border:1px solid var(--background-modifier-border);border-radius:6px;overflow:hidden;}.diff-header.svelte-1f2vmea {display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:var(--background-secondary);border-bottom:1px solid var(--background-modifier-border);}.diff-info.svelte-1f2vmea {display:flex;align-items:center;gap:12px;}.diff-stats.svelte-1f2vmea {display:flex;gap:8px;font-weight:500;}.additions.svelte-1f2vmea {color:var(--color-green);}.deletions.svelte-1f2vmea {color:var(--color-red);}.diff-filename.svelte-1f2vmea {color:var(--text-muted);}.diff-controls.svelte-1f2vmea {display:flex;gap:4px;}.view-toggle.svelte-1f2vmea {padding:4px 12px;border:1px solid var(--background-modifier-border);background:var(--background-primary);border-radius:4px;cursor:pointer;font-size:11px;color:var(--text-muted);}.view-toggle.svelte-1f2vmea:hover {background:var(--background-modifier-hover);}.view-toggle.active.svelte-1f2vmea {background:var(--interactive-accent);color:var(--text-on-accent);border-color:var(--interactive-accent);}.diff-split.svelte-1f2vmea {display:flex;height:50vh;}.diff-pane.svelte-1f2vmea {flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden;}.diff-pane.svelte-1f2vmea:first-child {border-right:1px solid var(--background-modifier-border);}.diff-pane-header.svelte-1f2vmea {padding:6px 12px;background:var(--background-secondary);border-bottom:1px solid var(--background-modifier-border);font-size:11px;font-weight:500;color:var(--text-muted);}.diff-scroll-area.svelte-1f2vmea {flex:1;overflow:auto;}.diff-unified-scroll.svelte-1f2vmea {height:50vh;overflow:auto;}.diff-lines-inner.svelte-1f2vmea {display:inline-block;min-width:100%;}.diff-line.svelte-1f2vmea {display:flex;line-height:20px;white-space:pre;}.diff-line.added.svelte-1f2vmea {--fallback-color-added: 46, 160, 67;background:rgba( var( --background-modifier-success-rgb, var(--color-green-rgb, var(--fallback-color-added)) ), 0.15 );}.diff-line.removed.svelte-1f2vmea {--fallback-color-removed: 248, 81, 73;background:rgba( var( --background-modifier-error-rgb, var(--color-red-rgb, var(--fallback-color-removed)) ), 0.15 );}.diff-line.empty.svelte-1f2vmea {background:var(--background-secondary);}.line-num.svelte-1f2vmea {min-width:40px;padding:0 8px;text-align:right;color:var(--text-faint);background:var(--background-secondary);user-select:none;border-right:1px solid var(--background-modifier-border);flex-shrink:0;}.diff-line.added.svelte-1f2vmea > .line-num:where(.svelte-1f2vmea), .diff-line.removed.svelte-1f2vmea > .line-num:where(.svelte-1f2vmea) {background:transparent;}.line-indicator.svelte-1f2vmea {width:20px;min-width:20px;text-align:center;color:var(--text-muted);user-select:none;flex-shrink:0;}.diff-line.added.svelte-1f2vmea .line-indicator:where(.svelte-1f2vmea) {color:var(--color-green);font-weight:bold;}.diff-line.removed.svelte-1f2vmea .line-indicator:where(.svelte-1f2vmea) {color:var(--color-red);font-weight:bold;}.line-content.svelte-1f2vmea {flex:1;padding:0 8px;}.diff-footer.svelte-1f2vmea {padding:8px 12px;background:var(--background-secondary);border-top:1px solid var(--background-modifier-border);font-size:11px;color:var(--text-muted);font-family:var(--font-interface);}`};function zb(t,e){fn(e,!0),Pb(t,hV);let r=_n(e,"fileName",3,""),n=_n(e,"defaultViewStyle",3,"auto");function i(){return n()==="split"?"split":n()==="unified"||yR.Platform.isMobile?"unified":"split"}let s=Xe(Wt(i())),o=ut(()=>Db(e.oldContent,e.newContent));function a(q){let B=[],I=1,ce=1;for(let ue of q){let Pe=ue.value.replace(/\n$/,"").split(` `);if(ue.added)for(let se of Pe){let me=B[B.length-1];me&&me.right===null?(me.right={content:se,type:"added"},me.rightLineNum=ce++):B.push({left:null,right:{content:se,type:"added"},leftLineNum:null,rightLineNum:ce++})}else if(ue.removed)for(let se of Pe)B.push({left:{content:se,type:"removed"},right:null,leftLineNum:I++,rightLineNum:null});else for(let se of Pe)B.push({left:{content:se,type:"unchanged"},right:{content:se,type:"unchanged"},leftLineNum:I++,rightLineNum:ce++})}return B}let l=ut(()=>a(O(o)));function c(q){let B=[],I=1,ce=1;for(let ue of q){let Pe=ue.value.replace(/\n$/,"").split(` `);for(let se of Pe)ue.added?B.push({content:se,type:"added",oldLineNum:null,newLineNum:ce++}):ue.removed?B.push({content:se,type:"removed",oldLineNum:I++,newLineNum:null}):B.push({content:se,type:"unchanged",oldLineNum:I++,newLineNum:ce++})}return B}let u=ut(()=>c(O(o))),f=ut(()=>O(o).filter(q=>q.added).reduce((q,B)=>q+B.count,0)),d=ut(()=>O(o).filter(q=>q.removed).reduce((q,B)=>q+B.count,0)),h=null,g=null,m=!1;function y(q,B){m||(m=!0,B.scrollTop=q.scrollTop,B.scrollLeft=q.scrollLeft,requestAnimationFrame(()=>{m=!1}))}function v(q){h=q;let B=()=>{g&&y(q,g)};return q.addEventListener("scroll",B),{destroy(){q.removeEventListener("scroll",B),h=null}}}function b(q){g=q;let B=()=>{h&&y(q,h)};return q.addEventListener("scroll",B),{destroy(){q.removeEventListener("scroll",B),g=null}}}var k=dV(),E=fe(k),_=fe(E),x=fe(_),S=fe(x),C=fe(S);le(S);var T=_e(S,2),P=fe(T);le(T),le(x);var R=_e(x,2);{var N=q=>{var B=oV(),I=fe(B,!0);le(B),ft(()=>at(I,r())),Ee(q,B)};mt(R,q=>{r()&&q(N)})}le(_);var F=_e(_,2),j=fe(F);let Q;var ge=_e(j,2);let ie;le(F),le(E);var pe=_e(E,2);{var Ze=q=>{var B=cV(),I=fe(B),ce=_e(fe(I),2),ue=fe(ce);qi(ue,21,()=>O(l),ji,(We,de)=>{var $e=aV();let ye;var Ce=fe($e),ze=fe(Ce,!0);le(Ce);var je=_e(Ce,2),zt=fe(je,!0);le(je);var bt=_e(je,2),vr=fe(bt,!0);le(bt),le($e),ft(()=>{ye=ui($e,1,"diff-line svelte-1f2vmea",null,ye,{removed:O(de).left?.type==="removed",empty:O(de).left===null}),at(ze,O(de).leftLineNum??""),at(zt,O(de).left?.type==="removed"?"-":" "),at(vr,O(de).left?.content??"")}),Ee(We,$e)}),le(ue),le(ce),Oa(ce,We=>v?.(We)),le(I);var Pe=_e(I,2),se=_e(fe(Pe),2),me=fe(se);qi(me,21,()=>O(l),ji,(We,de)=>{var $e=lV();let ye;var Ce=fe($e),ze=fe(Ce,!0);le(Ce);var je=_e(Ce,2),zt=fe(je,!0);le(je);var bt=_e(je,2),vr=fe(bt,!0);le(bt),le($e),ft(()=>{ye=ui($e,1,"diff-line svelte-1f2vmea",null,ye,{added:O(de).right?.type==="added",empty:O(de).right===null}),at(ze,O(de).rightLineNum??""),at(zt,O(de).right?.type==="added"?"+":" "),at(vr,O(de).right?.content??"")}),Ee(We,$e)}),le(me),le(se),Oa(se,We=>b?.(We)),le(Pe),le(B),Ee(q,B)},A=q=>{var B=fV(),I=fe(B);qi(I,21,()=>O(u),ji,(ce,ue)=>{var Pe=uV();let se;var me=fe(Pe),We=fe(me,!0);le(me);var de=_e(me,2),$e=fe(de,!0);le(de);var ye=_e(de,2),Ce=fe(ye);{var ze=or=>{var Xr=Mf("+");Ee(or,Xr)},je=or=>{var Xr=Mf("-");Ee(or,Xr)},zt=or=>{var Xr=Mf();Xr.nodeValue=" ",Ee(or,Xr)};mt(Ce,or=>{O(ue).type==="added"?or(ze):O(ue).type==="removed"?or(je,1):or(zt,-1)})}le(ye);var bt=_e(ye,2),vr=fe(bt,!0);le(bt),le(Pe),ft(()=>{se=ui(Pe,1,"diff-line svelte-1f2vmea",null,se,{added:O(ue).type==="added",removed:O(ue).type==="removed"}),at(We,O(ue).oldLineNum??""),at($e,O(ue).newLineNum??""),at(vr,O(ue).content)}),Ee(ce,Pe)}),le(I),le(B),Ee(q,B)};mt(pe,q=>{O(s)==="split"?q(Ze):q(A,-1)})}Ef(2),le(k),ft(()=>{at(C,`+${O(f)??""}`),at(P,`-${O(d)??""}`),Q=ui(j,1,"view-toggle svelte-1f2vmea",null,Q,{active:O(s)==="split"}),ie=ui(ge,1,"view-toggle svelte-1f2vmea",null,ie,{active:O(s)==="unified"})}),ir("click",j,()=>Ae(s,"split")),ir("click",ge,()=>Ae(s,"unified")),Ee(t,k),dn()}io(["click"]);var am=class{modal;settings;publishStatusManager;publisher;siteManager;vault;publicationCenterUi;constructor(e,r,n,i,s){this.modal=new Fa.Modal(e),this.settings=s,this.publishStatusManager=r,this.publisher=n,this.siteManager=i,this.vault=e.vault,this.modal.titleEl.createSpan({text:"Publication center"}).prepend(this.getIcon("leaf")),this.modal.titleEl.addClass("quartz-syncer-modal-title"),this.modal.contentEl.addClass("quartz-syncer-modal-content")}getIcon(e){let r=(0,Fa.getIcon)(e)??activeDocument.createSpan();return r instanceof SVGSVGElement&&r.addClass("quartz-syncer-svg-icon"),r}showDiff=async e=>{try{let r,n,i,s;this.settings.useCache&&(await this.publisher.datastore.loadRemoteFile(e),n=r?r[0]:void 0),(!r||!this.settings.useCache)&&(n=await this.siteManager.getNoteContent(e));let o="";if(this.settings.vaultPath!=="/"&&this.settings.vaultPath!==""?o=this.settings.vaultPath+e:o=e,this.settings.useCache)i=await this.publisher.datastore.loadLocalFile(o),s=i?i[0]:void 0;else if(i=this.vault.getFileByPath(o),!(i instanceof Fa.TFile))s="";else{if(i=await this.publisher.compiler.generateMarkdown(new Qo({file:i,vault:this.vault,compiler:this.publisher.compiler,datastore:this.publisher.datastore,metadataCache:this.publisher.metadataCache,settings:this.settings})),!i)throw new Error(`Failed to compile local file: ${o}. Compiler returned null.`);s=i[0]}if(n&&s){let a,l=new Fa.Modal(this.modal.app),c=e.split("/").pop()||"Diff";l.modalEl.addClass("quartz-syncer-diff-modal"),l.titleEl.createSpan({text:`${c}`}).prepend(this.getIcon("file-diff")),l.onOpen=()=>{a=Ra(zb,{target:l.contentEl,props:{oldContent:n,newContent:s,fileName:c,defaultViewStyle:this.settings.diffViewStyle}})},l.onClose=()=>{a&&yc(a)},l.open()}}catch{}};open=()=>{this.modal.onClose=()=>{yc(this.publicationCenterUi)},this.modal.onOpen=()=>{this.modal.contentEl.empty(),this.publicationCenterUi=Ra(Nb,{target:this.modal.contentEl,props:{publishStatusManager:this.publishStatusManager,publisher:this.publisher,showDiff:this.showDiff,close:()=>{this.modal.close()}}})},this.modal.open()}};p();var Da=class{siteManager;publisher;constructor(e,r){this.siteManager=e,this.publisher=r}generateDeletedContentPaths(e,r){let n=new Set(r),i=l=>l.endsWith(".js"),s=l=>n.has(l);return Object.keys(e).filter(l=>!i(l)&&!s(l)).map(l=>({path:l,sha:e[l]}))}async getPublishStatus(e){let r=[],n=[],i=[],s=[],o=[];e&&(e.setText("Retrieving publish status..."),e.setProgress(0));let a=await this.siteManager.userSyncerConnection.getContent("HEAD");if(!a)throw new Error("Could not get content tree from base garden");let l=await this.siteManager.getNoteHashes(a),c=await this.siteManager.getBlobHashes(a),u=Object.entries(c);if(this.publisher.settings.useCache){await this.publisher.datastore.preloadCache();let m=u.filter(([E,_])=>_?E.endsWith(".md")||this.publisher.settings.useBases&&E.endsWith(".base")||this.publisher.settings.useCanvas&&E.endsWith(".canvas"):!1),y=m.length,v=y.toString().length,b=0,k=await this.siteManager.getAllNoteContents();await Hg(m,async([E,_])=>{b++,e&&(e.setProgress(Math.floor(b/y*100)),e.setIndexText(`Syncing remote cache: ${b.toString().padStart(v)}/${y}`),e.setText(`Processing ${E}...`));let x=await this.publisher.datastore.loadRemoteHash(E);if(x&&x===_||!this.publisher.vault.getFileByPath(E))return;let S=k.get(E)??"";if(!S)return;let C=await this.publisher.datastore.getTime(E)??Date.now();await this.publisher.datastore.storeRemoteFile(E,C,[S,{blobs:[]}]),await this.publisher.datastore.storeRemoteHash(E,C,_)},10),e&&(e.setText("Syncing cache to disk..."),e.setProgress(0)),await this.publisher.datastore.flushCache(e)}e&&(e.setText("Loading published notes..."),e.setProgress(100));let f=await this.publisher.getFilesMarkedForPublishing();this.publisher.settings.useCache&&(await this.publisher.datastore.synchronize(f.notes.map(m=>m.getPath())),this.publisher.settings.syncCache&&await this.publisher.plugin.compareDataToCache()),e&&(e.setText("Compiling notes..."),e.setProgress(0));let d=f.notes.length,h=d.toString().length,g=0;try{await Hg(f.notes,async m=>{g++,e&&(e.setProgress(Math.floor(g/d*100)),e.setIndexText(`Compiling: ${g.toString().padStart(h)}/${d}`),e.setText(`Compiling ${m.getVaultPath()}...`));let y=await m.compile(),[v]=y.getCompiledFile(),b=await ol(v),k=l[m.getVaultPath()];k?k===b?(y.setRemoteHash(k),n.push(y)):(y.setRemoteHash(k),i.push(y)):r.push(y)},10)}finally{e&&(e.setText("Saving compiled cache to disk..."),e.setProgress(0)),await this.publisher.datastore.flushCache(e),this.publisher.datastore.clearMemoryCache()}return s.push(...this.generateDeletedContentPaths(l,f.notes.map(m=>m.getVaultPath()))),o.push(...this.generateDeletedContentPaths(c,f.blobs)),s.sort((m,y)=>m.path.localeCompare(y.path)),{unpublishedNotes:r,publishedNotes:n,changedNotes:i,deletedNotePaths:s,deletedBlobPaths:o}}};p();var ao=class{metadataCache;file;vault;fileManager;generatedFrontMatter={};constructor(e,r,n,i){this.metadataCache=r,this.vault=e,this.file=n,this.fileManager=i}set(e,r){return this.generatedFrontMatter[e]=r,this}remove(e){return this.generatedFrontMatter[e]=void 0,this}get(e){return this.getFrontMatterSnapshot()[e]}async apply(){let e=this.getFrontMatterSnapshot();await this.fileManager.processFrontMatter(this.file,r=>{for(let n of Object.keys(e))r[n]=e[n]})}getFrontMatterSnapshot(){let e={...this.metadataCache.getCache(this.file?.path)?.frontmatter};return delete e.position,{...e,...this.generatedFrontMatter}}};p();p();var pV="quartz.config.yaml",mV="quartz.plugins.json",gV="quartz.config.ts",yV="package.json",fi=class t{static async detectQuartzVersion(e){return await t.fileExists(e,pV)?"v5-yaml":await t.fileExists(e,mV)?"v5-json":await t.fileExists(e,gV)?"v4":"unknown"}static async getQuartzPackageVersion(e){try{let r=await e.getRawFile(yV);if(!r)return null;let n=w.from(r.content,"base64").toString("utf-8");return JSON.parse(n).version??null}catch{return null}}static async fileExists(e,r){try{return await e.getRawFile(r)!==void 0}catch{return!1}}};p();F_();var NO="quartz.config.yaml",FO="quartz.plugins.json",DO="quartz.lock.json",XV="yaml-language-server: $schema=./quartz/plugins/quartz-plugins.schema.json",xo=class{repo;yamlDocument=null;configFormat=null;constructor(e){this.repo=e}async readConfig(){let{content:e,format:r}=await this.readRawConfig();return this.configFormat=r,r==="json"?JSON.parse(e):(this.yamlDocument=zc(e,{keepSourceTokens:!0}),this.yamlDocument.toJSON())}serializeConfig(e){if(this.configFormat==="json")return JSON.stringify(e,null,2)+` `;if(this.yamlDocument)return this.yamlDocument.set("configuration",e.configuration),this.yamlDocument.set("plugins",e.plugins),e.layout?this.yamlDocument.set("layout",e.layout):this.yamlDocument.delete("layout"),this.ensureSchemaComment(this.yamlDocument),this.yamlDocument.toString();let r=new Cn(e);return this.ensureSchemaComment(r),r.toString()}async writeConfig(e,r="Update Quartz configuration via Syncer"){let n=this.serializeConfig(e),i=this.configFormat==="json"?FO:NO,s=new Map;s.set(i,n),await this.repo.writeRawFiles(s,r)}async readLockFile(){try{let e=await this.repo.getRawFile(DO);if(!e)return null;let r=w.from(e.content,"base64").toString("utf-8");return JSON.parse(r)}catch{return null}}async writeLockFile(e,r="Update plugin lock file via Syncer"){let n=JSON.stringify(e,null,2)+` `,i=new Map;i.set(DO,n),await this.repo.writeRawFiles(i,r)}getConfigFormat(){return this.configFormat}getRawYamlDocument(){return this.yamlDocument}async readRawConfig(){try{let e=await this.repo.getRawFile(NO);if(e)return{content:w.from(e.content,"base64").toString("utf-8"),format:"yaml"}}catch{}try{let e=await this.repo.getRawFile(FO);if(e)return{content:w.from(e.content,"base64").toString("utf-8"),format:"json"}}catch{}throw new Error("No Quartz v5 configuration file found. Expected quartz.config.yaml or quartz.plugins.json.")}ensureSchemaComment(e){e.toString().includes("yaml-language-server")||(e.commentBefore=XV)}};var wi=class{settings;metadataCache;baseSyncerConnection;userSyncerConnection;quartzVersion=null;configService=null;constructor(e,r,n){this.settings=r,this.metadataCache=e,this.baseSyncerConnection=new et({gitSettings:{remoteUrl:"https://github.com/jackyzha0/quartz.git",branch:"v4",auth:{type:"none"}},contentFolder:"content",vaultPath:"/"}),this.userSyncerConnection=new et({gitSettings:n,contentFolder:r.contentFolder,vaultPath:r.vaultPath})}async getNoteContent(e){e=rs(e);let r=await this.userSyncerConnection.getFile(`${this.settings.contentFolder}/${e}`);return r?w.from(r.content,"base64").toString("utf-8"):""}async getAllNoteContents(){let e=await this.userSyncerConnection.getAllBlobContents(this.settings.contentFolder),r=new Map,n=this.settings.contentFolder;for(let[i,s]of e){let o=i.replace(n,"");o=rs(o),r.set(o,s)}return r}extractHashesFromTree(e,r){let n=e.tree??[],i={};for(let s of n){if(typeof s.path!="string"||!s.path.startsWith(this.settings.contentFolder)||s.type!=="blob"||r&&!r(s.path))continue;let o=rs(s.path.replace(this.settings.contentFolder,""));i[o]=s.oid}return i}async getNoteHashes(e){return this.extractHashesFromTree(e,r=>r.endsWith(".md")||this.settings.useBases&&r.endsWith(".base")||this.settings.useCanvas&&r.endsWith(".canvas"))}async getBlobHashes(e){return this.extractHashesFromTree(e)}async getQuartzVersion(){return this.quartzVersion||(this.quartzVersion=await fi.detectQuartzVersion(this.userSyncerConnection)),this.quartzVersion}async getConfigService(){let e=await this.getQuartzVersion();return e!=="v5-yaml"&&e!=="v5-json"?null:(this.configService||(this.configService=new xo(this.userSyncerConnection)),this.configService)}isQuartzV5(){return this.quartzVersion==="v5-yaml"||this.quartzVersion==="v5-json"}};p();var QO=require("obsidian");p();var Dt=require("obsidian");p();var eg=require("obsidian"),Xm=class extends eg.AbstractInputSuggest{folders;inputEl;constructor(e,r){super(e,r),this.inputEl=r,this.folders=this.app.vault.getAllFolders(!0).map(n=>(0,eg.normalizePath)(n.path))}getSuggestions(e){let r=e.toLowerCase();return this.folders.filter(n=>n.toLowerCase().includes(r))}renderSuggestion(e,r){r.setText(e)}selectSuggestion(e){this.inputEl.value=e;let r=new Event("input");this.inputEl.dispatchEvent(r),this.close()}};p();var D_="quartz-syncer-git-token",Mc=class{secretStorage;cachedToken=null;constructor(e){this.secretStorage=e.secretStorage}getToken(){if(this.cachedToken!==null)return this.cachedToken;let e=this.secretStorage.getSecret(D_);return this.cachedToken=e,e}setToken(e){e&&(this.secretStorage.setSecret(D_,e),this.cachedToken=e)}clearToken(){this.secretStorage.setSecret(D_,""),this.cachedToken=null}hasToken(){let e=this.getToken();return e!==null&&e!==""}async migrateFromSettings(e,r){let n=e,i=n._pendingTokenMigration,s=typeof i=="string"&&i?i:this.getLegacyToken(n);if(!s)return!1;let o=this.getToken();return o&&o!==""?(this.clearLegacyToken(n)&&await r(),!1):(this.setToken(s),this.clearLegacyToken(n)&&await r(),!0)}getLegacyToken(e){let r=e.git;if(!r||typeof r!="object")return;let n=r.auth;if(!n||typeof n!="object")return;let i=n.secret;return typeof i=="string"&&i?i:void 0}clearLegacyToken(e){let r=!1;"_pendingTokenMigration"in e&&(delete e._pendingTokenMigration,r=!0);let n=e.git;if(n&&typeof n=="object"){let i=n.auth;i&&typeof i=="object"&&"secret"in i&&(i.secret=void 0,r=!0)}return r}listSecrets(){return this.secretStorage.listSecrets().filter(r=>r.startsWith("quartz-syncer-"))}};var tg=class extends Dt.SettingPage{app;plugin;readStatus="loading";writeStatus="loading";readStatusElement;writeStatusElement;remoteBranches=[];defaultBranch=null;branchSettingEl=null;branchesLoaded=!1;secretStorageService;constructor(e,r){super(),this.app=e,this.plugin=r,this.title="Git",this.secretStorageService=new Mc(e)}display(){this.containerEl.empty(),this.branchSettingEl=null,this.initializeGitHeader(),this.initializeRemoteUrlSetting(),this.initializeBranchSetting(),this.initializeProviderHintSetting(),this.initializeAuthTypeSetting(),this.initializeUsernameSetting(),this.initializeSecretSetting(),this.initializeCorsProxySetting(),this.initializeVaultFolderSetting()}hide(){this.debouncedUpdateConnectionStatus.cancel()}get settings(){return this.plugin.settings}async saveSettings(){await this.plugin.saveSettings()}initializeGitHeader(){let e=createDiv({cls:"quartz-syncer-git-status-container"}),r=e.createSpan({cls:"quartz-syncer-git-status-pill quartz-syncer-git-status-pending"});r.setText("Read: pending"),this.readStatusElement=r;let n=e.createSpan({cls:"quartz-syncer-git-status-pill quartz-syncer-git-status-pending"});n.setText("Write: pending"),this.writeStatusElement=n,this.checkConnectionAndSaveSettings(),new Dt.Setting(this.containerEl).setName("Git repository").setDesc("Configure your Git remote. Works with GitHub, GitLab, Bitbucket, and self-hosted Git servers.").setHeading().nameEl.append(e)}checkConnectionAndSaveSettings=async()=>{this.saveSettings(),this.debouncedUpdateConnectionStatus()};updateConnectionStatus=async()=>{if(!this.settings.gitRemoteUrl){this.readStatus="error",this.writeStatus="error",this.remoteBranches=[],this.defaultBranch=null,this.updateConnectionStatusIndicator();return}let e={type:this.settings.gitAuthType,username:this.settings.gitAuthUsername||void 0,secret:this.secretStorageService.getToken()||void 0};try{let{branches:r,defaultBranch:n}=await et.fetchRemoteBranches(this.settings.gitRemoteUrl,e,this.settings.gitCorsProxyUrl||void 0);this.remoteBranches=r,this.defaultBranch=n;let i=this.branchesLoaded;r.length>0?(this.readStatus="connected",this.branchesLoaded=!0,this.settings.gitBranch||(this.settings.gitBranch=n||"v4",await this.saveSettings()),i||this.refreshBranchSetting()):this.readStatus="error"}catch{this.readStatus="error",this.remoteBranches=[],this.defaultBranch=null}try{let r=await et.checkWriteAccess(this.settings.gitRemoteUrl,e,this.settings.gitCorsProxyUrl||void 0);this.writeStatus=r?"connected":"error"}catch{this.writeStatus="error"}this.updateConnectionStatusIndicator()};refreshBranchSetting(){this.branchSettingEl&&(this.branchSettingEl.empty(),this.initializeBranchSetting())}debouncedUpdateConnectionStatus=(0,Dt.debounce)(this.updateConnectionStatus,500,!0);updateConnectionStatusIndicator(){this.applyStatusToElement(this.readStatusElement,this.readStatus,"Read"),this.applyStatusToElement(this.writeStatusElement,this.writeStatus,"Write")}applyStatusToElement(e,r,n){e.removeClass("quartz-syncer-git-status-pending","quartz-syncer-git-status-success","quartz-syncer-git-status-failed"),r==="loading"?(e.setText(`${n}: pending`),e.addClass("quartz-syncer-git-status-pending")):r==="connected"?(e.setText(`${n}: connected`),e.addClass("quartz-syncer-git-status-success")):(e.setText(`${n}: failed`),e.addClass("quartz-syncer-git-status-failed"))}initializeRemoteUrlSetting(){new Dt.Setting(this.containerEl).setName("Remote URL").setDesc("The full URL of your Git repository (e.g., https://github.com/username/quartz.git)").addText(e=>e.setPlaceholder("https://github.com/username/quartz.git").setValue(this.settings.gitRemoteUrl).onChange(async r=>{this.settings.gitRemoteUrl=r,this.autoDetectProvider(r),await this.checkConnectionAndSaveSettings()}))}autoDetectProvider(e){let r="custom";try{let n=new URL(e).hostname.toLowerCase();n==="github.com"||n.endsWith(".github.com")?r="github":n==="gitlab.com"||n.endsWith(".gitlab.com")?r="gitlab":n==="bitbucket.org"||n.endsWith(".bitbucket.org")?r="bitbucket":n==="codeberg.org"&&(r="gitea")}catch{r="custom"}this.settings.gitProviderHint=r}initializeBranchSetting(){this.branchSettingEl||(this.branchSettingEl=this.containerEl.createDiv());let e=new Dt.Setting(this.branchSettingEl).setName("Branch").setDesc("The branch to sync with");this.remoteBranches.length>0?e.addDropdown(r=>{for(let i of this.remoteBranches){let s=i===this.defaultBranch?`${i} (default)`:i;r.addOption(i,s)}let n=this.settings.gitBranch;n&&this.remoteBranches.includes(n)?r.setValue(n):this.defaultBranch?(r.setValue(this.defaultBranch),this.settings.gitBranch=this.defaultBranch):this.remoteBranches.includes("v4")?(r.setValue("v4"),this.settings.gitBranch="v4"):this.remoteBranches.length>0&&(r.setValue(this.remoteBranches[0]),this.settings.gitBranch=this.remoteBranches[0]),r.onChange(async i=>{this.settings.gitBranch=i,await this.checkConnectionAndSaveSettings()})}):this.settings.gitRemoteUrl&&!this.branchesLoaded?e.addText(r=>r.setPlaceholder("Loading branches...").setValue(this.settings.gitBranch).setDisabled(!0)):e.addText(r=>r.setPlaceholder("v4").setValue(this.settings.gitBranch).onChange(async n=>{this.settings.gitBranch=n||"v4",await this.checkConnectionAndSaveSettings()}))}initializeProviderHintSetting(){new Dt.Setting(this.containerEl).setName("Provider").setDesc("Select your Git provider for optimized authentication hints").addDropdown(e=>e.addOption("github","GitHub").addOption("gitlab","GitLab").addOption("bitbucket","Bitbucket").addOption("gitea","Gitea / Codeberg").addOption("custom","Custom / Self-hosted").setValue(this.settings.gitProviderHint||"github").onChange(async r=>{this.settings.gitProviderHint=r,await this.checkConnectionAndSaveSettings()}))}initializeAuthTypeSetting(){new Dt.Setting(this.containerEl).setName("Authentication type").setDesc("How to authenticate with the Git server").addDropdown(e=>e.addOption("basic","Username & Token/Password").addOption("bearer","Bearer Token").addOption("none","None (public repos)").setValue(this.settings.gitAuthType).onChange(async r=>{this.settings.gitAuthType=r,await this.checkConnectionAndSaveSettings(),this.display()}))}initializeUsernameSetting(){if(this.settings.gitAuthType!=="basic")return;let e=this.settings.gitProviderHint,r="username",n="Your username for authentication";e==="gitlab"?(r="oauth2 or username",n="Use 'oauth2' for personal access tokens, or your username"):e==="bitbucket"&&(r="x-token-auth or username",n="Use 'x-token-auth' for app passwords, or your username"),new Dt.Setting(this.containerEl).setName("Username").setDesc(n).addText(i=>i.setPlaceholder(r).setValue(this.settings.gitAuthUsername||"").onChange(async s=>{this.settings.gitAuthUsername=s,await this.checkConnectionAndSaveSettings()}))}initializeSecretSetting(){if(this.settings.gitAuthType==="none")return;let e=this.settings.gitProviderHint,r="Access token",n="Your personal access token or password";e==="github"?n="A GitHub Personal Access Token (classic or fine-grained) with 'Contents' permission":e==="gitlab"?n="A GitLab Personal Access Token with 'read_repository' and 'write_repository' scopes":e==="bitbucket"&&(r="App password",n="A Bitbucket App Password with repository write access");let i=createFragment();i.createSpan({text:n+". "}),i.createEl("a",{text:"Documentation",href:"https://saberzero1.github.io/quartz-syncer-docs/Settings/Git/Access-Token"});let s=this.secretStorageService.hasToken(),l=new Dt.Setting(this.containerEl).setName(r).setDesc(i).controlEl.createDiv({cls:"quartz-syncer-token-container"}),c=l.createSpan({cls:`quartz-syncer-token-status ${s?"quartz-syncer-token-status-set":"quartz-syncer-token-status-unset"}`});c.setText(s?"Token stored securely":"No token set");let u=l.createDiv({cls:"quartz-syncer-token-input-container"}),f=u.createEl("input",{type:"password",cls:"quartz-syncer-token-input",placeholder:s?"Enter new token to replace":"Enter token"}),d=u.createEl("button",{cls:"quartz-syncer-token-toggle clickable-icon",attr:{"aria-label":"Toggle token visibility"}});(0,Dt.setIcon)(d,"eye");let h=!1;d.addEventListener("click",v=>{v.preventDefault(),h=!h,f.type=h?"text":"password",(0,Dt.setIcon)(d,h?"eye-off":"eye")});let g=l.createDiv({cls:"quartz-syncer-token-buttons"}),m=g.createEl("button",{cls:"mod-cta",text:s?"Update":"Save"}),y=async()=>{let v=f.value.trim();v&&(this.secretStorageService.setToken(v),f.value="",f.placeholder="Enter new token to replace",c.setText("Token stored securely"),c.removeClass("quartz-syncer-token-status-unset"),c.addClass("quartz-syncer-token-status-set"),m.setText("Update"),await this.checkConnectionAndSaveSettings())};if(m.addEventListener("click",()=>{y()}),s){let v=g.createEl("button",{cls:"mod-warning",text:"Clear"}),b=async()=>{this.secretStorageService.clearToken(),f.value="",f.placeholder="Enter token",c.setText("No token set"),c.removeClass("quartz-syncer-token-status-set"),c.addClass("quartz-syncer-token-status-unset"),m.setText("Save"),v.remove(),await this.checkConnectionAndSaveSettings()};v.addEventListener("click",()=>{b()})}}initializeCorsProxySetting(){let e=createFragment();e.createSpan({text:"A CORS proxy URL for browser environments. Required on mobile/web if your Git server doesn't support CORS. "}),e.createEl("a",{text:"Learn more",href:"https://github.com/isomorphic-git/cors-proxy"}),new Dt.Setting(this.containerEl).setName("CORS proxy (optional)").setDesc(e).addText(r=>r.setPlaceholder("https://cors.isomorphic-git.org").setValue(this.settings.gitCorsProxyUrl||"").onChange(async n=>{this.settings.gitCorsProxyUrl=n,await this.checkConnectionAndSaveSettings()}))}initializeVaultFolderSetting(){new Dt.Setting(this.containerEl).setName("Vault root folder").setDesc('The folder in your Obsidian vault to sync. Use "/" for the entire vault.').addSearch(e=>{new Xm(this.app,e.inputEl),e.setPlaceholder("/").setValue(this.settings.vaultPath).onChange(async r=>{r=(0,Dt.normalizePath)(r.trim()),r==="/"&&(r=""),this.settings.vaultPath=`${r}/`,await this.checkConnectionAndSaveSettings()})})}};p();var G=require("obsidian");p();function Lc(t){return typeof t=="object"&&t!==null&&"repo"in t&&typeof t.repo=="string"}function yr(t){return Lc(t)?t.name?t.name:zO(t.repo):zO(t)}function Pr(t){if(Lc(t)){let e=rg(t.repo);return t.subdir?`${e}::${t.subdir}`:e}return rg(t)}function ko(t){let e=Lc(t)?t.repo:t,r=rg(e);return r.startsWith("github:")?`https://github.com/${r.slice(7)}.git`:r.startsWith("git+")?r.slice(4):r}function ng(t){if(Lc(t))return t.ref;let e=t.indexOf("#");return e!==-1?t.slice(e+1):void 0}function rg(t){let e=t.indexOf("#");return e!==-1?t.slice(0,e):t}function zO(t){let e=rg(t);if(e.startsWith("github:")){let n=e.slice(7),i=n.split("/");return i[i.length-1]||n}if(e.includes("://"))try{let i=new URL(e.replace(/^git\+/,"")).pathname.replace(/\.git$/,""),s=i.split("/").filter(Boolean);return s[s.length-1]||i}catch{}let r=e.split("/").filter(Boolean);return r[r.length-1]||e}p();var ig=50,qa=class{addPlugin(e,r,n){let i=Pr(r);if(e.plugins.find(a=>Pr(a.source)===i))throw new Error(`Plugin "${i}" is already in the configuration.`);let o={source:r,enabled:n?.enabled??!0,order:n?.order??ig,options:n?.options??{}};return e.plugins.push(o),o}removePlugin(e,r){let n=e.plugins.findIndex(s=>Pr(s.source)===r);if(n===-1)throw new Error(`Plugin "${r}" not found in the configuration.`);let[i]=e.plugins.splice(n,1);return i}findPlugin(e,r){return e.plugins.find(n=>Pr(n.source)===r)}};p();var So=class{auth;corsProxyUrl;constructor(e,r){this.auth=e,this.corsProxyUrl=r}async checkUpdates(e,r){let n=r?.plugins??{},i=e.map(s=>this.checkSinglePlugin(s,n));return Promise.all(i)}async checkSinglePlugin(e,r){let n=yr(e.source),s=r[n]?.commit??null;if(!s)return{name:n,sourceKey:n,lockedCommit:null,remoteCommit:null,hasUpdate:!1};try{let o=ko(e.source),a=ng(e.source)??void 0,l=await et.fetchRemoteHeadCommit(o,this.auth,a,this.corsProxyUrl);return l?{name:n,sourceKey:n,lockedCommit:s,remoteCommit:l,hasUpdate:l!==s}:{name:n,sourceKey:n,lockedCommit:s,remoteCommit:null,hasUpdate:!1,error:"Could not reach remote"}}catch(o){let a=o instanceof Error?o.message:String(o);return{name:n,sourceKey:n,lockedCommit:s,remoteCommit:null,hasUpdate:!1,error:a}}}};p();var MO=require("obsidian"),eH="https://raw.githubusercontent.com/jackyzha0/quartz/v5/package.json",Bc="https://github.com/jackyzha0/quartz.git",Uc="v5",z_={type:"none"},vd=class{userRepo;constructor(e){this.userRepo=e}async checkForUpgrade(){let e=null;try{e=await fi.getQuartzPackageVersion(this.userRepo)}catch{}let r=null;try{r=await this.fetchUpstreamVersion()}catch(o){let a=o instanceof Error?o.message:String(o);return{currentVersion:e,upstreamVersion:null,hasUpgrade:!1,latestUpstreamSha:null,hasNewerCommits:!1,error:`Could not reach upstream Quartz: ${a}`}}if(!r)return{currentVersion:e,upstreamVersion:null,hasUpgrade:!1,latestUpstreamSha:null,hasNewerCommits:!1,error:"Could not determine upstream Quartz version"};let n=e!==null&&r!==e,i=null;try{i=await et.fetchRemoteHeadCommit(Bc,z_,Uc)}catch{}let s=!1;return i&&(s=!await this.userRepo.hasCommitInHistory(i)),{currentVersion:e,upstreamVersion:r,hasUpgrade:n,latestUpstreamSha:i,hasNewerCommits:s}}async performUpgrade(){try{let e=await this.userRepo.upgradeFromUpstream(Bc,Uc);return e.alreadyMerged?{success:!0,alreadyMerged:!0,oid:e.oid}:{success:!0,oid:e.oid,alreadyMerged:!1}}catch(e){let r=e instanceof Error?e.message:String(e);return r.includes("Merge conflicts in:")||r.includes("Cannot auto-upgrade:")||r.includes("MergeNotSupportedError")||r.includes("MergeConflictError")||r.includes("Merges with conflicts")?{success:!1,error:`${r}. No changes were made. Run \`npx quartz upgrade\` manually to resolve conflicts.`}:{success:!1,error:`Upgrade failed: ${r}`}}}async fetchUpstreamVersion(){let e=await(0,MO.requestUrl)({url:eH});return e.status<200||e.status>=300?null:e.json.version??null}};p();var LO="quartz/cli/templates",tH=["default","full-width","minimal"],sg=class{repo;constructor(e){this.repo=e}async listTemplateNames(){return(await this.repo.listDirectory(LO)).filter(r=>r.type==="tree").map(r=>r.name)}async readTemplate(e){let r=`${LO}/${e}/quartz.config.yaml`;try{let n=await this.repo.getRawFile(r);if(!n)return null;let{parseDocument:i}=await Promise.resolve().then(()=>(F_(),OO)),s=w.from(n.content,"base64").toString("utf-8"),a=i(s,{keepSourceTokens:!0}).toJSON();return{name:e,config:a}}catch{return null}}async getAvailableFrameNames(){let e=await this.listTemplateNames(),r=new Set(tH);for(let n of e)r.add(n);return[...r].sort()}applyTemplate(e,r){e.configuration={...r.config.configuration},e.plugins=[...r.config.plugins],e.layout=r.config.layout?{...r.config.layout}:void 0}};p();var og=class{auth;corsProxyUrl;cache=new Map;constructor(e,r){this.auth=e,this.corsProxyUrl=r}async fetchManifest(e){let r=typeof e=="string"?e:JSON.stringify(e);if(this.cache.has(r))return this.cache.get(r)??null;let n=ko(e),i=Lc(e)?e.subdir:void 0;try{let s=ng(e);if(!s){let{defaultBranch:l}=await et.fetchRemoteBranches(n,this.auth,this.corsProxyUrl);s=l??"main"}let o=await this.fetchManifestFromRef(n,s,r,i);if(o!==void 0)return o;let{defaultBranch:a}=await et.fetchRemoteBranches(n,this.auth,this.corsProxyUrl);if(a&&a!==s){let l=await this.fetchManifestFromRef(n,a,r,i);if(l!==void 0)return l}return this.cache.set(r,null),null}catch{return this.cache.set(r,null),null}}async fetchManifestFromRef(e,r,n,i){try{let s=new et({gitSettings:{remoteUrl:e,branch:r,auth:this.auth,corsProxyUrl:this.corsProxyUrl},contentFolder:"content",vaultPath:"/"}),o=i?`${i}/package.json`:"package.json",a=await s.getRawFile(o);if(!a)return this.cache.set(n,null),null;let l=w.from(a.content,"base64").toString("utf-8"),u=JSON.parse(l).quartz??null;return this.cache.set(n,u),u}catch{return}}clearCache(){this.cache.clear()}};p();var BO=require("obsidian"),rH="https://raw.githubusercontent.com/quartz-community/registry/main/registry.json",jc=class{cache=null;fetchPromise=null;async getPlugins(){if(this.cache)return this.cache;if(this.fetchPromise)return this.fetchPromise;this.fetchPromise=this.fetchRegistry();try{let e=await this.fetchPromise;return this.cache=e,e}finally{this.fetchPromise=null}}clearCache(){this.cache=null}async fetchRegistry(){try{let e=await(0,BO.requestUrl)({url:rH});return e.status<200||e.status>=300?[]:e.json.plugins??[]}catch{return[]}}};p();var bd=require("obsidian");var ag=class extends bd.Modal{registry;config;onInstall;allPlugins=[];searchQuery="";selectedTag="";isLoading=!1;installingPlugins=new Set;constructor(e,r,n,i){super(e),this.registry=r,this.config=n,this.onInstall=i}async onOpen(){this.modalEl.addClass("quartz-syncer-plugin-browser"),this.titleEl.setText("Community Plugin Browser"),this.loadAndRender()}onClose(){this.contentEl.empty()}async loadAndRender(){this.isLoading=!0,this.render();try{this.allPlugins=await this.registry.getPlugins()}catch{this.allPlugins=[]}this.isLoading=!1,this.render()}render(){if(this.contentEl.empty(),this.isLoading){this.contentEl.createEl("p",{text:"Loading plugin registry...",cls:"quartz-syncer-plugin-browser-loading"});return}if(this.allPlugins.length===0){this.contentEl.createEl("p",{text:"Could not load the plugin registry. Check your internet connection and try again."});return}this.renderControls();let e=this.getFilteredPlugins(),r=this.contentEl.createDiv("quartz-syncer-plugin-browser-list");if(e.length===0){r.createEl("p",{text:"No plugins match your search.",cls:"quartz-syncer-plugin-browser-empty"});return}for(let n of e)this.renderPluginCard(r,n)}renderControls(){let e=this.contentEl.createDiv("quartz-syncer-plugin-browser-controls"),r=e.createEl("input",{type:"text",placeholder:"Search plugins...",cls:"quartz-syncer-plugin-browser-search"});r.value=this.searchQuery,r.addEventListener("input",()=>{this.searchQuery=r.value,this.renderList()});let n=this.getAllTags();if(n.length>0){let i=e.createEl("select",{cls:"quartz-syncer-plugin-browser-tag-filter"});i.createEl("option",{text:"All categories",value:""});for(let s of n)i.createEl("option",{text:s,value:s});i.value=this.selectedTag,i.addEventListener("change",()=>{this.selectedTag=i.value,this.renderList()})}}renderList(){let e=this.contentEl.querySelector(".quartz-syncer-plugin-browser-list");e&&e.remove();let r=this.getFilteredPlugins(),n=this.contentEl.createDiv("quartz-syncer-plugin-browser-list");if(r.length===0){n.createEl("p",{text:"No plugins match your search.",cls:"quartz-syncer-plugin-browser-empty"});return}for(let i of r)this.renderPluginCard(n,i)}renderPluginCard(e,r){let n=this.isPluginInstalled(r),i=this.installingPlugins.has(r.name),s=e.createDiv("quartz-syncer-plugin-browser-card"),o=s.createDiv("quartz-syncer-plugin-browser-card-header");o.createSpan({text:r.name,cls:"quartz-syncer-plugin-browser-card-name"}),r.official&&o.createSpan({text:"official",cls:"quartz-syncer-plugin-browser-badge-official"}),s.createEl("p",{text:r.description,cls:"quartz-syncer-plugin-browser-card-desc"});let a=s.createDiv("quartz-syncer-plugin-browser-card-footer"),l=a.createDiv("quartz-syncer-plugin-browser-card-tags");for(let c of r.tags)l.createSpan({text:c,cls:"quartz-syncer-plugin-browser-tag"});if(n)a.createSpan({text:"Installed",cls:"quartz-syncer-plugin-browser-installed"});else{let c=a.createEl("button",{text:i?"Installing...":"Install",cls:"quartz-syncer-plugin-browser-install-btn"});i&&(c.disabled=!0),c.addEventListener("click",()=>{this.handleInstall(r,c)})}}async handleInstall(e,r){if(!this.installingPlugins.has(e.name)){this.installingPlugins.add(e.name),r.textContent="Installing...",r.disabled=!0;try{await this.onInstall(e.source),new bd.Notice(`Plugin "${e.name}" installed successfully.`),this.render()}catch(n){let i=n instanceof Error?n.message:String(n);new bd.Notice(`Failed to install "${e.name}": ${i}`),r.textContent="Install",r.disabled=!1}finally{this.installingPlugins.delete(e.name)}}}isPluginInstalled(e){let r=Pr(e.source);return this.config.plugins.some(n=>Pr(n.source)===r)}getFilteredPlugins(){let e=this.searchQuery.toLowerCase().trim();return this.allPlugins.filter(r=>this.selectedTag&&!r.tags.includes(this.selectedTag)?!1:e?r.name.toLowerCase().includes(e)||r.description.toLowerCase().includes(e)||r.tags.some(n=>n.toLowerCase().includes(e)):!0)}getAllTags(){let e=new Set;for(let r of this.allPlugins)for(let n of r.tags)e.add(n);return[...e].sort()}};p();var lg=require("obsidian"),Va=class extends lg.Modal{constructor(r,n,i,s="Confirm"){super(r);this.title=n;this.message=i;this.confirmLabel=s}resolved=!1;resolve=()=>{};onOpen(){this.titleEl.setText(this.title),this.contentEl.createEl("p",{text:this.message}),new lg.Setting(this.contentEl).addButton(r=>r.setButtonText(this.confirmLabel).setDestructive().onClick(()=>{this.resolved=!0,this.resolve(!0),this.close()})).addButton(r=>r.setButtonText("Cancel").onClick(()=>{this.close()}))}onClose(){this.resolved||this.resolve(!1)}await(){return new Promise(r=>{this.resolve=r,this.open()})}};p();var Tn=require("obsidian");function qc(t){return t==null?"":typeof t=="object"?JSON.stringify(t):`${t}`}var nH=["left","right","beforeBody","afterBody","body"],iH=["all","mobile-only","desktop-only"],cg=class extends Tn.Modal{ctx;constructor(e,r){super(e),this.ctx=r}async onOpen(){let e=yr(this.ctx.plugin.source);if(this.modalEl.addClass("quartz-syncer-plugin-options-modal"),this.titleEl.setText(e),!this.ctx.manifest&&this.ctx.manifestService){let r=await this.ctx.manifestService.fetchManifest(this.ctx.plugin.source);this.ctx.manifest=r}this.render()}onClose(){this.contentEl.empty()}render(){this.contentEl.empty(),this.renderActions(),this.renderOptions(),this.ctx.plugin.layout&&this.renderLayoutControls()}renderActions(){let{plugin:e,index:r,total:n,updateStatus:i}=this.ctx,s=yr(e.source);new Tn.Setting(this.contentEl).setName("Actions").setHeading().addToggle(l=>l.setTooltip("Enable or disable this plugin").setValue(e.enabled).onChange(c=>{e.enabled=c,this.ctx.onDirty()}));let a=new Tn.Setting(this.contentEl);if(a.addButton(l=>l.setButtonText("Move up").setDisabled(r===0).onClick(()=>{this.ctx.onMovePlugin(r,r-1),this.close()})),a.addButton(l=>l.setButtonText("Move down").setDisabled(r===n-1).onClick(()=>{this.ctx.onMovePlugin(r,r+1),this.close()})),i?.hasUpdate&&i.remoteCommit){let l=i.remoteCommit;a.addButton(c=>c.setButtonText(`Update to ${l.slice(0,7)}`).onClick(async()=>{await this.ctx.onUpdatePlugin(s,l),this.close()}))}a.addButton(l=>l.setButtonText("Remove").setDestructive().onClick(async()=>{if(!await new Va(this.app,"Remove plugin",`Remove plugin "${s}"?`,"Remove").await())return;let u=Pr(e.source);this.ctx.onRemovePlugin(u),this.close()}))}renderOptions(){let{plugin:e}=this.ctx;e.options||(e.options={}),new Tn.Setting(this.contentEl).setName("Options").setHeading();let r=this.ctx.manifest,n=r?.optionSchema??r?.configSchema??null,i=new Set([...Object.keys(e.options),...n?Object.keys(n):[]]);i.size===0&&new Tn.Setting(this.contentEl).setDesc(r?"This plugin has no configurable options.":"No manifest available. You can still add options manually.");for(let o of i)this.renderOptionField(e,o,n);let s="";new Tn.Setting(this.contentEl).setDesc("Add a custom option key.").addText(o=>o.setPlaceholder("optionKey").onChange(a=>{s=a})).addButton(o=>o.setButtonText("Add option").onClick(()=>{if(!(!s.trim()||!e.options)){if(e.options[s.trim()]!==void 0){new Tn.Notice(`Option "${s.trim()}" already exists.`);return}e.options[s.trim()]="",this.ctx.onDirty(),this.render()}}))}renderOptionField(e,r,n){let i=e.options[r],s=n?.[r],o=s?.title??r,a=s?.description??"",l=s?.type,c=s?.default,u=this.resolveEffectiveType(i,l),f=new Tn.Setting(this.contentEl).setName(o).setDesc(a);switch(u){case"boolean":this.renderBooleanOption(f,e,r,c);break;case"number":case"integer":this.renderNumberOption(f,e,r,s,u==="integer");break;case"array":this.renderArrayOption(f,e,r,s);break;case"object":this.renderJsonOption(f,e,r);break;default:this.renderStringOption(f,e,r,s);break}}resolveEffectiveType(e,r){return r||(typeof e=="boolean"?"boolean":typeof e=="number"?"number":Array.isArray(e)?"array":e!=null&&typeof e=="object"?"object":"string")}renderBooleanOption(e,r,n,i){let s=r.options[n],o=typeof s=="boolean"?s:typeof i=="boolean"?i:!1;e.addToggle(a=>a.setValue(o).onChange(l=>{r.options[n]=l,this.ctx.onDirty()}))}renderNumberOption(e,r,n,i,s){let o=r.options[n];e.addText(a=>a.setValue(o!==void 0?qc(o):i?.default!==void 0?qc(i.default):"").setPlaceholder(i?.default!==void 0?qc(i.default):s?"0":"0.0").onChange(l=>{let c=l.trim();if(!c){r.options[n]=void 0,this.ctx.onDirty(),e.setErrorMessage(null);return}let u=s?parseInt(c,10):parseFloat(c);if(isNaN(u)){e.setErrorMessage(s?"Must be a whole number.":"Must be a number.");return}let f=i?.minimum,d=i?.maximum;if(f!==void 0&&ud){e.setErrorMessage(`Maximum value is ${d}.`);return}e.setErrorMessage(null),r.options[n]=u,this.ctx.onDirty()}))}renderArrayOption(e,r,n,i){let s=r.options[n],o=Array.isArray(s)?s:[],a=i?.items?.type;!a||a==="string"?e.addText(c=>c.setValue(o.join(", ")).setPlaceholder(i?.default!==void 0?i.default.join(", "):"item1, item2, item3").onChange(u=>{let f=u.split(",").map(d=>d.trim()).filter(d=>d.length>0);r.options[n]=f.length>0?f:void 0,e.setErrorMessage(null),this.ctx.onDirty()})):this.renderJsonOption(e,r,n)}renderJsonOption(e,r,n){let i=r.options[n],s=i!==void 0?JSON.stringify(i,null,2):"";e.addTextArea(o=>o.setValue(s).setPlaceholder("{}").onChange(a=>{let l=a.trim();if(!l){r.options[n]=void 0,e.setErrorMessage(null),this.ctx.onDirty();return}try{r.options[n]=JSON.parse(l),e.setErrorMessage(null),this.ctx.onDirty()}catch{e.setErrorMessage("Invalid JSON.")}}))}renderStringOption(e,r,n,i){let s=r.options[n],o=i?.enum;if(o&&o.length>0){e.addDropdown(a=>{a.addOption("","\u2014 Select \u2014");for(let l of o)a.addOption(l,l);a.setValue(typeof s=="string"?s:"").onChange(l=>{r.options[n]=l||void 0,this.ctx.onDirty()})});return}e.addText(a=>a.setValue(s!==void 0?qc(s):"").setPlaceholder(i?.default!==void 0?qc(i.default):"").onChange(l=>{let c=i?.pattern;if(c&&l.trim())try{if(!new RegExp(c).test(l)){e.setErrorMessage(`Must match pattern: ${c}`);return}}catch{}let u=i?.maxLength;if(u!==void 0&&l.length>u){e.setErrorMessage(`Maximum length is ${u}.`);return}e.setErrorMessage(null),r.options[n]=l||void 0,this.ctx.onDirty()}))}renderLayoutControls(){let{plugin:e}=this.ctx;if(!e.layout)return;let r=e.layout;new Tn.Setting(this.contentEl).setName("Layout").setHeading();let n=new Tn.Setting(this.contentEl).setDesc("Position, priority, and display mode for this plugin's component.");n.addDropdown(i=>{i.addOption("","No position");for(let s of nH)i.addOption(s,s);i.setValue(r.position??"").onChange(s=>{r.position=s||void 0,this.ctx.onDirty()})}),n.addText(i=>i.setPlaceholder("Priority").setValue(r.priority!==void 0?qc(r.priority):"").onChange(s=>{let o=parseInt(s,10);r.priority=isNaN(o)?void 0:o,this.ctx.onDirty()})),n.addDropdown(i=>{for(let s of iH)i.addOption(s,s);i.setValue(r.display??"all").onChange(s=>{r.display=s,this.ctx.onDirty()})})}};var sH={light:"#faf8f8",lightgray:"#e5e5e5",gray:"#b8b8b8",darkgray:"#4e4e4e",dark:"#2b2b2b",secondary:"#284b63",tertiary:"#84a59d",highlight:"rgba(143, 159, 169, 0.15)",textHighlight:"#fff23688"},oH={light:"#161618",lightgray:"#393639",gray:"#646464",darkgray:"#d4d4d4",dark:"#ebebec",secondary:"#7b97aa",tertiary:"#84a59d",highlight:"rgba(143, 159, 169, 0.15)",textHighlight:"#fff23688"},aH=["content","folder","tag","canvas","bases","404"],ug=class extends G.SettingPage{app;plugin;siteManager=null;configService=null;cachedConfig=null;cachedLockFile=null;cachedVersion=null;cachedPackageVersion=null;cachedUpdateStatuses=null;cachedUpgradeStatus=null;cachedTemplateNames=[];cachedTemplates=new Map;templateService=null;manifestService=null;cachedManifests=new Map;collapsedSections=new Set;pluginRegistry=new jc;cachedThemesJson=null;searchQuery="";searchableSettings=[];searchResultsEl=null;noResultsEl=null;saveButtonEl=null;isLoading=!1;isSaving=!1;isCheckingUpdates=!1;isCheckingUpgrade=!1;isUpgrading=!1;isDirty=!1;pluginManager=new qa;constructor(e,r){super(),this.app=e,this.plugin=r,this.title="Quartz"}display(){this.containerEl.empty(),this.searchableSettings=[],this.searchResultsEl=null,this.noResultsEl=null,this.saveButtonEl=null,this.renderQuartzHeader(),this.renderContentFolderSetting(),this.renderSearchBar(),this.cachedConfig?(this.renderV5Content(),this.applySearchFilter(this.searchQuery)):(this.renderLoading(),this.loadV5Data())}hide(){this.isLoading=!1,this.isSaving=!1,this.isCheckingUpdates=!1,this.isCheckingUpgrade=!1,this.isUpgrading=!1,this.isDirty=!1}renderQuartzHeader(){new G.Setting(this.containerEl).setName("Quartz").setDesc("Quartz Syncer will apply these settings to your Quartz notes.").setHeading()}renderContentFolderSetting(){let e=this.containerEl.createDiv();new G.Setting(e).setName("Content folder").setDesc('The folder in your Quartz repository where Quartz Syncer should store your notes. By default "content".').addText(r=>r.setPlaceholder("content").setValue(this.plugin.settings.contentFolder).onChange(async n=>{this.plugin.settings.contentFolder=(0,G.normalizePath)(n),await this.plugin.saveSettings()})),this.registerSearchable(e,"Content folder",'The folder in your Quartz repository where Quartz Syncer should store your notes. By default "content".')}renderSearchBar(){let e=new G.Setting(this.containerEl);e.settingEl.addClass("quartz-syncer-v5-search-bar"),this.searchResultsEl=e.nameEl.createSpan({cls:"quartz-syncer-v5-search-results"}),e.addSearch(r=>{r.setPlaceholder("Filter settings...").setValue(this.searchQuery).onChange(n=>{this.searchQuery=n,this.applySearchFilter(n)})})}renderLoading(){new G.Setting(this.containerEl).setName("v5 Configuration").setDesc("Loading configuration from repository...")}renderNonV5Message(){new G.Setting(this.containerEl).setName("Quartz v5 not detected").setDesc("Your Quartz site uses the v4 configuration format. Run `npx quartz migrate` in your repository to enable plugin management from Obsidian.")}renderError(e){new G.Setting(this.containerEl).setName("Error").setDesc(e).addButton(r=>r.setButtonText("Retry").onClick(()=>{this.resetCache(),this.display()}))}renderCollapsibleHeading(e,r){let n=this.containerEl.createDiv({cls:"quartz-syncer-v5-section"});n.dataset.sectionHeading="true",n.dataset.sectionName=e;let i=this.collapsedSections.has(e)&&!this.searchQuery.trim(),s=new G.Setting(n).setName(e).setDesc(r).setHeading(),o=s.nameEl.createSpan({cls:`quartz-syncer-v5-section-chevron ${i?"":"quartz-syncer-v5-section-chevron-open"}`});return(0,G.setIcon)(o,"chevron-right"),s.settingEl.addClass("quartz-syncer-v5-section-heading"),s.settingEl.addEventListener("click",a=>{a.target.closest("button, input, select, .checkbox-container")||(this.collapsedSections.has(e)?this.collapsedSections.delete(e):this.collapsedSections.add(e),this.display())}),this.registerSearchable(n,e,r),n}renderSectionContent(e){return this.collapsedSections.has(e)&&!this.searchQuery.trim()?null:this.containerEl.createDiv({cls:"quartz-syncer-v5-section-content"})}registerSearchable(e,r,n){this.searchableSettings.push({containerEl:e,name:r.toLowerCase(),description:n.toLowerCase()})}applySearchFilter(e){let r=e.toLowerCase().trim(),n=0;for(let i of this.searchableSettings)i.containerEl.dataset.sectionHeading!=="true"&&(!r||i.name.includes(r)||i.description.includes(r)?(i.containerEl.removeClass("quartz-syncer-hidden"),n++):i.containerEl.addClass("quartz-syncer-hidden"));this.searchResultsEl&&(r?this.searchResultsEl.setText(`${n} result${n!==1?"s":""}`):this.searchResultsEl.setText("")),r&&n===0?(this.noResultsEl||(this.noResultsEl=this.containerEl.createDiv({cls:"quartz-syncer-v5-no-results",text:"No settings match your search."})),this.noResultsEl.removeClass("quartz-syncer-hidden")):this.noResultsEl&&this.noResultsEl.addClass("quartz-syncer-hidden"),this.updateSectionHeadingVisibility(r)}updateSectionHeadingVisibility(e){let r=Array.from(this.containerEl.querySelectorAll("[data-section-heading='true']"));for(let n of r){if(!e){n.removeClass("quartz-syncer-hidden");let o=n.nextElementSibling;o?.hasClass("quartz-syncer-v5-section-content")&&o.removeClass("quartz-syncer-hidden");continue}let i=n.nextElementSibling,s=!1;for(;i&&i.dataset.sectionHeading!=="true";){if(i.hasClass("quartz-syncer-v5-section-content")){if(s=Array.from(i.children).some(a=>!a.hasClass("quartz-syncer-hidden")),s)break}else if(!i.hasClass("quartz-syncer-hidden")){s=!0;break}i=i.nextElementSibling}if(s){n.removeClass("quartz-syncer-hidden");let o=n.nextElementSibling;o?.hasClass("quartz-syncer-v5-section-content")&&o.removeClass("quartz-syncer-hidden")}else{n.addClass("quartz-syncer-hidden");let o=n.nextElementSibling;o?.hasClass("quartz-syncer-v5-section-content")&&o.addClass("quartz-syncer-hidden")}}}async loadV5Data(){if(!this.isLoading){this.isLoading=!0;try{let e=this.getOrCreateSiteManager(),r=await e.getQuartzVersion();if(this.cachedVersion=r,r!=="v5-yaml"&&r!=="v5-json"){this.renderNonV5Message(),this.isLoading=!1;return}if(this.configService=await e.getConfigService(),!this.configService){this.renderError("Could not initialize config service for this repository."),this.isLoading=!1;return}this.templateService=new sg(e.userSyncerConnection);let n=this.plugin.getGitSettingsWithSecret();this.manifestService=new og(n.auth,n.corsProxyUrl);let[i,s,o,a]=await Promise.all([this.configService.readConfig(),this.configService.readLockFile(),this.loadPackageVersion(e),this.templateService.listTemplateNames()]);this.cachedConfig=i,this.cachedLockFile=s,this.cachedPackageVersion=o,this.cachedTemplateNames=a,this.display(),this.plugin.settings.upgradeCheckStrategy==="commit"&&!this.plugin.settings.lastUpstreamCommitSha&&this.checkForQuartzUpgrade()}catch(e){let r=e instanceof Error?e.message:String(e);this.renderError(r)}finally{this.isLoading=!1}}}async loadPackageVersion(e){try{return await fi.getQuartzPackageVersion(e.userSyncerConnection)}catch{return null}}getOrCreateSiteManager(){return this.siteManager||(this.siteManager=new wi(this.app.metadataCache,this.plugin.settings,this.plugin.getGitSettingsWithSecret())),this.siteManager}resetCache(){this.cachedConfig=null,this.cachedLockFile=null,this.cachedVersion=null,this.cachedPackageVersion=null,this.cachedUpdateStatuses=null,this.cachedUpgradeStatus=null,this.cachedTemplateNames=[],this.cachedTemplates=new Map,this.cachedManifests=new Map,this.templateService=null,this.manifestService=null,this.configService=null,this.siteManager=null,this.isDirty=!1}markDirty(){this.isDirty=!0,this.saveButtonEl&&(this.saveButtonEl.textContent="Save*")}async saveConfig(){if(!(!this.cachedConfig||!this.configService||this.isSaving)){this.isSaving=!0;try{await this.configService.writeConfig(this.cachedConfig),new G.Notice("Quartz configuration saved and pushed."),this.isDirty=!1,this.display()}catch(e){let r=e instanceof Error?e.message:String(e);new G.Notice(`Failed to save configuration: ${r}`)}finally{this.isSaving=!1}}}renderV5Content(){this.renderVersionSection(),this.renderUpgradeSection(),this.renderTemplateSection(),this.renderSiteConfigSection(),this.renderPluginListSection(),this.renderLayoutSection(),this.renderStickyActionBar()}renderVersionSection(){this.renderCollapsibleHeading("Quartz v5 configuration","Edit your Quartz v5 site configuration. Changes are pushed to your repository on save.");let e=this.renderSectionContent("Quartz v5 configuration");if(!e)return;let r=this.cachedPackageVersion?`${this.cachedPackageVersion} (${this.cachedVersion})`:this.cachedVersion??"unknown",n=e.createDiv();new G.Setting(n).setName("Quartz version").setDesc(r),this.registerSearchable(n,"Quartz version",r);let i=this.cachedVersion==="v5-yaml"?"YAML":"JSON",s=e.createDiv();new G.Setting(s).setName("Configuration format").setDesc(i),this.registerSearchable(s,"Configuration format",i)}renderStickyActionBar(){let e=this.containerEl.createDiv({cls:"quartz-syncer-v5-action-bar"}),r=new G.Setting(e);this.isDirty&&r.setDesc("You have unsaved changes."),r.addButton(n=>n.setButtonText(this.isDirty?"Save*":"Save").setCta().setDisabled(this.isSaving).onClick(async()=>{await this.saveConfig(),this.isDirty=!1,this.display()})),this.saveButtonEl=r.controlEl.querySelector("button"),r.addButton(n=>n.setButtonText("Refresh").setDisabled(this.isLoading).onClick(()=>{this.resetCache(),this.isDirty=!1,this.display()}))}renderUpgradeSection(){this.renderCollapsibleHeading("Quartz updates","");let e=this.renderSectionContent("Quartz updates");if(!e)return;let r=e.createDiv(),n=new G.Setting(r).setName("Check for Quartz updates").setDesc("");this.registerSearchable(r,"Check for Quartz updates",""),n.addButton(o=>o.setButtonText(this.isCheckingUpgrade?"Checking...":"Check for Quartz updates").setDisabled(this.isCheckingUpgrade).onClick(async()=>{await this.checkForQuartzUpgrade()}));let i=this.plugin.settings.upgradeCheckStrategy,s=e.createDiv();if(new G.Setting(s).setName("Update check strategy").setDesc("Version: check for new Quartz releases. Commit: check for any new upstream commits (including unreleased changes).").addDropdown(o=>{o.addOption("version","Version"),o.addOption("commit","Commit"),o.setValue(i).onChange(async a=>{this.plugin.settings.upgradeCheckStrategy=a,await this.plugin.saveSettings(),this.cachedUpgradeStatus=null,this.display(),a==="commit"&&!this.plugin.settings.lastUpstreamCommitSha&&this.checkForQuartzUpgrade()})}),this.registerSearchable(s,"Update check strategy","Version: check for new Quartz releases. Commit: check for any new upstream commits (including unreleased changes)."),this.cachedUpgradeStatus){let o=this.cachedUpgradeStatus,a=i==="commit"?o.hasNewerCommits:o.hasUpgrade;if(o.error){let l=e.createDiv();new G.Setting(l).setName("Upgrade check failed").setDesc(o.error),this.registerSearchable(l,"Upgrade check failed",o.error)}else if(a){let l=i==="commit"?`Latest upstream commit: ${o.latestUpstreamSha?.slice(0,7)??"unknown"}.`:`Your Quartz is at ${o.currentVersion??"unknown"}, upstream is at ${o.upstreamVersion??"unknown"}.`,c=e.createDiv(),u=new G.Setting(c).setName(i==="commit"?"New upstream commits available":"Quartz upgrade available").setDesc(l);this.registerSearchable(c,i==="commit"?"New upstream commits available":"Quartz upgrade available",l),u.addButton(f=>f.setButtonText(this.isUpgrading?"Upgrading...":"Upgrade now").setDestructive().setDisabled(this.isUpgrading).onClick(async()=>{await new Va(this.app,"Upgrade Quartz","This will merge upstream changes into your repository.","Upgrade").await()&&await this.performQuartzUpgrade()}))}else if(i==="commit"&&o.latestUpstreamSha){let l=e.createDiv(),c=`Current upstream commit: ${o.latestUpstreamSha.slice(0,7)}`;new G.Setting(l).setName("Quartz is up to date").setDesc(c),this.registerSearchable(l,"Quartz is up to date",c)}else{let l=e.createDiv(),c=`Current version: ${o.currentVersion??"unknown"}`;new G.Setting(l).setName("Quartz is up to date").setDesc(c),this.registerSearchable(l,"Quartz is up to date",c)}}}async checkForQuartzUpgrade(){if(!this.isCheckingUpgrade){this.isCheckingUpgrade=!0,this.display();try{let e=this.getOrCreateSiteManager(),r=new vd(e.userSyncerConnection);this.cachedUpgradeStatus=await r.checkForUpgrade(),this.cachedUpgradeStatus.latestUpstreamSha&&!this.cachedUpgradeStatus.hasNewerCommits&&(this.plugin.settings.lastUpstreamCommitSha=this.cachedUpgradeStatus.latestUpstreamSha,await this.plugin.saveSettings());let n=this.plugin.settings.upgradeCheckStrategy==="commit";(n?this.cachedUpgradeStatus.hasNewerCommits:this.cachedUpgradeStatus.hasUpgrade)?new G.Notice(n?"New upstream Quartz commits available. Use the Upgrade button in settings to upgrade.":"A Quartz upgrade is available. Use the Upgrade button in settings to upgrade."):this.cachedUpgradeStatus.error?new G.Notice(`Upgrade check failed: ${this.cachedUpgradeStatus.error}`):new G.Notice("Quartz is up to date.")}catch(e){let r=e instanceof Error?e.message:String(e);new G.Notice(`Failed to check for Quartz upgrade: ${r}`)}finally{this.isCheckingUpgrade=!1,this.display()}}}async performQuartzUpgrade(){if(!this.isUpgrading){this.isUpgrading=!0,this.display();try{let e=this.getOrCreateSiteManager(),n=await new vd(e.userSyncerConnection).performUpgrade();n.success?(n.alreadyMerged?new G.Notice("Quartz is already up to date."):new G.Notice(`Quartz upgraded successfully to ${n.oid?.slice(0,7)}.`),this.cachedUpgradeStatus=null,this.resetCache()):new G.Notice(n.error??"Upgrade failed.")}catch(e){let r=e instanceof Error?e.message:String(e);new G.Notice(`Failed to upgrade Quartz: ${r}`)}finally{this.isUpgrading=!1,this.display()}}}renderTemplateSection(){if(this.cachedTemplateNames.length===0)return;this.renderCollapsibleHeading("Templates","Apply a configuration template to replace your current settings with a preset.");let e=this.renderSectionContent("Templates");if(e)for(let r of this.cachedTemplateNames){let n=e.createDiv(),i=new G.Setting(n).setName(r),s=this.cachedTemplates.get(r),o="";s&&(o=`Title: "${s.config.configuration.pageTitle}" \xB7 ${s.config.plugins.length} plugin(s)`,i.setDesc(o)),i.addButton(a=>a.setButtonText("Preview").onClick(async()=>{if(!this.templateService)return;let l=this.cachedTemplates.get(r)??await this.templateService.readTemplate(r);if(!l){new G.Notice(`Could not load template "${r}".`);return}this.cachedTemplates.set(r,l),new G.Notice(`Template "${r}": ${l.config.plugins.length} plugin(s), title "${l.config.configuration.pageTitle}"`),this.display()})),i.addButton(a=>a.setButtonText("Apply").setDestructive().onClick(async()=>{if(!this.cachedConfig||!this.templateService||!await new Va(this.app,"Apply template",`Apply template "${r}"? This will replace your current site configuration.`,"Apply").await())return;let c=this.cachedTemplates.get(r)??await this.templateService.readTemplate(r);if(!c){new G.Notice(`Could not load template "${r}".`);return}this.cachedTemplates.set(r,c),this.templateService.applyTemplate(this.cachedConfig,c),this.markDirty(),this.display(),new G.Notice(`Template "${r}" applied. Save to push changes.`)})),this.registerSearchable(n,r,o)}}renderSiteConfigSection(){if(!this.cachedConfig)return;let e=this.cachedConfig.configuration;this.renderCollapsibleHeading("Site configuration","Edit site settings. Changes are applied when you click Save above.");let r=this.renderSectionContent("Site configuration");if(!r){e.theme&&this.renderThemeSection(e);return}let n=r.createDiv();new G.Setting(n).setName("Page title").setDesc("The title shown in the browser tab and site header.").addText(u=>u.setValue(e.pageTitle).onChange(f=>{e.pageTitle=f,this.markDirty()})),this.registerSearchable(n,"Page title","The title shown in the browser tab and site header.");let i=r.createDiv();new G.Setting(i).setName("Page title suffix").setDesc('Appended to the page title on subpages (e.g. " | My Site").').addText(u=>u.setValue(e.pageTitleSuffix??"").onChange(f=>{e.pageTitleSuffix=f||void 0,this.markDirty()})),this.registerSearchable(i,"Page title suffix",'Appended to the page title on subpages (e.g. " | My Site").');let s=r.createDiv();new G.Setting(s).setName("SPA mode").setDesc("Single Page Application mode for faster navigation between pages.").addToggle(u=>u.setValue(e.enableSPA).onChange(f=>{e.enableSPA=f,this.markDirty()})),this.registerSearchable(s,"SPA mode","Single Page Application mode for faster navigation between pages.");let o=r.createDiv();new G.Setting(o).setName("Popovers").setDesc("Show page preview popovers on hover.").addToggle(u=>u.setValue(e.enablePopovers??!1).onChange(f=>{e.enablePopovers=f,this.markDirty()})),this.registerSearchable(o,"Popovers","Show page preview popovers on hover.");let a=r.createDiv();new G.Setting(a).setName("Locale").setDesc("BCP 47 locale tag for date formatting and i18n (e.g. en-US).").addText(u=>u.setValue(e.locale).onChange(f=>{e.locale=f,this.markDirty()})),this.registerSearchable(a,"Locale","BCP 47 locale tag for date formatting and i18n (e.g. en-US).");let l=r.createDiv();if(new G.Setting(l).setName("Base URL").setDesc("The base URL where your site is hosted (without protocol, e.g. example.com/quartz).").addText(u=>u.setPlaceholder("example.com").setValue(e.baseUrl??"").onChange(f=>{e.baseUrl=f||void 0,this.markDirty()})),this.registerSearchable(l,"Base URL","The base URL where your site is hosted (without protocol, e.g. example.com/quartz)."),e.analytics){let u=r.createDiv();new G.Setting(u).setName("Analytics provider").setDesc(e.analytics.provider),this.registerSearchable(u,"Analytics provider",e.analytics.provider)}let c=r.createDiv();new G.Setting(c).setName("Ignore patterns").setDesc("Comma-separated glob patterns for files to exclude from processing.").addText(u=>u.setPlaceholder("drafts/*, private/*").setValue((e.ignorePatterns??[]).join(", ")).onChange(f=>{e.ignorePatterns=f.split(",").map(d=>d.trim()).filter(d=>d.length>0),this.markDirty()})),this.registerSearchable(c,"Ignore patterns","Comma-separated glob patterns for files to exclude from processing."),e.theme&&this.renderThemeSection(e)}renderThemeSection(e){let r=e.theme;this.renderCollapsibleHeading("Theme","Typography and font settings.");let n=this.renderSectionContent("Theme");if(!n)return;let i=n.createDiv();new G.Setting(i).setName("Header font").addText(u=>u.setValue(r.typography.header).onChange(f=>{r.typography.header=f,this.markDirty()})),this.registerSearchable(i,"Header font","");let s=n.createDiv();new G.Setting(s).setName("Body font").addText(u=>u.setValue(r.typography.body).onChange(f=>{r.typography.body=f,this.markDirty()})),this.registerSearchable(s,"Body font","");let o=n.createDiv();new G.Setting(o).setName("Code font").addText(u=>u.setValue(r.typography.code).onChange(f=>{r.typography.code=f,this.markDirty()})),this.registerSearchable(o,"Code font","");let a=n.createDiv();new G.Setting(a).setName("CDN caching").setDesc("Cache fonts via CDN for faster loading.").addToggle(u=>u.setValue(r.cdnCaching).onChange(f=>{r.cdnCaching=f,this.markDirty()})),this.registerSearchable(a,"CDN caching","Cache fonts via CDN for faster loading.");let l=this.findQuartzThemesPlugin(),c=n.createDiv();new G.Setting(c).setName("Use Quartz Themes").setDesc("Use community color themes from Quartz Themes instead of manual color editing.").addToggle(u=>u.setValue(l!==null).onChange(f=>{if(this.cachedConfig){if(f)try{this.pluginManager.addPlugin(this.cachedConfig,{name:"quartz-themes",repo:"github:saberzero1/quartz-themes",subdir:"plugin"}),new G.Notice("Quartz Themes plugin added. Save to push changes.")}catch(d){let h=d instanceof Error?d.message:String(d);new G.Notice(h)}else{let d=this.cachedConfig.plugins.findIndex(h=>yr(h.source)==="quartz-themes");d!==-1&&(this.cachedConfig.plugins.splice(d,1),new G.Notice("Quartz Themes plugin removed. Save to push changes."))}this.markDirty(),this.display()}})),this.registerSearchable(c,"Use Quartz Themes","Use community color themes from Quartz Themes instead of manual color editing."),l?this.renderQuartzThemesConfig(l,n):(this.renderColorSchemeSection("Light mode colors",r.colors.lightMode,sH,n),this.renderColorSchemeSection("Dark mode colors",r.colors.darkMode,oH,n))}renderColorSchemeSection(e,r,n,i){let s=i.createDiv();s.dataset.sectionHeading="true",new G.Setting(s).setName(e).setHeading(),this.registerSearchable(s,e,"");let o=[{key:"light",label:"Background"},{key:"lightgray",label:"Light gray (borders)"},{key:"gray",label:"Gray (graph, heavier borders)"},{key:"darkgray",label:"Dark gray (body text)"},{key:"dark",label:"Dark (headings)"},{key:"secondary",label:"Secondary (link color)"},{key:"tertiary",label:"Tertiary (hover states)"},{key:"highlight",label:"Highlight (internal link bg)"},{key:"textHighlight",label:"Text highlight (==marked==)"}];for(let{key:a,label:l}of o){let c=i.createDiv(),u=new G.Setting(c).setName(l),f=r[a],d=n[a],h=/^#[0-9a-fA-F]{3,8}$/.test(f);f!==d&&u.addExtraButton(g=>g.setIcon("reset").setTooltip(`Reset to default: ${d}`).onClick(()=>{r[a]=d,this.markDirty(),this.display()})),h&&u.addColorPicker(g=>g.setValue(f).onChange(m=>{r[a]=m,this.markDirty(),this.display()})),u.addText(g=>g.setValue(f).onChange(m=>{r[a]=m,this.markDirty()})),this.registerSearchable(c,l,"")}}findQuartzThemesPlugin(){return this.cachedConfig?this.cachedConfig.plugins.find(e=>yr(e.source)==="quartz-themes")??null:null}renderQuartzThemesConfig(e,r){e.options||(e.options={});let n=e.options.theme??"default",i=e.options.variation??null,s=this.cachedThemesJson;if(!s){let u=r.createDiv();new G.Setting(u).setName("Theme").setDesc("Loading available themes..."),this.registerSearchable(u,"Theme","Loading available themes..."),this.fetchThemesJson().then(()=>this.display());return}let o=Object.keys(s).sort(),a=r.createDiv();new G.Setting(a).setName("Theme").setDesc("Select a community color theme.").addDropdown(u=>{for(let f of o)u.addOption(f,f);u.setValue(n).onChange(f=>{e.options||(e.options={}),e.options.theme=f||"default";let d=f?s[f]:null;d&&d.variations&&d.variations.length>0?e.options.variation=null:delete e.options.variation,this.markDirty(),this.display()})}),this.registerSearchable(a,"Theme","Select a community color theme.");let c=(n?s[n]:null)?.variations??[];if(c.length>0){let u=r.createDiv();new G.Setting(u).setName("Variation").setDesc("Select a theme variation.").addDropdown(f=>{f.addOption("","\u2014 No variation \u2014");for(let d of c)f.addOption(d.name,d.name);f.setValue(i??"").onChange(d=>{e.options||(e.options={}),d?e.options.variation=d:delete e.options.variation,this.markDirty()})}),this.registerSearchable(u,"Variation","Select a theme variation.")}}async fetchThemesJson(){if(!this.cachedThemesJson)try{let e=await(0,G.requestUrl)({url:"https://raw.githubusercontent.com/saberzero1/quartz-themes/master/themes.json"});if(e.status<200||e.status>=300)return;let r=JSON.parse(e.text);this.cachedThemesJson=r.themes}catch{}}async checkForUpdates(){if(!(!this.cachedConfig||this.isCheckingUpdates)){this.isCheckingUpdates=!0,this.display();try{let e=this.plugin.getGitSettingsWithSecret(),n=await new So(e.auth,e.corsProxyUrl).checkUpdates(this.cachedConfig.plugins,this.cachedLockFile);this.cachedUpdateStatuses=new Map(n.map(s=>[s.sourceKey,s]));let i=n.filter(s=>s.hasUpdate).length;i>0?new G.Notice(`${i} plugin update(s) available.`):new G.Notice("All plugins are up to date.")}catch(e){let r=e instanceof Error?e.message:String(e);new G.Notice(`Failed to check for updates: ${r}`)}finally{this.isCheckingUpdates=!1,this.display()}}}async updatePlugin(e,r){if(!this.cachedLockFile||!this.configService)return;let n=this.cachedLockFile.plugins[e];if(!n){new G.Notice(`No lock entry found for ${e}.`);return}try{n.commit=r,n.installedAt=new Date().toISOString(),await this.configService.writeLockFile(this.cachedLockFile,`Update ${e} to ${r.slice(0,7)} via Syncer`),this.cachedUpdateStatuses&&this.cachedUpdateStatuses.delete(e),new G.Notice(`Updated ${e} to ${r.slice(0,7)}.`),this.display()}catch(i){let s=i instanceof Error?i.message:String(i);new G.Notice(`Failed to update ${e}: ${s}`)}}async updateAllPlugins(){if(!this.cachedLockFile||!this.configService||!this.cachedUpdateStatuses)return;let e=[...this.cachedUpdateStatuses.values()].filter(r=>r.hasUpdate&&r.remoteCommit);if(e.length===0){new G.Notice("No plugin updates available.");return}try{for(let n of e){let i=this.cachedLockFile.plugins[n.sourceKey];i&&n.remoteCommit&&(i.commit=n.remoteCommit,i.installedAt=new Date().toISOString())}let r=e.map(n=>n.sourceKey).join(", ");await this.configService.writeLockFile(this.cachedLockFile,`Update ${e.length} plugin(s) via Syncer: ${r}`),this.cachedUpdateStatuses=null,new G.Notice(`Updated ${e.length} plugin(s): ${r}`),this.display()}catch(r){let n=r instanceof Error?r.message:String(r);new G.Notice(`Failed to update plugins: ${n}`)}}async installPlugin(e){if(!this.cachedConfig||!this.configService)throw new Error("Configuration not loaded.");let r=this.pluginManager.addPlugin(this.cachedConfig,e);if(this.manifestService)try{let i=await this.manifestService.fetchManifest(e);i?.defaultOptions&&(r.options={...i.defaultOptions})}catch{}await this.configService.writeConfig(this.cachedConfig);let n=this.plugin.getGitSettingsWithSecret();try{let o=(await new So(n.auth,n.corsProxyUrl).checkUpdates([r],this.cachedLockFile))[0];if(o?.remoteCommit&&this.cachedLockFile&&this.configService){let a=yr(e);this.cachedLockFile.plugins[a]={source:e,resolved:ko(e),commit:o.remoteCommit,installedAt:new Date().toISOString()},await this.configService.writeLockFile(this.cachedLockFile,`Install ${a} via Syncer`)}}catch{}this.display()}renderPluginListSection(){if(!this.cachedConfig)return;let e=this.cachedConfig.plugins,r=this.cachedLockFile?.plugins??{};this.renderCollapsibleHeading("Plugins",`${e.length} plugin(s) configured. Toggle enabled state or adjust execution order.`);let n=this.renderSectionContent("Plugins");if(!n)return;let i=n.createDiv(),s=new G.Setting(i).setName("Plugin actions").setDesc("");this.registerSearchable(i,"Plugin actions","Check for updates, update all, browse plugins."),s.addButton(c=>c.setButtonText(this.isCheckingUpdates?"Checking...":"Check for updates").setDisabled(this.isCheckingUpdates).onClick(async()=>{await this.checkForUpdates()}));let o=this.cachedUpdateStatuses?[...this.cachedUpdateStatuses.values()].filter(c=>c.hasUpdate).length:0;o>0&&s.addButton(c=>c.setButtonText(`Update all (${o})`).onClick(async()=>{await this.updateAllPlugins()})),s.addButton(c=>c.setButtonText("Browse plugins").onClick(()=>{if(!this.cachedConfig)return;new ag(this.app,this.pluginRegistry,this.cachedConfig,async f=>this.installPlugin(f)).open()}));let a="",l=n.createDiv();if(new G.Setting(l).setName("Add plugin").setDesc('Enter a plugin source (e.g. "github:quartz-community/explorer").').addText(c=>c.setPlaceholder("github:org/plugin").onChange(u=>{a=u})).addButton(c=>c.setButtonText("Add").onClick(()=>{if(!(!this.cachedConfig||!a.trim()))try{this.pluginManager.addPlugin(this.cachedConfig,a.trim()),this.markDirty(),this.display(),new G.Notice(`Plugin "${a.trim()}" added. Save to push changes.`)}catch(u){let f=u instanceof Error?u.message:String(u);new G.Notice(f)}})),this.registerSearchable(l,"Add plugin",'Enter a plugin source (e.g. "github:quartz-community/explorer").'),e.length===0){let c=n.createDiv();new G.Setting(c).setName("No plugins").setDesc("No plugins are configured in your Quartz config."),this.registerSearchable(c,"No plugins","No plugins are configured in your Quartz config.");return}for(let c=0;c0?a.join(" \xB7 "):"",d=s.createDiv(),h=new G.Setting(d).setName(u).setDesc(f);this.registerSearchable(d,u,f),h.addToggle(g=>g.setTooltip("Enable or disable this plugin").setValue(e.enabled).onChange(m=>{e.enabled=m,this.markDirty()})),h.addExtraButton(g=>g.setIcon("settings").setTooltip("Plugin settings").onClick(()=>{if(!this.cachedConfig)return;new cg(this.app,{plugin:e,index:r,total:n,config:this.cachedConfig,manifest:this.cachedManifests.get(o)??null,manifestService:this.manifestService,updateStatus:c,onDirty:()=>this.markDirty(),onMovePlugin:(y,v)=>{this.movePlugin(y,v)},onRemovePlugin:y=>{if(this.cachedConfig)try{this.pluginManager.removePlugin(this.cachedConfig,y),this.markDirty(),this.display(),new G.Notice(`Plugin "${o}" removed. Save to push changes.`)}catch(v){let b=v instanceof Error?v.message:String(v);new G.Notice(b)}},onUpdatePlugin:async(y,v)=>{await this.updatePlugin(y,v)}}).open()}))}renderLayoutSection(){if(!this.cachedConfig)return;let e=this.cachedConfig;e.layout||(e.layout={});let r=e.layout;this.renderCollapsibleHeading("Layout overrides","Per-page-type layout overrides. Set a frame template or exclude plugins for specific page types.");let n=this.renderSectionContent("Layout overrides");if(n)for(let i of aH)this.renderPageTypeOverride(r,i,n)}renderPageTypeOverride(e,r,n){e.byPageType||(e.byPageType={});let i=e.byPageType[r],s=i!==void 0,o=n.createDiv(),a=new G.Setting(o).setName(r);if(!s){a.setDesc("No overrides configured."),this.registerSearchable(o,r,"No overrides configured."),a.addButton(u=>u.setButtonText("Add override").onClick(()=>{e.byPageType||(e.byPageType={}),e.byPageType[r]={},this.markDirty(),this.display()}));return}this.registerSearchable(o,r,""),a.addButton(u=>u.setButtonText("Remove override").onClick(()=>{e.byPageType&&delete e.byPageType[r],this.markDirty(),this.display()}));let l=n.createDiv();new G.Setting(l).setName("Template").setDesc(`Frame template for ${r} pages.`).addDropdown(u=>{u.addOption("","Default");let f=["default","full-width","minimal",...this.cachedTemplateNames.filter(d=>d!=="default"&&d!=="full-width"&&d!=="minimal")];for(let d of f)u.addOption(d,d);u.setValue(i.template??"").onChange(d=>{i.template=d||void 0,this.markDirty()})}),this.registerSearchable(l,"Template",`Frame template for ${r} pages.`);let c=n.createDiv();new G.Setting(c).setName("Excluded plugins").setDesc(`Comma-separated plugin names to exclude from ${r} pages.`).addText(u=>u.setPlaceholder("reader-mode, graph").setValue((i.exclude??[]).join(", ")).onChange(f=>{i.exclude=f.split(",").map(d=>d.trim()).filter(d=>d.length>0),i.exclude.length===0&&(i.exclude=void 0),this.markDirty()})),this.registerSearchable(c,"Excluded plugins",`Comma-separated plugin names to exclude from ${r} pages.`)}movePlugin(e,r){if(!this.cachedConfig)return;let n=this.cachedConfig.plugins;if(r<0||r>=n.length)return;let[i]=n.splice(e,1);n.splice(r,0,i),this.markDirty(),this.display()}};p();function M_(t){let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(e.length===0)return"At least one key is required.";let r=e.find(n=>!/^[\w-]+$/.test(n));if(r)return`Invalid key "${r}". Keys may only contain letters, digits, underscores, and hyphens.`}function UO(t){return[{type:"group",heading:"Note properties (frontmatter)",items:lH(t)}]}function lH(t){let e=t.settings;return[{name:"Frontmatter format",desc:"Output format for frontmatter in published notes. YAML is more readable, JSON is supported in case you need it.",aliases:["yaml","json","properties"],control:{type:"dropdown",key:"frontmatterFormat",defaultValue:"yaml",options:{yaml:"YAML",json:"JSON"}}},{name:"Publish key",desc:'Note property key used to mark a note as eligible to publish. By default "publish".',aliases:["frontmatter","property","flag"],visible:()=>!e.allNotesPublishableByDefault,control:{type:"text",key:"publishFrontmatterKey",defaultValue:"publish",placeholder:"publish",validate:r=>r.trim().length===0?"Publish key cannot be empty.":void 0}},{name:"All notes publishable by default",desc:"Make all notes publishable by default. This will override the publish key setting.",aliases:["public","default publish"],control:{type:"toggle",key:"allNotesPublishableByDefault",defaultValue:!1}},{name:"Include all properties",desc:"Include all note properties in the Quartz Syncer note. Enabling this overrides other property settings.",control:{type:"toggle",key:"includeAllFrontmatter",defaultValue:!1}},{name:"Include created timestamp",desc:"Include the created timestamp in your note's properties.",visible:()=>!e.includeAllFrontmatter,control:{type:"toggle",key:"showCreatedTimestamp",defaultValue:!0}},{name:"Created timestamp keys",desc:"Comma-separated list of keys to look for to determine the created timestamp.",visible:()=>!e.includeAllFrontmatter&&e.showCreatedTimestamp,control:{type:"text",key:"createdTimestampKey",defaultValue:"created, created_at, date",placeholder:"created, created_at, date",validate:M_}},{name:"Include modified timestamp",desc:"Include the modified timestamp in your note's properties.",visible:()=>!e.includeAllFrontmatter,control:{type:"toggle",key:"showUpdatedTimestamp",defaultValue:!0}},{name:"Modified timestamp keys",desc:"Comma-separated list of keys to look for to determine the modified timestamp.",visible:()=>!e.includeAllFrontmatter&&e.showUpdatedTimestamp,control:{type:"text",key:"updatedTimestampKey",defaultValue:"modified, lastmod, updated, last-modified",placeholder:"modified, lastmod, updated, last-modified",validate:M_}},{name:"Include published timestamp",desc:"Include the published timestamp in your note's properties.",visible:()=>!e.includeAllFrontmatter,control:{type:"toggle",key:"showPublishedTimestamp",defaultValue:!1}},{name:"Published timestamp keys",desc:"Comma-separated list of keys to look for to determine the published timestamp.",visible:()=>!e.includeAllFrontmatter&&e.showPublishedTimestamp,control:{type:"text",key:"publishedTimestampKey",defaultValue:"published, publishDate, date",placeholder:"published, publishDate, date",validate:M_}},{name:"Enable permalinks",desc:`Use the note's permalink as the Quartz note's URL if "permalink" is not in the frontmatter.`,aliases:["slug","url","path"],control:{type:"toggle",key:"usePermalink",defaultValue:!1}}]}p();var cH={dataview:"Converts Dataview queries into Quartz-compatible markdown.",datacore:"Converts Datacore queries into Quartz-compatible markdown. Currently experimental.",excalidraw:"Syncs Excalidraw drawings to Quartz. Rendering is handled by the Quartz Excalidraw plugin.","fantasy-statblocks":"Converts Fantasy Statblocks queries into Quartz-compatible format.","auto-card-link":"Converts Auto Card Link queries into Quartz-compatible markdown.",bases:"Publishes Obsidian Bases (.base files) to Quartz. Processing is delegated to Quartz.",canvas:"Publishes JSON Canvas (.canvas files) to Quartz. Processing is delegated to Quartz."};function qO(){let t=[],e=Bt.getByCategory("core"),r=Bt.getByCategory("community");return e.length>0&&t.push({type:"group",heading:"Core plugins",items:e.map(n=>jO(n))}),r.length>0&&t.push({type:"group",heading:"Community plugins",items:r.map(n=>jO(n))}),t.push({type:"group",heading:"Integration styles",items:[{name:"Manage integration styles",desc:"When enabled, Quartz Syncer will automatically write SCSS files for enabled integrations and ensure custom.scss imports them.",aliases:["scss","css","custom.scss"],control:{type:"toggle",key:"manageSyncerStyles",defaultValue:!0}}]}),t}function jO(t){let e=t.settingKey;return{name:`Enable ${t.name} integration`,desc:cH[t.id]??`Enables ${t.id} integration.`,control:{type:"toggle",key:e,defaultValue:!1,disabled:()=>!t.isAvailable()}}}p();var VO=require("obsidian");function HO(t){let e=t.settings;return[{type:"group",heading:"Performance",items:[{name:"Enable caching",desc:"Enable or disable the Quartz Syncer cache. This can improve performance by storing compiled files locally.",aliases:["speed","local storage"],control:{type:"toggle",key:"useCache",defaultValue:!0}},{name:"Synchronize cache between devices",desc:"Whether to write the cache to `data.json`. This is useful for syncing the cache across devices.",aliases:["sync","data.json","multi-device"],visible:()=>e.useCache,control:{type:"toggle",key:"syncCache",defaultValue:!0}},{name:"Persist cache after unload",desc:"Whether to persist the cache when the plugin is unloaded. This is useful for users that start Obsidian with the plugin disabled.",visible:()=>e.useCache,control:{type:"toggle",key:"persistCache",defaultValue:!1}},{name:"Clear cache",desc:"Clear the Quartz Syncer cache. This will remove all cached files and force a re-fetch of all data from the remote repository.",visible:()=>e.useCache,action:()=>{(async()=>(await t.datastore.dropAllFiles(),e.cache="{}",await t.saveSettings(),new VO.Notice("Quartz Syncer: cache cleared.")))()}}]}]}p();function GO(){return[{type:"group",heading:"User interface",items:[{name:"Diff view style",desc:"Choose how differences are displayed when comparing local and published files.",aliases:["compare","side-by-side","preview"],control:{type:"dropdown",key:"diffViewStyle",defaultValue:"auto",options:{auto:"Auto (Split on desktop, Unified on mobile)",split:"Always Split (side-by-side)",unified:"Always Unified (single column)"}}}]}]}var fg=class extends QO.PluginSettingTab{plugin;constructor(e,r){super(e,r),this.plugin=r,this.plugin.settings.noteSettingsIsInitialized||(this.plugin.settings.noteSettingsIsInitialized=!0,this.plugin.saveSettings())}getSettingDefinitions(){return[...this.buildOverviewItems(),{type:"page",name:"Git",desc:"Configure your Git remote, authentication, and branch.",page:()=>new tg(this.app,this.plugin)},{type:"page",name:"Quartz",desc:"Quartz site configuration, plugins, and templates.",page:()=>new ug(this.app,this.plugin)},{type:"page",name:"Frontmatter",desc:"Note properties and frontmatter settings.",items:UO(this.plugin)},{type:"page",name:"Integration",desc:"Plugin integrations for Dataview, Excalidraw, and more.",items:qO()},{type:"page",name:"Performance",desc:"Caching and performance optimization.",items:HO(this.plugin)},{type:"page",name:"UI",desc:"Customize the appearance and behavior of Quartz Syncer.",items:GO()}]}buildOverviewItems(){let e=this.plugin.settings;return[{name:`Quartz Syncer v${this.plugin.manifest.version}`,desc:this.buildLinksFragment()},{type:"group",heading:"Status",items:[{name:"Repository",desc:e.gitRemoteUrl||"Not configured",visible:()=>!!e.gitRemoteUrl},{name:"Branch",desc:e.gitBranch||"Not configured",visible:()=>!!e.gitRemoteUrl},{name:"Connection",render:(n,i)=>{this.renderConnectionStatus(n)},visible:()=>!!e.gitRemoteUrl},{name:"Quartz version",render:(n,i)=>{this.renderQuartzVersion(n)},visible:()=>!!e.gitRemoteUrl},{name:"Not configured",desc:"Set up your Git repository in the Git settings page to get started.",visible:()=>!e.gitRemoteUrl}]}]}buildLinksFragment(){let e=createFragment();return e.createSpan({text:"Publish your notes to "}),e.createEl("a",{text:"Quartz",href:"https://quartz.jzhao.xyz/"}),e.createSpan({text:". "}),e.createEl("a",{text:"Documentation",href:"https://saberzero1.github.io/quartz-syncer-docs/"}),e.createSpan({text:" \xB7 "}),e.createEl("a",{text:"Setup guide",href:"https://saberzero1.github.io/quartz-syncer-docs/Setup-Guide"}),e.createSpan({text:" \xB7 "}),e.createEl("a",{text:"Troubleshooting",href:"https://saberzero1.github.io/quartz-syncer-docs/Troubleshooting/"}),e}renderConnectionStatus(e){e.setName("Connection").setDesc("Checking...");let r=this.plugin.getGitSettingsWithSecret();(async()=>{try{let{branches:n}=await et.fetchRemoteBranches(r.remoteUrl,r.auth,r.corsProxyUrl),i=n.length>0,s=i?await et.checkWriteAccess(r.remoteUrl,r.auth,r.corsProxyUrl):!1;i&&s?e.setDesc("Connected (read & write)"):i?e.setDesc("Connected (read only)"):e.setDesc("Connection failed")}catch{e.setDesc("Connection failed")}})()}renderQuartzVersion(e){e.setName("Quartz version").setDesc("Detecting...");let r=this.plugin.getGitSettingsWithSecret();(async()=>{try{let i=await new wi(this.app.metadataCache,this.plugin.settings,r).getQuartzVersion();i==="v5-yaml"||i==="v5-json"?e.setDesc(`Quartz v5 (${i==="v5-yaml"?"YAML":"JSON"} config)`):e.setDesc("Quartz v4")}catch{e.setDesc("Could not detect version")}})()}};p();p();var Ha=class extends Error{constructor(e,r,n,i){super(r),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.setPrototypeOf(this,new.target.prototype),this.name="LocalSpaceError",this.code=e,this.details=n,i!==void 0&&(this.cause=i)}withDetails(e){return e?(this.details={...this.details??{},...e},this):this}},Qe=(t,e,r)=>new Ha(t,e,r),Ss=(t,e,r,n)=>{if(t instanceof Ha)return n?t.withDetails(n):t;let i=t instanceof Error?t:new Error(String(t)),s={...n??{},causeName:i.name,causeMessage:i.message};return new Ha(e,r,s,i)},uN=(t,e="Unknown error")=>t instanceof Error?t instanceof Ha?t:Ss(t,"UNKNOWN",t.message||e):Ss(t,"UNKNOWN",typeof t=="string"?t:e);function xe(t,e){return e&&t.then(r=>e(null,r),r=>e(uN(r),void 0)),t}function Vc(t,e,r,n){let i=o=>uN(o);if(n?.compatibilityMode)return typeof e=="function"&&t.then(o=>{e(o)}),typeof r=="function"&&t.catch(o=>{r(i(o))}),t;let s=o=>{let a=i(o);r?r(a):e&&e(a,void 0)};return e?t.then(o=>e(null,o),s):r&&t.catch(s),t}function uH(t,e){return t.indexOf(e)!==-1}function fN(t){return Array.isArray(t)}function ht(t){return typeof t!="string"?String(t):t}function L_(t,...e){let r=t;for(let n of e)if(n){let i=n;for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s)){let o=i[s];r[s]=fN(o)?[...o]:o}}return t}function t0(t,e){try{return new Blob(t,e)}catch(r){if(!(r instanceof Error)||r.name!=="TypeError")throw r;let n=window,i=n.BlobBuilder||n.MSBlobBuilder||n.MozBlobBuilder||n.WebKitBlobBuilder;if(!i)throw Qe("BLOB_UNSUPPORTED","Blob constructor not supported");let s=new i;for(let o of t)s.append(o);return s.getBlob(e?.type)}}function yg(t){if(Array.isArray(t))return t.map(({key:r,value:n})=>({key:ht(r),value:n}));if(t instanceof Map){let r=[];return t.forEach((n,i)=>{r.push({key:ht(i),value:n})}),r}let e=[];for(let r of Object.keys(t))e.push({key:ht(r),value:t[r]});return e}function Yi(t,e){if(e<=0||e>=t.length)return[t];let r=[];for(let n=0;n{let t;return t=typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t};function YO(t){let e=r0(),r=.75*t.length,n=t.length,i=0,s=r;t[t.length-1]==="="&&(s--,t[t.length-2]==="="&&s--);let o=new e.ArrayBuffer(s),a=new e.Uint8Array(o);for(let l=0;l>4,a[i++]=(15&u)<<4|f>>2,a[i++]=(3&f)<<6|63&d}return o}function hg(t){let e=new(r0()).Uint8Array(t),r="";for(let n=0;n>2],r+=To[(3&e[n])<<4|e[n+1]>>4],r+=To[(15&e[n+1])<<2|e[n+2]>>6],r+=To[63&e[n+2]];return e.length%3==2?r=r.substring(0,r.length-1)+"=":e.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var dH={"[object Int8Array]":dN,"[object Uint8Array]":hN,"[object Uint8ClampedArray]":pN,"[object Int16Array]":mN,"[object Uint16Array]":yN,"[object Int32Array]":gN,"[object Uint32Array]":wN,"[object Float32Array]":vN,"[object Float64Array]":bN,"[object BigInt64Array]":_N,"[object BigUint64Array]":xN},Ga={serialize:async function(t){let e=t!=null?fH.call(t):"";if(e==="[object ArrayBuffer]")return dg+KO+hg(t);if(function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}(t)){let r=dH[e];if(!r)throw Qe("SERIALIZATION_FAILED","Failed to get type for BinaryArray",{valueType:e});let n=t.byteOffset,i=t.byteLength,s=t.buffer,o=s instanceof ArrayBuffer?s.slice(n,n+i):new Uint8Array(s,n,i).slice().buffer;return dg+r+hg(o)}if(e==="[object Blob]"){let r=t,n=await r.arrayBuffer(),i="~~local_forage_type~"+r.type+"~"+hg(n);return dg+B_+i}try{return JSON.stringify(t)}catch(r){throw r}},deserialize:function(t){if(t.substring(0,9)!==dg)return JSON.parse(t);let e=t.substring(13),r=t.substring(9,13),n,i=e;if(r===B_&&WO.test(e)){let a=e.match(WO);a&&(n=a[1],i=e.substring(a[0].length))}let s=YO(i),o=r0();switch(r){case KO:return s;case B_:return t0([s],{type:n});case dN:return new o.Int8Array(s);case hN:return new o.Uint8Array(s);case pN:return new o.Uint8ClampedArray(s);case mN:return new o.Int16Array(s);case yN:return new o.Uint16Array(s);case gN:return new o.Int32Array(s);case wN:return new o.Uint32Array(s);case vN:return new o.Float32Array(s);case bN:return new o.Float64Array(s);case _N:if(o.BigInt64Array===void 0)throw Qe("DESERIALIZATION_FAILED","BigInt64Array is not supported in this environment",{operation:"deserialize",type:r});return new o.BigInt64Array(s);case xN:if(o.BigUint64Array===void 0)throw Qe("DESERIALIZATION_FAILED","BigUint64Array is not supported in this environment",{operation:"deserialize",type:r});return new o.BigUint64Array(s);default:throw Qe("DESERIALIZATION_FAILED","Unknown type: "+r,{operation:"deserialize",type:r})}},stringToBuffer:YO,bufferToString:hg},G_="local-forage-detect-blob-support",Kc,Qn={},pg=Object.prototype.toString,vi="asyncStorage",Ki="readonly",Eo="readwrite",_d=null,$r=(t,e,r,n="OPERATION_FAILED")=>t.catch(i=>{let s=i instanceof Error&&i.message?i.message:`IndexedDB ${e} failed`;throw Ss(i,n,s,{driver:vi,operation:e,...r??{}})}),kN=()=>typeof window<"u"&&window.navigator?window.navigator:typeof navigator<"u"?navigator:void 0;function Q_(){return typeof indexedDB<"u"?indexedDB:typeof window<"u"&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB)||null}function W_(t){return t?.idbFactory?t.idbFactory:Q_()}function ZO(t){return typeof Kc=="boolean"?Promise.resolve(Kc):_d||(_d=new Promise(e=>{let r=t.transaction(G_,Eo),n=t0([""]);r.objectStore(G_).put(n,"key"),r.onabort=i=>{i.preventDefault(),i.stopPropagation(),e(!1)},r.onerror=r.onabort,r.oncomplete=()=>{let i=kN(),s=i?.userAgent??"",o=s.match(/Chrome\/(\d+)/),a=s.match(/Edge\//),l=o?parseInt(o[1],10):NaN,c=!!a||!o||Number.isNaN(l)||l>=43;e(c)}}).then(e=>(Kc=e,_d=null,e)).catch(()=>(_d=null,Kc=!1,!1)),_d)}async function xd(t,e){if(typeof Kc=="boolean")return Kc;let r=e??t.db;if(r)return ZO(r);if(await IN(t),!t.db)throw Qe("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:vi});return ZO(t.db)}async function U_(t){let e=await async function(r){if(typeof r.arrayBuffer=="function")return r.arrayBuffer();if(typeof FileReader>"u")throw Qe("BLOB_UNSUPPORTED","Blob serialization not supported in this environment",{driver:vi});return new Promise((n,i)=>{let s=new FileReader;s.onerror=()=>i(s.error),s.onloadend=()=>n(s.result),s.readAsArrayBuffer(r)})}(t);return{__local_forage_encoded_blob:!0,data:Ga.bufferToString(e),type:t.type}}function kd(t){return t0([Ga.stringToBuffer(t.data)],{type:t.type})}function Sd(t){return!!t?.__local_forage_encoded_blob}function SN(t){if(t.name)return t.name;throw Qe("INVALID_CONFIG","IndexedDB database name is not configured.",{driver:vi,configKey:"name"})}function Rr(t){if(t.storeName)return t.storeName;throw Qe("INVALID_CONFIG","IndexedDB storeName is not configured.",{driver:vi,configKey:"storeName"})}function Qa(t){let e=SN(t);return t.bucket?.name?`${t.bucket.name}::${e}`:e}function Ao(t){return Qn[Qa(t)]}function wg(t){let e=Qa(t);return Qn[e]=Qn[e]||{forages:[],db:null,dbReady:null,deferredOperations:[],prewarmPromise:null,prewarmed:!1,idleTimer:null,activeTransactions:0,pendingTransactions:[],coalesceStates:{}},Qn[e]}function n0(t){return Rr(t)}function EN(t){let e=Ao(t);if(e)return e.coalesceStates[n0(t)]}function JO(t){let e=Ao(t);if(!e)return;let r=n0(t),n=e.coalesceStates[r];n&&(n.timer&&clearTimeout(n.timer),delete e.coalesceStates[r])}function gg(t){let e=wg(t),r={promise:null,resolve:null,reject:null};r.promise=new Promise((n,i)=>{r.resolve=n,r.reject=i}),e.deferredOperations.push(r),e.dbReady?e.dbReady=e.dbReady.then(()=>r.promise):e.dbReady=r.promise}function K_(t){let e=Ao(t);if(!e)return;let r=e.deferredOperations.pop();return r?(r.resolve(),r.promise):void 0}function Y_(t,e){let r=Ao(t);if(!r)return;let n=r.deferredOperations.pop();return n?(n.reject(e),n.promise):void 0}function Yc(t,e){return new Promise((r,n)=>{let i=W_(t);if(!i)return n(Qe("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:vi}));let s=Qa(t);if(Qn[s]=Qn[s]||{forages:[],db:null,dbReady:null,deferredOperations:[],prewarmPromise:null,prewarmed:!1,idleTimer:null,activeTransactions:0,pendingTransactions:[],coalesceStates:{}},t.db){if(!e)return r(t.db);gg(t),t.db.close()}let o=e?i.open(t.name,t.version):i.open(t.name);e&&(o.onupgradeneeded=a=>{let l=a.target.result;try{l.createObjectStore(t.storeName),a.oldVersion<=1&&l.createObjectStore(G_)}catch(c){if(c.name!=="ConstraintError")throw c}}),o.onerror=a=>{a.preventDefault(),n(a.target.error)},o.onsuccess=()=>{let a=o.result;a.onversionchange=l=>{l.target.close();let c=Qa(t),u=Qn[c];if(u){u.db=null,u.prewarmed=!1;for(let f of u.forages)f._dbInfo.db=null}},r(a),K_(t)}})}function CN(t,e){if(!t.db)return!0;let r=!t.db.objectStoreNames.contains(t.storeName),n=t.versiont.db.version;if(n&&(t.version,t.version=t.db.version),i||r){if(r){let s=t.db.version+1;s>t.version&&(t.version=s)}return!0}return!1}function TN(t,e){if(e===Eo&&t.durability)return{durability:t.durability}}function AN(t){let e=Ao(t),r=t.connectionIdleMs;e&&e.db&&r&&!(r<=0)&&(e.idleTimer&&clearTimeout(e.idleTimer),e.idleTimer=setTimeout(()=>{if(e.pendingTransactions.length>0||e.activeTransactions>0)AN(t);else{try{e.db?.close()}catch{}e.db=null,e.prewarmed=!1;for(let n of e.forages)n._dbInfo.db=null}},r))}function XO(t,e,r){let n=function(l){let c=wg(l),u=n0(l);return c.coalesceStates[u]=c.coalesceStates[u]||{storeName:u,queue:[],timer:null,coalescing:!1,drainPromise:null,stats:{totalWrites:0,coalescedWrites:0,transactionsSaved:0}},c.coalesceStates[u]}(t),i=e.type==="set"?{type:"set",key:e.key,value:e.value,resolve:()=>{},reject:()=>{}}:{type:"remove",key:e.key,resolve:()=>{},reject:()=>{}};n.queue.push(i),n.stats.totalWrites++;let s=t.coalesceWindowMs??8,o=t.coalesceMaxBatchSize;typeof o=="number"&&Number.isFinite(o)&&o>0&&n.queue.length>=o?Ad(t,n):n.timer||(n.timer=setTimeout(()=>{n.timer=null,Ad(t,n)},s));let a=new Promise((l,c)=>{i.resolve=l,i.reject=c});return r?.resolveImmediately?(a.catch(l=>{}),e.type==="set"?Promise.resolve(e.value):Promise.resolve()):a}function Ad(t,e){if(e.timer&&(clearTimeout(e.timer),e.timer=null),e.coalescing)return e.drainPromise??Promise.resolve();let r=e.queue.splice(0);if(r.length===0)return Promise.resolve();let n=function(a,l){return a.storeName===l.storeName?a:{...a,storeName:l.storeName}}(t,e),i=t.coalesceMaxBatchSize,s=typeof i=="number"&&Number.isFinite(i)&&i>0?Yi(r,i):[r];e.coalescing=!0;let o=new Promise((a,l)=>{let c=u=>new Promise((f,d)=>{Yr(n,Eo,(h,g)=>{if(!h&&g)try{let m=Rr(n),y=g.objectStore(m),v=null;for(let b of u)if(b.type==="set"){let k=y.put(b.value,b.key);k.onerror=()=>{v=k.error||new Error(`Failed to set "${String(b.key)}"`)}}else{let k=y.delete(b.key);k.onerror=()=>{v=k.error||new Error(`Failed to remove "${String(b.key)}"`)}}g.oncomplete=()=>{for(let b of u)b.type==="set"?b.resolve(b.value):b.resolve();u.length>1&&(e.stats.coalescedWrites+=u.length,e.stats.transactionsSaved+=u.length-1),f()},g.onabort=g.onerror=()=>{d(v||g.error||new Error("Failed to apply coalesced writes"))}}catch(m){d(m)}else d(h||new Error("Failed to create transaction"))})});(async()=>{for(let u of s)await c(u)})().then(()=>a()).catch(u=>{for(let f of r)f.reject(u);l(u)})});return e.drainPromise=o.then(()=>{if(e.coalescing=!1,e.queue.length>0)return Ad(t,e)}).catch(a=>{throw e.coalescing=!1,a}).finally(()=>{e.coalescing||e.queue.length!==0||(e.drainPromise=null)}),e.drainPromise}function An(t,e){if(!e?.force&&!t.coalesceWrites||!e?.force&&t.coalesceReadConsistency==="eventual")return Promise.resolve();let r=Ao(t);if(!r)return Promise.resolve();if(e?.scope==="database")return Object.values(r.coalesceStates).reduce((i,s)=>i.then(()=>Ad(t,s)),Promise.resolve());let n=EN(t);return n?Ad(t,n):Promise.resolve()}function Yr(t,e,r,n=1){let i=s=>{!(n>0)||t.db&&s.name!=="InvalidStateError"&&s.name!=="NotFoundError"?r(s):Promise.resolve().then(()=>{if(!t.db||s.name==="NotFoundError"&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),Yc(t,!0)}).then(()=>IN(t).then(()=>{Yr(t,e,r,n-1)})).catch(r)};try{let s=wg(t);s.idleTimer&&(clearTimeout(s.idleTimer),s.idleTimer=null);let o=t.maxConcurrentTransactions,a=()=>{if(s.pendingTransactions.length>0){let c=s.pendingTransactions.shift();c&&setTimeout(c,0)}},l=()=>{try{let c=TN(t,e),u=c?t.db.transaction(t.storeName,e,c):t.db.transaction(t.storeName,e);s.activeTransactions+=1;let f=!1,d=()=>{f||(f=!0,s.activeTransactions=Math.max(0,s.activeTransactions-1),AN(t),a())};u.addEventListener("complete",d),u.addEventListener("abort",d),u.addEventListener("error",d),r(null,u)}catch(c){i(c)}};if(o&&o>0&&s.activeTransactions>=o)return void s.pendingTransactions.push(l);l()}catch(s){i(s)}}function IN(t){gg(t);let e=Qa(t),r=Qn[e],n=r.forages;for(let i of n)i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null);return t.db=null,r.db=null,Yc(t,!1).then(i=>(t.db=i,CN(t,1)?Yc(t,!0):i)).then(i=>{t.db=r.db=i;for(let s of n)s._dbInfo.db=i}).catch(i=>{throw Y_(t,i),i})}function hH(t){let e=this,r=(e._initReady??e.ready).bind(e),n=$r(r().then(()=>{if(e._dbInfo){let i=Ao(e._dbInfo);if(i&&i.dbReady)return i.dbReady}}),"ready");return xe(n,t),n}var pH={_driver:"asyncStorage",_initStorage:async function(t){let e=this,r={db:null};for(let c in t)Object.assign(r,{[c]:t[c]});if(r.idbFactory=await async function(c){if(c.bucket?.name){let u=typeof navigator<"u"?navigator:void 0,f=u?.storageBuckets;if(f&&typeof f.open=="function")try{return(await f.open(c.bucket.name,{durability:c.bucket.durability,persisted:c.bucket.persisted})).indexedDB??null}catch{}}return Q_()}(t),!r.idbFactory)throw Qe("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:vi});SN(r),Qa(r);let n=wg(r);n.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=hH);let i=[];function s(){return Promise.resolve()}for(let c of n.forages)if(c!==e){let u=(c._initReady??c.ready).bind(c);i.push(u().catch(s))}let o=n.forages.slice(0);await Promise.all(i),r.db=n.db;let a=await Yc(r,!1);if(r.db=a,CN(r,e._defaultConfig.version??1)){let c=await Yc(r,!0);r.db=n.db=c}else r.db=n.db=a;e._dbInfo=r;for(let c of o)c!==e&&(c._dbInfo.db=r.db,c._dbInfo.version=r.version);let l=function(c,u){if(c.prewarmTransactions===!1)return;if(u.prewarmed||u.prewarmPromise)return u.prewarmPromise||Promise.resolve();let f=new Promise(d=>{try{let h=Rr(c),g=TN(c,Ki),m=g?c.db.transaction(h,Ki,g):c.db.transaction(h,Ki);m.objectStore(h).count(),m.oncomplete=()=>d(),m.onabort=m.onerror=()=>d()}catch{d()}});return u.prewarmPromise=f,f.finally(()=>{u.prewarmPromise=null,u.prewarmed=!0}),f}(r,n);l&&l.catch(()=>{})},_support:()=>function(){try{let t=Q_();if(!t)return!1;let e=kN(),r=e?.userAgent??"";return!(e&&/Safari/.test(r)&&!/Chrome/.test(r))||new Promise(n=>{let i=t.open("__localforage_test");i.onsuccess=()=>{i.result.close(),t.deleteDatabase("__localforage_test"),n(!0)},i.onerror=()=>n(!1)})}catch{return!1}}(),iterate:function(t,e){let r=this,n=new Promise((s,o)=>{r.ready().then(()=>An(r._dbInfo)).then(()=>{Yr(r._dbInfo,Ki,(a,l)=>{if(a)return o(a);try{let c=Rr(r._dbInfo),u=l.objectStore(c).openCursor(),f=1;u.onsuccess=()=>{let d=u.result;if(d){let h=d.value;h===void 0&&(h=null),Sd(h)&&(h=kd(h));let g=t(h,d.key,f++);g!==void 0?s(g):d.continue()}else s(void 0)},u.onerror=()=>o(u.error)}catch(c){o(c)}})}).catch(o)}),i=$r(n,"iterate");return xe(i,e),i},getItem:function(t,e){let r=this;t=ht(t);let n=new Promise((s,o)=>{r.ready().then(()=>An(r._dbInfo)).then(()=>{Yr(r._dbInfo,Ki,(a,l)=>{if(a)return o(a);try{let c=Rr(r._dbInfo),u=l.objectStore(c).get(t);u.onsuccess=()=>{let f=u.result;f===void 0&&(f=null),Sd(f)&&(f=kd(f)),s(f)},u.onerror=()=>o(u.error)}catch(c){o(c)}})}).catch(o)}),i=$r(n,"getItem",{key:t},"OPERATION_FAILED");return xe(i,e),i},getItems:function(t,e){let r=this,n=t.map(o=>ht(o)),i=new Promise(async(o,a)=>{try{if(await r.ready(),await An(r._dbInfo),n.length===0)return void o([]);let l=r._dbInfo,c=l.maxBatchSize??n.length,u=new Array(n.length),f=(g,m)=>new Promise((y,v)=>{Yr(l,Ki,(b,k)=>{if(b)return v(b);try{let E=Rr(l),_=k.objectStore(E),x=null,S=g.length;g.forEach((C,T)=>{let P=_.get(C);P.onsuccess=()=>{let R=P.result;R===void 0&&(R=null),Sd(R)&&(R=kd(R)),u[m+T]={key:C,value:R},S-=1,S===0&&y()},P.onerror=()=>{x=P.error||new Error(`Failed to get "${C}"`)}}),k.onabort=k.onerror=()=>{v(x||k.error||new Error("Failed to get items transaction"))}}catch(E){v(E)}})}),d=Yi(n,c),h=0;for(let g of d)await f(g,h),h+=g.length;o(u)}catch(l){a(l)}}),s=$r(i,"getItems",{keys:n},"OPERATION_FAILED");return xe(s,e),s},setItem:async function(t,e,r){let n=this;t=ht(t);let i=new Promise(async(o,a)=>{let l;try{l=n._dbInfo,l&&l.db||(await n.ready(),l=n._dbInfo),l.coalesceWrites&&l.coalesceReadConsistency!=="eventual"&&await An(l),pg.call(e)==="[object Blob]"&&(await xd(l)||(e=await U_(e)));let c=e===void 0?null:e,u=!!l.coalesceWrites,f=l.coalesceReadConsistency==="eventual",d=u&&f&&!!l.coalesceFireAndForget;if(u){let h=XO(l,{type:"set",key:t,value:c},{resolveImmediately:d});return d?void o(c):void h.then(g=>o(g)).catch(a)}Yr(l,Eo,(h,g)=>{if(h)return a(h);try{let m=Rr(l),y=g.objectStore(m).put(c,t);g.oncomplete=()=>{o(c)},g.onabort=g.onerror=()=>{let v=y.error||g.error;a(v)}}catch(m){a(m)}})}catch(c){a(c)}}),s=$r(i,"setItem",{key:t});return xe(s,r),s},setItems:function(t,e){let r=this,n=yg(t),i=n.map(a=>a.key),s=new Promise(async(a,l)=>{try{await r.ready(),await An(r._dbInfo);let c=r._dbInfo,u;n.some(g=>pg.call(g.value)==="[object Blob]")&&(u=await xd(c));let f=Yi(n,c.maxBatchSize??n.length),d=[],h=async g=>{let m=[];for(let y of g){let v=y.value;v===void 0&&(v=null),pg.call(y.value)==="[object Blob]"&&((typeof u=="boolean"?u:await xd(c))||(v=await U_(y.value))),m.push({key:y.key,value:v})}return new Promise((y,v)=>{Yr(c,Eo,(b,k)=>{if(b)return v(b);try{let E=Rr(c),_=k.objectStore(E),x=null;for(let S of m){let C=_.put(S.value,S.key);C.onerror=()=>{x=C.error||new Error(`Failed to set "${String(S.key)}"`)}}k.oncomplete=()=>y(m),k.onabort=k.onerror=()=>{v(x||k.error||new Error("Failed to set items transaction"))}}catch(E){v(E)}})})};for(let g of f){let m=await h(g);d.push(...m)}a(d)}catch(c){l(c)}}),o=$r(s,"setItems",{keys:i},"OPERATION_FAILED");return xe(o,e),o},removeItem:function(t,e){let r=this;t=ht(t);let n=new Promise((s,o)=>{(async()=>{let a=r._dbInfo;a&&a.db||(await r.ready(),a=r._dbInfo);let l=!!a.coalesceWrites,c=a.coalesceReadConsistency==="eventual",u=l&&c&&!!a.coalesceFireAndForget;if(l){let f=XO(a,{type:"remove",key:t},{resolveImmediately:u});return u?void s():void f.then(()=>s()).catch(o)}Yr(a,Eo,(f,d)=>{if(f)return o(f);try{let h=Rr(a),g=d.objectStore(h).delete(t);d.oncomplete=()=>s(),d.onerror=()=>o(g.error),d.onabort=()=>{let m=g.error||d.error;o(m)}}catch(h){o(h)}})})().catch(o)}),i=$r(n,"removeItem",{key:t});return xe(i,e),i},removeItems:function(t,e){let r=this,n=t.map(o=>ht(o)),i=new Promise(async(o,a)=>{try{if(await r.ready(),n.length===0)return void o();let l=r._dbInfo,c=l.maxBatchSize??n.length;await An(l,{force:!0});let u=d=>new Promise((h,g)=>{Yr(l,Eo,(m,y)=>{if(m)return g(m);try{let v=Rr(l),b=y.objectStore(v),k=null;for(let E of d){let _=b.delete(E);_.onerror=()=>{k=_.error||new Error(`Failed to remove "${E}"`)}}y.oncomplete=()=>h(),y.onabort=y.onerror=()=>{g(k||y.error||new Error("Failed to remove items transaction"))}}catch(v){g(v)}})}),f=Yi(n,c);for(let d of f)await u(d);o()}catch(l){a(l)}}),s=$r(i,"removeItems",{keys:n});return xe(s,e),s},runTransaction:function(t,e,r){let n=this,i=new Promise(async(o,a)=>{try{await n.ready();let l=n._dbInfo,c;await An(l,{force:!0});try{c=await xd(l)}catch{c=void 0}Yr(l,t,(u,f)=>{if(!u&&f)try{let d=Rr(l),h=f.objectStore(d),g=c,m=()=>{try{return f.objectStore(d),!0}catch{return!1}},y=async()=>(typeof g=="boolean"||(g=await xd(l,f.db)),g),v=()=>{if(t===Ki)throw Qe("TRANSACTION_READONLY","Transaction is readonly",{driver:vi,operation:"runTransaction",transactionMode:t})},b={get:x=>new Promise((S,C)=>{let T=h.get(ht(x));T.onsuccess=()=>{let P=T.result;P===void 0&&(P=null),Sd(P)&&(P=kd(P)),S(P)},T.onerror=()=>C(T.error)}),set:async(x,S)=>{v();let C=S;if(C===void 0&&(C=null),pg.call(S)==="[object Blob]"&&(await y()||(C=await U_(S))),!m())throw new Error("Transaction became inactive while preparing data.");return new Promise((T,P)=>{let R=h.put(C,ht(x));R.onsuccess=()=>T(C),R.onerror=()=>P(R.error)})},remove:x=>new Promise((S,C)=>{v();let T=h.delete(ht(x));T.onsuccess=()=>S(),T.onerror=()=>C(T.error)}),keys:()=>new Promise((x,S)=>{let C=[],T=h.openKeyCursor();T.onsuccess=()=>{let P=T.result;P?(C.push(P.key),P.continue()):x(C)},T.onerror=()=>S(T.error)}),iterate:x=>new Promise((S,C)=>{let T=h.openCursor(),P=1;T.onsuccess=()=>{let R=T.result;if(R){let N=R.value;N===void 0&&(N=null),Sd(N)&&(N=kd(N));let F=x(N,R.key,P++);F!==void 0?S(F):R.continue()}else S(void 0)},T.onerror=()=>C(T.error)}),clear:()=>new Promise((x,S)=>{v();let C=h.clear();C.onsuccess=()=>x(),C.onerror=()=>S(C.error)})},k=Promise.resolve().then(()=>e(b)),E=new Promise((x,S)=>{f.oncomplete=()=>x(),f.onabort=()=>S(f.error||new Error("Transaction aborted")),f.onerror=()=>S(f.error||new Error("Transaction error"))}),_=k.catch(x=>{try{f.abort()}catch{}throw x});Promise.allSettled([_,E]).then(([x,S])=>{x.status!=="rejected"?S.status!=="rejected"?o(x.value):a(S.reason):a(x.reason)})}catch(d){a(d)}else a(u||new Error("Failed to create transaction"))})}catch(l){a(l)}}),s=$r(i,"runTransaction",{transactionMode:t});return xe(s,r),s},clear:function(t){let e=this,r=new Promise((i,s)=>{e.ready().then(()=>An(e._dbInfo,{force:!0})).then(()=>{Yr(e._dbInfo,Eo,(o,a)=>{if(o)return s(o);try{let l=Rr(e._dbInfo),c=a.objectStore(l).clear();a.oncomplete=()=>i(),a.onabort=a.onerror=()=>{let u=c.error||a.error;s(u)}}catch(l){s(l)}})}).catch(s)}),n=$r(r,"clear");return xe(n,t),n},length:function(t){let e=this,r=new Promise((i,s)=>{e.ready().then(()=>An(e._dbInfo)).then(()=>{Yr(e._dbInfo,Ki,(o,a)=>{if(o)return s(o);try{let l=Rr(e._dbInfo),c=a.objectStore(l).count();c.onsuccess=()=>i(c.result),c.onerror=()=>s(c.error)}catch(l){s(l)}})}).catch(s)}),n=$r(r,"length");return xe(n,t),n},key:function(t,e){let r=this,n=new Promise((s,o)=>{t<0?s(null):r.ready().then(()=>An(r._dbInfo)).then(()=>{Yr(r._dbInfo,Ki,(a,l)=>{if(a)return o(a);try{let c=Rr(r._dbInfo),u=l.objectStore(c),f=!1,d=u.openKeyCursor();d.onsuccess=()=>{let h=d.result;h?t===0||f?s(h.key):(f=!0,h.advance(t)):s(null)},d.onerror=()=>o(d.error)}catch(c){o(c)}})}).catch(o)}),i=$r(n,"key",{keyIndex:t});return xe(i,e),i},keys:function(t){let e=this,r=new Promise((i,s)=>{e.ready().then(()=>An(e._dbInfo)).then(()=>{Yr(e._dbInfo,Ki,(o,a)=>{if(o)return s(o);try{let l=Rr(e._dbInfo),c=a.objectStore(l).openKeyCursor(),u=[];c.onsuccess=()=>{let f=c.result;f?(u.push(f.key),f.continue()):i(u)},c.onerror=()=>s(c.error)}catch(l){s(l)}})}).catch(s)}),n=$r(r,"keys");return xe(n,t),n},dropInstance:function(t,e){let r=this,n=r.config(),i={...typeof t=="object"?t:{}};if(i.name||(i.name=n.name,i.storeName||(i.storeName=n.storeName)),!i.name){let g=Promise.reject(Qe("INVALID_ARGUMENT","Invalid arguments",{driver:vi,operation:"dropInstance"})),m=$r(g,"dropInstance",{name:i.name,storeName:i.storeName});return xe(m,e),m}let s=r._dbInfo,o={...i,idbFactory:s?.idbFactory??void 0,coalesceWrites:s?.coalesceWrites,coalesceWindowMs:s?.coalesceWindowMs,coalesceReadConsistency:s?.coalesceReadConsistency,coalesceMaxBatchSize:s?.coalesceMaxBatchSize,coalesceFireAndForget:s?.coalesceFireAndForget};!o.bucket&&n.bucket&&(o.bucket=n.bucket);let a=i.name,l=r._dbInfo?.db??null,c=a===n.name&&l!==null,u=Qa(o),f,d;f=c&&l?Promise.resolve(l):Yc(o,!1).then(g=>{let m=Qn[u];if(m){let y=m.forages;m.db=g;for(let v of y)v._dbInfo.db=g}return g}),d=i.storeName?f.then(async g=>{if(await An(o,{force:!0,scope:"database"}),!g.objectStoreNames.contains(i.storeName))return void JO(o);let m=g.version+1;gg(o);let y=Qn[u],v=y?.forages||[];g.close();for(let k of v)k._dbInfo.db=null,k._dbInfo.version=m;return new Promise((k,E)=>{let _=W_(o);if(!_)return E(Qe("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:vi}));let x=_.open(a,m);x.onerror=()=>{let S=x.result;S&&S.close(),E(x.error||new Error("Failed to open database"))},x.onupgradeneeded=()=>{let S=x.result;S.objectStoreNames.contains(i.storeName)&&S.deleteObjectStore(i.storeName)},x.onsuccess=()=>{let S=x.result;k(S)}}).then(k=>{if(y){y.db=k,JO(o);for(let E of v)E._dbInfo.db=k,K_(E._dbInfo)}}).catch(k=>{throw y&&Y_(i,k),k})}):f.then(async g=>{await An(o,{force:!0,scope:"database"}),gg(o);let m=Qn[u],y=m?.forages||[];g.close();for(let v of y)v._dbInfo.db=null;return new Promise((v,b)=>{let k=W_(o);if(!k)return b(Qe("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:vi}));let E=k.deleteDatabase(a);E.onerror=()=>{b(E.error||new Error("Failed to delete database"))},E.onblocked=()=>{},E.onsuccess=()=>{v()}}).then(()=>{if(m){m.db=null;for(let v of y)K_(v._dbInfo);delete Qn[u]}}).catch(v=>{throw m&&Y_(o,v),v})});let h=$r(d,"dropInstance",{name:i.name,storeName:i.storeName});return xe(h,e),h},getPerformanceStats:function(){let t=this._dbInfo;if(!t)return{totalWrites:0,coalescedWrites:0,transactionsSaved:0,avgCoalesceSize:0};if(!Ao(t))return{totalWrites:0,coalescedWrites:0,transactionsSaved:0,avgCoalesceSize:0};let e=EN(t);if(!e)return{totalWrites:0,coalescedWrites:0,transactionsSaved:0,avgCoalesceSize:0};let r=e.stats,n=r.coalescedWrites>0?r.coalescedWrites/(r.totalWrites-r.transactionsSaved||1):0;return{totalWrites:r.totalWrites,coalescedWrites:r.coalescedWrites,transactionsSaved:r.transactionsSaved,avgCoalesceSize:parseFloat(n.toFixed(2))}}},Co="localStorageWrapper",Pn=(t,e,r,n="OPERATION_FAILED")=>t.catch(i=>{let s=i instanceof Error&&i.message?i.message:`localStorage ${e} failed`;throw Ss(i,n,s,{driver:Co,operation:e,...r??{}})});function eN(t,e){let r=t.name+"/";return t.storeName!==e.storeName&&(r+=t.storeName+"/"),r}function mH(){if(!function(){let t="_localforage_support_test";try{return localStorage.setItem(t,"true"),localStorage.removeItem(t),!1}catch{return!0}}())return!0;try{return localStorage.length>0}catch{return!1}}function tN(t){let e=Pn(this.ready().then(()=>{let r=this._dbInfo.keyPrefix;for(let n=localStorage.length-1;n>=0;n--){let i=localStorage.key(n);i&&i.indexOf(r)===0&&localStorage.removeItem(i)}}),"clear");return xe(e,t),e}function rN(t,e){let r=ht(t),n=Pn(this.ready().then(()=>{let i=this._dbInfo,s=localStorage.getItem(i.keyPrefix+r);return s===null?null:i.serializer.deserialize(s)}),"getItem",{key:r});return xe(n,e),n}function nN(t,e){let r=Pn(this.ready().then(()=>{let n=this._dbInfo,i=n.keyPrefix,s=i.length,o=localStorage.length,a=1;for(let l=0;l{let r=this._dbInfo,n=localStorage.length,i=[];for(let s=0;s{let i=this._dbInfo;localStorage.removeItem(i.keyPrefix+r)}),"removeItem",{key:r});return xe(n,e),n}async function sN(t,e,r){let n=ht(t),i=Pn(this.ready().then(async()=>{let s=e===void 0?null:e,o=await this._dbInfo.serializer.serialize(s);try{return localStorage.setItem(this._dbInfo.keyPrefix+n,o),s}catch(a){throw a instanceof Error&&(a.name==="QuotaExceededError"||a.name==="NS_ERROR_DOM_QUOTA_REACHED")?Ss(a,"QUOTA_EXCEEDED",a.message||"Storage quota exceeded",{driver:Co,operation:"setItem",key:n}):Ss(a,"OPERATION_FAILED","Failed to set item in localStorage",{driver:Co,operation:"setItem",key:n})}}),"setItem",{key:n});return xe(i,r),i}var gH={_driver:"localStorageWrapper",_initStorage:async function(t){let e={...t,keyPrefix:eN(t,this._defaultConfig),serializer:Ga};if(!mH())throw Qe("DRIVER_UNAVAILABLE","localStorage not usable",{driver:Co});this._dbInfo=e},_support:async()=>function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:nN,getItem:rN,getItems:function(t,e){let r=t.map(i=>ht(i)),n=Pn(this.ready().then(()=>{let i=this._dbInfo,s=[],o=i.maxBatchSize??r.length;for(let a of Yi(r,o))for(let l of a){let c=localStorage.getItem(i.keyPrefix+l);if(c===null){s.push({key:l,value:null});continue}let u=i.serializer.deserialize(c);s.push({key:l,value:u})}return s}),"getItems",{keys:r});return xe(n,e),n},setItem:sN,setItems:function(t,e){let r=yg(t),n=r.map(s=>s.key),i=Pn(this.ready().then(async()=>{let s=this._dbInfo,o=[],a=s.maxBatchSize??r.length,l=new Map;for(let c of Yi(r,a))for(let u of c){let f=u.value===void 0?null:u.value,d=await s.serializer.serialize(f);l.has(u.key)||l.set(u.key,localStorage.getItem(s.keyPrefix+u.key));try{localStorage.setItem(s.keyPrefix+u.key,d),o.push({key:u.key,value:f})}catch(h){for(let[g,m]of l.entries()){let y=s.keyPrefix+g;m===null?localStorage.removeItem(y):localStorage.setItem(y,m)}throw h instanceof Error&&(h.name==="QuotaExceededError"||h.name==="NS_ERROR_DOM_QUOTA_REACHED")?Ss(h,"QUOTA_EXCEEDED",h.message||"Storage quota exceeded",{driver:Co,operation:"setItems",key:u.key}):Ss(h,"OPERATION_FAILED","Failed to set items in localStorage",{driver:Co,operation:"setItems",key:u.key})}}return o}),"setItems",{keys:n});return xe(i,e),i},removeItem:iN,removeItems:function(t,e){let r=t.map(i=>ht(i)),n=Pn(this.ready().then(()=>{let i=this._dbInfo,s=i.maxBatchSize??r.length;for(let o of Yi(r,s))for(let a of o)localStorage.removeItem(i.keyPrefix+a)}),"removeItems",{keys:r});return xe(n,e),n},clear:tN,length:function(t){let e=Pn(j_.call(this).then(r=>r.length),"length");return xe(e,t),e},key:function(t,e){let r=Pn(this.ready().then(()=>{let n=this._dbInfo.keyPrefix,i=[];for(let s=0;s=i.length?null:i[t]}),"key",{keyIndex:t});return xe(r,e),r},keys:j_,runTransaction(t,e,r){let n=()=>{if(t==="readonly")throw Qe("TRANSACTION_READONLY","Transaction is readonly",{driver:Co,operation:"runTransaction",transactionMode:t})},i={get:o=>rN.call(this,o),set:(o,a)=>(n(),sN.call(this,o,a)),remove:o=>(n(),iN.call(this,o)),keys:()=>j_.call(this),iterate:o=>nN.call(this,o),clear:()=>(n(),tN.call(this))},s=Pn(Promise.resolve().then(()=>e(i)).catch(o=>{throw o}),"runTransaction",{transactionMode:t});return xe(s,r),s},dropInstance:function(t,e){let r={...t||{}};if(!r.name){let s=this.config();r.name=s.name,r.storeName=s.storeName}let n=r.name?new Promise(s=>{let o=r.storeName?eN(r,this._defaultConfig):`${r.name}/`;for(let a=localStorage.length-1;a>=0;a--){let l=localStorage.key(a);l&&l.indexOf(o)===0&&localStorage.removeItem(l)}s()}):Promise.reject(Qe("INVALID_ARGUMENT","Invalid arguments",{driver:Co,operation:"dropInstance"})),i=Pn(n,"dropInstance",{name:r.name,storeName:r.storeName??this._defaultConfig.storeName});return xe(i,e),i}},Hc="memoryStorageWrapper",Gc={},In=(t,e,r,n="OPERATION_FAILED")=>t.catch(i=>{let s=i instanceof Error&&i.message?i.message:`memoryStorage ${e} failed`;throw Ss(i,n,s,{driver:Hc,operation:e,...r??{}})});function yH(t,e){return Gc[t]=Gc[t]||{},Gc[t][e]=Gc[t][e]||new Map,Gc[t][e]}async function Qc(t){if(t===null||typeof t!="object")return t;if(typeof structuredClone=="function")return structuredClone(t);let e=await Ga.serialize(t);return Ga.deserialize(e)}async function q_(t){return Qc(t===void 0?null:t)}var wH={_driver:Hc,_initStorage:async function(t){let e=function(n){if(n.name)return n.name;throw Qe("INVALID_CONFIG","Memory storage database name is not configured.",{driver:Hc,configKey:"name"})}(t),r=function(n){if(n.storeName)return n.storeName;throw Qe("INVALID_CONFIG","Memory storage storeName is not configured.",{driver:Hc,configKey:"storeName"})}(t);this._dbInfo={...t,name:e,storeName:r,serializer:Ga,store:yH(e,r)}},_support:!0,iterate:function(t,e){let r=In(this.ready().then(async()=>{let n=1;for(let[i,s]of this._dbInfo.store.entries()){let o=t(await Qc(s),i,n++);if(o!==void 0)return o}}),"iterate");return xe(r,e),r},getItem:function(t,e){let r=ht(t),n=In(this.ready().then(async()=>this._dbInfo.store.has(r)?Qc(this._dbInfo.store.get(r)):null),"getItem",{key:r});return xe(n,e),n},getItems:function(t,e){let r=t.map(i=>ht(i)),n=In(this.ready().then(async()=>{let i=[],s=this._dbInfo.maxBatchSize??r.length;for(let o of Yi(r,s))for(let a of o){if(!this._dbInfo.store.has(a)){i.push({key:a,value:null});continue}let l=await Qc(this._dbInfo.store.get(a));i.push({key:a,value:l})}return i}),"getItems",{keys:r});return xe(n,e),n},setItem:function(t,e,r){let n=ht(t),i=In(this.ready().then(async()=>{let s=await q_(e);return this._dbInfo.store.set(n,s),s}),"setItem",{key:n});return xe(i,r),i},setItems:function(t,e){let r=yg(t),n=r.map(s=>s.key),i=In(this.ready().then(async()=>{let s=this._dbInfo.maxBatchSize??r.length,o=[];for(let a of Yi(r,s)){let l=[];for(let c of a)l.push({key:c.key,value:await q_(c.value)});for(let c of l)this._dbInfo.store.set(c.key,c.value),o.push({key:c.key,value:c.value})}return o}),"setItems",{keys:n});return xe(i,e),i},removeItem:function(t,e){let r=ht(t),n=In(this.ready().then(()=>{this._dbInfo.store.delete(r)}),"removeItem",{key:r});return xe(n,e),n},removeItems:function(t,e){let r=t.map(i=>ht(i)),n=In(this.ready().then(()=>{let i=this._dbInfo.maxBatchSize??r.length;for(let s of Yi(r,i))for(let o of s)this._dbInfo.store.delete(o)}),"removeItems",{keys:r});return xe(n,e),n},clear:function(t){let e=In(this.ready().then(()=>{this._dbInfo.store.clear()}),"clear");return xe(e,t),e},length:function(t){let e=In(this.ready().then(()=>this._dbInfo.store.size),"length");return xe(e,t),e},key:function(t,e){let r=In(this.ready().then(()=>Array.from(this._dbInfo.store.keys())[t]??null),"key",{keyIndex:t});return xe(r,e),r},keys:function(t){let e=In(this.ready().then(()=>Array.from(this._dbInfo.store.keys())),"keys");return xe(e,t),e},runTransaction:function(t,e,r){let n=In(this.ready().then(async()=>{let i=this._dbInfo.store,s=t==="readwrite"?new Map(i):null,o=()=>{if(t==="readonly")throw Qe("TRANSACTION_READONLY","Transaction is readonly",{driver:Hc,operation:"runTransaction",transactionMode:t})},a={get:async l=>{let c=ht(l);return i.has(c)?Qc(i.get(c)):null},set:async(l,c)=>{o();let u=ht(l),f=await q_(c);return i.set(u,f),f},remove:async l=>{o(),i.delete(ht(l))},keys:async()=>Array.from(i.keys()),iterate:async l=>{let c=1;for(let[u,f]of i.entries()){let d=l(await Qc(f),u,c++);if(d!==void 0)return d}},clear:async()=>{o(),i.clear()}};try{return await e(a)}catch(l){if(s){i.clear();for(let[c,u]of s.entries())i.set(c,u)}throw l}}),"runTransaction",{transactionMode:t});return xe(n,r),n},dropInstance:function(t,e){let r=In(this.ready().then(()=>{let n=this._dbInfo,i=t?.name??n.name;if(!i)throw Qe("INVALID_ARGUMENT","Invalid arguments",{driver:Hc,operation:"dropInstance"});let s=t!==void 0,o=typeof t?.storeName=="string",a=o?t.storeName:n.storeName,l=Gc[i];if(l)if(s&&!o)for(let c of Object.values(l))c.clear();else l[a]?.clear()}),"dropInstance",{name:t?.name??this._dbInfo.name,storeName:t?.storeName??this._dbInfo.storeName});return xe(r,e),r}},Z_=class extends Error{constructor(e="Plugin aborted the operation"){super(e),this.name="PluginAbortError"}},vH={LENIENT_WITH_ENCRYPTION:{condition:(t,e)=>t.some(r=>r.name==="encryption")&&e.pluginErrorPolicy==="lenient",message:"[localspace] Warning: Using lenient error policy with encryption plugin may silently fail decryption. Consider using strict policy for security-critical plugins."},LENIENT_WITH_COMPRESSION:{condition:(t,e)=>t.some(r=>r.name==="compression")&&e.pluginErrorPolicy==="lenient",message:"[localspace] Warning: Using lenient error policy with compression plugin may cause data corruption if decompression fails."},ENCRYPTION_BEFORE_COMPRESSION:{condition:t=>{let e=t.findIndex(s=>s.name==="encryption"),r=t.findIndex(s=>s.name==="compression");if(e===-1||r===-1)return!1;let n=t[e]?.priority??0,i=t[r]?.priority??0;return n>i||n===i&&e{let e=t.find(n=>n.name==="quota");if(!e)return!1;let r=e.priority??0;return t.some(n=>n.name!=="quota"&&n.name!=="sync"&&(n.priority??0)n.plugin),r=this.host._config;for(let[n,i]of Object.entries(vH))this.warningsEmitted.has(n)||i.condition(e,r)&&this.warningsEmitted.add(n)}hasPlugins(){return this.pluginRegistry.length>0}registerPlugins(e){for(let r of e)r&&this.pluginRegistry.push({plugin:r,order:this.orderCounter++});this.sortPlugins(),this.validatePluginCombinations()}sortPlugins(){this.pluginRegistry.sort((e,r)=>{let n=e.plugin.priority??0,i=r.plugin.priority??0;return n===i?e.order-r.order:i-n})}getActivePlugins(e){let r=e?.reverse??!1,n=this.pluginRegistry.map(i=>i.plugin).filter(i=>{if(this.disabled.has(i))return!1;let s=i.enabled;if(typeof s=="function")try{return!!s()}catch{return!1}return s!==!1});return r?n.slice().reverse():n}async ensureInitialized(){for(let e of this.getActivePlugins()){if(this.initialized.has(e))continue;if(typeof e.onInit!="function"){this.initialized.add(e);continue}let r=this.initPromises.get(e);if(r){await r;continue}let n=this.createContext(null),i=(async()=>{try{await e.onInit(n),this.initialized.add(e)}catch(s){if(await this.dispatchPluginError(e,s,"init","lifecycle",void 0,n),(this.host._config.pluginInitPolicy??"fail")==="disable-and-continue")return void this.disabled.add(e);throw s}finally{this.initPromises.delete(e)}})();this.initPromises.set(e,i),await i}}createContext(e){return{instance:this.host,driver:this.host.driver?this.host.driver():null,dbInfo:this.host._dbInfo??null,config:this.host._config,metadata:this.sharedMetadata,operation:e,operationState:Object.create(null)}}async beforeSet(e,r,n){let i=r;for(let s of this.getActivePlugins())s.beforeSet&&(i=await this.invokeValueHook(s,()=>s.beforeSet(e,i,n),"before","setItem",e,n,i));return i}async afterSet(e,r,n){for(let i of this.getActivePlugins({reverse:!0}))i.afterSet&&await this.invokeVoidHook(i,()=>i.afterSet(e,r,n),"after","setItem",e,n)}async beforeGet(e,r){let n=e;for(let i of this.getActivePlugins())i.beforeGet&&(n=await this.invokeValueHook(i,()=>i.beforeGet(n,r),"before","getItem",n,r,n));return n}async afterGet(e,r,n){let i=r;for(let s of this.getActivePlugins({reverse:!0}))s.afterGet&&(i=await this.invokeValueHook(s,()=>s.afterGet(e,i,n),"after","getItem",e,n,i));return i}async beforeRemove(e,r){let n=e;for(let i of this.getActivePlugins())i.beforeRemove&&(n=await this.invokeValueHook(i,()=>i.beforeRemove(n,r),"before","removeItem",n,r,n));return n}async afterRemove(e,r){for(let n of this.getActivePlugins({reverse:!0}))n.afterRemove&&await this.invokeVoidHook(n,()=>n.afterRemove(e,r),"after","removeItem",e,r)}async beforeSetItems(e,r){let n=e;for(let i of this.getActivePlugins())i.beforeSetItems&&(n=await this.invokeValueHook(i,()=>i.beforeSetItems(n,r),"before","setItems",void 0,r,n));return n}async afterSetItems(e,r){let n=e;for(let i of this.getActivePlugins({reverse:!0}))i.afterSetItems&&(n=await this.invokeValueHook(i,()=>i.afterSetItems(n,r),"after","setItems",void 0,r,n));return n}async beforeGetItems(e,r){let n=e;for(let i of this.getActivePlugins())i.beforeGetItems&&(n=await this.invokeValueHook(i,()=>i.beforeGetItems(n,r),"before","getItems",void 0,r,n));return n}async afterGetItems(e,r){let n=e;for(let i of this.getActivePlugins({reverse:!0}))i.afterGetItems&&(n=await this.invokeValueHook(i,()=>i.afterGetItems(n,r),"after","getItems",void 0,r,n));return n}async beforeRemoveItems(e,r){let n=e;for(let i of this.getActivePlugins())i.beforeRemoveItems&&(n=await this.invokeValueHook(i,()=>i.beforeRemoveItems(n,r),"before","removeItems",void 0,r,n));return n}async afterRemoveItems(e,r){for(let n of this.getActivePlugins({reverse:!0}))n.afterRemoveItems&&await this.invokeVoidHook(n,()=>n.afterRemoveItems(e,r),"after","removeItems",void 0,r)}async destroy(){let e=this.pluginRegistry.map(r=>r.plugin).slice().reverse();for(let r of e){if(this.destroyed.has(r)||this.disabled.has(r))continue;if(typeof r.onDestroy!="function"){this.destroyed.add(r);continue}let n=this.createContext(null);try{await r.onDestroy(n)}catch(i){await this.dispatchPluginError(r,i,"destroy","lifecycle",void 0,n)}finally{this.destroyed.add(r)}}}normalizeBatch(e){return yg(e)}shouldPropagate(e,r){return r==="strict"||e instanceof Ha||e instanceof Z_}async dispatchPluginError(e,r,n,i,s,o){let a={plugin:e.name,operation:i,stage:n,key:s,context:o,error:r};if(typeof e.onError=="function")try{return void await e.onError(r,a)}catch{}}async invokeValueHook(e,r,n,i,s,o,a){try{let l=await r();return l===void 0?a:l}catch(l){let c=this.host._config.pluginErrorPolicy??"strict";if(this.shouldPropagate(l,c))throw l;return await this.dispatchPluginError(e,l,n,i,s,o),a}}async invokeVoidHook(e,r,n,i,s,o){try{await r()}catch(a){let l=this.host._config.pluginErrorPolicy??"strict";if(this.shouldPropagate(a,l))throw a;await this.dispatchPluginError(e,a,n,i,s,o)}}},Wc={},Ed={},Td={INDEXEDDB:pH,LOCALSTORAGE:gH,MEMORY:wH},bH=[Td.INDEXEDDB._driver,Td.LOCALSTORAGE._driver],mg={},X_=["dropInstance","setItems","getItems","removeItems","runTransaction"],oN=["clear","getItem","getItems","iterate","key","keys","length","removeItem","removeItems","setItem","setItems","runTransaction"].concat(X_),aN=["setItem","getItem","removeItem","setItems","getItems","removeItems"],_H={description:"",driver:bH.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1,compatibilityMode:!1,coalesceWrites:!1,coalesceWindowMs:8,coalesceReadConsistency:"strong",coalesceFireAndForget:!1,coalesceMaxBatchSize:void 0,pluginInitPolicy:"fail",pluginErrorPolicy:"lenient"},Cd=(t,e)=>{if(t)return r=>{e?.compatibilityMode?t(r):t(r,void 0)}};function xH(t,e){t[e]=function(...r){return t.ready().then(()=>t[e].apply(t,r))}}function kH(t,e){let r=e._driver;if(Wc[r])return Promise.resolve();let n=mg[r];if(n)return n;let i=t.defineDriver(e).finally(()=>{mg[r]===i&&delete mg[r]});return mg[r]=i,i}var e0=class t{constructor(e){Object.defineProperty(this,"INDEXEDDB",{enumerable:!0,configurable:!0,writable:!0,value:"asyncStorage"}),Object.defineProperty(this,"LOCALSTORAGE",{enumerable:!0,configurable:!0,writable:!0,value:"localStorageWrapper"}),Object.defineProperty(this,"MEMORY",{enumerable:!0,configurable:!0,writable:!0,value:"memoryStorageWrapper"}),Object.defineProperty(this,"REACTNATIVEASYNCSTORAGE",{enumerable:!0,configurable:!0,writable:!0,value:"reactNativeAsyncStorageWrapper"}),Object.defineProperty(this,"_defaultConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_driverSet",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pendingDriverInitialization",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_isRunningDefaultDriverSelection",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_manualDriverOverride",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_initDriver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_ready",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_dbInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_driver",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pluginManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rawDriverMethods",{enumerable:!0,configurable:!0,writable:!0,value:{}});let r=[],{plugins:n=[],...i}=e??{};for(let o in Td)if(Object.prototype.hasOwnProperty.call(Td,o)){let a=Td[o],l=a._driver;this[o]=l,r.push(kH(this,a).catch(c=>{}))}this._defaultConfig=L_({},_H),this._config=L_({},this._defaultConfig,i),this._pluginManager=new J_(this,n),this._wrapLibraryMethodsWithReady();let s=r.length>0?Promise.all(r).then(()=>{}):Promise.resolve();this._pendingDriverInitialization=s.then(()=>this._runDefaultDriverSelection()),this._pendingDriverInitialization.then(()=>{this._pendingDriverInitialization=null},()=>{this._pendingDriverInitialization=null})}config(e){if(typeof e=="object"&&e!==null){if(this._ready)return Qe("CONFIG_LOCKED","Can't call config() after LocalSpace has been used.",{operation:"config"});let r=e;for(let i of Object.keys(r)){let s=r[i];if(i==="version"&&typeof s!="number")return Qe("INVALID_CONFIG","Database version must be a number.",{configKey:"version",providedType:typeof s})}let n=this._config;for(let i of Object.keys(r)){let s=r[i];i!=="storeName"||typeof s!="string"?n[i]=s:n.storeName=s.replace(/\W/g,"_")}return!r.driver||this.setDriver(this._config.driver)}if(typeof e=="string"){let r=e;return this._config[r]}return this._config}createInstance(e){return new t(e)}use(e){let r=Array.isArray(e)?e:[e];return this._pluginManager.registerPlugins(r),this._refreshPluginWrappers(),this}async destroy(){await this._pluginManager.ensureInitialized(),await this._pluginManager.destroy()}async defineDriver(e,r,n){let i=new Promise(async(o,a)=>{try{let l=e._driver,c=Qe("DRIVER_COMPLIANCE","Custom driver not compliant",{driver:l});if(!e._driver)return void a(c);let u=e,f=oN.concat("_initStorage");for(let h of f){let g=!uH(X_,h),m=u[h];if((g||m)&&typeof m!="function")return void a(c)}(()=>{let h=g=>function(...m){let y=Qe("UNSUPPORTED_OPERATION",`Method ${g} is not implemented by the current driver`,{operation:g}),v=m[m.length-1];return typeof v=="function"&&v(y),Promise.reject(y)};for(let g of X_)u[g]||(u[g]=h(g))})();let d=h=>{Wc[l],Wc[l]=e,Ed[l]=h,o()};"_support"in e?e._support&&typeof e._support=="function"?d(await e._support()):d(!!e._support):d(!0)}catch(l){a(l)}}),s=this._getCallbackOptions();return Vc(i,r,Cd(n,s),s),i}driver(){return this._driver||null}async getDriver(e,r,n){let i=Wc[e]?Promise.resolve(Wc[e]):Promise.reject(Qe("DRIVER_NOT_FOUND","Driver not found.",{driver:e})),s=this._getCallbackOptions();return Vc(i,r,Cd(n,s),s),i}async getSerializer(e){let r=Promise.resolve(Ga);return Vc(r,e,void 0,this._getCallbackOptions()),r}async ready(e){let r=(this._driverSet??this._pendingDriverInitialization??Promise.resolve()).then(()=>(this._ready===null&&(this._ready=this._initDriver?this._initDriver():Promise.resolve()),this._ready)),n=this._getCallbackOptions();return Vc(r,e,Cd(e,n),n),r}async setDriver(e,r,n){this._pendingDriverInitialization&&!this._isRunningDefaultDriverSelection&&await this._pendingDriverInitialization.catch(()=>{}),this._isRunningDefaultDriverSelection||(this._manualDriverOverride=!0),fN(e)||(e=[e]);let i=e,s=await this._resolveSupportedDrivers(i),o=this._getCallbackOptions();if(s.length===0){let f=Qe("DRIVER_UNAVAILABLE","No available storage method found.",{attemptedDrivers:i}),d=Promise.resolve().then(()=>{throw f});return this._driverSet=d,Vc(d,r,Cd(n,o),o),d}let a=()=>{this._config.driver=this.driver()??void 0},l=async f=>{this._extend(f),this._driver=f._driver,a();let d=this._initStorage;return this._ready=typeof d=="function"?d.call(this,this._config):Promise.resolve(),await this._ready,this._ready},c=f=>async()=>{let d=0;return(async()=>{for(;dPromise.resolve()):Promise.resolve();return this._driverSet=u.then(async()=>{let f=s[0];this._dbInfo=null,this._ready=null;let d=await this.getDriver(f);this._driver=d._driver,a(),this._wrapLibraryMethodsWithReady(),this._initDriver=c(s)}).catch(()=>{throw a(),Qe("DRIVER_UNAVAILABLE","No available storage method found.",{attemptedDrivers:s})}),Vc(this._driverSet,r,Cd(n,o),o),this._driverSet}supports(e){return!!Ed[e]||this._isDriverForcedByInstanceConfig(e)}_extend(e){L_(this,e),this._capturePluginAwareMethods(e)}_capturePluginAwareMethods(e){for(let r of aN){let n=e[r];typeof n=="function"&&(this._rawDriverMethods[r]=n.bind(this))}this._refreshPluginWrappers()}_refreshPluginWrappers(){for(let e of aN){let r=this._rawDriverMethods[e];if(r)if(this._pluginManager&&this._pluginManager.hasPlugins())switch(e){case"setItem":this[e]=this._createSetItemWrapper(r);break;case"getItem":this[e]=this._createGetItemWrapper(r);break;case"removeItem":this[e]=this._createRemoveItemWrapper(r);break;case"setItems":this[e]=this._createSetItemsWrapper(r);break;case"getItems":this[e]=this._createGetItemsWrapper(r);break;case"removeItems":this[e]=this._createRemoveItemsWrapper(r);break;default:this[e]=r}else this[e]=r}}_createSetItemWrapper(e){return(r,n,i)=>{let s=typeof i=="function"?i:void 0;return xe((async()=>{await this._pluginManager.ensureInitialized();let o=this._pluginManager.createContext("setItem");o.operationState.originalValue=n;let a=await this._pluginManager.beforeSet(r,n,o),l=await e(r,a);return o.operationState.driverResult=l,await this._pluginManager.afterSet(r,a,o),o.operationState.returnValue??o.operationState.originalValue??n})(),s)}}_createGetItemWrapper(e){return(r,n)=>{let i=typeof n=="function"?n:void 0;return xe((async()=>{await this._pluginManager.ensureInitialized();let s=this._pluginManager.createContext("getItem"),o=await this._pluginManager.beforeGet(r,s),a=await e(o);return await this._pluginManager.afterGet(o,a,s)})(),i)}}_createRemoveItemWrapper(e){return(r,n)=>{let i=typeof n=="function"?n:void 0;return xe((async()=>{await this._pluginManager.ensureInitialized();let s=this._pluginManager.createContext("removeItem"),o=await this._pluginManager.beforeRemove(r,s);await e(o),await this._pluginManager.afterRemove(o,s)})(),i)}}_createSetItemsWrapper(e){return(r,n)=>{let i=typeof n=="function"?n:void 0;return xe((async()=>{await this._pluginManager.ensureInitialized();let s=this._pluginManager.createContext("setItems");s.operationState.isBatch=!0;let o=await this._pluginManager.beforeSetItems(r,s),a=this._pluginManager.normalizeBatch(o);s.operationState.batchSize=a.length;let l=[],c=new Map;for(let d of a){let h=this._pluginManager.createContext("setItem");h.operationState.originalValue=d.value,h.operationState.isBatch=!0,h.operationState.batchSize=a.length;let g=await this._pluginManager.beforeSet(d.key,d.value,h),m={key:d.key,value:g,context:h};l.push(m),c.set(d.key,{value:g,context:h})}let u=await e(l),f=await this._pluginManager.afterSetItems(u,s);for(let d of l)await this._pluginManager.afterSet(d.key,d.value,d.context);return f.map(d=>{let h=c.get(d.key),g=h?.context.operationState.returnValue,m=g!==void 0?g:d.value!==void 0?d.value:h?.context.operationState.originalValue??h?.value;return{key:d.key,value:m}})})(),i)}}_createGetItemsWrapper(e){return(r,n)=>{let i=typeof n=="function"?n:void 0,s=(async()=>{await this._pluginManager.ensureInitialized();let o=this._pluginManager.createContext("getItems");o.operationState.isBatch=!0,o.operationState.batchSize=r.length;let a=await this._pluginManager.beforeGetItems(r,o),l=[],c=new Map;for(let h of a){let g=this._pluginManager.createContext("getItem");g.operationState.isBatch=!0,g.operationState.batchSize=a.length;let m=await this._pluginManager.beforeGet(h,g);c.set(m,h),l.push({requestedKey:h,targetKey:m,context:g})}let u=l.map(h=>h.targetKey),f=await e(u),d=[];for(let h=0;hv.targetKey===g.key)?.context??this._pluginManager.createContext("getItem");m.operationState.isBatch=!0,m.operationState.batchSize=a.length;let y=await this._pluginManager.afterGet(g.key,g.value,m);d.push({key:g.key,value:y})}return(await this._pluginManager.afterGetItems(d,o)).map(h=>({key:c.get(h.key)??h.key,value:h.value}))})();return xe(s,i)}}_createRemoveItemsWrapper(e){return(r,n)=>{let i=typeof n=="function"?n:void 0,s=(async()=>{await this._pluginManager.ensureInitialized();let o=this._pluginManager.createContext("removeItems");o.operationState.isBatch=!0,o.operationState.batchSize=r.length;let a=await this._pluginManager.beforeRemoveItems(r,o),l=[];for(let u of a){let f=this._pluginManager.createContext("removeItem");f.operationState.isBatch=!0,f.operationState.batchSize=a.length;let d=await this._pluginManager.beforeRemove(u,f);l.push({key:d,context:f})}let c=l.map(u=>u.key);await e(c),await this._pluginManager.afterRemoveItems(c,o);for(let u of l)await this._pluginManager.afterRemove(u.key,u.context)})();return xe(s,i)}}_getSupportedDrivers(e){let r=[];for(let n of e)(this.supports(n)||this._isDriverForcedByInstanceConfig(n))&&r.push(n);return r}_isDriverForcedByInstanceConfig(e){return e===this.REACTNATIVEASYNCSTORAGE&&!!this._config.reactNativeAsyncStorage}async _resolveSupportedDrivers(e){let r=[];for(let n of e){let i=Wc[n];if(i){if(!Ed[n]&&typeof i._support=="function")try{let s=await i._support();Ed[n]=!!s}catch{Ed[n]=!1}(this.supports(n)||this._isDriverForcedByInstanceConfig(n))&&r.push(n)}}return r}_wrapLibraryMethodsWithReady(){for(let e of oN)xH(this,e)}_runDefaultDriverSelection(){return this._manualDriverOverride?this._driverSet??Promise.resolve():(this._isRunningDefaultDriverSelection=!0,this.setDriver(this._config.driver).then(()=>{this._isRunningDefaultDriverSelection=!1},e=>{throw this._isRunningDefaultDriverSelection=!1,e}))}_getCallbackOptions(){return{compatibilityMode:!(!this._config||typeof this._config.compatibilityMode!="boolean")&&!!this._config.compatibilityMode}}_notInitializedError(e){return Qe("DRIVER_NOT_INITIALIZED","Driver not initialized",{operation:e})}async iterate(e,r){throw this._notInitializedError("iterate")}async getItems(e,r){throw this._notInitializedError("getItems")}async getItem(e,r){throw this._notInitializedError("getItem")}async setItem(e,r,n){throw this._notInitializedError("setItem")}async setItems(e,r){throw this._notInitializedError("setItems")}async removeItem(e,r){throw this._notInitializedError("removeItem")}async removeItems(e,r){throw this._notInitializedError("removeItems")}async runTransaction(e,r,n){throw this._notInitializedError("runTransaction")}async clear(e){throw this._notInitializedError("clear")}async length(e){throw this._notInitializedError("length")}async key(e,r){throw this._notInitializedError("key")}async keys(e){throw this._notInitializedError("keys")}async dropInstance(e,r){throw this._notInitializedError("dropInstance")}};var lN,cN={exports:{}},V_,H_,A$e=(lN||(lN=1,V_=cN,H_=function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",n={};function i(o,a){if(!n[o]){n[o]={};for(var l=0;l>>8,l[2*c+1]=f%256}return l},decompressFromUint8Array:function(o){if(o==null)return s.decompress(o);for(var a=new Array(o.length/2),l=0,c=a.length;l>=1}else{for(u=1,c=0;c>=1}--v==0&&(v=Math.pow(2,k),k++),delete h[y]}else for(u=d[y],c=0;c>=1;--v==0&&(v=Math.pow(2,k),k++),d[m]=b++,y=String(g)}if(y!==""){if(Object.prototype.hasOwnProperty.call(h,y)){if(y.charCodeAt(0)<256){for(c=0;c>=1}else{for(u=1,c=0;c>=1}--v==0&&(v=Math.pow(2,k),k++),delete h[y]}else for(u=d[y],c=0;c>=1;--v==0&&(v=Math.pow(2,k),k++)}for(u=2,c=0;c>=1;for(;;){if(_<<=1,x==a-1){E.push(l(_));break}x++}return E.join("")},decompress:function(o){return o==null?"":o==""?null:s._decompress(o.length,32768,function(a){return o.charCodeAt(a)})},_decompress:function(o,a,l){var c,u,f,d,h,g,m,y=[],v=4,b=4,k=3,E="",_=[],x={val:l(0),position:a,index:1};for(c=0;c<3;c+=1)y[c]=c;for(f=0,h=Math.pow(2,2),g=1;g!=h;)d=x.val&x.position,x.position>>=1,x.position==0&&(x.position=a,x.val=l(x.index++)),f|=(d>0?1:0)*g,g<<=1;switch(f){case 0:for(f=0,h=Math.pow(2,8),g=1;g!=h;)d=x.val&x.position,x.position>>=1,x.position==0&&(x.position=a,x.val=l(x.index++)),f|=(d>0?1:0)*g,g<<=1;m=t(f);break;case 1:for(f=0,h=Math.pow(2,16),g=1;g!=h;)d=x.val&x.position,x.position>>=1,x.position==0&&(x.position=a,x.val=l(x.index++)),f|=(d>0?1:0)*g,g<<=1;m=t(f);break;case 2:return""}for(y[3]=m,u=m,_.push(m);;){if(x.index>o)return"";for(f=0,h=Math.pow(2,k),g=1;g!=h;)d=x.val&x.position,x.position>>=1,x.position==0&&(x.position=a,x.val=l(x.index++)),f|=(d>0?1:0)*g,g<<=1;switch(m=f){case 0:for(f=0,h=Math.pow(2,8),g=1;g!=h;)d=x.val&x.position,x.position>>=1,x.position==0&&(x.position=a,x.val=l(x.index++)),f|=(d>0?1:0)*g,g<<=1;y[b++]=t(f),m=b-1,v--;break;case 1:for(f=0,h=Math.pow(2,16),g=1;g!=h;)d=x.val&x.position,x.position>>=1,x.position==0&&(x.position=a,x.val=l(x.index++)),f|=(d>0?1:0)*g,g<<=1;y[b++]=t(f),m=b-1,v--;break;case 2:return _.join("")}if(v==0&&(v=Math.pow(2,k),k++),y[m])E=y[m];else{if(m!==b)return null;E=u+u.charAt(0)}_.push(E),y[b++]=u+E.charAt(0),u=E,--v==0&&(v=Math.pow(2,k),k++)}}};return s}(),V_!=null?V_.exports=H_:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return H_})),cN.exports);var I$e=new TextEncoder;var Zc=new e0;var vg=class{constructor(e,r,n){this.vaultName=e;this.appId=r;this.version=n;this.persister=Zc.createInstance({name:`quartz-syncer/cache/${e}/${r}/${n}`,driver:[Zc.INDEXEDDB]})}persister;memoryCache=null;dirtyKeys=new Set;async preloadCache(){let e=new Map;await this.persister.iterate((r,n)=>{n.startsWith("file:")&&e.set(n,r)}),this.memoryCache=e}clearMemoryCache(){this.memoryCache=null,this.dirtyKeys.clear()}async flushCache(e){if(!this.memoryCache||this.dirtyKeys.size===0)return;let r=this.dirtyKeys.size,n=0;for(let i of this.dirtyKeys){let s=this.memoryCache.get(i);s&&await this.persister.setItem(i,s),n++,e&&(e.setProgress(Math.floor(n/r*100)),e.setIndexText(`Saving: ${n}/${r}`))}this.dirtyKeys.clear()}async getCacheEntry(e){let r=this.fileKey(e);return this.memoryCache?this.memoryCache.get(r)??null:await this.persister.getItem(r)}async getCacheProperty(e,r){return(await this.getCacheEntry(e))?.[r]??null}async setCacheEntry(e,r){let n=this.fileKey(e);if(this.memoryCache){this.memoryCache.set(n,r),this.dirtyKeys.add(n);return}await this.persister.setItem(n,r)}async mergeAndStore(e,r,n){let i=await this.getCacheEntry(e);await this.setCacheEntry(e,{version:this.version,time:n??Date.now(),localData:i?.localData??null,localHash:i?.localHash??void 0,remoteData:i?.remoteData??null,remoteHash:i?.remoteHash??void 0,hasDynamicContent:i?.hasDynamicContent,...r})}async recreate(){await Zc.dropInstance({name:`quartz-syncer/cache/${this.vaultName}/${this.appId}/${this.version}`}),await this.dropOutdatedCache(),this.persister=Zc.createInstance({name:`quartz-syncer/cache/${this.vaultName}/${this.appId}/${this.version}`,driver:[Zc.INDEXEDDB]})}async dropOutdatedCache(){let r=(await indexedDB.databases()).filter(n=>n.name&&n.name.startsWith(`quartz-syncer/cache/${this.vaultName}/${this.appId}/`)&&n.name!==`quartz-syncer/cache/${this.vaultName}/${this.appId}/${this.version}`);for(let n of r)indexedDB.deleteDatabase(n.name)}async isLocalFileOutdated(e,r){let n=await this.getCacheEntry(e);return n&&n.localData?n.hasDynamicContent?!0:n.timer.startsWith("file:")).map(r=>r.substring(5))}fileKey(e){return"file:"+e}async getLastUpdateTimestamp(){let e=await this.persister.getItem("data.json");return e||null}async setLastUpdateTimestamp(e,r){r.settings.cacheTimestamp=e,await this.persister.setItem("data.json",e),await r.saveSettings()}};p();p();var Rn=require("obsidian"),SH=class{pathToId=new Map;idToPath=[];intern(t){let e=this.pathToId.get(t);if(e!==void 0)return e;let r=this.idToPath.length;return this.pathToId.set(t,r),this.idToPath.push(t),r}getId(t){return this.pathToId.get(t)}getPath(t){return this.idToPath[t]}rename(t,e){let r=this.pathToId.get(t);r!==void 0&&(this.pathToId.delete(t),this.pathToId.set(e,r),this.idToPath[r]=e)}internWithId(t,e){for(this.pathToId.set(t,e);this.idToPath.length<=e;)this.idToPath.push(void 0);this.idToPath[e]=t}allPaths(){return this.pathToId.keys()}has(t){return this.pathToId.has(t)}get size(){return this.pathToId.size}resolvePaths(t){let e=new Set;for(let r of t){let n=this.idToPath[r];n!==void 0&&e.add(n)}return e}clear(){this.pathToId.clear(),this.idToPath.length=0}},$n=class{index=new Map;get(t){return this.index.get(t)??CH}has(t){let e=this.index.get(t);return e!==void 0&&e.size>0}add(t,e){let r=this.index.get(t);r===void 0&&(r=new Set,this.index.set(t,r)),r.add(e)}remove(t,e){let r=this.index.get(t);r!==void 0&&(r.delete(e),r.size===0&&this.index.delete(t))}removeFromKeys(t,e){for(let r of t)this.remove(r,e)}entries(){return this.index}get size(){return this.index.size}clear(){this.index.clear()}},EH=class{index=new Map;get(t){return this.index.get(t)}has(t){return this.index.has(t)}set(t,e){this.index.set(t,e)}remove(t){this.index.delete(t)}removeKeys(t){for(let e of t)this.index.delete(e)}clear(){this.index.clear()}},CH=Object.freeze(new Set),TH=1,bg="meta",Io="intern",Po="contrib",AH=class{db=null;dbName;constructor(t){this.dbName=`inverse-metadatacache:${t}`}async open(){try{return this.db=await $H(this.dbName,TH,t=>{t.objectStoreNames.contains(bg)||t.createObjectStore(bg),t.objectStoreNames.contains(Io)||t.createObjectStore(Io,{keyPath:"path"}),t.objectStoreNames.contains(Po)||t.createObjectStore(Po,{keyPath:"id"})}),!0}catch{return this.db=null,!1}}get isOpen(){return this.db!==null}async loadSnapshot(){if(!this.db)return null;try{let t=this.db.transaction([Io,Po],"readonly"),[e,r]=await Promise.all([PN(t.objectStore(Io)),PN(t.objectStore(Po))]);return{interns:e,contribs:r}}catch{return null}}async flush(t,e,r,n){if(!this.db)return!1;try{let i=this.db.transaction([Io,Po],"readwrite"),s=i.objectStore(Io),o=i.objectStore(Po);for(let a of t)s.put(a);for(let a of e)o.put(a);for(let a of r)o.delete(a);for(let a of n)s.delete(a);return await $N(i),!0}catch{return!1}}async clear(){if(this.db)try{let t=this.db.transaction([bg,Io,Po],"readwrite");t.objectStore(bg).clear(),t.objectStore(Io).clear(),t.objectStore(Po).clear(),await $N(t)}catch{}}close(){this.db?.close(),this.db=null}};function IH(t,e,r){let n={id:t,mtime:e};return r.tags?.size&&(n.tags=[...r.tags]),r.bodyTags?.size&&(n.bodyTags=[...r.bodyTags]),r.frontmatterTags?.size&&(n.frontmatterTags=[...r.frontmatterTags]),r.backlinks?.size&&(n.backlinks=[...r.backlinks]),r.bodyBacklinks?.size&&(n.bodyBacklinks=[...r.bodyBacklinks]),r.frontmatterBacklinks?.size&&(n.frontmatterBacklinks=[...r.frontmatterBacklinks]),r.unresolvedBacklinks?.size&&(n.unresolvedBacklinks=[...r.unresolvedBacklinks]),r.embeds?.size&&(n.embeds=[...r.embeds]),r.headings?.size&&(n.headings=[...r.headings]),r.frontmatterKeys?.size&&(n.frontmatterKeys=[...r.frontmatterKeys]),r.frontmatterValues?.size&&(n.frontmatterValues=[...r.frontmatterValues]),r.aliases?.size&&(n.aliases=[...r.aliases]),r.blocks?.size&&(n.blocks=[...r.blocks]),r.taskStatuses?.size&&(n.taskStatuses=[...r.taskStatuses]),n}function PH(t){let e={};return t.tags?.length&&(e.tags=new Set(t.tags)),t.bodyTags?.length&&(e.bodyTags=new Set(t.bodyTags)),t.frontmatterTags?.length&&(e.frontmatterTags=new Set(t.frontmatterTags)),t.backlinks?.length&&(e.backlinks=new Set(t.backlinks)),t.bodyBacklinks?.length&&(e.bodyBacklinks=new Set(t.bodyBacklinks)),t.frontmatterBacklinks?.length&&(e.frontmatterBacklinks=new Set(t.frontmatterBacklinks)),t.unresolvedBacklinks?.length&&(e.unresolvedBacklinks=new Set(t.unresolvedBacklinks)),t.embeds?.length&&(e.embeds=new Set(t.embeds)),t.headings?.length&&(e.headings=new Set(t.headings)),t.frontmatterKeys?.length&&(e.frontmatterKeys=new Set(t.frontmatterKeys)),t.frontmatterValues?.length&&(e.frontmatterValues=new Set(t.frontmatterValues)),t.aliases?.length&&(e.aliases=new Set(t.aliases)),t.blocks?.length&&(e.blocks=new Set(t.blocks)),t.taskStatuses?.length&&(e.taskStatuses=new Set(t.taskStatuses)),e}function $H(t,e,r){return new Promise((n,i)=>{let s=indexedDB.open(t,e);s.onupgradeneeded=()=>r(s.result),s.onsuccess=()=>n(s.result),s.onerror=()=>i(s.error)})}function PN(t){return new Promise((e,r)=>{let n=t.getAll();n.onsuccess=()=>e(n.result),n.onerror=()=>r(n.error)})}function $N(t){return new Promise((e,r)=>{t.oncomplete=()=>e(),t.onerror=()=>r(t.error),t.onabort=()=>r(t.error)})}var RH=500,OH=2e3,NH=3e4,_g=Object.freeze(new Set),FH=Object.freeze(new Map),DH=class extends Rn.Events{app;files;contributions=new Map;mtimes=new Map;chunkSize;tagIndex=new $n;bodyTagIndex=new $n;frontmatterTagIndex=new $n;backlinkIndex=new $n;bodyBacklinkIndex=new $n;frontmatterBacklinkIndex=new $n;unresolvedBacklinkIndex=new $n;embedIndex=new $n;headingIndex=new $n;frontmatterKeyIndex=new $n;frontmatterValueIndex=new $n;aliasIndex=new $n;blockIndex=new EH;taskStatusIndex=new $n;eventRefs=[];_isReady=!1;_destroyed=!1;store=null;persistEnabled;dirtyFileIds=new Set;deletedFileIds=new Set;deletedPaths=new Set;dirtyInternPaths=new Set;flushTimer=null;flushIntervalTimer=null;flushDebounceMs;flushIntervalMs;get isReady(){return this._isReady}get isDestroyed(){return this._destroyed}on(t,e,r){return super.on(t,e,r)}constructor(t,e){super(),this.app=t,this.files=new SH,this.chunkSize=e?.chunkSize??RH,this.persistEnabled=e?.persist!==!1,this.flushDebounceMs=e?.flushDebounceMs??OH,this.flushIntervalMs=e?.flushIntervalMs??NH,this.waitForMetadataCacheThenInitialize()}waitForMetadataCacheThenInitialize(){this.registerEvents();let t=this.app.metadataCache.resolvedLinks;if(Object.keys(t).some(a=>Object.keys(t[a]??{}).length>0)){this.initialize();return}let r=!1,n=!1,i=!1,s=()=>{n&&i&&this.finalizeLinks()},o=()=>{r?(this.app.metadataCache.off("resolved",o),i=!0,s()):(r=!0,this.initializeAndWaitForLinks().then(()=>{n=!0,s()}))};this.app.metadataCache.on("resolved",o)}async initializeAndWaitForLinks(){let t=!1;this.persistEnabled&&(t=await this.tryLoadFromDb()),t?await this.reconcileWithVault():await this.buildInitialIndex(),this.persistEnabled&&this.store?.isOpen&&this.startPeriodicFlush()}finalizeLinks(){this.rebuildAllLinkIndexes(),this._isReady=!0,this.trigger("ready")}registerEvents(){let t=this.app.metadataCache,e=this.app.vault;this.eventRefs.push(t.on("changed",(r,n,i)=>{this.updateFileFromCache(r.path,i,r.stat.mtime)})),this.eventRefs.push(t.on("deleted",(r,n)=>{this.removeFile(r.path)})),this.eventRefs.push(t.on("resolve",r=>{this.updateFileLinks(r.path)})),this.eventRefs.push(e.on("rename",(r,n)=>{this.handleRename(n,r.path)}))}async initialize(){let t=!1;this.persistEnabled&&(t=await this.tryLoadFromDb()),t?await this.reconcileWithVault():await this.buildInitialIndex(),this.rebuildAllLinkIndexes(),this.persistEnabled&&this.store?.isOpen&&this.startPeriodicFlush(),this._isReady||(this._isReady=!0,this.trigger("ready"))}async tryLoadFromDb(){try{let t=this.app.appId;if(this.store=new AH(t??"default"),!await this.store.open())return this.disablePersistence(),!1;let r=await this.store.loadSnapshot();return!r||r.interns.length===0?!1:(this.restoreFromSnapshot(r.interns,r.contribs),!0)}catch{return this.disablePersistence(),!1}}restoreFromSnapshot(t,e){for(let{path:r,id:n}of t)this.files.internWithId(r,n);for(let r of e){let n=PH(r);this.contributions.set(r.id,n),this.mtimes.set(r.id,r.mtime),this.rebuildIndexesFromContributions(r.id,n)}}rebuildIndexesFromContributions(t,e){if(e.tags)for(let r of e.tags)this.tagIndex.add(r,t);if(e.bodyTags)for(let r of e.bodyTags)this.bodyTagIndex.add(r,t);if(e.frontmatterTags)for(let r of e.frontmatterTags)this.frontmatterTagIndex.add(r,t);if(e.backlinks)for(let r of e.backlinks)this.backlinkIndex.add(r,t);if(e.bodyBacklinks)for(let r of e.bodyBacklinks)this.bodyBacklinkIndex.add(r,t);if(e.frontmatterBacklinks)for(let r of e.frontmatterBacklinks)this.frontmatterBacklinkIndex.add(r,t);if(e.unresolvedBacklinks)for(let r of e.unresolvedBacklinks)this.unresolvedBacklinkIndex.add(r,t);if(e.embeds)for(let r of e.embeds)this.embedIndex.add(r,t);if(e.headings)for(let r of e.headings)this.headingIndex.add(r,t);if(e.frontmatterKeys)for(let r of e.frontmatterKeys)this.frontmatterKeyIndex.add(r,t);if(e.frontmatterValues)for(let r of e.frontmatterValues)this.frontmatterValueIndex.add(r,t);if(e.aliases)for(let r of e.aliases)this.aliasIndex.add(r,t);if(e.blocks)for(let r of e.blocks)this.blockIndex.set(r,t);if(e.taskStatuses)for(let r of e.taskStatuses)this.taskStatusIndex.add(r,t)}async reconcileWithVault(){let t=this.app.vault.getMarkdownFiles(),e=new Set,r=[];for(let o of t){e.add(o.path);let a=this.files.getId(o.path);(a===void 0||this.mtimes.get(a)!==o.stat.mtime)&&r.push(o)}let n=this.files.allPaths();for(let o of n)e.has(o)||this.removeFile(o);let i=r.length,s=0;for(let o=0;o0&&(u.add(f),this.frontmatterBacklinkIndex.add(f,n)),(h>d||d===0)&&(c.add(f),this.bodyBacklinkIndex.add(f,n))}i.backlinks=l,i.bodyBacklinks=c,i.frontmatterBacklinks=u}for(let r of Object.keys(e)){let n=this.files.intern(r),i=this.getOrCreateContributions(n),s=e[r];if(s){let o=new Set;for(let a of Object.keys(s)){let l=a.toLowerCase();o.add(l),this.unresolvedBacklinkIndex.add(l,n)}i.unresolvedBacklinks=o}}for(let r of this.app.vault.getMarkdownFiles()){let n=this.files.getId(r.path);if(n===void 0)continue;let i=this.app.metadataCache.getFileCache(r);if(!i?.embeds)continue;let s=this.getOrCreateContributions(n),o=new Set;for(let a of i.embeds){let l=(0,Rn.getLinkpath)(a.link),u=this.app.metadataCache.getFirstLinkpathDest(l,r.path)?.path??l;o.add(u),this.embedIndex.add(u,n)}s.embeds=o,this.markDirty(n,r.path)}}indexFileFromCache(t,e){let r=this.files.intern(t),n=this.getOrCreateContributions(r);this.indexTags(r,e,n),this.indexEmbeds(r,e,n),this.indexHeadings(r,e,n),this.indexFrontmatter(r,e,n),this.indexAliases(r,e,n),this.indexBlocks(r,e,n),this.indexTasks(r,e,n)}indexTags(t,e,r){let n=(0,Rn.getAllTags)(e);if(!n)return;let i=new Set;for(let l of n){let c=l.toLowerCase();i.add(c),this.tagIndex.add(c,t)}r.tags=i;let s=new Set;if(e.tags)for(let l of e.tags){let c=l.tag.toLowerCase();s.add(c),this.bodyTagIndex.add(c,t)}r.bodyTags=s;let o=new Set,a=(0,Rn.parseFrontMatterTags)(e.frontmatter??null);if(a)for(let l of a){let c=l.toLowerCase();o.add(c),this.frontmatterTagIndex.add(c,t)}r.frontmatterTags=o}indexTasks(t,e,r){if(!e.listItems)return;let n=new Set;for(let i of e.listItems)i.task!==void 0&&(n.add(i.task),this.taskStatusIndex.add(i.task,t));r.taskStatuses=n}indexEmbeds(t,e,r){if(!e.embeds)return;let n=new Set;for(let i of e.embeds){let s=(0,Rn.getLinkpath)(i.link),a=this.app.metadataCache.getFirstLinkpathDest(s,this.files.getPath(t)??"")?.path??s;n.add(a),this.embedIndex.add(a,t)}r.embeds=n}indexHeadings(t,e,r){if(!e.headings)return;let n=new Set;for(let i of e.headings){let s=i.heading.toLowerCase();n.add(s),this.headingIndex.add(s,t)}r.headings=n}indexFrontmatter(t,e,r){if(!e.frontmatter)return;let n=new Set,i=new Set;for(let[s,o]of Object.entries(e.frontmatter)){if(s==="position")continue;let a=s.toLowerCase();n.add(a),this.frontmatterKeyIndex.add(a,t);let l=zH(a,o);for(let c of l)i.add(c),this.frontmatterValueIndex.add(c,t)}r.frontmatterKeys=n,r.frontmatterValues=i}indexAliases(t,e,r){let n=(0,Rn.parseFrontMatterAliases)(e.frontmatter??null);if(!n)return;let i=new Set;for(let s of n){let o=s.toLowerCase();i.add(o),this.aliasIndex.add(o,t)}r.aliases=i}indexBlocks(t,e,r){if(!e.blocks)return;let n=new Set;for(let i of Object.keys(e.blocks))n.add(i),this.blockIndex.set(i,t);r.blocks=n}indexUnresolvedBacklinks(t,e,r){let n=this.app.metadataCache.unresolvedLinks[e];if(!n)return;let i=new Set;for(let s of Object.keys(n)){let o=s.toLowerCase();i.add(o),this.unresolvedBacklinkIndex.add(o,t)}r.unresolvedBacklinks=i}updateFileFromCache(t,e,r){let n=this.files.intern(t);this.removeCacheContributions(n);let i=this.getOrCreateContributions(n);this.indexTags(n,e,i),this.indexEmbeds(n,e,i),this.indexHeadings(n,e,i),this.indexFrontmatter(n,e,i),this.indexAliases(n,e,i),this.indexBlocks(n,e,i),this.indexTasks(n,e,i),this.mtimes.set(n,r),this.markDirty(n,t),this.trigger("file-updated",t)}updateFileLinks(t){let e=this.files.getId(t);if(e===void 0)return;this.removeLinkContributions(e);let r=this.getOrCreateContributions(e);this.indexBacklinksWithSeparation(e,t,r),this.indexUnresolvedBacklinks(e,t,r),this.markDirty(e,t),this.trigger("file-updated",t)}indexBacklinksWithSeparation(t,e,r){let n=this.app.metadataCache.resolvedLinks[e];if(!n)return;let i=new Map,s=this.app.vault.getFileByPath(e);if(s){let c=this.app.metadataCache.getFileCache(s);if(c?.frontmatterLinks)for(let u of c.frontmatterLinks){let f=(0,Rn.getLinkpath)(u.link),d=this.app.metadataCache.getFirstLinkpathDest(f,e);d&&i.set(d.path,(i.get(d.path)??0)+1)}}let o=new Set,a=new Set,l=new Set;for(let c of Object.keys(n)){o.add(c),this.backlinkIndex.add(c,t);let u=i.get(c)??0,f=n[c]??0;u>0&&(l.add(c),this.frontmatterBacklinkIndex.add(c,t)),(f>u||u===0)&&(a.add(c),this.bodyBacklinkIndex.add(c,t))}r.backlinks=o,r.bodyBacklinks=a,r.frontmatterBacklinks=l}removeFile(t){let e=this.files.getId(t);e!==void 0&&(this.removeAllContributions(e),this.contributions.delete(e),this.mtimes.delete(e),this.deletedFileIds.add(e),this.deletedPaths.add(t),this.dirtyFileIds.delete(e),this.scheduleDebouncedFlush(),this.trigger("file-updated",t))}handleRename(t,e){this.files.rename(t,e);let r=this.files.getId(e);if(r===void 0)return;let n=this.contributions.get(r);n&&(n.backlinks&&(this.backlinkIndex.removeFromKeys(n.backlinks,r),n.backlinks=void 0),n.unresolvedBacklinks&&(this.unresolvedBacklinkIndex.removeFromKeys(n.unresolvedBacklinks,r),n.unresolvedBacklinks=void 0),this.deletedPaths.add(t),this.markDirty(r,e),this.trigger("file-updated",e))}removeCacheContributions(t){let e=this.contributions.get(t);e&&(e.tags&&this.tagIndex.removeFromKeys(e.tags,t),e.bodyTags&&this.bodyTagIndex.removeFromKeys(e.bodyTags,t),e.frontmatterTags&&this.frontmatterTagIndex.removeFromKeys(e.frontmatterTags,t),e.embeds&&this.embedIndex.removeFromKeys(e.embeds,t),e.headings&&this.headingIndex.removeFromKeys(e.headings,t),e.frontmatterKeys&&this.frontmatterKeyIndex.removeFromKeys(e.frontmatterKeys,t),e.frontmatterValues&&this.frontmatterValueIndex.removeFromKeys(e.frontmatterValues,t),e.aliases&&this.aliasIndex.removeFromKeys(e.aliases,t),e.blocks&&this.blockIndex.removeKeys(e.blocks),e.taskStatuses&&this.taskStatusIndex.removeFromKeys(e.taskStatuses,t),e.tags=void 0,e.bodyTags=void 0,e.frontmatterTags=void 0,e.embeds=void 0,e.headings=void 0,e.frontmatterKeys=void 0,e.frontmatterValues=void 0,e.aliases=void 0,e.blocks=void 0,e.taskStatuses=void 0)}removeLinkContributions(t){let e=this.contributions.get(t);e&&(e.backlinks&&this.backlinkIndex.removeFromKeys(e.backlinks,t),e.bodyBacklinks&&this.bodyBacklinkIndex.removeFromKeys(e.bodyBacklinks,t),e.frontmatterBacklinks&&this.frontmatterBacklinkIndex.removeFromKeys(e.frontmatterBacklinks,t),e.unresolvedBacklinks&&this.unresolvedBacklinkIndex.removeFromKeys(e.unresolvedBacklinks,t),e.backlinks=void 0,e.bodyBacklinks=void 0,e.frontmatterBacklinks=void 0,e.unresolvedBacklinks=void 0)}removeAllContributions(t){this.removeCacheContributions(t),this.removeLinkContributions(t)}getOrCreateContributions(t){let e=this.contributions.get(t);return e||(e={},this.contributions.set(t,e)),e}markDirty(t,e){this.dirtyFileIds.add(t),this.dirtyInternPaths.add(e),this.scheduleDebouncedFlush()}scheduleDebouncedFlush(){!this.persistEnabled||!this.store?.isOpen||this.flushTimer===null&&(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flushToDb()},this.flushDebounceMs))}startPeriodicFlush(){this.flushIntervalTimer=setInterval(()=>{this.flushToDb()},this.flushIntervalMs)}async flushToDb(){if(!this.store?.isOpen||this.dirtyFileIds.size===0&&this.deletedFileIds.size===0)return;let t=[];for(let s of this.dirtyInternPaths){let o=this.files.getId(s);o!==void 0&&t.push({path:s,id:o})}let e=[];for(let s of this.dirtyFileIds){let o=this.contributions.get(s),a=this.mtimes.get(s)??0;o&&e.push(IH(s,a,o))}let r=[...this.deletedFileIds],n=[...this.deletedPaths];this.dirtyFileIds.clear(),this.dirtyInternPaths.clear(),this.deletedFileIds.clear(),this.deletedPaths.clear(),await this.store.flush(t,e,r,n)||this.disablePersistence()}disablePersistence(){this.persistEnabled=!1,this.store?.close(),this.store=null}resolveIndex(t,e){let r=t.get(e);return r.size===0?_g:this.files.resolvePaths(r)}resolveFullIndex(t){let e=t.entries();if(e.size===0)return FH;let r=new Map;for(let[n,i]of e)r.set(n,this.files.resolvePaths(i));return r}getFilesWithTag(t){let e=t.startsWith("#")?t.toLowerCase():`#${t.toLowerCase()}`;return this.resolveIndex(this.tagIndex,e)}getFilesWithTagInBody(t){let e=t.startsWith("#")?t.toLowerCase():`#${t.toLowerCase()}`;return this.resolveIndex(this.bodyTagIndex,e)}getFilesWithTagInFrontmatter(t){let e=t.startsWith("#")?t.toLowerCase():`#${t.toLowerCase()}`;return this.resolveIndex(this.frontmatterTagIndex,e)}getAllTagsWithFiles(){return this.resolveFullIndex(this.tagIndex)}getBacklinksForFile(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.backlinkIndex,e)}getBacklinksFromBody(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.bodyBacklinkIndex,e)}getBacklinksFromFrontmatter(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.frontmatterBacklinkIndex,e)}getAllBacklinksWithFiles(){return this.resolveFullIndex(this.backlinkIndex)}getUnresolvedBacklinks(t){return this.resolveIndex(this.unresolvedBacklinkIndex,t.toLowerCase())}getFilesEmbedding(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.embedIndex,e)}getAllEmbedsWithFiles(){return this.resolveFullIndex(this.embedIndex)}getFilesWithHeading(t){return this.resolveIndex(this.headingIndex,t.toLowerCase())}getAllHeadingsWithFiles(){return this.resolveFullIndex(this.headingIndex)}getFilesWithFrontmatterKey(t){return this.resolveIndex(this.frontmatterKeyIndex,t.toLowerCase())}getFilesWithFrontmatterValue(t,e){let r=s0(t.toLowerCase(),e);return this.resolveIndex(this.frontmatterValueIndex,r)}getAllFrontmatterKeysWithFiles(){return this.resolveFullIndex(this.frontmatterKeyIndex)}getFilesWithAlias(t){return this.resolveIndex(this.aliasIndex,t.toLowerCase())}getAllAliasesWithFiles(){return this.resolveFullIndex(this.aliasIndex)}getFileWithBlockId(t){let e=this.blockIndex.get(t);if(e===void 0)return null;let r=this.files.getPath(e);return r===void 0?null:this.app.vault.getFileByPath(r)??null}getFilesWithTasks(){let t=new Set;for(let e of this.taskStatusIndex.entries().values())for(let r of e)t.add(r);return t.size===0?_g:this.files.resolvePaths(t)}getFilesWithTaskStatus(t){if(typeof t=="string")return this.resolveIndex(this.taskStatusIndex,t);let e=new Set;for(let r of t)for(let n of this.taskStatusIndex.get(r))e.add(n);return e.size===0?_g:this.files.resolvePaths(e)}getAllTaskStatusesWithFiles(){return this.resolveFullIndex(this.taskStatusIndex)}getFilesWithOpenTasks(){return this.resolveIndex(this.taskStatusIndex," ")}getFilesWithCompletedTasks(){let t=new Set;for(let[e,r]of this.taskStatusIndex.entries())if(e!==" ")for(let n of r)t.add(n);return t.size===0?_g:this.files.resolvePaths(t)}destroy(){if(!this._destroyed){this._destroyed=!0,this.flushTimer!==null&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.flushIntervalTimer!==null&&(clearInterval(this.flushIntervalTimer),this.flushIntervalTimer=null),this.flushToDb();for(let t of this.eventRefs)this.app.metadataCache.offref(t),this.app.vault.offref(t);this.eventRefs.length=0,this.store?.close(),this.store=null,this.tagIndex.clear(),this.bodyTagIndex.clear(),this.frontmatterTagIndex.clear(),this.backlinkIndex.clear(),this.bodyBacklinkIndex.clear(),this.frontmatterBacklinkIndex.clear(),this.unresolvedBacklinkIndex.clear(),this.embedIndex.clear(),this.headingIndex.clear(),this.frontmatterKeyIndex.clear(),this.frontmatterValueIndex.clear(),this.aliasIndex.clear(),this.blockIndex.clear(),this.taskStatusIndex.clear(),this.contributions.clear(),this.mtimes.clear(),this.files.clear()}}};function s0(t,e){return`${t}\0${MH(e)}`}function zH(t,e){return Array.isArray(e)?e.map(r=>s0(t,r)):[s0(t,e)]}function MH(t){return t==null?"":typeof t=="string"?t.toLowerCase():typeof t=="number"||typeof t=="boolean"?String(t):t instanceof Date?t.toISOString().toLowerCase():JSON.stringify(t).toLowerCase()}function RN(){return new Promise(t=>{typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):setTimeout(t,0)})}var i0=0,LH=1,BH="0.5.1",ON=Symbol.for("obsidian-extended-metadatacache/registry");function UH(){let t=globalThis,e=t[ON];return e||(e={majors:new Map},t[ON]=e),e}function NN(t,e){let r=UH(),n=r.majors.get(i0),s=!n||n.instance.isDestroyed?(()=>{let c={instance:new DH(t,e),version:BH,apiMajor:i0,apiMinor:LH,acquireCount:0};return r.majors.set(i0,c),c})():n;s.acquireCount++;let o=s,a=!1;return{api:o.instance,release(){a||(a=!0,o.acquireCount--)}}}var xg=class{handle=null;readyPromise;resolveReady;constructor(e){this.readyPromise=new Promise(n=>{this.resolveReady=n}),this.handle=NN(e);let r=this.handle.api;r.isReady?this.resolveReady():r.on("ready",()=>this.resolveReady())}get api(){if(!this.handle)throw new Error("ExtendedCacheService already destroyed");return this.handle.api}get isReady(){return this.handle?.api.isReady??!1}waitForReady(){return this.readyPromise}destroy(){this.handle?.release(),this.handle=null}};p();p();var jH={h:"help",v:"verbose"},FN={help:{description:"Show this help message"},h:{description:"Show this help message"},"--help":{description:"Show this help message"},verbose:{description:"Enable verbose output"},v:{description:"Enable verbose output"},"--verbose":{description:"Enable verbose output"}};function DN(t){let e={};for(let r of Object.keys(t)){let n=r.replace(/^-{1,2}/,""),i=jH[n]??n;e[i]=t[r]}return e}function zN(t){let e={...FN};if(!t)return e;for(let[r,n]of Object.entries(t))e[r]=n,e[`--${r}`]=n;return e}function MN(t,e,r){let n=[`Usage: obsidian ${t} [flags]`,"",e];if(r&&Object.keys(r).length>0){let i=Object.entries(r).filter(([s])=>!s.startsWith("-")&&!Object.keys(FN).includes(s));if(i.length>0){n.push("","Flags:");for(let[s,o]of i){let a=o.value?`=${o.value}`:"";n.push(` ${s}${a} ${o.description}`)}}}return n.push("","Global flags:"," help, h Show this help message"," verbose, v Enable verbose output"),n.join(` `)}function V(t,e){if(t.format==="json")return JSON.stringify(e,null,2);if(!e.ok)return`Error: ${e.error??"Unknown error"}`;let r=e.message??JSON.stringify(e.data),n=e.durationMs?` (${(e.durationMs/1e3).toFixed(1)}s)`:"";return`${r}${n}`}function ae(t,e){return{ok:!1,command:t,error:e}}function ke(t,e,r,n){return{ok:!0,command:t,message:e,data:r,durationMs:n}}p();p();p();function LN(t){return t.settings.gitRemoteUrl?t.settings.gitBranch?null:"Git branch is not configured. Set it in plugin settings or via 'obsidian quartz-syncer:config action=set key=gitBranch value='.":"Git remote URL is not configured. Set it in plugin settings or via 'obsidian quartz-syncer:config action=set key=gitRemoteUrl value='."}p();var kg=class{setProgress(e){}setIndexText(e){}setText(e){}};function He(t,e,r){return t===1?e:r??`${e}s`}function vt(t){let e=t.verbose==="true";return{verbose:e,includeVerbose:e&&t.format!=="json"}}function Jc(t,e,r=""){let n=t[e];return typeof n=="string"?n:r}function Sg(t,e){return t==="string"?e:e==="true"?!0:e==="false"?!1:null}function lt(t){return t instanceof Error?t.message:String(t)}function Yt(t,e,r){let n=LN(t);return n?V(e,ae(r,n)):null}function qH(t){let e=new wi(t.app.metadataCache,t.settings,t.getGitSettingsWithSecret()),r=new ha(t.app,t,t.app.vault,t.app.metadataCache,t.settings,t.datastore,t.extendedCache),n=new Da(e,r);return{siteManager:e,publisher:r,statusManager:n}}async function $o(t){let e=qH(t),r=new kg,n=await e.statusManager.getPublishStatus(r);return{...e,status:n,controller:r}}function Zi(t){let e=t.getGitSettingsWithSecret();return new et({gitSettings:e,contentFolder:t.settings.contentFolder,vaultPath:t.settings.vaultPath})}function Xc(t){let e=new Set([...t.unpublishedNotes.map(r=>r.getPath()),...t.changedNotes.map(r=>r.getPath()),...t.publishedNotes.map(r=>r.getPath()),...t.deletedNotePaths.map(r=>r.path)]);return t.deletedBlobPaths.filter(r=>!e.has(r.path))}function Or(t,e,r){if(!t)return r;let n=[];for(let{label:i,items:s}of e)s.length>0&&(n.push(i),n.push(...s.map(o=>` ${o}`)));return n.length>0?n.join(` `):r}var Eg="quartz-syncer:status",VH={format:{value:"",description:"Output format (default: text)"}};function BN(t,e){t(Eg,"Show the publish status of all marked notes",VH,async r=>{try{let n=Yt(e,r,Eg);if(n)return n;let i=Date.now(),{status:s}=await $o(e),o=Xc(s),a={unpublished:s.unpublishedNotes.map(h=>h.getPath()),changed:s.changedNotes.map(h=>h.getPath()),published:s.publishedNotes.map(h=>h.getPath()),deletedNotes:s.deletedNotePaths.map(h=>h.path),deletedBlobs:o.map(h=>h.path),summary:{unpublished:s.unpublishedNotes.length,changed:s.changedNotes.length,published:s.publishedNotes.length,deletedNotes:s.deletedNotePaths.length,deletedBlobs:o.length}},{includeVerbose:l}=vt(r),c=[],u=(h,g)=>{c.push(h),!(!l||g.length===0)&&c.push(...g.map(m=>` ${m}`))},f=[...a.deletedNotes,...a.deletedBlobs];u(`Unpublished: ${a.summary.unpublished}`,a.unpublished),u(`Changed: ${a.summary.changed}`,a.changed),u(`Published: ${a.summary.published}`,a.published),u(`Deleted: ${a.summary.deletedNotes+a.summary.deletedBlobs}`,f);let d=c.join(` `);return V(r,ke(Eg,d,a,Date.now()-i))}catch(n){return V(r,ae(Eg,lt(n)))}})}p();var eu="quartz-syncer:sync",HH={force:{description:"Apply deletions (required to delete remote files)"},"dry-run":{description:"Show what would be published/deleted without changes"},format:{value:"",description:"Output format (default: text)"}};function UN(t,e){t(eu,"Publish pending notes and optionally delete removed notes",HH,async r=>{try{let n=Yt(e,r,eu);if(n)return n;let i=Date.now(),s=r["dry-run"]==="true",o=r.force==="true",{includeVerbose:a}=vt(r),{publisher:l,status:c}=await $o(e),u=[...c.unpublishedNotes,...c.changedNotes],f=Xc(c),d=[...c.deletedNotePaths.map(x=>x.path),...f.map(x=>x.path)],h={publish:u.map(x=>x.getPath()),delete:d,skippedDeletes:[],summary:{published:u.length,deleted:0,skippedDeletes:0}};if(s){h.summary.deleted=d.length;let x=`Dry run: ${h.summary.published} to publish, ${d.length} to delete.`,S=Or(a,[{label:`Published ${h.publish.length} ${He(h.publish.length,"file")}:`,items:h.publish},{label:`Deleted ${h.delete.length} ${He(h.delete.length,"file")}:`,items:h.delete}],x);return V(r,ke(eu,S,h,Date.now()-i))}if(u.length===0&&d.length===0)return V(r,ke(eu,Or(a,[{label:`Published 0 ${He(0,"file")}:`,items:[]},{label:`Deleted 0 ${He(0,"file")}:`,items:[]},{label:`Skipped 0 ${He(0,"deletion")}:`,items:[]}],"Nothing to sync."),h,Date.now()-i));let g=l.createConnection();if(!await l.publishBatch(u,g))throw new Error("Failed to publish files.");let y=0,v=[];if(d.length>0)if(o){if(!await l.deleteBatch(d,g))throw new Error("Failed to delete files.");y=d.length}else v=d;h.skippedDeletes=v,h.summary.deleted=y,h.summary.skippedDeletes=v.length;let b=[`Published ${u.length} ${He(u.length,"file")}`,`Deleted ${y} ${He(y,"file")}`];v.length>0&&b.push(`Skipped ${v.length} ${He(v.length,"deletion")} (use force)`);let k=b.join(". ")+".",E=o?d:[],_=Or(a,[{label:`Published ${h.publish.length} ${He(h.publish.length,"file")}:`,items:h.publish},{label:`Deleted ${E.length} ${He(E.length,"file")}:`,items:E},{label:`Skipped ${v.length} ${He(v.length,"deletion")}:`,items:v}],k);return V(r,ke(eu,_,h,Date.now()-i))}catch(n){return V(r,ae(eu,lt(n)))}})}p();var tu="quartz-syncer:publish",GH={"dry-run":{description:"Show what would be published without changes"},format:{value:"",description:"Output format (default: text)"}};function jN(t,e){t(tu,"Publish pending notes without deletions",GH,async r=>{try{let n=Yt(e,r,tu);if(n)return n;let i=Date.now(),s=r["dry-run"]==="true",{includeVerbose:o}=vt(r),{publisher:a,status:l}=await $o(e),c=[...l.unpublishedNotes,...l.changedNotes],u={publish:c.map(m=>m.getPath()),summary:{published:c.length}};if(s){let m=`Dry run: ${c.length} to publish.`,y=Or(o,[{label:`Published ${c.length} ${He(c.length,"file")}:`,items:u.publish}],m);return V(r,ke(tu,y,u,Date.now()-i))}if(c.length===0)return V(r,ke(tu,Or(o,[{label:`Published 0 ${He(0,"file")}:`,items:[]}],"Nothing to publish."),u,Date.now()-i));let f=a.createConnection();if(!await a.publishBatch(c,f))throw new Error("Failed to publish files.");let h=`Published ${c.length} ${He(c.length,"file")}.`,g=Or(o,[{label:`Published ${c.length} ${He(c.length,"file")}:`,items:u.publish}],h);return V(r,ke(tu,g,u,Date.now()-i))}catch(n){return V(r,ae(tu,lt(n)))}})}p();var Wa="quartz-syncer:delete",QH={force:{description:"Apply deletions (required)"},"dry-run":{description:"Show what would be deleted without changes"},format:{value:"",description:"Output format (default: text)"}};function qN(t,e){t(Wa,"Delete removed notes from the remote repository",QH,async r=>{try{let n=Yt(e,r,Wa);if(n)return n;let i=Date.now(),s=r["dry-run"]==="true",o=r.force==="true",{includeVerbose:a}=vt(r),{publisher:l,status:c}=await $o(e),u=Xc(c),f=[...c.deletedNotePaths.map(v=>v.path),...u.map(v=>v.path)],d={delete:f,summary:{deleted:f.length}};if(s){let v=`Dry run: ${f.length} to delete.`,b=Or(a,[{label:`Deleted ${f.length} ${He(f.length,"file")}:`,items:f}],v);return V(r,ke(Wa,b,d,Date.now()-i))}if(f.length===0)return V(r,ke(Wa,Or(a,[{label:`Deleted 0 ${He(0,"file")}:`,items:[]}],"Nothing to delete."),d,Date.now()-i));if(!o)return V(r,ae(Wa,"Deletion requires the 'force' flag."));let h=l.createConnection();if(!await l.deleteBatch(f,h))throw new Error("Failed to delete files.");let m=`Deleted ${f.length} ${He(f.length,"file")}.`,y=Or(a,[{label:`Deleted ${f.length} ${He(f.length,"file")}:`,items:f}],m);return V(r,ke(Wa,y,d,Date.now()-i))}catch(n){return V(r,ae(Wa,lt(n)))}})}p();p();var Tg=require("obsidian");p();p();p();var o0=(t,e,r)=>{let n=t instanceof RegExp?VN(t,r):t,i=e instanceof RegExp?VN(e,r):e,s=n!==null&&i!=null&&WH(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},VN=(t,e)=>{let r=e.match(t);return r?r[0]:null},WH=(t,e,r)=>{let n,i,s,o,a,l=r.indexOf(t),c=r.indexOf(e,l+1),u=l;if(l>=0&&c>0){if(t===e)return[l,c];for(n=[],s=r.length;u>=0&&!a;){if(u===l)n.push(u),l=r.indexOf(t,u+1);else if(n.length===1){let f=n.pop();f!==void 0&&(a=[f,c])}else i=n.pop(),i!==void 0&&i=0?l:c}n.length&&o!==void 0&&(a=[s,o])}return a};var HN="\0SLASH"+Math.random()+"\0",GN="\0OPEN"+Math.random()+"\0",l0="\0CLOSE"+Math.random()+"\0",QN="\0COMMA"+Math.random()+"\0",WN="\0PERIOD"+Math.random()+"\0",KH=new RegExp(HN,"g"),YH=new RegExp(GN,"g"),ZH=new RegExp(l0,"g"),JH=new RegExp(QN,"g"),XH=new RegExp(WN,"g"),e5=/\\\\/g,t5=/\\{/g,r5=/\\}/g,n5=/\\,/g,i5=/\\\./g,s5=1e5;function a0(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function o5(t){return t.replace(e5,HN).replace(t5,GN).replace(r5,l0).replace(n5,QN).replace(i5,WN)}function a5(t){return t.replace(KH,"\\").replace(YH,"{").replace(ZH,"}").replace(JH,",").replace(XH,".")}function KN(t){if(!t)return[""];let e=[],r=o0("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=KN(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function YN(t,e={}){if(!t)return[];let{max:r=s5}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),Id(o5(t),r,!0).map(a5)}function l5(t){return"{"+t+"}"}function c5(t){return/^-?0\d/.test(t)}function u5(t,e){return t<=e}function f5(t,e){return t>=e}function Id(t,e,r){let n=[],i=o0("{","}",t);if(!i)return[t];let s=i.pre,o=i.post.length?Id(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a=0;if(!c&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+l0+i.post,Id(t,e,!0)):[t];let f;if(c)f=i.body.split(/\.\./);else if(f=KN(i.body),f.length===1&&f[0]!==void 0&&(f=Id(f[0],e,!1).map(l5),f.length===1))return o.map(h=>i.pre+f[0]+h);let d;if(c&&f[0]!==void 0&&f[1]!==void 0){let h=a0(f[0]),g=a0(f[1]),m=Math.max(f[0].length,f[1].length),y=f.length===3&&f[2]!==void 0?Math.max(Math.abs(a0(f[2])),1):1,v=u5;g0){let S=new Array(x+1).join("0");E<0?_="-"+S+_.slice(1):_=S+_}}d.push(_)}}else{d=[];for(let h=0;h{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};p();p();var d5={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},$d=t=>t.replace(/[[\]\\-]/g,"\\$&"),h5=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ZN=t=>t.join(""),JN=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,l=!1,c=!1,u=r,f="";e:for(;sf?n.push($d(f)+"-"+$d(m)):m===f&&n.push($d(m)),f="",s++;continue}if(t.startsWith("-]",s+1)){n.push($d(m+"-")),s+=2;continue}if(t.startsWith("-",s+1)){f=m,s+=2;continue}n.push($d(m)),s++}if(ur?e?t.replace(/\[([^/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?t.replace(/\[([^/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var Zr,p5=new Set(["!","?","+","*","@"]),c0=t=>p5.has(t),XN=t=>c0(t.type),m5=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),g5=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),y5=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),eF=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),w5="(?!(?:^|/)\\.\\.?(?:$|/))",Cg="(?!\\.)",v5=new Set(["[","."]),b5=new Set(["..","."]),_5=new Set("().*{}+?[]^$\\!"),x5=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),u0="[^/]",tF=u0+"*?",rF=u0+"+?",k5=0,Ka=class{type;#t;#r;#n=!1;#e=[];#i;#o;#a;#l=!1;#c;#s;#h=!1;id=++k5;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#t.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,r,n={}){this.type=e,e&&(this.#r=!0),this.#i=r,this.#t=this.#i?this.#i.#t:this,this.#c=this.#t===this?n:this.#t.#c,this.#a=this.#t===this?[]:this.#t.#a,e==="!"&&!this.#t.#l&&this.#a.push(this),this.#o=this.#i?this.#i.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#s!==void 0?this.#s:this.type?this.#s=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#s=this.#e.map(e=>String(e)).join("")}#p(){if(this!==this.#t)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let e;for(;e=this.#a.pop();){if(e.type!=="!")continue;let r=e,n=r.#i;for(;n;){for(let i=r.#o+1;!n.type&&itypeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#l&&this.#i?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(this.#o===0)return!0;let e=this.#i;for(let r=0;rtypeof h!="string"),c=this.#e.map(h=>{let[g,m,y,v]=typeof h=="string"?Zr.#w(h,this.#r,l):h.toRegExpSource(e);return this.#r=this.#r||y,this.#n=this.#n||v,g}).join(""),u="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&b5.has(this.#e[0]))){let g=v5,m=r&&g.has(c.charAt(0))||c.startsWith("\\.")&&g.has(c.charAt(2))||c.startsWith("\\.\\.")&&g.has(c.charAt(4)),y=!r&&!e&&g.has(c.charAt(0));u=m?w5:y?Cg:""}let f="";return this.isEnd()&&this.#t.#l&&this.#i?.type==="!"&&(f="(?:$|\\/)"),[u+c+f,Ro(c),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#b(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),c=this;return c.#e=[l],c.type=null,c.#r=void 0,[l,Ro(this.toString()),!1,!1]}let o=!n||e||r||!Cg?"":this.#b(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#h)a=(this.isStart()&&!r?Cg:"")+rF;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Cg:"")+tF+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+l}return[a,Ro(s),this.#r=!!this.#r,this.#n]}#d(){if(XN(this)){let e=0,r=!1;do{r=!0;for(let n=0;n{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#w(e,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let l=0;lr?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var sr=(t,e,r={})=>(Pd(e),!r.nocomment&&e.charAt(0)==="#"?!1:new ru(e,r).match(t)),S5=/^\*+([^+@!?*[(]*)$/,E5=t=>e=>!e.startsWith(".")&&e.endsWith(t),C5=t=>e=>e.endsWith(t),T5=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),A5=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),I5=/^\*+\.\*+$/,P5=t=>!t.startsWith(".")&&t.includes("."),$5=t=>t!=="."&&t!==".."&&t.includes("."),R5=/^\.\*+$/,O5=t=>t!=="."&&t!==".."&&t.startsWith("."),N5=/^\*+$/,F5=t=>t.length!==0&&!t.startsWith("."),D5=t=>t.length!==0&&t!=="."&&t!=="..",z5=/^\?+([^+@!?*[(]*)?$/,M5=([t,e=""])=>{let r=sF([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},L5=([t,e=""])=>{let r=oF([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},B5=([t,e=""])=>{let r=oF([t]);return e?n=>r(n)&&n.endsWith(e):r},U5=([t,e=""])=>{let r=sF([t]);return e?n=>r(n)&&n.endsWith(e):r},sF=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},oF=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},aF=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",nF={win32:{sep:"\\"},posix:{sep:"/"}},j5=aF==="win32"?nF.win32.sep:nF.posix.sep;sr.sep=j5;var wr=Symbol("globstar **");sr.GLOBSTAR=wr;var q5="[^/]",V5=q5+"*?",H5="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",G5="(?:(?!(?:\\/|^)\\.).)*?",Q5=(t,e={})=>r=>sr(r,t,e);sr.filter=Q5;var Wn=(t,e={})=>Object.assign({},t,e),W5=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return sr;let e=sr;return Object.assign((n,i,s={})=>e(n,i,Wn(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,Wn(t,s))}static defaults(i){return e.defaults(Wn(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,Wn(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Wn(t,s))}},unescape:(n,i={})=>e.unescape(n,Wn(t,i)),escape:(n,i={})=>e.escape(n,Wn(t,i)),filter:(n,i={})=>e.filter(n,Wn(t,i)),defaults:n=>e.defaults(Wn(t,n)),makeRe:(n,i={})=>e.makeRe(n,Wn(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,Wn(t,i)),match:(n,i,s={})=>e.match(n,i,Wn(t,s)),sep:e.sep,GLOBSTAR:wr})};sr.defaults=W5;var lF=(t,e={})=>(Pd(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:YN(t,{max:e.braceExpandMax}));sr.braceExpand=lF;var K5=(t,e={})=>new ru(t,e).makeRe();sr.makeRe=K5;var Y5=(t,e,r={})=>{let n=new ru(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};sr.match=Y5;var iF=/[?*]|[+@!]\(.*?\)|\[|\]/,Z5=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ru=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){Pd(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||aF,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>{}),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!iF.test(s[2]))&&!iF.test(s[3]),c=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(c)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;ii&&n.splice(i+1,o-i);let a=n[i+1],l=n[i+2],c=n[i+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;or.length)}partsMatch(e,r,n=!1){let i=0,s=0,o=[],a="";for(;i=2&&(e=this.levelTwoFileOptimize(e)),r.includes(wr)?this.#t(e,r,n,i,s):this.#n(e,r,n,i,s)}#t(e,r,n,i,s){let o=r.indexOf(wr,s),a=r.lastIndexOf(wr),[l,c,u]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(l.length){let b=e.slice(i,i+l.length);if(!this.#n(b,l,n,0,0))return!1;i+=l.length,s+=l.length}let f=0;if(u.length){if(u.length+i>e.length)return!1;let b=e.length-u.length;if(this.#n(e,u,n,b,0))f=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(b--,!this.#n(e,u,n,b,0)))return!1;f=u.length+1}}if(!c.length){let b=!!f;for(let k=i;k{let c=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?Z5(f):f===wr?wr:f._src});c.forEach((f,d)=>{let h=c[d+1],g=c[d-1];f!==wr||g===wr||(g===void 0?h!==void 0&&h!==wr?c[d+1]="(?:\\/|"+n+"\\/)?"+h:c[d]=n:h===void 0?c[d-1]=g+"(?:\\/|\\/"+n+")?":h!==wr&&(c[d-1]=g+"(?:\\/|\\/"+n+"\\/)"+h,c[d+1]=wr))});let u=c.filter(f=>f!==wr);if(this.partial&&u.length>=1){let f=[];for(let d=1;d<=u.length;d++)f.push(u.slice(0,d).join("/"));return"(?:"+f.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let l=i;if(n.matchBase&&a.length===1&&(l=[o]),this.matchOne(l,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return sr.defaults(e).Minimatch}};sr.AST=Ka;sr.Minimatch=ru;sr.escape=f0;sr.unescape=Ro;function cF(t,e){if(e.startsWith("~")){let i=e.slice(1).trim(),s=(0,Tg.prepareFuzzySearch)(i);return{files:t.vault.getFiles().map(a=>({file:a,result:s(a.path)})).filter(a=>a.result!==null).sort((a,l)=>l.result.score-a.result.score).map(a=>a.file),mode:"fuzzy",pattern:i}}if(e.includes("*")||e.includes("?")){let i=e.replace(/\\/g,"/");return{files:t.vault.getFiles().filter(o=>sr(o.path,i)),mode:"glob",pattern:i}}let r=(0,Tg.normalizePath)(e),n=t.vault.getFileByPath(r);return{files:n?[n]:[],mode:"exact",pattern:r}}var Ya="quartz-syncer:mark",J5={path:{value:"",description:"File path, glob, or fuzzy query (prefix with ~)"},value:{value:"",description:"Publish flag value (default: true)"},"dry-run":{description:"Show matched files without modifying"},format:{value:"",description:"Output format (default: text)"}};function X5(t){return!t||t==="true"?!0:t==="false"?!1:t==="toggle"?"toggle":null}function eG(t){return t===!0||t==="true"||t===1}function uF(t,e){t(Ya,"Set or toggle the publish flag for matching files",J5,async r=>{try{let n=typeof r.path=="string"?r.path:"";if(!n)return V(r,ae(Ya,"Missing required flag: path"));let i=X5(typeof r.value=="string"?r.value:void 0);if(i===null)return V(r,ae(Ya,"Invalid value. Use true, false, or toggle."));let s=r["dry-run"]==="true",{includeVerbose:o}=vt(r),a=cF(e.app,n),l=e.settings.vaultPath,c=l==="/",u=new Set(["md",...e.settings.useBases?["base"]:[],...e.settings.useCanvas?["canvas"]:[],...e.settings.useExcalidraw?["excalidraw"]:[]]),f=a.files.filter(_=>u.has(_.extension)&&(c||_.path.startsWith(l)));if(f.length===0)return V(r,ae(Ya,"No publishable files matched the provided path."));let d=[],h=[],g=[];for(let _ of f)try{let x=new ao(e.app.vault,e.app.metadataCache,_,e.app.fileManager),S;if(i==="toggle"){let C=x.get(e.settings.publishFrontmatterKey);S=!eG(C)}else S=i;s||await x.set(e.settings.publishFrontmatterKey,S).apply(),d.push(_.path),g.push({path:_.path,value:S})}catch(x){h.push({path:_.path,error:lt(x)})}let m={mode:a.mode,pattern:a.pattern,dryRun:s,matched:f.map(_=>_.path),updated:d,failed:h,appliedValues:g},y=[s?`Dry run: ${d.length} ${He(d.length,"file")} matched`:`Updated ${d.length} ${He(d.length,"file")}`,`Mode: ${a.mode}`];h.length>0&&y.push(`Failed: ${h.length} ${He(h.length,"file")}`);let v=y.join(". ")+".",b=[`Vault root: ${c?"/":l}`,`All notes publishable: ${e.settings.allNotesPublishableByDefault?"yes":"no"}`],k=o?[v,...b,...m.appliedValues.length>0?m.appliedValues.map(_=>` ${_.path} \u2192 ${_.value}`):[]].join(` `):v,E=h.length>0?{ok:!1,command:Ya,error:k,data:m}:ke(Ya,k,m);return V(r,E)}catch(n){return V(r,ae(Ya,lt(n)))}})}p();var Rd="quartz-syncer:test",tG={format:{value:"",description:"Output format (default: text)"}};function fF(t,e){t(Rd,"Test repository connection and credentials",tG,async r=>{try{let n=Yt(e,r,Rd);if(n)return n;let i=e.getGitSettingsWithSecret(),{includeVerbose:s}=vt(r),o=Zi(e),a=await o.testConnection(),l=a?await et.checkWriteAccess(i.remoteUrl,i.auth,i.corsProxyUrl):!1,c={repository:o.getRepositoryName(),branch:i.branch,readAccess:a,writeAccess:l},u=a?`Connection OK (read: ${a?"yes":"no"}, write: ${l?"yes":"no"}).`:"Connection failed.",f=[`type: ${i.auth?.type??"unknown"}`];i.auth?.username&&f.push(`username: ${i.auth.username}`);let d=s&&a?[u,`Repository: ${c.repository}`,`Branch: ${c.branch}`,`Auth: ${f.join(", ")}`].join(` `):u;return V(r,a?ke(Rd,d,c):ae(Rd,d))}catch(n){return V(r,ae(Rd,lt(n)))}})}p();var dF=require("obsidian");var Ji="quartz-syncer:cache",rG={action:{value:"",description:"Cache operation to perform"},path:{value:"",description:"File path (required for action=clear)"},force:{description:"Skip confirmation for clear-all"},format:{value:"",description:"Output format (default: text)"}};function hF(t,e){t(Ji,"Manage the Quartz Syncer cache",rG,async r=>{try{if(!e.settings.useCache||!e.datastore)return V(r,ae(Ji,"Cache is disabled."));let{includeVerbose:n}=vt(r),i=Jc(r,"action");if(!i)return V(r,ae(Ji,"Missing required flag: action"));if(i==="status"){let s=await e.datastore.allFiles(),o=await e.datastore.getLastUpdateTimestamp(),a={count:s.length,files:s,lastUpdated:o},l=`Cache contains ${s.length} ${He(s.length,"file")}.`,c=n&&s.length>0?[l,...s.map(u=>` ${u}`)].join(` `):l;return V(r,ke(Ji,c,a))}if(i==="clear"){let s=Jc(r,"path");if(!s)return V(r,ae(Ji,"Missing required flag: path"));let o=(0,dF.normalizePath)(s);await e.datastore.persister.removeItem(e.datastore.fileKey(o)),await e.datastore.setLastUpdateTimestamp(Date.now(),e);let a=`Cache cleared for ${o}.`;return V(r,ke(Ji,a,{path:o}))}return i==="clear-all"?r.force==="true"?(await e.datastore.recreate(),await e.datastore.setLastUpdateTimestamp(Date.now(),e),V(r,ke(Ji,"Cache cleared for all files.",{cleared:!0}))):V(r,ae(Ji,"Clearing all cache requires the 'force' flag.")):V(r,ae(Ji,"Invalid action. Use status, clear, or clear-all."))}catch(n){return V(r,ae(Ji,lt(n)))}})}p();var d0=require("obsidian");p();var pF=new Set(["__proto__","constructor","prototype"]);function Od(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ag(t,e){let r=e.split(".");if(r.some(i=>pF.has(i)))return;let n=t;for(let i of r){if(!Od(n)||!Object.hasOwn(n,i))return;n=n[i]}return n}function Ig(t,e,r){let n=e.split(".");if(n.some(o=>pF.has(o)))return!1;let i=t;for(let o=0;o",description:"Config operation"},key:{value:"",description:"Dot-notation setting key"},value:{value:"",description:"Value for action=set"},format:{value:"",description:"Output format (default: text)"}},iG={gitRemoteUrl:"string",gitBranch:"string",gitCorsProxyUrl:"string",gitAuthType:"string",gitAuthUsername:"string",gitProviderHint:"string",contentFolder:"string",vaultPath:"string",publishFrontmatterKey:"string",allNotesPublishableByDefault:"boolean",useCache:"boolean",syncCache:"boolean",useDataview:"boolean",useDatacore:"boolean",useExcalidraw:"boolean",useFantasyStatblocks:"boolean",useBases:"boolean",useCanvas:"boolean",frontmatterFormat:"string",diffViewStyle:"string"},sG={gitAuthType:["none","basic","bearer"],gitProviderHint:["github","gitlab","bitbucket","gitea","custom"],frontmatterFormat:["yaml","json"],diffViewStyle:["split","unified","auto"]};function oG(t,e){let r={...t};return e&&(r.gitAuthSecret="***"),r}function mF(t,e){t(Nr,"Read or update Quartz Syncer settings",nG,async r=>{try{let{includeVerbose:n}=vt(r),i=Jc(r,"action","list"),s=!!e.getGitSettingsWithSecret().auth?.secret;if(i==="list"){let a=oG(e.settings,s),{cache:l,cacheTimestamp:c,...u}=a,f=Object.entries(Nd(u)).map(([d,h])=>`${d}=${h}`).join(` `);return V(r,ke(Nr,f,u))}let o=Jc(r,"key");if(!o)return V(r,ae(Nr,"Missing required flag: key"));if(i==="get"){if(o==="git.auth.secret"){let f=s?"***":"not set",d={key:o,value:f},h=`${o}="${f}"`,g=n?`${h} (type: string)`:h;return V(r,ke(Nr,g,d))}let a=Ag(e.settings,o);if(a===void 0)return V(r,ae(Nr,"Unknown setting key."));let l={key:o,value:a},c=`${o}=${JSON.stringify(a)}`,u=n?`${c} (type: ${typeof a})`:c;return V(r,ke(Nr,u,l))}if(i==="set"){if(o==="git.auth.secret")return V(r,ae(Nr,"git.auth.secret cannot be set via CLI."));let a=iG[o];if(!a)return V(r,ae(Nr,"Setting is not writable via CLI."));if(typeof r.value!="string")return V(r,ae(Nr,"Missing required flag: value"));let l=r.value,c=Sg(a,l);if(c===null)return V(r,ae(Nr,`Invalid value for ${o}. Expected ${a}.`));let u=sG[o];if(u&&typeof c=="string"&&!u.includes(c))return V(r,ae(Nr,`Invalid value for ${o}. Expected one of: ${u.join(", ")}.`));let f=c;if(typeof c=="string")if(o==="vaultPath"){let m=c.trim();if(m==="/"||m==="")f="/";else{let y=(0,d0.normalizePath)(m);f=y.endsWith("/")?y:y+"/"}}else o==="contentFolder"&&(f=(0,d0.normalizePath)(c.trim()));if(!Ig(e.settings,o,f))return V(r,ae(Nr,"Failed to set value."));await e.saveSettings();let h={key:o,value:f},g=`Updated ${o}.`;return V(r,ke(Nr,g,h))}return V(r,ae(Nr,"Invalid action. Use get, set, or list."))}catch(n){return V(r,ae(Nr,lt(n)))}})}p();var Za="quartz-syncer:upgrade",aG={force:{description:"Apply upgrade (required)"},"dry-run":{description:"Check for updates without applying"},format:{value:"",description:"Output format (default: text)"}};function gF(t,e){t(Za,"Upgrade the Quartz repository from upstream",aG,async r=>{try{let n=Yt(e,r,Za);if(n)return n;let i=e.getGitSettingsWithSecret(),s=Zi(e),o=r["dry-run"]==="true",{includeVerbose:a}=vt(r);if(o){let d=e.settings.lastUpstreamCommitSha||null,h=await et.fetchRemoteHeadCommit(Bc,z_,Uc,i.corsProxyUrl);if(h===null)return V(r,ae(Za,"Could not check upstream. The remote may be unreachable."));let g=h!==d,m=g?"Upstream updates available.":"Already up to date.",y=[`Recorded SHA: ${d??"none"}`,`Upstream HEAD: ${h}`],v=a?Or(a,[{label:m,items:[`Upstream: ${Bc}#${Uc}`,...y]}],m).replace(/\n\t/g,` `):m;return V(r,ke(Za,v,{lastUpstreamCommitSha:d??null,upstreamHead:h,hasUpdate:g}))}if(!(r.force==="true"))return V(r,ae(Za,"Upgrade requires the 'force' flag."));let c=await s.upgradeFromUpstream(Bc,Uc);c.oid&&e.settings.lastUpstreamCommitSha!==c.oid&&(e.settings.lastUpstreamCommitSha=c.oid,await e.saveSettings());let u=c.alreadyMerged?"Already up to date.":`Upgraded to ${c.oid}.`,f=a?Or(a,[{label:u,items:[`Upstream SHA: ${c.oid}`,`Recorded SHA: ${e.settings.lastUpstreamCommitSha||"none"}`]}],u).replace(/\n\t/g,` `):u;return V(r,ke(Za,f,c))}catch(n){return V(r,ae(Za,lt(n)))}})}p();var yF=require("obsidian");var Pg="quartz-syncer:version",lG={format:{value:"",description:"Output format (default: text)"}},cG={"v5-yaml":"quartz.config.yaml","v5-json":"quartz.plugins.json",v4:"quartz.config.ts",unknown:"unknown"};function wF(t,e){t(Pg,"Show plugin, Obsidian, and Quartz version information",lG,async r=>{try{let{includeVerbose:n}=vt(r),i=e.appVersion,s=yF.apiVersion??"unknown",o="unknown",a=null,l=null;Yt(e,r,Pg)||(l=Zi(e),o=await fi.detectQuartzVersion(l),a=await fi.getQuartzPackageVersion(l));let u=a??"unknown",f=o??"unknown",d=cG[f]??"unknown",h=[`Quartz Syncer: ${i}`,`Obsidian: ${s}`,`Quartz: ${u} (${f})`],g=l?[`Repository: ${l.getRepositoryName()}`,`Branch: ${e.settings.gitBranch}`,`Quartz config: ${d}`]:["Git: not configured"],m=n?[...h,...g].join(` `):h.join(` `);return V(r,ke(Pg,m,{pluginVersion:i,obsidianVersion:s,quartzVersion:a,quartzFormat:f}))}catch(n){return V(r,ae(Pg,lt(n)))}})}p();var Fr="quartz-syncer:plugin",uG={action:{value:"",description:"Plugin operation (default: list)"},source:{value:"",description:"Plugin source identifier"},force:{description:"Required for plugin removal"},format:{value:"",description:"Output format (default: text)"}};function fG(t){return new xo(Zi(t))}function dG(t,e){let r=[];for(let n of t){let i=yr(n.source),s=n.enabled?"enabled":"disabled",o=n.order??ig;r.push(`${i} [${s}] (order: ${o})`),e&&(r.push(` Source: ${Pr(n.source)}`),r.push(` Options: ${JSON.stringify(n.options??{})}`))}return r.join(` `)}function hG(t,e){let r=[];for(let n of t){let i=n.hasUpdate?"update available":"up to date";r.push(`${n.name} [${i}]`),e&&(r.push(` Locked: ${n.lockedCommit??"none"}`),r.push(` Remote: ${n.remoteCommit??"unknown"}`),n.error&&r.push(` Error: ${n.error}`))}return r.join(` `)}function pG(t,e){let r=[];for(let n of t){let i=n.official?" [official]":"";r.push(`${n.name} - ${n.description}${i}`),e&&(r.push(` Source: ${Pr(n.source)}`),r.push(` Tags: ${n.tags.join(", ")||"none"}`))}return r.join(` `)}function vF(t,e){t(Fr,"Manage Quartz v5 plugins",uG,async r=>{try{let{includeVerbose:n}=vt(r),i=typeof r.action=="string"?r.action:"list";if(i==="browse"){let u=await new jc().getPlugins(),f=pG(u,n);return V(r,ke(Fr,f,{plugins:u}))}let s=Yt(e,r,Fr);if(s)return s;let o=fG(e),a=await o.readConfig();if(i==="list"){let c=dG(a.plugins,n),u={plugins:a.plugins.map(f=>({name:yr(f.source),sourceKey:Pr(f.source),enabled:f.enabled,order:f.order??ig,options:f.options??{},source:f.source}))};return V(r,ke(Fr,c,u))}if(i==="updates"){let c=await o.readLockFile(),u=e.getGitSettingsWithSecret(),d=await new So(u.auth,u.corsProxyUrl||void 0).checkUpdates(a.plugins,c),h=d.filter(y=>y.hasUpdate),g=n?d:h,m=g.length>0?hG(g,n):"All plugins are up to date.";return V(r,ke(Fr,m,{updates:d,updatable:h.length}))}if(i==="update"){let c=await o.readLockFile(),u=e.getGitSettingsWithSecret(),h=(await new So(u.auth,u.corsProxyUrl||void 0).checkUpdates(a.plugins,c)).filter(v=>v.hasUpdate&&v.remoteCommit);if(h.length===0)return V(r,ke(Fr,"All plugins are up to date.",{updated:0}));if(r.force!=="true"){let v=h.map(b=>b.name).join(", ");return V(r,ae(Fr,`${h.length} ${He(h.length,"plugin")} can be updated (${v}). Use 'force' to apply.`))}let g=c??{version:"1.0.0",plugins:{}};for(let v of h){let b=a.plugins.find(k=>yr(k.source)===v.name);g.plugins[v.name]?g.plugins[v.name].commit=v.remoteCommit:b&&(g.plugins[v.name]={source:b.source,resolved:ko(b.source),commit:v.remoteCommit,installedAt:new Date().toISOString()})}await o.writeLockFile(g,`Update ${h.length} ${He(h.length,"plugin")}`);let m=h.map(v=>v.name),y=`Updated ${h.length} ${He(h.length,"plugin")}: ${m.join(", ")}.`;return V(r,ke(Fr,y,{updated:h.length,plugins:h.map(v=>({name:v.name,from:v.lockedCommit,to:v.remoteCommit}))}))}let l=typeof r.source=="string"?r.source:"";if(i==="add"){if(!l)return V(r,ae(Fr,"Missing required flag: source"));let u=new qa().addPlugin(a,l),f=yr(u.source);return await o.writeConfig(a,`Add plugin: ${f}`),V(r,ke(Fr,`Added plugin ${f}.`,{name:f,source:u.source}))}if(i==="remove"){if(!l)return V(r,ae(Fr,"Missing required flag: source"));if(r.force!=="true")return V(r,ae(Fr,"Removing a plugin requires the 'force' flag."));let c=new qa,u=Pr(l),f=c.removePlugin(a,u),d=yr(f.source);return await o.writeConfig(a,`Remove plugin: ${d}`),V(r,ke(Fr,`Removed plugin ${d}.`,{name:d,source:f.source}))}return V(r,ae(Fr,"Invalid action. Use list, add, remove, updates, update, or browse."))}catch(n){return V(r,ae(Fr,lt(n)))}})}p();var Jr="quartz-syncer:quartz-config",mG={action:{value:"",description:"Config operation (default: list)"},key:{value:"",description:"Dot-notation config key (e.g., pageTitle, theme.typography.header)"},value:{value:"",description:"New value for action=set"},format:{value:"",description:"Output format (default: text)"}},gG={pageTitle:"string",pageTitleSuffix:"string",enableSPA:"boolean",enablePopovers:"boolean",locale:"string",baseUrl:"string","theme.fontOrigin":"string","theme.cdnCaching":"boolean","theme.typography.header":"string","theme.typography.body":"string","theme.typography.code":"string","theme.colors.lightMode.light":"string","theme.colors.lightMode.lightgray":"string","theme.colors.lightMode.gray":"string","theme.colors.lightMode.darkgray":"string","theme.colors.lightMode.dark":"string","theme.colors.lightMode.secondary":"string","theme.colors.lightMode.tertiary":"string","theme.colors.lightMode.highlight":"string","theme.colors.lightMode.textHighlight":"string","theme.colors.darkMode.light":"string","theme.colors.darkMode.lightgray":"string","theme.colors.darkMode.gray":"string","theme.colors.darkMode.darkgray":"string","theme.colors.darkMode.dark":"string","theme.colors.darkMode.secondary":"string","theme.colors.darkMode.tertiary":"string","theme.colors.darkMode.highlight":"string","theme.colors.darkMode.textHighlight":"string"},yG=new Set(["googleFonts","local"]);function bF(t,e){t(Jr,"Read or update Quartz v5 site configuration",mG,async r=>{try{let n=Yt(e,r,Jr);if(n)return n;let i=typeof r.action=="string"?r.action:"list",s=new xo(Zi(e));if(i==="list"){let a=await s.readConfig(),l=Nd(a.configuration),c=Object.entries(l).map(([u,f])=>`${u}=${f}`).join(` `);return V(r,ke(Jr,c,a.configuration))}let o=typeof r.key=="string"?r.key:"";if(!o)return V(r,ae(Jr,"Missing required flag: key"));if(i==="get"){let a=await s.readConfig(),l=Ag(a.configuration,o);if(l===void 0)return V(r,ae(Jr,"Unknown config key."));let c={key:o,value:l},u=`${o}=${JSON.stringify(l)}`;return V(r,ke(Jr,u,c))}if(i==="set"){let a=gG[o];if(!a)return V(r,ae(Jr,"Config key is not writable via CLI."));if(typeof r.value!="string")return V(r,ae(Jr,"Missing required flag: value"));let l=Sg(a,r.value);if(l===null)return V(r,ae(Jr,`Invalid value for ${o}. Expected ${a}.`));if(o==="theme.fontOrigin"&&typeof l=="string"&&!yG.has(l))return V(r,ae(Jr,"Invalid value for theme.fontOrigin. Expected googleFonts or local."));let c=await s.readConfig();if(!Ig(c.configuration,o,l))return V(r,ae(Jr,"Failed to set value."));await s.writeConfig(c,`Update Quartz config: ${o}`);let f={key:o,value:l},d=`Updated ${o}.`;return V(r,ke(Jr,d,f))}return V(r,ae(Jr,"Invalid action. Use get, set, or list."))}catch(n){return V(r,ae(Jr,lt(n)))}})}p();var _F="quartz-syncer",wG={format:{value:"",description:"Output format (default: text)"}},xF=`Quartz Syncer CLI \u2014 Manage and publish notes to Quartz from the terminal. Usage: obsidian quartz-syncer[:] [flags] Commands: status Show the publish status of all marked notes sync Publish pending notes and optionally delete removed notes publish Publish pending notes without deletions delete Delete removed notes from the remote repository mark Set or toggle the publish flag for matching files test Test repository connection and credentials cache Manage the Quartz Syncer cache config Read or update Quartz Syncer settings upgrade Upgrade the Quartz repository from upstream version Show plugin, Obsidian, and Quartz version information plugin Manage Quartz v5 plugins quartz-config Read or update Quartz v5 site configuration Global flags (all commands): format= Output format (default: text) help, h Show command-specific help verbose, v Enable detailed output Command-specific flags: dry-run Preview changes (sync, publish, delete, mark, upgrade) force Required for destructive operations (sync, delete, upgrade, plugin) Examples: obsidian quartz-syncer:status obsidian quartz-syncer:status format=json obsidian quartz-syncer:sync force obsidian quartz-syncer:publish dry-run obsidian quartz-syncer:mark path="notes/post.md" obsidian quartz-syncer:mark path="blog/**/*.md" dry-run obsidian quartz-syncer:config action=get key=gitBranch Documentation: https://saberzero1.github.io/quartz-syncer-docs/`;function kF(t,e){t(_F,"Show available commands and usage information",wG,r=>r.format==="json"?V(r,ke(_F,xF,{commands:[{name:"quartz-syncer:status",description:"Show the publish status of all marked notes"},{name:"quartz-syncer:sync",description:"Publish pending notes and optionally delete removed notes"},{name:"quartz-syncer:publish",description:"Publish pending notes without deletions"},{name:"quartz-syncer:delete",description:"Delete removed notes from the remote repository"},{name:"quartz-syncer:mark",description:"Set or toggle the publish flag for matching files"},{name:"quartz-syncer:test",description:"Test repository connection and credentials"},{name:"quartz-syncer:cache",description:"Manage the Quartz Syncer cache"},{name:"quartz-syncer:config",description:"Read or update Quartz Syncer settings"},{name:"quartz-syncer:upgrade",description:"Upgrade the Quartz repository from upstream"},{name:"quartz-syncer:version",description:"Show plugin, Obsidian, and Quartz version information"},{name:"quartz-syncer:plugin",description:"Manage Quartz v5 plugins"},{name:"quartz-syncer:quartz-config",description:"Read or update Quartz v5 site configuration"}],version:e.appVersion})):xF)}function SF(t){let e=t;if(typeof e.registerCliHandler!="function")return!1;let r=e.registerCliHandler.bind(e),n=(i,s,o,a)=>{let l=zN(o);r(i,s,l,c=>{let u=DN(c);if(u.help==="true"&&i!=="quartz-syncer"){let f=MN(i,s,o);return u.format==="json"?V(u,{ok:!0,command:i,message:f}):f}return a(u)})};return kF(n,t),BN(n,t),UN(n,t),jN(n,t),qN(n,t),uF(n,t),fF(n,t),hF(n,t),mF(n,t),gF(n,t),wF(n,t),vF(n,t),bF(n,t),!0}var vG={settingsSchemaVersion:2,gitRemoteUrl:"",gitBranch:"v4",gitCorsProxyUrl:"",gitAuthType:"basic",gitAuthUsername:"",gitProviderHint:"github",vaultPath:"/",githubRepo:void 0,githubUserName:void 0,githubToken:void 0,contentFolder:"content",publishFrontmatterKey:"publish",allNotesPublishableByDefault:!1,showCreatedTimestamp:!0,showUpdatedTimestamp:!0,showPublishedTimestamp:!1,usePermalink:!1,includeAllFrontmatter:!1,frontmatterFormat:"yaml",createdTimestampKey:"created, created_at, date",updatedTimestampKey:"modified, lastmod, updated, last-modified",publishedTimestampKey:"published, publishDate, date",timestampFormat:"MMM dd, yyyy h:mm a",useCache:!0,syncCache:!0,persistCache:!1,cacheTimestamp:0,cache:"{}",useAutoCardLink:!1,useDataview:!0,useDatacore:!1,useExcalidraw:!1,useFantasyStatblocks:!1,useBases:!1,useCanvas:!1,manageSyncerStyles:!0,lastUsedSettingsTab:"git",noteSettingsIsInitialized:!1,pluginVersion:"",lastUpstreamCommitSha:"",upgradeCheckStrategy:"version",diffViewStyle:"auto",ENABLE_DEVELOPER_TOOLS:!1},$g=class extends Es.Plugin{appVersion;datastore;secretStorageService;extendedCache;publishModal;async onload(){this.appVersion=this.manifest.version,await this.loadSettings(),this.extendedCache=new xg(this.app),this.addSettingTab(new fg(this.app,this)),await this.addCommands(),SF(this),this.addRibbonIcon("leaf","Quartz Syncer publication center",async()=>{this.openPublishModal()})}onunload(){this.extendedCache?.destroy(),this.settings.persistCache||this.clearCacheForAllFiles(!0),super.onunload()}async onExternalSettingsChange(){await this.compareDataToCache()}async loadSettings(){this.settings=Object.assign({},vG,await this.loadData()),this.migrateGitHubSettings(),this.migrateNestedGitSettings(),this.migrateRemovedThemesTab(),this.migrateTimestampKeyDefaults(),await this.saveSettings(),this.secretStorageService=new Mc(this.app),await this.secretStorageService.migrateFromSettings(this.settings,()=>this.saveSettings()),!this.datastore&&this.settings.useCache&&(this.datastore=new vg(this.app.vault.getName(),this.manifest.id,this.appVersion)),(!this.settings||this.settings.pluginVersion!==this.appVersion)&&(await this.clearCacheForAllFiles(!0),this.settings.pluginVersion=this.appVersion),await this.compareDataToCache()}migrateGitHubSettings(){let e=this.settings,r=e.githubRepo||e.githubUserName||e.githubToken,n=this.settings.gitRemoteUrl;if(r&&!n){let i=e.githubRepo||"quartz",s=e.githubUserName||"",o=e.githubToken||"";this.settings.gitRemoteUrl=s?`https://github.com/${s}/${i}.git`:"",this.settings.gitBranch="v4",this.settings.gitCorsProxyUrl="",this.settings.gitAuthType="basic",this.settings.gitAuthUsername=s,this.settings.gitProviderHint="github",o&&(this.settings._pendingTokenMigration=o),this.settings.lastUsedSettingsTab==="github"&&(this.settings.lastUsedSettingsTab="git"),e.githubRepo=void 0,e.githubUserName=void 0,e.githubToken=void 0}}migrateNestedGitSettings(){let e=this.settings;if(e.git&&typeof e.git=="object"){let r=e.git,n=r.auth||{};this.settings.gitRemoteUrl=r.remoteUrl||"",this.settings.gitBranch=r.branch||"v4",this.settings.gitCorsProxyUrl=r.corsProxyUrl||"",this.settings.gitAuthType=n.type||"basic",this.settings.gitAuthUsername=n.username||"",this.settings.gitProviderHint=r.providerHint||"github",delete e.git,this.settings.settingsSchemaVersion=2}}migrateTimestampKeyDefaults(){let e=["","created"],r=["","modified"],n=["","published"];e.includes(this.settings.createdTimestampKey)&&(this.settings.createdTimestampKey="created, created_at, date"),r.includes(this.settings.updatedTimestampKey)&&(this.settings.updatedTimestampKey="modified, lastmod, updated, last-modified"),n.includes(this.settings.publishedTimestampKey)&&(this.settings.publishedTimestampKey="published, publishDate, date")}migrateRemovedThemesTab(){let e=this.settings;"useThemes"in e&&delete e.useThemes,this.settings.lastUsedSettingsTab==="themes"&&(this.settings.lastUsedSettingsTab="git")}async saveSettings(){await this.saveData(this.settings)}getGitSettingsWithSecret(){return{remoteUrl:this.settings.gitRemoteUrl,branch:this.settings.gitBranch,corsProxyUrl:this.settings.gitCorsProxyUrl||void 0,auth:{type:this.settings.gitAuthType,username:this.settings.gitAuthUsername||void 0,secret:this.secretStorageService.getToken()||void 0},providerHint:this.settings.gitProviderHint||void 0}}async addCommands(){this.addCommand({id:"open-publish-modal",name:"Open publication center",callback:async()=>{this.openPublishModal()}}),this.addCommand({id:"mark-note-for-publish",name:"Add publication flag",callback:async()=>{this.setPublishFlagValue(!0)}}),this.addCommand({id:"unmark-note-for-publish",name:"Remove publication flag",callback:async()=>{this.setPublishFlagValue(!1)}}),this.addCommand({id:"mark-toggle-publish-status",name:"Toggle publication flag",callback:async()=>{this.togglePublishFlag()}}),this.settings.useCache&&(this.addCommand({id:"clear-cache-for-active-file",name:"Clear cache for active file",callback:async()=>{await this.clearCacheForActiveFile()}}),this.addCommand({id:"clear-cache-for-all-files",name:"Clear cache for all files",callback:async()=>{await this.clearCacheForAllFiles()}}))}getActiveFile(e){let r=e.getActiveFile();return r||(new Es.Notice("Quartz Syncer: No file is open/active. Please open a file and try again."),null)}async clearCacheForActiveFile(){let e=this.getActiveFile(this.app.workspace);if(!e)return;let r=`file:${e.path}`;this.settings.useCache?(await this.datastore.persister.removeItem(r),this.settings.cacheTimestamp=Date.now(),await this.saveSettings(),await this.datastore.setLastUpdateTimestamp(this.settings.cacheTimestamp,this),new Es.Notice(`Quartz Syncer: Cache cleared for file: ${e.path}`)):new Es.Notice("Quartz Syncer: Cache is disabled, no action taken.")}async clearCacheForAllFiles(e=!1){if(e)this.datastore&&(this.settings.cache="{}",this.settings.cacheTimestamp=Date.now(),await this.saveSettings(),await this.datastore.persister.clear(),await this.datastore.dropOutdatedCache());else{if(!confirm("Are you sure you want to clear the Quartz Syncer cache for all files? This action cannot be undone.")){new Es.Notice("Quartz Syncer: Cache clearing cancelled.");return}this.settings.useCache?(this.settings.cache="{}",this.settings.cacheTimestamp=Date.now(),await this.saveSettings(),await this.datastore.setLastUpdateTimestamp(this.settings.cacheTimestamp,this),await this.datastore.recreate(),new Es.Notice("Quartz Syncer: Cache cleared for all files.")):new Es.Notice("Quartz Syncer: Cache is disabled, no action taken.")}}async setPublishFlagValue(e){let r=this.getActiveFile(this.app.workspace);if(!r)return;new ao(this.app.vault,this.app.metadataCache,r,this.app.fileManager).set(this.settings.publishFrontmatterKey,e).apply()}async togglePublishFlag(){let e=this.getActiveFile(this.app.workspace);if(!e)return;let r=new ao(this.app.vault,this.app.metadataCache,e,this.app.fileManager);r.set(this.settings.publishFrontmatterKey,!r.get(this.settings.publishFrontmatterKey)).apply()}openPublishModal(){if(!this.publishModal){let e=new wi(this.app.metadataCache,this.settings,this.getGitSettingsWithSecret()),r=new ha(this.app,this,this.app.vault,this.app.metadataCache,this.settings,this.datastore,this.extendedCache),n=new Da(e,r);this.publishModal=new am(this.app,n,r,e,this.settings)}this.publishModal.open()}async compareDataToCache(){if(!this.settings.useCache||!this.settings.syncCache)return;let e=await this.datastore.getLastUpdateTimestamp();e===null&&(e=0),e *) buffer/index.js: (*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT *) safe-buffer/index.js: safe-buffer/index.js: (*! safe-buffer. MIT License. Feross Aboukhadijeh *) crc-32/crc32.js: (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) isomorphic-git/index.cjs: (*! * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements. * SPDX-License-Identifier: LGPL-3.0-or-later * Copyright (c) James Prevett and other ZenFS contributors. *) */ /* nosourcemap */