From d051ed47d456861d5b63fb6a9c577c65a2425135 Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Thu, 26 Sep 2024 23:20:25 +0200 Subject: [PATCH] initial commit --- .obsidian-ocr.sqlite | Bin 0 -> 36864 bytes .obsidian/app.json | 1 + .obsidian/appearance.json | 3 + .obsidian/community-plugins.json | 5 + .obsidian/core-plugins-migration.json | 30 + .obsidian/core-plugins.json | 20 + .obsidian/graph.json | 22 + .obsidian/plugins/obsidian-git/data.json | 56 + .obsidian/plugins/obsidian-git/main.js | 350 + .obsidian/plugins/obsidian-git/manifest.json | 10 + .obsidian/plugins/obsidian-git/styles.css | 566 + .obsidian/plugins/obsidian-ocr/main.js | 65032 +++++++++++++++++ .obsidian/plugins/obsidian-ocr/manifest.json | 11 + .obsidian/plugins/obsidian-ocr/styles.css | 35 + .obsidian/plugins/pdf-plus/data.json | 311 + .obsidian/plugins/pdf-plus/main.js | 120 + .obsidian/plugins/pdf-plus/manifest.json | 15 + .obsidian/plugins/pdf-plus/styles.css | 605 + .obsidian/workspace.json | 172 + prova per obsidian.md | 9 + 20 files changed, 67373 insertions(+) create mode 100644 .obsidian-ocr.sqlite create mode 100644 .obsidian/app.json create mode 100644 .obsidian/appearance.json create mode 100644 .obsidian/community-plugins.json create mode 100644 .obsidian/core-plugins-migration.json create mode 100644 .obsidian/core-plugins.json create mode 100644 .obsidian/graph.json create mode 100644 .obsidian/plugins/obsidian-git/data.json create mode 100644 .obsidian/plugins/obsidian-git/main.js create mode 100644 .obsidian/plugins/obsidian-git/manifest.json create mode 100644 .obsidian/plugins/obsidian-git/styles.css create mode 100644 .obsidian/plugins/obsidian-ocr/main.js create mode 100644 .obsidian/plugins/obsidian-ocr/manifest.json create mode 100644 .obsidian/plugins/obsidian-ocr/styles.css create mode 100644 .obsidian/plugins/pdf-plus/data.json create mode 100644 .obsidian/plugins/pdf-plus/main.js create mode 100644 .obsidian/plugins/pdf-plus/manifest.json create mode 100644 .obsidian/plugins/pdf-plus/styles.css create mode 100644 .obsidian/workspace.json create mode 100644 prova per obsidian.md diff --git a/.obsidian-ocr.sqlite b/.obsidian-ocr.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..a24c8cc8a9c1af794a9988d571340febb5ba678d GIT binary patch literal 36864 zcmeI(-A>wI7{KvXkuN{bdSuds6NqMuS$4Q&467kiRKx>!(o}fGW>BaUa)MOBrzx~?cn z${%z77!AR4Fh+wK%{($qDKFe_i_5>2Y`&l@{aF6F)Li&AzrFB1UzpE6@;x>ofB*sr zAbDM~b#^_5FHvw_HEg-y6qz`KYm1t@(}b8nwpySR1bBSknF^%yUbg z1?@<2DaXT(YSn`yqZo@W1$$L`lTB*}YpP;9Eph2xbo?L1rq!3daM>I=4s&Bnr8MN_o?WnU?lv z)4}EAc+fKjUCR>}ec?34ZBL69Q?dGtY%DrfSFHP?rK_Bp(Fz6ideG+3z75UJ#M&C# z5Zk-)Zg(FUl^e in t?ka(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Tk=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ck=(t,e)=>{for(var n in e)ka(t,n,{get:e[n],enumerable:!0})},Gp=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Sk(e))!kk.call(t,i)&&i!==n&&ka(t,i,{get:()=>e[i],enumerable:!(r=_k(e,i))||r.enumerable});return t};var Ve=(t,e,n)=>(n=t!=null?xk(Ek(t)):{},Gp(e||!t||!t.__esModule?ka(n,"default",{value:t,enumerable:!0}):n,t)),Fk=t=>Gp(ka({},"__esModule",{value:!0}),t);var ot=(t,e,n)=>Ak(t,typeof e!="symbol"?e+"":e,n);var qp=L(so=>{"use strict";v();so.byteLength=Ok;so.toByteArray=Pk;so.fromByteArray=jk;var mn=[],Yt=[],Mk=typeof Uint8Array!="undefined"?Uint8Array:Array,ru="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tr=0,Vp=ru.length;Tr0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function Ok(t){var e=Wp(t),n=e[0],r=e[1];return(n+r)*3/4-r}function Ik(t,e,n){return(e+n)*3/4-n}function Pk(t){var e,n=Wp(t),r=n[0],i=n[1],a=new Mk(Ik(t,r,i)),s=0,o=i>0?r-4:r,l;for(l=0;l>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Yt[t.charCodeAt(l)]<<2|Yt[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Yt[t.charCodeAt(l)]<<10|Yt[t.charCodeAt(l+1)]<<4|Yt[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Rk(t){return mn[t>>18&63]+mn[t>>12&63]+mn[t>>6&63]+mn[t&63]}function Lk(t,e,n){for(var r,i=[],a=e;ao?o:s+a));return r===1?(e=t[n-1],i.push(mn[e>>2]+mn[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(mn[e>>10]+mn[e>>4&63]+mn[e<<2&63]+"=")),i.join("")}});var Xp=L(iu=>{v();iu.read=function(t,e,n,r,i){var a,s,o=i*8-r-1,l=(1<>1,u=-7,f=n?i-1:0,d=n?-1:1,h=t[e+f];for(f+=d,a=h&(1<<-u)-1,h>>=-u,u+=o;u>0;a=a*256+t[e+f],f+=d,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=r;u>0;s=s*256+t[e+f],f+=d,u-=8);if(a===0)a=1-c;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-c}return(h?-1:1)*s*Math.pow(2,a-r)};iu.write=function(t,e,n,r,i,a){var s,o,l,c=a*8-i-1,u=(1<>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,p=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+h]=o&255,h+=p,o/=256,i-=8);for(s=s<0;t[n+h]=s&255,h+=p,s/=256,c-=8);t[n+h-p]|=m*128}});var hu=L(ci=>{"use strict";v();var au=qp(),oi=Xp(),Yp=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ci.Buffer=I;ci.SlowBuffer=Uk;ci.INSPECT_MAX_BYTES=50;var oo=2147483647;ci.kMaxLength=oo;I.TYPED_ARRAY_SUPPORT=Dk();!I.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Dk(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(I.prototype,"parent",{enumerable:!0,get:function(){if(I.isBuffer(this))return this.buffer}});Object.defineProperty(I.prototype,"offset",{enumerable:!0,get:function(){if(I.isBuffer(this))return this.byteOffset}});function Pn(t){if(t>oo)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,I.prototype),e}function I(t,e,n){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return cu(t)}return Jp(t,e,n)}I.poolSize=8192;function Jp(t,e,n){if(typeof t=="string")return Nk(t,e);if(ArrayBuffer.isView(t))return $k(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(gn(t,ArrayBuffer)||t&&gn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(gn(t,SharedArrayBuffer)||t&&gn(t.buffer,SharedArrayBuffer)))return ou(t,e,n);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return I.from(r,e,n);let i=Hk(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return I.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}I.from=function(t,e,n){return Jp(t,e,n)};Object.setPrototypeOf(I.prototype,Uint8Array.prototype);Object.setPrototypeOf(I,Uint8Array);function em(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Bk(t,e,n){return em(t),t<=0?Pn(t):e!==void 0?typeof n=="string"?Pn(t).fill(e,n):Pn(t).fill(e):Pn(t)}I.alloc=function(t,e,n){return Bk(t,e,n)};function cu(t){return em(t),Pn(t<0?0:uu(t)|0)}I.allocUnsafe=function(t){return cu(t)};I.allocUnsafeSlow=function(t){return cu(t)};function Nk(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!I.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=tm(t,e)|0,r=Pn(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function su(t){let e=t.length<0?0:uu(t.length)|0,n=Pn(e);for(let r=0;r=oo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oo.toString(16)+" bytes");return t|0}function Uk(t){return+t!=t&&(t=0),I.alloc(+t)}I.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==I.prototype};I.compare=function(e,n){if(gn(e,Uint8Array)&&(e=I.from(e,e.offset,e.byteLength)),gn(n,Uint8Array)&&(n=I.from(n,n.offset,n.byteLength)),!I.isBuffer(e)||!I.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===n)return 0;let r=e.length,i=n.length;for(let a=0,s=Math.min(r,i);ai.length?(I.isBuffer(s)||(s=I.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(I.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function tm(t,e){if(I.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||gn(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let n=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return lu(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return um(t).length;default:if(i)return r?-1:lu(t).length;e=(""+e).toLowerCase(),i=!0}}I.byteLength=tm;function zk(t,e,n){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Jk(this,e,n);case"utf8":case"utf-8":return rm(this,e,n);case"ascii":return Kk(this,e,n);case"latin1":case"binary":return Qk(this,e,n);case"base64":return Yk(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return eA(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}I.prototype._isBuffer=!0;function Cr(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}I.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;nn&&(e+=" ... "),""};Yp&&(I.prototype[Yp]=I.prototype.inspect);I.prototype.compare=function(e,n,r,i,a){if(gn(e,Uint8Array)&&(e=I.from(e,e.offset,e.byteLength)),!I.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(n===void 0&&(n=0),r===void 0&&(r=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),n<0||r>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&n>=r)return 0;if(i>=a)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,a>>>=0,this===e)return 0;let s=a-i,o=r-n,l=Math.min(s,o),c=this.slice(i,a),u=e.slice(n,r);for(let f=0;f2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,du(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof e=="string"&&(e=I.from(e,r)),I.isBuffer(e))return e.length===0?-1:Zp(t,e,n,r,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):Zp(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Zp(t,e,n,r,i){let a=1,s=t.length,o=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;a=2,s/=2,o/=2,n/=2}function l(u,f){return a===1?u[f]:u.readUInt16BE(f*a)}let c;if(i){let u=-1;for(c=n;cs&&(n=s-o),c=n;c>=0;c--){let u=!0;for(let f=0;fi&&(r=i)):r=i;let a=e.length;r>a/2&&(r=a/2);let s;for(s=0;s>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-n;if((r===void 0||r>a)&&(r=a),e.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return Gk(this,e,n,r);case"utf8":case"utf-8":return Vk(this,e,n,r);case"ascii":case"latin1":case"binary":return Wk(this,e,n,r);case"base64":return qk(this,e,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xk(this,e,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};I.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Yk(t,e,n){return e===0&&n===t.length?au.fromByteArray(t):au.fromByteArray(t.slice(e,n))}function rm(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i239?4:a>223?3:a>191?2:1;if(i+o<=n){let l,c,u,f;switch(o){case 1:a<128&&(s=a);break;case 2:l=t[i+1],(l&192)===128&&(f=(a&31)<<6|l&63,f>127&&(s=f));break;case 3:l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(f=(a&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(a&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=o}return Zk(r)}var Kp=4096;function Zk(t){let e=t.length;if(e<=Kp)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr)&&(n=r);let i="";for(let a=e;ar&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),nn)throw new RangeError("Trying to access beyond buffer length")}I.prototype.readUintLE=I.prototype.readUIntLE=function(e,n,r){e=e>>>0,n=n>>>0,r||lt(e,n,this.length);let i=this[e],a=1,s=0;for(;++s>>0,n=n>>>0,r||lt(e,n,this.length);let i=this[e+--n],a=1;for(;n>0&&(a*=256);)i+=this[e+--n]*a;return i};I.prototype.readUint8=I.prototype.readUInt8=function(e,n){return e=e>>>0,n||lt(e,1,this.length),this[e]};I.prototype.readUint16LE=I.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||lt(e,2,this.length),this[e]|this[e+1]<<8};I.prototype.readUint16BE=I.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||lt(e,2,this.length),this[e]<<8|this[e+1]};I.prototype.readUint32LE=I.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};I.prototype.readUint32BE=I.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};I.prototype.readBigUInt64LE=Kn(function(e){e=e>>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=n+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(i)+(BigInt(a)<>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=n*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(i)<>>0,n=n>>>0,r||lt(e,n,this.length);let i=this[e],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*n)),i};I.prototype.readIntBE=function(e,n,r){e=e>>>0,n=n>>>0,r||lt(e,n,this.length);let i=n,a=1,s=this[e+--i];for(;i>0&&(a*=256);)s+=this[e+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*n)),s};I.prototype.readInt8=function(e,n){return e=e>>>0,n||lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};I.prototype.readInt16LE=function(e,n){e=e>>>0,n||lt(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};I.prototype.readInt16BE=function(e,n){e=e>>>0,n||lt(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};I.prototype.readInt32LE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};I.prototype.readInt32BE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};I.prototype.readBigInt64LE=Kn(function(e){e=e>>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(i)<>>0,li(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Aa(e,this.length-8);let i=(n<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,n||lt(e,4,this.length),oi.read(this,e,!0,23,4)};I.prototype.readFloatBE=function(e,n){return e=e>>>0,n||lt(e,4,this.length),oi.read(this,e,!1,23,4)};I.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||lt(e,8,this.length),oi.read(this,e,!0,52,8)};I.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||lt(e,8,this.length),oi.read(this,e,!1,52,8)};function Ft(t,e,n,r,i,a){if(!I.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}I.prototype.writeUintLE=I.prototype.writeUIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Ft(this,e,n,r,o,0)}let a=1,s=0;for(this[n]=e&255;++s>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Ft(this,e,n,r,o,0)}let a=r-1,s=1;for(this[n+a]=e&255;--a>=0&&(s*=256);)this[n+a]=e/s&255;return n+r};I.prototype.writeUint8=I.prototype.writeUInt8=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,1,255,0),this[n]=e&255,n+1};I.prototype.writeUint16LE=I.prototype.writeUInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2};I.prototype.writeUint16BE=I.prototype.writeUInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2};I.prototype.writeUint32LE=I.prototype.writeUInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4};I.prototype.writeUint32BE=I.prototype.writeUInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function im(t,e,n,r,i){cm(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,n}function am(t,e,n,r,i){cm(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n+7]=a,a=a>>8,t[n+6]=a,a=a>>8,t[n+5]=a,a=a>>8,t[n+4]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s=s>>8,t[n+2]=s,s=s>>8,t[n+1]=s,s=s>>8,t[n]=s,n+8}I.prototype.writeBigUInt64LE=Kn(function(e,n=0){return im(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});I.prototype.writeBigUInt64BE=Kn(function(e,n=0){return am(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});I.prototype.writeIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Ft(this,e,n,r,l-1,-l)}let a=0,s=1,o=0;for(this[n]=e&255;++a>0)-o&255;return n+r};I.prototype.writeIntBE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Ft(this,e,n,r,l-1,-l)}let a=r-1,s=1,o=0;for(this[n+a]=e&255;--a>=0&&(s*=256);)e<0&&o===0&&this[n+a+1]!==0&&(o=1),this[n+a]=(e/s>>0)-o&255;return n+r};I.prototype.writeInt8=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1};I.prototype.writeInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2};I.prototype.writeInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2};I.prototype.writeInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4};I.prototype.writeInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Ft(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};I.prototype.writeBigInt64LE=Kn(function(e,n=0){return im(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});I.prototype.writeBigInt64BE=Kn(function(e,n=0){return am(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function sm(t,e,n,r,i,a){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function om(t,e,n,r,i){return e=+e,n=n>>>0,i||sm(t,e,n,4,34028234663852886e22,-34028234663852886e22),oi.write(t,e,n,r,23,4),n+4}I.prototype.writeFloatLE=function(e,n,r){return om(this,e,n,!0,r)};I.prototype.writeFloatBE=function(e,n,r){return om(this,e,n,!1,r)};function lm(t,e,n,r,i){return e=+e,n=n>>>0,i||sm(t,e,n,8,17976931348623157e292,-17976931348623157e292),oi.write(t,e,n,r,52,8),n+8}I.prototype.writeDoubleLE=function(e,n,r){return lm(this,e,n,!0,r)};I.prototype.writeDoubleBE=function(e,n,r){return lm(this,e,n,!1,r)};I.prototype.copy=function(e,n,r,i){if(!I.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),n>=e.length&&(n=e.length),n||(n=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-n>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let a;if(typeof e=="number")for(a=n;a2**32?i=Qp(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=Qp(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);function Qp(t){let e="",n=t.length,r=t[0]==="-"?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function tA(t,e,n){li(e,"offset"),(t[e]===void 0||t[e+n]===void 0)&&Aa(e,t.length-(n+1))}function cm(t,e,n,r,i,a){if(t>n||t3?e===0||e===BigInt(0)?o=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:o=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:o=`>= ${e}${s} and <= ${n}${s}`,new si.ERR_OUT_OF_RANGE("value",o,t)}tA(r,i,a)}function li(t,e){if(typeof t!="number")throw new si.ERR_INVALID_ARG_TYPE(e,"number",t)}function Aa(t,e,n){throw Math.floor(t)!==t?(li(t,n),new si.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new si.ERR_BUFFER_OUT_OF_BOUNDS:new si.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}var nA=/[^+/0-9A-Za-z-_]/g;function rA(t){if(t=t.split("=")[0],t=t.trim().replace(nA,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function lu(t,e){e=e||1/0;let n,r=t.length,i=null,a=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(s+1===r){(e-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return a}function iA(t){let e=[];for(let n=0;n>8,i=n%256,a.push(i),a.push(r);return a}function um(t){return au.toByteArray(rA(t))}function lo(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function gn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function du(t){return t!==t}var sA=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Kn(t){return typeof BigInt=="undefined"?oA:t}function oA(){throw new Error("BigInt not supported")}});var fm,pu,Buffer,v=Tk(()=>{fm=require("obsidian");fm.Platform.isMobileApp?pu=hu().Buffer:pu=global.Buffer;Buffer=pu});var hm=L((_j,dm)=>{"use strict";v();var Dt=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process=="undefined"||typeof process.domain=="undefined")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||Dt.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Dt.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Dt.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Dt.DEFAULT_MAX_PENDING};Dt.DEFAULT_TIMEOUT=0;Dt.DEFAULT_MAX_OCCUPATION_TIME=0;Dt.DEFAULT_MAX_EXECUTION_TIME=0;Dt.DEFAULT_MAX_PENDING=1e3;Dt.prototype.acquire=function(t,e,n,r){if(Array.isArray(t))return this._acquireBatch(t,e,n,r);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof n!="function"&&(r=n,n=null,s=new this.Promise(function(b,x){i=b,a=x})),r=r||{};var o=!1,l=null,c=null,u=null,f=this,d=function(b,x,E){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(s?x?a(x):i(E):typeof n=="function"&&n(x,E),o=!0),b&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},h=function(b){if(o)return d(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[t]=process.domain);var x=r.maxExecutionTime||f.maxExecutionTime;if(x&&(u=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},x)),e.length===1){var E=!1;try{e(function(_,T){E||(E=!0,d(b,_,T))})}catch(_){E||(E=!0,d(b,_))}}else f._promiseTry(function(){return e()}).then(function(_){d(b,void 0,_)},function(_){d(b,_)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=r.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],h(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])h(!1);else if(f.queues[t].length>=p)d(!1,new Error("Too many pending tasks in queue "+t));else{var m=function(){h(!0)};r.skipQueue?f.queues[t].unshift(m):f.queues[t].push(m);var g=r.timeout||f.timeout;g&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},g))}var w=r.maxOccupationTime||f.maxOccupationTime;if(w&&(c=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),s)return s};Dt.prototype._acquireBatch=function(t,e,n,r){typeof n!="function"&&(r=n,n=null);var i=this,a=function(o,l){return function(c){i.acquire(o,l,c,r)}},s=t.reduceRight(function(o,l){return a(l,o)},e);if(typeof n=="function")s(n);else return new this.Promise(function(o,l){s.length===1?s(function(c,u){c?l(c):o(u)}):o(s())})};Dt.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Dt.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};dm.exports=Dt});var mm=L((Ej,pm)=>{"use strict";v();pm.exports=hm()});var gm=L((Aj,mu)=>{v();typeof Object.create=="function"?mu.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:mu.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}});var yu=L((gu,vm)=>{v();var co=hu(),yn=co.Buffer;function ym(t,e){for(var n in t)e[n]=t[n]}yn.from&&yn.alloc&&yn.allocUnsafe&&yn.allocUnsafeSlow?vm.exports=co:(ym(co,gu),gu.Buffer=Fr);function Fr(t,e,n){return yn(t,e,n)}Fr.prototype=Object.create(yn.prototype);ym(yn,Fr);Fr.from=function(t,e,n){if(typeof t=="number")throw new TypeError("Argument must not be a number");return yn(t,e,n)};Fr.alloc=function(t,e,n){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=yn(t);return e!==void 0?typeof n=="string"?r.fill(e,n):r.fill(e):r.fill(0),r};Fr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return yn(t)};Fr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return co.SlowBuffer(t)}});var xm=L((Fj,bm)=>{v();var wm=yu().Buffer;function uo(t,e){this._block=wm.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}uo.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=wm.from(t,e));for(var n=this._block,r=this._blockSize,i=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=this._len*8;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(n&4294967295)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a};uo.prototype._update=function(){throw new Error("_update must be implemented by subclass")};bm.exports=uo});var Em=L((Oj,Sm)=>{v();var lA=gm(),_m=xm(),cA=yu().Buffer,uA=[1518500249,1859775393,-1894007588,-899497514],fA=new Array(80);function Ta(){this.init(),this._w=fA,_m.call(this,64,56)}lA(Ta,_m);Ta.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function dA(t){return t<<1|t>>>31}function hA(t){return t<<5|t>>>27}function pA(t){return t<<30|t>>>2}function mA(t,e,n,r){return t===0?e&n|~e&r:t===2?e&n|e&r|n&r:e^n^r}Ta.prototype._update=function(t){for(var e=this._w,n=this._a|0,r=this._b|0,i=this._c|0,a=this._d|0,s=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=dA(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=hA(n)+mA(c,r,i,a)+s+e[l]+uA[c]|0;s=a,a=i,i=pA(r),r=n,n=u}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Ta.prototype._hash=function(){var t=cA.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};Sm.exports=Ta});var Am=L(vu=>{v();var km;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof vu=="object"?t(vu):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(km={}):t(km={})})(function(t){t.version="1.2.2";function e(){for(var y=0,S=new Array(256),k=0;k!=256;++k)y=k,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,S[k]=y;return typeof Int32Array!="undefined"?new Int32Array(S):S}var n=e();function r(y){var S=0,k=0,C=0,M=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(C=0;C!=256;++C)M[C]=y[C];for(C=0;C!=256;++C)for(k=y[C],S=256+C;S<4096;S+=256)k=M[S]=k>>>8^y[k&255];var P=[];for(C=1;C!=16;++C)P[C-1]=typeof Int32Array!="undefined"?M.subarray(C*256,C*256+256):M.slice(C*256,C*256+256);return P}var i=r(n),a=i[0],s=i[1],o=i[2],l=i[3],c=i[4],u=i[5],f=i[6],d=i[7],h=i[8],p=i[9],m=i[10],g=i[11],w=i[12],b=i[13],x=i[14];function E(y,S){for(var k=S^-1,C=0,M=y.length;C>>8^n[(k^y.charCodeAt(C++))&255];return~k}function _(y,S){for(var k=S^-1,C=y.length-15,M=0;M>8&255]^w[y[M++]^k>>16&255]^g[y[M++]^k>>>24]^m[y[M++]]^p[y[M++]]^h[y[M++]]^d[y[M++]]^f[y[M++]]^u[y[M++]]^c[y[M++]]^l[y[M++]]^o[y[M++]]^s[y[M++]]^a[y[M++]]^n[y[M++]];for(C+=15;M>>8^n[(k^y[M++])&255];return~k}function T(y,S){for(var k=S^-1,C=0,M=y.length,P=0,$=0;C>>8^n[(k^P)&255]:P<2048?(k=k>>>8^n[(k^(192|P>>6&31))&255],k=k>>>8^n[(k^(128|P&63))&255]):P>=55296&&P<57344?(P=(P&1023)+64,$=y.charCodeAt(C++)&1023,k=k>>>8^n[(k^(240|P>>8&7))&255],k=k>>>8^n[(k^(128|P>>2&63))&255],k=k>>>8^n[(k^(128|$>>6&15|(P&3)<<4))&255],k=k>>>8^n[(k^(128|$&63))&255]):(k=k>>>8^n[(k^(224|P>>12&15))&255],k=k>>>8^n[(k^(128|P>>6&63))&255],k=k>>>8^n[(k^(128|P&63))&255]);return~k}t.table=n,t.bstr=E,t.buf=_,t.str=T})});var Rn=L(St=>{"use strict";v();var gA=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function yA(t,e){return Object.prototype.hasOwnProperty.call(t,e)}St.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)yA(n,r)&&(t[r]=n[r])}}return t};St.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var vA={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray){t.set(e.subarray(n,n+r),i);return}for(var a=0;a{"use strict";v();var bA=Rn(),xA=4,Tm=0,Cm=1,_A=2;function fi(t){for(var e=t.length;--e>=0;)t[e]=0}var SA=0,Rm=1,EA=2,kA=3,AA=258,ku=29,Pa=256,Fa=Pa+1+ku,ui=30,Au=19,Lm=2*Fa+1,Mr=15,wu=16,TA=7,Tu=256,jm=16,Dm=17,Bm=18,Su=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],fo=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],CA=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Nm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],FA=512,Ln=new Array((Fa+2)*2);fi(Ln);var Ca=new Array(ui*2);fi(Ca);var Ma=new Array(FA);fi(Ma);var Oa=new Array(AA-kA+1);fi(Oa);var Cu=new Array(ku);fi(Cu);var ho=new Array(ui);fi(ho);function bu(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}var $m,Hm,Um;function xu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function zm(t){return t<256?Ma[t]:Ma[256+(t>>>7)]}function Ia(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Mt(t,e,n){t.bi_valid>wu-n?(t.bi_buf|=e<>wu-t.bi_valid,t.bi_valid+=n-wu):(t.bi_buf|=e<>>=1,n<<=1;while(--e>0);return n>>>1}function MA(t){t.bi_valid===16?(Ia(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}function OA(t,e){var n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,p,m=0;for(d=0;d<=Mr;d++)t.bl_count[d]=0;for(n[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(d=l,m++),n[u*2+1]=d,!(u>r)&&(t.bl_count[d]++,h=0,u>=o&&(h=s[u-o]),p=n[u*2],t.opt_len+=p*(d+h),a&&(t.static_len+=p*(i[u*2+1]+h)));if(m!==0){do{for(d=l-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,m-=2}while(m>0);for(d=l;d!==0;d--)for(u=t.bl_count[d];u!==0;)f=t.heap[--c],!(f>r)&&(n[f*2+1]!==d&&(t.opt_len+=(d-n[f*2+1])*n[f*2],n[f*2+1]=d),u--)}}function Vm(t,e,n){var r=new Array(Mr+1),i=0,a,s;for(a=1;a<=Mr;a++)r[a]=i=i+n[a-1]<<1;for(s=0;s<=e;s++){var o=t[s*2+1];o!==0&&(t[s*2]=Gm(r[o]++,o))}}function IA(){var t,e,n,r,i,a=new Array(Mr+1);for(n=0,r=0;r>=7;r8?Ia(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function PA(t,e,n,r){qm(t),r&&(Ia(t,n),Ia(t,~n)),bA.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function Fm(t,e,n,r){var i=e*2,a=n*2;return t[i]>1;s>=1;s--)_u(t,n,s);c=a;do s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],_u(t,n,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,n[c*2]=n[s*2]+n[o*2],t.depth[c]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,n[s*2+1]=n[o*2+1]=c,t.heap[1]=c++,_u(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],OA(t,e),Vm(n,l,t.bl_count)}function Om(t,e,n){var r,i=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=s,s=e[(r+1)*2+1],!(++o=3&&t.bl_tree[Nm[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function LA(t,e,n,r){var i;for(Mt(t,e-257,5),Mt(t,n-1,5),Mt(t,r-4,4),i=0;i>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return Tm;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Cm;for(n=32;n0?(t.strm.data_type===_A&&(t.strm.data_type=jA(t)),Eu(t,t.l_desc),Eu(t,t.d_desc),s=RA(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&e!==-1?Xm(t,e,n,r):t.strategy===xA||a===i?(Mt(t,(Rm<<1)+(r?1:0),3),Mm(t,Ln,Ca)):(Mt(t,(EA<<1)+(r?1:0),3),LA(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Mm(t,t.dyn_ltree,t.dyn_dtree)),Wm(t),r&&qm(t)}function $A(t,e,n){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=n&255,t.last_lit++,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(Oa[n]+Pa+1)*2]++,t.dyn_dtree[zm(e)*2]++),t.last_lit===t.lit_bufsize-1}di._tr_init=DA;di._tr_stored_block=Xm;di._tr_flush_block=NA;di._tr_tally=$A;di._tr_align=BA});var Fu=L((Nj,Zm)=>{"use strict";v();function HA(t,e,n,r){for(var i=t&65535|0,a=t>>>16&65535|0,s=0;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+e[r++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}Zm.exports=HA});var Mu=L((Hj,Km)=>{"use strict";v();function UA(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e}var zA=UA();function GA(t,e,n,r){var i=zA,a=r+n;t^=-1;for(var s=r;s>>8^i[(t^e[s])&255];return t^-1}Km.exports=GA});var po=L((zj,Qm)=>{"use strict";v();Qm.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var og=L(xn=>{"use strict";v();var Et=Rn(),Zt=Ym(),ng=Fu(),Qn=Mu(),VA=po(),Rr=0,WA=1,qA=3,rr=4,Jm=5,bn=0,eg=1,Kt=-2,XA=-3,Ou=-5,YA=-1,ZA=1,mo=2,KA=3,QA=4,JA=0,e3=2,wo=8,t3=9,n3=15,r3=8,i3=29,a3=256,Pu=a3+1+i3,s3=30,o3=19,l3=2*Pu+1,c3=15,me=3,tr=258,on=tr+me+1,u3=32,bo=42,Ru=69,go=73,yo=91,vo=103,Or=113,La=666,rt=1,ja=2,Ir=3,mi=4,f3=3;function nr(t,e){return t.msg=VA[e],e}function tg(t){return(t<<1)-(t>4?9:0)}function er(t){for(var e=t.length;--e>=0;)t[e]=0}function Jn(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(Et.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))}function dt(t,e){Zt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Jn(t.strm)}function ve(t,e){t.pending_buf[t.pending++]=e}function Ra(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function d3(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,Et.arraySet(e,t.input,t.next_in,i,n),t.state.wrap===1?t.adler=ng(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Qn(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function rg(t,e){var n=t.max_chain_length,r=t.strstart,i,a,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-on?t.strstart-(t.w_size-on):0,c=t.window,u=t.w_mask,f=t.prev,d=t.strstart+tr,h=c[r+s-1],p=c[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(c[i+s]!==p||c[i+s-1]!==h||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&rs){if(t.match_start=e,s=a,a>=o)break;h=c[r+s-1],p=c[r+s]}}while((e=f[e&u])>l&&--n!==0);return s<=t.lookahead?s:t.lookahead}function Pr(t){var e=t.w_size,n,r,i,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-on)){Et.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,r=t.hash_size,n=r;do i=t.head[--n],t.head[n]=i>=e?i-e:0;while(--r);r=e,n=r;do i=t.prev[--n],t.prev[n]=i>=e?i-e:0;while(--r);a+=e}if(t.strm.avail_in===0)break;if(r=d3(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=r,t.lookahead+t.insert>=me)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Pr(t),t.lookahead===0&&e===Rr)return rt;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((t.strstart===0||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,dt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-on&&(dt(t,!1),t.strm.avail_out===0))return rt}return t.insert=0,e===rr?(dt(t,!0),t.strm.avail_out===0?Ir:mi):(t.strstart>t.block_start&&(dt(t,!1),t.strm.avail_out===0),rt)}function Iu(t,e){for(var n,r;;){if(t.lookahead=me&&(t.ins_h=(t.ins_h<=me)if(r=Zt._tr_tally(t,t.strstart-t.match_start,t.match_length-me),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=me){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=me&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=me-1)),t.prev_length>=me&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-me,r=Zt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-me),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<=me&&t.strstart>0&&(i=t.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){a=t.strstart+tr;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=me?(n=Zt._tr_tally(t,1,t.match_length-me),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Zt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(dt(t,!1),t.strm.avail_out===0))return rt}return t.insert=0,e===rr?(dt(t,!0),t.strm.avail_out===0?Ir:mi):t.last_lit&&(dt(t,!1),t.strm.avail_out===0)?rt:ja}function m3(t,e){for(var n;;){if(t.lookahead===0&&(Pr(t),t.lookahead===0)){if(e===Rr)return rt;break}if(t.match_length=0,n=Zt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(dt(t,!1),t.strm.avail_out===0))return rt}return t.insert=0,e===rr?(dt(t,!0),t.strm.avail_out===0?Ir:mi):t.last_lit&&(dt(t,!1),t.strm.avail_out===0)?rt:ja}function wn(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}var pi;pi=[new wn(0,0,0,0,h3),new wn(4,4,8,4,Iu),new wn(4,5,16,8,Iu),new wn(4,6,32,32,Iu),new wn(4,4,16,16,hi),new wn(8,16,32,32,hi),new wn(8,16,128,128,hi),new wn(8,32,128,256,hi),new wn(32,128,258,1024,hi),new wn(32,258,258,4096,hi)];function g3(t){t.window_size=2*t.w_size,er(t.head),t.max_lazy_match=pi[t.level].max_lazy,t.good_match=pi[t.level].good_length,t.nice_match=pi[t.level].nice_length,t.max_chain_length=pi[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=me-1,t.match_available=0,t.ins_h=0}function y3(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=wo,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Et.Buf16(l3*2),this.dyn_dtree=new Et.Buf16((2*s3+1)*2),this.bl_tree=new Et.Buf16((2*o3+1)*2),er(this.dyn_ltree),er(this.dyn_dtree),er(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Et.Buf16(c3+1),this.heap=new Et.Buf16(2*Pu+1),er(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Et.Buf16(2*Pu+1),er(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ig(t){var e;return!t||!t.state?nr(t,Kt):(t.total_in=t.total_out=0,t.data_type=e3,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?bo:Or,t.adler=e.wrap===2?0:1,e.last_flush=Rr,Zt._tr_init(e),bn)}function ag(t){var e=ig(t);return e===bn&&g3(t.state),e}function v3(t,e){return!t||!t.state||t.state.wrap!==2?Kt:(t.state.gzhead=e,bn)}function sg(t,e,n,r,i,a){if(!t)return Kt;var s=1;if(e===YA&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>t3||n!==wo||r<8||r>15||e<0||e>9||a<0||a>QA)return nr(t,Kt);r===8&&(r=9);var o=new y3;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<Jm||e<0)return t?nr(t,Kt):Kt;if(r=t.state,!t.output||!t.input&&t.avail_in!==0||r.status===La&&e!==rr)return nr(t,t.avail_out===0?Ou:Kt);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===bo)if(r.wrap===2)t.adler=0,ve(r,31),ve(r,139),ve(r,8),r.gzhead?(ve(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ve(r,r.gzhead.time&255),ve(r,r.gzhead.time>>8&255),ve(r,r.gzhead.time>>16&255),ve(r,r.gzhead.time>>24&255),ve(r,r.level===9?2:r.strategy>=mo||r.level<2?4:0),ve(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ve(r,r.gzhead.extra.length&255),ve(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Qn(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Ru):(ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,r.level===9?2:r.strategy>=mo||r.level<2?4:0),ve(r,f3),r.status=Or);else{var s=wo+(r.w_bits-8<<4)<<8,o=-1;r.strategy>=mo||r.level<2?o=0:r.level<6?o=1:r.level===6?o=2:o=3,s|=o<<6,r.strstart!==0&&(s|=u3),s+=31-s%31,r.status=Or,Ra(r,s),r.strstart!==0&&(Ra(r,t.adler>>>16),Ra(r,t.adler&65535)),t.adler=1}if(r.status===Ru)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),Jn(t),i=r.pending,r.pending===r.pending_buf_size));)ve(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=go)}else r.status=go;if(r.status===go)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),Jn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.gzindex=0,r.status=yo)}else r.status=yo;if(r.status===yo)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),Jn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Qn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.status=vo)}else r.status=vo;if(r.status===vo&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Jn(t),r.pending+2<=r.pending_buf_size&&(ve(r,t.adler&255),ve(r,t.adler>>8&255),t.adler=0,r.status=Or)):r.status=Or),r.pending!==0){if(Jn(t),t.avail_out===0)return r.last_flush=-1,bn}else if(t.avail_in===0&&tg(e)<=tg(n)&&e!==rr)return nr(t,Ou);if(r.status===La&&t.avail_in!==0)return nr(t,Ou);if(t.avail_in!==0||r.lookahead!==0||e!==Rr&&r.status!==La){var l=r.strategy===mo?m3(r,e):r.strategy===KA?p3(r,e):pi[r.level].func(r,e);if((l===Ir||l===mi)&&(r.status=La),l===rt||l===Ir)return t.avail_out===0&&(r.last_flush=-1),bn;if(l===ja&&(e===WA?Zt._tr_align(r):e!==Jm&&(Zt._tr_stored_block(r,0,0,!1),e===qA&&(er(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Jn(t),t.avail_out===0))return r.last_flush=-1,bn}return e!==rr?bn:r.wrap<=0?eg:(r.wrap===2?(ve(r,t.adler&255),ve(r,t.adler>>8&255),ve(r,t.adler>>16&255),ve(r,t.adler>>24&255),ve(r,t.total_in&255),ve(r,t.total_in>>8&255),ve(r,t.total_in>>16&255),ve(r,t.total_in>>24&255)):(Ra(r,t.adler>>>16),Ra(r,t.adler&65535)),Jn(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?bn:eg)}function x3(t){var e;return!t||!t.state?Kt:(e=t.state.status,e!==bo&&e!==Ru&&e!==go&&e!==yo&&e!==vo&&e!==Or&&e!==La?nr(t,Kt):(t.state=null,e===Or?nr(t,XA):bn))}function _3(t,e){var n=e.length,r,i,a,s,o,l,c,u;if(!t||!t.state||(r=t.state,s=r.wrap,s===2||s===1&&r.status!==bo||r.lookahead))return Kt;for(s===1&&(t.adler=ng(t.adler,e,n,0)),r.wrap=0,n>=r.w_size&&(s===0&&(er(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new Et.Buf8(r.w_size),Et.arraySet(u,e,n-r.w_size,r.w_size,0),e=u,n=r.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=n,t.next_in=0,t.input=e,Pr(r);r.lookahead>=me;){i=r.strstart,a=r.lookahead-(me-1);do r.ins_h=(r.ins_h<{"use strict";v();var xo=Rn(),lg=!0,cg=!0;try{String.fromCharCode.apply(null,[0])}catch(t){lg=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){cg=!1}var Da=new xo.Buf8(256);for(jn=0;jn<256;jn++)Da[jn]=jn>=252?6:jn>=248?5:jn>=240?4:jn>=224?3:jn>=192?2:1;var jn;Da[254]=Da[254]=1;gi.string2buf=function(t){var e,n,r,i,a,s=t.length,o=0;for(i=0;i>>6,e[a++]=128|n&63):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|n&63):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|n&63);return e};function ug(t,e){if(e<65534&&(t.subarray&&cg||!t.subarray&&lg))return String.fromCharCode.apply(null,xo.shrinkBuf(t,e));for(var n="",r=0;r4){o[r++]=65533,n+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&n1){o[r++]=65533;continue}i<65536?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|i&1023)}return ug(o,r)};gi.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+Da[t[n]]>e?n:e}});var ju=L((Yj,fg)=>{"use strict";v();function S3(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}fg.exports=S3});var mg=L($a=>{"use strict";v();var Ba=og(),Na=Rn(),Bu=Lu(),Nu=po(),E3=ju(),pg=Object.prototype.toString,k3=0,Du=4,yi=0,dg=1,hg=2,A3=-1,T3=0,C3=8;function Lr(t){if(!(this instanceof Lr))return new Lr(t);this.options=Na.assign({level:A3,method:C3,chunkSize:16384,windowBits:15,memLevel:8,strategy:T3,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new E3,this.strm.avail_out=0;var n=Ba.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==yi)throw new Error(Nu[n]);if(e.header&&Ba.deflateSetHeader(this.strm,e.header),e.dictionary){var r;if(typeof e.dictionary=="string"?r=Bu.string2buf(e.dictionary):pg.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=Ba.deflateSetDictionary(this.strm,r),n!==yi)throw new Error(Nu[n]);this._dict_set=!0}}Lr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;a=e===~~e?e:e===!0?Du:k3,typeof t=="string"?n.input=Bu.string2buf(t):pg.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Na.Buf8(r),n.next_out=0,n.avail_out=r),i=Ba.deflate(n,a),i!==dg&&i!==yi)return this.onEnd(i),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===Du||a===hg))&&(this.options.to==="string"?this.onData(Bu.buf2binstring(Na.shrinkBuf(n.output,n.next_out))):this.onData(Na.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&i!==dg);return a===Du?(i=Ba.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===yi):(a===hg&&(this.onEnd(yi),n.avail_out=0),!0)};Lr.prototype.onData=function(t){this.chunks.push(t)};Lr.prototype.onEnd=function(t){t===yi&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Na.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function $u(t,e){var n=new Lr(e);if(n.push(t,!0),n.err)throw n.msg||Nu[n.err];return n.result}function F3(t,e){return e=e||{},e.raw=!0,$u(t,e)}function M3(t,e){return e=e||{},e.gzip=!0,$u(t,e)}$a.Deflate=Lr;$a.deflate=$u;$a.deflateRaw=F3;$a.gzip=M3});var yg=L((Jj,gg)=>{"use strict";v();var _o=30,O3=12;gg.exports=function(e,n){var r,i,a,s,o,l,c,u,f,d,h,p,m,g,w,b,x,E,_,T,y,S,k,C,M;r=e.state,i=e.next_in,C=e.input,a=i+(e.avail_in-5),s=e.next_out,M=e.output,o=s-(n-e.avail_out),l=s+(e.avail_out-257),c=r.dmax,u=r.wsize,f=r.whave,d=r.wnext,h=r.window,p=r.hold,m=r.bits,g=r.lencode,w=r.distcode,b=(1<>>24,p>>>=_,m-=_,_=E>>>16&255,_===0)M[s++]=E&65535;else if(_&16){T=E&65535,_&=15,_&&(m<_&&(p+=C[i++]<>>=_,m-=_),m<15&&(p+=C[i++]<>>24,p>>>=_,m-=_,_=E>>>16&255,_&16){if(y=E&65535,_&=15,m<_&&(p+=C[i++]<c){e.msg="invalid distance too far back",r.mode=_o;break e}if(p>>>=_,m-=_,_=s-o,y>_){if(_=y-_,_>f&&r.sane){e.msg="invalid distance too far back",r.mode=_o;break e}if(S=0,k=h,d===0){if(S+=u-_,_2;)M[s++]=k[S++],M[s++]=k[S++],M[s++]=k[S++],T-=3;T&&(M[s++]=k[S++],T>1&&(M[s++]=k[S++]))}else{S=s-y;do M[s++]=M[S++],M[s++]=M[S++],M[s++]=M[S++],T-=3;while(T>2);T&&(M[s++]=M[S++],T>1&&(M[s++]=M[S++]))}}else if(_&64){e.msg="invalid distance code",r.mode=_o;break e}else{E=w[(E&65535)+(p&(1<<_)-1)];continue n}break}}else if(_&64)if(_&32){r.mode=O3;break e}else{e.msg="invalid literal/length code",r.mode=_o;break e}else{E=g[(E&65535)+(p&(1<<_)-1)];continue t}break}}while(i>3,i-=T,m-=T<<3,p&=(1<{"use strict";v();var vg=Rn(),vi=15,wg=852,bg=592,xg=0,Hu=1,_g=2,I3=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],P3=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],R3=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],L3=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Sg.exports=function(e,n,r,i,a,s,o,l){var c=l.bits,u=0,f=0,d=0,h=0,p=0,m=0,g=0,w=0,b=0,x=0,E,_,T,y,S,k=null,C=0,M,P=new vg.Buf16(vi+1),$=new vg.Buf16(vi+1),j=null,Q=0,le,de,re;for(u=0;u<=vi;u++)P[u]=0;for(f=0;f=1&&P[h]===0;h--);if(p>h&&(p=h),h===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===xg||h!==1))return-1;for($[1]=0,u=1;uwg||e===_g&&b>bg)return 1;for(;;){le=u-g,o[f]M?(de=j[Q+o[f]],re=k[C+o[f]]):(de=96,re=0),E=1<>g)+_]=le<<24|de<<16|re|0;while(_!==0);for(E=1<>=1;if(E!==0?(x&=E-1,x+=E):x=0,f++,--P[u]===0){if(u===h)break;u=n[r+o[f]]}if(u>p&&(x&y)!==T){for(g===0&&(g=p),S+=d,m=u-g,w=1<wg||e===_g&&b>bg)return 1;T=x&y,a[T]=p<<24|m<<16|S-s|0}}return x!==0&&(a[S+x]=u-g<<24|64<<16|0),l.bits=p,0}});var a0=L(ln=>{"use strict";v();var Bt=Rn(),qu=Fu(),_n=Mu(),j3=yg(),Ha=Eg(),D3=0,Zg=1,Kg=2,kg=4,B3=5,So=6,jr=0,N3=1,$3=2,Qt=-2,Qg=-3,Xu=-4,H3=-5,Ag=8,Jg=1,Tg=2,Cg=3,Fg=4,Mg=5,Og=6,Ig=7,Pg=8,Rg=9,Lg=10,Ao=11,Dn=12,Uu=13,jg=14,zu=15,Dg=16,Bg=17,Ng=18,$g=19,Eo=20,ko=21,Hg=22,Ug=23,zg=24,Gg=25,Vg=26,Gu=27,Wg=28,qg=29,Le=30,Yu=31,U3=32,z3=852,G3=592,V3=15,W3=V3;function Xg(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function q3(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Bt.Buf16(320),this.work=new Bt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function e0(t){var e;return!t||!t.state?Qt:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Jg,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Bt.Buf32(z3),e.distcode=e.distdyn=new Bt.Buf32(G3),e.sane=1,e.back=-1,jr)}function t0(t){var e;return!t||!t.state?Qt:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,e0(t))}function n0(t,e){var n,r;return!t||!t.state||(r=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Qt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,t0(t))}function r0(t,e){var n,r;return t?(r=new q3,t.state=r,r.window=null,n=n0(t,e),n!==jr&&(t.state=null),n):Qt}function X3(t){return r0(t,W3)}var Yg=!0,Vu,Wu;function Y3(t){if(Yg){var e;for(Vu=new Bt.Buf32(512),Wu=new Bt.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Ha(Zg,t.lens,0,288,Vu,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ha(Kg,t.lens,0,32,Wu,0,t.work,{bits:5}),Yg=!1}t.lencode=Vu,t.lenbits=9,t.distcode=Wu,t.distbits=5}function i0(t,e,n,r){var i,a=t.state;return a.window===null&&(a.wsize=1<=a.wsize?(Bt.arraySet(a.window,e,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),Bt.arraySet(a.window,e,n-r,i,a.wnext),r-=i,r?(Bt.arraySet(a.window,e,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=_n(n.check,k,2,0),c=0,u=0,n.mode=Tg;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=Le;break}if((c&15)!==Ag){t.msg="unknown compression method",n.mode=Le;break}if(c>>>=4,u-=4,y=(c&15)+8,n.wbits===0)n.wbits=y;else if(y>n.wbits){t.msg="invalid window size",n.mode=Le;break}n.dmax=1<>8&1),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,n.check=_n(n.check,k,2,0)),c=0,u=0,n.mode=Cg;case Cg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>8&255,k[2]=c>>>16&255,k[3]=c>>>24&255,n.check=_n(n.check,k,4,0)),c=0,u=0,n.mode=Fg;case Fg:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>8),n.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,n.check=_n(n.check,k,2,0)),c=0,u=0,n.mode=Mg;case Mg:if(n.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>>8&255,n.check=_n(n.check,k,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=Og;case Og:if(n.flags&1024&&(h=n.length,h>o&&(h=o),h&&(n.head&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Bt.arraySet(n.head.extra,r,a,h,y)),n.flags&512&&(n.check=_n(n.check,r,h,a)),o-=h,a+=h,n.length-=h),n.length))break e;n.length=0,n.mode=Ig;case Ig:if(n.flags&2048){if(o===0)break e;h=0;do y=r[a+h++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y));while(y&&h>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Dn;break;case Lg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>=u&7,u-=u&7,n.mode=Gu;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<>>=1,u-=1,c&3){case 0:n.mode=jg;break;case 1:if(Y3(n),n.mode=Eo,e===So){c>>>=2,u-=2;break e}break;case 2:n.mode=Bg;break;case 3:t.msg="invalid block type",n.mode=Le}c>>>=2,u-=2;break;case jg:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=Le;break}if(n.length=c&65535,c=0,u=0,n.mode=zu,e===So)break e;case zu:n.mode=Dg;case Dg:if(h=n.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;Bt.arraySet(i,r,a,h,s),o-=h,a+=h,l-=h,s+=h,n.length-=h;break}n.mode=Dn;break;case Bg:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Le;break}n.have=0,n.mode=Ng;case Ng:for(;n.have>>=3,u-=3}for(;n.have<19;)n.lens[P[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,C={bits:n.lenbits},S=Ha(D3,n.lens,0,19,n.lencode,0,n.work,C),n.lenbits=C.bits,S){t.msg="invalid code lengths set",n.mode=Le;break}n.have=0,n.mode=$g;case $g:for(;n.have>>24,b=g>>>16&255,x=g&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=w,u-=w,n.lens[n.have++]=x;else{if(x===16){for(M=w+2;u>>=w,u-=w,n.have===0){t.msg="invalid bit length repeat",n.mode=Le;break}y=n.lens[n.have-1],h=3+(c&3),c>>>=2,u-=2}else if(x===17){for(M=w+3;u>>=w,u-=w,y=0,h=3+(c&7),c>>>=3,u-=3}else{for(M=w+7;u>>=w,u-=w,y=0,h=11+(c&127),c>>>=7,u-=7}if(n.have+h>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Le;break}for(;h--;)n.lens[n.have++]=y}}if(n.mode===Le)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Le;break}if(n.lenbits=9,C={bits:n.lenbits},S=Ha(Zg,n.lens,0,n.nlen,n.lencode,0,n.work,C),n.lenbits=C.bits,S){t.msg="invalid literal/lengths set",n.mode=Le;break}if(n.distbits=6,n.distcode=n.distdyn,C={bits:n.distbits},S=Ha(Kg,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,C),n.distbits=C.bits,S){t.msg="invalid distances set",n.mode=Le;break}if(n.mode=Eo,e===So)break e;case Eo:n.mode=ko;case ko:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=a,t.avail_in=o,n.hold=c,n.bits=u,j3(t,d),s=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,o=t.avail_in,c=n.hold,u=n.bits,n.mode===Dn&&(n.back=-1);break}for(n.back=0;g=n.lencode[c&(1<>>24,b=g>>>16&255,x=g&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>E)],w=g>>>24,b=g>>>16&255,x=g&65535,!(E+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=E,u-=E,n.back+=E}if(c>>>=w,u-=w,n.back+=w,n.length=x,b===0){n.mode=Vg;break}if(b&32){n.back=-1,n.mode=Dn;break}if(b&64){t.msg="invalid literal/length code",n.mode=Le;break}n.extra=b&15,n.mode=Hg;case Hg:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Ug;case Ug:for(;g=n.distcode[c&(1<>>24,b=g>>>16&255,x=g&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>E)],w=g>>>24,b=g>>>16&255,x=g&65535,!(E+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=E,u-=E,n.back+=E}if(c>>>=w,u-=w,n.back+=w,b&64){t.msg="invalid distance code",n.mode=Le;break}n.offset=x,n.extra=b&15,n.mode=zg;case zg:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Le;break}n.mode=Gg;case Gg:if(l===0)break e;if(h=d-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Le;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=s-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[s++]=m[p++];while(--h);n.length===0&&(n.mode=ko);break;case Vg:if(l===0)break e;i[s++]=n.length,l--,n.mode=ko;break;case Gu:if(n.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<{"use strict";v();s0.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var l0=L((o7,o0)=>{"use strict";v();function eT(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}o0.exports=eT});var u0=L(za=>{"use strict";v();var wi=a0(),Ua=Rn(),To=Lu(),We=Zu(),Ku=po(),tT=ju(),nT=l0(),c0=Object.prototype.toString;function Dr(t){if(!(this instanceof Dr))return new Dr(t);this.options=Ua.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new tT,this.strm.avail_out=0;var n=wi.inflateInit2(this.strm,e.windowBits);if(n!==We.Z_OK)throw new Error(Ku[n]);if(this.header=new nT,wi.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=To.string2buf(e.dictionary):c0.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=wi.inflateSetDictionary(this.strm,e.dictionary),n!==We.Z_OK)))throw new Error(Ku[n])}Dr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,s,o,l,c,u=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?We.Z_FINISH:We.Z_NO_FLUSH,typeof t=="string"?n.input=To.binstring2buf(t):c0.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Ua.Buf8(r),n.next_out=0,n.avail_out=r),a=wi.inflate(n,We.Z_NO_FLUSH),a===We.Z_NEED_DICT&&i&&(a=wi.inflateSetDictionary(this.strm,i)),a===We.Z_BUF_ERROR&&u===!0&&(a=We.Z_OK,u=!1),a!==We.Z_STREAM_END&&a!==We.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===We.Z_STREAM_END||n.avail_in===0&&(s===We.Z_FINISH||s===We.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=To.utf8border(n.output,n.next_out),l=n.next_out-o,c=To.buf2string(n.output,o),n.next_out=l,n.avail_out=r-l,l&&Ua.arraySet(n.output,n.output,o,l,0),this.onData(c)):this.onData(Ua.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(u=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==We.Z_STREAM_END);return a===We.Z_STREAM_END&&(s=We.Z_FINISH),s===We.Z_FINISH?(a=wi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===We.Z_OK):(s===We.Z_SYNC_FLUSH&&(this.onEnd(We.Z_OK),n.avail_out=0),!0)};Dr.prototype.onData=function(t){this.chunks.push(t)};Dr.prototype.onEnd=function(t){t===We.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ua.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Qu(t,e){var n=new Dr(e);if(n.push(t,!0),n.err)throw n.msg||Ku[n.err];return n.result}function rT(t,e){return e=e||{},e.raw=!0,Qu(t,e)}za.Inflate=Dr;za.inflate=Qu;za.inflateRaw=rT;za.ungzip=Qu});var h0=L((f7,d0)=>{"use strict";v();var iT=Rn().assign,aT=mg(),sT=u0(),oT=Zu(),f0={};iT(f0,aT,sT,oT);d0.exports=f0});var g0=L((h7,m0)=>{"use strict";v();var p0=(t,e)=>function(...n){let r=e.promiseModule;return new r((i,a)=>{e.multiArgs?n.push((...s)=>{e.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):e.errorFirst?n.push((s,o)=>{s?a(s):i(o)}):n.push(i),t.apply(this,n)})};m0.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let n=typeof t;if(!(t!==null&&(n==="object"||n==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":n}\``);let r=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return e.include?e.include.some(s):!e.exclude.some(s)},i;n==="function"?i=function(...a){return e.excludeMain?t(...a):p0(t,e).apply(this,a)}:i=Object.create(Object.getPrototypeOf(t));for(let a in t){let s=t[a];i[a]=typeof s=="function"&&r(a)?p0(s,e):s}return i}});var k0=L((m7,E0)=>{v();function y0(t){return Array.isArray(t)?t:[t]}var tf="",v0=" ",Ju="\\",lT=/^\s+$/,cT=/(?:[^\\]|^)\\$/,uT=/^\\!/,fT=/^\\#/,dT=/\r?\n/g,hT=/^\.*\/|^\.+$/,ef="/",x0="node-ignore";typeof Symbol!="undefined"&&(x0=Symbol.for("node-ignore"));var w0=x0,pT=(t,e,n)=>Object.defineProperty(t,e,{value:n}),mT=/([0-z])-([0-z])/g,_0=()=>!1,gT=t=>t.replace(mT,(e,n,r)=>n.charCodeAt(0)<=r.charCodeAt(0)?e:tf),yT=t=>{let{length:e}=t;return t.slice(0,e-e%2)},vT=[[/^\uFEFF/,()=>tf],[/\\?\s+$/,t=>t.indexOf("\\")===0?v0:tf],[/\\\s/g,()=>v0],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,n)=>e+6{let r=n.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Ju],[/\\\\/g,()=>Ju],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,n,r,i)=>e===Ju?`\\[${n}${yT(r)}${i}`:i==="]"&&r.length%2===0?`[${gT(n)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],b0=Object.create(null),wT=(t,e)=>{let n=b0[t];return n||(n=vT.reduce((r,i)=>r.replace(i[0],i[1].bind(t)),t),b0[t]=n),e?new RegExp(n,"i"):new RegExp(n)},af=t=>typeof t=="string",bT=t=>t&&af(t)&&!lT.test(t)&&!cT.test(t)&&t.indexOf("#")!==0,xT=t=>t.split(dT),nf=class{constructor(e,n,r,i){this.origin=e,this.pattern=n,this.negative=r,this.regex=i}},_T=(t,e)=>{let n=t,r=!1;t.indexOf("!")===0&&(r=!0,t=t.substr(1)),t=t.replace(uT,"!").replace(fT,"#");let i=wT(t,e);return new nf(n,t,r,i)},ST=(t,e)=>{throw new e(t)},Bn=(t,e,n)=>af(t)?t?Bn.isNotRelative(t)?n(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${e}\``,TypeError),S0=t=>hT.test(t);Bn.isNotRelative=S0;Bn.convert=t=>t;var rf=class{constructor({ignorecase:e=!0,ignoreCase:n=e,allowRelativePaths:r=!1}={}){pT(this,w0,!0),this._rules=[],this._ignoreCase=n,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[w0]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(bT(e)){let n=_T(e,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(e){return this._added=!1,y0(af(e)?xT(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,n){let r=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&r!==i||s&&!r&&!i&&!n)return;a.regex.test(e)&&(r=!s,i=s)}),{ignored:r,unignored:i}}_test(e,n,r,i){let a=e&&Bn.convert(e);return Bn(a,e,this._allowRelativePaths?_0:ST),this._t(a,n,r,i)}_t(e,n,r,i){if(e in n)return n[e];if(i||(i=e.split(ef)),i.pop(),!i.length)return n[e]=this._testOne(e,r);let a=this._t(i.join(ef)+ef,n,r,i);return n[e]=a.ignored?a:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return y0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Co=t=>new rf(t),ET=t=>Bn(t&&Bn.convert(t),t,_0);Co.isPathValid=ET;Co.default=Co;E0.exports=Co;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");Bn.convert=t;let e=/^[a-z]:\//i;Bn.isNotRelative=n=>e.test(n)||S0(n)}});var T0=L((y7,A0)=>{"use strict";v();function kT(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sn(t,e,n){return e=e instanceof RegExp?e:new RegExp(kT(e),"g"),t.replace(e,n)}var AT={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Sn(e,"./","/"),e=Sn(e,"..","."),e=Sn(e," ","-"),e=Sn(e,/^[~^:?*\\\-]/g,""),e=Sn(e,/[~^:?*\\]/g,"-"),e=Sn(e,/[~^:?*\\\-]$/g,""),e=Sn(e,"@{","-"),e=Sn(e,/\.$/g,""),e=Sn(e,/\/$/g,""),e=Sn(e,/\.lock$/g,""),e}};A0.exports=AT});var F0=L((w7,C0)=>{v();C0.exports=function(t,e){var n=t,r=e,i=n.length,a=r.length,s=!1,o=null,l=i+1,c=[],u=[],f=[],d="",h=-1,p=0,m=1,g,w,b=function(){i>=a&&(g=n,w=i,n=r,r=g,i=a,a=w,s=!0,l=i+1)},x=function(y,S,k){return{x:y,y:S,k}},E=function(y,S){return{elem:y,t:S}},_=function(y,S,k){var C,M,P;for(S>k?C=c[y-1+l]:C=c[y+1+l],P=Math.max(S,k),M=P-y;M=0;--P)for(;CM-C?(s?f[f.length]=new E(r[M],h):f[f.length]=new E(r[M],m),++k,++M):y[P].y-y[P].x=y+1;--j)k[j+l]=_(j,k[j-1+l]+1,k[j+1+l]);k[y+l]=_(y,k[y-1+l]+1,k[y+1+l])}while(k[y+l]!==a);for(o=y+2*C,M=c[y+l],P=[];M!==-1;)P[P.length]=new x(u[M].x,u[M].y,null),M=u[M].k;T(P)}}}});var I0=L((x7,O0)=>{v();var TT=F0();function CT(t,e){var n=new TT(t,e);n.compose();for(var r=n.getses(),i,a,s=t.length-1,o=e.length-1,l=r.length-1;l>=0;--l)r[l].t===n.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):(i={file1index:s,file2index:o,chain:null},a=i),s--,o--):r[l].t===n.SES_DELETE?s--:r[l].t===n.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return a?(a.chain=c,i):c}function M0(t,e){for(var n=[],r=t.length,i=e.length,a=CT(t,e);a!==null;a=a.chain){var s=r-a.file1index-1,o=i-a.file2index-1;r=a.file1index,i=a.file2index,(s||o)&&n.push({file1:[r+1,s],file2:[i+1,o]})}return n.reverse(),n}function FT(t,e,n){var r,i=M0(e,t),a=M0(e,n),s=[];function o($,j){s.push([$.file1[0],j,$.file1[1],$.file2[0],$.file2[1]])}for(r=0;rc&&(l.push([1,c,$-c]),c=$)}for(var f=0;fm)break;m=Math.max(m,w+g[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[n.length,-1,e.length,-1]};for(r=d;r<=f;r++){h=s[r];var x=h[1],E=b[x],_=h[0],T=_+h[2],y=h[3],S=y+h[4];E[0]=Math.min(y,E[0]),E[1]=Math.max(S,E[1]),E[2]=Math.min(_,E[2]),E[3]=Math.max(T,E[3])}var k=b[0][0]+(p-b[0][2]),C=b[0][1]+(m-b[0][3]),M=b[2][0]+(p-b[2][2]),P=b[2][1]+(m-b[2][3]);l.push([-1,k,C-k,p,m-p,M,P-M])}c=m}return u(e.length),l}function MT(t,e,n){var r=[],i=[t,e,n],a=FT(t,e,n),s=[];function o(){s.length&&r.push({ok:s}),s=[]}function l(h){for(var p=0;p{v();var Di=1e3,Bi=Di*60,Ni=Bi*60,Gr=Ni*24,P6=Gr*7,R6=Gr*365.25;L1.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return L6(t);if(n==="number"&&isFinite(t))return e.long?D6(t):j6(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function L6(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*R6;case"weeks":case"week":case"w":return n*P6;case"days":case"day":case"d":return n*Gr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Ni;case"minutes":case"minute":case"mins":case"min":case"m":return n*Bi;case"seconds":case"second":case"secs":case"sec":case"s":return n*Di;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function j6(t){var e=Math.abs(t);return e>=Gr?Math.round(t/Gr)+"d":e>=Ni?Math.round(t/Ni)+"h":e>=Bi?Math.round(t/Bi)+"m":e>=Di?Math.round(t/Di)+"s":t+"ms"}function D6(t){var e=Math.abs(t);return e>=Gr?Yo(t,e,Gr,"day"):e>=Ni?Yo(t,e,Ni,"hour"):e>=Bi?Yo(t,e,Bi,"minute"):e>=Di?Yo(t,e,Di,"second"):t+" ms"}function Yo(t,e,n,r){var i=e>=n*1.5;return Math.round(t/n)+" "+r+(i?"s":"")}});var B1=L((M7,D1)=>{v();function B6(t){n.debug=n,n.default=n,n.coerce=l,n.disable=a,n.enable=i,n.enabled=s,n.humanize=j1(),n.destroy=c,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let d=0;d{if(T==="%%")return"%";E++;let S=n.formatters[y];if(typeof S=="function"){let k=g[E];T=S.call(w,k),g.splice(E,1),E--}return T}),n.formatArgs.call(w,g),(w.log||n.log).apply(w,g)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==n.namespaces&&(h=n.namespaces,p=n.enabled(u)),p),set:g=>{d=g}}),typeof n.init=="function"&&n.init(m),m}function r(u,f){let d=n(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f,d=(typeof u=="string"?u:"").split(/[\s,]+/),h=d.length;for(f=0;f"-"+f)].join(",");return n.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let f,d;for(f=0,d=n.skips.length;f{v();Ht.formatArgs=$6;Ht.save=H6;Ht.load=U6;Ht.useColors=N6;Ht.storage=z6();Ht.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ht.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function N6(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $6(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Zo.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(n++,i==="%c"&&(r=n))}),t.splice(r,0,e)}Ht.log=console.debug||console.log||(()=>{});function H6(t){try{t?Ht.storage.setItem("debug",t):Ht.storage.removeItem("debug")}catch(e){}}function U6(){let t;try{t=Ht.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function z6(){try{return localStorage}catch(t){}}Zo.exports=B1()(Ht);var{formatters:G6}=Zo.exports;G6.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var N1=L(Ut=>{"use strict";v();var V6=Ut&&Ut.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ut,"__esModule",{value:!0});var W6=require("fs"),q6=V6(Ko()),$i=q6.default("@kwsites/file-exists");function X6(t,e,n){$i("checking %s",t);try{let r=W6.statSync(t);return r.isFile()&&e?($i("[OK] path represents a file"),!0):r.isDirectory()&&n?($i("[OK] path represents a directory"),!0):($i("[FAIL] path represents something other than a file or directory"),!1)}catch(r){if(r.code==="ENOENT")return $i("[FAIL] path is not accessible: %o",r),!1;throw $i("[FATAL] %o",r),r}}function Y6(t,e=Ut.READABLE){return X6(t,(e&Ut.FILE)>0,(e&Ut.FOLDER)>0)}Ut.exists=Y6;Ut.FILE=1;Ut.FOLDER=2;Ut.READABLE=Ut.FILE+Ut.FOLDER});var $1=L(Qo=>{"use strict";v();function Z6(t){for(var e in t)Qo.hasOwnProperty(e)||(Qo[e]=t[e])}Object.defineProperty(Qo,"__esModule",{value:!0});Z6(N1())});var Lf=L(Vr=>{"use strict";v();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.createDeferred=Vr.deferred=void 0;function Rf(){let t,e,n="pending";return{promise:new Promise((i,a)=>{t=i,e=a}),done(i){n==="pending"&&(n="resolved",t(i))},fail(i){n==="pending"&&(n="rejected",e(i))},get fulfilled(){return n!=="pending"},get status(){return n}}}Vr.deferred=Rf;Vr.createDeferred=Rf;Vr.default=Rf});var y2=L((bD,g2)=>{"use strict";v();g2.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var w2=L((_D,v2)=>{v();var kd={px:{px:1,cm:37.79527559055118,mm:3.7795275590551185,in:96,pt:1.3333333333333333,pc:16},cm:{px:.026458333333333334,cm:1,mm:.1,in:2.54,pt:.035277777777777776,pc:.42333333333333334},mm:{px:.26458333333333334,cm:10,mm:1,in:25.4,pt:.35277777777777775,pc:4.233333333333333},in:{px:.010416666666666666,cm:.39370078740157477,mm:.03937007874015748,in:1,pt:.013888888888888888,pc:.16666666666666666},pt:{px:.75,cm:28.346456692913385,mm:2.834645669291339,in:72,pt:1,pc:12},pc:{px:.0625,cm:2.3622047244094486,mm:.2362204724409449,in:6,pt:.08333333333333333,pc:1},deg:{deg:1,grad:.9,rad:180/Math.PI,turn:360},grad:{deg:1.1111111111111112,grad:1,rad:200/Math.PI,turn:400},rad:{deg:Math.PI/180,grad:Math.PI/200,rad:1,turn:Math.PI*2},turn:{deg:.002777777777777778,grad:.0025,rad:.5/Math.PI,turn:1},s:{s:1,ms:.001},ms:{s:1e3,ms:1},Hz:{Hz:1,kHz:1e3},kHz:{Hz:.001,kHz:1},dpi:{dpi:1,dpcm:.39370078740157477,dppx:.010416666666666666},dpcm:{dpi:2.54,dpcm:1,dppx:.026458333333333334},dppx:{dpi:96,dpcm:37.79527559055118,dppx:1}};v2.exports=function(t,e,n,r){if(!kd.hasOwnProperty(n))throw new Error("Cannot convert to "+n);if(!kd[n].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+n);var i=kd[n][e]*t;return r!==!1?(r=Math.pow(10,parseInt(r)||5),Math.round(i*r)/r):i}});var P2=L(zn=>{"use strict";v();Object.defineProperty(zn,"__esModule",{value:!0});zn.fromRgba=Wi;zn.fromRgb=Ad;zn.fromHsla=wl;zn.fromHsl=O2;zn.fromString=I2;zn.default=void 0;var b2=S2(y2()),ZF=S2(w2());function S2(t){return t&&t.__esModule?t:{default:t}}function KF(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function x2(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n-1}function rM(t,e,n){var r=t/255,i=e/255,a=n/255,s=Math.max(r,i,a),o=Math.min(r,i,a),l=s-o,c=(s+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(s){case r:return(i-a)/l%6;case i:return(a-r)/l+2;default:return(r-i)/l+4}}();return[f*60,u*100,c*100]}function iM(t,e,n){var r=t/60,i=e/100,a=n/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(r%2-1)),l=a-s/2,c=function(){return r<1?[s,o,0]:r<2?[o,s,0]:r<3?[0,s,o]:r<4?[0,o,s]:r<5?[o,0,s]:[s,0,o]}(),u=Ct(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var aM=function(){function t(e){var n=Ct(e,4),r=n[0],i=n[1],a=n[2],s=n[3];KF(this,t),this.values=[Math.max(Math.min(parseInt(r,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return QF(t,[{key:"toRgbString",value:function(){var n=Ct(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return s===1?"rgb(".concat(r,", ").concat(i,", ").concat(a,")"):"rgba(".concat(r,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var n=this.toHslaArray(),r=Ct(n,4),i=r[0],a=r[1],s=r[2],o=r[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var n=Ct(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return r=Number(r).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(r).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var n=Ct(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3],o=rM(r,i,a),l=Ct(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,s]}}]),t}();function Wi(t){var e=Ct(t,4),n=e[0],r=e[1],i=e[2],a=e[3];return new aM([n,r,i,a])}function Ad(t){var e=Ct(t,3),n=e[0],r=e[1],i=e[2];return Wi([n,r,i,1])}function wl(t){var e=Ct(t,4),n=e[0],r=e[1],i=e[2],a=e[3],s=iM(n,r,i),o=Ct(s,3),l=o[0],c=o[1],u=o[2];return Wi([l,c,u,a])}function O2(t){var e=Ct(t,3),n=e[0],r=e[1],i=e[2];return wl([n,r,i,1])}function sM(t){var e=E2.exec(t)||k2.exec(t),n=Ct(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=parseInt(r.length<2?r.repeat(2):r,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,Wi([r,i,a,s])}function oM(t){var e=A2.exec(t)||C2.exec(t)||T2.exec(t)||F2.exec(t),n=Ct(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=Es(r,"%")?parseInt(r,10)*255/100:parseInt(r,10),i=Es(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=Es(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Es(s,"%")?100:1),Wi([r,i,a,s])}function lM(t){var e=M2.exec(t),n=Ct(e,6),r=n[1],i=n[2],a=n[3],s=n[4],o=n[5];return i=i||"deg",r=(0,ZF.default)(parseFloat(r),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Es(o,"%")?100:1),wl([r,a,s,o])}function I2(t){return b2.default[t]?Ad(b2.default[t]):E2.test(t)||k2.test(t)?sM(t):A2.test(t)||C2.test(t)||T2.test(t)||F2.test(t)?oM(t):M2.test(t)?lM(t):null}var cM={fromString:I2,fromRgb:Ad,fromRgba:Wi,fromHsl:O2,fromHsla:wl};zn.default=cM});var Td=L((AD,L2)=>{"use strict";v();var R2=Object.prototype.toString;L2.exports=function(e){var n=R2.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&R2.call(e.callee)==="[object Function]"),r}});var G2=L((CD,z2)=>{"use strict";v();var U2;Object.keys||(ks=Object.prototype.hasOwnProperty,Cd=Object.prototype.toString,j2=Td(),Fd=Object.prototype.propertyIsEnumerable,D2=!Fd.call({toString:null},"toString"),B2=Fd.call(function(){},"prototype"),As=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],bl=function(t){var e=t.constructor;return e&&e.prototype===t},N2={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},$2=function(){if(typeof window=="undefined")return!1;for(var t in window)try{if(!N2["$"+t]&&ks.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{bl(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),H2=function(t){if(typeof window=="undefined"||!$2)return bl(t);try{return bl(t)}catch(e){return!1}},U2=function(e){var n=e!==null&&typeof e=="object",r=Cd.call(e)==="[object Function]",i=j2(e),a=n&&Cd.call(e)==="[object String]",s=[];if(!n&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var o=B2&&r;if(a&&e.length>0&&!ks.call(e,0))for(var l=0;l0)for(var c=0;c{"use strict";v();var uM=Array.prototype.slice,fM=Td(),V2=Object.keys,xl=V2?function(e){return V2(e)}:G2(),W2=Object.keys;xl.shim=function(){if(Object.keys){var e=function(){var n=Object.keys(arguments);return n&&n.length===arguments.length}(1,2);e||(Object.keys=function(r){return fM(r)?W2(uM.call(r)):W2(r)})}else Object.keys=xl;return Object.keys||xl};q2.exports=xl});var Y2=L((ID,X2)=>{"use strict";v();X2.exports=Error});var K2=L((RD,Z2)=>{"use strict";v();Z2.exports=EvalError});var J2=L((jD,Q2)=>{"use strict";v();Q2.exports=RangeError});var tw=L((BD,ew)=>{"use strict";v();ew.exports=ReferenceError});var Md=L(($D,nw)=>{"use strict";v();nw.exports=SyntaxError});var Gn=L((UD,rw)=>{"use strict";v();rw.exports=TypeError});var aw=L((GD,iw)=>{"use strict";v();iw.exports=URIError});var Ts=L((WD,sw)=>{"use strict";v();sw.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[n]=i;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,n);if(s.value!==i||s.enumerable!==!0)return!1}return!0}});var Sl=L((XD,lw)=>{"use strict";v();var ow=typeof Symbol!="undefined"&&Symbol,dM=Ts();lw.exports=function(){return typeof ow!="function"||typeof Symbol!="function"||typeof ow("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:dM()}});var uw=L((ZD,cw)=>{"use strict";v();var Od={__proto__:null,foo:{}},hM=Object;cw.exports=function(){return{__proto__:Od}.foo===Od.foo&&!(Od instanceof hM)}});var hw=L((QD,dw)=>{"use strict";v();var pM="Function.prototype.bind called on incompatible ",mM=Object.prototype.toString,gM=Math.max,yM="[object Function]",fw=function(e,n){for(var r=[],i=0;i{"use strict";v();var bM=hw();pw.exports=Function.prototype.bind||bM});var Id=L((n9,mw)=>{"use strict";v();var xM=Function.prototype.call,_M=Object.prototype.hasOwnProperty,SM=El();mw.exports=SM.call(xM,_M)});var dn=L((i9,bw)=>{"use strict";v();var pe,EM=Y2(),kM=K2(),AM=J2(),TM=tw(),Zi=Md(),Yi=Gn(),CM=aw(),ww=Function,Pd=function(t){try{return ww('"use strict"; return ('+t+").constructor;")()}catch(e){}},Yr=Object.getOwnPropertyDescriptor;if(Yr)try{Yr({},"")}catch(t){Yr=null}var Rd=function(){throw new Yi},FM=Yr?function(){try{return arguments.callee,Rd}catch(t){try{return Yr(arguments,"callee").get}catch(e){return Rd}}}():Rd,qi=Sl()(),MM=uw()(),ct=Object.getPrototypeOf||(MM?function(t){return t.__proto__}:null),Xi={},OM=typeof Uint8Array=="undefined"||!ct?pe:ct(Uint8Array),Zr={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?pe:ArrayBuffer,"%ArrayIteratorPrototype%":qi&&ct?ct([][Symbol.iterator]()):pe,"%AsyncFromSyncIteratorPrototype%":pe,"%AsyncFunction%":Xi,"%AsyncGenerator%":Xi,"%AsyncGeneratorFunction%":Xi,"%AsyncIteratorPrototype%":Xi,"%Atomics%":typeof Atomics=="undefined"?pe:Atomics,"%BigInt%":typeof BigInt=="undefined"?pe:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":EM,"%eval%":eval,"%EvalError%":kM,"%Float32Array%":typeof Float32Array=="undefined"?pe:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?pe:FinalizationRegistry,"%Function%":ww,"%GeneratorFunction%":Xi,"%Int8Array%":typeof Int8Array=="undefined"?pe:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?pe:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qi&&ct?ct(ct([][Symbol.iterator]())):pe,"%JSON%":typeof JSON=="object"?JSON:pe,"%Map%":typeof Map=="undefined"?pe:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!qi||!ct?pe:ct(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?pe:Promise,"%Proxy%":typeof Proxy=="undefined"?pe:Proxy,"%RangeError%":AM,"%ReferenceError%":TM,"%Reflect%":typeof Reflect=="undefined"?pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?pe:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!qi||!ct?pe:ct(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qi&&ct?ct(""[Symbol.iterator]()):pe,"%Symbol%":qi?Symbol:pe,"%SyntaxError%":Zi,"%ThrowTypeError%":FM,"%TypedArray%":OM,"%TypeError%":Yi,"%Uint8Array%":typeof Uint8Array=="undefined"?pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?pe:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?pe:Uint32Array,"%URIError%":CM,"%WeakMap%":typeof WeakMap=="undefined"?pe:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?pe:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?pe:WeakSet};if(ct)try{null.error}catch(t){gw=ct(ct(t)),Zr["%Error.prototype%"]=gw}var gw,IM=function t(e){var n;if(e==="%AsyncFunction%")n=Pd("async function () {}");else if(e==="%GeneratorFunction%")n=Pd("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=Pd("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&ct&&(n=ct(i.prototype))}return Zr[e]=n,n},yw={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Cs=El(),kl=Id(),PM=Cs.call(Function.call,Array.prototype.concat),RM=Cs.call(Function.apply,Array.prototype.splice),vw=Cs.call(Function.call,String.prototype.replace),Al=Cs.call(Function.call,String.prototype.slice),LM=Cs.call(Function.call,RegExp.prototype.exec),jM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,DM=/\\(\\)?/g,BM=function(e){var n=Al(e,0,1),r=Al(e,-1);if(n==="%"&&r!=="%")throw new Zi("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Zi("invalid intrinsic syntax, expected opening `%`");var i=[];return vw(e,jM,function(a,s,o,l){i[i.length]=o?vw(l,DM,"$1"):s||a}),i},NM=function(e,n){var r=e,i;if(kl(yw,r)&&(i=yw[r],r="%"+i[0]+"%"),kl(Zr,r)){var a=Zr[r];if(a===Xi&&(a=IM(r)),typeof a=="undefined"&&!n)throw new Yi("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new Zi("intrinsic "+e+" does not exist!")};bw.exports=function(e,n){if(typeof e!="string"||e.length===0)throw new Yi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Yi('"allowMissing" argument must be a boolean');if(LM(/^%?[^%]*%?$/,e)===null)throw new Zi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=BM(e),i=r.length>0?r[0]:"",a=NM("%"+i+"%",n),s=a.name,o=a.value,l=!1,c=a.alias;c&&(i=c[0],RM(r,PM([0,1],c)));for(var u=1,f=!0;u=r.length){var m=Yr(o,d);f=!!m,f&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[d]}else f=kl(o,d),o=o[d];f&&!l&&(Zr[s]=o)}}return o}});var Cl=L((s9,xw)=>{"use strict";v();var $M=dn(),Tl=$M("%Object.defineProperty%",!0)||!1;if(Tl)try{Tl({},"a",{value:1})}catch(t){Tl=!1}xw.exports=Tl});var Ml=L((l9,_w)=>{"use strict";v();var HM=dn(),Fl=HM("%Object.getOwnPropertyDescriptor%",!0);if(Fl)try{Fl([],"length")}catch(t){Fl=null}_w.exports=Fl});var Ol=L((u9,kw)=>{"use strict";v();var Sw=Cl(),UM=Md(),Ki=Gn(),Ew=Ml();kw.exports=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Ki("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Ki("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ki("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ki("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ki("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ki("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!Ew&&Ew(e,n);if(Sw)Sw(e,n,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:a===null&&l?l.writable:!a});else if(o||!i&&!a&&!s)e[n]=r;else throw new UM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Il=L((d9,Tw)=>{"use strict";v();var Ld=Cl(),Aw=function(){return!!Ld};Aw.hasArrayLengthDefineBug=function(){if(!Ld)return null;try{return Ld([],"length",{value:1}).length!==1}catch(e){return!0}};Tw.exports=Aw});var hr=L((p9,Ow)=>{"use strict";v();var zM=_l(),GM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",VM=Object.prototype.toString,WM=Array.prototype.concat,Cw=Ol(),qM=function(t){return typeof t=="function"&&VM.call(t)==="[object Function]"},Fw=Il()(),XM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!qM(r)||!r())return}Fw?Cw(t,e,n,!0):Cw(t,e,n)},Mw=function(t,e){var n=arguments.length>2?arguments[2]:{},r=zM(e);GM&&(r=WM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i{"use strict";v();var YM=dn(),Iw=Ol(),ZM=Il()(),Pw=Ml(),Rw=Gn(),KM=YM("%Math.floor%");Lw.exports=function(e,n){if(typeof e!="function")throw new Rw("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||KM(n)!==n)throw new Rw("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Pw){var s=Pw(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!r)&&(ZM?Iw(e,"length",n,!0,!0):Iw(e,"length",n)),e}});var Kr=L((v9,Pl)=>{"use strict";v();var jd=El(),Rl=dn(),QM=jw(),JM=Gn(),Nw=Rl("%Function.prototype.apply%"),$w=Rl("%Function.prototype.call%"),Hw=Rl("%Reflect.apply%",!0)||jd.call($w,Nw),Dw=Cl(),eO=Rl("%Math.max%");Pl.exports=function(e){if(typeof e!="function")throw new JM("a function is required");var n=Hw(jd,$w,arguments);return QM(n,1+eO(0,e.length-(arguments.length-1)),!0)};var Bw=function(){return Hw(jd,Nw,arguments)};Dw?Dw(Pl.exports,"apply",{value:Bw}):Pl.exports.apply=Bw});var Wt=L((b9,Gw)=>{"use strict";v();var Uw=dn(),zw=Kr(),tO=zw(Uw("String.prototype.indexOf"));Gw.exports=function(e,n){var r=Uw(e,!!n);return typeof r=="function"&&tO(e,".prototype.")>-1?zw(r):r}});var Dd=L((_9,Yw)=>{"use strict";v();var nO=_l(),qw=Ts()(),Xw=Wt(),Vw=Object,rO=Xw("Array.prototype.push"),Ww=Xw("Object.prototype.propertyIsEnumerable"),iO=qw?Object.getOwnPropertySymbols:null;Yw.exports=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Vw(e);if(arguments.length===1)return r;for(var i=1;i{"use strict";v();var Bd=Dd(),aO=function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),n={},r=0;r{"use strict";v();var oO=hr(),lO=Nd();Kw.exports=function(){var e=lO();return oO(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var nb=L((C9,tb)=>{"use strict";v();var cO=hr(),uO=Kr(),fO=Dd(),Jw=Nd(),dO=Qw(),hO=uO.apply(Jw()),eb=function(e,n){return hO(Object,arguments)};cO(eb,{getPolyfill:Jw,implementation:fO,shim:dO});tb.exports=eb});var ib=L((M9,rb)=>{"use strict";v();var Ms=function(){return typeof function(){}.name=="string"},Fs=Object.getOwnPropertyDescriptor;if(Fs)try{Fs([],"length")}catch(t){Fs=null}Ms.functionsHaveConfigurableNames=function(){if(!Ms()||!Fs)return!1;var e=Fs(function(){},"name");return!!e&&!!e.configurable};var pO=Function.prototype.bind;Ms.boundFunctionsHaveNames=function(){return Ms()&&typeof pO=="function"&&function(){}.bind().name!==""};rb.exports=Ms});var ob=L((I9,sb)=>{"use strict";v();var ab=Ol(),mO=Il()(),gO=ib().functionsHaveConfigurableNames(),yO=Gn();sb.exports=function(e,n){if(typeof e!="function")throw new yO("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||gO)&&(mO?ab(e,"name",n,!0,!0):ab(e,"name",n)),e}});var $d=L((R9,lb)=>{"use strict";v();var vO=ob(),wO=Gn(),bO=Object;lb.exports=vO(function(){if(this==null||this!==bO(this))throw new wO("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var Hd=L((j9,cb)=>{"use strict";v();var xO=$d(),_O=hr().supportsDescriptors,SO=Object.getOwnPropertyDescriptor;cb.exports=function(){if(_O&&/a/mig.flags==="gim"){var e=SO(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return xO}});var db=L((B9,fb)=>{"use strict";v();var EO=hr().supportsDescriptors,kO=Hd(),AO=Object.getOwnPropertyDescriptor,TO=Object.defineProperty,CO=TypeError,ub=Object.getPrototypeOf,FO=/a/;fb.exports=function(){if(!EO||!ub)throw new CO("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=kO(),n=ub(FO),r=AO(n,"flags");return(!r||r.get!==e)&&TO(n,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var gb=L(($9,mb)=>{"use strict";v();var MO=hr(),OO=Kr(),IO=$d(),hb=Hd(),PO=db(),pb=OO(hb());MO(pb,{getPolyfill:hb,implementation:IO,shim:PO});mb.exports=pb});var pr=L((U9,yb)=>{"use strict";v();var RO=Ts();yb.exports=function(){return RO()&&!!Symbol.toStringTag}});var zd=L((G9,wb)=>{"use strict";v();var LO=pr()(),jO=Wt(),Ud=jO("Object.prototype.toString"),Ll=function(e){return LO&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Ud(e)==="[object Arguments]"},vb=function(e){return Ll(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ud(e)!=="[object Array]"&&Ud(e.callee)==="[object Function]"},DO=function(){return Ll(arguments)}();Ll.isLegacyArguments=vb;wb.exports=DO?Ll:vb});var bb=L(()=>{v()});var $b=L((Y9,Nb)=>{v();var Jd=typeof Map=="function"&&Map.prototype,Gd=Object.getOwnPropertyDescriptor&&Jd?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Dl=Jd&&Gd&&typeof Gd.get=="function"?Gd.get:null,xb=Jd&&Map.prototype.forEach,eh=typeof Set=="function"&&Set.prototype,Vd=Object.getOwnPropertyDescriptor&&eh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Bl=eh&&Vd&&typeof Vd.get=="function"?Vd.get:null,_b=eh&&Set.prototype.forEach,BO=typeof WeakMap=="function"&&WeakMap.prototype,Is=BO?WeakMap.prototype.has:null,NO=typeof WeakSet=="function"&&WeakSet.prototype,Ps=NO?WeakSet.prototype.has:null,$O=typeof WeakRef=="function"&&WeakRef.prototype,Sb=$O?WeakRef.prototype.deref:null,HO=Boolean.prototype.valueOf,UO=Object.prototype.toString,zO=Function.prototype.toString,GO=String.prototype.match,th=String.prototype.slice,gr=String.prototype.replace,VO=String.prototype.toUpperCase,Eb=String.prototype.toLowerCase,Pb=RegExp.prototype.test,kb=Array.prototype.concat,Tn=Array.prototype.join,WO=Array.prototype.slice,Ab=Math.floor,Xd=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Wd=Object.getOwnPropertySymbols,Yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",yt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qi||!0)?Symbol.toStringTag:null,Rb=Object.prototype.propertyIsEnumerable,Tb=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Cb(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Pb.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Ab(-t):Ab(t);if(r!==t){var i=String(r),a=th.call(e,i.length+1);return gr.call(i,n,"$&_")+"."+gr.call(gr.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return gr.call(e,n,"$&_")}var Zd=bb(),Fb=Zd.custom,Mb=jb(Fb)?Fb:null;Nb.exports=function t(e,n,r,i){var a=n||{};if(mr(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(mr(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=mr(a,"customInspect")?a.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(mr(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(mr(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=a.numericSeparator;if(typeof e=="undefined")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Bb(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?Cb(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return o?Cb(e,c):c}var u=typeof a.depth=="undefined"?5:a.depth;if(typeof r=="undefined"&&(r=0),r>=u&&u>0&&typeof e=="object")return Kd(e)?"[Array]":"[Object]";var f=uI(a,r);if(typeof i=="undefined")i=[];else if(Db(i,e)>=0)return"[Circular]";function d($,j,Q){if(j&&(i=WO.call(i),i.push(j)),Q){var le={depth:a.depth};return mr(a,"quoteStyle")&&(le.quoteStyle=a.quoteStyle),t($,le,r+1,i)}return t($,a,r+1,i)}if(typeof e=="function"&&!Ob(e)){var h=tI(e),p=jl(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(p.length>0?" { "+Tn.call(p,", ")+" }":"")}if(jb(e)){var m=Qi?gr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yd.call(e);return typeof e=="object"&&!Qi?Os(m):m}if(oI(e)){for(var g="<"+Eb.call(String(e.nodeName)),w=e.attributes||[],b=0;b",g}if(Kd(e)){if(e.length===0)return"[]";var x=jl(e,d);return f&&!cI(x)?"["+Qd(x,f)+"]":"[ "+Tn.call(x,", ")+" ]"}if(YO(e)){var E=jl(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Rb.call(e,"cause")?"{ ["+String(e)+"] "+Tn.call(kb.call("[cause]: "+d(e.cause),E),", ")+" }":E.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Tn.call(E,", ")+" }"}if(typeof e=="object"&&s){if(Mb&&typeof e[Mb]=="function"&&Zd)return Zd(e,{depth:u-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(nI(e)){var _=[];return xb&&xb.call(e,function($,j){_.push(d(j,e,!0)+" => "+d($,e))}),Ib("Map",Dl.call(e),_,f)}if(aI(e)){var T=[];return _b&&_b.call(e,function($){T.push(d($,e))}),Ib("Set",Bl.call(e),T,f)}if(rI(e))return qd("WeakMap");if(sI(e))return qd("WeakSet");if(iI(e))return qd("WeakRef");if(KO(e))return Os(d(Number(e)));if(JO(e))return Os(d(Xd.call(e)));if(QO(e))return Os(HO.call(e));if(ZO(e))return Os(d(String(e)));if(typeof window!="undefined"&&e===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&e===globalThis||typeof global!="undefined"&&e===global)return"{ [object globalThis] }";if(!XO(e)&&!Ob(e)){var y=jl(e,d),S=Tb?Tb(e)===Object.prototype:e instanceof Object||e.constructor===Object,k=e instanceof Object?"":"null prototype",C=!S&&yt&&Object(e)===e&&yt in e?th.call(yr(e),8,-1):k?"Object":"",M=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",P=M+(C||k?"["+Tn.call(kb.call([],C||[],k||[]),": ")+"] ":"");return y.length===0?P+"{}":f?P+"{"+Qd(y,f)+"}":P+"{ "+Tn.call(y,", ")+" }"}return String(e)};function Lb(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function qO(t){return gr.call(String(t),/"/g,""")}function Kd(t){return yr(t)==="[object Array]"&&(!yt||!(typeof t=="object"&&yt in t))}function XO(t){return yr(t)==="[object Date]"&&(!yt||!(typeof t=="object"&&yt in t))}function Ob(t){return yr(t)==="[object RegExp]"&&(!yt||!(typeof t=="object"&&yt in t))}function YO(t){return yr(t)==="[object Error]"&&(!yt||!(typeof t=="object"&&yt in t))}function ZO(t){return yr(t)==="[object String]"&&(!yt||!(typeof t=="object"&&yt in t))}function KO(t){return yr(t)==="[object Number]"&&(!yt||!(typeof t=="object"&&yt in t))}function QO(t){return yr(t)==="[object Boolean]"&&(!yt||!(typeof t=="object"&&yt in t))}function jb(t){if(Qi)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Yd)return!1;try{return Yd.call(t),!0}catch(e){}return!1}function JO(t){if(!t||typeof t!="object"||!Xd)return!1;try{return Xd.call(t),!0}catch(e){}return!1}var eI=Object.prototype.hasOwnProperty||function(t){return t in this};function mr(t,e){return eI.call(t,e)}function yr(t){return UO.call(t)}function tI(t){if(t.name)return t.name;var e=GO.call(zO.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Db(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return Bb(th.call(t,0,e.maxStringLength),e)+r}var i=gr.call(gr.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lI);return Lb(i,"single",e)}function lI(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+VO.call(e.toString(16))}function Os(t){return"Object("+t+")"}function qd(t){return t+" { ? }"}function Ib(t,e,n,r){var i=r?Qd(n,r):Tn.call(n,", ");return t+" ("+e+") {"+i+"}"}function cI(t){for(var e=0;e=0)return!1;return!0}function uI(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=Tn.call(Array(t.indent+1)," ");else return null;return{base:n,prev:Tn.call(Array(e+1),n)}}function Qd(t,e){if(t.length===0)return"";var n=` +`+e.prev+e.base;return n+Tn.call(t,","+n)+` +`+e.prev}function jl(t,e){var n=Kd(t),r=[];if(n){r.length=t.length;for(var i=0;i{"use strict";v();var Hb=dn(),Ji=Wt(),fI=$b(),dI=Gn(),Nl=Hb("%WeakMap%",!0),$l=Hb("%Map%",!0),hI=Ji("WeakMap.prototype.get",!0),pI=Ji("WeakMap.prototype.set",!0),mI=Ji("WeakMap.prototype.has",!0),gI=Ji("Map.prototype.get",!0),yI=Ji("Map.prototype.set",!0),vI=Ji("Map.prototype.has",!0),nh=function(t,e){for(var n=t,r;(r=n.next)!==null;n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r},wI=function(t,e){var n=nh(t,e);return n&&n.value},bI=function(t,e,n){var r=nh(t,e);r?r.value=n:t.next={key:e,next:t.next,value:n}},xI=function(t,e){return!!nh(t,e)};Ub.exports=function(){var e,n,r,i={assert:function(a){if(!i.has(a))throw new dI("Side channel does not contain "+fI(a))},get:function(a){if(Nl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return hI(e,a)}else if($l){if(n)return gI(n,a)}else if(r)return wI(r,a)},has:function(a){if(Nl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return mI(e,a)}else if($l){if(n)return vI(n,a)}else if(r)return xI(r,a);return!1},set:function(a,s){Nl&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new Nl),pI(e,a,s)):$l?(n||(n=new $l),yI(n,a,s)):(r||(r={key:{},next:null}),bI(r,a,s))}};return i}});var Gb=L((J9,zb)=>{"use strict";v();var _I=Id(),Rs=rh()(),Vn=Gn(),ih={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");if(Rs.assert(t),!ih.has(t,e))throw new Vn("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");var n=Rs.get(t);return n&&n["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");var n=Rs.get(t);return!!n&&_I(n,"$"+e)},set:function(t,e,n){if(!t||typeof t!="object"&&typeof t!="function")throw new Vn("`O` is not an object");if(typeof e!="string")throw new Vn("`slot` must be a string");var r=Rs.get(t);r||(r={},Rs.set(t,r)),r["$"+e]=n}};Object.freeze&&Object.freeze(ih);zb.exports=ih});var qb=L((tB,Wb)=>{"use strict";v();var Ls=Gb(),SI=SyntaxError,Vb=typeof StopIteration=="object"?StopIteration:null;Wb.exports=function(e){if(!Vb)throw new SI("this environment lacks StopIteration");Ls.set(e,"[[Done]]",!1);var n={next:function(){var i=Ls.get(this,"[[Iterator]]"),a=Ls.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Ls.set(i,"[[Done]]",!0),s!==Vb)throw s;return{done:!0,value:void 0}}}};return Ls.set(n,"[[Iterator]]",e),n}});var ah=L((rB,Xb)=>{v();var EI={}.toString;Xb.exports=Array.isArray||function(t){return EI.call(t)=="[object Array]"}});var sh=L((aB,Yb)=>{"use strict";v();var kI=String.prototype.valueOf,AI=function(e){try{return kI.call(e),!0}catch(n){return!1}},TI=Object.prototype.toString,CI="[object String]",FI=pr()();Yb.exports=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:FI?AI(e):TI.call(e)===CI}});var lh=L((oB,Qb)=>{"use strict";v();var oh=typeof Map=="function"&&Map.prototype?Map:null,MI=typeof Set=="function"&&Set.prototype?Set:null,Hl;oh||(Hl=function(e){return!1});var Kb=oh?Map.prototype.has:null,Zb=MI?Set.prototype.has:null;!Hl&&!Kb&&(Hl=function(e){return!1});Qb.exports=Hl||function(e){if(!e||typeof e!="object")return!1;try{if(Kb.call(e),Zb)try{Zb.call(e)}catch(n){return!0}return e instanceof oh}catch(n){}return!1}});var uh=L((cB,tx)=>{"use strict";v();var OI=typeof Map=="function"&&Map.prototype?Map:null,ch=typeof Set=="function"&&Set.prototype?Set:null,Ul;ch||(Ul=function(e){return!1});var Jb=OI?Map.prototype.has:null,ex=ch?Set.prototype.has:null;!Ul&&!ex&&(Ul=function(e){return!1});tx.exports=Ul||function(e){if(!e||typeof e!="object")return!1;try{if(ex.call(e),Jb)try{Jb.call(e)}catch(n){return!0}return e instanceof ch}catch(n){}return!1}});var hx=L((fB,Vl)=>{"use strict";v();var nx=zd(),rx=qb();Sl()()||Ts()()?(zl=Symbol.iterator,Vl.exports=function(e){if(e!=null&&typeof e[zl]!="undefined")return e[zl]();if(nx(e))return Array.prototype[zl].call(e)}):(ix=ah(),ax=sh(),fh=dn(),sx=fh("%Map%",!0),ox=fh("%Set%",!0),nn=Wt(),dh=nn("Array.prototype.push"),hh=nn("String.prototype.charCodeAt"),lx=nn("String.prototype.slice"),cx=function(e,n){var r=e.length;if(n+1>=r)return n+1;var i=hh(e,n);if(i<55296||i>56319)return n+1;var a=hh(e,n+1);return a<56320||a>57343?n+1:n+2},Gl=function(e){var n=0;return{next:function(){var i=n>=e.length,a;return i||(a=e[n],n+=1),{done:i,value:a}}}},ph=function(e,n){if(ix(e)||nx(e))return Gl(e);if(ax(e)){var r=0;return{next:function(){var a=cx(e,r),s=lx(e,r,a);return r=a,{done:a>e.length,value:s}}}}if(n&&typeof e["_es6-shim iterator_"]!="undefined")return e["_es6-shim iterator_"]()},!sx&&!ox?Vl.exports=function(e){if(e!=null)return ph(e,!0)}:(ux=lh(),fx=uh(),mh=nn("Map.prototype.forEach",!0),gh=nn("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(yh=nn("Map.prototype.iterator",!0),vh=nn("Set.prototype.iterator",!0)),wh=nn("Map.prototype.@@iterator",!0)||nn("Map.prototype._es6-shim iterator_",!0),bh=nn("Set.prototype.@@iterator",!0)||nn("Set.prototype._es6-shim iterator_",!0),dx=function(e){if(ux(e)){if(yh)return rx(yh(e));if(wh)return wh(e);if(mh){var n=[];return mh(e,function(i,a){dh(n,[a,i])}),Gl(n)}}if(fx(e)){if(vh)return rx(vh(e));if(bh)return bh(e);if(gh){var r=[];return gh(e,function(i){dh(r,i)}),Gl(r)}}},Vl.exports=function(e){return dx(e)||ph(e)}));var zl,ix,ax,fh,sx,ox,nn,dh,hh,lx,cx,Gl,ph,ux,fx,mh,gh,yh,vh,wh,bh,dx});var xh=L((hB,mx)=>{"use strict";v();var px=function(t){return t!==t};mx.exports=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||px(e)&&px(n))}});var _h=L((mB,gx)=>{"use strict";v();var II=xh();gx.exports=function(){return typeof Object.is=="function"?Object.is:II}});var vx=L((yB,yx)=>{"use strict";v();var PI=_h(),RI=hr();yx.exports=function(){var e=PI();return RI(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var _x=L((wB,xx)=>{"use strict";v();var LI=hr(),jI=Kr(),DI=xh(),wx=_h(),BI=vx(),bx=jI(wx(),Object);LI(bx,{getPolyfill:wx,implementation:DI,shim:BI});xx.exports=bx});var Eh=L((xB,Ax)=>{"use strict";v();var NI=Kr(),kx=Wt(),$I=dn(),Sh=$I("%ArrayBuffer%",!0),Wl=kx("ArrayBuffer.prototype.byteLength",!0),HI=kx("Object.prototype.toString"),Sx=!!Sh&&!Wl&&new Sh(0).slice,Ex=!!Sx&&NI(Sx);Ax.exports=Wl||Ex?function(e){if(!e||typeof e!="object")return!1;try{return Wl?Wl(e):Ex(e,0),!0}catch(n){return!1}}:Sh?function(e){return HI(e)==="[object ArrayBuffer]"}:function(e){return!1}});var Cx=L((SB,Tx)=>{"use strict";v();var UI=Date.prototype.getDay,zI=function(e){try{return UI.call(e),!0}catch(n){return!1}},GI=Object.prototype.toString,VI="[object Date]",WI=pr()();Tx.exports=function(e){return typeof e!="object"||e===null?!1:WI?zI(e):GI.call(e)===VI}});var Px=L((kB,Ix)=>{"use strict";v();var kh=Wt(),Fx=pr()(),Mx,Ox,Ah,Th;Fx&&(Mx=kh("Object.prototype.hasOwnProperty"),Ox=kh("RegExp.prototype.exec"),Ah={},ql=function(){throw Ah},Th={toString:ql,valueOf:ql},typeof Symbol.toPrimitive=="symbol"&&(Th[Symbol.toPrimitive]=ql));var ql,qI=kh("Object.prototype.toString"),XI=Object.getOwnPropertyDescriptor,YI="[object RegExp]";Ix.exports=Fx?function(e){if(!e||typeof e!="object")return!1;var n=XI(e,"lastIndex"),r=n&&Mx(n,"value");if(!r)return!1;try{Ox(e,Th)}catch(i){return i===Ah}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:qI(e)===YI}});var jx=L((TB,Lx)=>{"use strict";v();var ZI=Wt(),Rx=ZI("SharedArrayBuffer.prototype.byteLength",!0);Lx.exports=Rx?function(e){if(!e||typeof e!="object")return!1;try{return Rx(e),!0}catch(n){return!1}}:function(e){return!1}});var Bx=L((FB,Dx)=>{"use strict";v();var KI=Number.prototype.toString,QI=function(e){try{return KI.call(e),!0}catch(n){return!1}},JI=Object.prototype.toString,eP="[object Number]",tP=pr()();Dx.exports=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:tP?QI(e):JI.call(e)===eP}});var Hx=L((OB,$x)=>{"use strict";v();var Nx=Wt(),nP=Nx("Boolean.prototype.toString"),rP=Nx("Object.prototype.toString"),iP=function(e){try{return nP(e),!0}catch(n){return!1}},aP="[object Boolean]",sP=pr()();$x.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:sP&&Symbol.toStringTag in e?iP(e):rP(e)===aP}});var Vx=L((PB,Ch)=>{"use strict";v();var oP=Object.prototype.toString,lP=Sl()();lP?(Ux=Symbol.prototype.toString,zx=/^Symbol\(.*\)$/,Gx=function(e){return typeof e.valueOf()!="symbol"?!1:zx.test(Ux.call(e))},Ch.exports=function(e){if(typeof e=="symbol")return!0;if(oP.call(e)!=="[object Symbol]")return!1;try{return Gx(e)}catch(n){return!1}}):Ch.exports=function(e){return!1};var Ux,zx,Gx});var Xx=L((LB,qx)=>{"use strict";v();var Wx=typeof BigInt!="undefined"&&BigInt;qx.exports=function(){return typeof Wx=="function"&&typeof BigInt=="function"&&typeof Wx(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var Kx=L((DB,Fh)=>{"use strict";v();var cP=Xx()();cP?(Yx=BigInt.prototype.valueOf,Zx=function(e){try{return Yx.call(e),!0}catch(n){}return!1},Fh.exports=function(e){return e===null||typeof e=="undefined"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:Zx(e)}):Fh.exports=function(e){return!1};var Yx,Zx});var Jx=L((NB,Qx)=>{"use strict";v();var uP=sh(),fP=Bx(),dP=Hx(),hP=Vx(),pP=Kx();Qx.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(uP(e))return"String";if(fP(e))return"Number";if(dP(e))return"Boolean";if(hP(e))return"Symbol";if(pP(e))return"BigInt"}});var n_=L((HB,t_)=>{"use strict";v();var Xl=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,e_=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Yl;Xl||(Yl=function(e){return!1});var Oh=Xl?Xl.prototype.has:null,Mh=e_?e_.prototype.has:null;!Yl&&!Oh&&(Yl=function(e){return!1});t_.exports=Yl||function(e){if(!e||typeof e!="object")return!1;try{if(Oh.call(e,Oh),Mh)try{Mh.call(e,Mh)}catch(n){return!0}return e instanceof Xl}catch(n){}return!1}});var i_=L((zB,Ph)=>{"use strict";v();var mP=dn(),r_=Wt(),gP=mP("%WeakSet%",!0),Ih=r_("WeakSet.prototype.has",!0);Ih?(Zl=r_("WeakMap.prototype.has",!0),Ph.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Ih(e,Ih),Zl)try{Zl(e,Zl)}catch(n){return!0}return e instanceof gP}catch(n){}return!1}):Ph.exports=function(e){return!1};var Zl});var s_=L((VB,a_)=>{"use strict";v();var yP=lh(),vP=uh(),wP=n_(),bP=i_();a_.exports=function(e){if(e&&typeof e=="object"){if(yP(e))return"Map";if(vP(e))return"Set";if(wP(e))return"WeakMap";if(bP(e))return"WeakSet"}return!1}});var u_=L((qB,c_)=>{"use strict";v();var l_=Function.prototype.toString,ea=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Lh,Kl;if(typeof ea=="function"&&typeof Object.defineProperty=="function")try{Lh=Object.defineProperty({},"length",{get:function(){throw Kl}}),Kl={},ea(function(){throw 42},null,Lh)}catch(t){t!==Kl&&(ea=null)}else ea=null;var xP=/^\s*class\b/,jh=function(e){try{var n=l_.call(e);return xP.test(n)}catch(r){return!1}},Rh=function(e){try{return jh(e)?!1:(l_.call(e),!0)}catch(n){return!1}},Ql=Object.prototype.toString,_P="[object Object]",SP="[object Function]",EP="[object GeneratorFunction]",kP="[object HTMLAllCollection]",AP="[object HTML document.all class]",TP="[object HTMLCollection]",CP=typeof Symbol=="function"&&!!Symbol.toStringTag,FP=!(0 in[,]),Dh=function(){return!1};typeof document=="object"&&(o_=document.all,Ql.call(o_)===Ql.call(document.all)&&(Dh=function(e){if((FP||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var n=Ql.call(e);return(n===kP||n===AP||n===TP||n===_P)&&e("")==null}catch(r){}return!1}));var o_;c_.exports=ea?function(e){if(Dh(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ea(e,null,Lh)}catch(n){if(n!==Kl)return!1}return!jh(e)&&Rh(e)}:function(e){if(Dh(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(CP)return Rh(e);if(jh(e))return!1;var n=Ql.call(e);return n!==SP&&n!==EP&&!/^\[object HTML/.test(n)?!1:Rh(e)}});var h_=L((YB,d_)=>{"use strict";v();var MP=u_(),OP=Object.prototype.toString,f_=Object.prototype.hasOwnProperty,IP=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),OP.call(e)==="[object Array]"?IP(e,n,i):typeof e=="string"?PP(e,n,i):RP(e,n,i)};d_.exports=LP});var m_=L((KB,p_)=>{"use strict";v();p_.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var y_=L((JB,g_)=>{"use strict";v();var Bh=m_(),jP=typeof globalThis=="undefined"?global:globalThis;g_.exports=function(){for(var e=[],n=0;n{"use strict";v();var ec=h_(),DP=y_(),v_=Kr(),Hh=Wt(),Jl=Ml(),BP=Hh("Object.prototype.toString"),b_=pr()(),w_=typeof globalThis=="undefined"?global:globalThis,$h=DP(),Uh=Hh("String.prototype.slice"),Nh=Object.getPrototypeOf,NP=Hh("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:HP(e)}return Jl?$P(e):null}});var k_=L((rN,E_)=>{"use strict";v();var UP=Wt(),S_=UP("ArrayBuffer.prototype.byteLength",!0),zP=Eh();E_.exports=function(e){return zP(e)?S_?S_(e):e.byteLength:NaN}});var Z_=L((aN,Y_)=>{"use strict";v();var W_=nb(),Cn=Wt(),A_=gb(),GP=dn(),ta=hx(),VP=rh(),T_=_x(),C_=zd(),F_=ah(),M_=Eh(),O_=Cx(),I_=Px(),P_=jx(),R_=_l(),L_=Jx(),j_=s_(),D_=__(),B_=k_(),N_=Cn("SharedArrayBuffer.prototype.byteLength",!0),$_=Cn("Date.prototype.getTime"),zh=Object.getPrototypeOf,H_=Cn("Object.prototype.toString"),rc=GP("%Set%",!0),Gh=Cn("Map.prototype.has",!0),ic=Cn("Map.prototype.get",!0),U_=Cn("Map.prototype.size",!0),ac=Cn("Set.prototype.add",!0),q_=Cn("Set.prototype.delete",!0),sc=Cn("Set.prototype.has",!0),nc=Cn("Set.prototype.size",!0);function z_(t,e,n,r){for(var i=ta(t),a;(a=i.next())&&!a.done;)if(hn(e,a.value,n,r))return q_(t,a.value),!0;return!1}function X_(t){if(typeof t=="undefined")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function WP(t,e,n,r,i,a){var s=X_(n);if(s!=null)return s;var o=ic(e,s),l=W_({},i,{strict:!1});return typeof o=="undefined"&&!Gh(e,s)||!hn(r,o,l,a)?!1:!Gh(t,s)&&hn(r,o,l,a)}function qP(t,e,n){var r=X_(n);return r!=null?r:sc(e,r)&&!sc(t,r)}function G_(t,e,n,r,i,a){for(var s=ta(t),o,l;(o=s.next())&&!o.done;)if(l=o.value,hn(n,l,i,a)&&hn(r,ic(e,l),i,a))return q_(t,l),!0;return!1}function hn(t,e,n,r){var i=n||{};if(i.strict?T_(t,e):t===e)return!0;var a=L_(t),s=L_(e);if(a!==s)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?T_(t,e):t==e;var o=r.has(t),l=r.has(e),c;if(o&&l){if(r.get(t)===r.get(e))return!0}else c={};return o||r.set(t,c),l||r.set(e,c),ZP(t,e,i,r)}function V_(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function XP(t,e,n,r){if(nc(t)!==nc(e))return!1;for(var i=ta(t),a=ta(e),s,o,l;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")l||(l=new rc),ac(l,s.value);else if(!sc(e,s.value)){if(n.strict||!qP(t,e,s.value))return!1;l||(l=new rc),ac(l,s.value)}if(l){for(;(o=a.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!z_(l,o.value,n.strict,r))return!1}else if(!n.strict&&!sc(t,o.value)&&!z_(l,o.value,n.strict,r))return!1;return nc(l)===0}return!0}function YP(t,e,n,r){if(U_(t)!==U_(e))return!1;for(var i=ta(t),a=ta(e),s,o,l,c,u,f;(s=i.next())&&!s.done;)if(c=s.value[0],u=s.value[1],c&&typeof c=="object")l||(l=new rc),ac(l,c);else if(f=ic(e,c),typeof f=="undefined"&&!Gh(e,c)||!hn(u,f,n,r)){if(n.strict||!WP(t,e,c,u,n,r))return!1;l||(l=new rc),ac(l,c)}if(l){for(;(o=a.next())&&!o.done;)if(c=o.value[0],f=o.value[1],c&&typeof c=="object"){if(!G_(l,t,c,f,n,r))return!1}else if(!n.strict&&(!t.has(c)||!hn(ic(t,c),f,n,r))&&!G_(l,t,c,f,W_({},n,{strict:!1}),r))return!1;return nc(l)===0}return!0}function ZP(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||H_(t)!==H_(e)||C_(t)!==C_(e))return!1;var s=F_(t),o=F_(e);if(s!==o)return!1;var l=t instanceof Error,c=e instanceof Error;if(l!==c||(l||c)&&(t.name!==e.name||t.message!==e.message))return!1;var u=I_(t),f=I_(e);if(u!==f||(u||f)&&(t.source!==e.source||A_(t)!==A_(e)))return!1;var d=O_(t),h=O_(e);if(d!==h||(d||h)&&$_(t)!==$_(e)||n.strict&&zh&&zh(t)!==zh(e))return!1;var p=D_(t),m=D_(e);if(p!==m)return!1;if(p||m){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(T[i]!=y[i])return!1;for(i=T.length-1;i>=0;i--)if(a=T[i],!hn(t[a],e[a],n,r))return!1;var S=j_(t),k=j_(e);return S!==k?!1:S==="Set"||k==="Set"?XP(t,e,n,r):S==="Map"?YP(t,e,n,r):!0}Y_.exports=function(e,n,r){return hn(e,n,r,VP())}});var Zh=L((exports,module)=>{v();(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(n){return new Sha256(e,!0).update(n)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(i){return e.create().update(i)};for(var n=0;n>2]|=t[i]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|r&63)<=57344?(o[a>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<=64?(this.block=o[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=this.blocks,c,u,f,d,h,p,m,g,w,b,x;for(c=16;c<64;++c)h=l[c-15],u=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,h=l[c-2],f=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,l[c]=l[c-16]+u+l[c-7]+f<<0;for(x=e&n,c=0;c<64;c+=4)this.first?(this.is224?(g=300032,h=l[0]-1413257819,o=h-150054599<<0,r=h+24177077<<0):(g=704751109,h=l[0]-210244248,o=h-1521486534<<0,r=h+143694565<<0),this.first=!1):(u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),g=t&e,d=g^t&n^x,m=i&a^~i&s,h=o+f+m+K[c]+l[c],p=u+d,o=r+h<<0,r=h+p<<0),u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=r&t,d=w^r&e^g,m=o&i^~o&a,h=s+f+m+K[c+1]+l[c+1],p=u+d,s=n+h<<0,n=h+p<<0,u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=n&r,d=b^n&t^w,m=s&o^~s&i,h=a+f+m+K[c+2]+l[c+2],p=u+d,a=e+h<<0,e=h+p<<0,u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),x=e&n,d=x^e&r^b,m=a&s^~a&o,h=i+f+m+K[c+3]+l[c+3],p=u+d,i=t+h<<0,t=h+p<<0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+s<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15];return this.is224||(l+=HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,r>>24&255,r>>16&255,r>>8&255,r&255,i>>24&255,i>>16&255,i>>8&255,i&255,a>>24&255,a>>16&255,a>>8&255,a&255,s>>24&255,s>>16&255,s>>8&255,s&255];return this.is224||l.push(o>>24&255,o>>16&255,o>>8&255,o&255),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};function HmacSha256(t,e,n){var r,i=typeof t;if(i==="string"){var a=[],s=t.length,o=0,l;for(r=0;r>6,a[o++]=128|l&63):l<55296||l>=57344?(a[o++]=224|l>>12,a[o++]=128|l>>6&63,a[o++]=128|l&63):(l=65536+((l&1023)<<10|t.charCodeAt(++r)&1023),a[o++]=240|l>>18,a[o++]=128|l>>12&63,a[o++]=128|l>>6&63,a[o++]=128|l&63);t=a}else if(i==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);t.length>64&&(t=new Sha256(e,!0).update(t).array());var c=[],u=[];for(r=0;r<64;++r){var f=t[r]||0;c[r]=92^f,u[r]=54^f}Sha256.call(this,e,n),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=n}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var pE=L(_p=>{v();(function(t){var e=/\S/,n=/\"/g,r=/\n/g,i=/\r/g,a=/\\/g,s=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(S,k){var C=S.length,M=0,P=1,$=2,j=M,Q=null,le=null,de="",re=[],Ae=!1,he=0,H=0,U="{{",D="}}";function se(){de.length>0&&(re.push({tag:"_t",text:new String(de)}),de="")}function _e(){for(var Te=!0,Be=H;Be"&&(Re.indent=re[Je].text.toString()),re.splice(Je,1));else Be||re.push({tag:` +`});Ae=!1,H=re.length}function X(Te,Be){var Je="="+D,Re=Te.indexOf(Je,Be),V=c(Te.substring(Te.indexOf("=",Be)+1,Re)).split(" ");return U=V[0],D=V[V.length-1],Re+Je.length-1}for(k&&(k=k.split(" "),U=k[0],D=k[1]),he=0;he0;){if(j=y.shift(),$&&$.tag=="<"&&!(j.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[j.tag]<=t.tags.$||h(j,C))k.push(j),j.nodes=d(y,j.tag,k,C);else if(j.tag=="/"){if(k.length===0)throw new Error("Closing tag without opener: /"+j.n);if(P=k.pop(),j.n!=P.n&&!p(j.n,P.n,C))throw new Error("Nesting error: "+P.n+" vs. "+j.n);return P.end=j.i,M}else j.tag==` +`&&(j.last=y.length==0||y[0].tag==` +`);M.push(j)}if(k.length>0)throw new Error("missing closing tag: "+k.pop().n);return M}function h(y,S){for(var k=0,C=S.length;k":E,"<":function(y,S){var k={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,k);var C=S.partials[E(y,S)];C.subs=k.subs,C.partials=k.partials},$:function(y,S){var k={subs:{},code:"",partials:S.partials,prefix:y.n};t.walk(y.nodes,k),S.subs[y.n]=k.code,S.inPartial||(S.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,S){S.code+=T('"\\n"'+(y.last?"":" + i"))},_v:function(y,S){S.code+="t.b(t.v(t."+x(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,S){S.code+=T('"'+b(y.text)+'"')},"{":_,"&":_};function _(y,S){S.code+="t.b(t.t(t."+x(y.n)+'("'+b(y.n)+'",c,p,0)));'}function T(y){return"t.b("+y+");"}t.walk=function(y,S){for(var k,C=0,M=y.length;C{v();var sL={};(function(t){t.Template=function(d,h,p,m){d=d||{},this.r=d.code||this.r,this.c=p,this.options=m||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,m){return this.ri([h],p||{},m)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],m=h[p.name];if(p.instance&&p.base==m)return p.instance;if(typeof m=="string"){if(!this.c)throw new Error("No compiler available.");m=this.c.compile(m,this.options)}if(!m)return null;if(this.partials[d].base=m,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);m=n(m,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=m,m},rp:function(d,h,p,m){var g=this.ep(d,p);return g?g.ri(h,p,m):""},rs:function(d,h,p){var m=d[d.length-1];if(!f(m)){p(d,h,this);return}for(var g=0;g=0;E--)if(w=h[E],g=e(d,w,x),g!==void 0){b=!0;break}return b?(!m&&typeof g=="function"&&(g=this.mv(g,h,p)),g):m?!1:""},ls:function(d,h,p,m,g){var w=this.options.delimiters;return this.options.delimiters=g,this.b(this.ct(c(d.call(h,m)),h,p)),this.options.delimiters=w,!1},ct:function(d,h,p){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(d,this.options).render(h,p)},b:function(d){this.buf+=d},fl:function(){var d=this.buf;return this.buf="",d},ms:function(d,h,p,m,g,w,b){var x,E=h[h.length-1],_=d.call(E);return typeof _=="function"?m?!0:(x=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(_,E,p,x.substring(g,w),b)):_},mv:function(d,h,p){var m=h[h.length-1],g=d.call(m);return typeof g=="function"?this.ct(c(g.call(m)),m,p):g},sub:function(d,h,p,m){var g=this.subs[d];g&&(this.activeSub=d,g(h,p,this,m),this.activeSub=!1)}};function e(d,h,p){var m;return h&&typeof h=="object"&&(h[d]!==void 0?m=h[d]:p&&h.get&&typeof h.get=="function"&&(m=h.get(d))),m}function n(d,h,p,m,g,w){function b(){}b.prototype=d;function x(){}x.prototype=d.subs;var E,_=new b;_.subs=new x,_.subsText={},_.buf="",m=m||{},_.stackSubs=m,_.subsText=w;for(E in h)m[E]||(m[E]=h[E]);for(E in m)_.subs[E]=m[E];g=g||{},_.stackPartials=g;for(E in p)g[E]||(g[E]=p[E]);for(E in g)_.partials[E]=g[E];return _}var r=/&/g,i=//g,s=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(r,"&").replace(i,"<").replace(a,">").replace(s,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof Sp!="undefined"?Sp:sL)});var Ep=L((lU,gE)=>{v();var Rc=pE();Rc.Template=mE().Template;Rc.template=Rc.Template;gE.exports=Rc});var JE=L((ro,Np)=>{v();(function(e,n){typeof ro=="object"&&typeof Np=="object"?Np.exports=n():typeof define=="function"&&define.amd?define([],n):typeof ro=="object"?ro.feather=n():e.feather=n()})(typeof self!="undefined"?self:ro,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,a){n.o(r,i)||Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:a})},n.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=0)}({"./dist/icons.json":function(t){t.exports={activity:'',airplay:'',"alert-circle":'',"alert-octagon":'',"alert-triangle":'',"align-center":'',"align-justify":'',"align-left":'',"align-right":'',anchor:'',aperture:'',archive:'',"arrow-down-circle":'',"arrow-down-left":'',"arrow-down-right":'',"arrow-down":'',"arrow-left-circle":'',"arrow-left":'',"arrow-right-circle":'',"arrow-right":'',"arrow-up-circle":'',"arrow-up-left":'',"arrow-up-right":'',"arrow-up":'',"at-sign":'',award:'',"bar-chart-2":'',"bar-chart":'',"battery-charging":'',battery:'',"bell-off":'',bell:'',bluetooth:'',bold:'',"book-open":'',book:'',bookmark:'',box:'',briefcase:'',calendar:'',"camera-off":'',camera:'',cast:'',"check-circle":'',"check-square":'',check:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"chevrons-down":'',"chevrons-left":'',"chevrons-right":'',"chevrons-up":'',chrome:'',circle:'',clipboard:'',clock:'',"cloud-drizzle":'',"cloud-lightning":'',"cloud-off":'',"cloud-rain":'',"cloud-snow":'',cloud:'',code:'',codepen:'',codesandbox:'',coffee:'',columns:'',command:'',compass:'',copy:'',"corner-down-left":'',"corner-down-right":'',"corner-left-down":'',"corner-left-up":'',"corner-right-down":'',"corner-right-up":'',"corner-up-left":'',"corner-up-right":'',cpu:'',"credit-card":'',crop:'',crosshair:'',database:'',delete:'',disc:'',"divide-circle":'',"divide-square":'',divide:'',"dollar-sign":'',"download-cloud":'',download:'',dribbble:'',droplet:'',"edit-2":'',"edit-3":'',edit:'',"external-link":'',"eye-off":'',eye:'',facebook:'',"fast-forward":'',feather:'',figma:'',"file-minus":'',"file-plus":'',"file-text":'',file:'',film:'',filter:'',flag:'',"folder-minus":'',"folder-plus":'',folder:'',framer:'',frown:'',gift:'',"git-branch":'',"git-commit":'',"git-merge":'',"git-pull-request":'',github:'',gitlab:'',globe:'',grid:'',"hard-drive":'',hash:'',headphones:'',heart:'',"help-circle":'',hexagon:'',home:'',image:'',inbox:'',info:'',instagram:'',italic:'',key:'',layers:'',layout:'',"life-buoy":'',"link-2":'',link:'',linkedin:'',list:'',loader:'',lock:'',"log-in":'',"log-out":'',mail:'',"map-pin":'',map:'',"maximize-2":'',maximize:'',meh:'',menu:'',"message-circle":'',"message-square":'',"mic-off":'',mic:'',"minimize-2":'',minimize:'',"minus-circle":'',"minus-square":'',minus:'',monitor:'',moon:'',"more-horizontal":'',"more-vertical":'',"mouse-pointer":'',move:'',music:'',"navigation-2":'',navigation:'',octagon:'',package:'',paperclip:'',"pause-circle":'',pause:'',"pen-tool":'',percent:'',"phone-call":'',"phone-forwarded":'',"phone-incoming":'',"phone-missed":'',"phone-off":'',"phone-outgoing":'',phone:'',"pie-chart":'',"play-circle":'',play:'',"plus-circle":'',"plus-square":'',plus:'',pocket:'',power:'',printer:'',radio:'',"refresh-ccw":'',"refresh-cw":'',repeat:'',rewind:'',"rotate-ccw":'',"rotate-cw":'',rss:'',save:'',scissors:'',search:'',send:'',server:'',settings:'',"share-2":'',share:'',"shield-off":'',shield:'',"shopping-bag":'',"shopping-cart":'',shuffle:'',sidebar:'',"skip-back":'',"skip-forward":'',slack:'',slash:'',sliders:'',smartphone:'',smile:'',speaker:'',square:'',star:'',"stop-circle":'',sun:'',sunrise:'',sunset:'',table:'',tablet:'',tag:'',target:'',terminal:'',thermometer:'',"thumbs-down":'',"thumbs-up":'',"toggle-left":'',"toggle-right":'',tool:'',"trash-2":'',trash:'',trello:'',"trending-down":'',"trending-up":'',triangle:'',truck:'',tv:'',twitch:'',twitter:'',type:'',umbrella:'',underline:'',unlock:'',"upload-cloud":'',upload:'',"user-check":'',"user-minus":'',"user-plus":'',"user-x":'',user:'',users:'',"video-off":'',video:'',voicemail:'',"volume-1":'',"volume-2":'',"volume-x":'',volume:'',watch:'',"wifi-off":'',wifi:'',wind:'',"x-circle":'',"x-octagon":'',"x-square":'',x:'',youtube:'',"zap-off":'',zap:'',"zoom-in":'',"zoom-out":''}},"./node_modules/classnames/dedupe.js":function(t,e,n){var r,i;(function(){"use strict";var a=function(){function s(){}s.prototype=Object.create(null);function o(m,g){for(var w=g.length,b=0;b1?arguments[1]:void 0,g=m!==void 0,w=0,b=c(d),x,E,_,T;if(g&&(m=r(m,p>2?arguments[2]:void 0,2)),b!=null&&!(h==Array&&s(b)))for(T=b.call(d),E=new h;!(_=T.next()).done;w++)l(E,w,g?a(T,m,[_.value,w],!0):_.value);else for(x=o(d.length),E=new h(x);x>w;w++)l(E,w,g?m(d[w],w):d[w]);return E.length=w,E}},"./node_modules/core-js/internals/array-includes.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-indexed-object.js"),i=n("./node_modules/core-js/internals/to-length.js"),a=n("./node_modules/core-js/internals/to-absolute-index.js");t.exports=function(s){return function(o,l,c){var u=r(o),f=i(u.length),d=a(c,f),h;if(s&&l!=l){for(;f>d;)if(h=u[d++],h!=h)return!0}else for(;f>d;d++)if((s||d in u)&&u[d]===l)return s||d||0;return!s&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(t,e,n){var r=n("./node_modules/core-js/internals/a-function.js");t.exports=function(i,a,s){if(r(i),a===void 0)return i;switch(s){case 0:return function(){return i.call(a)};case 1:return function(o){return i.call(a,o)};case 2:return function(o,l){return i.call(a,o,l)};case 3:return function(o,l,c){return i.call(a,o,l,c)}}return function(){return i.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(t,e,n){var r=n("./node_modules/core-js/internals/an-object.js");t.exports=function(i,a,s,o){try{return o?a(r(s)[0],s[1]):a(s)}catch(c){var l=i.return;throw l!==void 0&&r(l.call(i)),c}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(t,e,n){var r=n("./node_modules/core-js/internals/well-known-symbol.js"),i=r("iterator"),a=!1;try{var s=0,o={next:function(){return{done:!!s++}},return:function(){a=!0}};o[i]=function(){return this},Array.from(o,function(){throw 2})}catch(l){}t.exports=function(l,c){if(!c&&!a)return!1;var u=!1;try{var f={};f[i]=function(){return{next:function(){return{done:u=!0}}}},l(f)}catch(d){}return u}},"./node_modules/core-js/internals/classof-raw.js":function(t,e){var n={}.toString;t.exports=function(r){return n.call(r).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(t,e,n){var r=n("./node_modules/core-js/internals/classof-raw.js"),i=n("./node_modules/core-js/internals/well-known-symbol.js"),a=i("toStringTag"),s=r(function(){return arguments}())=="Arguments",o=function(l,c){try{return l[c]}catch(u){}};t.exports=function(l){var c,u,f;return l===void 0?"Undefined":l===null?"Null":typeof(u=o(c=Object(l),a))=="string"?u:s?r(c):(f=r(c))=="Object"&&typeof c.callee=="function"?"Arguments":f}},"./node_modules/core-js/internals/copy-constructor-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/own-keys.js"),a=n("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),s=n("./node_modules/core-js/internals/object-define-property.js");t.exports=function(o,l){for(var c=i(l),u=s.f,f=a.f,d=0;d",x="java"+w+":",E;for(p.style.display="none",o.appendChild(p),p.src=String(x),E=p.contentWindow.document,E.open(),E.write(g+w+b+"document.F=Object"+g+"/"+w+b),E.close(),h=E.F;m--;)delete h[f][a[m]];return h()};t.exports=Object.create||function(m,g){var w;return m!==null?(d[f]=r(m),w=new d,d[f]=null,w[u]=m):w=h(),g===void 0?w:i(w,g)},s[u]=!0},"./node_modules/core-js/internals/object-define-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-define-property.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/object-keys.js");t.exports=r?Object.defineProperties:function(l,c){a(l);for(var u=s(c),f=u.length,d=0,h;f>d;)i.f(l,h=u[d++],c[h]);return l}},"./node_modules/core-js/internals/object-define-property.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/ie8-dom-define.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/to-primitive.js"),o=Object.defineProperty;e.f=r?o:function(c,u,f){if(a(c),u=s(u,!0),a(f),i)try{return o(c,u,f)}catch(d){}if("get"in f||"set"in f)throw TypeError("Accessors not supported");return"value"in f&&(c[u]=f.value),c}},"./node_modules/core-js/internals/object-get-own-property-descriptor.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-property-is-enumerable.js"),a=n("./node_modules/core-js/internals/create-property-descriptor.js"),s=n("./node_modules/core-js/internals/to-indexed-object.js"),o=n("./node_modules/core-js/internals/to-primitive.js"),l=n("./node_modules/core-js/internals/has.js"),c=n("./node_modules/core-js/internals/ie8-dom-define.js"),u=Object.getOwnPropertyDescriptor;e.f=r?u:function(d,h){if(d=s(d),h=o(h,!0),c)try{return u(d,h)}catch(p){}if(l(d,h))return a(!i.f.call(d,h),d[h])}},"./node_modules/core-js/internals/object-get-own-property-names.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js"),a=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return r(o,a)}},"./node_modules/core-js/internals/object-get-own-property-symbols.js":function(t,e){e.f=Object.getOwnPropertySymbols},"./node_modules/core-js/internals/object-get-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-object.js"),a=n("./node_modules/core-js/internals/shared-key.js"),s=n("./node_modules/core-js/internals/correct-prototype-getter.js"),o=a("IE_PROTO"),l=Object.prototype;t.exports=s?Object.getPrototypeOf:function(c){return c=i(c),r(c,o)?c[o]:typeof c.constructor=="function"&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?l:null}},"./node_modules/core-js/internals/object-keys-internal.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-indexed-object.js"),a=n("./node_modules/core-js/internals/array-includes.js"),s=n("./node_modules/core-js/internals/hidden-keys.js"),o=a(!1);t.exports=function(l,c){var u=i(l),f=0,d=[],h;for(h in u)!r(s,h)&&r(u,h)&&d.push(h);for(;c.length>f;)r(u,h=c[f++])&&(~o(d,h)||d.push(h));return d}},"./node_modules/core-js/internals/object-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js");t.exports=Object.keys||function(s){return r(s,i)}},"./node_modules/core-js/internals/object-property-is-enumerable.js":function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!r.call({1:2},1);e.f=a?function(o){var l=i(this,o);return!!l&&l.enumerable}:r},"./node_modules/core-js/internals/object-set-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,a={},s;try{s=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,s.call(a,[]),i=a instanceof Array}catch(o){}return function(l,c){return r(l,c),i?s.call(l,c):l.__proto__=c,l}}():void 0)},"./node_modules/core-js/internals/own-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/object-get-own-property-names.js"),a=n("./node_modules/core-js/internals/object-get-own-property-symbols.js"),s=n("./node_modules/core-js/internals/an-object.js"),o=r.Reflect;t.exports=o&&o.ownKeys||function(c){var u=i.f(s(c)),f=a.f;return f?u.concat(f(c)):u}},"./node_modules/core-js/internals/path.js":function(t,e,n){t.exports=n("./node_modules/core-js/internals/global.js")},"./node_modules/core-js/internals/redefine.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/hide.js"),s=n("./node_modules/core-js/internals/has.js"),o=n("./node_modules/core-js/internals/set-global.js"),l=n("./node_modules/core-js/internals/function-to-string.js"),c=n("./node_modules/core-js/internals/internal-state.js"),u=c.get,f=c.enforce,d=String(l).split("toString");i("inspectSource",function(h){return l.call(h)}),(t.exports=function(h,p,m,g){var w=g?!!g.unsafe:!1,b=g?!!g.enumerable:!1,x=g?!!g.noTargetGet:!1;if(typeof m=="function"&&(typeof p=="string"&&!s(m,"name")&&a(m,"name",p),f(m).source=d.join(typeof p=="string"?p:"")),h===r){b?h[p]=m:o(p,m);return}else w?!x&&h[p]&&(b=!0):delete h[p];b?h[p]=m:a(h,p,m)})(Function.prototype,"toString",function(){return typeof this=="function"&&u(this).source||l.call(this)})},"./node_modules/core-js/internals/require-object-coercible.js":function(t,e){t.exports=function(n){if(n==null)throw TypeError("Can't call method on "+n);return n}},"./node_modules/core-js/internals/set-global.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/hide.js");t.exports=function(a,s){try{i(r,a,s)}catch(o){r[a]=s}return s}},"./node_modules/core-js/internals/set-to-string-tag.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-define-property.js").f,i=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/well-known-symbol.js"),s=a("toStringTag");t.exports=function(o,l,c){o&&!i(o=c?o:o.prototype,s)&&r(o,s,{configurable:!0,value:l})}},"./node_modules/core-js/internals/shared-key.js":function(t,e,n){var r=n("./node_modules/core-js/internals/shared.js"),i=n("./node_modules/core-js/internals/uid.js"),a=r("keys");t.exports=function(s){return a[s]||(a[s]=i(s))}},"./node_modules/core-js/internals/shared.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/set-global.js"),a=n("./node_modules/core-js/internals/is-pure.js"),s="__core-js_shared__",o=r[s]||i(s,{});(t.exports=function(l,c){return o[l]||(o[l]=c!==void 0?c:{})})("versions",[]).push({version:"3.1.3",mode:a?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},"./node_modules/core-js/internals/string-at.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a,s,o){var l=String(i(a)),c=r(s),u=l.length,f,d;return c<0||c>=u?o?"":void 0:(f=l.charCodeAt(c),f<55296||f>56319||c+1===u||(d=l.charCodeAt(c+1))<56320||d>57343?o?l.charAt(c):f:o?l.slice(c,c+2):(f-55296<<10)+(d-56320)+65536)}},"./node_modules/core-js/internals/to-absolute-index.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.max,a=Math.min;t.exports=function(s,o){var l=r(s);return l<0?i(l+o,0):a(l,o)}},"./node_modules/core-js/internals/to-indexed-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/indexed-object.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a){return r(i(a))}},"./node_modules/core-js/internals/to-integer.js":function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(i){return isNaN(i=+i)?0:(i>0?r:n)(i)}},"./node_modules/core-js/internals/to-length.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.min;t.exports=function(a){return a>0?i(r(a),9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(i){return Object(r(i))}},"./node_modules/core-js/internals/to-primitive.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js");t.exports=function(i,a){if(!r(i))return i;var s,o;if(a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i))||typeof(s=i.valueOf)=="function"&&!r(o=s.call(i))||!a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i)))return o;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/internals/uid.js":function(t,e){var n=0,r=Math.random();t.exports=function(i){return"Symbol(".concat(i===void 0?"":i,")_",(++n+r).toString(36))}},"./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js"),i=n("./node_modules/core-js/internals/an-object.js");t.exports=function(a,s){if(i(a),!r(s)&&s!==null)throw TypeError("Can't set "+String(s)+" as a prototype")}},"./node_modules/core-js/internals/well-known-symbol.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/uid.js"),s=n("./node_modules/core-js/internals/native-symbol.js"),o=r.Symbol,l=i("wks");t.exports=function(c){return l[c]||(l[c]=s&&o[c]||(s?o:a)("Symbol."+c))}},"./node_modules/core-js/modules/es.array.from.js":function(t,e,n){var r=n("./node_modules/core-js/internals/export.js"),i=n("./node_modules/core-js/internals/array-from.js"),a=n("./node_modules/core-js/internals/check-correctness-of-iteration.js"),s=!a(function(o){Array.from(o)});r({target:"Array",stat:!0,forced:s},{from:i})},"./node_modules/core-js/modules/es.string.iterator.js":function(t,e,n){"use strict";var r=n("./node_modules/core-js/internals/string-at.js"),i=n("./node_modules/core-js/internals/internal-state.js"),a=n("./node_modules/core-js/internals/define-iterator.js"),s="String Iterator",o=i.set,l=i.getterFor(s);a(String,"String",function(c){o(this,{type:s,string:String(c),index:0})},function(){var u=l(this),f=u.string,d=u.index,h;return d>=f.length?{value:void 0,done:!0}:(h=r(f,d,!0),u.index+=h.length,{value:h,done:!1})})},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(r){typeof window=="object"&&(n=window)}t.exports=n},"./src/default-attrs.json":function(t){t.exports={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"}},"./src/icon.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(h){for(var p=1;p2&&arguments[2]!==void 0?arguments[2]:[];u(this,h),this.name=p,this.contents=m,this.tags=g,this.attrs=r({},l.default,{class:"feather feather-"+p})}return i(h,[{key:"toSvg",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},g=r({},this.attrs,m,{class:(0,s.default)(this.attrs.class,m.class)});return""+this.contents+""}},{key:"toString",value:function(){return this.contents}}]),h}();function d(h){return Object.keys(h).map(function(p){return p+'="'+h[p]+'"'}).join(" ")}e.default=f},"./src/icons.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icon.js"),i=c(r),a=n("./dist/icons.json"),s=c(a),o=n("./src/tags.json"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}e.default=Object.keys(s.default).map(function(u){return new i.default(u,s.default[u],l.default[u])}).reduce(function(u,f){return u[f.name]=f,u},{})},"./src/index.js":function(t,e,n){"use strict";var r=n("./src/icons.js"),i=c(r),a=n("./src/to-svg.js"),s=c(a),o=n("./src/replace.js"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}t.exports={icons:i.default,toSvg:s.default,replace:l.default}},"./src/replace.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(d){for(var h=1;h0&&arguments[0]!==void 0?arguments[0]:{};if(typeof document=="undefined")throw new Error("`feather.replace()` only works in a browser environment.");var h=document.querySelectorAll("[data-feather]");Array.from(h).forEach(function(p){return u(p,d)})}function u(d){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=f(d),m=p["data-feather"];if(delete p["data-feather"],o.default[m]===void 0){console.warn("feather: '"+m+"' is not a valid icon");return}var g=o.default[m].toSvg(r({},h,p,{class:(0,a.default)(h.class,p.class)})),w=new DOMParser().parseFromString(g,"image/svg+xml"),b=w.querySelector("svg");d.parentNode.replaceChild(b,d)}function f(d){return Array.from(d.attributes).reduce(function(h,p){return h[p.name]=p.value,h},{})}e.default=c},"./src/tags.json":function(t){t.exports={activity:["pulse","health","action","motion"],airplay:["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],anchor:[],archive:["index","box"],"at-sign":["mention","at","email","message"],award:["achievement","badge"],aperture:["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],battery:["power","electricity"],"battery-charging":["power","electricity"],bell:["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],bluetooth:["wireless"],"book-open":["read","library"],book:["read","dictionary","booklet","magazine","library"],bookmark:["read","clip","marker","tag"],box:["cube"],briefcase:["work","bag","baggage","folder"],calendar:["date"],camera:["photo"],cast:["chromecast","airplay"],"chevron-down":["expand"],"chevron-up":["collapse"],circle:["off","zero","record"],clipboard:["copy"],clock:["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],cloud:["weather"],codepen:["logo"],codesandbox:["logo"],code:["source","programming"],coffee:["drink","cup","mug","tea","cafe","hot","beverage"],columns:["layout"],command:["keyboard","cmd","terminal","prompt"],compass:["navigation","safari","travel","direction"],copy:["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],cpu:["processor","technology"],"credit-card":["purchase","payment","cc"],crop:["photo","image"],crosshair:["aim","target"],database:["storage","memory"],delete:["remove"],disc:["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],droplet:["water"],edit:["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],eye:["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],facebook:["logo","social"],"fast-forward":["music"],figma:["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],film:["movie","video"],filter:["funnel","hopper"],flag:["report"],"folder-minus":["directory"],"folder-plus":["directory"],folder:["directory"],framer:["logo","design","tool"],frown:["emoji","face","bad","sad","emotion"],gift:["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],github:["logo","version control"],gitlab:["logo","version control"],globe:["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],hash:["hashtag","number","pound"],headphones:["music","audio","sound"],heart:["like","love","emotion"],"help-circle":["question mark"],hexagon:["shape","node.js","logo"],home:["house","living"],image:["picture"],inbox:["email"],instagram:["logo","camera"],key:["password","login","authentication","secure"],layers:["stack"],layout:["window","webpage"],"life-buoy":["help","life ring","support"],link:["chain","url"],"link-2":["chain","url"],linkedin:["logo","social media"],list:["options"],lock:["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],mail:["email","message"],"map-pin":["location","navigation","travel","marker"],map:["location","navigation","travel"],maximize:["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],meh:["emoji","face","neutral","emotion"],menu:["bars","navigation","hamburger"],"message-circle":["comment","chat"],"message-square":["comment","chat"],"mic-off":["record","sound","mute"],mic:["record","sound","listen"],minimize:["exit fullscreen","close"],"minimize-2":["exit fullscreen","arrows","close"],minus:["subtract"],monitor:["tv","screen","display"],moon:["dark","night"],"more-horizontal":["ellipsis"],"more-vertical":["ellipsis"],"mouse-pointer":["arrow","cursor"],move:["arrows"],music:["note"],navigation:["location","travel"],"navigation-2":["location","travel"],octagon:["stop"],package:["box","container"],paperclip:["attachment"],pause:["music","stop"],"pause-circle":["music","audio","stop"],"pen-tool":["vector","drawing"],percent:["discount"],"phone-call":["ring"],"phone-forwarded":["call"],"phone-incoming":["call"],"phone-missed":["call"],"phone-off":["call","mute"],"phone-outgoing":["call"],phone:["call"],play:["music","start"],"pie-chart":["statistics","diagram"],"play-circle":["music","start"],plus:["add","new"],"plus-circle":["add","new"],"plus-square":["add","new"],pocket:["logo","save"],power:["on","off"],printer:["fax","office","device"],radio:["signal"],"refresh-cw":["synchronise","arrows"],"refresh-ccw":["arrows"],repeat:["loop","arrows"],rewind:["music"],"rotate-ccw":["arrow"],"rotate-cw":["arrow"],rss:["feed","subscribe"],save:["floppy disk"],scissors:["cut"],search:["find","magnifier","magnifying glass"],send:["message","mail","email","paper airplane","paper aeroplane"],settings:["cog","edit","gear","preferences"],"share-2":["network","connections"],shield:["security","secure"],"shield-off":["security","insecure"],"shopping-bag":["ecommerce","cart","purchase","store"],"shopping-cart":["ecommerce","cart","purchase","store"],shuffle:["music"],"skip-back":["music"],"skip-forward":["music"],slack:["logo"],slash:["ban","no"],sliders:["settings","controls"],smartphone:["cellphone","device"],smile:["emoji","face","happy","good","emotion"],speaker:["audio","music"],star:["bookmark","favorite","like"],"stop-circle":["media","music"],sun:["brightness","weather","light"],sunrise:["weather","time","morning","day"],sunset:["weather","time","evening","night"],tablet:["device"],tag:["label"],target:["logo","bullseye"],terminal:["code","command line","prompt"],thermometer:["temperature","celsius","fahrenheit","weather"],"thumbs-down":["dislike","bad","emotion"],"thumbs-up":["like","good","emotion"],"toggle-left":["on","off","switch"],"toggle-right":["on","off","switch"],tool:["settings","spanner"],trash:["garbage","delete","remove","bin"],"trash-2":["garbage","delete","remove","bin"],triangle:["delta"],truck:["delivery","van","shipping","transport","lorry"],tv:["television","stream"],twitch:["logo"],twitter:["logo","social"],type:["text"],umbrella:["rain","weather"],unlock:["security"],"user-check":["followed","subscribed"],"user-minus":["delete","remove","unfollow","unsubscribe"],"user-plus":["new","add","create","follow","subscribe"],"user-x":["delete","remove","unfollow","unsubscribe","unavailable"],user:["person","account"],users:["group"],"video-off":["camera","movie","film"],video:["camera","movie","film"],voicemail:["phone"],volume:["music","sound","mute"],"volume-1":["music","sound"],"volume-2":["music","sound"],"volume-x":["music","sound","mute"],watch:["clock","time"],"wifi-off":["disabled"],wifi:["connection","signal","wireless"],wind:["weather","air"],"x-circle":["cancel","close","delete","remove","times","clear"],"x-octagon":["delete","stop","alert","warning","times","clear"],"x-square":["cancel","close","delete","remove","times","clear"],x:["cancel","close","delete","remove","times","clear"],youtube:["logo","video","play"],"zap-off":["flash","camera","lightning"],zap:["flash","camera","lightning"],"zoom-in":["magnifying glass"],"zoom-out":["magnifying glass"]}},"./src/to-svg.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icons.js"),i=a(r);function a(o){return o&&o.__esModule?o:{default:o}}function s(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead."),!o)throw new Error("The required `key` (icon name) parameter is missing.");if(!i.default[o])throw new Error("No icon matching '"+o+"'. See the complete list of icons at https://feathericons.com");return i.default[o].toSvg(l)}e.default=s},0:function(t,e,n){n("./node_modules/core-js/es/array/from.js"),t.exports=n("./src/index.js")}})})});var dj={};Ck(dj,{default:()=>tu});module.exports=Fk(dj);v();v();var Va=Ve(mm(),1),Cf=Ve(Em(),1),t1=Ve(Am(),1),Uo=Ve(h0(),1),Oo=Ve(g0(),1),n1=Ve(k0(),1),cn=Ve(T0(),1),r1=Ve(I0(),1),ge=class t extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let n=new t(e.message);return n.code=e.code,n.data=e.data,n.caller=e.caller,n.stack=e.stack,n}get isIsomorphicGitError(){return!0}},Wa=class t extends ge{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=t.code,this.data={filepaths:e}}};Wa.code="UnmergedPathsError";var ce=class t extends ge{constructor(e){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};ce.code="InternalError";var _i=class t extends ge{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};_i.code="UnsafeFilepathError";var Jt=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let n=this.buffer.slice(this._start,this._start+e);return this._start+=e,n}toString(e,n){let r=this.buffer.toString(e,this._start,this._start+n);return this._start+=n,r}write(e,n,r){let i=this.buffer.write(e,this._start,n,r);return this._start+=n,i}copy(e,n,r){let i=e.copy(this.buffer,this._start,n,r);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let n=this.buffer.writeUInt8(e,this._start);return this._start+=1,n}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let n=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,n}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let n=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,n}};function zo(t,e){return-(te)}function i1(t,e){return zo(t.path,e.path)}function a1(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let n=t&511;return n&73?n=493:n=420,e!==8&&(n=0),(e<<12)+n}var En=2**32;function P0(t,e,n,r){if(t!==void 0&&e!==void 0)return[t,e];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3),a=(n-i*1e3)*1e6;return[i,a]}function Si(t){let[e,n]=P0(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[r,i]=P0(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%En,ctimeNanoseconds:n%En,mtimeSeconds:r%En,mtimeNanoseconds:i%En,dev:t.dev%En,ino:t.ino%En,mode:a1(t.mode%En),uid:t.uid%En,gid:t.gid%En,size:t.size>-1?t.size%En:0}}function OT(t){let e="";for(let n of new Uint8Array(t))n<16&&(e+="0"),e+=n.toString(16);return e}var sf=null;async function $n(t){return sf===null&&(sf=await PT()),sf?s1(t):IT(t)}function IT(t){return new Cf.default().update(t).digest("hex")}async function s1(t){let e=await crypto.subtle.digest("SHA-1",t);return OT(e)}async function PT(){try{if(await s1(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch(t){}return!1}function RT(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function LT(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var gf=class t{constructor(e,n){this._dirty=!1,this._unmergedPaths=n||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let n=this._entries.get(e.path);n||(this._entries.set(e.path,e),n=e),n.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new ce("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ce("Index file is empty (.git/index)");let n=new t,r=new Jt(e),i=r.toString("utf8",4);if(i!=="DIRC")throw new ce(`Invalid dircache magic file number: ${i}`);let a=await $n(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new ce(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=r.readUInt32BE();if(o!==2)throw new ce(`Unsupported dircache version: ${o}`);let l=r.readUInt32BE(),c=0;for(;!r.eof()&&ce.stages.length>1?e.stages.filter(n=>n):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:n,oid:r,stage:i=0}){n||(n={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),n=Si(n);let a=Buffer.from(e),s={ctimeSeconds:n.ctimeSeconds,ctimeNanoseconds:n.ctimeNanoseconds,mtimeSeconds:n.mtimeSeconds,mtimeNanoseconds:n.mtimeNanoseconds,dev:n.dev,ino:n.ino,mode:n.mode||33188,uid:n.uid,gid:n.gid,size:n.size,path:e,oid:r,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let n of this._entries.keys())n.startsWith(e+"/")&&this._entries.delete(n);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(` +`)}static async _entryToBuffer(e){let n=Buffer.from(e.path),r=Math.ceil((62+n.length+1)/8)*8,i=Buffer.alloc(r),a=new Jt(i),s=Si(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(LT(e)),a.write(e.path,n.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),n=new Jt(e);n.write("DIRC",4,"utf8"),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let r=[];for(let o of this.entries)if(r.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&r.push(t._entryToBuffer(l));r=await Promise.all(r);let i=Buffer.concat(r),a=Buffer.concat([e,i]),s=await $n(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Io(t,e,n=!0,r=!0){let i=Si(t),a=Si(e);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}var of=null,bi=Symbol("IndexCache");function jT(){return{map:new Map,stats:new Map}}async function DT(t,e,n){let r=await t.lstat(e),i=await t.read(e),a=await gf.from(i);n.map.set(e,a),n.stats.set(e,r)}async function BT(t,e,n){let r=n.stats.get(e);if(r===void 0)return!0;let i=await t.lstat(e);return r===null||i===null?!1:Io(r,i)}var it=class{static async acquire({fs:e,gitdir:n,cache:r,allowUnmerged:i=!0},a){r[bi]||(r[bi]=jT());let s=`${n}/index`;of===null&&(of=new Va.default({maxPending:1/0}));let o,l=[];return await of.acquire(s,async()=>{await BT(e,s,r[bi])&&await DT(e,s,r[bi]);let c=r[bi].map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new Wa(l);if(o=await a(c),c._dirty){let u=await c.toObject();await e.write(s,u),r[bi].stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function Po(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function Ei(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function o1(t){let e=new Map,n=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:Po(i),metadata:{},children:[]};e.set(i,a),a.parent=n(Ei(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},r=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:Po(i),metadata:a,parent:n(Ei(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};n(".");for(let i of t)r(i.path,i);return e}function NT(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new ce(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var yf=class{constructor({fs:e,gitdir:n,cache:r}){this.treePromise=it.acquire({fs:e,gitdir:n,cache:r},async function(a){return o1(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let n=e._fullpath,i=(await this.treePromise).get(n);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${n}'`);let a=i.children.map(s=>s.fullpath);return a.sort(zo),a}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let r=(await this.treePromise).get(e._fullpath);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.type==="tree"?{}:Si(r.metadata);e._type=r.type==="tree"?"tree":NT(i.mode),e._mode=i.mode,r.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let r=(await this.treePromise).get(e._fullpath);e._oid=r.metadata.oid}return e._oid}},Go=Symbol("GitWalkSymbol");function Vo(){let t=Object.create(null);return Object.defineProperty(t,Go,{value:function({fs:e,gitdir:n,cache:r}){return new yf({fs:e,gitdir:n,cache:r})}}),Object.freeze(t),t}var Me=class t extends ge{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Me.code="NotFoundError";var kt=class t extends ge{constructor(e,n,r,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=t.code,this.data={oid:e,actual:n,expected:r,filepath:i}}};kt.code="ObjectTypeError";var or=class t extends ge{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};or.code="InvalidOidError";var qa=class t extends ge{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following: +[remote "${e}"] + fetch = +refs/heads/*:refs/remotes/origin/* +`),this.code=this.name=t.code,this.data={remote:e}}};qa.code="NoRefspecError";var Ro=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let n=null;this.parsedConfig=e.trim().split(` +`).map(r=>{if(/^\s*#/.test(r))return{line:r,comment:!0};let i=r.indexOf(" ");if(r.startsWith("^")){let a=r.slice(1);return this.refs.set(n+"^{}",a),{line:r,ref:n,peeled:a}}else{let a=r.slice(0,i);return n=r.slice(i+1),this.refs.set(n,a),{line:r,ref:n,oid:a}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(n=>n.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` +`)+` +`}},Lo=class t{constructor({remotePath:e,localPath:n,force:r,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:n,force:r,matchPrefix:i})}static from(e){let[n,r,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=n==="+",l=i==="*";if(l!==(s==="*"))throw new ce("Invalid refspec");return new t({remotePath:r,localPath:a,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},vf=class t{constructor(e=[]){this.rules=e}static from(e){let n=[];for(let r of e)n.push(Lo.from(r));return new t(n)}add(e){let n=Lo.from(e);this.rules.push(n)}translate(e){let n=[];for(let r of this.rules)for(let i of e){let a=r.translate(i);a&&n.push([i,a])}return n}translateOne(e){let n=null;for(let r of this.rules){let i=r.translate(e);i&&(n=i)}return n}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function $T(t,e){let n=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),i=-(nr);return i===0?t.endsWith("^{}")?1:-1:i}var R0=new Map;function L0(t){let e=R0.get(t);return e||(e=HT(t),R0.set(t,e)),e}function HT(t){return t=t.split("/./").join("/").replace(/\/{2,}/g,"/"),t==="/."?"/":t==="./"||(t.startsWith("./")&&(t=t.slice(2)),t.endsWith("/.")&&(t=t.slice(0,-2)),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t==="")?".":t}function B(...t){return L0(t.map(L0).join("/"))}var UT=t=>{t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},Ga=t=>{if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},j0={core:{filemode:Ga,bare:Ga,logallrefupdates:Ga,symlinks:Ga,ignorecase:Ga,bigFileThreshold:UT}},zT=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,GT=/^[A-Za-z0-9-.]+$/,VT=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,WT=/^[A-Za-z][A-Za-z-]*$/,qT=/^(.*?)( *[#;].*)$/,XT=t=>{let e=zT.exec(t);if(e!=null){let[n,r]=e.slice(1);return[n,r]}return null},YT=t=>{let e=VT.exec(t);if(e!=null){let[n,r="true"]=e.slice(1),i=ZT(r),a=KT(i);return[n,a]}return null},ZT=t=>{let e=qT.exec(t);if(e==null)return t;let[n,r]=e.slice(1);return D0(n)&&D0(r)?`${n}${r}`:n},D0=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,KT=t=>t.split("").reduce((e,n,r,i)=>{let a=n==='"'&&i[r-1]!=="\\",s=n==="\\"&&i[r+1]==='"';return a||s?e:e+n},""),B0=t=>t!=null?t.toLowerCase():null,wf=(t,e,n)=>[B0(t),e,B0(n)].filter(r=>r!=null).join("."),N0=t=>{let e=t.split("."),n=e.shift(),r=e.pop(),i=e.length?e.join("."):void 0;return{section:n,subsection:i,name:r,path:wf(n,i,r),sectionPath:wf(n,i,null)}},QT=(t,e)=>t.reduce((n,r,i)=>e(r)?i:n,-1),bf=class t{constructor(e){let n=null,r=null;this.parsedConfig=e?e.split(` +`).map(i=>{let a=null,s=null,o=i.trim(),l=XT(o),c=l!=null;if(c)[n,r]=l;else{let f=YT(o);f!=null&&([a,s]=f)}let u=wf(n,r,a);return{line:i,isSection:c,section:n,subsection:r,name:a,value:s,path:u}}):[]}static from(e){return new t(e)}async get(e,n=!1){let r=N0(e).path,i=this.parsedConfig.filter(a=>a.path===r).map(({section:a,name:s,value:o})=>{let l=j0[a]&&j0[a][s];return l?l(o):o});return n?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(n=>n.section===e&&n.isSection).map(n=>n.subsection)}async deleteSection(e,n){this.parsedConfig=this.parsedConfig.filter(r=>!(r.section===e&&r.subsection===n))}async append(e,n){return this.set(e,n,!0)}async set(e,n,r=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l}=N0(e),c=QT(this.parsedConfig,u=>u.path===o);if(n==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let u=this.parsedConfig[c],f=Object.assign({},u,{name:s,value:n,modified:!0});r?this.parsedConfig.splice(c+1,0,f):this.parsedConfig[c]=f}else{let u=this.parsedConfig.findIndex(d=>d.path===l),f={section:i,subsection:a,name:s,value:n,modified:!0,path:o};if(GT.test(i)&&WT.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,f);else{let d={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(d,f)}}}toString(){return this.parsedConfig.map(({line:e,section:n,subsection:r,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:r!=null?`[${n} "${r}"]`:`[${n}]`:e).join(` +`)}},$e=class{static async get({fs:e,gitdir:n}){let r=await e.read(`${n}/config`,{encoding:"utf8"});return bf.from(r)}static async save({fs:e,gitdir:n,config:r}){await e.write(`${n}/config`,r.toString(),{encoding:"utf8"})}},Fo=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],JT=["config","description","index","shallow","commondir"],lf;async function ir(t,e){return lf===void 0&&(lf=new Va.default),lf.acquire(t,e)}var W=class t{static async updateRemoteRefs({fs:e,gitdir:n,remote:r,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let g of i.values())if(!g.match(/[0-9a-f]{40}/))throw new or(g);let u=await $e.get({fs:e,gitdir:n});if(!o){if(o=await u.getall(`remote.${r}.fetch`),o.length===0)throw new qa(r);o.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let f=vf.from(o),d=new Map;if(c){let g=await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:n,refs:g.map(w=>`refs/tags/${w}`)})}if(s){for(let g of i.keys())if(g.startsWith("refs/tags")&&!g.endsWith("^{}")&&!await t.exists({fs:e,gitdir:n,ref:g})){let w=i.get(g);d.set(g,w)}}let h=f.translate([...i.keys()]);for(let[g,w]of h){let b=i.get(g);d.set(w,b)}let p=f.translate([...a.keys()]);for(let[g,w]of p){let b=a.get(g),x=f.translateOne(b);x&&d.set(w,`ref: ${x}`)}let m=[];if(l){for(let g of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:n,filepath:g})).map(b=>`${g}/${b}`);for(let b of w)d.has(b)||m.push(b)}m.length>0&&await t.deleteRefs({fs:e,gitdir:n,refs:m})}for(let[g,w]of d)await ir(g,async()=>e.write(B(n,g),`${w.trim()} +`,"utf8"));return{pruned:m}}static async writeRef({fs:e,gitdir:n,ref:r,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new or(i);await ir(r,async()=>e.write(B(n,r),`${i.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:n,ref:r,value:i}){await ir(r,async()=>e.write(B(n,r),`ref: ${i.trim()} +`,"utf8"))}static async deleteRef({fs:e,gitdir:n,ref:r}){return t.deleteRefs({fs:e,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:n,refs:r}){await Promise.all(r.map(o=>e.rm(B(n,o))));let i=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"})),a=Ro.from(i),s=a.refs.size;for(let o of r)a.refs.has(o)&&a.delete(o);a.refs.sizee.write(`${n}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith("ref: "))return r=r.slice(5),t.resolve({fs:e,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let a=await t.packedRefs({fs:e,gitdir:n}),s=Fo(r).filter(o=>!JT.includes(o));for(let o of s){let l=await ir(o,async()=>await e.read(`${n}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:n,ref:l.trim(),depth:i})}throw new Me(r)}static async exists({fs:e,gitdir:n,ref:r}){try{return await t.expand({fs:e,gitdir:n,ref:r}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await t.packedRefs({fs:e,gitdir:n}),a=Fo(r);for(let s of a)if(await ir(s,async()=>e.exists(`${n}/${s}`))||i.has(s))return s;throw new Me(r)}static async expandAgainstMap({ref:e,map:n}){let r=Fo(e);for(let i of r)if(await n.has(i))return i;throw new Me(e)}static resolveAgainstMap({ref:e,fullref:n=e,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:n,depth:r,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:n,oid:e};let a=Fo(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:r,map:i})}throw new Me(e)}static async packedRefs({fs:e,gitdir:n}){let r=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"}));return Ro.from(r).refs}static async listRefs({fs:e,gitdir:n,filepath:r}){let i=t.packedRefs({fs:e,gitdir:n}),a=null;try{a=await e.readdirDeep(`${n}/${r}`),a=a.map(s=>s.replace(`${n}/${r}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(r)&&(s=s.replace(r+"/",""),a.includes(s)||a.push(s));return a.sort($T),a}static async listBranches({fs:e,gitdir:n,remote:r}){return r?t.listRefs({fs:e,gitdir:n,filepath:`refs/remotes/${r}`}):t.listRefs({fs:e,gitdir:n,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:n}){return(await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function e5(t,e){return zo($0(t),$0(e))}function $0(t){return t.mode==="040000"?t.path+"/":t.path}function l1(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new ce(`Unexpected GitTree entry mode: ${t}`)}function t5(t){let e=[],n=0;for(;n`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(e5),Buffer.concat(e.map(n=>{let r=Buffer.from(n.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(n.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(n.oid,"hex");return Buffer.concat([r,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},lr=class{static wrap({type:e,object:n}){return Buffer.concat([Buffer.from(`${e} ${n.byteLength.toString()}\0`),Buffer.from(n)])}static unwrap(e){let n=e.indexOf(32),r=e.indexOf(0),i=e.slice(0,n).toString("utf8"),a=e.slice(n+1,r).toString("utf8"),s=e.length-(r+1);if(parseInt(a)!==s)throw new ce(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(r+1))}}};async function i5({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await t.read(`${e}/${r}`);return i?{object:i,format:"deflated",source:r}:null}function a5(t,e){let n=new Jt(t),r=H0(n);if(r!==e.byteLength)throw new ce(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);let i=H0(n),a,s=z0(n,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Jt(a);for(o.copy(s);!n.eof();)o.copy(z0(n,e));let l=o.tell();if(i!==l)throw new ce(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function H0(t){let e=0,n=0,r=null;do r=t.readUInt8(),e|=(r&127)<>=1,i+=8;return r}function z0(t,e){let n=t.readUInt8(),r=128,i=15,a=112;if(n&r){let s=U0(t,n&i,4),o=U0(t,(n&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(n)}function s5(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function c1(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:s5(t)}var jo=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=c1(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:n}=await this.stream.next();return e&&(this._ended=!0,!n)?Buffer.alloc(0):(n&&(n=Buffer.from(n)),n)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let n=[this.buffer];for(;this.cursor+e>o5(n);){let r=await this._next();if(this._ended)break;n.push(r)}this.buffer=Buffer.concat(n)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function o5(t){return t.reduce((e,n)=>e+n.length,0)}async function l5(t,e){let n=new jo(t),r=await n.read(4);if(r=r.toString("utf8"),r!=="PACK")throw new ce(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new ce(`Invalid packfile version: ${i}`);let a=await n.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!n.eof()&&a--;){let s=n.tell(),{type:o,length:l,ofs:c,reference:u}=await c5(n),f=new Uo.default.Inflate;for(;!f.result;){let d=await n.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new ce(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new ce("Inflated object size is different from that stated in packfile.");await n.undo(),await n.read(d.length-f.strm.avail_in);let h=n.tell();await e({data:f.result,type:o,num:a,offset:s,end:h,reference:u,ofs:c})}}}}async function c5(t){let e=await t.byte(),n=e>>4&7,r=e&15;if(e&128){let s=4;do e=await t.byte(),r|=(e&127)<i+1<<7|a,-1)}function h5(t,e){let n=e,r=4,i=null;do i=t.readUInt8(),n|=(i&127)<2048*1024*1024)throw new ce("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");r.seek(r.tell()+4*255);let s=r.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=E);let _=Math.floor((u-E)*100/u);_!==f&&r&&await r({phase:"Receiving objects",loaded:u-E,total:u}),f=_,w=i[w],["commit","tree","blob","tag"].includes(w)?a[x]={type:w,offset:x}:w==="ofs-delta"?a[x]={type:w,offset:x}:w==="ref-delta"&&(a[x]={type:w,offset:x})});let d=Object.keys(a).map(Number);for(let[g,w]of d.entries()){let b=g+1===d.length?e.byteLength-20:d[g+1],x=a[w],E=t1.default.buf(e.slice(w,b))>>>0;x.end=b,x.crc=E}let h=new t({pack:Promise.resolve(e),packfileSha:s,crcs:l,hashes:o,offsets:c,getExternalRefDelta:n});f=null;let p=0,m=[0,0,0,0,0,0,0,0,0,0,0,0];for(let g in a){g=Number(g);let w=Math.floor(p*100/u);w!==f&&r&&await r({phase:"Resolving deltas",loaded:p,total:u}),p++,f=w;let b=a[g];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:x,object:E}=await h.readSlice({start:g});m[h.readDepth]+=1;let _=await $n(lr.wrap({type:x,object:E}));b.oid=_,o.push(_),c.set(_,g),l[_]=b.crc}catch(x){continue}}return o.sort(),h}async toBuffer(){let e=[],n=(c,u)=>{e.push(Buffer.from(c,u))};n("ff744f63","hex"),n("00000002","hex");let r=new Jt(Buffer.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=c&&u++;r.writeUInt32BE(u)}e.push(r.buffer);for(let c of this.hashes)n(c,"hex");let i=new Jt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);e.push(i.buffer);let a=new Jt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)a.writeUInt32BE(this.offsets.get(c));e.push(a.buffer),n(this.packfileSha,"hex");let s=Buffer.concat(e),o=await $n(s),l=Buffer.alloc(20);return l.write(o,"hex"),Buffer.concat([s,l])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new ce(`Could not read object ${e} from packfile`)}let n=this.offsets.get(e);return this.readSlice({start:n})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let n={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new ce("Tried to read from a GitPackIndex with no packfile loaded into memory");let r=(await this.pack).slice(e),i=new Jt(r),a=i.readUInt8(),s=a&112,o=n[s];if(o===void 0)throw new ce("Unrecognized type: 0b"+s.toString(2));let l=a&15,c=l;a&128&&(c=h5(i,l));let f=null,d=null;if(o==="ofs_delta"){let p=d5(i),m=e-p;({object:f,type:o}=await this.readSlice({start:m}))}if(o==="ref_delta"){let p=i.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:p}))}let h=r.slice(i.tell());if(d=Buffer.from(await u1(h)),d.byteLength!==c)throw new ce(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return f&&(d=Buffer.from(a5(d,f))),this.readDepth>3&&(this.offsetCache[e]={type:o,object:d}),{type:o,format:"content",object:d}}},Mo=Symbol("PackfileCache");async function p5({fs:t,filename:e,getExternalRefDelta:n,emitter:r,emitterPrefix:i}){let a=await t.read(e);return Xa.fromIdx({idx:a,getExternalRefDelta:n})}function Ff({fs:t,cache:e,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}){e[Mo]||(e[Mo]=new Map);let s=e[Mo].get(n);return s||(s=p5({fs:t,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}),e[Mo].set(n,s)),s}async function m5({fs:t,cache:e,gitdir:n,oid:r,format:i="content",getExternalRefDelta:a}){let s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await Ff({fs:t,cache:e,filename:l,getExternalRefDelta:a});if(c.error)throw new ce(c.error);if(c.offsets.has(r)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=t.read(f)}let u=await c.read({oid:r,getExternalRefDelta:a});return u.format="content",u.source=`objects/pack/${o.replace(/idx$/,"pack")}`,u}}return null}async function He({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=u=>He({fs:t,cache:e,gitdir:n,oid:u}),s;if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await i5({fs:t,gitdir:n,oid:r})),!s){if(s=await m5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a}),!s)throw new Me(r);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await u1(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await $n(s.object);if(o!==r)throw new ce(`SHA check failed! Expected ${r}, computed ${o}`);let{object:l,type:c}=lr.unwrap(s.object);if(s.type=c,s.object=l,s.format="content",i==="content")return s;throw new ce(`invalid requested format "${i}"`)}var un=class t extends ge{constructor(e,n,r=!0){super(`Failed to create ${e} at ${n} because it already exists.${r?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:n,canForce:r}}};un.code="AlreadyExistsError";var Ya=class t extends ge{constructor(e,n,r){super(`Found multiple ${e} matching "${n}" (${r.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:n,matches:r}}};Ya.code="AmbiguousError";var Za=class t extends ge{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};Za.code="CheckoutConflictError";var Ka=class t extends ge{constructor(e,n){super(`Failed to checkout "${e}" because commit ${n} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=t.code,this.data={ref:e,oid:n}}};Ka.code="CommitNotFetchedError";var Qa=class t extends ge{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};Qa.code="EmptyServerResponseError";var Ja=class t extends ge{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Ja.code="FastForwardError";var es=class t extends ge{constructor(e,n){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:n}}};es.code="GitPushError";var ki=class t extends ge{constructor(e,n,r){super(`HTTP Error: ${e} ${n}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:n,response:r}}};ki.code="HttpError";var cr=class t extends ge{constructor(e){let n="invalid filepath";e==="leading-slash"||e==="trailing-slash"?n='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(n='"filepath" should not be a directory.'),super(n),this.code=this.name=t.code,this.data={reason:e}}};cr.code="InvalidFilepathError";var Hn=class t extends ge{constructor(e,n){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:n}}};Hn.code="InvalidRefNameError";var ts=class t extends ge{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};ts.code="MaxDepthError";var Ai=class t extends ge{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Ai.code="MergeNotSupportedError";var Ti=class t extends ge{constructor(e,n,r,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:n,deleteByUs:r,deleteByTheirs:i}}};Ti.code="MergeConflictError";var At=class t extends ge{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=t.code,this.data={role:e}}};At.code="MissingNameError";var Ot=class t extends ge{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Ot.code="MissingParameterError";var ns=class t extends ge{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=t.code,this.data={errors:e},this.errors=e}};ns.code="MultipleGitError";var $r=class t extends ge{constructor(e,n){super(`Expected "${e}" but received "${n}".`),this.code=this.name=t.code,this.data={expected:e,actual:n}}};$r.code="ParseError";var Ci=class t extends ge{constructor(e){let n="";e==="not-fast-forward"?n=" because it was not a simple fast-forward":e==="tag-exists"&&(n=" because tag already exists"),super(`Push rejected${n}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Ci.code="PushRejectedError";var ar=class t extends ge{constructor(e,n){super(`Remote does not support the "${e}" so the "${n}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:n}}};ar.code="RemoteCapabilityError";var rs=class t extends ge{constructor(e,n){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=t.code,this.data={preview:e,response:n}}};rs.code="SmartHttpError";var is=class t extends ge{constructor(e,n,r){super(`Git remote "${e}" uses an unrecognized transport protocol: "${n}"`),this.code=this.name=t.code,this.data={url:e,transport:n,suggestion:r}}};is.code="UnknownTransportError";var as=class t extends ge{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};as.code="UrlParseError";var Fi=class t extends ge{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Fi.code="UserCanceledError";var ss=class t extends ge{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=t.code,this.data={filepath:e}}};ss.code="IndexResetError";var os=class t extends ge{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=t.code,this.data={ref:e}}};os.code="NoCommitError";var cs=Object.freeze({__proto__:null,AlreadyExistsError:un,AmbiguousError:Ya,CheckoutConflictError:Za,CommitNotFetchedError:Ka,EmptyServerResponseError:Qa,FastForwardError:Ja,GitPushError:es,HttpError:ki,InternalError:ce,InvalidFilepathError:cr,InvalidOidError:or,InvalidRefNameError:Hn,MaxDepthError:ts,MergeNotSupportedError:Ai,MergeConflictError:Ti,MissingNameError:At,MissingParameterError:Ot,MultipleGitError:ns,NoRefspecError:qa,NotFoundError:Me,ObjectTypeError:kt,ParseError:$r,PushRejectedError:Ci,RemoteCapabilityError:ar,SmartHttpError:rs,UnknownTransportError:is,UnsafeFilepathError:_i,UrlParseError:as,UserCanceledError:Fi,UnmergedPathsError:Wa,IndexResetError:ss,NoCommitError:os});function xf({name:t,email:e,timestamp:n,timezoneOffset:r}){return r=g5(r),`${t} <${e}> ${n} ${r}`}function g5(t){let e=y5(v5(t));t=Math.abs(t);let n=Math.floor(t/60);t-=n*60;let r=String(n),i=String(t);return r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),(e===-1?"-":"+")+r+i}function y5(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function v5(t){return t===0?t:-t}function Nn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function Do(t){let[,e,n,r,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:n,timestamp:Number(r),timezoneOffset:w5(i)}}function w5(t){let[,e,n,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=(e==="+"?1:-1)*(Number(n)*60+Number(r)),b5(r)}function b5(t){return t===0?t:-t}var Nt=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ce("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object} +type ${e.type} +tag ${e.tag} +tagger ${xf(e.tagger)} + +${e.message} +${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(` + +`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(` + +`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(` +`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` +`+i.slice(1):n.push(i);let r={};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.tagger&&(r.tagger=Do(r.tagger)),r.committer&&(r.committer=Do(r.committer)),r}withoutSignature(){let e=Nn(this._tag);return e.indexOf(` +-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(` +-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(` +-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Nn(e)}payload(){return this.withoutSignature()+` +`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,n,r){let i=e.payload(),{signature:a}=await n({payload:i,secretKey:r});a=Nn(a);let s=i+a;return t.from(s)}};function uf(t){return t.trim().split(` +`).map(e=>" "+e).join(` +`)+` +`}function x5(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var Pt=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ce("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:n}){let r=t.justHeaders(e),i=t.justMessage(e),a=Nn(r+` +gpgsig`+uf(n)+` +`+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Nn(e.slice(e.indexOf(` + +`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` + +`))}parseHeaders(){let e=t.justHeaders(this._commit).split(` +`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` +`+i.slice(1):n.push(i);let r={parent:[]};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.author&&(r.author=Do(r.author)),r.committer&&(r.committer=Do(r.committer)),r}static renderHeaders(e){let n="";if(e.tree?n+=`tree ${e.tree} +`:n+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 +`,e.parent){if(e.parent.length===void 0)throw new ce("commit 'parent' property should be an array");for(let a of e.parent)n+=`parent ${a} +`}let r=e.author;n+=`author ${xf(r)} +`;let i=e.committer||e.author;return n+=`committer ${xf(i)} +`,e.gpgsig&&(n+="gpgsig"+uf(e.gpgsig)),n}static render(e){return t.renderHeaders(e)+` +`+Nn(e.message)}render(){return this._commit}withoutSignature(){let e=Nn(this._commit);if(e.indexOf(` +gpgsig`)===-1)return e;let n=e.slice(0,e.indexOf(` +gpgsig`)),r=e.slice(e.indexOf(`-----END PGP SIGNATURE----- +`)+28);return Nn(n+` +`+r)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return x5(e)}static async sign(e,n,r){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await n({payload:i,secretKey:r});s=Nn(s);let l=t.justHeaders(e._commit)+` +gpgsig`+uf(s)+` +`+a;return t.from(l)}};async function Mi({fs:t,cache:e,gitdir:n,oid:r}){if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:It.from([]),oid:r};let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Nt.from(a).parse().object,Mi({fs:t,cache:e,gitdir:n,oid:r});if(i==="commit")return r=Pt.from(a).parse().tree,Mi({fs:t,cache:e,gitdir:n,oid:r});if(i!=="tree")throw new kt(r,i,"tree");return{tree:It.from(a),oid:r}}var _f=class{constructor({fs:e,gitdir:n,ref:r,cache:i}){this.fs=e,this.cache=i,this.gitdir=n,this.mapPromise=(async()=>{let s=new Map,o;try{o=await W.resolve({fs:e,gitdir:n,ref:r})}catch(c){c instanceof Me&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Mi({fs:e,cache:this.cache,gitdir:n,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),s})();let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(n);if(!o)throw new Error(`No obj for ${n}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await He({fs:r,cache:i,gitdir:a,oid:l});if(c!==o.type)throw new kt(l,c,o.type);let f=It.from(u);for(let d of f)s.set(B(n,d.path),d);return f.entries().map(d=>B(n,d.path))}async type(e){if(e._type===!1){let n=await this.mapPromise,{type:r}=n.get(e._fullpath);e._type=r}return e._type}async mode(e){if(e._mode===!1){let n=await this.mapPromise,{mode:r}=n.get(e._fullpath);e._mode=a1(parseInt(r,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let n=await this.mapPromise,{fs:r,cache:i,gitdir:a}=this,o=n.get(e._fullpath).oid,{type:l,object:c}=await He({fs:r,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let r=(await this.mapPromise).get(e._fullpath);e._oid=r.oid}return e._oid}};function sr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Go,{value:function({fs:n,gitdir:r,cache:i}){return new _f({fs:n,gitdir:r,ref:t,cache:i})}}),Object.freeze(e),e}var Sf=class{constructor({fs:e,dir:n,gitdir:r,cache:i}){this.fs=e,this.cache=i,this.dir=n,this.gitdir=r;let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,dir:i}=this,a=await r.readdir(B(i,n));return a===null?null:a.map(s=>B(n,s))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:n,dir:r}=this,i=await n.lstat(`${r}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=Si(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:n,dir:r,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await $e.get({fs:n,gitdir:i})).get("core.autocrlf"),o=await n.read(`${r}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let{fs:n,gitdir:r,cache:i}=this,a;await it.acquire({fs:n,gitdir:r,cache:i},async function(s){let o=s.entriesMap.get(e._fullpath),l=await e.stat(),u=await(await $e.get({fs:n,gitdir:r})).get("core.filemode"),f=typeof process!="undefined"?process.platform!=="win32":!0;!o||Io(l,o,u,f)?await e.content()===void 0?a=void 0:(a=await $n(lr.wrap({type:"blob",object:await e.content()})),o&&a===o.oid&&(!u||l.mode===o.mode)&&Io(l,o,u,f)&&s.insert({filepath:e._fullpath,stats:l,oid:a})):a=o.oid}),e._oid=a}return e._oid}};function Wo(){let t=Object.create(null);return Object.defineProperty(t,Go,{value:function({fs:e,dir:n,gitdir:r,cache:i}){return new Sf({fs:e,dir:n,gitdir:r,cache:i})}}),Object.freeze(t),t}function _5(t,e){let n=e-t;return Array.from({length:n},(r,i)=>t+i)}var f1=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,n)=>e.concat(n),[]):t=>t.flat(),Ef=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:s=async(l,c)=>{let u=f1(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(h=>h[Go]({fs:t,dir:n,gitdir:r,cache:e})),c=new Array(l.length).fill("."),u=_5(0,l.length),f=async h=>{u.map(g=>{h[g]=h[g]&&new l[g].ConstructEntry(h[g])});let m=(await Promise.all(u.map(g=>h[g]?l[g].readdir(h[g]):[]))).map(g=>g===null?[]:g).map(g=>g[Symbol.iterator]());return{entries:h,children:S5(m)}},d=async h=>{let{entries:p,children:m}=await f(h),g=p.find(b=>b&&b._fullpath)._fullpath,w=await a(g,p);if(w!==null){let b=await o(d,m);return b=b.filter(x=>x!==void 0),s(w,b)}};return d(c)}async function kf(t,e){let n=await t.readdir(e);n==null?await t.rm(e):n.length?await Promise.all(n.map(r=>{let i=B(e,r);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?kf(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function E5(t){return k5(t)&&G0(t.then)&&G0(t.catch)}function k5(t){return t&&typeof t=="object"}function G0(t){return typeof t=="function"}function V0(t){return E5((n=>{try{return n.readFile().catch(r=>r)}catch(r){return r}})(t))}var W0=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function q0(t,e){if(V0(e))for(let n of W0)t[`_${n}`]=e[n].bind(e);else for(let n of W0)t[`_${n}`]=(0,Oo.default)(e[n].bind(e));V0(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=kf.bind(null,t):e.rm?t._rm=(0,Oo.default)(e.rm.bind(e)):e.rmdir.length>2?t._rm=(0,Oo.default)(e.rmdir.bind(e)):t._rm=kf.bind(null,t)}var ee=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let n=Object.getOwnPropertyDescriptor(e,"promises");n&&n.enumerable?q0(this,e.promises):q0(this,e),this._original_unwrapped_fs=e}async exists(e,n={}){try{return await this._stat(e),!0}catch(r){if(r.code==="ENOENT"||r.code==="ENOTDIR")return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',r),r}}async read(e,n={}){try{let r=await this._readFile(e,n);if(n.autocrlf==="true")try{r=new TextDecoder("utf8",{fatal:!0}).decode(r),r=r.replace(/\r\n/g,` +`),r=new TextEncoder().encode(r)}catch(i){}return typeof r!="string"&&(r=Buffer.from(r)),r}catch(r){return null}}async write(e,n,r={}){try{await this._writeFile(e,n,r);return}catch(i){await this.mkdir(Ei(e)),await this._writeFile(e,n,r)}}async mkdir(e,n=!1){try{await this._mkdir(e);return}catch(r){if(r===null||r.code==="EEXIST")return;if(n)throw r;if(r.code==="ENOENT"){let i=Ei(e);if(i==="."||i==="/"||i===e)throw r;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(n){if(n.code!=="ENOENT")throw n}}async rmdir(e,n){try{n&&n.recursive?await this._rm(e,n):await this._rmdir(e)}catch(r){if(r.code!=="ENOENT")throw r}}async readdir(e){try{let n=await this._readdir(e);return n.sort(zo),n}catch(n){return n.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let n=await this._readdir(e);return(await Promise.all(n.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(n){if(n.code==="ENOENT")return null;throw n}}async readlink(e,n={encoding:"buffer"}){try{let r=await this._readlink(e,n);return Buffer.isBuffer(r)?r:Buffer.from(r)}catch(r){if(r.code==="ENOENT")return null;throw r}}async writelink(e,n){return this._symlink(n.toString("utf8"),e)}};function F(t,e){if(e===void 0)throw new Ot(t)}async function Bo(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function A5({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r="HEAD",cache:i={}}){try{F("fs",t),F("dir",e),F("gitdir",n);let a=new ee(t),s=[sr({ref:r}),Wo(),Vo()],o=[];await it.acquire({fs:a,gitdir:n,cache:i},async function(c){o=c.unmergedPaths});let l=await Oi({fs:a,cache:i,dir:e,gitdir:n,trees:s,map:async function(c,[u,f,d]){let h=!await Bo(f,d),p=o.includes(c),m=!await Bo(d,u);if(h||p)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(m)return!1;throw new ss(c)}});await it.acquire({fs:a,gitdir:n,cache:i},async function(c){for(let u of l)if(u!==!1){if(!u){await a.rmdir(`${e}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${e}/${u.path}`,f,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var Ii=class{static async isIgnored({fs:e,dir:n,gitdir:r=B(n,".git"),filepath:i}){if(Po(i)===".git")return!0;if(i===".")return!1;let a="",s=B(r,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:B(n,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;uAf({dir:e,gitdir:n,fs:o,filepath:r,index:l,force:a,parallel:s}))}catch(o){throw o.caller="git.add",o}}async function Af({dir:t,gitdir:e,fs:n,filepath:r,index:i,force:a,parallel:s}){r=Array.isArray(r)?r:[r];let o=r.map(async f=>{if(!a&&await Ii.isIgnored({fs:n,dir:t,gitdir:e,filepath:f}))return;let d=await n.lstat(B(t,f));if(!d)throw new Me(f);if(d.isDirectory()){let h=await n.readdir(B(t,f));if(s){let p=h.map(m=>Af({dir:t,gitdir:e,fs:n,filepath:[B(f,m)],index:i,force:a,parallel:s}));await Promise.all(p)}else for(let p of h)await Af({dir:t,gitdir:e,fs:n,filepath:[B(f,p)],index:i,force:a,parallel:s})}else{let p=await(await $e.get({fs:n,gitdir:e})).get("core.autocrlf"),m=d.isSymbolicLink()?await n.readlink(B(t,f)).then(M5):await n.read(B(t,f),{autocrlf:p});if(m===null)throw new Me(f);let g=await $t({fs:n,gitdir:e,type:"blob",object:m});i.insert({filepath:f,stats:d,oid:g})}}),l=await Promise.allSettled(o),c=l.filter(f=>f.status==="rejected").map(f=>f.reason);if(c.length>1)throw new ns(c);if(c.length===1)throw c[0];return l.filter(f=>f.status==="fulfilled"&&f.value).map(f=>f.value)}async function ls({fs:t,gitdir:e,path:n}){return(await $e.get({fs:t,gitdir:e})).get(n)}function h1(t,...e){for(let n of e)if(n)for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(t[r]=i)}return t}async function Hr({fs:t,gitdir:e,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),a={name:await ls({fs:t,gitdir:e,path:"user.name"}),email:await ls({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=h1({},a,r?r.author:void 0,n);if(s.name!==void 0)return s}async function Pi({fs:t,gitdir:e,author:n,committer:r,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await ls({fs:t,gitdir:e,path:"user.name"}),email:await ls({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=h1({},s,i?i.committer:void 0,n,r);if(o.name!==void 0)return o}async function p1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Nt.from(a).parse().object,p1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="commit")throw new kt(r,i,"commit");return{commit:Pt.from(a),oid:r}}async function No({fs:t,cache:e,gitdir:n,oid:r}){let{commit:i,oid:a}=await p1({fs:t,cache:e,gitdir:n,oid:r});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function qo({fs:t,cache:e,onSign:n,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h}){let p=!1;f||(f=await W.resolve({fs:t,gitdir:r,ref:"HEAD",depth:2}));let m,g;try{m=await W.resolve({fs:t,gitdir:r,ref:f}),g=await No({fs:t,gitdir:r,oid:m,cache:{}})}catch(x){p=!0}if(l&&p)throw new os(f);let w=l?await Hr({fs:t,gitdir:r,author:a,commit:g.commit}):await Hr({fs:t,gitdir:r,author:a});if(!w)throw new At("author");let b=l?await Pi({fs:t,gitdir:r,author:w,committer:s,commit:g.commit}):await Pi({fs:t,gitdir:r,author:w,committer:s});if(!b)throw new At("committer");return it.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async function(x){let _=o1(x.entries).get(".");if(h||(h=await m1({fs:t,gitdir:r,inode:_,dryRun:c})),d?d=await Promise.all(d.map(S=>W.resolve({fs:t,gitdir:r,ref:S}))):l?d=g.commit.parent:d=m?[m]:[],!i)if(l)i=g.commit.message;else throw new Ot("message");let T=Pt.from({tree:h,parent:d,author:w,committer:b,message:i});o&&(T=await Pt.sign(T,n,o));let y=await $t({fs:t,gitdir:r,type:"commit",object:T.toObject(),dryRun:c});return!u&&!c&&await W.writeRef({fs:t,gitdir:r,ref:f,value:y}),y})}async function m1({fs:t,gitdir:e,inode:n,dryRun:r}){let i=n.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await m1({fs:t,gitdir:e,inode:l,dryRun:r}));let a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),s=It.from(a);return await $t({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:r})}async function us({fs:t,cache:e,gitdir:n,oid:r,filepath:i}){if(i.startsWith("/"))throw new cr("leading-slash");if(i.endsWith("/"))throw new cr("trailing-slash");let a=r,s=await Mi({fs:t,cache:e,gitdir:n,oid:r}),o=s.tree;if(i==="")r=s.oid;else{let l=i.split("/");r=await g1({fs:t,cache:e,gitdir:n,tree:o,pathArray:l,oid:a,filepath:i})}return r}async function g1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let l of r)if(l.path===o){if(i.length===0)return l.oid;{let{type:c,object:u}=await He({fs:t,cache:e,gitdir:n,oid:l.oid});if(c!=="tree")throw new kt(a,c,"tree",s);return r=It.from(u),g1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s})}}throw new Me(`file or directory found at "${a}:${s}"`)}async function ji({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){i!==void 0&&(r=await us({fs:t,cache:e,gitdir:n,oid:r,filepath:i}));let{tree:a,oid:s}=await Mi({fs:t,cache:e,gitdir:n,oid:r});return{oid:s,tree:a.entries()}}async function Mf({fs:t,gitdir:e,tree:n}){let r=It.from(n).toObject();return await $t({fs:t,gitdir:e,type:"tree",object:r,format:"content"})}async function I5({fs:t,cache:e,onSign:n,gitdir:r,ref:i,oid:a,note:s,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await W.resolve({gitdir:r,fs:t,ref:i})}catch(w){if(!(w instanceof Me))throw w}let h=(await ji({fs:t,cache:e,gitdir:r,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(w=>w.path!==a);else for(let w of h)if(w.path===a)throw new un("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let p=await $t({fs:t,gitdir:r,type:"blob",object:s,format:"content"});h.push({mode:"100644",path:a,oid:p,type:"blob"});let m=await Mf({fs:t,gitdir:r,tree:h});return await qo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:m,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:c,signingKey:u})}async function P5({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{F("fs",t),F("gitdir",r),F("oid",a),F("note",s),u&&F("onSign",e);let d=new ee(t),h=await Hr({fs:d,gitdir:r,author:l});if(!h)throw new At("author");let p=await Pi({fs:d,gitdir:r,author:h,committer:c});if(!p)throw new At("committer");return await I5({fs:new ee(d),cache:f,onSign:e,gitdir:r,ref:i,oid:a,note:s,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}async function y1({fs:t,gitdir:e,remote:n,url:r,force:i}){if(n!==cn.default.clean(n))throw new Hn(n,cn.default.clean(n));let a=await $e.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(n)&&r!==await a.get(`remote.${n}.url`))throw new un("remote",n);await a.set(`remote.${n}.url`,r),await a.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await $e.save({fs:t,gitdir:e,config:a})}async function R5({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r,url:i,force:a=!1}){try{return F("fs",t),F("gitdir",n),F("remote",r),F("url",i),await y1({fs:new ee(t),gitdir:n,remote:r,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function L5({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await W.exists({fs:t,gitdir:r,ref:i}))throw new un("tag",i);let f=await W.resolve({fs:t,gitdir:r,ref:l||"HEAD"}),{type:d}=await He({fs:t,cache:e,gitdir:r,oid:f}),h=Nt.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});c&&(h=await Nt.sign(h,n,c));let p=await $t({fs:t,gitdir:r,type:"tag",object:h.toObject()});await W.writeRef({fs:t,gitdir:r,ref:i,value:p})}async function j5({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{F("fs",t),F("gitdir",r),F("ref",i),c&&F("onSign",e);let d=new ee(t),h=await Hr({fs:d,gitdir:r,author:a});if(!h)throw new At("tagger");return await L5({fs:d,cache:f,onSign:e,gitdir:r,ref:i,tagger:h,message:s,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function D5({fs:t,gitdir:e,ref:n,object:r,checkout:i=!1,force:a=!1}){if(n!==cn.default.clean(n))throw new Hn(n,cn.default.clean(n));let s=`refs/heads/${n}`;if(!a&&await W.exists({fs:t,gitdir:e,ref:s}))throw new un("branch",n,!1);let o;try{o=await W.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch(l){}o&&await W.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function B5({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,checkout:a=!1,force:s=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),await D5({fs:new ee(t),gitdir:n,ref:r,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var v1=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Of({fs:t,cache:e,onProgress:n,onPostCheckout:r,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0}){let p;if(r)try{p=await W.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(g){p="0000000000000000000000000000000000000000"}let m;try{m=await W.resolve({fs:t,gitdir:a,ref:o})}catch(g){if(o==="HEAD")throw g;let w=`${s}/${o}`;if(m=await W.resolve({fs:t,gitdir:a,ref:w}),h){let b=await $e.get({fs:t,gitdir:a});await b.set(`branch.${o}.remote`,s),await b.set(`branch.${o}.merge`,`refs/heads/${o}`),await $e.save({fs:t,gitdir:a,config:b})}await W.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:m})}if(!c){let g;try{g=await N5({fs:t,cache:e,onProgress:n,dir:i,gitdir:a,ref:o,force:d,filepaths:l})}catch(_){throw _ instanceof Me&&_.data.what===m?new Ka(o,m):_}let w=g.filter(([_])=>_==="conflict").map(([_,T])=>T);if(w.length>0)throw new Za(w);let b=g.filter(([_])=>_==="error").map(([_,T])=>T);if(b.length>0)throw new ce(b.join(", "));if(f){r&&await r({previousHead:p,newHead:m,type:l!=null&&l.length>0?"file":"branch"});return}let x=0,E=g.length;await it.acquire({fs:t,gitdir:a,cache:e},async function(_){await Promise.all(g.filter(([T])=>T==="delete"||T==="delete-index").map(async function([T,y]){let S=`${i}/${y}`;T==="delete"&&await t.rm(S),_.delete({filepath:y}),n&&await n({phase:"Updating workdir",loaded:++x,total:E})}))}),await it.acquire({fs:t,gitdir:a,cache:e},async function(_){for(let[T,y]of g)if(T==="rmdir"||T==="rmdir-index"){let S=`${i}/${y}`;try{T==="rmdir-index"&&_.delete({filepath:y}),await t.rmdir(S),n&&await n({phase:"Updating workdir",loaded:++x,total:E})}catch(k){if(k.code==="ENOTEMPTY")console.log(`Did not delete ${y} because directory is not empty`);else throw k}}}),await Promise.all(g.filter(([_])=>_==="mkdir"||_==="mkdir-index").map(async function([_,T]){let y=`${i}/${T}`;await t.mkdir(y),n&&await n({phase:"Updating workdir",loaded:++x,total:E})})),await it.acquire({fs:t,gitdir:a,cache:e},async function(_){await Promise.all(g.filter(([T])=>T==="create"||T==="create-index"||T==="update"||T==="mkdir-index").map(async function([T,y,S,k,C]){let M=`${i}/${y}`;try{if(T!=="create-index"&&T!=="mkdir-index"){let{object:$}=await He({fs:t,cache:e,gitdir:a,oid:S});if(C&&await t.rm(M),k===33188)await t.write(M,$);else if(k===33261)await t.write(M,$,{mode:511});else if(k===40960)await t.writelink(M,$);else throw new ce(`Invalid mode 0o${k.toString(8)} detected in blob ${S}`)}let P=await t.lstat(M);k===33261&&(P.mode=493),T==="mkdir-index"&&(P.mode=57344),_.insert({filepath:y,stats:P,oid:S}),n&&await n({phase:"Updating workdir",loaded:++x,total:E})}catch(P){console.log(P)}}))}),r&&await r({previousHead:p,newHead:m,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let g=await W.expand({fs:t,gitdir:a,ref:o});g.startsWith("refs/heads")?await W.writeSymbolicRef({fs:t,gitdir:a,ref:"HEAD",value:g}):await W.writeRef({fs:t,gitdir:a,ref:"HEAD",value:m})}}async function N5({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,ref:a,force:s,filepaths:o}){let l=0;return Oi({fs:t,cache:e,dir:r,gitdir:i,trees:[sr({ref:a}),Wo(),Vo()],map:async function(c,[u,f,d]){if(c===".")return;if(o&&!o.some(p=>v1(c,p)))return null;switch(n&&await n({phase:"Analyzing workdir",loaded:++l}),[!!d,!!u,!!f].map(Number).join("")){case"000":return;case"001":return s&&o&&o.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await f.oid()?s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?s?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir",c];case"blob":return await d.oid()!==await f.oid()?s?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!s)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(s)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=f1(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function $5({fs:t,onProgress:e,onPostCheckout:n,dir:r,gitdir:i=B(r,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:l=!1,noUpdateHead:c=s===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={}}){try{F("fs",t),F("dir",r),F("gitdir",i);let p=s||"HEAD";return await Of({fs:new ee(t),cache:h,onProgress:e,onPostCheckout:n,dir:r,gitdir:i,remote:a,ref:p,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d})}catch(p){throw p.caller="git.checkout",p}}var H5=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Nr(t){let e=H5.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function zr({fs:t,gitdir:e,fullname:n=!1,test:r=!1}){let i=await W.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(r)try{await W.resolve({fs:t,gitdir:e,ref:i})}catch(a){return}if(i.startsWith("refs/"))return n?i:Nr(i)}function U5(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function w1({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function fs(t,e){let n=c1(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function $o(t){let e=0,n=[];await fs(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}function X0(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[n,r]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:n,password:r}}}function Tf(t,e){let n=e.toString(16);return"0".repeat(t-n.length)+n}var Ne=class{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let n=e.length+4,r=Tf(4,n);return Buffer.concat([Buffer.from(r,"utf8"),e])}static streamReader(e){let n=new jo(e);return async function(){try{let i=await n.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await n.read(i-4);return a==null?!0:a}catch(i){return e.error=i,!0}}}};async function Y0(t){let e={},n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let r=n.indexOf("=");if(r>-1){let i=n.slice(0,r),a=n.slice(r+1);e[i]=a}else e[n]=!0}return{protocolVersion:2,capabilities2:e}}async function Z0(t,{service:e}){let n=new Set,r=new Map,i=new Map,a=Ne.streamReader(t),s=await a();for(;s===null;)s=await a();if(s===!0)throw new Qa;if(s.includes("version 2"))return Y0(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new $r(`# service=${e}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:n,refs:r,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return Y0(a);let[l,c]=df(o,"\0","\\x00");if(c.split(" ").map(u=>n.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=df(l," "," ");for(r.set(f,u);;){let d=await a();if(d===!0)break;if(d!==null){let[h,p]=df(d.toString("utf8")," "," ");r.set(p,h)}}}for(let u of n)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:n,refs:r,symrefs:i}}function df(t,e,n){let r=t.trim().split(e);if(r.length!==2)throw new $r(`Two strings separated by '${n}'`,t.toString("utf8"));return r}var K0=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,Q0=(t,e)=>{(e.username||e.password)&&(t.Authorization=w1(e)),e.headers&&Object.assign(t,e.headers)},hf=async t=>{try{let e=Buffer.from(await $o(t.body)),n=e.toString("utf8");return{preview:n.length<256?n:n.slice(0,256)+"...",response:n,data:e}}catch(e){return{}}},Ri=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:n,onAuth:r,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=X0(l),h=s?K0(s,f):f;(d.username||d.password)&&(c.Authorization=w1(d)),u===2&&(c["Git-Protocol"]="version=2");let p,m,g=!1;do if(p=await e.request({onProgress:n,method:"GET",url:`${h}/info/refs?service=${o}`,headers:c}),m=!1,p.statusCode===401||p.statusCode===203){let w=g?a:r;if(w){if(d=await w(f,{...d,headers:{...c}}),d&&d.cancel)throw new Fi;d&&(Q0(c,d),g=!0,m=!0)}}else p.statusCode===200&&g&&i&&await i(f,d);while(m);if(p.statusCode!==200){let{response:w}=await hf(p);throw new ki(p.statusCode,p.statusMessage,w)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let w=await Z0(p.body,{service:o});return w.auth=d,w}else{let{preview:w,response:b,data:x}=await hf(p);try{let E=await Z0([x],{service:o});return E.auth=d,E}catch(E){throw new rs(w,b)}}}static async connect({http:e,onProgress:n,corsProxy:r,service:i,url:a,auth:s,body:o,headers:l}){let c=X0(a);c&&(a=c.url),r&&(a=K0(r,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,Q0(l,s);let u=await e.request({onProgress:n,method:"POST",url:`${a}/${i}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=hf(u);throw new ki(u.statusCode,u.statusMessage,f)}return u}};function z5({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}var Li=class{static getRemoteHelperFor({url:e}){let n=new Map;n.set("http",Ri),n.set("https",Ri);let r=z5({url:e});if(!r)throw new as(e);if(n.has(r.transport))return n.get(r.transport);throw new is(e,r.transport,r.transport==="ssh"?U5(e):void 0)}},Br=null,Ur=class{static async read({fs:e,gitdir:n}){Br===null&&(Br=new Va.default);let r=B(n,"shallow"),i=new Set;return await Br.acquire(r,async function(){let a=await e.read(r,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(` +`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:n,oids:r}){Br===null&&(Br=new Va.default);let i=B(n,"shallow");if(r.size>0){let a=[...r].join(` +`)+` +`;await Br.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Br.acquire(i,async function(){await e.rm(i)})}};async function G5({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return t.exists(`${e}/${r}`)}async function V5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await t.readdir(B(n,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${n}/objects/pack/${s}`,l=await Ff({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new ce(l.error);if(l.offsets.has(r))return!0}return!1}async function J0({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=o=>He({fs:t,cache:e,gitdir:n,oid:o}),s=await G5({fs:t,gitdir:n,oid:r});return s||(s=await V5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a})),s}function W5(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function b1(t,e){let n=t.map(r=>r.split("=",1)[0]);return e.filter(r=>{let i=r.split("=",1)[0];return n.includes(i)})}var Xo={name:"isomorphic-git",version:"1.27.1",agent:"git/isomorphic-git@1.27.1"},xi=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let n=this._waiting;this._waiting=null,n({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function q5(t){let e=t.indexOf("\r"),n=t.indexOf(` +`);return e===-1&&n===-1?-1:e===-1?n+1:n===-1?e+1:n===e+1?n+1:Math.min(e,n)+1}function x1(t){let e=new xi,n="";return(async()=>(await fs(t,r=>{for(r=r.toString("utf8"),n+=r;;){let i=q5(n);if(i===-1)break;e.write(n.slice(0,i)),n=n.slice(i)}}),n.length>0&&e.write(n),e.end()))(),e}var Ho=class{static demux(e){let n=Ne.streamReader(e),r=new xi,i=new xi,a=new xi,s=async function(){let o=await n();if(o===null)return s();if(o===!0){r.end(),a.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let l=o.slice(1);a.write(l),r.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:r.write(o)}s()};return s(),{packetlines:r,packfile:i,progress:a}}};async function X5(t){let{packetlines:e,packfile:n,progress:r}=Ho.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((c,u)=>{fs(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new or(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new or(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");s.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))})})}function Y5({capabilities:t=[],wants:e=[],haves:n=[],shallows:r=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(Ne.encode(`want ${c}${l} +`)),l="";for(let c of r)o.push(Ne.encode(`shallow ${c} +`));i!==null&&o.push(Ne.encode(`deepen ${i} +`)),a!==null&&o.push(Ne.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)} +`));for(let c of s)o.push(Ne.encode(`deepen-not ${c} +`));o.push(Ne.flush());for(let c of n)o.push(Ne.encode(`have ${c} +`));return o.push(Ne.encode(`done +`)),o}async function If({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:g=[],relative:w=!1,tags:b=!1,singleBranch:x=!1,headers:E={},prune:_=!1,pruneTags:T=!1}){let y=c||await zr({fs:t,gitdir:l,test:!0}),S=await $e.get({fs:t,gitdir:l}),k=f||y&&await S.get(`branch.${y}.remote`)||"origin",C=d||await S.get(`remote.${k}.url`);if(typeof C=="undefined")throw new Ot("remote OR url");let M=u||y&&await S.get(`branch.${y}.merge`)||c||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let P=Li.getRemoteHelperFor({url:C}),$=await P.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:C,headers:E,protocolVersion:1}),j=$.auth,Q=$.refs;if(Q.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!$.capabilities.has("shallow"))throw new ar("shallow","depth");if(m!==null&&!$.capabilities.has("deepen-since"))throw new ar("deepen-since","since");if(g.length>0&&!$.capabilities.has("deepen-not"))throw new ar("deepen-not","exclude");if(w===!0&&!$.capabilities.has("deepen-relative"))throw new ar("deepen-relative","relative");let{oid:le,fullref:de}=W.resolveAgainstMap({ref:M,map:Q});for(let V of Q.keys())V===de||V==="HEAD"||V.startsWith("refs/heads/")||b&&V.startsWith("refs/tags/")||Q.delete(V);let re=b1([...$.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Xo.agent}`]);w&&re.push("deepen-relative");let Ae=x?[le]:Q.values(),he=x?[y]:await W.listRefs({fs:t,gitdir:l,filepath:"refs"}),H=[];for(let V of he)try{V=await W.expand({fs:t,gitdir:l,ref:V});let et=await W.resolve({fs:t,gitdir:l,ref:V});await J0({fs:t,cache:e,gitdir:l,oid:et})&&H.push(et)}catch(et){}H=[...new Set(H)];let U=await Ur.read({fs:t,gitdir:l}),D=$.capabilities.has("shallow")?[...U]:[],se=Y5({capabilities:re,wants:Ae,haves:H,shallows:D,depth:p,since:m,exclude:g}),_e=Buffer.from(await $o(se)),mt=await P.connect({http:n,onProgress:r,corsProxy:h,service:"git-upload-pack",url:C,auth:j,body:[_e],headers:E}),X=await X5(mt.body);mt.headers&&(X.headers=mt.headers);for(let V of X.shallows)if(!U.has(V))try{let{object:et}=await He({fs:t,cache:e,gitdir:l,oid:V}),N=new Pt(et),Y=await Promise.all(N.headers().parent.map(Ge=>J0({fs:t,cache:e,gitdir:l,oid:Ge})));Y.length===0||Y.every(Ge=>Ge)||U.add(V)}catch(et){U.add(V)}for(let V of X.unshallows)U.delete(V);if(await Ur.write({fs:t,gitdir:l,oids:U}),x){let V=new Map([[de,le]]),et=new Map,N=10,Y=de;for(;N--;){let _t=$.symrefs.get(Y);if(_t===void 0)break;et.set(Y,_t),Y=_t}let ye=Q.get(Y);ye&&V.set(Y,ye);let{pruned:Ge}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:k,refs:V,symrefs:et,tags:b,prune:_});_&&(X.pruned=Ge)}else{let{pruned:V}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:k,refs:Q,symrefs:$.symrefs,tags:b,prune:_,pruneTags:T});_&&(X.pruned=V)}if(X.HEAD=$.symrefs.get("HEAD"),X.HEAD===void 0){let{oid:V}=W.resolveAgainstMap({ref:"HEAD",map:Q});for(let[et,N]of Q.entries())if(et!=="HEAD"&&N===V){X.HEAD=et;break}}let Te=de.startsWith("refs/tags")?"tag":"branch";if(X.FETCH_HEAD={oid:le,description:`${Te} '${Nr(de)}' of ${C}`},r||i){let V=x1(X.progress);fs(V,async et=>{if(i&&await i(et),r){let N=et.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);N&&await r({phase:N[1].trim(),loaded:parseInt(N[2],10),total:parseInt(N[3],10)})}})}let Be=Buffer.from(await $o(X.packfile));if(mt.body.error)throw mt.body.error;let Je=Be.slice(-20).toString("hex"),Re={defaultBranch:X.HEAD,fetchHead:X.FETCH_HEAD.oid,fetchHeadDescription:X.FETCH_HEAD.description};if(X.headers&&(Re.headers=X.headers),_&&(Re.pruned=X.pruned),Je!==""&&!W5(Be)){Re.packfile=`objects/pack/pack-${Je}.pack`;let V=B(l,Re.packfile);await t.write(V,Be);let et=Y=>He({fs:t,cache:e,gitdir:l,oid:Y}),N=await Xa.fromPack({pack:Be,getExternalRefDelta:et,onProgress:r});await t.write(V.replace(/\.pack$/,".idx"),await N.toBuffer())}return Re}async function _1({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){if(await t.exists(r+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>r+"/"+s);for(let s of a)await t.mkdir(s);await t.write(r+"/config",`[core] + repositoryformatversion = 0 + filemode = false + bare = ${e} +`+(e?"":` logallrefupdates = true +`)+` symlinks = false + ignorecase = true +`),await t.write(r+"/HEAD",`ref: refs/heads/${i} +`)}async function Z5({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:m,since:g,exclude:w,relative:b,singleBranch:x,noCheckout:E,noTags:_,headers:T}){try{if(await _1({fs:t,gitdir:u}),await y1({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let k=await $e.get({fs:t,gitdir:u});await k.set("http.corsProxy",d),await $e.save({fs:t,gitdir:u,config:k})}let{defaultBranch:y,fetchHead:S}=await If({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:m,since:g,exclude:w,relative:b,singleBranch:x,headers:T,tags:!_});if(S===null)return;h=h||y,h=h.replace("refs/heads/",""),await Of({fs:t,cache:e,onProgress:r,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:E})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function K5({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:m=void 0,exclude:g=[],relative:w=!1,singleBranch:b=!1,noCheckout:x=!1,noTags:E=!1,headers:_={},cache:T={}}){try{return F("fs",t),F("http",e),F("gitdir",c),x||F("dir",l),F("url",u),await Z5({fs:new ee(t),cache:T,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:m,exclude:g,relative:w,singleBranch:b,noCheckout:x,noTags:E,headers:_})}catch(y){throw y.caller="git.clone",y}}async function Q5({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{F("fs",t),l||F("message",i),o&&F("onSign",e);let m=new ee(t);return await qo({fs:m,cache:p,onSign:e,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(m){throw m.caller="git.commit",m}}async function J5({fs:t,dir:e,gitdir:n=B(e,".git"),fullname:r=!1,test:i=!1}){try{return F("fs",t),F("gitdir",n),await zr({fs:new ee(t),gitdir:n,fullname:r,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function eC({fs:t,gitdir:e,ref:n}){if(n=n.startsWith("refs/heads/")?n:`refs/heads/${n}`,!await W.exists({fs:t,gitdir:e,ref:n}))throw new Me(n);let i=await W.expand({fs:t,gitdir:e,ref:n}),a=await zr({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await W.resolve({fs:t,gitdir:e,ref:i});await W.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await W.deleteRef({fs:t,gitdir:e,ref:i});let s=Nr(n),o=await $e.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await $e.save({fs:t,gitdir:e,config:o})}async function tC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await eC({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteBranch",i}}async function nC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{F("fs",t),F("ref",r),await W.deleteRef({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteRef",i}}async function rC({fs:t,gitdir:e,remote:n}){let r=await $e.get({fs:t,gitdir:e});await r.deleteSection("remote",n),await $e.save({fs:t,gitdir:e,config:r})}async function iC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("remote",r),await rC({fs:new ee(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.deleteRemote",i}}async function aC({fs:t,gitdir:e,ref:n}){n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,await W.deleteRef({fs:t,gitdir:e,ref:n})}async function sC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await aC({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteTag",i}}async function oC({fs:t,gitdir:e,oid:n}){let r=n.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map(a=>`${r}${a}`).filter(a=>a.startsWith(n))}async function lC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=[],s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await Ff({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new ce(c.error);for(let u of c.offsets.keys())u.startsWith(r)&&a.push(u)}return a}async function cC({fs:t,cache:e,gitdir:n,oid:r}){let i=o=>He({fs:t,cache:e,gitdir:n,oid:o}),a=await oC({fs:t,gitdir:n,oid:r}),s=await lC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new Ya("oids",r,a):new Me(`an object matching "${r}"`)}async function uC({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await cC({fs:new ee(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.expandOid",a}}async function fC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("gitdir",n),F("ref",r),await W.expand({fs:new ee(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.expandRef",i}}async function Pf({fs:t,cache:e,gitdir:n,oids:r}){let i={},a=r.length,s=r.map((o,l)=>({index:l,oid:o}));for(;s.length;){let o=new Set;for(let{oid:c,index:u}of s)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===a&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of s)try{let{object:f}=await He({fs:t,cache:e,gitdir:n,oid:c}),d=Pt.from(f),{parent:h}=d.parseHeaders();for(let p of h)(!i[p]||!i[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}s=Array.from(l.values())}return[]}var pf=/^.*(\r?\n|$)/gm;function dC({branches:t,contents:e}){let n=t[1],r=t[2],i=e[0],a=e[1],s=e[2],o=a.match(pf),l=i.match(pf),c=s.match(pf),u=(0,r1.default)(o,l,c),f=7,d="",h=!0;for(let p of u)p.ok&&(d+=p.ok.join("")),p.conflict&&(h=!1,d+=`${"<".repeat(f)} ${n} +`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)} +`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${r} +`);return{cleanMerge:h,mergedText:d}}async function hC({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=sr({ref:a}),m=sr({ref:s}),g=sr({ref:o}),w=[],b=[],x=[],E=[],_=await Oi({fs:t,cache:e,dir:n,gitdir:r,trees:[p,m,g],map:async function(T,[y,S,k]){let C=Po(T),M=await Bo(y,S),P=await Bo(k,S);switch(`${M}-${P}`){case"false-false":return{mode:await S.mode(),path:C,oid:await S.oid(),type:await S.type()};case"false-true":return k?{mode:await k.mode(),path:C,oid:await k.oid(),type:await k.type()}:void 0;case"true-false":return y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&S&&k&&await y.type()==="blob"&&await S.type()==="blob"&&await k.type()==="blob")return pC({fs:t,gitdir:r,path:C,ours:y,base:S,theirs:k,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async $=>{if($.cleanMerge)d||i.insert({filepath:T,oid:$.mergeResult.oid,stage:0});else if(w.push(T),b.push(T),!d){let j=await S.oid(),Q=await y.oid(),le=await k.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:j,stage:1}),i.insert({filepath:T,oid:Q,stage:2}),i.insert({filepath:T,oid:le,stage:3})}return $.mergeResult});if(S&&!y&&k&&await S.type()==="blob"&&await k.type()==="blob"){if(w.push(T),x.push(T),!d){let $=await S.oid(),j=await k.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:$,stage:1}),i.insert({filepath:T,oid:j,stage:3})}return{mode:await k.mode(),oid:await k.oid(),type:"blob",path:C}}if(S&&y&&!k&&await S.type()==="blob"&&await y.type()==="blob"){if(w.push(T),E.push(T),!d){let $=await S.oid(),j=await y.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:$,stage:1}),i.insert({filepath:T,oid:j,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(S&&!y&&!k&&await S.type()==="blob")return;throw new Ai}}},reduce:w.length!==0&&(!n||d)?void 0:async(T,y)=>{let S=y.filter(Boolean);if(T&&!(T&&T.type==="tree"&&S.length===0)){if(S.length>0){let C=new It(S).toObject(),M=await $t({fs:t,gitdir:r,type:"tree",object:C,dryRun:f});T.oid=M}return T}}});return w.length!==0?(n&&!d&&await Oi({fs:t,cache:e,dir:n,gitdir:r,trees:[sr({ref:_.oid})],map:async function(T,[y]){let S=`${n}/${T}`;if(await y.type()==="blob"){let k=await y.mode(),C=new TextDecoder().decode(await y.content());await t.write(S,C,{mode:k})}return!0}}),new Ti(w,b,x,E)):_.oid}async function pC({fs:t,gitdir:e,path:n,ours:r,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:c,mergeDriver:u=dC}){let f="blob",d=await i.mode()===await r.mode()?await a.mode():await r.mode();if(await r.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:n,oid:await r.oid(),type:f}};if(await r.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:n,oid:await a.oid(),type:f}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:n,oid:await r.oid(),type:f}};let h=Buffer.from(await r.content()).toString("utf8"),p=Buffer.from(await i.content()).toString("utf8"),m=Buffer.from(await a.content()).toString("utf8"),{mergedText:g,cleanMerge:w}=await u({branches:[l,s,o],contents:[p,h,m],path:n}),b=await $t({fs:t,gitdir:e,type:"blob",object:Buffer.from(g,"utf8"),dryRun:c});return{cleanMerge:w,mergeResult:{mode:d,path:n,oid:b,type:f}}}async function S1({fs:t,cache:e,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:m,mergeDriver:g}){i===void 0&&(i=await zr({fs:t,gitdir:r,fullname:!0})),i=await W.expand({fs:t,gitdir:r,ref:i}),a=await W.expand({fs:t,gitdir:r,ref:a});let w=await W.resolve({fs:t,gitdir:r,ref:i}),b=await W.resolve({fs:t,gitdir:r,ref:a}),x=await Pf({fs:t,cache:e,gitdir:r,oids:[w,b]});if(x.length!==1)throw new Ai;let E=x[0];if(E===b)return{oid:w,alreadyMerged:!0};if(s&&E===w)return!l&&!c&&await W.writeRef({fs:t,gitdir:r,ref:i,value:b}),{oid:b,fastForward:!0};{if(o)throw new Ja;let _=await it.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async y=>hC({fs:t,cache:e,dir:n,gitdir:r,index:y,ourOid:w,theirOid:b,baseOid:E,ourName:Nr(i),baseName:"base",theirName:Nr(a),dryRun:l,abortOnConflict:u,mergeDriver:g}));if(_ instanceof Ti)throw _;return f||(f=`Merge branch '${Nr(a)}' into ${Nr(i)}`),{oid:await qo({fs:t,cache:e,gitdir:r,message:f,ref:i,tree:_,parent:[w,b],author:d,committer:h,signingKey:p,onSign:m,dryRun:l,noUpdateBranch:c}),tree:_,mergeCommit:!0}}}async function E1({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:m,fastForward:g,fastForwardOnly:w,corsProxy:b,singleBranch:x,headers:E,author:_,committer:T,signingKey:y}){try{if(!u){let C=await zr({fs:t,gitdir:c});if(!C)throw new Ot("ref");u=C}let{fetchHead:S,fetchHeadDescription:k}=await If({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:d,remoteRef:h,singleBranch:x,headers:E,prune:p,pruneTags:m});await S1({fs:t,cache:e,gitdir:c,ours:u,theirs:S,fastForward:g,fastForwardOnly:w,message:`Merge ${k}`,author:_,committer:T,signingKey:y,dryRun:!1,noUpdateBranch:!1}),await Of({fs:t,cache:e,onProgress:r,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(S){throw S.caller="git.pull",S}}async function mC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:p,headers:m={},cache:g={}}){try{F("fs",t),F("http",e),F("gitdir",l);let w={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await E1({fs:new ee(t),cache:g,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:m,author:w,committer:w})}catch(w){throw w.caller="git.fastForward",w}}async function gC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:g=[],relative:w=!1,tags:b=!1,singleBranch:x=!1,headers:E={},prune:_=!1,pruneTags:T=!1,cache:y={}}){try{return F("fs",t),F("http",e),F("gitdir",l),await If({fs:new ee(t),cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:l,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p,since:m,exclude:g,relative:w,tags:b,singleBranch:x,headers:E,prune:_,pruneTags:T})}catch(S){throw S.caller="git.fetch",S}}async function yC({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await Pf({fs:new ee(t),cache:i,gitdir:n,oids:r})}catch(a){throw a.caller="git.findMergeBase",a}}async function k1({fs:t,filepath:e}){if(await t.exists(B(e,".git")))return e;{let n=Ei(e);if(n===e)throw new Me(`git root for ${e}`);return k1({fs:t,filepath:n})}}async function vC({fs:t,filepath:e}){try{return F("fs",t),F("filepath",e),await k1({fs:new ee(t),filepath:e})}catch(n){throw n.caller="git.findRoot",n}}async function wC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await ls({fs:new ee(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfig",i}}async function bC({fs:t,gitdir:e,path:n}){return(await $e.get({fs:t,gitdir:e})).getall(n)}async function xC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await bC({fs:new ee(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfigAll",i}}async function _C({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{F("http",t),F("url",a);let c=await Li.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),p=h.pop(),m=u;for(let g of h)m[g]=m[g]||{},m=m[g];m[p]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),p=h.pop(),m=u;for(let g of h)m[g]=m[g]||{},m=m[g];m[p]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function A1(t,e,n,r){let i=[];for(let[a,s]of t.refs){if(e&&!a.startsWith(e))continue;if(a.endsWith("^{}")){if(r){let l=a.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=s}continue}let o={ref:a,oid:s};n&&t.symrefs.has(a)&&(o.target=t.symrefs.get(a)),i.push(o)}return i}async function SC({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2}){try{F("http",t),F("url",a);let u=await Li.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let d of u.capabilities){let[h,p]=d.split("=");p?f[h]=p:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:A1(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function EC({type:t,object:e,format:n="content",oid:r=void 0}){return n!=="deflated"&&(n!=="wrapped"&&(e=lr.wrap({type:t,object:e})),r=await $n(e)),{oid:r,object:e}}async function kC({object:t}){try{F("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t=Buffer.from(t);let e="blob",{oid:n,object:r}=await EC({type:"blob",format:"content",object:t});return{oid:n,type:e,object:new Uint8Array(r),format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function AC({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,filepath:a}){try{a=B(r,a);let s=await t.read(a),o=c=>He({fs:t,cache:e,gitdir:i,oid:c}),l=await Xa.fromPack({pack:s,getExternalRefDelta:o,onProgress:n});return await t.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function TC({fs:t,onProgress:e,dir:n,gitdir:r=B(n,".git"),filepath:i,cache:a={}}){try{return F("fs",t),F("dir",n),F("gitdir",n),F("filepath",i),await AC({fs:new ee(t),cache:a,onProgress:e,dir:n,gitdir:r,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function CC({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){try{return F("fs",t),F("gitdir",r),e||F("dir",n),await _1({fs:new ee(t),bare:e,dir:n,gitdir:r,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function T1({fs:t,cache:e,gitdir:n,oid:r,ancestor:i,depth:a}){let s=await Ur.read({fs:t,gitdir:n});if(!r)throw new Ot("oid");if(!i)throw new Ot("ancestor");if(r===i)return!1;let o=[r],l=new Set,c=0;for(;o.length;){if(c++===a)throw new ts(a);let u=o.shift(),{type:f,object:d}=await He({fs:t,cache:e,gitdir:n,oid:u});if(f!=="commit")throw new kt(u,f,"commit");let h=Pt.from(d).parse();for(let p of h.parent)if(p===i)return!0;if(!s.has(u))for(let p of h.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function FC({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,ancestor:i,depth:a=-1,cache:s={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),F("ancestor",i),await T1({fs:new ee(t),cache:s,gitdir:n,oid:r,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function MC({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r}){try{return F("fs",t),F("dir",e),F("gitdir",n),F("filepath",r),Ii.isIgnored({fs:new ee(t),dir:e,gitdir:n,filepath:r})}catch(i){throw i.caller="git.isIgnored",i}}async function OC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("gitdir",n),W.listBranches({fs:new ee(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.listBranches",i}}async function IC({fs:t,gitdir:e,ref:n,cache:r}){if(n){let i=await W.resolve({gitdir:e,fs:t,ref:n}),a=[];return await C1({fs:t,cache:r,gitdir:e,oid:i,filenames:a,prefix:""}),a}else return it.acquire({fs:t,gitdir:e,cache:r},async function(i){return i.entries.map(a=>a.path)})}async function C1({fs:t,cache:e,gitdir:n,oid:r,filenames:i,prefix:a}){let{tree:s}=await ji({fs:t,cache:e,gitdir:n,oid:r});for(let o of s)o.type==="tree"?await C1({fs:t,cache:e,gitdir:n,oid:o.oid,filenames:i,prefix:B(a,o.path)}):i.push(B(a,o.path))}async function PC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),await IC({fs:new ee(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listFiles",a}}async function RC({fs:t,cache:e,gitdir:n,ref:r}){let i;try{i=await W.resolve({gitdir:n,fs:t,ref:r})}catch(o){if(o instanceof Me)return[]}return(await ji({fs:t,cache:e,gitdir:n,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function LC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",cache:i={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),await RC({fs:new ee(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listNotes",a}}async function jC({fs:t,gitdir:e}){let n=await $e.get({fs:t,gitdir:e}),r=await n.getSubsections("remote");return Promise.all(r.map(async a=>{let s=await n.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function DC({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),await jC({fs:new ee(t),gitdir:n})}catch(r){throw r.caller="git.listRemotes",r}}async function BC(t){let e=Ne.streamReader(t),n=[],r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let[i,a,...s]=r.split(" "),o={ref:a,oid:i};for(let l of s){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}n.push(o)}return n}async function NC({prefix:t,symrefs:e,peelTags:n}){let r=[];return r.push(Ne.encode(`command=ls-refs +`)),r.push(Ne.encode(`agent=${Xo.agent} +`)),(n||e||t)&&r.push(Ne.delim()),n&&r.push(Ne.encode("peel")),e&&r.push(Ne.encode("symrefs")),t&&r.push(Ne.encode(`ref-prefix ${t}`)),r.push(Ne.flush()),r}async function $C({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{F("http",t),F("url",a);let d=await Ri.discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(d.protocolVersion===1)return A1(d,c,u,f);let h=await NC({prefix:c,symrefs:u,peelTags:f}),p=await Ri.connect({http:t,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return BC(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function HC({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),W.listTags({fs:new ee(t),gitdir:n})}catch(r){throw r.caller="git.listTags",r}}function UC(t,e){return t.committer.timestamp-e.committer.timestamp}var zC="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function e1({fs:t,cache:e,gitdir:n,oid:r,fileId:i}){if(i===zC)return;let a=r,s,o=await Mi({fs:t,cache:e,gitdir:n,oid:r}),l=o.tree;return i===o.oid?s=o.path:(s=await F1({fs:t,cache:e,gitdir:n,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function F1({fs:t,cache:e,gitdir:n,tree:r,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=r.entries().map(function(c){let u;return c.oid===i?(u=B(o,c.path),s.push(u)):c.type==="tree"&&(u=He({fs:t,cache:e,gitdir:n,oid:c.oid}).then(function({object:f}){return F1({fs:t,cache:e,gitdir:n,tree:It.from(f),fileId:i,oid:a,filepaths:s,parentPath:B(o,c.path)})})),u});return await Promise.all(l),s}async function GC({fs:t,cache:e,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l}){let c=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await Ur.read({fs:t,gitdir:n}),d=await W.resolve({fs:t,gitdir:n,ref:i}),h=[await No({fs:t,cache:e,gitdir:n,oid:d})],p,m,g;function w(b){g&&r&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(r){let x;try{x=await us({fs:t,cache:e,gitdir:n,oid:b.commit.tree,filepath:r}),m&&p!==x&&u.push(m),p=x,m=b,g=!0}catch(E){if(E instanceof Me){let _=l&&p;if(_&&(_=await e1({fs:t,cache:e,gitdir:n,oid:b.commit.tree,fileId:p}),_))if(Array.isArray(_)){if(m){let T=await e1({fs:t,cache:e,gitdir:n,oid:m.commit.tree,fileId:p});if(Array.isArray(T))if(_=_.filter(y=>T.indexOf(y)===-1),_.length===1)_=_[0],r=_,m&&u.push(m);else{_=!1,m&&u.push(m);break}}}else r=_,m&&u.push(m);if(!_){if(g&&p&&(u.push(m),!o))break;if(!o&&!l)throw E}m=b,g=!1}else throw E}}else u.push(b);if(a!==void 0&&u.length===a){w(b);break}if(!f.has(b.oid))for(let x of b.commit.parent){let E=await No({fs:t,cache:e,gitdir:n,oid:x});h.map(_=>_.oid).includes(E.oid)||h.push(E)}h.length===0&&w(b),h.sort((x,E)=>UC(x.commit,E.commit))}return u}async function VC({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:c={}}){try{return F("fs",t),F("gitdir",n),F("ref",i),await GC({fs:new ee(t),cache:c,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function WC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:m={},mergeDriver:g}){try{F("fs",t),p&&F("onSign",e);let w=new ee(t),b=await Hr({fs:w,gitdir:r,author:d});if(!b&&(!o||!s))throw new At("author");let x=await Pi({fs:w,gitdir:r,author:b,committer:h});if(!x&&(!o||!s))throw new At("committer");return await S1({fs:w,cache:m,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:b,committer:x,signingKey:p,onSign:e,mergeDriver:g})}catch(w){throw w.caller="git.merge",w}}var qC={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function M1({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Cf.default,s=[];function o(u,f){let d=Buffer.from(u,f);s.push(d),a.update(d)}async function l({stype:u,object:f}){let d=qC[u],h=f.length,p=h>15?128:0,m=h&15;h=h>>>4;let g=(p|d|m).toString(16);for(o(g,"hex");p;)p=h>127?128:0,g=p|h&127,o(Tf(2,g),"hex"),h=h>>>7;o(Buffer.from(await d1(f)))}o("PACK"),o("00000002","hex"),o(Tf(8,i.length),"hex");for(let u of i){let{type:f,object:d}=await He({fs:t,cache:e,gitdir:r,oid:u});await l({write:o,object:d,stype:f})}let c=a.digest();return s.push(c),s}async function XC({fs:t,cache:e,gitdir:n,oids:r,write:i}){let a=await M1({fs:t,cache:e,gitdir:n,oids:r}),s=Buffer.from(await $o(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(B(n,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function YC({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,write:i=!1,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await XC({fs:new ee(t),cache:a,gitdir:n,oids:r,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function ZC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:m=!0,fastForwardOnly:g=!1,corsProxy:w,singleBranch:b,headers:x={},author:E,committer:_,signingKey:T,cache:y={}}){try{F("fs",t),F("gitdir",l);let S=new ee(t),k=await Hr({fs:S,gitdir:l,author:E});if(!k)throw new At("author");let C=await Pi({fs:S,gitdir:l,author:k,committer:_});if(!C)throw new At("committer");return await E1({fs:S,cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:d,fastForward:m,fastForwardOnly:g,corsProxy:w,singleBranch:b,headers:x,author:k,committer:C,signingKey:T,prune:h,pruneTags:p})}catch(S){throw S.caller="git.pull",S}}async function KC({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),start:i,finish:a}){let s=await Ur.read({fs:t,gitdir:r}),o=new Set,l=new Set;for(let f of i)o.add(await W.resolve({fs:t,gitdir:r,ref:f}));for(let f of a)try{let d=await W.resolve({fs:t,gitdir:r,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await He({fs:t,cache:e,gitdir:r,oid:f});if(d==="tag"){let m=Nt.from(h).headers().object;return u(m)}if(d!=="commit")throw new kt(f,d,"commit");if(!s.has(f)){let m=Pt.from(h).headers().parent;for(f of m)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of o)await u(f);return c}async function mf({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:l,object:c}=await He({fs:t,cache:e,gitdir:r,oid:o});if(l==="tag"){let f=Nt.from(c).headers().object;await s(f)}else if(l==="commit"){let f=Pt.from(c).headers().tree;await s(f)}else if(l==="tree"){let u=It.from(c);for(let f of u)f.type==="blob"&&a.add(f.oid),f.type==="tree"&&await s(f.oid)}}for(let o of i)await s(o);return a}async function QC(t){let e={},n="",r=Ne.streamReader(t),i=await r();for(;i!==!0;)i!==null&&(n+=i.toString("utf8")+` +`),i=await r();let a=n.toString("utf8").split(` +`);if(i=a.shift(),!i.startsWith("unpack "))throw new $r('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function JC({capabilities:t=[],triplets:e=[]}){let n=[],r=`\0 ${t.join(" ")}`;for(let i of e)n.push(Ne.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${r} +`)),r="";return n.push(Ne.flush()),n}async function e6({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:m=!1,corsProxy:g,headers:w={}}){let b=u||await zr({fs:t,gitdir:c});if(typeof b=="undefined")throw new Ot("ref");let x=await $e.get({fs:t,gitdir:c});d=d||await x.get(`branch.${b}.pushRemote`)||await x.get("remote.pushDefault")||await x.get(`branch.${b}.remote`)||"origin";let E=h||await x.get(`remote.${d}.pushurl`)||await x.get(`remote.${d}.url`);if(typeof E=="undefined")throw new Ot("remote OR url");let _=f||await x.get(`branch.${b}.merge`);if(typeof E=="undefined")throw new Ot("remoteRef");g===void 0&&(g=await x.get("http.corsProxy"));let T=await W.expand({fs:t,gitdir:c,ref:b}),y=m?"0000000000000000000000000000000000000000":await W.resolve({fs:t,gitdir:c,ref:T}),S=Li.getRemoteHelperFor({url:E}),k=await S.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:g,service:"git-receive-pack",url:E,headers:w,protocolVersion:1}),C=k.auth,M;if(!_)M=T;else try{M=await W.expandAgainstMap({ref:_,map:k.refs})}catch(U){if(U instanceof Me)M=_.startsWith("refs/")?_:`refs/heads/${_}`;else throw U}let P=k.refs.get(M)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:E,localRef:{ref:m?"(delete)":T,oid:y},remoteRef:{ref:M,oid:P}}))throw new Fi;let $=!k.capabilities.has("no-thin"),j=new Set;if(!m){let U=[...k.refs.values()],D=new Set;if(P!=="0000000000000000000000000000000000000000"){let se=await Pf({fs:t,cache:e,gitdir:c,oids:[y,P]});for(let _e of se)U.push(_e);$&&(D=await mf({fs:t,cache:e,gitdir:c,oids:se}))}if(!U.includes(y)){let se=await KC({fs:t,cache:e,gitdir:c,start:[y],finish:U});j=await mf({fs:t,cache:e,gitdir:c,oids:se})}if($){try{let se=await W.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:_e}=await W.resolveAgainstMap({ref:se.replace(`refs/remotes/${d}/`,""),fullref:se,map:k.refs}),mt=[_e];for(let X of await mf({fs:t,cache:e,gitdir:c,oids:mt}))D.add(X)}catch(se){}for(let se of D)j.delete(se)}if(y===P&&(p=!0),!p){if(T.startsWith("refs/tags")&&P!=="0000000000000000000000000000000000000000")throw new Ci("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&P!=="0000000000000000000000000000000000000000"&&!await T1({fs:t,cache:e,gitdir:c,oid:y,ancestor:P,depth:-1}))throw new Ci("not-fast-forward")}}let Q=b1([...k.capabilities],["report-status","side-band-64k",`agent=${Xo.agent}`]),le=await JC({capabilities:Q,triplets:[{oldoid:P,oid:y,fullRef:M}]}),de=m?[]:await M1({fs:t,cache:e,gitdir:c,oids:[...j]}),re=await S.connect({http:n,onProgress:r,corsProxy:g,service:"git-receive-pack",url:E,auth:C,headers:w,body:[...le,...de]}),{packfile:Ae,progress:he}=await Ho.demux(re.body);if(i){let U=x1(he);fs(U,async D=>{await i(D)})}let H=await QC(Ae);if(re.headers&&(H.headers=re.headers),d&&H.ok&&H.refs[M].ok&&!T.startsWith("refs/tags")){let U=`refs/remotes/${d}/${M.replace("refs/heads","")}`;m?await W.deleteRef({fs:t,gitdir:c,ref:U}):await W.writeRef({fs:t,gitdir:c,ref:U,value:y})}if(H.ok&&Object.values(H.refs).every(U=>U.ok))return H;{let U=Object.entries(H.refs).filter(([D,se])=>!se.ok).map(([D,se])=>` + - ${D}: ${se.error}`).join("");throw new es(U,H)}}async function t6({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:m=!1,corsProxy:g,headers:w={},cache:b={}}){try{return F("fs",t),F("http",e),F("gitdir",c),await e6({fs:new ee(t),cache:b,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:m,corsProxy:g,headers:w})}catch(x){throw x.caller="git.push",x}}async function O1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Nt.from(a).parse().object,O1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="blob")throw new kt(r,i,"blob");return{oid:r,blob:new Uint8Array(a)}}async function I1({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){return i!==void 0&&(r=await us({fs:t,cache:e,gitdir:n,oid:r,filepath:i})),await O1({fs:t,cache:e,gitdir:n,oid:r})}async function ds({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await I1({fs:new ee(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function n6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await No({fs:new ee(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readCommit",a}}async function r6({fs:t,cache:e,gitdir:n,ref:r="refs/notes/commits",oid:i}){let a=await W.resolve({gitdir:n,fs:t,ref:r}),{blob:s}=await I1({fs:t,cache:e,gitdir:n,oid:a,filepath:i});return s}async function i6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",oid:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oid",i),await r6({fs:new ee(t),cache:a,gitdir:n,ref:r,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function a6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{F("fs",t),F("gitdir",n),F("oid",r);let l=new ee(t);a!==void 0&&(r=await us({fs:l,cache:o,gitdir:n,oid:r,filepath:a}));let u=await He({fs:l,cache:o,gitdir:n,oid:r,format:i==="parsed"?"content":i});if(u.oid=r,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=Pt.from(u.object).parse();break;case"tree":u.object=It.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Nt.from(u.object).parse();break;default:throw new kt(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(l){throw l.caller="git.readObject",l}}async function s6({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await He({fs:t,cache:e,gitdir:n,oid:r,format:"content"});if(i!=="tag")throw new kt(r,i,"tag");let s=Nt.from(a);return{oid:r,tag:s.parse(),payload:s.payload()}}async function o6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await s6({fs:new ee(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readTag",a}}async function l6({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i=void 0,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await ji({fs:new ee(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function c6({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r),await it.acquire({fs:new ee(t),gitdir:n,cache:i},async function(a){a.delete({filepath:r})})}catch(a){throw a.caller="git.remove",a}}async function u6({fs:t,cache:e,onSign:n,gitdir:r,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let c;try{c=await W.resolve({gitdir:r,fs:t,ref:i})}catch(p){if(!(p instanceof Me))throw p}let f=(await ji({fs:t,gitdir:r,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let d=await Mf({fs:t,gitdir:r,tree:f});return await qo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' +`,author:s,committer:o,signingKey:l})}async function f6({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:c={}}){try{F("fs",t),F("gitdir",r),F("oid",a);let u=new ee(t),f=await Hr({fs:u,gitdir:r,author:s});if(!f)throw new At("author");let d=await Pi({fs:u,gitdir:r,author:f,committer:o});if(!d)throw new At("committer");return await u6({fs:u,cache:c,onSign:e,gitdir:r,ref:i,oid:a,author:f,committer:d,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function d6({fs:t,gitdir:e,oldref:n,ref:r,checkout:i=!1}){if(r!==cn.default.clean(r))throw new Hn(r,cn.default.clean(r));if(n!==cn.default.clean(n))throw new Hn(n,cn.default.clean(n));let a=`refs/heads/${n}`,s=`refs/heads/${r}`;if(await W.exists({fs:t,gitdir:e,ref:s}))throw new un("branch",r,!1);let l=await W.resolve({fs:t,gitdir:e,ref:a,depth:1});await W.writeRef({fs:t,gitdir:e,ref:s,value:l}),await W.deleteRef({fs:t,gitdir:e,ref:a});let u=await zr({fs:t,gitdir:e,fullname:!0})===a;(i||u)&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function h6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,oldref:i,checkout:a=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oldref",i),await d6({fs:new ee(t),gitdir:n,ref:r,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function P1({gitdir:t,type:e,object:n}){return $n(lr.wrap({type:e,object:n}))}async function p6({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i,cache:a={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let s=new ee(t),o,l;try{o=await W.resolve({fs:s,gitdir:n,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await us({fs:s,cache:a,gitdir:n,oid:o,filepath:r})}catch(f){o=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await s.read(B(e,r));u&&(l=await P1({gitdir:n,type:"blob",object:u}),o===l&&(c=await s.lstat(B(e,r)))),await it.acquire({fs:s,gitdir:n,cache:a},async function(f){f.delete({filepath:r}),o&&f.insert({filepath:r,stats:c,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function m6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,depth:i}){try{return F("fs",t),F("gitdir",n),F("ref",r),await W.resolve({fs:new ee(t),gitdir:n,ref:r,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function g6({fs:t,dir:e,gitdir:n=B(e,".git"),path:r,value:i,append:a=!1}){try{F("fs",t),F("gitdir",n),F("path",r);let s=new ee(t),o=await $e.get({fs:s,gitdir:n});a?await o.append(r,i):await o.set(r,i),await $e.save({fs:s,gitdir:n,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function y6({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let a=new ee(t);if(await Ii.isIgnored({fs:a,gitdir:n,dir:e,filepath:r}))return"ignored";let o=await v6({fs:a,cache:i,gitdir:n}),l=await R1({fs:a,cache:i,gitdir:n,tree:o,path:r}),c=await it.acquire({fs:a,gitdir:n,cache:i},async function(m){for(let g of m)if(g.path===r)return g;return null}),u=await a.lstat(B(e,r)),f=l!==null,d=c!==null,h=u!==null,p=async()=>{if(d&&!Io(c,u))return c.oid;{let m=await a.read(B(e,r)),g=await P1({gitdir:n,type:"blob",object:m});return d&&c.oid===g&&u.size!==-1&&it.acquire({fs:a,gitdir:n,cache:i},async function(w){w.insert({filepath:r,stats:u,oid:g})}),g}};if(!f&&!h&&!d)return"absent";if(!f&&!h&&d)return"*absent";if(!f&&h&&!d)return"*added";if(!f&&h&&d)return await p()===c.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return l===c.oid,"*deleted";if(f&&h&&!d)return await p()===l?"*undeleted":"*undeletemodified";if(f&&h&&d){let m=await p();return m===l?m===c.oid?"unmodified":"*unmodified":m===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function R1({fs:t,cache:e,gitdir:n,tree:r,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of r)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await He({fs:t,cache:e,gitdir:n,oid:s.oid});if(o==="tree"){let c=It.from(l);return R1({fs:t,cache:e,gitdir:n,tree:c,path:i})}if(o==="blob")throw new kt(s.oid,o,"blob",i.join("/"))}return null}async function v6({fs:t,cache:e,gitdir:n}){let r;try{r=await W.resolve({fs:t,gitdir:n,ref:"HEAD"})}catch(a){if(a instanceof Me)return[]}let{tree:i}=await ji({fs:t,cache:e,gitdir:n,oid:r});return i}async function w6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let l=new ee(t);return await Oi({fs:l,cache:s,dir:e,gitdir:n,trees:[sr({ref:r}),Wo(),Vo()],map:async function(c,[u,f,d]){if(!u&&!d&&f&&!o&&await Ii.isIgnored({fs:l,dir:e,filepath:c})||!i.some(T=>v1(c,T)))return null;if(a&&!a(c))return;let[h,p,m]=await Promise.all([u&&u.type(),f&&f.type(),d&&d.type()]),g=[h,p,m].includes("blob");if((h==="tree"||h==="special")&&!g)return;if(h==="commit")return null;if((p==="tree"||p==="special")&&!g)return;if(m==="commit")return null;if((m==="tree"||m==="special")&&!g)return;let w=h==="blob"?await u.oid():void 0,b=m==="blob"?await d.oid():void 0,x;h!=="blob"&&p==="blob"&&m!=="blob"?x="42":p==="blob"&&(x=await f.oid());let E=[void 0,w,x,b],_=E.map(T=>E.indexOf(T));return _.shift(),[c,..._]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function b6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,force:a=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let s=new ee(t);if(r===void 0)throw new Ot("ref");r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`;let o=await W.resolve({fs:s,gitdir:n,ref:i||"HEAD"});if(!a&&await W.exists({fs:s,gitdir:n,ref:r}))throw new un("tag",r);await W.writeRef({fs:s,gitdir:n,ref:r,value:o})}catch(s){throw s.caller="git.tag",s}}async function x6({fs:t,dir:e,gitdir:n=B(e,".git"),cache:r={},filepath:i,oid:a,mode:s,add:o,remove:l,force:c}){try{F("fs",t),F("gitdir",n),F("filepath",i);let u=new ee(t);if(l)return await it.acquire({fs:u,gitdir:n,cache:r},async function(d){let h;if(!c&&(h=await u.lstat(B(e,i)),h)){if(h.isDirectory())throw new cr("directory");return}d.has({filepath:i})&&d.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(B(e,i)),!f)throw new Me(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new cr("directory")}return await it.acquire({fs:u,gitdir:n,cache:r},async function(d){if(!o&&!d.has({filepath:i}))throw new Me(`file at "${i}" in index and "add" not set`);let h={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};if(!a){h=f;let p=h.isSymbolicLink()?await u.readlink(B(e,i)):await u.read(B(e,i));a=await $t({fs:u,gitdir:n,type:"blob",format:"content",object:p})}return d.insert({filepath:i,oid:a,stats:h}),a})}catch(u){throw u.caller="git.updateIndex",u}}function _6(){try{return Xo.version}catch(t){throw t.caller="git.version",t}}async function S6({fs:t,dir:e,gitdir:n=B(e,".git"),trees:r,map:i,reduce:a,iterate:s,cache:o={}}){try{return F("fs",t),F("gitdir",n),F("trees",r),await Oi({fs:new ee(t),cache:o,dir:e,gitdir:n,trees:r,map:i,reduce:a,iterate:s})}catch(l){throw l.caller="git.walk",l}}async function E6({fs:t,dir:e,gitdir:n=B(e,".git"),blob:r}){try{return F("fs",t),F("gitdir",n),F("blob",r),await $t({fs:new ee(t),gitdir:n,type:"blob",object:r,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function k6({fs:t,gitdir:e,commit:n}){let r=Pt.from(n).toObject();return await $t({fs:t,gitdir:e,type:"commit",object:r,format:"content"})}async function A6({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r}){try{return F("fs",t),F("gitdir",n),F("commit",r),await k6({fs:new ee(t),gitdir:n,commit:r})}catch(i){throw i.caller="git.writeCommit",i}}async function T6({fs:t,dir:e,gitdir:n=B(e,".git"),type:r,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let l=new ee(t);if(a==="parsed"){switch(r){case"commit":i=Pt.from(i).toObject();break;case"tree":i=It.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=Nt.from(i).toObject();break;default:throw new kt(s||"",r,"blob|commit|tag|tree")}a="content"}return s=await $t({fs:l,gitdir:n,type:r,object:i,oid:s,format:a}),s}catch(l){throw l.caller="git.writeObject",l}}async function C6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,value:i,force:a=!1,symbolic:s=!1}){try{F("fs",t),F("gitdir",n),F("ref",r),F("value",i);let o=new ee(t);if(r!==cn.default.clean(r))throw new Hn(r,cn.default.clean(r));if(!a&&await W.exists({fs:o,gitdir:n,ref:r}))throw new un("ref",r);s?await W.writeSymbolicRef({fs:o,gitdir:n,ref:r,value:i}):(i=await W.resolve({fs:o,gitdir:n,ref:i}),await W.writeRef({fs:o,gitdir:n,ref:r,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function F6({fs:t,gitdir:e,tag:n}){let r=Nt.from(n).toObject();return await $t({fs:t,gitdir:e,type:"tag",object:r,format:"content"})}async function M6({fs:t,dir:e,gitdir:n=B(e,".git"),tag:r}){try{return F("fs",t),F("gitdir",n),F("tag",r),await F6({fs:new ee(t),gitdir:n,tag:r})}catch(i){throw i.caller="git.writeTag",i}}async function O6({fs:t,dir:e,gitdir:n=B(e,".git"),tree:r}){try{return F("fs",t),F("gitdir",n),F("tree",r),await Mf({fs:new ee(t),gitdir:n,tree:r})}catch(i){throw i.caller="git.writeTree",i}}var I6={Errors:cs,STAGE:Vo,TREE:sr,WORKDIR:Wo,add:O5,abortMerge:A5,addNote:P5,addRemote:R5,annotatedTag:j5,branch:B5,checkout:$5,clone:K5,commit:Q5,getConfig:wC,getConfigAll:xC,setConfig:g6,currentBranch:J5,deleteBranch:tC,deleteRef:nC,deleteRemote:iC,deleteTag:sC,expandOid:uC,expandRef:fC,fastForward:mC,fetch:gC,findMergeBase:yC,findRoot:vC,getRemoteInfo:_C,getRemoteInfo2:SC,hashBlob:kC,indexPack:TC,init:CC,isDescendent:FC,isIgnored:MC,listBranches:OC,listFiles:PC,listNotes:LC,listRemotes:DC,listServerRefs:$C,listTags:HC,log:VC,merge:WC,packObjects:YC,pull:ZC,push:t6,readBlob:ds,readCommit:n6,readNote:i6,readObject:a6,readTag:o6,readTree:l6,remove:c6,removeNote:f6,renameBranch:h6,resetIndex:p6,updateIndex:x6,resolveRef:m6,status:y6,statusMatrix:w6,tag:b6,version:_6,walk:S6,writeBlob:E6,writeCommit:A6,writeObject:T6,writeRef:C6,writeTag:M6,writeTree:O6},ie=I6;var xe=require("obsidian");v();var Hs=require("obsidian");v();var oS=require("child_process"),lS=Ve(Ko()),Qr=require("obsidian"),vt=Ve(require("path")),Ds=require("path");v();var cl=Ve($1(),1),sl=Ve(Ko(),1),av=require("child_process"),Hv=Ve(Lf(),1),Ui=Ve(Lf(),1),ll=Object.defineProperty,K6=Object.defineProperties,Q6=Object.getOwnPropertyDescriptor,J6=Object.getOwnPropertyDescriptors,Jf=Object.getOwnPropertyNames,H1=Object.getOwnPropertySymbols,yy=Object.prototype.hasOwnProperty,e8=Object.prototype.propertyIsEnumerable,U1=(t,e,n)=>e in t?ll(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,tn=(t,e)=>{for(var n in e||(e={}))yy.call(e,n)&&U1(t,n,e[n]);if(H1)for(var n of H1(e))e8.call(e,n)&&U1(t,n,e[n]);return t},ms=(t,e)=>K6(t,J6(e)),t8=t=>ll(t,"__esModule",{value:!0}),q=(t,e)=>function(){return t&&(e=(0,t[Jf(t)[0]])(t=0)),e},n8=(t,e)=>function(){return e||(0,t[Jf(t)[0]])((e={exports:{}}).exports,e),e.exports},qe=(t,e)=>{for(var n in e)ll(t,n,{get:e[n],enumerable:!0})},r8=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Jf(e))!yy.call(t,i)&&(n||i!=="default")&&ll(t,i,{get:()=>e[i],enumerable:!(r=Q6(e,i))||r.enumerable});return t},Ue=(t=>(e,n)=>t&&t.get(e)||(n=r8(t8({}),e,1),t&&t.set(e,n),n))(typeof WeakMap!="undefined"?new WeakMap:0),ps=(t,e,n)=>new Promise((r,i)=>{var a=l=>{try{o(n.next(l))}catch(c){i(c)}},s=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((n=n.apply(t,e)).next())}),Un,dr=q({"src/lib/errors/git-error.ts"(){Un=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),ws,Gi=q({"src/lib/errors/git-response-error.ts"(){dr(),ws=class extends Un{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),vy,wy=q({"src/lib/errors/task-configuration-error.ts"(){dr(),vy=class extends Un{constructor(t){super(void 0,t)}}}});function by(t){return typeof t=="function"?t:Xr}function xy(t){return typeof t=="function"&&t!==Xr}function _y(t,e){let n=t.indexOf(e);return n<=0?[t,""]:[t.substr(0,n),t.substr(n+1)]}function Sy(t,e=0){return Ey(t)&&t.length>e?t[e]:void 0}function qr(t,e=0){if(Ey(t)&&t.length>e)return t[t.length-1-e]}function Ey(t){return!!(t&&typeof t.length=="number")}function bs(t="",e=!0,n=` +`){return t.split(n).reduce((r,i)=>{let a=e?i.trim():i;return a&&r.push(a),r},[])}function ed(t,e){return bs(t,!0).map(n=>e(n))}function td(t){return(0,cl.exists)(t,cl.FOLDER)}function we(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function ky(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ul(t,e){if(Array.isArray(t)){let n=t.indexOf(e);n>=0&&t.splice(n,1)}else t.delete(e);return e}function fr(t){return Array.isArray(t)?t:[t]}function Ay(t){return fr(t).map(String)}function je(t,e=0){if(t==null)return e;let n=parseInt(t,10);return isNaN(n)?e:n}function gs(t,e){let n=[];for(let r=0,i=t.length;rn in t?{[n]:t[n]}:{}))}function Hf(t=0){return new Promise(e=>setTimeout(e,t))}var zi,Xr,xs,fl=q({"src/lib/utils/util.ts"(){zi="\0",Xr=()=>{},xs=Object.prototype.toString.call.bind(Object.prototype.toString)}});function kn(t,e,n){return e(t)?t:arguments.length>2?n:void 0}function nd(t,e){return/number|string|boolean/.test(typeof t)&&(!e||!e.includes(typeof t))}function rd(t){return!!t&&xs(t)==="[object Object]"}function Cy(t){return typeof t=="function"}var _s,gt,Fy,al,id,My=q({"src/lib/utils/argument-filters.ts"(){fl(),_s=t=>Array.isArray(t),gt=t=>typeof t=="string",Fy=t=>Array.isArray(t)&&t.every(gt),al=t=>gt(t)||Array.isArray(t)&&t.every(gt),id=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),Uf,i8=q({"src/lib/utils/exit-codes.ts"(){Uf=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Uf||{})}}),vs,a8=q({"src/lib/utils/git-output-streams.ts"(){vs=class{constructor(t,e){this.stdOut=t,this.stdErr=e}asStrings(){return new vs(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),ue,ur,s8=q({"src/lib/utils/line-parser.ts"(){ue=class{constructor(t,e){this.matches=[],this.parse=(n,r)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,n(a)))?this.useMatches(r,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,n){let r=n&&t.exec(n);return r&&this.pushMatch(e,r),!!r}pushMatch(t,e){this.matches.push(...e.slice(1))}},ur=class extends ue{addMatch(t,e,n){return/^remote:\s/.test(String(n))&&super.addMatch(t,e,n)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function Oy(...t){let e=process.cwd(),n=Object.assign(tn({baseDir:e},Iy),...t.filter(r=>typeof r=="object"&&r));return n.baseDir=n.baseDir||e,n.trimmed=n.trimmed===!0,n}var Iy,o8=q({"src/lib/utils/simple-git-options.ts"(){Iy={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function ad(t,e=[]){return rd(t)?Object.keys(t).reduce((n,r)=>{let i=t[r];return nd(i,["boolean"])?n.push(r+"="+i):n.push(r),n},e):e}function en(t,e=0,n=!1){let r=[];for(let i=0,a=e<0?t.length:e;i{for(let a=bs(i,r),s=0,o=a.length;s{if(!(s+c>=o))return a[s+c]};e.some(({parse:c})=>c(l,t))}}),t}var u8=q({"src/lib/utils/task-parser.ts"(){fl()}}),Py={};qe(Py,{ExitCodes:()=>Uf,GitOutputStreams:()=>vs,LineParser:()=>ue,NOOP:()=>Xr,NULL:()=>zi,RemoteLineParser:()=>ur,append:()=>we,appendTaskOptions:()=>ad,asArray:()=>fr,asFunction:()=>by,asNumber:()=>je,asStringArray:()=>Ay,bufferToString:()=>ys,callTaskParser:()=>zf,createInstanceConfig:()=>Oy,delay:()=>Hf,filterArray:()=>_s,filterFunction:()=>Cy,filterHasLength:()=>id,filterPlainObject:()=>rd,filterPrimitives:()=>nd,filterString:()=>gt,filterStringArray:()=>Fy,filterStringOrStringArray:()=>al,filterType:()=>kn,first:()=>Sy,folderExists:()=>td,forEachLineWithContent:()=>ed,getTrailingOptions:()=>en,including:()=>ky,isUserFunction:()=>xy,last:()=>qr,objectToString:()=>xs,parseStringResponse:()=>Vt,pick:()=>Ty,prefixedArray:()=>gs,remove:()=>ul,splitOn:()=>_y,toLinesWithContent:()=>bs,trailingFunctionArgument:()=>at,trailingOptionsArgument:()=>sd});var fe=q({"src/lib/utils/index.ts"(){My(),i8(),a8(),s8(),o8(),c8(),u8(),fl()}}),Ry={};qe(Ry,{CheckRepoActions:()=>Gf,checkIsBareRepoTask:()=>jy,checkIsRepoRootTask:()=>Ly,checkIsRepoTask:()=>f8});function f8(t){switch(t){case"bare":return jy();case"root":return Ly()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:dl,parser:od}}function Ly(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:dl,parser(e){return/^\.(git)?$/.test(e.trim())}}}function jy(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:dl,parser:od}}function d8(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var Gf,dl,od,Dy=q({"src/lib/tasks/check-is-repo.ts"(){fe(),Gf=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(Gf||{}),dl=({exitCode:t},e,n,r)=>{if(t===128&&d8(e))return n(Buffer.from("false"));r(e)},od=t=>t.trim()==="true"}});function h8(t,e){let n=new By(t),r=t?$y:Ny;return bs(e).forEach(i=>{let a=i.replace(r,"");n.paths.push(a),(Hy.test(a)?n.folders:n.files).push(a)}),n}var By,Ny,$y,Hy,p8=q({"src/lib/responses/CleanSummary.ts"(){fe(),By=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},Ny=/^[a-z]+\s*/i,$y=/^[a-z]+\s+[a-z]+\s*/i,Hy=/\/$/}}),Vf={};qe(Vf,{EMPTY_COMMANDS:()=>hl,adhocExecTask:()=>Uy,configurationErrorTask:()=>Rt,isBufferTask:()=>zy,isEmptyTask:()=>Gy,straightThroughBufferTask:()=>m8,straightThroughStringTask:()=>Gt});function Uy(t){return{commands:hl,format:"empty",parser:t}}function Rt(t){return{commands:hl,format:"empty",parser(){throw typeof t=="string"?new vy(t):t}}}function Gt(t,e=!1){return{commands:t,format:"utf-8",parser(n){return e?String(n).trim():n}}}function m8(t){return{commands:t,format:"buffer",parser(e){return e}}}function zy(t){return t.format==="buffer"}function Gy(t){return t.format==="empty"||!t.commands.length}var hl,st=q({"src/lib/tasks/task.ts"(){wy(),hl=[]}}),Vy={};qe(Vy,{CONFIG_ERROR_INTERACTIVE_MODE:()=>ld,CONFIG_ERROR_MODE_REQUIRED:()=>cd,CONFIG_ERROR_UNKNOWN_OPTION:()=>ud,CleanOptions:()=>tl,cleanTask:()=>Wy,cleanWithOptionsTask:()=>g8,isCleanOptionsArray:()=>y8});function g8(t,e){let{cleanMode:n,options:r,valid:i}=v8(t);return n?i.options?(r.push(...e),r.some(x8)?Rt(ld):Wy(n,r)):Rt(ud+JSON.stringify(t)):Rt(cd)}function Wy(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(r){return h8(t==="n",r)}}}function y8(t){return Array.isArray(t)&&t.every(e=>fd.has(e))}function v8(t){let e,n=[],r={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{w8(i)?(e=i,r.cleanMode=!0):r.options=r.options&&b8(n[n.length]=`-${i}`)}),{cleanMode:e,options:n,valid:r}}function w8(t){return t==="f"||t==="n"}function b8(t){return/^-[a-z]$/i.test(t)&&fd.has(t.charAt(1))}function x8(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var ld,cd,ud,tl,fd,qy=q({"src/lib/tasks/clean.ts"(){p8(),fe(),st(),ld="Git clean interactive mode is not supported",cd='Git clean mode parameter ("n" or "f") is required',ud="Git clean unknown option found in: ",tl=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))(tl||{}),fd=new Set(["i",...Ay(Object.values(tl))])}});function _8(t){let e=new Yy;for(let n of Xy(t))e.addValue(n.file,String(n.key),n.value);return e}function S8(t,e){let n=null,r=[],i=new Map;for(let a of Xy(t,e))a.key===e&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:e,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function E8(t){return t.replace(/^(file):/,"")}function*Xy(t,e=null){let n=t.split("\0");for(let r=0,i=n.length-1;rObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=qr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,n){let r=this.addFile(t);r.hasOwnProperty(e)?Array.isArray(r[e])?r[e].push(n):r[e]=[r[e],n]:r[e]=n,this._all=void 0}}}});function jf(t,e){return typeof t=="string"&&Wf.hasOwnProperty(t)?t:e}function A8(t,e,n,r){let i=["config",`--${r}`];return n&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function T8(t,e){let n=["config","--null","--show-origin","--get-all",t];return e&&n.splice(1,0,`--${e}`),{commands:n,format:"utf-8",parser(r){return S8(r,t)}}}function C8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(n){return _8(n)}}}function F8(){return{addConfig(t,e,...n){return this._runTask(A8(t,e,n[0]===!0,jf(n[1],"local")),at(arguments))},getConfig(t,e){return this._runTask(T8(t,jf(e,void 0)),at(arguments))},listConfig(...t){return this._runTask(C8(jf(t[0],void 0)),at(arguments))}}}var Wf,Zy=q({"src/lib/tasks/config.ts"(){k8(),fe(),Wf=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Wf||{})}});function M8(...t){return new Qy().param(...t)}function O8(t){let e=new Set,n={};return ed(t,r=>{let[i,a,s]=r.split(zi);e.add(i),(n[i]=n[i]||[]).push({line:je(a),path:i,preview:s})}),{paths:e,results:n}}function I8(){return{grep(t){let e=at(arguments),n=en(arguments);for(let i of Ky)if(n.includes(i))return this._runTask(Rt(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=M8().param(t));let r=["grep","--null","-n","--full-name",...n,...t];return this._runTask({commands:r,format:"utf-8",parser(i){return O8(i)}},e)}}}var Ky,hs,z1,Qy,Jy=q({"src/lib/tasks/grep.ts"(){fe(),st(),Ky=["-h"],hs=Symbol("grepQuery"),Qy=class{constructor(){this[z1]=[]}*[(z1=hs,Symbol.iterator)](){for(let t of this[hs])yield t}and(...t){return t.length&&this[hs].push("--and","(",...gs(t,"-e"),")"),this}param(...t){return this[hs].push(...gs(t,"-e")),this}}}}),ev={};qe(ev,{ResetMode:()=>nl,getResetMode:()=>R8,resetTask:()=>P8});function P8(t,e){let n=["reset"];return tv(t)&&n.push(`--${t}`),n.push(...e),Gt(n)}function R8(t){if(tv(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function tv(t){return nv.includes(t)}var nl,nv,rv=q({"src/lib/tasks/reset.ts"(){st(),nl=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(nl||{}),nv=Array.from(Object.values(nl))}});function L8(){return(0,sl.default)("simple-git")}function G1(t,e,n){return!e||!String(e).replace(/\s*/,"")?n?(r,...i)=>{t(r,...i),n(r,...i)}:t:(r,...i)=>{t(`%s ${r}`,e,...i),n&&n(r,...i)}}function j8(t,e,{namespace:n}){if(typeof t=="string")return t;let r=e&&e.namespace||"";return r.startsWith(n)?r.substr(n.length+1):r||n}function dd(t,e,n,r=L8()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?r.extend(e):e,o=j8(kn(e,gt),s,r);return c(n);function l(u,f){return we(a,dd(t,o.replace(/^[^:]+/,u),f,r))}function c(u){let f=u&&`[${u}]`||"",d=s&&G1(s,f)||Xr,h=G1(r,`${i} ${f}`,d);return Object.assign(s?d:h,{label:t,sibling:l,info:h,step:c})}}var iv=q({"src/lib/git-logger.ts"(){fe(),sl.default.formatters.L=t=>String(id(t)?t.length:"-"),sl.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):xs(t)}}),Jo,qf,D8=q({"src/lib/runners/tasks-pending-queue.ts"(){dr(),iv(),Jo=class{constructor(t="GitExecutor"){this.logLabel=t,this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){let e=Jo.getName(t.commands[0]),n=dd(this.logLabel,e);return{task:t,logger:n,name:e}}push(t){let e=this.createProgress(t);return e.logger("Adding task to the queue, commands = %o",t.commands),this._queue.set(t,e),e}fatal(t){for(let[e,{logger:n}]of Array.from(this._queue.entries()))e===t.task?(n.info("Failed %o",t),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",t.message),this.complete(e);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(t){this.withProgress(t)&&this._queue.delete(t)}attempt(t){let e=this.withProgress(t);if(!e)throw new Un(void 0,"TasksPendingQueue: attempt called for an unknown task");return e.logger("Starting task"),e}static getName(t="empty"){return`task:${t}:${++Jo.counter}`}},qf=Jo,qf.counter=0}});function Hi(t,e){return{method:Sy(t.commands)||"",commands:e}}function B8(t,e){return n=>{e("[ERROR] child process exception %o",n),t.push(Buffer.from(String(n.stack),"ascii"))}}function V1(t,e,n,r){return i=>{n("%s received %L bytes",e,i),r("%B",i),t.push(i)}}var Xf,N8=q({"src/lib/runners/git-executor-chain.ts"(){dr(),st(),fe(),D8(),Xf=class{constructor(t,e,n){this._executor=t,this._scheduler=e,this._plugins=n,this._chain=Promise.resolve(),this._queue=new qf}get binary(){return this._executor.binary}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}attemptTask(t){return ps(this,null,function*(){let e=yield this._scheduler.next(),n=()=>this._queue.complete(t);try{let{logger:r}=this._queue.attempt(t);return yield Gy(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{n(),e()}})}onFatalException(t,e){let n=e instanceof Un?Object.assign(e,{task:t}):new Un(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(n),n}attemptRemoteTask(t,e){return ps(this,null,function*(){let n=this._plugins.exec("spawn.args",[...t.commands],Hi(t,t.commands)),r=yield this.gitResponse(t,this.binary,n,this.outputHandler,e.step("SPAWN")),i=yield this.handleTaskData(t,n,r,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),zy(t)?zf(t.parser,i):zf(t.parser,i.asStrings())})}attemptEmptyTask(t,e){return ps(this,null,function*(){return e("empty task bypassing child process to call to task's parser"),t.parser(this)})}handleTaskData(t,e,n,r){let{exitCode:i,rejection:a,stdOut:s,stdErr:o}=n;return new Promise((l,c)=>{r("Preparing to handle process response exitCode=%d stdOut=",i);let{error:u}=this._plugins.exec("task.error",{error:a},tn(tn({},Hi(t,e)),n));if(u&&t.onError)return r.info("exitCode=%s handling with custom error handler"),t.onError(n,u,f=>{r.info("custom error handler treated as success"),r("custom error returned a %s",xs(f)),l(new vs(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},c);if(u)return r.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,o.length,a),c(u);r.info("retrieving task output complete"),l(new vs(Buffer.concat(s),Buffer.concat(o)))})}gitResponse(t,e,n,r,i){return ps(this,null,function*(){let a=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Hi(t,t.commands));return new Promise(o=>{let l=[],c=[];i.info("%s %o",e,n),i("%O",s);let u=this._beforeSpawn(t,n);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,ms(tn({},Hi(t,n)),{kill(d){u=d||u}}));let f=(0,av.spawn)(e,n,s);f.stdout.on("data",V1(l,"stdOut",i,a.step("stdOut"))),f.stderr.on("data",V1(c,"stdErr",i,a.step("stdErr"))),f.on("error",B8(c,i)),r&&(i("Passing child process stdOut/stdErr to custom outputHandler"),r(e,f.stdout,f.stderr,[...n])),this._plugins.exec("spawn.after",void 0,ms(tn({},Hi(t,n)),{spawned:f,close(d,h){o({stdOut:l,stdErr:c,exitCode:d,rejection:u||h})},kill(d){f.killed||(u=d,f.kill("SIGINT"))}}))})})}_beforeSpawn(t,e){let n;return this._plugins.exec("spawn.before",void 0,ms(tn({},Hi(t,e)),{kill(r){n=r||n}})),n}}}}),sv={};qe(sv,{GitExecutor:()=>ov});var ov,$8=q({"src/lib/runners/git-executor.ts"(){N8(),ov=class{constructor(t="git",e,n,r){this.binary=t,this.cwd=e,this._scheduler=n,this._plugins=r,this._chain=new Xf(this,this._scheduler,this._plugins)}chain(){return new Xf(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function H8(t,e,n=Xr){let r=a=>{n(null,a)},i=a=>{(a==null?void 0:a.task)===t&&n(a instanceof ws?U8(a):a,void 0)};e.then(r,i)}function U8(t){let e=r=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${r} should be GitResponseError.git.${r}, this will no longer be available in version 3`),e=Xr};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(n,{}));function n(r,i){return i in t||(r[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),r}}var z8=q({"src/lib/task-callback.ts"(){Gi(),fe()}});function W1(t,e){return Uy(n=>{if(!td(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||n).cwd=t})}var G8=q({"src/lib/tasks/change-working-directory.ts"(){fe(),st()}});function Df(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=ul(e,"-B")),Gt(e)}function V8(){return{checkout(){return this._runTask(Df(en(arguments,1)),at(arguments))},checkoutBranch(t,e){return this._runTask(Df(["-b",t,e,...en(arguments)]),at(arguments))},checkoutLocalBranch(t){return this._runTask(Df(["-b",t,...en(arguments)]),at(arguments))}}}var W8=q({"src/lib/tasks/checkout.ts"(){fe(),st()}});function q8(t){return Vt({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},lv,t)}var lv,X8=q({"src/lib/parsers/parse-commit.ts"(){fe(),lv=[new ue(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,n,r])=>{t.branch=e,t.commit=r,t.root=!!n}),new ue(/\s*Author:\s(.+)/i,(t,[e])=>{let n=e.split("<"),r=n.pop();!r||!r.includes("@")||(t.author={email:r.substr(0,r.length-1),name:n.join("<").trim()})}),new ue(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(n,10)||0,t.summary.deletions=parseInt(r,10)||0}),new ue(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(n,10)||0;r==="-"?t.summary.deletions=i:r==="+"&&(t.summary.insertions=i)})]}});function Y8(t,e,n){return{commands:["-c","core.abbrev=40","commit",...gs(t,"-m"),...e,...n],format:"utf-8",parser:q8}}function Z8(){return{commit(e,...n){let r=at(arguments),i=t(e)||Y8(fr(e),fr(kn(n[0],al,[])),[...kn(n[1],_s,[]),...en(arguments,0,!0)]);return this._runTask(i,r)}};function t(e){return!al(e)&&Rt("git.commit: requires the commit message to be supplied as a string/string[]")}}var K8=q({"src/lib/tasks/commit.ts"(){X8(),fe(),st()}});function Q8(t,e){let n=["hash-object",t];return e&&n.push("-w"),Gt(n,!0)}var J8=q({"src/lib/tasks/hash-object.ts"(){st()}});function e4(t,e,n){let r=String(n).trim(),i;if(i=cv.exec(r))return new rl(t,e,!1,i[1]);if(i=uv.exec(r))return new rl(t,e,!0,i[1]);let a="",s=r.split(" ");for(;s.length;)if(s.shift()==="in"){a=s.join(" ");break}return new rl(t,e,/^re/i.test(r),a)}var rl,cv,uv,t4=q({"src/lib/responses/InitSummary.ts"(){rl=class{constructor(t,e,n,r){this.bare=t,this.path=e,this.existing=n,this.gitDir=r}},cv=/^Init.+ repository in (.+)$/,uv=/^Rein.+ in (.+)$/}});function n4(t){return t.includes(hd)}function r4(t=!1,e,n){let r=["init",...n];return t&&!n4(r)&&r.splice(1,0,hd),{commands:r,format:"utf-8",parser(i){return e4(r.includes("--bare"),e,i)}}}var hd,i4=q({"src/lib/tasks/init.ts"(){t4(),hd="--bare"}});function pd(t){for(let e=0;eVt(new fv,e,n,!1)}var Bf,q1,X1,Y1,hv,pv=q({"src/lib/parsers/parse-diff-summary.ts"(){Ss(),s4(),fe(),Bf=[new ue(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,n,r=""])=>{t.files.push({file:e.trim(),changes:je(n),insertions:r.replace(/[^+]/g,"").length,deletions:r.replace(/[^-]/g,"").length,binary:!1})}),new ue(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,n,r])=>{t.files.push({file:e.trim(),before:je(n),after:je(r),binary:!0})}),new ue(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);t.changed=je(e),t.insertions=je(r==null?void 0:r[1]),t.deletions=je(i==null?void 0:i[1])})],q1=[new ue(/(\d+)\t(\d+)\t(.+)$/,(t,[e,n,r])=>{let i=je(e),a=je(n);t.changed++,t.insertions+=i,t.deletions+=a,t.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new ue(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],X1=[new ue(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],Y1=[new ue(/([ACDMRTUXB])([0-9][0-9][0-9])?\t(.[^\t]+)\t?(.*)?$/,(t,[e,n,r,i])=>{t.changed++,t.files.push({file:i!=null?i:r,changes:0,status:e,insertions:0,deletions:0,binary:!1})})],hv={"":Bf,"--stat":Bf,"--numstat":q1,"--name-status":Y1,"--name-only":X1}}});function o4(t,e){return e.reduce((n,r,i)=>(n[r]=t[i]||"",n),Object.create({diff:null}))}function mv(t=vd,e=gv,n=""){let r=dv(n);return function(i){let a=bs(i,!0,gd).map(function(s){let o=s.trim().split(yd),l=o4(o[0].trim().split(t),e);return o.length>1&&o[1].trim()&&(l.diff=r(o[1])),l});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var gd,yd,vd,gv,yv=q({"src/lib/parsers/parse-list-log-summary.ts"(){fe(),pv(),Ss(),gd="\xF2\xF2\xF2\xF2\xF2\xF2 ",yd=" \xF2\xF2",vd=" \xF2 ",gv=["hash","date","message","refs","author_name","author_email"]}}),vv={};qe(vv,{diffSummaryTask:()=>l4,validateLogFormatConfig:()=>pl});function l4(t){let e=pd(t),n=["diff"];return e===""&&(e="--stat",n.push("--stat=4096")),n.push(...t),pl(n)||{commands:n,format:"utf-8",parser:dv(e)}}function pl(t){let e=t.filter(a4);if(e.length>1)return Rt(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return Rt(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var wd=q({"src/lib/tasks/diff.ts"(){Ss(),pv(),st()}});function c4(t,e){let n=[],r=[];return Object.keys(t).forEach(i=>{n.push(i),r.push(String(t[i]))}),[n,r.join(e)]}function u4(t){return Object.keys(t).reduce((e,n)=>(n in Yf||(e[n]=t[n]),e),{})}function wv(t={},e=[]){let n=kn(t.splitter,gt,vd),r=!nd(t.format)&&t.format?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[i,a]=c4(r,n),s=[],o=[`--pretty=format:${gd}${a}${yd}`,...e],l=t.n||t["max-count"]||t.maxCount;if(l&&o.push(`--max-count=${l}`),t.from||t.to){let c=t.symmetric!==!1?"...":"..";s.push(`${t.from||""}${c}${t.to||""}`)}return gt(t.file)&&s.push("--follow",t.file),ad(u4(t),o),{fields:i,splitter:n,commands:[...o,...s]}}function f4(t,e,n){let r=mv(t,e,pd(n));return{commands:["log",...n],format:"utf-8",parser:r}}function d4(){return{log(...n){let r=at(arguments),i=wv(sd(arguments),kn(arguments[0],_s)),a=e(...n)||pl(i.commands)||t(i);return this._runTask(a,r)}};function t(n){return f4(n.splitter,n.fields,n.commands)}function e(n,r){return gt(n)&>(r)&&Rt("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Yf,bv=q({"src/lib/tasks/log.ts"(){Ss(),yv(),fe(),st(),wd(),Yf=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(Yf||{})}}),il,xv,h4=q({"src/lib/responses/MergeSummary.ts"(){il=class{constructor(t,e=null,n){this.reason=t,this.file=e,this.meta=n}toString(){return`${this.file}:${this.reason}`}},xv=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),Zf,_v,p4=q({"src/lib/responses/PullSummary.ts"(){Zf=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},_v=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Nf(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Z1(t){let e=/^\s*(\d+)/.exec(t),n=/delta (\d+)/i.exec(t);return{count:je(e&&e[1]||"0"),delta:je(n&&n[1]||"0")}}var Sv,m4=q({"src/lib/parsers/parse-remote-objects.ts"(){fe(),Sv=[new ur(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Nf(t.remoteMessages);Object.assign(i,{[r]:je(n)})}),new ur(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Nf(t.remoteMessages);Object.assign(i,{[r]:je(n)})}),new ur(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,n,r])=>{let i=Nf(t.remoteMessages);i.total=Z1(e),i.reused=Z1(n),i.packReused=je(r)})]}});function Ev(t,e){return Vt({remoteMessages:new Av},kv,e)}var kv,Av,Tv=q({"src/lib/parsers/parse-remote-messages.ts"(){fe(),m4(),kv=[new ur(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Sv,new ur([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new ur([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,n,r])=>{t.remoteMessages.vulnerabilities={count:je(e),summary:n,url:r}})],Av=class{constructor(){this.all=[]}}}});function g4(t,e){let n=Vt(new _v,Cv,[t,e]);return n.message&&n}var K1,Q1,J1,ey,Cv,ty,bd,Fv=q({"src/lib/parsers/parse-pull.ts"(){p4(),fe(),Tv(),K1=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,Q1=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,J1=/^(create|delete) mode \d+ (.+)/,ey=[new ue(K1,(t,[e,n,r])=>{t.files.push(e),n&&(t.insertions[e]=n.length),r&&(t.deletions[e]=r.length)}),new ue(Q1,(t,[e,,n,,r])=>n!==void 0||r!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+n||0,t.summary.deletions=+r||0,!0):!1),new ue(J1,(t,[e,n])=>{we(t.files,n),we(e==="create"?t.created:t.deleted,n)})],Cv=[new ue(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new ue(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new ue(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,n,r,i])=>{t.branch.local=r,t.hash.local=e,t.branch.remote=i,t.hash.remote=n})],ty=(t,e)=>Vt(new Zf,ey,[t,e]),bd=(t,e)=>Object.assign(new Zf,ty(t,e),Ev(t,e))}}),ny,Mv,ry,y4=q({"src/lib/parsers/parse-merge.ts"(){h4(),fe(),Fv(),ny=[new ue(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new ue(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,n])=>{t.conflicts.push(new il(e,n))}),new ue(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,n,r])=>{t.conflicts.push(new il(e,n,{deleteRef:r}))}),new ue(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new il(e,null))}),new ue(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Mv=(t,e)=>Object.assign(ry(t,e),bd(t,e)),ry=t=>Vt(new xv,ny,t)}});function iy(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,n){let r=Mv(e,n);if(r.failed)throw new ws(r);return r}}:Rt("Git.merge requires at least one option")}var v4=q({"src/lib/tasks/merge.ts"(){Gi(),y4(),st()}});function w4(t,e,n){let r=n.includes("deleted"),i=n.includes("tag")||/^refs\/tags/.test(t),a=!n.includes("new");return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:t,remote:e}}var ay,Ov,sy,b4=q({"src/lib/parsers/parse-push.ts"(){fe(),Tv(),ay=[new ue(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new ue(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref=ms(tn({},t.ref||{}),{local:e})}),new ue(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,n,r])=>{t.pushed.push(w4(e,n,r))}),new ue(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,n,r])=>{t.branch=ms(tn({},t.branch||{}),{local:e,remote:n,remoteName:r})}),new ue(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,n,r,i])=>{t.update={head:{local:e,remote:n},hash:{from:r,to:i}}})],Ov=(t,e)=>{let n=sy(t,e),r=Ev(t,e);return tn(tn({},n),r)},sy=(t,e)=>Vt({pushed:[]},ay,[t,e])}}),Iv={};qe(Iv,{pushTagsTask:()=>x4,pushTask:()=>xd});function x4(t={},e){return we(e,"--tags"),xd(t,e)}function xd(t={},e){let n=["push",...e];return t.branch&&n.splice(1,0,t.branch),t.remote&&n.splice(1,0,t.remote),ul(n,"-v"),we(n,"--verbose"),we(n,"--porcelain"),{commands:n,format:"utf-8",parser:Ov}}var Pv=q({"src/lib/tasks/push.ts"(){b4(),fe()}}),oy,Rv,_4=q({"src/lib/responses/FileStatusSummary.ts"(){oy=/^(.+) -> (.+)$/,Rv=class{constructor(t,e,n){if(this.path=t,this.index=e,this.working_dir=n,e+n==="R"){let r=oy.exec(t)||[null,t,t];this.from=r[1]||"",this.path=r[2]||""}}}}});function ly(t){let[e,n]=t.split(zi);return{from:n||e,to:e}}function zt(t,e,n){return[`${t}${e}`,n]}function $f(t,...e){return e.map(n=>zt(t,n,(r,i)=>we(r.conflicted,i)))}function S4(t,e){let n=e.trim();switch(" "){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.substr(3));case n.charAt(1):return r(" ",n.charAt(0),n.substr(2));default:return}function r(i,a,s){let o=`${i}${a}`,l=Lv.get(o);l&&l(t,s),o!=="##"&&o!=="!!"&&t.files.push(new Rv(s.replace(/\0.+$/,""),i,a))}}var cy,Lv,jv,E4=q({"src/lib/responses/StatusSummary.ts"(){fe(),_4(),cy=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},Lv=new Map([zt(" ","A",(t,e)=>we(t.created,e)),zt(" ","D",(t,e)=>we(t.deleted,e)),zt(" ","M",(t,e)=>we(t.modified,e)),zt("A"," ",(t,e)=>we(t.created,e)&&we(t.staged,e)),zt("A","M",(t,e)=>we(t.created,e)&&we(t.staged,e)&&we(t.modified,e)),zt("D"," ",(t,e)=>we(t.deleted,e)&&we(t.staged,e)),zt("M"," ",(t,e)=>we(t.modified,e)&&we(t.staged,e)),zt("M","M",(t,e)=>we(t.modified,e)&&we(t.staged,e)),zt("R"," ",(t,e)=>{we(t.renamed,ly(e))}),zt("R","M",(t,e)=>{let n=ly(e);we(t.renamed,n),we(t.modified,n.to)}),zt("!","!",(t,e)=>{we(t.ignored=t.ignored||[],e)}),zt("?","?",(t,e)=>we(t.not_added,e)),...$f("A","A","U"),...$f("D","D","U"),...$f("U","A","D","U"),["##",(t,e)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,s=/\son\s([\S]+)$/,o;o=n.exec(e),t.ahead=o&&+o[1]||0,o=r.exec(e),t.behind=o&&+o[1]||0,o=i.exec(e),t.current=o&&o[1],o=a.exec(e),t.tracking=o&&o[1],o=s.exec(e),t.current=o&&o[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),jv=function(t){let e=t.split(zi),n=new cy;for(let r=0,i=e.length;r!Dv.includes(n))],parser(n){return jv(n)}}}var Dv,A4=q({"src/lib/tasks/status.ts"(){E4(),Dv=["--null","-z"]}});function ol(t=0,e=0,n=0,r="",i=!0){return Object.defineProperty({major:t,minor:e,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function T4(){return ol(0,0,0,"",!1)}function C4(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:F4,onError(t,e,n,r){if(t.exitCode===-2)return n(Buffer.from(_d));r(e)}})}}}function F4(t){return t===_d?T4():Vt(ol(0,0,0,t),Bv,t)}var _d,Bv,M4=q({"src/lib/tasks/version.ts"(){fe(),_d="installed=false",Bv=[new ue(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,n,r,i=""])=>{Object.assign(t,ol(je(e),je(n),je(r),i))}),new ue(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,n,r,i=""])=>{Object.assign(t,ol(je(e),je(n),r,i))})]}}),Nv={};qe(Nv,{SimpleGitApi:()=>Kf});var Kf,O4=q({"src/lib/simple-git-api.ts"(){z8(),G8(),W8(),K8(),Zy(),Jy(),J8(),i4(),bv(),v4(),Pv(),A4(),st(),M4(),fe(),Kf=class{constructor(t){this._executor=t}_runTask(t,e){let n=this._executor.chain(),r=n.push(t);return e&&H8(t,r,e),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(t){return this._runTask(Gt(["add",...fr(t)]),at(arguments))}cwd(t){let e=at(arguments);return typeof t=="string"?this._runTask(W1(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(W1(t.path,t.root&&this._executor||void 0),e):this._runTask(Rt("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Q8(t,e===!0),at(arguments))}init(t){return this._runTask(r4(t===!0,this._executor.cwd,en(arguments)),at(arguments))}merge(){return this._runTask(iy(en(arguments)),at(arguments))}mergeFromTo(t,e){return gt(t)&>(e)?this._runTask(iy([t,e,...en(arguments)]),at(arguments,!1)):this._runTask(Rt("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=xd({remote:kn(arguments[0],gt),branch:kn(arguments[1],gt)},en(arguments));return this._runTask(t,at(arguments))}stash(){return this._runTask(Gt(["stash",...en(arguments)]),at(arguments))}status(){return this._runTask(k4(en(arguments)),at(arguments))}},Object.assign(Kf.prototype,V8(),Z8(),F8(),I8(),d4(),C4())}}),$v={};qe($v,{Scheduler:()=>Uv});var uy,Uv,I4=q({"src/lib/runners/scheduler.ts"(){fe(),iv(),uy=(()=>{let t=0;return()=>{t++;let{promise:e,done:n}=(0,Hv.createDeferred)();return{promise:e,done:n,id:t}}})(),Uv=class{constructor(t=2){this.concurrency=t,this.logger=dd("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=we(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),ul(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=we(this.pending,uy());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),zv={};qe(zv,{applyPatchTask:()=>P4});function P4(t,e){return Gt(["apply",...e,...t])}var R4=q({"src/lib/tasks/apply-patch.ts"(){st()}});function L4(t,e){return{branch:t,hash:e,success:!0}}function j4(t){return{branch:t,hash:null,success:!1}}var Gv,D4=q({"src/lib/responses/BranchDeleteSummary.ts"(){Gv=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Vv(t,e){return e===1&&Qf.test(t)}var fy,Qf,dy,ml,B4=q({"src/lib/parsers/parse-branch-delete.ts"(){D4(),fe(),fy=/(\S+)\s+\(\S+\s([^)]+)\)/,Qf=/^error[^']+'([^']+)'/m,dy=[new ue(fy,(t,[e,n])=>{let r=L4(e,n);t.all.push(r),t.branches[e]=r}),new ue(Qf,(t,[e])=>{let n=j4(e);t.errors.push(n),t.all.push(n),t.branches[e]=n})],ml=(t,e)=>Vt(new Gv,dy,[t,e])}}),Wv,N4=q({"src/lib/responses/BranchSummary.ts"(){Wv=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,n,r,i){t==="*"&&(this.detached=e,this.current=n),this.all.push(n),this.branches[n]={current:t==="*",linkedWorkTree:t==="+",name:n,commit:r,label:i}}}}});function hy(t){return t?t.charAt(0):""}function qv(t){return Vt(new Wv,Xv,t)}var Xv,$4=q({"src/lib/parsers/parse-branch.ts"(){N4(),fe(),Xv=[new ue(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,n,r,i])=>{t.push(hy(e),!0,n,r,i)}),new ue(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,n,r,i])=>{t.push(hy(e),!1,n,r,i)})]}}),Yv={};qe(Yv,{branchLocalTask:()=>U4,branchTask:()=>H4,containsDeleteBranchCommand:()=>Zv,deleteBranchTask:()=>G4,deleteBranchesTask:()=>z4});function Zv(t){let e=["-d","-D","--delete"];return t.some(n=>e.includes(n))}function H4(t){let e=Zv(t),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(r,i){return e?ml(r,i).all[0]:qv(r)}}}function U4(){return{format:"utf-8",commands:["branch","-v"],parser:qv}}function z4(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(n,r){return ml(n,r)},onError({exitCode:n,stdOut:r},i,a,s){if(!Vv(String(i),n))return s(i);a(r)}}}function G4(t,e=!1){let n={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(r,i){return ml(r,i).branches[t]},onError({exitCode:r,stdErr:i,stdOut:a},s,o,l){if(!Vv(String(s),r))return l(s);throw new ws(n.parser(ys(a),ys(i)),String(s))}};return n}var V4=q({"src/lib/tasks/branch.ts"(){Gi(),B4(),$4(),fe()}}),Kv,W4=q({"src/lib/responses/CheckIgnore.ts"(){Kv=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),Qv={};qe(Qv,{checkIgnoreTask:()=>q4});function q4(t){return{commands:["check-ignore",...t],format:"utf-8",parser:Kv}}var X4=q({"src/lib/tasks/check-ignore.ts"(){W4()}}),Jv={};qe(Jv,{cloneMirrorTask:()=>Z4,cloneTask:()=>e2});function Y4(t){return/^--upload-pack(=|$)/.test(t)}function e2(t,e,n){let r=["clone",...n];return gt(t)&&r.push(t),gt(e)&&r.push(e),r.find(Y4)?Rt("git.fetch: potential exploit argument blocked."):Gt(r)}function Z4(t,e,n){return we(n,"--mirror"),e2(t,e,n)}var K4=q({"src/lib/tasks/clone.ts"(){st(),fe()}});function Q4(t,e){return Vt({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},t2,[t,e])}var t2,J4=q({"src/lib/parsers/parse-fetch.ts"(){fe(),t2=[new ue(/From (.+)$/,(t,[e])=>{t.remote=e}),new ue(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.branches.push({name:e,tracking:n})}),new ue(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.tags.push({name:e,tracking:n})}),new ue(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new ue(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,n,r,i])=>{t.updated.push({name:r,tracking:i,to:n,from:e})})]}}),n2={};qe(n2,{fetchTask:()=>tF});function eF(t){return/^--upload-pack(=|$)/.test(t)}function tF(t,e,n){let r=["fetch",...n];return t&&e&&r.push(t,e),r.find(eF)?Rt("git.fetch: potential exploit argument blocked."):{commands:r,format:"utf-8",parser:Q4}}var nF=q({"src/lib/tasks/fetch.ts"(){J4(),st()}});function rF(t){return Vt({moves:[]},r2,t)}var r2,iF=q({"src/lib/parsers/parse-move.ts"(){fe(),r2=[new ue(/^Renaming (.+) to (.+)$/,(t,[e,n])=>{t.moves.push({from:e,to:n})})]}}),i2={};qe(i2,{moveTask:()=>aF});function aF(t,e){return{commands:["mv","-v",...fr(t),e],format:"utf-8",parser:rF}}var sF=q({"src/lib/tasks/move.ts"(){iF(),fe()}}),a2={};qe(a2,{pullTask:()=>oF});function oF(t,e,n){let r=["pull",...n];return t&&e&&r.splice(1,0,t,e),{commands:r,format:"utf-8",parser(i,a){return bd(i,a)},onError(i,a,s,o){let l=g4(ys(i.stdOut),ys(i.stdErr));if(l)return o(new ws(l));o(a)}}}var lF=q({"src/lib/tasks/pull.ts"(){Gi(),Fv(),fe()}});function cF(t){let e={};return s2(t,([n])=>e[n]={name:n}),Object.values(e)}function uF(t){let e={};return s2(t,([n,r,i])=>{e.hasOwnProperty(n)||(e[n]={name:n,refs:{fetch:"",push:""}}),i&&r&&(e[n].refs[i.replace(/[^a-z]/g,"")]=r)}),Object.values(e)}function s2(t,e){ed(t,n=>e(n.split(/\s+/)))}var fF=q({"src/lib/responses/GetRemoteSummary.ts"(){fe()}}),o2={};qe(o2,{addRemoteTask:()=>dF,getRemotesTask:()=>hF,listRemotesTask:()=>pF,remoteTask:()=>mF,removeRemoteTask:()=>gF});function dF(t,e,n=[]){return Gt(["remote","add",...n,t,e])}function hF(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?uF:cF}}function pF(t=[]){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),Gt(e)}function mF(t=[]){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),Gt(e)}function gF(t){return Gt(["remote","remove",t])}var yF=q({"src/lib/tasks/remote.ts"(){fF(),st()}}),l2={};qe(l2,{stashListTask:()=>vF});function vF(t={},e){let n=wv(t),r=["stash","list",...n.commands,...e],i=mv(n.splitter,n.fields,pd(r));return pl(r)||{commands:r,format:"utf-8",parser:i}}var wF=q({"src/lib/tasks/stash-list.ts"(){Ss(),yv(),wd(),bv()}}),c2={};qe(c2,{addSubModuleTask:()=>bF,initSubModuleTask:()=>xF,subModuleTask:()=>gl,updateSubModuleTask:()=>_F});function bF(t,e){return gl(["add",t,e])}function xF(t){return gl(["init",...t])}function gl(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),Gt(e)}function _F(t){return gl(["update",...t])}var SF=q({"src/lib/tasks/sub-module.ts"(){st()}});function EF(t,e){let n=isNaN(t),r=isNaN(e);return n!==r?n?1:-1:n?u2(t,e):0}function u2(t,e){return t===e?0:t>e?1:-1}function kF(t){return t.trim()}function el(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var py,f2,AF=q({"src/lib/responses/TagList.ts"(){py=class{constructor(t,e){this.all=t,this.latest=e}},f2=function(t,e=!1){let n=t.split(` +`).map(kF).filter(Boolean);e||n.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return EF(el(s[0]),el(o[0]));for(let l=0,c=Math.max(s.length,o.length);li.indexOf(".")>=0);return new py(n,r)}}}),d2={};qe(d2,{addAnnotatedTagTask:()=>FF,addTagTask:()=>CF,tagListTask:()=>TF});function TF(t=[]){let e=t.some(n=>/^--sort=/.test(n));return{format:"utf-8",commands:["tag","-l",...t],parser(n){return f2(n,e)}}}function CF(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function FF(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var MF=q({"src/lib/tasks/tag.ts"(){AF()}}),OF=n8({"src/git.js"(t,e){var{GitExecutor:n}=($8(),Ue(sv)),{SimpleGitApi:r}=(O4(),Ue(Nv)),{Scheduler:i}=(I4(),Ue($v)),{configurationErrorTask:a}=(st(),Ue(Vf)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:p}=(fe(),Ue(Py)),{applyPatchTask:m}=(R4(),Ue(zv)),{branchTask:g,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:x}=(V4(),Ue(Yv)),{checkIgnoreTask:E}=(X4(),Ue(Qv)),{checkIsRepoTask:_}=(Dy(),Ue(Ry)),{cloneTask:T,cloneMirrorTask:y}=(K4(),Ue(Jv)),{cleanWithOptionsTask:S,isCleanOptionsArray:k}=(qy(),Ue(Vy)),{diffSummaryTask:C}=(wd(),Ue(vv)),{fetchTask:M}=(nF(),Ue(n2)),{moveTask:P}=(sF(),Ue(i2)),{pullTask:$}=(lF(),Ue(a2)),{pushTagsTask:j}=(Pv(),Ue(Iv)),{addRemoteTask:Q,getRemotesTask:le,listRemotesTask:de,remoteTask:re,removeRemoteTask:Ae}=(yF(),Ue(o2)),{getResetMode:he,resetTask:H}=(rv(),Ue(ev)),{stashListTask:U}=(wF(),Ue(l2)),{addSubModuleTask:D,initSubModuleTask:se,subModuleTask:_e,updateSubModuleTask:mt}=(SF(),Ue(c2)),{addAnnotatedTagTask:X,addTagTask:Te,tagListTask:Be}=(MF(),Ue(d2)),{straightThroughBufferTask:Je,straightThroughStringTask:Re}=(st(),Ue(Vf));function V(N,Y){this._executor=new n(N.binary,N.baseDir,new i(N.maxConcurrentProcesses),Y),this._trimmed=N.trimmed}(V.prototype=Object.create(r.prototype)).constructor=V,V.prototype.customBinary=function(N){return this._executor.binary=N,this},V.prototype.env=function(N,Y){return arguments.length===1&&typeof N=="object"?this._executor.env=N:(this._executor.env=this._executor.env||{})[N]=Y,this},V.prototype.stashList=function(N){return this._runTask(U(p(arguments)||{},o(N)&&N||[]),h(arguments))};function et(N,Y,ye,Ge){return typeof ye!="string"?a(`git.${N}() requires a string 'repoPath'`):Y(ye,f(Ge,c),d(arguments))}V.prototype.clone=function(){return this._runTask(et("clone",T,...arguments),h(arguments))},V.prototype.mirror=function(){return this._runTask(et("mirror",y,...arguments),h(arguments))},V.prototype.mv=function(N,Y){return this._runTask(P(N,Y),h(arguments))},V.prototype.checkoutLatestTag=function(N){var Y=this;return this.pull(function(){Y.tags(function(ye,Ge){Y.checkout(Ge.latest,N)})})},V.prototype.pull=function(N,Y,ye,Ge){return this._runTask($(f(N,c),f(Y,c),d(arguments)),h(arguments))},V.prototype.fetch=function(N,Y){return this._runTask(M(f(N,c),f(Y,c),d(arguments)),h(arguments))},V.prototype.silent=function(N){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},V.prototype.tags=function(N,Y){return this._runTask(Be(d(arguments)),h(arguments))},V.prototype.rebase=function(){return this._runTask(Re(["rebase",...d(arguments)]),h(arguments))},V.prototype.reset=function(N){return this._runTask(H(he(N),d(arguments)),h(arguments))},V.prototype.revert=function(N){let Y=h(arguments);return typeof N!="string"?this._runTask(a("Commit must be a string"),Y):this._runTask(Re(["revert",...d(arguments,0,!0),N]),Y)},V.prototype.addTag=function(N){let Y=typeof N=="string"?Te(N):a("Git.addTag requires a tag name");return this._runTask(Y,h(arguments))},V.prototype.addAnnotatedTag=function(N,Y){return this._runTask(X(N,Y),h(arguments))},V.prototype.deleteLocalBranch=function(N,Y,ye){return this._runTask(x(N,typeof Y=="boolean"?Y:!1),h(arguments))},V.prototype.deleteLocalBranches=function(N,Y,ye){return this._runTask(b(N,typeof Y=="boolean"?Y:!1),h(arguments))},V.prototype.branch=function(N,Y){return this._runTask(g(d(arguments)),h(arguments))},V.prototype.branchLocal=function(N){return this._runTask(w(),h(arguments))},V.prototype.raw=function(N){let Y=!Array.isArray(N),ye=[].slice.call(Y?arguments:N,0);for(let _t=0;_tt.removeEventListener("abort",a))}}]:void 0}function RF(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function LF(t,e){if(RF(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new Wr(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function jF(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new Wr(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&/^\s*-u\b/.test(t))throw new Wr(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new Wr(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function DF({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(n,r){return n.forEach((i,a)=>{let s=aHf(i))).then(s.done)}return{type:"spawn.after",action(i,a){return ps(this,arguments,function*(s,{spawned:o,close:l}){var c,u;let f=n(),d=!0,h=()=>void(d=!1);(c=o.stdout)==null||c.on("data",h),(u=o.stderr)==null||u.on("data",h),o.on("error",h),o.on("close",p=>f.close(p)),o.on("exit",p=>f.exit(p));try{yield f.result,d&&(yield Hf(50)),l(f.exitCode)}catch(p){l(f.exitCode,p)}})}}}dr();function $F(t){return!!(t.exitCode&&t.stdErr.length)}function HF(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function UF(t=!1,e=$F,n=HF){return(r,i)=>!t&&r||!e(i)?r:n(i)}function gy(t){return{type:"task.error",action(e,n){let r=t(e.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new Un(void 0,r.toString("utf-8"))}:{error:r}}}}fe();var zF=class{constructor(){this.plugins=new Set}add(t){let e=[];return fr(t).forEach(n=>n&&this.plugins.add(we(e,n))),()=>{e.forEach(n=>this.plugins.delete(n))}}exec(t,e,n){let r=e,i=Object.freeze(Object.create(n));for(let a of this.plugins)a.type===t&&(r=a.action(r,i));return r}};fe();function GF(t){let e="--progress",n=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,s){return n.includes(s.method)?ky(a,e):a}},{type:"spawn.after",action(a,s){var o;s.commands.includes(e)&&((o=s.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:s.method,stage:VF(c[1]),progress:je(c[2]),processed:je(c[3]),total:je(c[4])})}))}}]}function VF(t){return String(t.toLowerCase().split(" ",1))||"unknown"}fe();function WF(t){let e=Ty(t,["uid","gid"]);return{type:"spawn.options",action(n){return tn(tn({},e),n)}}}function qF({block:t,stdErr:e=!0,stdOut:n=!0}){if(t>0)return{type:"spawn.after",action(r,i){var a,s;let o;function l(){o&&clearTimeout(o),o=setTimeout(u,t)}function c(){var f,d;(f=i.spawned.stdout)==null||f.off("data",l),(d=i.spawned.stderr)==null||d.off("data",l),i.spawned.off("exit",c),i.spawned.off("close",c),o&&clearTimeout(o)}function u(){c(),i.kill(new Wr(void 0,"timeout","block timeout reached"))}n&&((a=i.spawned.stdout)==null||a.on("data",l)),e&&((s=i.spawned.stderr)==null||s.on("data",l)),i.spawned.on("exit",c),i.spawned.on("close",c),l()}}}fe();var XF=OF();function YF(t,e){let n=new zF,r=Oy(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!td(r.baseDir))throw new IF(r,"Cannot use simple-git on a directory that does not exist");return Array.isArray(r.config)&&n.add(BF(r.config)),n.add(DF(r.unsafe)),n.add(NF(r.completion)),r.abort&&n.add(PF(r.abort)),r.progress&&n.add(GF(r.progress)),r.timeout&&n.add(qF(r.timeout)),r.spawnOptions&&n.add(WF(r.spawnOptions)),n.add(gy(UF(!0))),r.errors&&n.add(gy(r.errors)),new XF(r,n)}Gi();var h2=YF;v();var p2=require("obsidian"),yl="YYYY-MM-DD",Sd=`${yl} HH:mm`,Ed=`${yl} HH:mm:ss`,vl=40,Vi="conflict-files-obsidian-git.md",An={commitMessage:"vault backup: {{date}}",commitDateFormat:Ed,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:p2.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:Sd,dateTimeTimezone:"viewer-local",coloringMaxAge:"1y",colorNew:{r:255,g:150,b:150},colorOld:{r:120,g:160,b:255},textColorCss:"var(--text-muted)",ignoreWhitespace:!1,gutterSpacingFallbackLength:5}},ht={type:"git-view",name:"Source Control",icon:"git-pull-request"},fn={type:"git-history-view",name:"History",icon:"history"},Tt={type:"diff-view",name:"Diff View",icon:"git-pull-request"};v();function m2(t,e){let n=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:n})}v();var K_=Ve(P2()),Q_=Ve(Z_()),na=require("obsidian"),Vh=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function qt(t){let e;if(t){if(t.button===0||t.button===1){let n=na.Keymap.isModEvent(t);e=app.workspace.getLeaf(n)}}else e=app.workspace.getLeaf(!1);return e}function Fn(t,e,n,r,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(n);if(a!=null){let s=new na.Menu;t.workspace.trigger("file-menu",s,a,i,r),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function vr(t){throw new Error("Impossible branch: "+t)}function Wh(t){return`rgb(${t.r},${t.g},${t.b})`}function J_(t){var a;let e=(a=K_.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[n,r,i]=e;return{r:n,g:r,b:i}}function eS(t){return t.diff(na.moment.unix(0),"seconds")}function tS(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function nS(t,e){return(0,Q_.default)(t,e,{strict:!0})}function rS(t,e,n){return t.length<=e?new Array(e-t.length).fill(n).join("")+t:t.substring(t.length-e)}function iS(t,e){if(e<=0)return t;let n=new Array(e).fill(" ").join(""),r=t.substring(e,t.length);return n+r}function qh(t,e,n){return t<=e&&e<=n}function wr(t){let[e,...n]=t.split("/");return[e,n.length===0?void 0:n.join("/")]}function Lt(t){return t.endsWith("/")?t:t.split("/").last().replace(".md","")}function js(t){return t===1?"1 minute":`${t} minutes`}v();var ra=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,n=!0){return n&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}_getTreeStructure(e,n=0){let r=[];for(e=[...e];e.length>0;){let i=e.first(),a=i.path.substring(n);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=e.filter(c=>c.path.substring(n).startsWith(s+"/"));o.forEach(c=>e.remove(c));let l=i.path.substring(0,a.indexOf("/")+n);r.push({title:s,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(n>0?n+s.length:s.length)+1)})}else r.push({title:a,data:i,path:i.path,vaultPath:this.getRelativeVaultPath(i.path)}),e.remove(i)}return r}simplify(e){var n,r,i,a;for(let s of e){for(;;){let o=((n=s.children)==null?void 0:n.length)==1,l=((i=(r=s.children)==null?void 0:r.first())==null?void 0:i.data)==null;if(!(s.children!=null&&o&&l))break;let c=s.children.first();s.title+="/"+c.title,s.data=c.data,s.path=c.path,s.vaultPath=c.vaultPath,s.children=c.children}s.children!=null&&this.simplify(s.children),(a=s.children)==null||a.sort((o,l)=>{let c=(l.data==null?1:0)-(o.data==null?1:0);return c!=0?c:o.title.localeCompare(l.title)})}return e.sort((s,o)=>{let l=(o.data==null?1:0)-(s.data==null?1:0);return l!=0?l:s.title.localeCompare(o.title)})}getTreeStructure(e){let n=this._getTreeStructure(e);return this.simplify(n)}async formatCommitMessage(e){let n;if(e.includes("{{numFiles}}")){n=await this.status();let i=n.staged.length;e=e.replace("{{numFiles}}",String(i))}if(e.includes("{{hostname}}")){let i=this.plugin.localStorage.getHostname()||"";e=e.replace("{{hostname}}",i)}if(e.includes("{{files}}")){n=n!=null?n:await this.status();let i={},a="";if(n.staged.length<100){n.staged.forEach(o=>{o.index in i?i[o.index].push(o.path):i[o.index]=[o.path]});let s=[];for(let[o,l]of Object.entries(i))s.push(o+" "+l.join(" "));a=s.join(", ")}else a="Too many files to list";e=e.replace("{{files}}",a)}let r=window.moment;if(e=e.replace("{{date}}",r().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let i=n!=null?n:await this.status(),a="";i.staged.length<100?a=i.staged.map(s=>s.path).join(` +`):a="Too many files to list",e=e+` + +Affected files: +`+a}return e}};var Oe=class extends ra{constructor(e){super(e)}async setGitInstance(e=!1){if(this.isGitInstalled()){let n=this.app.vault.adapter,r=n.getBasePath(),i=r;this.plugin.settings.basePath&&(await n.exists((0,Qr.normalizePath)(this.plugin.settings.basePath))?i=vt.join(r,this.plugin.settings.basePath):e||new Qr.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=i,this.git=h2({baseDir:i,binary:this.plugin.localStorage.getGitPath()||void 0,config:["core.quotepath=off"]});let a=this.plugin.localStorage.getPATHPaths(),s=this.plugin.localStorage.getEnvVars(),o=this.plugin.settings.gitDir;if(a.length>0){let l=process.env.PATH+":"+a.join(":");process.env.PATH=l}o&&(process.env.GIT_DIR=o);for(let l of s){let[c,u]=l.split("=");process.env[c]=u}if(lS.default.enable("simple-git"),await this.git.checkIsRepo()){let l=await this.git.revparse("--show-cdup"),c=(0,Ds.resolve)(i+Ds.sep+l);this.absoluteRepoPath=c,await this.git.cwd(c)}}}getRelativeVaultPath(e){let r=this.app.vault.adapter.getBasePath(),i=vt.join(this.absoluteRepoPath,e),a=vt.relative(r,i);return Qr.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(e,n=!0){if(n){let i=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,s=vt.join(i,e),o=vt.relative(a,s);return Qr.Platform.isWin&&(o=o.replace(/\\/g,"/")),o}return e}async status(){this.plugin.setState(1);let e=await this.git.status(r=>this.onError(r));this.plugin.setState(0);let n=e.files.map(r=>{let i=this.formatPath(r);return{path:i.path,from:i.from,index:r.index==="?"?"U":r.index,working_dir:r.working_dir==="?"?"U":r.working_dir,vault_path:this.getRelativeVaultPath(i.path)}});return{all:n,changed:n.filter(r=>r.working_dir!==" "),staged:n.filter(r=>r.index!==" "&&r.index!="U"),conflicted:e.conflicted.map(r=>this.formatPath({path:r}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(e){let n=this.getRelativeRepoPath(e),i=["-C",vt.dirname(n),"rev-parse","HEAD"],a=this.git.raw(i);return a.catch(s=>console.warn("obsidian-git: rev-parse error:",s)),a}async getSubmodulePaths(){return new Promise(async e=>{this.git.outputHandler(async(n,r,i,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let s="",o=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");r.on("data",l=>{s+=l.toString("utf8")}),r.on("end",async()=>{let c=s.split(` +`).map(u=>{let f=u.match(/'([^']*)'/);if(f!=null)return o+"/"+f[1]+Ds.sep}).filter(u=>!!u);c.reverse(),e(c)})}),await this.git.subModule(["foreach","--recursive",""]),this.git.outputHandler(()=>{})})}formatPath(e,n=!1){function r(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return n?{from:r(e.from),path:r(e.path)}:{path:r(e.path)}}async blame(e,n,r){if(e=this.getRelativeRepoPath(e),!await this.isTracked(e))return"untracked";let i=await this.getSubmoduleOfFile(e),a=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:e;a.push("blame","--porcelain"),r&&a.push("-w");let o=`-C${vl}`;switch(n){case"inactive":break;case"same-commit":a.push("-C",o);break;case"all-commits":a.push("-C","-C",o);break;default:vr(n)}a.push("--",s);let l=await this.git.raw(a,c=>c&&console.warn("git-blame",c));return KP(l)}async isTracked(e){let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("ls-files","--",i),this.git.raw(r,a=>a&&console.warn("ls-files",a)).then(a=>a.trim()!=="")}async commitAll({message:e}){if(this.plugin.settings.updateSubmodules){this.plugin.setState(4);let r=await this.getSubmodulePaths();for(let i of r)await this.git.cwd({path:i,root:!1}).add("-A",a=>this.onError(a)),await this.git.cwd({path:i,root:!1}).commit(await this.formatCommitMessage(e),a=>this.onError(a))}this.plugin.setState(3),await this.git.add("-A",r=>this.onError(r)),this.plugin.setState(4);let n=await this.git.commit(await this.formatCommitMessage(e),r=>this.onError(r));return dispatchEvent(new CustomEvent("git-head-update")),n.summary.changes}async commit({message:e,amend:n}){this.plugin.setState(4);let r=(await this.git.commit(await this.formatCommitMessage(e),n?["--amend"]:[],i=>this.onError(i))).summary.changes;return dispatchEvent(new CustomEvent("git-head-update")),this.plugin.setState(0),r}async stage(e,n){this.plugin.setState(3),e=this.getRelativeRepoPath(e,n),await this.git.add(["--",e],r=>this.onError(r)),this.plugin.setState(0)}async stageAll({dir:e}){this.plugin.setState(3),await this.git.add(e!=null?e:"-A",n=>this.onError(n)),this.plugin.setState(0)}async unstageAll({dir:e}){this.plugin.setState(3),await this.git.reset(e!=null?["--",e]:[],n=>this.onError(n)),this.plugin.setState(0)}async unstage(e,n){this.plugin.setState(3),e=this.getRelativeRepoPath(e,n),await this.git.reset(["--",e],r=>this.onError(r)),this.plugin.setState(0)}async discard(e){this.plugin.setState(3),await this.isTracked(e)?await this.git.checkout(["--",e],n=>this.onError(n)):await this.app.vault.adapter.rmdir(this.getRelativeVaultPath(e),!0),this.plugin.setState(0)}async hashObject(e){e=this.getRelativeRepoPath(e);let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;r.push("hash-object","--",i);let a=this.git.raw(r);return a.catch(s=>s&&console.warn("obsidian-git. hash-object failed:",s==null?void 0:s.message)),a}async discardAll({dir:e}){return this.discard(e!=null?e:".")}async pull(){this.plugin.setState(2),this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"],i=>this.onError(i));let e=await this.branchInfo(),n=await this.git.revparse([e.current],i=>this.onError(i));if(!e.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch(i=>this.onError(i));let r=await this.git.revparse([e.tracking],i=>this.onError(i));if(n!==r){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{switch(this.plugin.settings.syncMethod){case"merge":await this.git.merge([e.tracking]);break;case"rebase":await this.git.rebase([e.tracking])}}catch(s){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${s.message}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${e.current}`,r],s=>this.onError(s)),await this.unstageAll({})}catch(s){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${s.message}`)}dispatchEvent(new CustomEvent("git-head-update"));let i=await this.git.revparse([e.current],s=>this.onError(s));return(await this.git.diff([`${n}..${i}`,"--name-only"])).split(/\r\n|\r|\n/).filter(s=>s.length>0).map(s=>({path:s,working_dir:"P",vault_path:this.getRelativeVaultPath(s)}))}else return[]}async push(){if(this.plugin.setState(5),this.plugin.settings.updateSubmodules){let a=await this.git.env({...process.env,OBSIDIAN_GIT:1}).subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`],s=>this.onError(s));console.log(a)}let e=await this.git.status(),n=e.tracking,r=e.current;if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let i=(await this.git.diffSummary([r,n,"--"],a=>this.onError(a))).changed;return await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(a=>this.onError(a)),i}async getUnpushedCommits(){let e=await this.git.status(),n=e.tracking,r=e.current;return n==null||r==null?0:(await this.git.diffSummary([r,n,"--"],a=>this.onError(a))).changed}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let e=await this.git.status(a=>this.onError(a)),n=e.tracking,r=e.current;return n?(await this.git.diffSummary([r,n,"--"])).changed!==0:!1}async checkRequirements(){return this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let e=await this.git.status(r=>this.onError(r)),n=await this.git.branch(["--no-color"],r=>this.onError(r));return{current:e.current||void 0,tracking:e.tracking||void 0,branches:n.all}}async getRemoteUrl(e){try{return await this.git.remote(["get-url",e])||void 0}catch(n){if(n.toString().contains(e))return;this.onError(n)}}async log(e,n=!0,r){let i;return e&&(i=this.getRelativeRepoPath(e,n)),(await this.git.log({file:i,maxCount:r,"-m":null,"--name-status":null},s=>this.onError(s))).all.map(s=>{var o,l,c,u;return{...s,author:{name:s.author_name,email:s.author_email},refs:s.refs.split(", ").filter(f=>f.length>0),diff:{...s.diff,files:(l=(o=s.diff)==null?void 0:o.files.map(f=>({...f,status:f.status,path:f.file,hash:s.hash,vault_path:this.getRelativeVaultPath(f.file)})))!=null?l:[]},fileName:(u=(c=s.diff)==null?void 0:c.files.first())==null?void 0:u.file}})}async show(e,n,r=!0){let i=this.getRelativeRepoPath(n,r);return this.git.show([e+":"+i],a=>this.onError(a))}async checkout(e,n){if(n&&(e=`${n}/${e}`),await this.git.checkout(e,r=>this.onError(r)),this.plugin.settings.submoduleRecurseCheckout){let r=await this.getSubmodulePaths();for(let i of r){let a=await this.git.cwd({path:i,root:!1}).branch();Object.keys(a.branches).includes(e)&&await this.git.cwd({path:i,root:!1}).checkout(e,s=>this.onError(s))}}}async createBranch(e){await this.git.checkout(["-b",e],n=>this.onError(n))}async deleteBranch(e,n){await this.git.branch([n?"-D":"-d",e],r=>this.onError(r))}async branchIsMerged(e){return!(await this.git.branch(["--no-merged"],r=>this.onError(r))).all.contains(e)}async init(){await this.git.init(!1,e=>this.onError(e))}async clone(e,n,r){await this.git.clone(e,vt.join(this.app.vault.adapter.getBasePath(),n),r?["--depth",`${r}`]:[],i=>this.onError(i))}async setConfig(e,n){n==null?await this.git.raw(["config","--local","--unset",e]):await this.git.addConfig(e,n,r=>this.onError(r))}async getConfig(e){return(await this.git.listConfig("local",r=>this.onError(r))).all[e]}async fetch(e){await this.git.fetch(e!=null?[e]:[],n=>this.onError(n))}async setRemote(e,n){(await this.getRemotes()).includes(e)?await this.git.remote(["set-url",e,n],r=>this.onError(r)):await this.git.remote(["add",e,n],r=>this.onError(r))}async getRemoteBranches(e){let n=await this.git.branch(["-r","--list",`${e}*`],i=>this.onError(i)),r=[];for(let i in n.branches)r.push(n.branches[i].name);return r}async getRemotes(){let e=await this.git.remote([],n=>this.onError(n));return e?e.trim().split(` +`):[]}async removeRemote(e){await this.git.removeRemote(e)}async updateUpstreamBranch(e){try{await this.git.branch(["--set-upstream-to",e])}catch(n){console.error(n);try{await this.git.branch(["--set-upstream",e])}catch(r){console.error(r),await this.git.push(["--set-upstream",...wr(e)],i=>this.onError(i))}}}updateGitPath(e){this.setGitInstance()}updateBasePath(e){this.setGitInstance(!0)}async getDiffString(e,n=!1,r){return n?await this.git.diff(["--cached","--",e]):r?await this.git.show([`${r}`,"--",e]):await this.git.diff(["--",e])}async diff(e,n,r){return await this.git.diff([`${n}..${r}`,"--",e])}async getSubmoduleOfFile(e){if(!await this.app.vault.adapter.exists(vt.dirname(e)))return;let n=await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-toplevel"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message));if(n=n.trim(),(await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-superproject-working-tree"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(vt.normalize(e)),s=vt.relative(n,a);return{submodule:n,relativeFilepath:s}}async getLastCommitTime(){let e=await this.git.log({n:1},n=>this.onError(n));if(e!=null&&e.latest!=null)return new Date(e.latest.date)}isGitInstalled(){let e=(0,oS.spawnSync)(this.plugin.localStorage.getGitPath()||"git",["--version"],{stdio:"ignore"});return e.error?(console.error(e.error),!1):!0}onError(e){if(e){let n=e.message.contains("Could not resolve host")||e.message.match(/ssh: connect to host .*? port .*?: Operation timed out/)||e.message.match(/ssh: connect to host .*? port .*?: Network is unreachable/);n?this.plugin.offlineMode||this.plugin.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3):(this.plugin.displayError(e.message),this.plugin.setState(0)),n&&(this.plugin.offlineMode=!0,this.plugin.setState(0))}}},cS={hash:"000000",isZeroCommit:!0,summary:""};function KP(t){let n=t.replace(`\r +`,` +`).split(` +`),r={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a=4&&n.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return r}function JP(t,e,n){let r=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[n],s=e.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(r){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=sS(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=sS(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}e.commits.set(a,s)}function eR(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Xh(t.author)&&(t.author=void 0),Xh(t.committer)&&(t.committer=void 0),Xh(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Xh(t){return!t||Object.keys(t).length===0}function aS(t){return t.length>0&&t[0].trim()===t[0]}function sS(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}v();var HS=require("@codemirror/state");v();var bS=require("@codemirror/state"),mc=require("obsidian");v();var Yh=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,n){if(e)return this.ensureInitialized(e),n(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(n=>n.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},ia=new Yh;v();var dc=require("@codemirror/state"),mS=Ve(Zh());v();var z=require("obsidian");v();v();function Wn(){}Wn.prototype={diff:function(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={}),this.options=i;var s=this;function o(E){return a?(setTimeout(function(){a(void 0,E)},0),!0):E}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var l=n.length,c=e.length,u=1,f=l+c;i.maxEditLength&&(f=Math.min(f,i.maxEditLength));var d=(r=i.timeout)!==null&&r!==void 0?r:1/0,h=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(p[0],n,e,0);if(p[0].oldPos+1>=c&&m+1>=l)return o([{value:this.join(n),count:n.length}]);var g=-1/0,w=1/0;function b(){for(var E=Math.max(g,-u);E<=Math.min(w,u);E+=2){var _=void 0,T=p[E-1],y=p[E+1];T&&(p[E-1]=void 0);var S=!1;if(y){var k=y.oldPos-E;S=y&&0<=k&&k=c&&m+1>=l)return o(tR(s,_.lastComponent,n,e,s.useLongestToken));p[E]=_,_.oldPos+1>=c&&(w=Math.min(w,E-1)),m+1>=l&&(g=Math.max(g,E+1))}u++}if(a)(function E(){setTimeout(function(){if(u>f||Date.now()>h)return a();b()||E()},0)})();else for(;u<=f&&Date.now()<=h;){var x=b();if(x)return x}},addToPath:function(e,n,r,i){var a=e.lastComponent;return a&&a.added===n&&a.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}},extractCommon:function(e,n,r,i){for(var a=n.length,s=r.length,o=e.oldPos,l=o-i,c=0;l+1m.length?w:m}),f.value=t.join(d)}else f.value=t.join(n.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}var p=a[l-1];return l>1&&typeof p.value=="string"&&(p.added||p.removed)&&t.equals("",p.value)&&(a[l-2].value+=p.value,a.pop()),a}var xN=new Wn;var uS=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,fS=/\S/,dS=new Wn;dS.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!fS.test(t)&&!fS.test(e)};dS.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?l(T.lines.slice(-s.context)):[],u-=d.length,f-=d.length)}(_=d).push.apply(_,Kh(E.map(function(j){return(x.added?"+":"-")+j}))),x.added?p+=E.length:h+=E.length}else{if(u)if(E.length<=s.context*2&&b=o.length-2&&E.length<=s.context){var M=/\n$/.test(n),P=/\n$/.test(r),$=E.length==0&&d.length>C.oldLines;!M&&$&&n.length>0&&d.splice(C.oldLines,0,"\\ No newline at end of file"),(!M&&!$||!P)&&d.push("\\ No newline at end of file")}c.push(C),u=0,f=0,d=[]}h+=E.length,p+=E.length}},g=0;g{this.resolve=e})}selectSuggestion(e,n){if(this.resolve){let r;this.config.allowEmpty&&e===" "?r="":e==="..."?r=void 0:r=e,this.resolve(r)}super.selectSuggestion(e,n)}onClose(){this.resolve&&this.resolve(void 0)}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,n){n.setText(e)}onChooseSuggestion(e,n){}};v();var br=require("obsidian"),cc=class{constructor(e,n){this.plugin=n;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,n){var r;if(this.maybeLog("Read: "+e+JSON.stringify(n)),n=="utf8"||n.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(r=this.index)!=null?r:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,n){if(this.maybeLog("Write: "+e),typeof n=="string"){let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modify(r,n):this.adapter.write(e,n)}else if(e.endsWith(this.gitDir+"/index"))this.index=n,this.indexmtime=Date.now();else{let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modifyBinary(r,n):this.adapter.writeBinary(e,n)}}async readdir(e){e==="."&&(e="/");let n=await this.adapter.list(e),r=[...n.files,...n.folders],i;return e!=="/"?i=r.map(a=>(0,br.normalizePath)(a.substring(e.length))):i=r,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,n){var r,i;return this.adapter.rmdir(e,(i=(r=n==null?void 0:n.options)==null?void 0:r.recursive)!=null?i:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.length,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let r=await this.adapter.stat(e);if(r==null)throw{code:"ENOENT"};return this.indexctime=r.ctime,this.indexmtime=r.mtime,{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let n=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),n instanceof br.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:n.stat.ctime,mtimeMs:n.stat.mtime,size:n.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let r=await this.adapter.stat(e);if(r)return{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:r.type==="folder"?"directory":r.type,isFile:()=>r.type==="file",isDirectory:()=>r.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var pn=class extends ra{constructor(n){super(n);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new cc(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var n,r;return{username:(n=this.plugin.localStorage.getUsername())!=null?n:void 0,password:(r=this.plugin.localStorage.getPassword())!=null?r:void 0}},onAuthFailure:async()=>{new Jr.Notice("Authentication failed. Please try with different credentials");let n=await new ze({placeholder:"Specify your username"}).open();if(n){let r=await new ze({placeholder:"Specify your password/personal access token"}).open();if(r)return this.plugin.localStorage.setUsername(n),this.plugin.localStorage.setPassword(r),{username:n,password:r}}return{cancel:!0}},http:{async request({url:n,method:r,headers:i,body:a}){a&&(a=await gR(a),a=a.buffer);let s=await(0,Jr.requestUrl)({url:n,method:r,headers:i,body:a,throw:!1});return{url:n,method:r,headers:s.headers,body:[new Uint8Array(s.arrayBuffer)],statusCode:s.status,statusMessage:s.status.toString()}}}}}async wrapFS(n){try{let r=await n;return await this.fs.saveAndClear(),r}catch(r){throw await this.fs.saveAndClear(),r}}async status(){let n,r=window.setTimeout(function(){n=new Jr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setState(1);let i=(await this.wrapFS(ie.statusMatrix({...this.getRepo()}))).map(l=>this.getFileStatusResult(l)),a=i.filter(l=>l.working_dir!==" "),s=i.filter(l=>l.index!==" "&&l.index!=="U"),o=[];return window.clearTimeout(r),n==null||n.hide(),{all:i,changed:a,staged:s,conflicted:o}}catch(i){throw window.clearTimeout(r),n==null||n.hide(),this.plugin.displayError(i),i}}async commitAll({message:n,status:r,unstagedFiles:i}){try{return await this.checkAuthorInfo(),await this.stageAll({status:r,unstagedFiles:i}),this.commit({message:n})}catch(a){throw this.plugin.displayError(a),a}}async commit({message:n}){try{await this.checkAuthorInfo(),this.plugin.setState(4);let r=await this.formatCommitMessage(n),i=this.plugin.localStorage.getConflict(),a;if(i){let s=await this.branchInfo();a=[s.current,s.tracking]}await this.wrapFS(ie.commit({...this.getRepo(),message:r,parent:a})),this.plugin.localStorage.setConflict(!1);return}catch(r){throw this.plugin.displayError(r),r}}async stage(n,r){let i=this.getRelativeRepoPath(n,r),a;r?a=n:a=this.getRelativeVaultPath(n);try{this.plugin.setState(3),await this.app.vault.adapter.exists(a)?await this.wrapFS(ie.add({...this.getRepo(),filepath:i})):await this.wrapFS(ie.remove({...this.getRepo(),filepath:i}))}catch(s){throw this.plugin.displayError(s),s}}async stageAll({dir:n,status:r,unstagedFiles:i}){try{if(r)await Promise.all(r.changed.map(a=>a.working_dir!=="D"?this.wrapFS(ie.add({...this.getRepo(),filepath:a.path})):ie.remove({...this.getRepo(),filepath:a.path})));else{let a=i!=null?i:await this.getUnstagedFiles(n!=null?n:".");await Promise.all(a.map(({filepath:s,deleted:o})=>o?ie.remove({...this.getRepo(),filepath:s}):this.wrapFS(ie.add({...this.getRepo(),filepath:s}))))}}catch(a){throw this.plugin.displayError(a),a}}async unstage(n,r){try{this.plugin.setState(3),n=this.getRelativeRepoPath(n,r),await this.wrapFS(ie.resetIndex({...this.getRepo(),filepath:n}))}catch(i){throw this.plugin.displayError(i),i}}async unstageAll({dir:n,status:r}){try{let i;r?i=r.staged.map(a=>a.path):i=(await this.getStagedFiles(n!=null?n:".")).map(({filepath:s})=>s),await this.wrapFS(Promise.all(i.map(a=>ie.resetIndex({...this.getRepo(),filepath:a}))))}catch(i){throw this.plugin.displayError(i),i}}async discard(n){try{this.plugin.setState(3),await this.wrapFS(ie.checkout({...this.getRepo(),filepaths:[n],force:!0}))}catch(r){throw this.plugin.displayError(r),r}}async discardAll({dir:n,status:r}){let i=[];r?n!=null?i=r.changed.filter(a=>a.path.startsWith(n)).map(a=>a.path):i=r.changed.map(a=>a.path):i=(await this.getUnstagedFiles(n)).map(({filepath:a})=>a);try{await this.wrapFS(ie.checkout({...this.getRepo(),filepaths:i,force:!0}))}catch(a){throw this.plugin.displayError(a),a}}getProgressText(n,r){let i=`${n} progress:`;return r.phase&&(i=`${i} ${r.phase}:`),r.loaded&&(i=`${i} ${r.loaded}`,r.total&&(i=`${i} of ${r.total}`)),i}resolveRef(n){return this.wrapFS(ie.resolveRef({...this.getRepo(),ref:n}))}async pull(){let n=this.showNotice("Initializing pull");try{this.plugin.setState(2);let r=await this.resolveRef("HEAD");await this.fetch();let i=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(ie.merge({...this.getRepo(),ours:i.current,theirs:i.tracking,abortOnConflict:!1}))).alreadyMerged||await this.wrapFS(ie.checkout({...this.getRepo(),ref:i.current,onProgress:l=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:i.remote})),n==null||n.hide();let s=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(r,s);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,working_dir:"P",index:"P",vault_path:this.getRelativeVaultPath(l.path)}))}catch(r){throw n==null||n.hide(),r instanceof cs.MergeConflictError&&this.plugin.handleConflict(r.data.filepaths.map(i=>this.getRelativeVaultPath(i))),this.plugin.displayError(r),r}}async push(){if(!await this.canPush())return 0;let n=this.showNotice("Initializing push");try{this.plugin.setState(1);let r=await this.branchInfo(),i=r.tracking,a=r.current,s=(await this.getFileChangesCount(a,i)).length;return this.plugin.setState(5),await this.wrapFS(ie.push({...this.getRepo(),onProgress:o=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Pushing",o))}})),n==null||n.hide(),s}catch(r){throw n==null||n.hide(),this.plugin.displayError(r),r}}async getUnpushedCommits(){let n=await this.branchInfo(),r=n.tracking,i=n.current;if(r==null||i==null)return 0;let a=await this.resolveRef(i),s=await this.resolveRef(r);return(await this.getFileChangesCount(a,s)).length}async canPush(){let n=await this.branchInfo(),r=n.tracking,i=n.current,a=await this.resolveRef(i),s=await this.resolveRef(r);return a!=s}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var n,r;try{let i=await ie.currentBranch(this.getRepo())||"",a=await ie.listBranches(this.getRepo()),s=(n=await this.getConfig(`branch.${i}.remote`))!=null?n:"origin",o=(r=await this.getConfig(`branch.${i}.merge`))==null?void 0:r.split("refs/heads")[1],l=o?s+o:void 0;return{current:i,tracking:l,branches:a,remote:s}}catch(i){throw this.plugin.displayError(i),i}}async getCurrentRemote(){var i;let n=await ie.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${n}.remote`))!=null?i:"origin"}async checkout(n,r){try{return this.wrapFS(ie.checkout({...this.getRepo(),ref:n,force:!!r,remote:r}))}catch(i){throw this.plugin.displayError(i),i}}async createBranch(n){try{await this.wrapFS(ie.branch({...this.getRepo(),ref:n,checkout:!0}))}catch(r){throw this.plugin.displayError(r),r}}async deleteBranch(n){try{await this.wrapFS(ie.deleteBranch({...this.getRepo(),ref:n}))}catch(r){throw this.plugin.displayError(r),r}}async branchIsMerged(n){return!0}async init(){try{await this.wrapFS(ie.init(this.getRepo()))}catch(n){throw this.plugin.displayError(n),n}}async clone(n,r,i){let a=this.showNotice("Initializing clone");try{await this.wrapFS(ie.clone({...this.getRepo(),dir:r,url:n,depth:i,onProgress:s=>{a!==void 0&&(a.noticeEl.innerText=this.getProgressText("Cloning",s))}})),a==null||a.hide()}catch(s){throw a==null||a.hide(),this.plugin.displayError(s),s}}async setConfig(n,r){try{return this.wrapFS(ie.setConfig({...this.getRepo(),path:n,value:r}))}catch(i){throw this.plugin.displayError(i),i}}async getConfig(n){try{return this.wrapFS(ie.getConfig({...this.getRepo(),path:n}))}catch(r){throw this.plugin.displayError(r),r}}async fetch(n){let r=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:a=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Fetching",a))},remote:n!=null?n:await this.getCurrentRemote()};await this.wrapFS(ie.fetch(i)),r==null||r.hide()}catch(i){throw this.plugin.displayError(i),r==null||r.hide(),i}}async setRemote(n,r){try{await this.wrapFS(ie.addRemote({...this.getRepo(),remote:n,url:r,force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async getRemoteBranches(n){let r=[];return r.push(...await this.wrapFS(ie.listBranches({...this.getRepo(),remote:n}))),r.remove("HEAD"),r=r.map(i=>`${n}/${i}`),r}async getRemotes(){return(await this.wrapFS(ie.listRemotes({...this.getRepo()}))).map(n=>n.remote)}async removeRemote(n){await this.wrapFS(ie.deleteRemote({...this.getRepo(),remote:n}))}async getRemoteUrl(n){var r;return(r=(await this.wrapFS(ie.listRemotes({...this.getRepo()}))).filter(i=>i.remote==n)[0])==null?void 0:r.url}async log(n,r=!0,i){let a=await this.wrapFS(ie.log({...this.getRepo(),depth:i}));return Promise.all(a.map(async s=>{let o=s.commit.message.split(` + +`);return{message:o[0],author:{name:s.commit.author.name,email:s.commit.author.email},body:o.slice(1).join(` + +`),date:new Date(s.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(s.commit.parent.first(),s.oid)).map(l=>({path:l.path,status:l.type,vault_path:this.getRelativeVaultPath(l.path),hash:s.oid,binary:void 0}))},hash:s.oid,refs:[]}}))}updateBasePath(n){this.getRepo().dir=n}async updateUpstreamBranch(n){let[r,i]=wr(n),a=await this.branchInfo();await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`),await this.setConfig(`branch.${i}.remote`,r)}updateGitPath(n){}async getFileChangesCount(n,r){return this.walkDifference({walkers:[ie.TREE({ref:n}),ie.TREE({ref:r})]})}async walkDifference({walkers:n,dir:r}){return await this.wrapFS(ie.walk({...this.getRepo(),trees:n,map:async function(a,[s,o]){if(!Vh(a,r))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(n="."){return(await this.walkDifference({walkers:[ie.TREE({ref:"HEAD"}),ie.STAGE()],dir:n})).map(i=>({vault_path:this.getRelativeVaultPath(i.path),filepath:i.path}))}async getUnstagedFiles(n="."){let r,i=window.setTimeout(function(){r=new Jr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(ie.walk({...a,trees:[ie.WORKDIR(),ie.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await ie.isIgnored({...a,filepath:o})||!Vh(o,n))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?p!==h?{filepath:o,deleted:!1}:null:{filepath:o,deleted:!0}}}));return window.clearTimeout(i),r==null||r.hide(),s}catch(a){throw window.clearTimeout(i),r==null||r.hide(),this.plugin.displayError(a),a}}async getDiffString(n,r=!1,i){let a=this.getRelativeVaultPath(n),s=async(c,[u])=>{if(n==c){let f=await u.oid();return(await ie.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await ds({...this.getRepo(),filepath:n,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h}),u=await ie.readCommit({...this.getRepo(),oid:i}),f=await ds({...this.getRepo(),filepath:n,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h});return lc(a,f!=null?f:"",c!=null?c:"")}let o=(await ie.walk({...this.getRepo(),trees:[ie.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(r){let c=await this.resolveRef("HEAD").then(f=>ds({...this.getRepo(),filepath:n,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ie.Errors.NotFoundError))throw f});return lc(a,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(a)?c=await this.app.vault.adapter.read(a):c="",lc(a,l,c)}}async getLastCommitTime(){let n=this.getRepo(),r=await this.resolveRef("HEAD"),a=(await ie.readCommit({...n,oid:r})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(n){let r=this.status_mapping[`${n[this.HEAD]}${n[this.WORKDIR]}${n[this.STAGE]}`];return{index:r[0]=="?"?"U":r[0],working_dir:r[1]=="?"?"U":r[1],path:n[this.FILE],vault_path:this.getRelativeVaultPath(n[this.FILE])}}async checkAuthorInfo(){let n=await this.getConfig("user.name"),r=await this.getConfig("user.email");if(!n||!r)throw"Git author information is not set. Please set it in the settings."}showNotice(n,r=!0){if(!this.plugin.settings.disablePopups)return new Jr.Notice(n,r?this.noticeLength:void 0)}};function hR(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function pR(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:hR(t)}async function mR(t,e){let n=pR(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function gR(t){let e=0,n=[];await mR(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}var yR="https://momentjs.com/docs/#/parsing/string-format/",vR="https://publish.obsidian.md/git-doc/Line+Authoring",uc=class extends z.PluginSettingTab{constructor(n,r){super(n,r);this.plugin=r;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:n}=this,r=this.plugin,i;r.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=r.gitReady;n.empty(),a||(n.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),n.createEl("br"));let s;if(a){new z.Setting(n).setName("Automatic").setHeading(),new z.Setting(n).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(u=>u.setValue(r.settings.differentIntervalCommitAndPush).onChange(f=>{r.settings.differentIntervalCommitAndPush=f,r.saveSettings(),r.automaticsManager.reload("commit","push"),this.display()})),new z.Setting(n).setName(`Auto ${i} interval (minutes)`).setDesc(`${r.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(u=>u.setValue(String(r.settings.autoSaveInterval)).onChange(f=>{isNaN(Number(f))?new z.Notice("Please specify a valid number."):(r.settings.autoSaveInterval=Number(f),r.saveSettings(),r.automaticsManager.reload("commit"),r.settings.autoSaveInterval>0?new z.Notice(`Automatic ${i} enabled! Every ${js(r.settings.autoSaveInterval)}.`):r.settings.autoSaveInterval<=0&&new z.Notice(`Automatic ${i} disabled!`))})),s=new z.Setting(n).setName(`Auto ${i} after stopping file edits`).setDesc(`Requires the ${i} interval not to be 0. + If turned on, do auto ${i} every ${js(r.settings.autoSaveInterval)} after stopping file edits. + This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(u=>u.setValue(r.settings.autoBackupAfterFileChange).onChange(f=>{r.settings.autoBackupAfterFileChange=f,this.display(),r.saveSettings(),r.automaticsManager.reload("commit")})),this.mayDisableSetting(s,r.settings.setLastSaveToLastCommit),s=new z.Setting(n).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(u=>u.setValue(r.settings.setLastSaveToLastCommit).onChange(async f=>{r.settings.setLastSaveToLastCommit=f,r.saveSettings(),r.automaticsManager.reload("commit"),this.display()})),this.mayDisableSetting(s,r.settings.autoBackupAfterFileChange),s=new z.Setting(n).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPushInterval)).onChange(f=>{isNaN(Number(f))?new z.Notice("Please specify a valid number."):(r.settings.autoPushInterval=Number(f),r.saveSettings(),r.settings.autoPushInterval>0?(r.automaticsManager.reload("push"),new z.Notice(`Automatic push enabled! Every ${js(r.settings.autoPushInterval)}.`)):r.settings.autoPushInterval<=0&&new z.Notice("Automatic push disabled!"))})),this.mayDisableSetting(s,!r.settings.differentIntervalCommitAndPush),new z.Setting(n).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPullInterval)).onChange(f=>{isNaN(Number(f))?new z.Notice("Please specify a valid number."):(r.settings.autoPullInterval=Number(f),r.saveSettings(),r.settings.autoPullInterval>0?(r.automaticsManager.reload("pull"),new z.Notice(`Automatic pull enabled! Every ${js(r.settings.autoPullInterval)}.`)):r.settings.autoPullInterval<=0&&new z.Notice("Automatic pull disabled!"))})),new z.Setting(n).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(u=>u.setValue(r.settings.customMessageOnAutoBackup).onChange(f=>{r.settings.customMessageOnAutoBackup=f,r.saveSettings(),this.display()})),s=new z.Setting(n).setName(`Commit message on auto ${i}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.autoCommitMessage).onChange(f=>{r.settings.autoCommitMessage=f,r.saveSettings()})),this.mayDisableSetting(s,r.settings.customMessageOnAutoBackup),new z.Setting(n).setName("Commit message").setHeading(),new z.Setting(n).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.commitMessage?r.settings.commitMessage:"").onChange(f=>{r.settings.commitMessage=f,r.saveSettings()}));let c=new z.Setting(n).setName("{{date}} placeholder format").addMomentFormat(u=>u.setDefaultFormat(r.settings.commitDateFormat).setValue(r.settings.commitDateFormat).onChange(async f=>{r.settings.commitDateFormat=f,await r.saveSettings()}));c.descEl.innerHTML=` + Specify custom date format. E.g. "${Ed}. See Moment.js for more formats.`,new z.Setting(n).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(u=>{var f;return u.setValue((f=r.localStorage.getHostname())!=null?f:"").onChange(async d=>{r.localStorage.setHostname(d)})}),new z.Setting(n).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await r.gitManager.formatCommitMessage(r.settings.commitMessage);new z.Notice(`${f}`)})),new z.Setting(n).setName("List filenames affected by commit in the commit body").addToggle(u=>u.setValue(r.settings.listChangedFilesInMessageBody).onChange(f=>{r.settings.listChangedFilesInMessageBody=f,r.saveSettings()})),new z.Setting(n).setName("Pull").setHeading(),r.gitManager instanceof Oe&&new z.Setting(n).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(u=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};u.addOptions(f),u.setValue(r.settings.syncMethod),u.onChange(async d=>{r.settings.syncMethod=d,r.saveSettings()})}),new z.Setting(n).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(u=>u.setValue(r.settings.autoPullOnBoot).onChange(f=>{r.settings.autoPullOnBoot=f,r.saveSettings()})),new z.Setting(n).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),s=new z.Setting(n).setName("Push on commit-and-sync").setDesc("Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit only. It will still be called commit-and-sync.").addToggle(u=>u.setValue(!r.settings.disablePush).onChange(f=>{r.settings.disablePush=!f,r.saveSettings()})),new z.Setting(n).setName("Pull on commit-and-sync").setDesc("On commit-and-sync, pull commits before pushing. Turning this off turns a commit-and-sync action into commit and push only.").addToggle(u=>u.setValue(r.settings.pullBeforePush).onChange(f=>{r.settings.pullBeforePush=f,r.saveSettings()})),r.gitManager instanceof Oe&&(new z.Setting(n).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new z.Setting(n).setName("History view").setHeading(),new z.Setting(n).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(c=>{let u={hide:"Hide",full:"Full",initials:"Initials"};c.addOptions(u),c.setValue(r.settings.authorInHistoryView),c.onChange(async f=>{r.settings.authorInHistoryView=f,r.saveSettings(),r.refresh()})}),new z.Setting(n).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(c=>c.setValue(r.settings.dateInHistoryView).onChange(u=>{r.settings.dateInHistoryView=u,r.saveSettings(),r.refresh()})),new z.Setting(n).setName("Source control view").setHeading(),new z.Setting(n).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(c=>c.setValue(r.settings.refreshSourceControl).onChange(u=>{r.settings.refreshSourceControl=u,r.saveSettings()})),new z.Setting(n).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>c.setValue(r.settings.refreshSourceControlTimer.toString()).setPlaceholder("7000").onChange(u=>{r.settings.refreshSourceControlTimer=Math.max(parseInt(u),500),r.saveSettings(),r.setRefreshDebouncer()})),new z.Setting(n).setName("Miscellaneous").setHeading(),new z.Setting(n).setName("Disable notifications").setDesc("Disable notifications for git operations to minimize distraction (refer to status bar for updates). Errors are still shown as notifications even if you enable this setting.").addToggle(c=>c.setValue(r.settings.disablePopups).onChange(u=>{r.settings.disablePopups=u,this.display(),r.saveSettings()})),r.settings.disablePopups||new z.Setting(n).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(r.settings.disablePopupsForNoChanges).onChange(u=>{r.settings.disablePopupsForNoChanges=u,r.saveSettings()})),new z.Setting(n).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showStatusBar).onChange(u=>{r.settings.showStatusBar=u,r.saveSettings()})),new z.Setting(n).setName("Show stage/unstage button in file menu").addToggle(c=>c.setValue(r.settings.showFileMenu).onChange(u=>{r.settings.showFileMenu=u,r.saveSettings()})),new z.Setting(n).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showBranchStatusBar).onChange(u=>{r.settings.showBranchStatusBar=u,r.saveSettings()})),new z.Setting(n).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(r.settings.changedFilesInStatusBar).onChange(u=>{r.settings.changedFilesInStatusBar=u,r.saveSettings()})),r.gitManager instanceof pn?new z.Setting(n).setName("Authentication/commit author").setHeading():new z.Setting(n).setName("Commit author").setHeading(),r.gitManager instanceof pn&&new z.Setting(n).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=r.localStorage.getUsername())!=null?u:""),c.onChange(f=>{r.localStorage.setUsername(f)})}),r.gitManager instanceof pn&&new z.Setting(n).setName("Password/Personal access token").setDesc("Type in your password. You won't be able to see it again.").addText(c=>{c.inputEl.autocapitalize="off",c.inputEl.autocomplete="off",c.inputEl.spellcheck=!1,c.onChange(u=>{r.localStorage.setPassword(u)})}),r.gitReady&&new z.Setting(n).setName("Author name for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.name")),c.onChange(u=>{r.gitManager.setConfig("user.name",u==""?void 0:u)})}),r.gitReady&&new z.Setting(n).setName("Author email for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.email")),c.onChange(u=>{r.gitManager.setConfig("user.email",u==""?void 0:u)})}),new z.Setting(n).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be requried for special setups.").setHeading(),r.gitManager instanceof Oe&&(new z.Setting(n).setName("Update submodules").setDesc('"Commit-and-sync" and "pull" takes care of submodules. Missing features: Conflicted files, count of pulled/pushed/committed files. Tracking branch needs to be set for each submodule.').addToggle(c=>c.setValue(r.settings.updateSubmodules).onChange(u=>{r.settings.updateSubmodules=u,r.saveSettings()})),r.settings.updateSubmodules&&new z.Setting(n).setName("Submodule recurse checkout/switch").setDesc("Whenever a checkout happens on the root repository, recurse the checkout on the submodules (if the branches exist).").addToggle(c=>c.setValue(r.settings.submoduleRecurseCheckout).onChange(u=>{r.settings.submoduleRecurseCheckout=u,r.saveSettings()}))),r.gitManager instanceof Oe&&new z.Setting(n).setName("Custom Git binary path").addText(c=>{var u;c.setValue((u=r.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{r.localStorage.setGitPath(f),r.gitManager.updateGitPath(f||"git")})}),r.gitManager instanceof Oe&&new z.Setting(n).setName("Additional environment variables").setDesc("Use each line for a new environment variable in the format KEY=VALUE .").addTextArea(c=>{c.setPlaceholder("GIT_DIR=/path/to/git/dir"),c.setValue(r.localStorage.getEnvVars().join(` +`)),c.onChange(u=>{r.localStorage.setEnvVars(u.split(` +`))})}),r.gitManager instanceof Oe&&new z.Setting(n).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(r.localStorage.getPATHPaths().join(` +`)),c.onChange(u=>{r.localStorage.setPATHPaths(u.split(` +`))})}),r.gitManager instanceof Oe&&new z.Setting(n).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(()=>{r.gitManager.setGitInstance()})}),new z.Setting(n).setName("Custom base path (Git repository path)").setDesc(` + Sets the relative path to the vault from which the Git binary should be executed. + Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows. + `).addText(c=>{c.setValue(r.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(u=>{r.settings.basePath=u,r.saveSettings(),r.gitManager.updateBasePath(u||"")})}),new z.Setting(n).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(r.settings.gitDir),c.setPlaceholder(".git"),c.onChange(u=>{r.settings.gitDir=u,r.saveSettings()})}),new z.Setting(n).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(r.localStorage.getPluginDisabled()).onChange(u=>{r.localStorage.setPluginDisabled(u),u?r.unloadPlugin():r.loadPlugin(),new z.Notice("Obsidian must be restarted for the changes to take affect.")})),new z.Setting(n).setName("Support").setHeading(),new z.Setting(n).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{c.buttonEl.outerHTML="Buy Me a Coffee at ko-fi.com"});let o=n.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=()=>{window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new z.Notice("Debug information copied to clipboard. May contain sensitive information!")},z.Platform.isDesktopApp){let c=n.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging: +You can always see the logs of this and every other plugin by opening the console with`);let u=n.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),z.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(n,r){r&&(n.setDisabled(r),n.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(n){this.settings.lineAuthor.show=n,this.plugin.saveSettings(),n?this.plugin.lineAuthoringFeature.activateFeature():this.plugin.lineAuthoringFeature.deactivateFeature()}lineAuthorSettingHandler(n,r){this.settings.lineAuthor[n]=r,this.plugin.saveSettings(),this.plugin.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let n=this.settings.lineAuthor;n.authorDisplay!=="hide"&&(n.lastShownAuthorDisplay=n.authorDisplay),n.dateTimeFormatOptions!=="hide"&&(n.lastShownDateTimeFormatOptions=n.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let n=new z.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.innerHTML=` + Feature guide and quick examples
+ The commit hash, author name and authoring date can all be individually toggled.
Hide everything, to only show the age-colored sidebar.`,n.addToggle(r=>r.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.display()})),this.settings.lineAuthor.show){let r=new z.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(a=>{a.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),a.setValue(this.settings.lineAuthor.followMovement),a.onChange(s=>this.lineAuthorSettingHandler("followMovement",s))});if(r.descEl.innerHTML=` + By default (deactivated), each line only shows the newest commit where it was changed. +
+ With same commit, cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown. +
+ With all commits, cut-copy-paste-ing text inbetween multiple commits will be detected. +
+ It uses git-blame and + for matches (at least ${vl} characters) within the same (or all) commit(s), the originating commit's information is shown.`,new z.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(async s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new z.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new z.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.display()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new z.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(o=>{this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new z.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=` + The time-zone in which the authoring date should be shown. + Either your local time-zone (default), + the author's time-zone during commit creation or + UTC\xB100:00. + `;let i=new z.Setting(this.containerEl).setName("Oldest age in coloring");i.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],i.addText(a=>{a.setPlaceholder("1y"),a.setValue(this.settings.lineAuthor.coloringMaxAge),a.onChange(s=>{let[o,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new z.Setting(this.containerEl).setName("Text color").addText(a=>{a.setValue(this.settings.lineAuthor.textColorCss),a.onChange(s=>{this.lineAuthorSettingHandler("textColorCss",s)})}).descEl.innerHTML=` + The CSS color of the gutter text.
+ + It is higly recommended to use + + CSS variables + defined by themes + (e.g.
var(--text-muted)
or +
var(--text-on-accent)
, + because they automatically adapt to theme changes.
+ + See: + List of available CSS variables in Obsidian + + `,new z.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(a=>{a.setValue(this.settings.lineAuthor.ignoreWhitespace),a.onChange(s=>this.lineAuthorSettingHandler("ignoreWhitespace",s))}).descEl.innerHTML=` + Whitespace and newlines are interpreted as + part of the document and in changes + by default (hence not ignored). + This makes the last line being shown as 'changed' + when a new subsequent line is added, + even if the previously last line's text is the same. +
+ If you don't care about purely-whitespace changes + (e.g. list nesting / quote indentation changes), + then activating this will provide more meaningful change detection. + `}}createColorSetting(n){let r=new z.Setting(this.containerEl).setName("").addText(i=>{let a=np(n,this.settings.lineAuthor),s=np(n,An.lineAuthor);i.setPlaceholder(Wh(s)),i.setValue(Wh(a)),i.onChange(o=>{let l=J_(o);if(l!==void 0){let c=n==="newest"?"colorNew":"colorOld";this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(n,l)})});this.lineAuthorColorSettings.set(n,r),this.refreshColorSettingsName(n),this.refreshColorSettingsDesc(n,np(n,this.settings.lineAuthor))}refreshColorSettingsName(n){let r=this.lineAuthorColorSettings.get(n);if(r){let i=n==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";r.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(n,r){let i=this.lineAuthorColorSettings.get(n);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(n,this.settings.lineAuthor,r!==void 0))}colorSettingPreviewDescHtml(n,r,i){let a=i?rp(n,r):"rgba(127,127,127,0.3)",s=z.moment.unix(z.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and + named colors (e.g. 'black', 'purple'). Color preview: ${`
${o}
`}`}previewCustomDateTimeDescriptionHtml(n){let r=(0,z.moment)().format(n);return`
Format string to display the authoring date.
Currently: ${r}`}previewOldestAgeDescriptionHtml(n){let r=fc(n);return[`The oldest age in the line author coloring. Everything older will have the same color. +
Smallest valid age is "1d". Currently: ${r!==void 0?`${r.asDays()} days`:"invalid!"}`,r]}};function np(t,e){return t==="oldest"?e.colorOld:e.colorNew}function fc(t){let e=z.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}function gS(t,e,n){if(!(t===void 0||e===void 0||n===void 0))return`head${t}-obj${e}-path${n}`}var yS=dc.Annotation.define();function vS(t,e,n){return n.update({annotations:yS.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}function wR(t){return t.annotation(yS)}var aa=dc.StateField.define({create:t=>{},update:(t,e)=>{var n;return(n=wR(e))!=null?n:bR(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function hc(t){var a;let e=mS.sha256.create();if(!t)return e;let{la:n,key:r,lineOffsetsFromUnsavedChanges:i}=t;e.update(n==="untracked"?"t":"f"),e.update(r);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var rn={get:void 0,save:void 0};function wS(t,e){rn.get=t,rn.save=e}function pc(t){var e,n;return(n=(e=fc(t.coloringMaxAge))==null?void 0:e.asDays())!=null?n:fc(An.lineAuthor.coloringMaxAge).asDays()}function bR(t,e){if(e)return t.changes.empty||t.changes.iterChanges((n,r,i,a)=>{var p;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(n).number,c=s.lineAt(r).number,u=o.lineAt(i).number,f=o.lineAt(a).number,d=c-l+1,h=f-u+1;for(let m=u;m<=f;m++){let g=(p=e.lineOffsetsFromUnsavedChanges.get(m))!=null?p:0,w=f===m,b=h-d;w&&(g+=b),e.lineOffsetsFromUnsavedChanges.set(m,g)}}),e}var ip=class{constructor(e){this.state=e;this.subscribeMe()}async notifyLineAuthoring(e,n){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let r=this.view.state,i=vS(e,n,r);this.view.dispatch(i)}updateToNewState(e){let n=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=e,n&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(ia.ifFilepathDefinedTransformSubscribers(this.filepath,e=>e.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(e){ia.ifFilepathDefinedTransformSubscribers(e,n=>n.delete(this))}get filepath(){var e,n;return(n=(e=this.state.field(mc.editorViewField))==null?void 0:e.file)==null?void 0:n.path}get view(){return this.state.field(mc.editorEditorField)}},xS=bS.StateField.define({create:t=>new ip(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});v();function _S(){sa=void 0,ap=[],gc=0,vc.clear(),wc.clear(),oa.clear()}var sa,yc=()=>sa;function SS(t,e){var i;let n=e.length;if(n<((i=sa==null?void 0:sa.length)!=null?i:0))return;sa={gutter:t,length:n,text:e};let r=rn.get();n!==r.gutterSpacingFallbackLength&&(r.gutterSpacingFallbackLength=n,rn.save(r))}var ap=[],xR=15,gc=0;function ES(t){ap[gc]=t,gc=(gc+1)%xR}function kS(){return tS(ap)}var vc=new Map,wc=new Map,oa=new Set;v();var BS=require("@codemirror/state"),NS=require("@codemirror/view");v();var cp=require("@codemirror/view"),RS=Ve(Zh()),_c=require("obsidian");v();v();var bc={x:-10,y:-10};function AS(){bc.x===-10&&window.addEventListener("mousedown",t=>{bc.x=t.clientX,bc.y=t.clientY})}function TS(){for(let t of oa)if(_R(t,bc))return t}function _R(t,e){let{x:n,y:r,width:i,height:a}=t.getBoundingClientRect();return n<=e.x&&e.x<=n+i&&r<=e.y&&e.y<=r+a}v();var $s={};var CS="data-commit";function FS(t,e,n){if(e.hasFocus())return;let r=TS();if(!r)return;let i=ER(r);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&SR(i,t),sp("showCommitHash",t),sp("authorDisplay",t),sp("dateTimeFormatOptions",t))}function SR(t,e){e.addItem(n=>n.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(r=>navigator.clipboard.writeText(t.hash)))}function sp(t,e){var l,c;let n,r,i=$s.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=An.lineAuthor[t];if(t==="showCommitHash")n="Show commit hash",r=!a;else if(t==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:o;n="Show author "+(s?a:u),r=s?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=i.lastShownDateTimeFormatOptions)!=null?c:o;n="Show "+(s?a:u),n+=n.contains("date")?"":" date",r=s?"hide":u}else vr(t);e.addItem(u=>u.setTitle(n).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var d,h;return(h=(d=$s.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,r)}))}function MS(t,e,n){n.setAttr(CS,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function ER(t){let e=t.getAttr(CS);return e?JSON.parse(e):void 0}v();function rp(t,e){return t==="oldest"?xc(0,!1,e).color:xc(void 0,!0,e).color}function xc(t,e,n){let r=pc(n),i=Date.now()/1e3,a=t!=null?t:0,o=(e?0:i-a)/60/60/24,l=Math.pow(Math.clamp(o/r,0,1),1/2.3),c=kR(),u=n.colorNew,f=n.colorOld,d=c?.4:1,h=op(u.r,f.r,l)*d,p=op(u.g,f.g,l)*d,m=op(u.b,f.b,l)*d;return{color:`rgba(${h},${p},${m},${c?.75:.25})`,daysSinceCommit:o}}function op(t,e,n){return t+(e-t)*n}function kR(){let t=window==null?void 0:window.app;return(t==null?void 0:t.getTheme())==="obsidian"}function OS(t){document.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}v();function IS(t,e,n){let r;for(let i=e;i<=n;i++){let a=t.hashPerLine[i],s=t.commits.get(a);(!r||s.isZeroCommit||AR(s,r))&&(r=s)}return r}function AR(t,e){var i,a,s,o;let n=(a=(i=t.author)==null?void 0:i.epochSeconds)!=null?a:0,r=(o=(s=e.author)==null?void 0:s.epochSeconds)!=null?o:0;return n>r}var PS="-",TR="+",CR=3,FR="*",MR=/\S/g,OR="%",la=class extends cp.GutterMarker{constructor(n){super();this.text=n}eq(n){return this.text===(n==null?void 0:n.text)}toDOM(){return document.createTextNode(this.text)}destroy(n){document.body.contains(n)||n.remove()}},lp=class extends cp.GutterMarker{constructor(n,r,i,a,s,o){super();this.lineAuthoring=n;this.startLine=r;this.endLine=i;this.key=a;this.settings=s;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(n){return this.key===(n==null?void 0:n.key)&&this.startLine===(n==null?void 0:n.startLine)&&this.endLine===(n==null?void 0:n.endLine)&&(this==null?void 0:this.options)===(n==null?void 0:n.options)}toDOM(){var n;return this.precomputedDomProvider=(n=this.precomputedDomProvider)!=null?n:this.computeDom(),this.precomputedDomProvider()}destroy(n){document.body.contains(n)||(n.remove(),oa.delete(n))}computeDom(){let n=IS(this.lineAuthoring,this.startLine,this.endLine),r=n.isZeroCommit?"":this.renderNonZeroCommit(n);return!n.isZeroCommit&&this.options!=="waiting-for-result"?SS(this,r):r=this.adaptTextForFakeCommit(n,r,this.options),this.createHtmlNode(n,r,this.options==="waiting-for-result")}createHtmlNode(n,r,i){var c;let a=window.createDiv();a.innerText=r;let{color:s,daysSinceCommit:o}=xc((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds,n==null?void 0:n.isZeroCommit,this.settings);a.style.backgroundColor=s,MS(n,i,a);function l(){let u=a.cloneNode(!0);return oa.add(u),i||ES(o),u}return l}renderNonZeroCommit(n){let r=this.settings.showCommitHash?this.renderHash(n):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(n,this.settings.authorDisplay)}`,a=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(n,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[r,i,a].filter(o=>o.length>=1).join(" ")}renderHash(n){return n.hash.substring(0,6)}renderAuthorName(n,r){var o,l,c,u;let i=(l=(o=n==null?void 0:n.author)==null?void 0:o.name)!=null?l:"",a=i.split(" ").filter(f=>f.length>=1),s;switch(r){case"initials":s=a.map(f=>f[0].toUpperCase()).join("");break;case"first name":s=(c=a.first())!=null?c:PS;break;case"last name":s=(u=a.last())!=null?u:PS;break;case"full":s=i;break;default:return vr(r)}return nS(n==null?void 0:n.author,n==null?void 0:n.committer)||(s=s+FR),s}renderAuthoringDate(n,r,i,a){var c;let s="?";if(((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds)===void 0)return s;let o;switch(r){case"date":o=yl;break;case"datetime":o=Sd;break;case"custom":o=i;break;case"natural language":o=u=>{let f=u.diff((0,_c.moment)());return _c.moment.duration(f).humanize(!0)};break;default:return vr(r)}let l=_c.moment.unix(n.author.epochSeconds);switch(a){case"viewer-local":break;case"author-local":l=l.utcOffset(n.author.tz),o+=" Z";break;case"utc0000":l=l.utc(),o+="[Z]";break;default:return vr(a)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(n,r,i){var l,c,u,f;let a=(c=(l=yc())==null?void 0:l.text)!=null?c:r,s=i!=="waiting-for-result"&&n.isZeroCommit?TR:OR;r=a.replace(MR,s);let o=(f=(u=rn.get())==null?void 0:u.gutterSpacingFallbackLength)!=null?f:r.length;if(r=rS(r,o,s),i!=="waiting-for-result"&&n.isZeroCommit){let d=Math.min(o,CR);r=iS(r,o-d)}return r}};function ei(t,e,n,r,i,a){let s=RS.sha256.create();s.update(Object.values(i).join(",")),s.update(`s${e}-e${n}-k${r}-o${a}`);let o=s.hex(),l=vc.get(o);if(l)return l;let c=new lp(t,e,n,r,i,a);return vc.set(o,c),c}v();var LS=require("obsidian");function up(){var e,n;let t=(n=(e=rn.get())==null?void 0:e.gutterSpacingFallbackLength)!=null?n:An.lineAuthor.gutterSpacingFallbackLength;return new la(Array(t).fill("-").join(""))}function fp(t){let{lineAuthoring:e,ageForInitialRender:n}=IR(t);return ei(e,1,1,"initialGutter"+n,t,"waiting-for-result")}function IR(t){var a;let e=(a=kS())!=null?a:pc(t)*.25,n=(0,LS.moment)().add(-e,"days"),r={name:"",epochSeconds:eS(n),tz:"+0000"},i={hash:"waiting-for-result",author:r,committer:r,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:e}}v();function jS(t,e){return ei({hashPerLine:[void 0,"000000"],commits:new Map([["000000",cS]])},1,1,t,e)}var dp=new la(""),$S=(0,NS.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(aa,!1);return PR(t,e)},lineMarkerChange(t){let e=hc(t.state.field(aa));return hc(t.startState.field(aa))!==e},renderEmptyElements:!0,initialSpacer:t=>(DS(t),up()),updateSpacer:(t,e)=>{var n,r;return DS(e.view),(r=(n=yc())==null?void 0:n.gutter)!=null?r:up()}});function PR(t,e){let n=hc(e),r=t.state.doc,i=new Map;for(let u=1;u<=r.lines;u++){let f=r.line(u).from,d=t.lineBlockAt(f).to;i.set(u,[f,d]),n.update([f,d,0])}let a=rn.get();n.update("s"+Object.values(rn).join(","));let s=n.hex(),o=wc.get(s);if(o)return o;let{result:l,allowCache:c}=RR(r,i,a,e);return c&&wc.set(s,l),l}function RR(t,e,n,r){let i=!0,a=t.lines,s=[];function o(f,d,h){return s.push(h.range(f,d))}let l=LR(a,r),c=t.length===0,u=t.iterLines(a,a+1).next().value==="";for(let f=1;f<=a;f++){let[d,h]=e.get(f),p=t.lineAt(h).number;if(c){o(d,h,dp);continue}if(f===a&&u){o(d,h,dp);continue}if(r===void 0){o(d,h,fp(n)),i=!1;continue}let{key:m,la:g}=r;if(g==="untracked"){o(d,h,jS(g,n));continue}let w=g.hashPerLine.length-1,b=l[f],x=l[p];if(x&&x>w&&o(d,h,dp),b!==void 0&&qh(1,b,w)&&x!==void 0&&qh(1,x,w)){o(d,h,ei(g,b,x,m,n));continue}if(w<1){o(d,h,fp(n)),i=!1;continue}let E=Math.clamp(b!=null?b:f,1,w),_=Math.clamp(x!=null?x:p,1,w);o(d,h,ei(g,E,_,m+"computing",n,"waiting-for-result"))}return{result:BS.RangeSet.of(s,!0),allowCache:i}}function LR(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),i=>i);let n=[void 0],r=0;for(let i=1;i<=t;i++){let a=e.lineOffsetsFromUnsavedChanges.get(i);r+=a!=null?a:0,n[i]=a===void 0?i-r:void 0}return n}function DS(t){t.dom.querySelectorAll(".cm-gutters").forEach(n=>{n!=null&&n.style&&(n.style.marginLeft||(n.style.marginLeft="unset"))})}var Sc=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){this.trackChangedHelper(e).catch(n=>(console.warn("Git: Error in trackChanged."+n),Promise.reject(n)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}this.computeLineAuthorInfo(e.path)}}destroy(){this.lineAuthorings.clear(),ia.clear(),_S()}async computeLineAuthorInfo(e){let n=this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,r=await n.submoduleAwareHeadRevisonInContainingDirectory(e),i=await n.hashObject(e),a=gS(r,i,e);if(a!==void 0){if(!this.lineAuthorings.has(a)){let s=await n.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(a,s)}this.notifyComputationResultToSubscribers(e,a)}}notifyComputationResultToSubscribers(e,n){ia.ifFilepathDefinedTransformSubscribers(e,async r=>r.forEach(i=>i.notifyLineAuthoring(n,this.lineAuthorings.get(n))))}},US=HS.Prec.high([xS,aa,$S]);var Ec=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{let n=e==null?void 0:e.view,r=n==null?void 0:n.file;if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}r===void 0||(n==null?void 0:n.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),wS(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;OS(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new Sc(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&Hs.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Oe?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(US),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),AS(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var n;return(n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e)})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,n)=>{var r;return e instanceof Hs.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var n;return e instanceof Hs.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",FS)}};v();var kc=class{constructor(){this.tasks=[]}addTask(e){this.tasks.push(e),this.tasks.length===1&&this.handleTask()}async handleTask(){this.tasks.length>0&&this.tasks[0]().finally(()=>{this.tasks.shift(),this.handleTask()})}};v();var Mn=require("obsidian");var Ac=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),addEventListener("git-refresh",this.refreshCommitTimestamp.bind(this))}displayMessage(e,n){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:n}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.iconEl=this.statusBarEl.createDiv(),this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px",this.iconEl.style.float="left"),this.plugin.state){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,Mn.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,Mn.setIcon)(this.iconEl,"refresh-w"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,Mn.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,Mn.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,Mn.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;case 6:this.statusBarEl.ariaLabel="You have conflict files...",(0,Mn.setIcon)(this.iconEl,"alert-circle"),this.statusBarEl.addClass(this.base+"conflict");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Mn.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var n;let e=this.lastCommitTimestamp;if(e){let r=window.moment,i=r(e).fromNow();this.statusBarEl.ariaLabel=`${this.plugin.offlineMode?"Offline: ":""}Last Commit: ${i}`,(n=this.unPushedCommits)!=null&&n&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=this.plugin.offlineMode?"Git is offline":"Git is ready";this.plugin.offlineMode?(0,Mn.setIcon)(this.iconEl,"globe"):(0,Mn.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}};v();var zS=require("obsidian"),Tc=class extends zS.SuggestModal{constructor(n,r){super(n.app);this.fromAutoBackup=r;this.resolve=null;this.plugin=n,this.setPlaceholder("Type your message and select optional the version with the added date.")}open(){return super.open(),new Promise(n=>{this.resolve=n})}onClose(){this.resolve&&this.resolve(void 0)}selectSuggestion(n,r){this.resolve&&this.resolve(n),super.selectSuggestion(n,r)}getSuggestions(n){let r=window.moment().format(this.plugin.settings.commitDateFormat);return n==""&&(n="..."),[n,`${r}: ${n}`,`${n}: ${r}`]}renderSuggestion(n,r){r.innerText=n}onChooseSuggestion(n,r){}};v();var GS=require("obsidian"),Us=class{constructor(e){this.plugin=e}saveLastAuto(e,n){n==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):n==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):n==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,n,r;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((n=this.plugin.localStorage.getLastAutoPull())!=null?n:""),push:new Date((r=this.plugin.localStorage.getLastAutoPush())!=null?r:"")}}async init(){this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let n=new Date,r=this.plugin.settings.autoPushInterval-Math.round((n.getTime()-e.push.getTime())/1e3/60);this.startAutoPush(r<=0?0:r)}if(this.plugin.settings.autoPullInterval>0){let n=new Date,r=this.plugin.settings.autoPullInterval-Math.round((n.getTime()-e.pull.getTime())/1e3/60);this.startAutoPull(r<=0?0:r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.plugin.localStorage.setLastAutoBackup(e.toString())}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let n=new Date,r=this.plugin.settings.autoSaveInterval-Math.round((n.getTime()-e.backup.getTime())/1e3/60);this.startAutoCommitAndSync(r<=0?0:r)}}}startAutoCommitAndSync(e){let n=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,GS.debounce)(()=>this.doAutoCommitAndSync(),n,!0):(n>2147483647&&(n=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),n))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(()=>this.plugin.settings.differentIntervalCommitAndPush?this.plugin.commit({fromAuto:!0}):this.plugin.commitAndSync(!0)),this.saveLastAuto(new Date,"backup"),this.plugin.saveSettings(),this.startAutoCommitAndSync()}startAutoPull(e){let n=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPull=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote()),this.saveLastAuto(new Date,"pull"),this.plugin.saveSettings(),this.startAutoPull()},n)}startAutoPush(e){let n=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPush=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.push()),this.saveLastAuto(new Date,"push"),this.plugin.saveSettings(),this.startAutoPush()},n)}clearAutoCommitAndSync(){var n;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((n=this.plugin.autoCommitDebouncer)==null||n.cancel(),this.plugin.autoCommitDebouncer=void 0,e=!0),e}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPush=void 0,!0):!1}};v();var Gs=require("obsidian");v();var zs=require("obsidian");async function VS(t,e,n){let r=await qS(e,n);if(r.result==="failure"){new zs.Notice(r.reason);return}let{isGitHub:i,branch:a,repo:s,user:o,filePath:l}=r;if(i){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}-L${u}`)}else new zs.Notice("It seems like you are not using GitHub")}async function WS(t,e){let n=await qS(t,e);if(n.result==="failure"){new zs.Notice(n.reason);return}let{isGitHub:r,branch:i,repo:a,user:s,filePath:o}=n;r?window.open(`https://github.com/${s}/${a}/commits/${i}/${o}`):new zs.Notice("It seems like you are not using GitHub")}async function qS(t,e){let n=await e.branchInfo(),r=n.tracking,i=n.current,a,s=e.getRelativeRepoPath(t.path);if(e instanceof Oe){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){s=l.relativeFilepath;let c=await e.git.cwd({path:l.submodule,root:!1}).status();if(r=c.tracking||void 0,i=c.current||void 0,r){let u=r.substring(0,r.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)a=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(r==null)return{result:"failure",reason:"Remote branch is not configured"};if(i==null)return{result:"failure",reason:"Failed to get current branch name"};if(a==null){let l=r.substring(0,r.indexOf("/"));if(a=await e.getConfig(`remote.${l}.url`),a==null)return{result:"failure",reason:"Failed to get remote url"}}let o=a.match(/(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/);if(o==null)return{result:"failure",reason:"Could not parse remote url"};{let[l,c,u,f,d]=o;return{result:"success",isGitHub:!!l,repo:u||d,user:c||f,branch:i,filePath:s}}}v();var XS=require("obsidian"),Cc=class extends XS.FuzzySuggestModal{constructor(e,n){super(e.app),this.plugin=e,this.changedFiles=n,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.working_dir=="U")return`Untracked | ${e.vault_path}`;let n="",r="";return e.working_dir!=" "&&(n=`Working Dir: ${e.working_dir} `),e.index!=" "&&(r=`Index: ${e.index}`),`${n}${r} | ${e.vault_path}`}onChooseItem(e,n){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vault_path,"")==null?this.app.openWithDefaultApp(e.vault_path):this.plugin.app.workspace.openLinkText(e.vault_path,"/")}};v();var YS=require("obsidian"),Fc=class extends YS.Modal{constructor(n,r){super(n);this.content=r;this.resolve=null}open(){return super.open(),new Promise(n=>{this.resolve=n})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText("Edit .gitignore");let i=n.createDiv(),a=i.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});i.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",async()=>{this.resolve(a.value),this.close()})}onClose(){let{contentEl:n}=this;this.resolve(void 0),n.empty()}};function ZS(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let n=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(n)||e.vault.adapter.write(n,"");let r=await e.vault.adapter.read(n),a=await new Fc(e,r).open();a!==void 0&&(await e.vault.adapter.write(n,a),t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(ht.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:ht.type})):r=n.first(),e.workspace.revealLeaf(r)}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(fn.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:fn.type})):r=n.first(),e.workspace.revealLeaf(r)}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:n=>{var i;let r=e.workspace.getActiveFile();if(n)return r!==null;(i=qt())==null||i.setViewState({type:Tt.type,active:!0,state:{staged:!1,file:t.gitManager.getRelativeRepoPath(r.path,!0)}})}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(n,{file:r})=>{if(r)return VS(n,r,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(n,{file:r})=>{if(r)return WS(r,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to gitignore",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.addFileToGitignore(r)}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync(!1),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1,!0))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:!0}))}),Gs.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Commit Amend",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.stageFile(r))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.unstageFile(r))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:async()=>t.editRemotes()}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:async()=>t.removeRemote()}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:async()=>t.setUpstreamBranch()}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new ze({options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? plugin action cannot be undone.",onlySelection:!0}).open()==="YES"&&(await e.vault.adapter.rmdir(`${t.settings.basePath}/.git`,!0),new Gs.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),t.init()):new Gs.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:async()=>t.createNewRepo()}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:async()=>t.cloneNewRepo()}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(!await t.isAllInitialized())return;let n=await t.gitManager.status();if(console.log(n),t.setState(0),n.changed.length+n.staged.length>500){t.displayError("Too many changes to display");return}new Cc(t,n.all).open()}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch()}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch()}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch()}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{if(!await t.isAllInitialized())return!1;await new ze({options:["NO","YES"],placeholder:"Do you want to discard all changes to tracked files? plugin action cannot be undone.",onlySelection:!0}).open()==="YES"&&t.promiseQueue.addTask(()=>t.discardAll())}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var n;return(n=t.settingsTab)==null?void 0:n.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}})}v();var Mc=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":"}migrate(){let e=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let n of e){let r=localStorage.getItem(this.prefix+n);app.loadLocalStorage(this.prefix+n)==null&&r!=null&&r!=null&&(app.saveLocalStorage(this.prefix+n,r),localStorage.removeItem(this.prefix+n))}}getPassword(){return app.loadLocalStorage(this.prefix+"password")}setPassword(e){return app.saveLocalStorage(this.prefix+"password",e)}getUsername(){return app.loadLocalStorage(this.prefix+"username")}setUsername(e){return app.saveLocalStorage(this.prefix+"username",e)}getHostname(){return app.loadLocalStorage(this.prefix+"hostname")}setHostname(e){return app.saveLocalStorage(this.prefix+"hostname",e)}getConflict(){return app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(e){return app.saveLocalStorage(this.prefix+"conflict",`${e}`)}getLastAutoPull(){return app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(e){return app.saveLocalStorage(this.prefix+"lastAutoPull",e)}getLastAutoBackup(){return app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(e){return app.saveLocalStorage(this.prefix+"lastAutoBackup",e)}getLastAutoPush(){return app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(e){return app.saveLocalStorage(this.prefix+"lastAutoPush",e)}getGitPath(){return app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(e){return app.saveLocalStorage(this.prefix+"gitPath",e)}getPATHPaths(){var e,n;return(n=(e=app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?n:[]}setPATHPaths(e){return app.saveLocalStorage(this.prefix+"PATHPaths",e.join(":"))}getEnvVars(){var e;return JSON.parse((e=app.loadLocalStorage(this.prefix+"envVars"))!=null?e:"[]")}setEnvVars(e){return app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(e))}getPluginDisabled(){return app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(e){return app.saveLocalStorage(this.prefix+"pluginDisabled",`${e}`)}};v();v();v();v();var De;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(De||(De={}));var KS={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},QS={LINES:"lines",WORDS:"words",NONE:"none"},JS={WORD:"word",CHAR:"char"},ti;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(ti||(ti={}));v();var jR=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],DR=RegExp("["+jR.join("\\")+"]","g");function eE(t){return t.replace(DR,"\\$&")}function hp(t){return t&&t.replace(/\\/g,"/")}function tE(t){let e,n,r,i=0;for(e=0,r=t.length;e1?n[n.length-1]:e}function rE(t,e){return e.reduce((n,r)=>n||t.startsWith(r),!1)}var iE=["a/","b/","i/","w/","c/","o/"];function xr(t,e,n){let r=n!==void 0?[...iE,n]:iE,i=e?new RegExp(`^${eE(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=r.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function BR(t,e){return xr(t,"---",e)}function NR(t,e){return xr(t,"+++",e)}function aE(t,e={}){let n=[],r=null,i=null,a=null,s=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,m=/^deleted file mode (\d{6})/,g=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,x=/^rename from "?(.+)"?/,E=/^rename to "?(.+)"?/,_=/^similarity index (\d+)%/,T=/^dissimilarity index (\d+)%/,y=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,k=/^GIT binary patch/,C=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,M=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,P=/^new file mode (\d{6})/,$=/^deleted file mode (\d{6}),(\d{6})/,j=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function Q(){i!==null&&r!==null&&(r.blocks.push(i),i=null)}function le(){r!==null&&(!r.oldName&&l!==null&&(r.oldName=l),!r.newName&&c!==null&&(r.newName=c),r.newName&&(n.push(r),r=null)),l=null,c=null}function de(){Q(),le(),r={blocks:[],deletedLines:0,addedLines:0}}function re(H){Q();let U;r!==null&&((U=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(H))?(r.isCombined=!1,a=parseInt(U[1],10),o=parseInt(U[2],10)):(U=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(H))?(r.isCombined=!0,a=parseInt(U[1],10),s=parseInt(U[2],10),o=parseInt(U[3],10)):(H.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,r.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:H}}function Ae(H){if(r===null||i===null||a===null||o===null)return;let U={content:H},D=r.isCombined?["+ "," +","++"]:["+"],se=r.isCombined?["- "," -","--"]:["-"];rE(H,D)?(r.addedLines++,U.type=De.INSERT,U.oldNumber=void 0,U.newNumber=o++):rE(H,se)?(r.deletedLines++,U.type=De.DELETE,U.oldNumber=a++,U.newNumber=void 0):(U.type=De.CONTEXT,U.oldNumber=a++,U.newNumber=o++),i.lines.push(U)}function he(H,U){let D=U;for(;D{if(!H||H.startsWith("*"))return;let D,se=j[U-1],_e=j[U+1],mt=j[U+2];if(H.startsWith("diff --git")||H.startsWith("diff --combined")){if(de(),(D=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(H))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isGitDiff=!0;return}if(H.startsWith("Binary files")&&!(r!=null&&r.isGitDiff)){if(de(),(D=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(H))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isBinary=!0;return}if((!r||!r.isGitDiff&&r&&H.startsWith(u)&&_e.startsWith(f)&&mt.startsWith(d))&&de(),r!=null&&r.isTooBig)return;if(r&&(typeof e.diffMaxChanges=="number"&&r.addedLines+r.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&H.length>e.diffMaxLineLength)){r.isTooBig=!0,r.addedLines=0,r.deletedLines=0,r.blocks=[],i=null;let Te=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(n.length):"Diff too big to be displayed";re(Te);return}if(H.startsWith(u)&&_e.startsWith(f)||H.startsWith(f)&&se.startsWith(u)){if(r&&!r.oldName&&H.startsWith("--- ")&&(D=BR(H,e.srcPrefix))){r.oldName=D,r.language=nE(r.oldName,r.language);return}if(r&&!r.newName&&H.startsWith("+++ ")&&(D=NR(H,e.dstPrefix))){r.newName=D,r.language=nE(r.newName,r.language);return}}if(r&&(H.startsWith(d)||r.isGitDiff&&r.oldName&&r.newName&&!i)){re(H);return}if(i&&(H.startsWith("+")||H.startsWith("-")||H.startsWith(" "))){Ae(H);return}let X=!he(H,U);if(r===null)throw new Error("Where is my file !!!");(D=h.exec(H))?r.oldMode=D[1]:(D=p.exec(H))?r.newMode=D[1]:(D=m.exec(H))?(r.deletedFileMode=D[1],r.isDeleted=!0):(D=g.exec(H))?(r.newFileMode=D[1],r.isNew=!0):(D=w.exec(H))?(X&&(r.oldName=D[1]),r.isCopy=!0):(D=b.exec(H))?(X&&(r.newName=D[1]),r.isCopy=!0):(D=x.exec(H))?(X&&(r.oldName=D[1]),r.isRename=!0):(D=E.exec(H))?(X&&(r.newName=D[1]),r.isRename=!0):(D=S.exec(H))?(r.isBinary=!0,r.oldName=xr(D[1],void 0,e.srcPrefix),r.newName=xr(D[2],void 0,e.dstPrefix),re("Binary file")):k.test(H)?(r.isBinary=!0,re(H)):(D=_.exec(H))?r.unchangedPercentage=parseInt(D[1],10):(D=T.exec(H))?r.changedPercentage=parseInt(D[1],10):(D=y.exec(H))?(r.checksumBefore=D[1],r.checksumAfter=D[2],D[3]&&(r.mode=D[3])):(D=C.exec(H))?(r.checksumBefore=[D[2],D[3]],r.checksumAfter=D[1]):(D=M.exec(H))?(r.oldMode=[D[2],D[3]],r.newMode=D[1]):(D=P.exec(H))?(r.newFileMode=D[1],r.isNew=!0):(D=$.exec(H))&&(r.deletedFileMode=D[1],r.isDeleted=!0)}),Q(),le(),n}v();v();v();function qn(){}qn.prototype={diff:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.callback;typeof r=="function"&&(i=r,r={}),this.options=r;var a=this;function s(m){return i?(setTimeout(function(){i(void 0,m)},0),!0):m}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var o=n.length,l=e.length,c=1,u=o+l;r.maxEditLength&&(u=Math.min(u,r.maxEditLength));var f=[{newPos:-1,components:[]}],d=this.extractCommon(f[0],n,e,0);if(f[0].newPos+1>=o&&d+1>=l)return s([{value:this.join(n),count:n.length}]);function h(){for(var m=-1*c;m<=c;m+=2){var g=void 0,w=f[m-1],b=f[m+1],x=(b?b.newPos:0)-m;w&&(f[m-1]=void 0);var E=w&&w.newPos+1=o&&x+1>=l)return s(HR(a,g.components,n,e,a.useLongestToken));f[m]=g}c++}if(i)(function m(){setTimeout(function(){if(c>u)return i();h()||m()},0)})();else for(;c<=u;){var p=h();if(p)return p}},pushComponent:function(e,n,r){var i=e[e.length-1];i&&i.added===n&&i.removed===r?e[e.length-1]={count:i.count+1,added:n,removed:r}:e.push({count:1,added:n,removed:r})},extractCommon:function(e,n,r,i){for(var a=n.length,s=r.length,o=e.newPos,l=o-i,c=0;o+1h.length?m:h}),c.value=t.join(u)}else c.value=t.join(n.slice(o,o+c.count));o+=c.count,c.added||(l+=c.count)}}var d=e[s-1];return s>1&&typeof d.value=="string"&&(d.added||d.removed)&&t.equals("",d.value)&&(e[s-2].value+=d.value,e.pop()),e}function UR(t){return{newPos:t.newPos,components:t.components.slice(0)}}var zR=new qn;function lE(t,e,n){return zR.diff(t,e,n)}var sE=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,oE=/\S/,gp=new qn;gp.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!oE.test(t)&&!oE.test(e)};gp.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n{let r=t(e).trim(),i=t(n).trim();return XR(r,i)/(r.length+i.length)}}function ua(t){function e(r,i,a=new Map){let s=1/0,o;for(let l=0;l0||o.indexB>0)&&(x=g.concat(x)),(r.length>d||i.length>h)&&(x=x.concat(b)),x}return n}var pt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},ni={matching:QS.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:JS.WORD,colorScheme:ti.LIGHT},On="/",fE=ca(t=>t.value),YR=ua(fE);function vp(t){return t.indexOf("dev/null")!==-1}function ZR(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function KR(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function fa(t){switch(t){case De.CONTEXT:return pt.CONTEXT;case De.INSERT:return pt.INSERTS;case De.DELETE:return pt.DELETES}}function da(t){switch(t){case ti.DARK:return"d2h-dark-color-scheme";case ti.AUTO:return"d2h-auto-color-scheme";case ti.LIGHT:default:return"d2h-light-color-scheme"}}function QR(t){return t?2:1}function _r(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function an(t,e,n=!0){let r=QR(e);return{prefix:t.substring(0,r),content:n?_r(t.substring(r)):t.substring(r)}}function ri(t){let e=hp(t.oldName),n=hp(t.newName);if(e!==n&&!vp(e)&&!vp(n)){let r=[],i=[],a=e.split(On),s=n.split(On),o=a.length,l=s.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&a[u]===s[f];)i.unshift(s[f]),u-=1,f-=1;let d=r.join(On),h=i.join(On),p=a.slice(c,u+1).join(On),m=s.slice(c,f+1).join(On);return d.length&&h.length?d+On+"{"+p+" \u2192 "+m+"}"+On+h:d.length?d+On+"{"+p+" \u2192 "+m+"}":h.length?"{"+p+" \u2192 "+m+"}"+On+h:e+" \u2192 "+n}else return vp(n)?e:n}function ha(t){return`d2h-${tE(ri(t)).toString().slice(-6)}`}function pa(t){let e="file-changed";return t.isRename||t.isCopy?e="file-renamed":t.isNew?e="file-added":t.isDeleted?e="file-deleted":t.newName!==t.oldName&&(e="file-renamed"),e}function Ic(t,e,n,r={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},ni),r),l=an(t,n,!1),c=an(e,n,!1);if(l.content.length>a||c.content.length>a)return{oldLine:{prefix:l.prefix,content:_r(l.content)},newLine:{prefix:c.prefix,content:_r(c.content)}};let u=o==="char"?lE(l.content,c.content):cE(l.content,c.content),f=[];if(o==="word"&&i==="words"){let h=u.filter(g=>g.removed),p=u.filter(g=>g.added);YR(p,h).forEach(g=>{g[0].length===1&&g[1].length===1&&fE(g[0][0],g[1][0]){let m=p.added?"ins":p.removed?"del":null,g=f.indexOf(p)>-1?' class="d2h-change"':"",w=_r(p.value);return m!==null?`${h}<${m}${g}>${w}`:`${h}${w}`},"");return{oldLine:{prefix:l.prefix,content:ZR(d)},newLine:{prefix:c.prefix,content:KR(d)}}}var dE="file-summary",JR="icon",eL={colorScheme:ni.colorScheme},Pc=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},eL),n)}render(e){let n=e.map(r=>this.hoganUtils.render(dE,"line",{fileHtmlId:ha(r),oldName:r.oldName,newName:r.newName,fileName:ri(r),deletedLines:"-"+r.deletedLines,addedLines:"+"+r.addedLines},{fileIcon:this.hoganUtils.template(JR,pa(r))})).join(` +`);return this.hoganUtils.render(dE,"wrapper",{colorScheme:da(this.config.colorScheme),filesNumber:e.length,files:n})}};v();var bp=Object.assign(Object.assign({},ni),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ws="generic",hE="line-by-line",tL="icon",nL="tag",qs=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},bp),n)}render(e){let n=e.map(r=>{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` +`);return this.hoganUtils.render(Ws,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(hE,"file-diff"),i=this.hoganUtils.template(Ws,"file-path"),a=this.hoganUtils.template(tL,"file"),s=this.hoganUtils.template(nL,pa(e));return r.render({file:e,fileHtmlId:ha(e),diffs:n,filePath:i.render({fileDiffName:ri(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(Ws,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:pt})}generateFileHtml(e){let n=ua(ca(r=>an(r.content,e.isCombined).content));return e.blocks.map(r=>{let i=this.hoganUtils.render(Ws,"block-header",{CSSLineClass:pt,blockHeader:e.isTooBig?r.header:_r(r.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=an(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:pt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(` +`)}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===De.CONTEXT?n.push([[s],[],[]]):s.type===De.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===De.INSERT&&r.length>0?i.push(s):s.type===De.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` +`);return this.hoganUtils.render(Xs,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(rL,"file-diff"),i=this.hoganUtils.template(Xs,"file-path"),a=this.hoganUtils.template(iL,"file"),s=this.hoganUtils.template(aL,pa(e));return r.render({file:e,fileHtmlId:ha(e),diffs:n,filePath:i.render({fileDiffName:ri(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Xs,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:pt})}}generateFileHtml(e){let n=ua(ca(r=>an(r.content,e.isCombined).content));return e.blocks.map(r=>{let i={left:this.makeHeaderHtml(r.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=an(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:pt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:pt.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((r,i)=>({left:r.left+i.left,right:r.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===De.CONTEXT?n.push([[s],[],[]]):s.type===De.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===De.INSERT&&r.length>0?i.push(s):s.type===De.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(r.rp("'),r.b(r.v(r.f("fileName",t,e,0))),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(r.v(r.f("addedLines",t,e,0))),r.b(""),r.b(` +`+n),r.b(' '),r.b(r.v(r.f("deletedLines",t,e,0))),r.b(""),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{"'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' Files changed ('),r.b(r.v(r.f("filesNumber",t,e,0))),r.b(")"),r.b(` +`+n),r.b(' hide'),r.b(` +`+n),r.b(' show'),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
    '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("files",t,e,0))),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-block-header"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
'),r.s(r.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),r.s(r.f("blockHeader",t,e,1),t,e,1,0,0,"")||r.b(" "),r.b("
"),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-empty-diff"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(" File without changes"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-file-path"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(''),r.b(` +`+n),r.b(r.rp("'),r.b(r.v(r.f("fileDiffName",t,e,0))),r.b(""),r.b(` +`+n),r.b(r.rp(""),r.b(` +`+n),r.b('"),r.fl()},partials:{""),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("lineNumber",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.s(r.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("prefix",i,a,0))),s.b(""),s.b(` +`+n)}),t.pop()),r.s(r.f("prefix",t,e,1),t,e,1,0,0,"")||(r.b('  '),r.b(` +`+n)),r.s(r.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("content",i,a,0))),s.b(""),s.b(` +`+n)}),t.pop()),r.s(r.f("content",t,e,1),t,e,1,0,0,"")||(r.b('
'),r.b(` +`+n)),r.b("
"),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b(""),r.fl()},partials:{},subs:{}});Xe["generic-wrapper"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("content",t,e,0))),r.b(` +`+n),r.b("
"),r.fl()},partials:{},subs:{}});Xe["icon-file-added"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file-changed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file-deleted"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file-renamed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["icon-file"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});Xe["line-by-line-file-diff"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("diffs",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.fl()},partials:{},subs:{}});Xe["line-by-line-numbers"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(r.v(r.f("oldNumber",t,e,0))),r.b("
"),r.b(` +`+n),r.b('
'),r.b(r.v(r.f("newNumber",t,e,0))),r.b("
"),r.fl()},partials:{},subs:{}});Xe["side-by-side-file-diff"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.d("diffs.left",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b('
'),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(' '),r.b(` +`+n),r.b(" "),r.b(r.t(r.d("diffs.right",t,e,0))),r.b(` +`+n),r.b(" "),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.b(` +`+n),r.b("
"),r.fl()},partials:{},subs:{}});Xe["tag-file-added"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('ADDED'),r.fl()},partials:{},subs:{}});Xe["tag-file-changed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('CHANGED'),r.fl()},partials:{},subs:{}});Xe["tag-file-deleted"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('DELETED'),r.fl()},partials:{},subs:{}});Xe["tag-file-renamed"]=new tt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('RENAMED'),r.fl()},partials:{},subs:{}});var Zs=class{constructor({compiledTemplates:e={},rawTemplates:n={}}){let r=Object.entries(n).reduce((i,[a,s])=>{let o=kp.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Xe),e),r)}static compile(e){return kp.compile(e,{asString:!1})}render(e,n,r,i,a){let s=this.templateKey(e,n);try{return this.preCompiledTemplates[s].render(r,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,n){return this.preCompiledTemplates[this.templateKey(e,n)]}templateKey(e,n){return`${e}-${n}`}};var oL=Object.assign(Object.assign(Object.assign({},bp),xp),{outputFormat:KS.LINE_BY_LINE,drawFileList:!0});function yE(t,e={}){let n=Object.assign(Object.assign({},oL),e),r=typeof t=="string"?aE(t,n):t,i=new Zs(n),{colorScheme:a}=n,s={colorScheme:a},o=n.drawFileList?new Pc(i,s).render(r):"",l=n.outputFormat==="side-by-side"?new Ys(i,n).render(r):new qs(i,n).render(r);return o+l}var Lc=require("obsidian");var ma=class extends Lc.ItemView{constructor(n,r){super(n);this.plugin=r;this.gettingDiff=!1;this.gitRefreshBind=this.refresh.bind(this);this.gitViewRefreshBind=this.refresh.bind(this);this.parser=new DOMParser,this.navigation=!0,addEventListener("git-refresh",this.gitRefreshBind),addEventListener("git-view-refresh",this.gitViewRefreshBind)}getViewType(){return Tt.type}getDisplayText(){var n;if(((n=this.state)==null?void 0:n.file)!=null){let r=this.state.file.split("/").last();return r!=null&&r.endsWith(".md")&&(r=r.slice(0,-3)),Tt.name+` (${r})`}return Tt.name}getIcon(){return Tt.icon}async setState(n,r){this.state=n,Lc.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return removeEventListener("git-refresh",this.gitRefreshBind),removeEventListener("git-view-refresh",this.gitViewRefreshBind),super.onClose()}onOpen(){return this.refresh(),super.onOpen()}async refresh(){var n;if((n=this.state)!=null&&n.file&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let r=await this.plugin.gitManager.getDiffString(this.state.file,this.state.staged,this.state.hash);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.file);if(!r){if(this.plugin.gitManager instanceof Oe&&await this.plugin.gitManager.isTracked(this.state.file))r=[`--- ${this.state.file}`,`+++ ${this.state.file}`,""].join(` +`);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);r=[...`--- /dev/null ++++ ${this.state.file} +@@ -0,0 +1,${a.split(` +`).length} @@`.split(` +`),...a.split(` +`).map(o=>`+${o}`)].join(` +`)}}if(r){let a=this.parser.parseFromString(yE(r),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(a)}else{let a=this.contentEl.createDiv({cls:"obsidian-git-center"});a.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),a.createEl("br"),a.createSpan({text:"File not found: "+this.state.file})}}finally{this.gettingDiff=!1}}}};v();var ZE=require("obsidian");v();v();v();v();function Fe(){}var Ks=t=>t;function Ap(t){return t()}function jc(){return Object.create(null)}function Se(t){t.forEach(Ap)}function ga(t){return typeof t=="function"}function ut(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function vE(t){return Object.keys(t).length===0}v();var wE=typeof window!="undefined",Tp=wE?()=>window.performance.now():()=>Date.now(),Qs=wE?t=>requestAnimationFrame(t):Fe;v();var ya=new Set;function bE(t){ya.forEach(e=>{e.c(t)||(ya.delete(e),e.f())}),ya.size!==0&&Qs(bE)}function Cp(t){let e;return ya.size===0&&Qs(bE),{promise:new Promise(n=>{ya.add(e={c:t,f:n})}),abort(){ya.delete(e)}}}v();v();v();v();var Fp=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Dc=class t{constructor(e){ot(this,"_listeners","WeakMap"in Fp?new WeakMap:void 0);ot(this,"_observer");ot(this,"options");this.options=e}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(n=>{var r;for(let i of n)t.entries.set(i.target,i),(r=this._listeners.get(i.target))==null||r(i)})}};Dc.entries="WeakMap"in Fp?new WeakMap:void 0;var xE=!1;function _E(){xE=!0}function SE(){xE=!1}function O(t,e){t.appendChild(e)}function jt(t,e,n){let r=Bc(t);if(!r.getElementById(e)){let i=R("style");i.id=e,i.textContent=n,kE(r,i)}}function Bc(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function EE(t){let e=R("style");return e.textContent="/* empty */",kE(Bc(t),e),e.sheet}function kE(t,e){return O(t.head||t,e),e.sheet}function ae(t,e,n){t.insertBefore(e,n||null)}function ne(t){t.parentNode&&t.parentNode.removeChild(t)}function sn(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function be(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function A(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function AE(t){return Array.from(t.childNodes)}function Ie(t,e){e=""+e,t.data!==e&&(t.data=e)}function Mp(t,e){t.value=e==null?"":e}function Xt(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function oe(t,e,n){t.classList.toggle(e,!!n)}function Nc(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function TE(t){let e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}var $c=new Map,Hc=0;function cL(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function uL(t,e){let n={stylesheet:EE(e),rules:{}};return $c.set(t,n),n}function Uc(t,e,n,r,i,a,s,o=0){let l=16.666/r,c=`{ +`;for(let g=0;g<=1;g+=l){let w=e+(n-e)*a(g);c+=g*100+`%{${s(w,1-w)}} +`}let u=c+`100% {${s(n,1-n)}} +}`,f=`__svelte_${cL(u)}_${o}`,d=Bc(t),{stylesheet:h,rules:p}=$c.get(d)||uL(d,t);p[f]||(p[f]=!0,h.insertRule(`@keyframes ${f} ${u}`,h.cssRules.length));let m=t.style.animation||"";return t.style.animation=`${m?`${m}, `:""}${f} ${r}ms linear ${i}ms 1 both`,Hc+=1,f}function Op(t,e){let n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Hc-=i,Hc||fL())}function fL(){Qs(()=>{Hc||($c.forEach(t=>{let{ownerNode:e}=t.stylesheet;e&&ne(e)}),$c.clear())})}v();v();v();v();var Sr;function Xn(t){Sr=t}function CE(){if(!Sr)throw new Error("Function called outside component initialization");return Sr}function Js(t){CE().$$.on_destroy.push(t)}function Er(t,e){let n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}var ii=[];var Pe=[],wa=[],FE=[],dL=Promise.resolve(),Pp=!1;function ME(){Pp||(Pp=!0,dL.then(zc))}function wt(t){wa.push(t)}var Ip=new Set,va=0;function zc(){if(va!==0)return;let t=Sr;do{try{for(;vat.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),wa=e}var eo;function pL(){return eo||(eo=Promise.resolve(),eo.then(()=>{eo=null})),eo}function Rp(t,e,n){t.dispatchEvent(Nc(`${e?"intro":"outro"}${n}`))}var Gc=new Set,Yn;function Ee(){Yn={r:0,c:[],p:Yn}}function ke(){Yn.r||Se(Yn.c),Yn=Yn.p}function G(t,e){t&&t.i&&(Gc.delete(t),t.i(e))}function Z(t,e,n,r){if(t&&t.o){if(Gc.has(t))return;Gc.add(t),Yn.c.push(()=>{Gc.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}var mL={duration:0};function bt(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,l=null,c=null,u;function f(){c&&Op(t,c)}function d(p,m){let g=p.b-s;return m*=Math.abs(g),{a:s,b:p.b,d:g,duration:m,start:p.start,end:p.start+m,group:p.group}}function h(p){let{delay:m=0,duration:g=300,easing:w=Ks,tick:b=Fe,css:x}=a||mL,E={start:Tp()+m,b:p};p||(E.group=Yn,Yn.r+=1),"inert"in t&&(p?u!==void 0&&(t.inert=u):(u=t.inert,t.inert=!0)),o||l?l=E:(x&&(f(),c=Uc(t,s,p,g,m,w,x)),p&&b(0,1),o=d(E,g),wt(()=>Rp(t,p,"start")),Cp(_=>{if(l&&_>l.start&&(o=d(l,g),l=null,Rp(t,o.b,"start"),x&&(f(),c=Uc(t,s,o.b,o.duration,0,w,a.css))),o){if(_>=o.end)b(s=o.b,1-s),Rp(t,o.b,"end"),l||(o.b?f():--o.group.r||Se(o.group.c)),o=null;else if(_>=o.start){let T=_-o.start;s=o.a+o.d*w(T/o.duration),b(s,1-s)}}return!!(o||l)}))}return{run(p){ga(a)?pL().then(()=>{a=a({direction:p?"in":"out"}),h(p)}):h(p)},end(){f(),o=l=null}}}v();function Ye(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}v();v();v();var gL=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],yL=new Set([...gL]);v();v();function nt(t){t&&t.c()}function Ke(t,e,n){let{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),wt(()=>{let a=t.$$.on_mount.map(Ap).filter(ga);t.$$.on_destroy?t.$$.on_destroy.push(...a):Se(a),t.$$.on_mount=[]}),i.forEach(wt)}function Qe(t,e){let n=t.$$;n.fragment!==null&&(OE(n.after_update),Se(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function wL(t,e){t.$$.dirty[0]===-1&&(ii.push(t),ME(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let p=h.length?h[0]:d;return c.ctx&&i(c.ctx[f],c.ctx[f]=p)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](p),u&&wL(t,f)),d}):[],c.update(),u=!0,Se(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){_E();let f=AE(e.target);c.fragment&&c.fragment.l(f),f.forEach(ne)}else c.fragment&&c.fragment.c();e.intro&&G(t.$$.fragment),Ke(t,e.target,e.anchor),SE(),zc()}Xn(l)}var bL;typeof HTMLElement=="function"&&(bL=class extends HTMLElement{constructor(e,n,r){super();ot(this,"$$ctor");ot(this,"$$s");ot(this,"$$c");ot(this,"$$cn",!1);ot(this,"$$d",{});ot(this,"$$r",!1);ot(this,"$$p_d",{});ot(this,"$$l",{});ot(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(e,n,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(n),this.$$c){let i=this.$$c.$on(e,n);this.$$l_u.set(n,i)}super.addEventListener(e,n,r)}removeEventListener(e,n,r){if(super.removeEventListener(e,n,r),this.$$c){let i=this.$$l_u.get(n);i&&(i(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(a){return()=>{let s;return{c:function(){s=R("slot"),a!=="default"&&A(s,"name",a)},m:function(c,u){ae(c,s,u)},d:function(c){c&&ne(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let n={},r=TE(this);for(let a of this.$$s)a in r&&(n[a]=[e(a)]);for(let a of this.attributes){let s=this.$$g_p(a.name);s in this.$$d||(this.$$d[s]=Lp(s,a.value,this.$$p_d,"toProp"))}for(let a in this.$$p_d)!(a in this.$$d)&&this[a]!==void 0&&(this.$$d[a]=this[a],delete this[a]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$scope:{ctx:[]}}});let i=()=>{this.$$r=!0;for(let a in this.$$p_d)if(this.$$d[a]=this.$$c.$$.ctx[this.$$c.$$.props[a]],this.$$p_d[a].reflect){let s=Lp(a,this.$$d[a],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,s)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(let a in this.$$l)for(let s of this.$$l[a]){let o=this.$$c.$on(a,s);this.$$l_u.set(s,o)}this.$$l={}}}attributeChangedCallback(e,n,r){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Lp(e,r,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(n=>this.$$p_d[n].attribute===e||!this.$$p_d[n].attribute&&n.toLowerCase()===e)||e}});function Lp(t,e,n,r){var a;let i=(a=n[t])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Ze=class{constructor(){ot(this,"$$");ot(this,"$$set")}$destroy(){Qe(this,1),this.$destroy=Fe}$on(e,n){if(!ga(n))return Fe;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!vE(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};v();v();var IE="4";v();typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(IE);v();function ba(t,e,n,r){function i(a){return a instanceof n?a:new n(function(s){s(a)})}return new(n||(n=Promise))(function(a,s){function o(u){try{c(r.next(u))}catch(f){s(f)}}function l(u){try{c(r.throw(u))}catch(f){s(f)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((r=r.apply(t,e||[])).next())})}var qc=require("obsidian");v();v();var to=require("obsidian");v();v();function PE(t){let e=t-1;return e*e*e+1}function xt(t,{delay:e=0,duration:n=400,easing:r=PE,axis:i="y"}={}){let a=getComputedStyle(t),s=+a.opacity,o=i==="y"?"height":"width",l=parseFloat(a[o]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),f=parseFloat(a[`padding${u[0]}`]),d=parseFloat(a[`padding${u[1]}`]),h=parseFloat(a[`margin${u[0]}`]),p=parseFloat(a[`margin${u[1]}`]),m=parseFloat(a[`border${u[0]}Width`]),g=parseFloat(a[`border${u[1]}Width`]);return{delay:e,duration:n,easing:r,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${o}: ${w*l}px;padding-${c[0]}: ${w*f}px;padding-${c[1]}: ${w*d}px;margin-${c[0]}: ${w*h}px;margin-${c[1]}: ${w*p}px;border-${c[0]}-width: ${w*m}px;border-${c[1]}-width: ${w*g}px;`}}v();var xa=require("obsidian");function xL(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function RE(t){let e,n,r;return{c(){e=R("div"),A(e,"data-icon","go-to-file"),A(e,"aria-label","Open File"),A(e,"class","clickable-icon")},m(i,a){ae(i,e,a),t[7](e),n||(r=[te(e,"auxclick",be(t[4])),te(e,"click",be(t[4]))],n=!0)},p:Fe,d(i){i&&ne(e),t[7](null),n=!1,Se(r)}}}function _L(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof xa.TFile,u,f,d=t[0].status+"",h,p,m,g,w,b,x=c&&RE(t);return{c(){var E,_;e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("div"),x&&x.c(),u=J(),f=R("span"),h=Ce(d),A(r,"class","tree-item-inner nav-file-title-content"),A(l,"class","buttons"),A(f,"class","type"),A(f,"data-type",p=t[0].status),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",m=t[0].vault_path),A(n,"data-tooltip-position",t[3]),A(n,"aria-label",g=t[0].vault_path),oe(n,"is-active",((E=t[1].plugin.lastDiffViewState)==null?void 0:E.file)==t[0].vault_path&&((_=t[1].plugin.lastDiffViewState)==null?void 0:_.hash)),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(E,_){ae(E,e,_),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),x&&x.m(l,null),O(o,u),O(o,f),O(f,h),w||(b=[te(e,"click",be(t[5])),te(e,"auxclick",be(t[8])),te(e,"focus",t[6])],w=!0)},p(E,[_]){var T,y;_&1&&i!==(i=Lt(E[0].vault_path)+"")&&Ie(a,i),_&3&&(c=E[1].app.vault.getAbstractFileByPath(E[0].vault_path)instanceof xa.TFile),c?x?x.p(E,_):(x=RE(E),x.c(),x.m(l,null)):x&&(x.d(1),x=null),_&1&&d!==(d=E[0].status+"")&&Ie(h,d),_&1&&p!==(p=E[0].status)&&A(f,"data-type",p),_&1&&m!==(m=E[0].vault_path)&&A(n,"data-path",m),_&8&&A(n,"data-tooltip-position",E[3]),_&1&&g!==(g=E[0].vault_path)&&A(n,"aria-label",g),_&3&&oe(n,"is-active",((T=E[1].plugin.lastDiffViewState)==null?void 0:T.file)==E[0].vault_path&&((y=E[1].plugin.lastDiffViewState)==null?void 0:y.hash))},i:Fe,o:Fe,d(E){E&&ne(e),x&&x.d(),w=!1,Se(b)}}}function SL(t,e,n){let r,{diff:i}=e,{view:a}=e,s=[];window.setTimeout(()=>s.forEach(d=>(0,xa.setIcon)(d,d.getAttr("data-icon"))),0);function o(d){var h;let p=a.app.vault.getAbstractFileByPath(i.vault_path);p instanceof xa.TFile&&((h=qt(d))===null||h===void 0||h.openFile(p))}function l(d){var h;(h=qt(d))===null||h===void 0||h.setViewState({type:Tt.type,active:!0,state:{file:i.path,staged:!1,hash:i.hash}})}function c(d){Er.call(this,t,d)}function u(d){Pe[d?"unshift":"push"](()=>{s[0]=d,n(2,s)})}let f=d=>{d.button==2?Fn(a.app,d,i.vault_path,a.leaf,"git-history"):l(d)};return t.$$set=d=>{"diff"in d&&n(0,i=d.diff),"view"in d&&n(1,a=d.view)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,r,o,l,c,u,f]}var jp=class extends Ze{constructor(e){super(),ft(this,e,SL,_L,ut,{diff:0,view:1},xL)}},Vc=jp;v();function EL(t){jt(t,"svelte-1lnl15d","main.svelte-1lnl15d .nav-folder-title-content.svelte-1lnl15d{display:flex;align-items:center}")}function LE(t,e,n){let r=t.slice();return r[8]=e[n],r}function kL(t){let e,n,r,i,a,s,o,l=t[8].title+"",c,u,f,d,h,p,m;function g(){return t[7](t[8])}let w=!t[4][t[8].title]&&jE(t);return{c(){e=R("div"),n=R("div"),r=R("div"),i=J(),a=R("div"),a.innerHTML='',s=J(),o=R("div"),c=Ce(l),f=J(),w&&w.c(),d=J(),A(r,"data-icon","folder"),Xt(r,"padding-right","5px"),Xt(r,"display","flex"),A(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(a,"is-collapsed",t[4][t[8].title]),A(o,"class","tree-item-inner nav-folder-title-content svelte-1lnl15d"),A(n,"class","tree-item-self is-clickable nav-folder-title"),A(n,"data-tooltip-position",t[5]),A(n,"aria-label",u=t[8].vaultPath),A(e,"class","tree-item nav-folder"),oe(e,"is-collapsed",t[4][t[8].title])},m(b,x){ae(b,e,x),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,f),w&&w.m(e,null),O(e,d),h=!0,p||(m=te(n,"click",g),p=!0)},p(b,x){t=b,(!h||x&17)&&oe(a,"is-collapsed",t[4][t[8].title]),(!h||x&1)&&l!==(l=t[8].title+"")&&Ie(c,l),(!h||x&32)&&A(n,"data-tooltip-position",t[5]),(!h||x&1&&u!==(u=t[8].vaultPath))&&A(n,"aria-label",u),t[4][t[8].title]?w&&(Ee(),Z(w,1,1,()=>{w=null}),ke()):w?(w.p(t,x),x&17&&G(w,1)):(w=jE(t),w.c(),G(w,1),w.m(e,d)),(!h||x&17)&&oe(e,"is-collapsed",t[4][t[8].title])},i(b){h||(G(w),h=!0)},o(b){Z(w),h=!1},d(b){b&&ne(e),w&&w.d(),p=!1,m()}}}function AL(t){let e,n,r,i;return n=new Vc({props:{diff:t[8].data,view:t[2]}}),{c(){e=R("div"),nt(n.$$.fragment),r=J()},m(a,s){ae(a,e,s),Ke(n,e,null),O(e,r),i=!0},p(a,s){let o={};s&1&&(o.diff=a[8].data),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(G(n.$$.fragment,a),i=!0)},o(a){Z(n.$$.fragment,a),i=!1},d(a){a&&ne(e),Qe(n)}}}function jE(t){let e,n,r,i;return n=new Wc({props:{hierarchy:t[8],plugin:t[1],view:t[2]}}),{c(){e=R("div"),nt(n.$$.fragment),A(e,"class","tree-item-children nav-folder-children")},m(a,s){ae(a,e,s),Ke(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[8]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(G(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){Z(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Qe(n),a&&r&&r.end()}}}function DE(t){let e,n,r,i,a=[AL,kL],s=[];function o(l,c){return l[8].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=In()},m(l,c){s[e].m(l,c),ae(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ee(),Z(s[u],1,1,()=>{s[u]=null}),ke(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),G(n,1),n.m(r.parentNode,r))},i(l){i||(G(n),i=!0)},o(l){Z(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function TL(t){let e,n,r=Ye(t[0].children),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){e=R("main");for(let s=0;sc(f);return t.$$set=f=>{"hierarchy"in f&&n(0,i=f.hierarchy),"plugin"in f&&n(1,a=f.plugin),"view"in f&&n(2,s=f.view),"topLevel"in f&&n(3,o=f.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(5,r=s.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,o,l,r,c,u]}var Wc=class extends Ze{constructor(e){super(),ft(this,e,CL,TL,ut,{hierarchy:0,plugin:1,view:2,topLevel:3},EL)}},BE=Wc;function NE(t,e,n){let r=t.slice();return r[9]=e[n],r}function $E(t){let e,n=t[0].refs.join(", ")+"",r;return{c(){e=R("div"),r=Ce(n),A(e,"class","git-ref")},m(i,a){ae(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[0].refs.join(", ")+"")&&Ie(r,n)},d(i){i&&ne(e)}}}function HE(t){let e,n=t[7](t[0])+"",r;return{c(){e=R("div"),r=Ce(n),A(e,"class","git-author")},m(i,a){ae(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[7](i[0])+"")&&Ie(r,n)},d(i){i&&ne(e)}}}function UE(t){let e,n=(0,to.moment)(t[0].date).format(t[3].settings.commitDateFormat)+"",r;return{c(){e=R("div"),r=Ce(n),A(e,"class","git-date")},m(i,a){ae(i,e,a),O(e,r)},p(i,a){a&9&&n!==(n=(0,to.moment)(i[0].date).format(i[3].settings.commitDateFormat)+"")&&Ie(r,n)},d(i){i&&ne(e)}}}function zE(t){let e,n,r,i,a,s=[ML,FL],o=[];function l(c,u){return c[2]?0:1}return n=l(t,-1),r=o[n]=s[n](t),{c(){e=R("div"),r.c(),A(e,"class","tree-item-children nav-folder-children")},m(c,u){ae(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function FL(t){let e,n,r=Ye(t[0].diff.files),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s0&&$E(t),x=t[3].settings.authorInHistoryView!="hide"&&((T=t[0].author)==null?void 0:T.name)&&HE(t),E=t[3].settings.dateInHistoryView&&UE(t),_=!t[4]&&zE(t);return{c(){var y;e=R("main"),n=R("div"),r=R("div"),i=R("div"),i.innerHTML='',a=J(),s=R("div"),b&&b.c(),o=J(),x&&x.c(),l=J(),E&&E.c(),c=J(),u=R("div"),d=Ce(f),p=J(),_&&_.c(),A(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(i,"is-collapsed",t[4]),A(u,"class","tree-item-inner nav-folder-title-content"),A(r,"class","tree-item-self is-clickable nav-folder-title"),A(r,"aria-label",h=`${t[0].refs.length>0?t[0].refs.join(", ")+` +`:""}${(y=t[0].author)==null?void 0:y.name} +${(0,to.moment)(t[0].date).format(t[3].settings.commitDateFormat)} +${t[0].message}`),A(r,"data-tooltip-position",t[5]),A(n,"class","tree-item nav-folder"),oe(n,"is-collapsed",t[4])},m(y,S){ae(y,e,S),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),b&&b.m(s,null),O(s,o),x&&x.m(s,null),O(s,l),E&&E.m(s,null),O(s,c),O(s,u),O(u,d),O(n,p),_&&_.m(n,null),m=!0,g||(w=te(r,"click",t[8]),g=!0)},p(y,[S]){var k,C;(!m||S&16)&&oe(i,"is-collapsed",y[4]),y[0].refs.length>0?b?b.p(y,S):(b=$E(y),b.c(),b.m(s,o)):b&&(b.d(1),b=null),y[3].settings.authorInHistoryView!="hide"&&((k=y[0].author)!=null&&k.name)?x?x.p(y,S):(x=HE(y),x.c(),x.m(s,l)):x&&(x.d(1),x=null),y[3].settings.dateInHistoryView?E?E.p(y,S):(E=UE(y),E.c(),E.m(s,c)):E&&(E.d(1),E=null),(!m||S&1)&&f!==(f=y[0].message+"")&&Ie(d,f),(!m||S&9&&h!==(h=`${y[0].refs.length>0?y[0].refs.join(", ")+` +`:""}${(C=y[0].author)==null?void 0:C.name} +${(0,to.moment)(y[0].date).format(y[3].settings.commitDateFormat)} +${y[0].message}`))&&A(r,"aria-label",h),(!m||S&32)&&A(r,"data-tooltip-position",y[5]),y[4]?_&&(Ee(),Z(_,1,1,()=>{_=null}),ke()):_?(_.p(y,S),S&16&&G(_,1)):(_=zE(y),_.c(),G(_,1),_.m(n,null)),(!m||S&16)&&oe(n,"is-collapsed",y[4])},i(y){m||(G(_),m=!0)},o(y){Z(_),m=!1},d(y){y&&ne(e),b&&b.d(),x&&x.d(),E&&E.d(),_&&_.d(),g=!1,w()}}}function IL(t,e,n){let r,i,{log:a}=e,{view:s}=e,{showTree:o}=e,{plugin:l}=e,c=!0;function u(d){let h=d.author.name;if(l.settings.authorInHistoryView=="full")return h;if(l.settings.authorInHistoryView=="initials")return h.split(" ").filter(m=>m.length>0).map(m=>m[0].toUpperCase()).join("")}let f=()=>n(4,c=!c);return t.$$set=d=>{"log"in d&&n(0,a=d.log),"view"in d&&n(1,s=d.view),"showTree"in d&&n(2,o=d.showTree),"plugin"in d&&n(3,l=d.plugin)},t.$$.update=()=>{t.$$.dirty&9&&n(6,r={title:"",path:"",vaultPath:"",children:l.gitManager.getTreeStructure(a.diff.files)}),t.$$.dirty&2&&n(5,i=s.leaf.getRoot().side=="left"?"right":"left")},[a,s,o,l,c,i,r,u,f]}var Dp=class extends Ze{constructor(e){super(),ft(this,e,IL,OL,ut,{log:0,view:1,showTree:2,plugin:3})}},VE=Dp;function WE(t,e,n){let r=t.slice();return r[11]=e[n],r}function qE(t){let e,n,r=Ye(t[6]),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){e=R("div");for(let s=0;s{d=null}),ke())},i(h){c||(G(d),c=!0)},o(h){Z(d),c=!1},d(h){h&&ne(e),t[7](null),t[9](null),d&&d.d(),u=!1,Se(f)}}}function RL(){dispatchEvent(new CustomEvent("git-refresh"))}function LL(t,e,n){let{plugin:r}=e,{view:i}=e,a,s=[],o,l=r.settings.treeStructure,c;addEventListener("git-view-refresh",u),u(),r.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{s.forEach(p=>(0,qc.setIcon)(p,p.getAttr("data-icon"))),(0,qc.setIcon)(c,l?"list":"folder")},0)}),Js(()=>{removeEventListener("git-view-refresh",u)});function u(){return ba(this,void 0,void 0,function*(){if(!r.gitReady){n(6,o=void 0);return}n(4,a=!0);let p=r.gitManager instanceof Oe;n(6,o=yield r.gitManager.log(void 0,!1,p?50:10)),n(4,a=!1)})}function f(p){Pe[p?"unshift":"push"](()=>{c=p,n(3,c)})}let d=()=>{n(2,l=!l),n(0,r.settings.treeStructure=l,r),r.saveSettings()};function h(p){Pe[p?"unshift":"push"](()=>{s[6]=p,n(5,s)})}return t.$$set=p=>{"plugin"in p&&n(0,r=p.plugin),"view"in p&&n(1,i=p.view)},t.$$.update=()=>{t.$$.dirty&12&&c&&(c.empty(),(0,qc.setIcon)(c,l?"list":"folder"))},[r,i,l,c,a,s,o,f,d,h]}var Bp=class extends Ze{constructor(e){super(),ft(this,e,LL,PL,ut,{plugin:0,view:1})}},YE=Bp;var no=class extends ZE.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return fn.type}getDisplayText(){return fn.name}getIcon(){return fn.icon}onClose(){return super.onClose()}onOpen(){return this._view=new YE({target:this.contentEl,props:{plugin:this.plugin,view:this}}),super.onOpen()}};v();var KE=require("obsidian"),Xc=class extends KE.FuzzySuggestModal{constructor(n){super(app);this.branches=n;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(n){return n}onChooseItem(n,r){this.resolve(n)}open(){return super.open(),new Promise(n=>{this.resolve=n})}async onClose(){await new Promise(n=>setTimeout(n,10)),this.resolve&&this.resolve(void 0)}};v();var wk=require("obsidian");v();var Ea=require("obsidian");v();var QE=require("obsidian"),kr=class extends QE.Modal{constructor(n,r,i){super(n);this.deletion=r;this.filename=i;this.resolve=null}myOpen(){return this.open(),new Promise(n=>{this.resolve=n})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText(`${this.deletion?"Delete":"Discard"} this file?`),n.createEl("p").setText(`Do you really want to ${this.deletion?"delete":"discard the changes of"} "${this.filename}"`);let i=n.createDiv({cls:"modal-button-container"}),a=i.createEl("button",{cls:"mod-warning",text:this.deletion?"Delete":"Discard"});a.addEventListener("click",async()=>{this.resolve&&this.resolve(!0),this.close()}),a.addEventListener("keypress",async()=>{this.resolve&&this.resolve(!0),this.close()});let s=i.createEl("button",{text:"Cancel"});s.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),s.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:n}=this;n.empty()}};v();var _a=require("obsidian");v();v();var jL=Ve(JE()),Ar=require("obsidian");function ai(t,e,n){let r=t.target;app.workspace.trigger("hover-link",{event:t,source:e.getViewType(),hoverParent:e,targetEl:r,linktext:n})}function DL(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function ek(t){let e,n,r;return{c(){e=R("div"),A(e,"data-icon","go-to-file"),A(e,"aria-label","Open File"),A(e,"class","clickable-icon")},m(i,a){ae(i,e,a),t[11](e),n||(r=[te(e,"auxclick",be(t[5])),te(e,"click",be(t[5]))],n=!0)},p:Fe,d(i){i&&ne(e),t[11](null),n=!1,Se(r)}}}function BL(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof _a.TFile,u,f,d,h,p,m,g=t[0].working_dir+"",w,b,x,E,_,T,y=c&&ek(t);return{c(){var S,k,C;e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("div"),y&&y.c(),u=J(),f=R("div"),d=J(),h=R("div"),p=J(),m=R("div"),w=Ce(g),A(r,"class","tree-item-inner nav-file-title-content"),A(f,"data-icon","undo"),A(f,"aria-label","Discard"),A(f,"class","clickable-icon"),A(h,"data-icon","plus"),A(h,"aria-label","Stage"),A(h,"class","clickable-icon"),A(l,"class","buttons"),A(m,"class","type"),A(m,"data-type",b=t[0].working_dir),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",x=t[0].vault_path),A(n,"data-tooltip-position",t[3]),A(n,"aria-label",E=t[0].vault_path),oe(n,"is-active",((S=t[1].plugin.lastDiffViewState)==null?void 0:S.file)==t[0].vault_path&&!((k=t[1].plugin.lastDiffViewState)!=null&&k.hash)&&!((C=t[1].plugin.lastDiffViewState)!=null&&C.staged)),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(S,k){ae(S,e,k),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),y&&y.m(l,null),O(l,u),O(l,f),t[12](f),O(l,d),O(l,h),t[13](h),O(o,p),O(o,m),O(m,w),_||(T=[te(f,"click",be(t[8])),te(h,"click",be(t[6])),te(e,"mouseover",t[4]),te(e,"click",be(t[7])),te(e,"auxclick",be(t[14])),te(e,"focus",t[10])],_=!0)},p(S,[k]){var C,M,P;k&1&&i!==(i=Lt(S[0].vault_path)+"")&&Ie(a,i),k&3&&(c=S[1].app.vault.getAbstractFileByPath(S[0].vault_path)instanceof _a.TFile),c?y?y.p(S,k):(y=ek(S),y.c(),y.m(l,u)):y&&(y.d(1),y=null),k&1&&g!==(g=S[0].working_dir+"")&&Ie(w,g),k&1&&b!==(b=S[0].working_dir)&&A(m,"data-type",b),k&1&&x!==(x=S[0].vault_path)&&A(n,"data-path",x),k&8&&A(n,"data-tooltip-position",S[3]),k&1&&E!==(E=S[0].vault_path)&&A(n,"aria-label",E),k&3&&oe(n,"is-active",((C=S[1].plugin.lastDiffViewState)==null?void 0:C.file)==S[0].vault_path&&!((M=S[1].plugin.lastDiffViewState)!=null&&M.hash)&&!((P=S[1].plugin.lastDiffViewState)!=null&&P.staged))},i:Fe,o:Fe,d(S){S&&ne(e),y&&y.d(),t[12](null),t[13](null),_=!1,Se(T)}}}function NL(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(b=>(0,_a.setIcon)(b,b.getAttr("data-icon"))),0);function l(b){a.app.vault.getAbstractFileByPath(i.vault_path)&&ai(b,a,i.vault_path)}function c(b){var x;let E=a.app.vault.getAbstractFileByPath(i.vault_path);E instanceof _a.TFile&&((x=qt(b))===null||x===void 0||x.openFile(E))}function u(){s.stage(i.path,!1).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})}function f(b){var x;(x=qt(b))===null||x===void 0||x.setViewState({type:Tt.type,active:!0,state:{file:i.path,staged:!1}})}function d(){let b=i.working_dir=="U";new kr(a.app,b,i.vault_path).myOpen().then(x=>{x===!0&&(b?a.app.vault.adapter.remove(i.vault_path).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))}):s.discard(i.path).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))}))})}function h(b){Er.call(this,t,b)}function p(b){Pe[b?"unshift":"push"](()=>{o[1]=b,n(2,o)})}function m(b){Pe[b?"unshift":"push"](()=>{o[0]=b,n(2,o)})}function g(b){Pe[b?"unshift":"push"](()=>{o[2]=b,n(2,o)})}let w=b=>{b.button==2?Fn(a.app,b,i.vault_path,a.leaf,"git-source-control"):f(b)};return t.$$set=b=>{"change"in b&&n(0,i=b.change),"view"in b&&n(1,a=b.view),"manager"in b&&n(9,s=b.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,d,s,h,p,m,g,w]}var $p=class extends Ze{constructor(e){super(),ft(this,e,NL,BL,ut,{change:0,view:1,manager:9},DL)}},Yc=$p;v();var tk=require("obsidian");function $L(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function HL(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[0].working_dir+"",u,f,d,h,p,m;return{c(){e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("span"),u=Ce(c),A(r,"class","tree-item-inner nav-file-title-content"),A(l,"class","type"),A(l,"data-type",f=t[0].working_dir),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",d=t[0].vault_path),A(n,"data-tooltip-position",t[2]),A(n,"aria-label",h=t[0].vault_path),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(g,w){ae(g,e,w),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),O(l,u),p||(m=[te(e,"mouseover",t[3]),te(e,"click",be(t[4])),te(e,"auxclick",be(t[6])),te(e,"focus",t[5])],p=!0)},p(g,[w]){w&1&&i!==(i=Lt(g[0].vault_path)+"")&&Ie(a,i),w&1&&c!==(c=g[0].working_dir+"")&&Ie(u,c),w&1&&f!==(f=g[0].working_dir)&&A(l,"data-type",f),w&1&&d!==(d=g[0].vault_path)&&A(n,"data-path",d),w&4&&A(n,"data-tooltip-position",g[2]),w&1&&h!==(h=g[0].vault_path)&&A(n,"aria-label",h)},i:Fe,o:Fe,d(g){g&&ne(e),p=!1,Se(m)}}}function UL(t,e,n){let r,{change:i}=e,{view:a}=e;function s(u){app.vault.getAbstractFileByPath(i.vault_path)&&ai(u,a,i.vault_path)}function o(u){var f;let d=a.app.vault.getAbstractFileByPath(i.vault_path);d instanceof tk.TFile&&((f=qt(u))===null||f===void 0||f.openFile(d))}function l(u){Er.call(this,t,u)}let c=u=>{u.button==2?Fn(a.app,u,i.vault_path,a.leaf,"git-source-control"):o(u)};return t.$$set=u=>{"change"in u&&n(0,i=u.change),"view"in u&&n(1,a=u.view)},t.$$.update=()=>{t.$$.dirty&2&&n(2,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,r,s,o,l,c]}var Hp=class extends Ze{constructor(e){super(),ft(this,e,UL,HL,ut,{change:0,view:1},$L)}},Zc=Hp;v();var Sa=require("obsidian");function zL(t){jt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function nk(t){let e,n,r;return{c(){e=R("div"),A(e,"data-icon","go-to-file"),A(e,"aria-label","Open File"),A(e,"class","clickable-icon")},m(i,a){ae(i,e,a),t[10](e),n||(r=te(e,"click",be(t[5])),n=!0)},p:Fe,d(i){i&&ne(e),t[10](null),n=!1,r()}}}function GL(t){let e,n,r,i=Lt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof Sa.TFile,u,f,d,h,p=t[0].index+"",m,g,w,b,x,E,_=c&&nk(t);return{c(){var T,y,S;e=R("main"),n=R("div"),r=R("div"),a=Ce(i),s=J(),o=R("div"),l=R("div"),_&&_.c(),u=J(),f=R("div"),d=J(),h=R("div"),m=Ce(p),A(r,"class","tree-item-inner nav-file-title-content"),A(f,"data-icon","minus"),A(f,"aria-label","Unstage"),A(f,"class","clickable-icon"),A(l,"class","buttons"),A(h,"class","type"),A(h,"data-type",g=t[0].index),A(o,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),A(n,"data-path",w=t[0].vault_path),A(n,"data-tooltip-position",t[3]),A(n,"aria-label",b=t[0].vault_path),oe(n,"is-active",((T=t[1].plugin.lastDiffViewState)==null?void 0:T.file)==t[0].vault_path&&!((y=t[1].plugin.lastDiffViewState)!=null&&y.hash)&&((S=t[1].plugin.lastDiffViewState)==null?void 0:S.staged)),A(e,"class","tree-item nav-file svelte-1wbh8tp")},m(T,y){ae(T,e,y),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),_&&_.m(l,null),O(l,u),O(l,f),t[11](f),O(o,d),O(o,h),O(h,m),x||(E=[te(f,"click",be(t[7])),te(e,"mouseover",t[4]),te(e,"focus",t[9]),te(e,"click",be(t[6])),te(e,"auxclick",be(t[12]))],x=!0)},p(T,[y]){var S,k,C;y&1&&i!==(i=Lt(T[0].vault_path)+"")&&Ie(a,i),y&3&&(c=T[1].app.vault.getAbstractFileByPath(T[0].vault_path)instanceof Sa.TFile),c?_?_.p(T,y):(_=nk(T),_.c(),_.m(l,u)):_&&(_.d(1),_=null),y&1&&p!==(p=T[0].index+"")&&Ie(m,p),y&1&&g!==(g=T[0].index)&&A(h,"data-type",g),y&1&&w!==(w=T[0].vault_path)&&A(n,"data-path",w),y&8&&A(n,"data-tooltip-position",T[3]),y&1&&b!==(b=T[0].vault_path)&&A(n,"aria-label",b),y&3&&oe(n,"is-active",((S=T[1].plugin.lastDiffViewState)==null?void 0:S.file)==T[0].vault_path&&!((k=T[1].plugin.lastDiffViewState)!=null&&k.hash)&&((C=T[1].plugin.lastDiffViewState)==null?void 0:C.staged))},i:Fe,o:Fe,d(T){T&&ne(e),_&&_.d(),t[11](null),x=!1,Se(E)}}}function VL(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(g=>(0,Sa.setIcon)(g,g.getAttr("data-icon"))),0);function l(g){a.app.vault.getFileByPath(i.vault_path)&&ai(g,a,i.vault_path)}function c(g){var w;let b=a.app.vault.getAbstractFileByPath(i.vault_path);b instanceof Sa.TFile&&((w=qt(g))===null||w===void 0||w.openFile(b))}function u(g){var w;(w=qt(g))===null||w===void 0||w.setViewState({type:Tt.type,active:!0,state:{file:i.path,staged:!0}})}function f(){s.unstage(i.path,!1).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})}function d(g){Er.call(this,t,g)}function h(g){Pe[g?"unshift":"push"](()=>{o[1]=g,n(2,o)})}function p(g){Pe[g?"unshift":"push"](()=>{o[0]=g,n(2,o)})}let m=g=>{g.button==2?Fn(a.app,g,i.vault_path,a.leaf,"git-source-control"):u(g)};return t.$$set=g=>{"change"in g&&n(0,i=g.change),"view"in g&&n(1,a=g.view),"manager"in g&&n(8,s=g.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,s,d,h,p,m]}var Up=class extends Ze{constructor(e){super(),ft(this,e,VL,GL,ut,{change:0,view:1,manager:8},zL)}},Kc=Up;v();function qL(t){jt(t,"svelte-hup5mn","main.svelte-hup5mn .nav-folder-title.svelte-hup5mn{align-items:center}")}function rk(t,e,n){let r=t.slice();return r[16]=e[n],r}function XL(t){let e,n,r,i,a,s,o,l=t[16].title+"",c,u,f,d,h,p,m,g,w,b,x,E;function _(M,P){return M[3]==0?KL:ZL}let T=_(t,-1),y=T(t),S=!t[5][t[16].title]&&ik(t);function k(){return t[14](t[16])}function C(...M){return t[15](t[16],...M)}return{c(){e=R("div"),n=R("div"),r=R("div"),i=J(),a=R("div"),a.innerHTML='',s=J(),o=R("div"),c=Ce(l),u=J(),f=R("div"),d=R("div"),y.c(),h=J(),p=R("div"),g=J(),S&&S.c(),w=J(),A(r,"data-icon","folder"),Xt(r,"padding-right","5px"),Xt(r,"display","flex"),A(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(a,"is-collapsed",t[5][t[16].title]),A(o,"class","tree-item-inner nav-folder-title-content"),Xt(p,"width","11px"),A(d,"class","buttons"),A(f,"class","git-tools"),A(n,"class","tree-item-self is-clickable nav-folder-title svelte-hup5mn"),A(n,"data-tooltip-position",t[6]),A(n,"aria-label",m=t[16].vaultPath),A(e,"class","tree-item nav-folder"),oe(e,"is-collapsed",t[5][t[16].title])},m(M,P){ae(M,e,P),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(n,u),O(n,f),O(f,d),y.m(d,null),O(d,h),O(d,p),O(e,g),S&&S.m(e,null),O(e,w),b=!0,x||(E=[te(e,"click",be(k)),te(e,"auxclick",be(C))],x=!0)},p(M,P){t=M,(!b||P&33)&&oe(a,"is-collapsed",t[5][t[16].title]),(!b||P&1)&&l!==(l=t[16].title+"")&&Ie(c,l),T===(T=_(t,P))&&y?y.p(t,P):(y.d(1),y=T(t),y&&(y.c(),y.m(d,h))),(!b||P&64)&&A(n,"data-tooltip-position",t[6]),(!b||P&1&&m!==(m=t[16].vaultPath))&&A(n,"aria-label",m),t[5][t[16].title]?S&&(Ee(),Z(S,1,1,()=>{S=null}),ke()):S?(S.p(t,P),P&33&&G(S,1)):(S=ik(t),S.c(),G(S,1),S.m(e,w)),(!b||P&33)&&oe(e,"is-collapsed",t[5][t[16].title])},i(M){b||(G(S),b=!0)},o(M){Z(S),b=!1},d(M){M&&ne(e),y.d(),S&&S.d(),x=!1,Se(E)}}}function YL(t){let e,n,r,i,a,s=[ej,JL,QL],o=[];function l(c,u){return c[3]==0?0:c[3]==1?1:c[3]==2?2:-1}return~(n=l(t,-1))&&(r=o[n]=s[n](t)),{c(){e=R("div"),r&&r.c(),i=J()},m(c,u){ae(c,e,u),~n&&o[n].m(e,null),O(e,i),a=!0},p(c,u){let f=n;n=l(c,u),n===f?~n&&o[n].p(c,u):(r&&(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke()),~n?(r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,i)):r=null)},i(c){a||(G(r),a=!0)},o(c){Z(r),a=!1},d(c){c&&ne(e),~n&&o[n].d()}}}function ZL(t){let e,n,r,i,a;function s(){return t[12](t[16])}function o(){return t[13](t[16])}return{c(){e=R("div"),e.innerHTML='',n=J(),r=R("div"),r.innerHTML='',A(e,"data-icon","undo"),A(e,"aria-label","Discard"),A(e,"class","clickable-icon"),A(r,"data-icon","plus"),A(r,"aria-label","Stage"),A(r,"class","clickable-icon")},m(l,c){ae(l,e,c),ae(l,n,c),ae(l,r,c),i||(a=[te(e,"click",be(s)),te(r,"click",be(o))],i=!0)},p(l,c){t=l},d(l){l&&(ne(e),ne(n),ne(r)),i=!1,Se(a)}}}function KL(t){let e,n,r;function i(){return t[11](t[16])}return{c(){e=R("div"),e.innerHTML='',A(e,"data-icon","minus"),A(e,"aria-label","Unstage"),A(e,"class","clickable-icon")},m(a,s){ae(a,e,s),n||(r=te(e,"click",be(i)),n=!0)},p(a,s){t=a},d(a){a&&ne(e),n=!1,r()}}}function ik(t){let e,n,r,i;return n=new Qc({props:{hierarchy:t[16],plugin:t[1],view:t[2],fileType:t[3]}}),{c(){e=R("div"),nt(n.$$.fragment),A(e,"class","tree-item-children nav-folder-children")},m(a,s){ae(a,e,s),Ke(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[16]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),s&8&&(o.fileType=a[3]),n.$set(o)},i(a){i||(G(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){Z(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Qe(n),a&&r&&r.end()}}}function QL(t){let e,n;return e=new Zc({props:{change:t[16].data,view:t[2]}}),{c(){nt(e.$$.fragment)},m(r,i){Ke(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[16].data),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(G(e.$$.fragment,r),n=!0)},o(r){Z(e.$$.fragment,r),n=!1},d(r){Qe(e,r)}}}function JL(t){let e,n;return e=new Yc({props:{change:t[16].data,manager:t[1].gitManager,view:t[2]}}),{c(){nt(e.$$.fragment)},m(r,i){Ke(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[16].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(G(e.$$.fragment,r),n=!0)},o(r){Z(e.$$.fragment,r),n=!1},d(r){Qe(e,r)}}}function ej(t){let e,n;return e=new Kc({props:{change:t[16].data,manager:t[1].gitManager,view:t[2]}}),{c(){nt(e.$$.fragment)},m(r,i){Ke(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[16].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(G(e.$$.fragment,r),n=!0)},o(r){Z(e.$$.fragment,r),n=!1},d(r){Qe(e,r)}}}function ak(t){let e,n,r,i,a=[YL,XL],s=[];function o(l,c){return l[16].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=In()},m(l,c){s[e].m(l,c),ae(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ee(),Z(s[u],1,1,()=>{s[u]=null}),ke(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),G(n,1),n.m(r.parentNode,r))},i(l){i||(G(n),i=!0)},o(l){Z(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function tj(t){let e,n,r=Ye(t[0].children),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){e=R("main");for(let s=0;s{dispatchEvent(new CustomEvent("git-refresh"))})}function f(x){a.gitManager.unstageAll({dir:x}).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})}function d(x){new kr(s.app,!1,x.vaultPath).myOpen().then(E=>{E===!0&&a.gitManager.discardAll({dir:x.path,status:a.cachedStatus}).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))})})}function h(x){n(5,c[x.title]=!c[x.title],c)}let p=x=>f(x.path),m=x=>d(x),g=x=>u(x.path),w=x=>h(x),b=(x,E)=>Fn(s.app,E,x.vaultPath,s.leaf,"git-source-control");return t.$$set=x=>{"hierarchy"in x&&n(0,i=x.hierarchy),"plugin"in x&&n(1,a=x.plugin),"view"in x&&n(2,s=x.view),"fileType"in x&&n(3,o=x.fileType),"topLevel"in x&&n(4,l=x.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(6,r=s.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,o,l,c,r,u,f,d,h,p,m,g,w,b]}var Qc=class extends Ze{constructor(e){super(),ft(this,e,nj,tj,ut,{hierarchy:0,plugin:1,view:2,fileType:3,topLevel:4},qL)}},Jc=Qc;function rj(t){jt(t,"svelte-11adhly",`.commit-msg-input.svelte-11adhly.svelte-11adhly{width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field)}.git-commit-msg.svelte-11adhly.svelte-11adhly{position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto}main.svelte-11adhly .git-tools .files-count.svelte-11adhly{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}.nav-folder-title.svelte-11adhly.svelte-11adhly{align-items:center}.git-commit-msg-clear-button.svelte-11adhly.svelte-11adhly{position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:-4px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out}.git-commit-msg-clear-button.svelte-11adhly.svelte-11adhly:after{content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;mask-image:url("data:image/svg+xml,");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,");-webkit-mask-repeat:no-repeat}`)}function sk(t,e,n){let r=t.slice();return r[40]=e[n],r}function ok(t,e,n){let r=t.slice();return r[40]=e[n],r}function lk(t,e,n){let r=t.slice();return r[45]=e[n],r}function ck(t){let e,n,r,i;return{c(){e=R("div"),A(e,"class","git-commit-msg-clear-button svelte-11adhly"),A(e,"aria-label",n="Clear")},m(a,s){ae(a,e,s),r||(i=te(e,"click",t[33]),r=!0)},p:Fe,d(a){a&&ne(e),r=!1,i()}}}function uk(t){let e,n,r,i,a,s,o,l,c,u,f,d,h=t[6].staged.length+"",p,m,g,w,b,x,E,_,T,y,S,k,C,M,P,$,j=t[6].changed.length+"",Q,le,de,re,Ae,he,H=t[13]&&fk(t),U=t[12]&&hk(t),D=t[7].length>0&&mk(t);return{c(){e=R("div"),n=R("div"),r=R("div"),i=R("div"),i.innerHTML='',a=J(),s=R("div"),s.textContent="Staged Changes",o=J(),l=R("div"),c=R("div"),u=R("div"),u.innerHTML='',f=J(),d=R("div"),p=Ce(h),m=J(),H&&H.c(),g=J(),w=R("div"),b=R("div"),x=R("div"),x.innerHTML='',E=J(),_=R("div"),_.textContent="Changes",T=J(),y=R("div"),S=R("div"),k=R("div"),k.innerHTML='',C=J(),M=R("div"),M.innerHTML='',P=J(),$=R("div"),Q=Ce(j),le=J(),U&&U.c(),de=J(),D&&D.c(),A(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(i,"is-collapsed",!t[13]),A(s,"class","tree-item-inner nav-folder-title-content"),A(u,"data-icon","minus"),A(u,"aria-label","Unstage"),A(u,"class","clickable-icon"),A(c,"class","buttons"),A(d,"class","files-count svelte-11adhly"),A(l,"class","git-tools"),A(r,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),A(n,"class","staged tree-item nav-folder"),oe(n,"is-collapsed",!t[13]),A(x,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),oe(x,"is-collapsed",!t[12]),A(_,"class","tree-item-inner nav-folder-title-content"),A(k,"data-icon","undo"),A(k,"aria-label","Discard"),A(k,"class","clickable-icon"),A(M,"data-icon","plus"),A(M,"aria-label","Stage"),A(M,"class","clickable-icon"),A(S,"class","buttons"),A($,"class","files-count svelte-11adhly"),A(y,"class","git-tools"),A(b,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),A(w,"class","changes tree-item nav-folder"),oe(w,"is-collapsed",!t[12]),A(e,"class","tree-item nav-folder mod-root")},m(se,_e){ae(se,e,_e),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),O(r,o),O(r,l),O(l,c),O(c,u),t[34](u),O(l,f),O(l,d),O(d,p),O(n,m),H&&H.m(n,null),O(e,g),O(e,w),O(w,b),O(b,x),O(b,E),O(b,_),O(b,T),O(b,y),O(y,S),O(S,k),O(S,C),O(S,M),t[36](M),O(y,P),O(y,$),O($,Q),O(w,le),U&&U.m(w,null),O(e,de),D&&D.m(e,null),re=!0,Ae||(he=[te(u,"click",be(t[19])),te(r,"click",t[35]),te(k,"click",be(t[22])),te(M,"click",be(t[18])),te(b,"click",t[37])],Ae=!0)},p(se,_e){(!re||_e[0]&8192)&&oe(i,"is-collapsed",!se[13]),(!re||_e[0]&64)&&h!==(h=se[6].staged.length+"")&&Ie(p,h),se[13]?H?(H.p(se,_e),_e[0]&8192&&G(H,1)):(H=fk(se),H.c(),G(H,1),H.m(n,null)):H&&(Ee(),Z(H,1,1,()=>{H=null}),ke()),(!re||_e[0]&8192)&&oe(n,"is-collapsed",!se[13]),(!re||_e[0]&4096)&&oe(x,"is-collapsed",!se[12]),(!re||_e[0]&64)&&j!==(j=se[6].changed.length+"")&&Ie(Q,j),se[12]?U?(U.p(se,_e),_e[0]&4096&&G(U,1)):(U=hk(se),U.c(),G(U,1),U.m(w,null)):U&&(Ee(),Z(U,1,1,()=>{U=null}),ke()),(!re||_e[0]&4096)&&oe(w,"is-collapsed",!se[12]),se[7].length>0?D?(D.p(se,_e),_e[0]&128&&G(D,1)):(D=mk(se),D.c(),G(D,1),D.m(e,null)):D&&(Ee(),Z(D,1,1,()=>{D=null}),ke())},i(se){re||(G(H),G(U),G(D),re=!0)},o(se){Z(H),Z(U),Z(D),re=!1},d(se){se&&ne(e),t[34](null),H&&H.d(),t[36](null),U&&U.d(),D&&D.d(),Ae=!1,Se(he)}}}function fk(t){let e,n,r,i,a,s=[aj,ij],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=R("div"),r.c(),A(e,"class","tree-item-children nav-folder-children")},m(c,u){ae(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function ij(t){let e,n,r=Ye(t[6].staged),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function sj(t){let e,n,r=Ye(t[6].changed),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s',i=J(),a=R("div"),a.textContent="Recently Pulled Files",s=J(),o=R("span"),c=Ce(l),u=J(),p&&p.c(),A(r,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),A(a,"class","tree-item-inner nav-folder-title-content"),A(o,"class","tree-item-flair"),A(n,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),A(e,"class","pulled nav-folder"),oe(e,"is-collapsed",!t[14])},m(m,g){ae(m,e,g),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,u),p&&p.m(e,null),f=!0,d||(h=te(n,"click",t[38]),d=!0)},p(m,g){(!f||g[0]&128)&&l!==(l=m[7].length+"")&&Ie(c,l),m[14]?p?(p.p(m,g),g[0]&16384&&G(p,1)):(p=gk(m),p.c(),G(p,1),p.m(e,null)):p&&(Ee(),Z(p,1,1,()=>{p=null}),ke()),(!f||g[0]&16384)&&oe(e,"is-collapsed",!m[14])},i(m){f||(G(p),f=!0)},o(m){Z(p),f=!1},d(m){m&&ne(e),p&&p.d(),d=!1,h()}}}function gk(t){let e,n,r,i,a,s=[cj,lj],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=R("div"),r.c(),A(e,"class","tree-item-children nav-folder-children")},m(c,u){ae(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ee(),Z(o[f],1,1,()=>{o[f]=null}),ke(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),G(r,1),r.m(e,null))},i(c){a||(G(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){Z(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function lj(t){let e,n,r=Ye(t[7]),i=[];for(let s=0;sZ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s{j=null}),ke())},i(Q){C||(G(j),C=!0)},o(Q){Z(j),C=!1},d(Q){Q&&ne(e),t[23](null),t[24](null),t[25](null),t[26](null),t[27](null),t[28](null),t[29](null),t[31](null),$&&$.d(),j&&j.d(),M=!1,Se(P)}}}function Zn(){dispatchEvent(new CustomEvent("git-refresh"))}function fj(t,e,n){let r,{plugin:i}=e,{view:a}=e,s,o,l=[],c=i.settings.commitMessage,u=[],f,d,h,p=!0,m=!0,g=!0,w=i.settings.treeStructure,b;addEventListener("git-view-refresh",_),_(),i.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{u.forEach(X=>(0,Ea.setIcon)(X,X.getAttr("data-icon"))),(0,Ea.setIcon)(b,w?"list":"folder")},0)}),Js(()=>{removeEventListener("git-view-refresh",_)});function x(){return ba(this,void 0,void 0,function*(){if(n(5,s=!0),o){if(yield i.tools.hasTooBigFiles(o.staged))return i.setState(0),!1;i.promiseQueue.addTask(()=>i.gitManager.commit({message:c}).then(()=>{c!==i.settings.commitMessage&&n(2,c=""),i.automaticsManager.setUpAutoCommitAndSync()}).finally(Zn))}})}function E(){return ba(this,void 0,void 0,function*(){n(5,s=!0),o&&i.promiseQueue.addTask(()=>i.commitAndSync(!1,!1,c).then(()=>{c!==i.settings.commitMessage&&n(2,c="")}).finally(Zn))})}function _(){return ba(this,void 0,void 0,function*(){if(!i.gitReady){n(6,o=void 0);return}let X=yield i.gitManager.getUnpushedCommits();if(u.forEach(Te=>{var Be,Je;Ea.Platform.isMobile?(Te.removeClass("button-border"),Te.id=="push"&&X>0&&Te.addClass("button-border")):((Be=Te.firstElementChild)===null||Be===void 0||Be.removeAttribute("color"),Te.id=="push"&&X>0&&((Je=Te.firstElementChild)===null||Je===void 0||Je.setAttr("color","var(--text-accent)")))}),n(6,o=i.cachedStatus),i.lastPulledFiles&&i.lastPulledFiles!=l&&(n(7,l=i.lastPulledFiles),n(11,h={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(l)})),o){let Te=(Be,Je)=>Be.vault_path.split("/").last().localeCompare(Lt(Je.vault_path));o.changed.sort(Te),o.staged.sort(Te),o.changed.length+o.staged.length>500?(n(6,o=void 0),i.loading||i.displayError("Too many changes to display")):(n(9,f={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.changed)}),n(10,d={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.staged)}))}else n(9,f=void 0),n(10,d=void 0);n(5,s=i.loading)})}function T(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.stageAll({status:o}).finally(Zn))}function y(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.unstageAll({status:o}).finally(Zn))}function S(){n(5,s=!0),i.promiseQueue.addTask(()=>i.push().finally(Zn))}function k(){n(5,s=!0),i.promiseQueue.addTask(()=>i.pullChangesFromRemote().finally(Zn))}function C(){new kr(a.app,!1,i.gitManager.getRelativeVaultPath("/")).myOpen().then(X=>{X===!0&&i.promiseQueue.addTask(()=>i.gitManager.discardAll({status:i.cachedStatus}).finally(()=>{dispatchEvent(new CustomEvent("git-refresh"))}))})}function M(X){Pe[X?"unshift":"push"](()=>{u[5]=X,n(8,u)})}function P(X){Pe[X?"unshift":"push"](()=>{u[0]=X,n(8,u)})}function $(X){Pe[X?"unshift":"push"](()=>{u[1]=X,n(8,u)})}function j(X){Pe[X?"unshift":"push"](()=>{u[2]=X,n(8,u)})}function Q(X){Pe[X?"unshift":"push"](()=>{u[3]=X,n(8,u)})}function le(X){Pe[X?"unshift":"push"](()=>{u[4]=X,n(8,u)})}function de(X){Pe[X?"unshift":"push"](()=>{b=X,n(4,b)})}let re=()=>{n(3,w=!w),n(0,i.settings.treeStructure=w,i),i.saveSettings()};function Ae(X){Pe[X?"unshift":"push"](()=>{u[6]=X,n(8,u)})}function he(){c=this.value,n(2,c)}let H=()=>n(2,c="");function U(X){Pe[X?"unshift":"push"](()=>{u[8]=X,n(8,u)})}let D=()=>n(13,m=!m);function se(X){Pe[X?"unshift":"push"](()=>{u[9]=X,n(8,u)})}let _e=()=>n(12,p=!p),mt=()=>n(14,g=!g);return t.$$set=X=>{"plugin"in X&&n(0,i=X.plugin),"view"in X&&n(1,a=X.view)},t.$$.update=()=>{t.$$.dirty[0]&24&&b&&(b.empty(),(0,Ea.setIcon)(b,w?"list":"folder")),t.$$.dirty[0]&4&&n(15,r=(c.match(/\n/g)||[]).length+1||1)},[i,a,c,w,b,s,o,l,u,f,d,h,p,m,g,r,x,E,T,y,S,k,C,M,P,$,j,Q,le,de,re,Ae,he,H,U,D,se,_e,mt]}var zp=class extends Ze{constructor(e){super(),ft(this,e,fj,uj,ut,{plugin:0,view:1},rj,[-1,-1])}},vk=zp;var io=class extends wk.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return ht.type}getDisplayText(){return ht.name}getIcon(){return ht.icon}onClose(){return super.onClose()}onOpen(){return this._view=new vk({target:this.contentEl,props:{plugin:this.plugin,view:this}}),super.onOpen()}};v();var eu=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(r=>{this.plugin.switchBranch()})}async display(){if(this.plugin.gitReady){let e=await this.plugin.gitManager.branchInfo();e.current!=null?this.statusBarEl.setText(e.current):this.statusBarEl.empty()}else this.statusBarEl.empty()}};v();var bk=require("obsidian");var ao=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let n=await this.plugin.gitManager.branchInfo(),r=n.tracking?wr(n.tracking)[0]:null;if(r){let i=await this.plugin.gitManager.getRemoteUrl(r);if(i!=null&&i.includes("github.com")){let a=e.filter(s=>{let o=this.plugin.app.vault.getAbstractFileByPath(s.vault_path);return o instanceof bk.TFile?o.stat.size>=1e8:!1});if(a.length>0)return this.plugin.displayError(`Did not commit, because following files are too big: ${a.map(s=>s.vault_path)}. Please remove them.`),!0}}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(Vi,e);let n=!1;this.plugin.app.workspace.iterateAllLeaves(r=>{r.getDisplayText()!=""&&Vi.startsWith(r.getDisplayText())&&(n=!0)}),n||this.plugin.app.workspace.openLinkText(Vi,"/",!0)}};var tu=class extends xe.Plugin{constructor(){super(...arguments);this.tools=new ao(this);this.gitReady=!1;this.promiseQueue=new kc;this.offlineMode=!1;this.loading=!1;this.lineAuthoringFeature=new Ec(this)}setState(n){var r;this.state=n,(r=this.statusBar)==null||r.display()}async updateCachedStatus(){return this.cachedStatus=await this.gitManager.status(),this.cachedStatus}async refresh(){if(!this.gitReady)return;let n=this.app.workspace.getLeavesOfType(ht.type),r=this.app.workspace.getLeavesOfType(fn.type);(this.settings.changedFilesInStatusBar||n.length>0||r.length>0)&&(this.loading=!0,dispatchEvent(new CustomEvent("git-view-refresh")),await this.updateCachedStatus(),this.loading=!1,dispatchEvent(new CustomEvent("git-view-refresh")))}async refreshUpdatedHead(){this.lineAuthoringFeature.refreshLineAuthorViews()}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),$s.plugin=this,this.localStorage=new Mc(this),this.localStorage.migrate(),await this.loadSettings(),this.migrateSettings(),this.settingsTab=new uc(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||this.loadPlugin()}async loadPlugin(){if(addEventListener("git-refresh",this.refresh.bind(this)),addEventListener("git-head-update",this.refreshUpdatedHead.bind(this)),this.registerView(ht.type,n=>new io(n,this)),this.registerView(fn.type,n=>new no(n,this)),this.registerView(Tt.type,n=>new ma(n,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let n=this.app.workspace.getLeavesOfType(ht.type),r;n.length===0?(r=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await r.setViewState({type:ht.type})):r=n.first(),this.app.workspace.revealLeaf(r),dispatchEvent(new CustomEvent("git-refresh"))}),this.lineAuthoringFeature.onLoadPlugin(),this.registerHoverLinkSource(ht.type,{display:"Git View",defaultMod:!0}),this.setRefreshDebouncer(),ZS(this),this.registerEvent(this.app.workspace.on("file-menu",(n,r,i)=>{this.handleFileMenu(n,r,i)})),this.settings.showStatusBar){let n=this.addStatusBarItem();this.statusBar=new Ac(n,this),this.registerInterval(window.setInterval(()=>{var r;return(r=this.statusBar)==null?void 0:r.display()},1e3))}if(xe.Platform.isDesktop&&this.settings.showBranchStatusBar){let n=this.addStatusBarItem();this.branchBar=new eu(n,this),this.registerInterval(window.setInterval(()=>{var r;return(r=this.branchBar)==null?void 0:r.display()},6e4))}this.app.workspace.onLayoutReady(()=>this.init())}setRefreshDebouncer(){var n;(n=this.debRefresh)==null||n.cancel(),this.debRefresh=(0,xe.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh()},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(n){await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+this.gitManager.getRelativeRepoPath(n.path,!0)),this.refresh()}handleFileMenu(n,r,i){this.gitReady&&this.settings.showFileMenu&&r&&(this.settings.showFileMenu&&i=="file-explorer-context-menu"&&(n.addItem(a=>{a.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof xe.TFile?await this.gitManager.stage(r.path,!0):await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Staged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof xe.TFile?await this.gitManager.unstage(r.path,!0):await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Unstaged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r)})})),i=="git-source-control"&&n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r)})}))}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){this.gitReady=!1,dispatchEvent(new CustomEvent("git-refresh")),this.lineAuthoringFeature.deactivateFeature(),this.automaticsManager.unload(),removeEventListener("git-refresh",this.refresh.bind(this)),removeEventListener("git-head-update",this.refreshUpdatedHead.bind(this)),this.app.workspace.offref(this.openEvent),this.app.metadataCache.offref(this.modifyEvent),this.app.metadataCache.offref(this.deleteEvent),this.app.metadataCache.offref(this.createEvent),this.app.metadataCache.offref(this.renameEvent),this.debRefresh.cancel()}async onunload(){this.app.workspace.unregisterHoverLinkSource(ht.type),this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let n=await this.loadData();n==null&&(n={showedMobileNotice:!0}),this.settings=m2(An,n)}async saveSettings(){var n;(n=this.settingsTab)==null||n.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return xe.Platform.isDesktopApp}async init(){var n;try{this.useSimpleGit?(this.gitManager=new Oe(this),await this.gitManager.setGitInstance()):this.gitManager=new pn(this);let r=await this.gitManager.checkRequirements();switch(r){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new xe.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":this.gitReady=!0,this.setState(0),this.openEvent=this.app.workspace.on("active-leaf-change",i=>this.handleViewActiveState(i)),this.modifyEvent=this.app.vault.on("modify",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.deleteEvent=this.app.vault.on("delete",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.createEvent=this.app.vault.on("create",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.renameEvent=this.app.vault.on("rename",()=>{var i;this.debRefresh(),(i=this.autoCommitDebouncer)==null||i.call(this)}),this.registerEvent(this.modifyEvent),this.registerEvent(this.deleteEvent),this.registerEvent(this.createEvent),this.registerEvent(this.renameEvent),(n=this.branchBar)==null||n.display(),this.lineAuthoringFeature.conditionallyActivateBySettings(),dispatchEvent(new CustomEvent("git-refresh")),this.settings.autoPullOnBoot&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),this.automaticsManager=new Us(this),await this.automaticsManager.init();break;default:this.log("Something weird happened. The 'checkRequirements' result is "+r)}}catch(r){this.displayError(r),console.error(r)}}async createNewRepo(){await this.gitManager.init(),new xe.Notice("Initialized new repo"),await this.init()}async cloneNewRepo(){let r=await new ze({placeholder:"Enter remote URL"}).open();if(r){let i="Vault Root",a=await new ze({options:this.gitManager instanceof pn?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof pn}).open();if(a!==void 0){if(a===i&&(a="."),a=(0,xe.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new ze({options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.app.vault.configDir} directory at the root?`,onlySelection:!0}).open();if(f===void 0){new xe.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new ze({options:["Abort clone",d],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).open()===d)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new xe.Notice("Aborted clone");return}}}let s=await new ze({placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).open(),o;if(s!==""&&(o=parseInt(s),isNaN(o))){new xe.Notice("Invalid depth. Aborting clone.");return}new xe.Notice(`Cloning new repo into "${a}"`);let l=this.settings.basePath,c=a&&a!==".";c&&(this.settings.basePath=a);try{await this.gitManager.clone(r,a,o)}catch(u){throw this.settings.basePath=l,this.saveSettings(),u}new xe.Notice("Cloned new repo."),new xe.Notice("Please restart Obsidian"),c&&this.saveSettings()}}}async isAllInitialized(){return this.gitReady||await this.init(),this.gitReady}async pullChangesFromRemote(){if(!await this.isAllInitialized())return;let n=await this.pull();if(this.automaticsManager.setUpAutoCommitAndSync(),n!==!1){if(n||this.displayMessage("Everything is up-to-date"),this.gitManager instanceof Oe){let r=await this.gitManager.status();r.conflicted.length>0&&(this.displayError(`You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),this.handleConflict(r.conflicted))}dispatchEvent(new CustomEvent("git-refresh")),this.setState(0)}}async commitAndSync(n,r=!1,i){await this.isAllInitialized()&&(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),await this.commit({fromAuto:n,requestCustomMessage:r,commitMessage:i})&&(this.settings.disablePush||(await this.remotesAreSet()&&await this.gitManager.canPush()?(this.settings.syncMethod!="reset"&&this.settings.pullBeforePush&&await this.pull(),await this.push()):this.displayMessage("No changes to push")),this.setState(0)))}async commit({fromAuto:n,requestCustomMessage:r=!1,onlyStaged:i=!1,commitMessage:a,amend:s=!1}){if(!await this.isAllInitialized())return!1;let o=this.localStorage.getConflict(),l,c,u;if(this.gitManager instanceof Oe){if(this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),c.conflicted.length==0&&(this.localStorage.setConflict(!1),o=!1),n&&c.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${c.conflicted.length} ${c.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),this.handleConflict(c.conflicted),!1;l=[...c.changed,...c.staged]}else{if(n&&o)return this.setState(6),this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;o?(await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),l=[...c.changed,...c.staged]):i?l=await this.gitManager.getStagedFiles():(u=await this.gitManager.getUnstagedFiles(),l=u.map(({filepath:f})=>({vault_path:this.gitManager.getRelativeVaultPath(f)})))}if(await this.tools.hasTooBigFiles(l))return this.setState(0),!1;if(l.length!==0||o){let f=a!=null?a:a=n?this.settings.autoCommitMessage:this.settings.commitMessage;if(n&&this.settings.customMessageOnAutoBackup||r){!this.settings.disablePopups&&n&&new xe.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let p=await new Tc(this,!0).open();if(p!=null&&p!=""&&p!="...")f=p;else return this.setState(0),!1}let d;i?d=await this.gitManager.commit({message:f,amend:s}):d=await this.gitManager.commitAll({message:f,status:c,unstagedFiles:u,amend:s}),this.gitManager instanceof Oe&&(await this.updateCachedStatus()).conflicted.length==0&&this.localStorage.setConflict(!1);let h=!1;d===void 0&&(h=!0,d=l.length),this.automaticsManager.setUpAutoCommitAndSync(),this.displayMessage(`Committed${h?" approx.":""} ${d} ${d==1?"file":"files"}`)}else this.displayMessage("No changes to commit");return dispatchEvent(new CustomEvent("git-refresh")),this.setState(0),!0}async push(){if(!await this.isAllInitialized()||!await this.remotesAreSet())return!1;let n=this.localStorage.getConflict();this.gitManager instanceof Oe&&await this.mayDeleteConflictFile();let r;if(this.gitManager instanceof Oe&&(r=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),this.handleConflict(r.conflicted),!1;if(this.gitManager instanceof pn&&n)return this.displayError("Cannot push. You have conflicts"),this.setState(6),!1;this.log("Pushing....");let i=await this.gitManager.push();return i!==void 0&&(this.log("Pushed!",i),i>0?this.displayMessage(`Pushed ${i} ${i==1?"file":"files"} to remote`):this.displayMessage("No changes to push")),this.offlineMode=!1,this.setState(0),dispatchEvent(new CustomEvent("git-refresh")),!0}async pull(){if(!await this.remotesAreSet())return!1;let n=await this.gitManager.pull()||[];return this.offlineMode=!1,n.length>0&&(this.displayMessage(`Pulled ${n.length} ${n.length==1?"file":"files"} from remote`),this.lastPulledFiles=n),n.length}async fetch(){await this.remotesAreSet()&&(await this.gitManager.fetch(),this.displayMessage("Fetched from remote"),this.offlineMode=!1,dispatchEvent(new CustomEvent("git-refresh")))}async mayDeleteConflictFile(){let n=this.app.vault.getAbstractFileByPath(Vi);n&&(this.app.workspace.iterateAllLeaves(r=>{var i;r.view instanceof xe.MarkdownView&&((i=r.view.file)==null?void 0:i.path)==n.path&&r.detach()}),await this.app.vault.delete(n))}async stageFile(n){return await this.isAllInitialized()?(await this.gitManager.stage(n.path,!0),this.displayMessage(`Staged ${n.path}`),dispatchEvent(new CustomEvent("git-refresh")),this.setState(0),!0):!1}async unstageFile(n){return await this.isAllInitialized()?(await this.gitManager.unstage(n.path,!0),this.displayMessage(`Unstaged ${n.path}`),dispatchEvent(new CustomEvent("git-refresh")),this.setState(0),!0):!1}async switchBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo(),r=await new Xc(n.branches).open();if(r!=null)return await this.gitManager.checkout(r),this.displayMessage(`Switched to ${r}`),(i=this.branchBar)==null||i.display(),r}async switchRemoteBranch(){var a;if(!await this.isAllInitialized())return;let n=await this.selectRemoteBranch()||"",[r,i]=wr(n);if(i!=null&&r!=null)return await this.gitManager.checkout(i,r),this.displayMessage(`Switched to ${n}`),(a=this.branchBar)==null||a.display(),n}async createBranch(){var r;if(!await this.isAllInitialized())return;let n=await new ze({placeholder:"Create new branch"}).open();if(n!=null)return await this.gitManager.createBranch(n),this.displayMessage(`Created new branch ${n}`),(r=this.branchBar)==null||r.display(),n}async deleteBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo();n.current&&n.branches.remove(n.current);let r=await new ze({options:n.branches,placeholder:"Delete branch",onlySelection:!0}).open();if(r!=null){let a=!1;if(!await this.gitManager.branchIsMerged(r)){let o=await new ze({options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).open();if(o!=="YES")return;a=o==="YES"}return await this.gitManager.deleteBranch(r,a),this.displayMessage(`Deleted branch ${r}`),(i=this.branchBar)==null||i.display(),r}}async remotesAreSet(){return this.settings.updateSubmodules||(await this.gitManager.branchInfo()).tracking?!0:(new xe.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let n=await this.selectRemoteBranch();return n==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setState(0),!1):(await this.gitManager.updateUpstreamBranch(n),this.displayMessage(`Set upstream branch to ${n}`),this.setState(0),!0)}async discardAll(){await this.gitManager.discardAll({status:this.cachedStatus}),new xe.Notice("All local changes have been discarded. New files remain untouched.")}async handleConflict(n){this.setState(6),this.localStorage.setConflict(!0);let r;n!==void 0&&(r=["# Conflicts","Please resolve them and commit them using the commands `Git: Commit all changes` followed by `Git: Push`","(This file will automatically be deleted before commit)","[[#Additional Instructions]] available below file list","",...n.map(i=>{let a=this.app.vault.getAbstractFileByPath(i);return a instanceof xe.TFile?`- [[${this.app.metadataCache.fileToLinktext(a,"/")}]]`:`- Not a file: ${i}`}),` +# Additional Instructions +I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text. + +\`\`\`diff +<<<<<<< HEAD + File changes in local repository +======= + File changes in remote repository +>>>>>>> origin/main +\`\`\``]),this.tools.writeAndOpenFile(r==null?void 0:r.join(` +`))}async editRemotes(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new ze({options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}).open();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new ze({initialValue:a}).open();if(o)return await this.gitManager.setRemote(i,o),i}}async selectRemoteBranch(){let n=await this.gitManager.getRemotes(),r;n.length===0&&(r=await this.editRemotes(),r==null&&(n=await this.gitManager.getRemotes()));let i=new ze({options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=r!=null?r:await i.open();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a);return await new ze({options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).open()}}async removeRemote(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new ze({options:n,placeholder:"Select a remote"}).open();i&&this.gitManager.removeRemote(i)}handleViewActiveState(n){var a,s;if(!(n!=null&&n.view.getState().file))return;let r=this.app.workspace.getLeavesOfType(ht.type).first(),i=this.app.workspace.getLeavesOfType(fn.type).first();if((a=r==null?void 0:r.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||a.removeClass("is-active"),(s=i==null?void 0:i.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||s.removeClass("is-active"),(n==null?void 0:n.view)instanceof ma){let o=n.view.state.file;this.lastDiffViewState=n.view.getState();let l;r&&n.view.state.staged?l=r.view.containerEl.querySelector(`div.staged div.nav-file-title[data-path='${o}']`):r&&n.view.state.staged===!1&&!n.view.state.hash?l=r.view.containerEl.querySelector(`div.changes div.nav-file-title[data-path='${o}']`):i&&n.view.state.hash&&(l=i.view.containerEl.querySelector(`div.nav-file-title[data-path='${o}']`)),l==null||l.addClass("is-active")}else this.lastDiffViewState=void 0}displayMessage(n,r=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(n.toLowerCase(),r),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!n.startsWith("No changes"))&&new xe.Notice(n,5*1e3),this.log(n)}displayError(n,r=10*1e3){var i;if(n instanceof cs.UserCanceledError){new xe.Notice("Aborted");return}n=n.toString(),new xe.Notice(n,r),this.log(`error: ${n}`),(i=this.statusBar)==null||i.displayMessage(n.toLowerCase(),r)}log(...n){console.log(`${this.manifest.id}:`,...n)}}; +/*! Bundled license information: + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + +buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) + +safe-buffer/index.js: + (*! safe-buffer. MIT License. Feross Aboukhadijeh *) + +crc-32/crc32.js: + (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) + +js-sha256/src/sha256.js: + (** + * [js-sha256]{@link https://github.com/emn178/js-sha256} + * + * @version 0.9.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2017 + * @license MIT + *) + +feather-icons/dist/feather.js: + (*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames + *) +*/ diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json new file mode 100644 index 0000000..3f4b1a2 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -0,0 +1,10 @@ +{ + "author": "Vinzent", + "authorUrl": "https://github.com/Vinzent03", + "id": "obsidian-git", + "name": "Git", + "description": "Integrate Git version control with automatic backup and other advanced features.", + "isDesktopOnly": false, + "fundingUrl": "https://ko-fi.com/vinzent", + "version": "2.27.0" +} diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css new file mode 100644 index 0000000..abe81d4 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -0,0 +1,566 @@ +@keyframes loading { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +.workspace-leaf-content[data-type="git-view"] .button-border { + border: 2px solid var(--interactive-accent); + border-radius: var(--radius-s); +} + +.workspace-leaf-content[data-type="git-view"] .view-content { + padding: 0; +} + +.workspace-leaf-content[data-type="git-history-view"] .view-content { + padding: 0; +} + +.loading > svg { + animation: 2s linear infinite loading; + transform-origin: 50% 50%; + display: inline-block; +} + +.obsidian-git-center { + margin: auto; + text-align: center; + width: 50%; +} + +.obsidian-git-textarea { + display: block; + margin-left: auto; + margin-right: auto; +} + +.obsidian-git-disabled { + opacity: 0.5; +} + +.obsidian-git-center-button { + display: block; + margin: 20px auto; +} + +.tooltip.mod-left { + overflow-wrap: break-word; +} + +.tooltip.mod-right { + overflow-wrap: break-word; +} +.git-tools { + display: flex; + margin-left: auto; +} +.git-tools .type { + padding-left: var(--size-2-1); + display: flex; + align-items: center; + justify-content: center; + width: 11px; +} + +.git-tools .type[data-type="M"] { + color: orange; +} +.git-tools .type[data-type="D"] { + color: red; +} +.git-tools .buttons { + display: flex; +} +.git-tools .buttons > * { + padding: 0 0; + height: auto; +} + +.is-active .git-tools .buttons > * { + color: var(--nav-item-color-active); +} + +.git-author { + color: var(--text-accent); +} + +.git-date { + color: var(--text-accent); +} + +.git-ref { + color: var(--text-accent); +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-d-none { + display: none; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper { + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-header { + background-color: var(--background-primary); + border-bottom: 1px solid var(--interactive-accent); + font-family: var(--font-monospace); + height: 35px; + padding: 5px 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-header, +.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats { + display: -webkit-box; + display: -ms-flexbox; + display: flex; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats { + font-size: 14px; + margin-left: auto; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added { + border: 1px solid #b4e2b4; + border-radius: 5px 0 0 5px; + color: #399839; + padding: 2px; + text-align: right; + vertical-align: middle; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted { + border: 1px solid #e9aeae; + border-radius: 0 5px 5px 0; + color: #c33; + margin-left: 1px; + padding: 2px; + text-align: left; + vertical-align: middle; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper { + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 15px; + width: 100%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-name { + overflow-x: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper { + border: 1px solid var(--background-modifier-border); + border-radius: 3px; + margin-bottom: 1em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse { + -webkit-box-pack: end; + -ms-flex-pack: end; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + border: 1px solid var(--background-modifier-border); + border-radius: 3px; + cursor: pointer; + display: none; + font-size: 12px; + justify-content: flex-end; + padding: 4px 8px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected { + background-color: #c8e1ff; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input { + margin: 0 4px 0 0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table { + border-collapse: collapse; + font-family: Menlo, Consolas, monospace; + font-size: 13px; + width: 100%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff { + width: 100%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff { + overflow-y: hidden; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff { + display: inline-block; + margin-bottom: -8px; + margin-right: -4px; + overflow-x: scroll; + overflow-y: hidden; + width: 50%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line { + padding: 0 8em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line { + display: inline-block; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + white-space: nowrap; + width: 100%; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line { + padding: 0 4.5em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn { + word-wrap: normal; + background: none; + display: inline-block; + padding: 0; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + vertical-align: middle; + white-space: pre; + width: 100%; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + del { + background-color: #ffb6ba; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + del { + background-color: #8d232881; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins { + border-radius: 0.2em; + display: inline-block; + margin-top: -1px; + text-decoration: none; + vertical-align: middle; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + ins { + background-color: #97f295; + text-align: left; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-code-side-line + ins { + background-color: #1d921996; + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix { + word-wrap: normal; + background: none; + display: inline; + padding: 0; + white-space: pre; +} + +.workspace-leaf-content[data-type="diff-view"] .line-num1 { + float: left; +} + +.workspace-leaf-content[data-type="diff-view"] .line-num1, +.workspace-leaf-content[data-type="diff-view"] .line-num2 { + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + padding: 0 0.5em; + text-overflow: ellipsis; + width: 3.5em; +} + +.workspace-leaf-content[data-type="diff-view"] .line-num2 { + float: right; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-muted); + cursor: pointer; + display: inline-block; + position: absolute; + text-align: right; + width: 7.5em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after { + content: "\200b"; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-muted); + cursor: pointer; + display: inline-block; + overflow: hidden; + padding: 0 0.5em; + position: absolute; + text-align: right; + text-overflow: ellipsis; + width: 4em; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-diff-tbody tr { + position: relative; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after { + content: "\200b"; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder, +.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber, +.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber, +.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber { + direction: rtl; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del { + background-color: #fee8e9; + border-color: #e9aeae; +} + +.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins { + background-color: #dfd; + border-color: #b4e2b4; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del { + background-color: #521b1d83; + border-color: #691d1d73; +} + +.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins { + background-color: rgba(30, 71, 30, 0.5); + border-color: #13501381; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-info { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + color: var(--text-normal); +} + +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-del.d2h-change { + background-color: #fdf2d0; +} + +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-del.d2h-change { + background-color: #55492480; +} + +.theme-light + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-ins.d2h-change { + background-color: #ded; +} + +.theme-dark + .workspace-leaf-content[data-type="diff-view"] + .d2h-file-diff + .d2h-ins.d2h-change { + background-color: rgba(37, 78, 37, 0.418); +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper { + margin-bottom: 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a { + color: #3572b0; + text-decoration: none; +} + +.workspace-leaf-content[data-type="diff-view"] + .d2h-file-list-wrapper + a:visited { + color: #3572b0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header { + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title { + font-weight: 700; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + text-align: left; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list { + display: block; + list-style: none; + margin: 0; + padding: 0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li { + border-bottom: 1px solid var(--background-modifier-border); + margin: 0; + padding: 5px 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child { + border-bottom: none; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch { + cursor: pointer; + display: none; + font-size: 10px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-icon { + fill: currentColor; + margin-right: 10px; + vertical-align: middle; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-deleted { + color: #c33; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-added { + color: #399839; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-changed { + color: #d0b44c; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-moved { + color: #3572b0; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-tag { + background-color: var(--background-primary); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 10px; + margin-left: 5px; + padding: 0 2px; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag { + border: 2px solid #c33; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag { + border: 1px solid #399839; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag { + border: 1px solid #d0b44c; +} + +.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag { + border: 1px solid #3572b0; +} + +/* ====================== Line Authoring Information ====================== */ + +.cm-gutterElement.obs-git-blame-gutter { + /* Add background color to spacing inbetween and around the gutter for better aesthetics */ + border-width: 0px 2px 0.2px 2px; + border-style: solid; + border-color: var(--background-secondary); + background-color: var(--background-secondary); +} + +.cm-gutterElement.obs-git-blame-gutter > div, +.line-author-settings-preview { + /* delegate text color to settings */ + color: var(--obs-git-gutter-text); + font-family: monospace; + height: 100%; /* ensure, that age-based background color occupies entire parent */ + text-align: right; + padding: 0px 6px 0px 6px; + white-space: pre; /* Keep spaces and do not collapse them. */ +} + +@media (max-width: 800px) { + /* hide git blame gutter not to superpose text */ + .cm-gutterElement.obs-git-blame-gutter { + display: none; + } +} diff --git a/.obsidian/plugins/obsidian-ocr/main.js b/.obsidian/plugins/obsidian-ocr/main.js new file mode 100644 index 0000000..67d189e --- /dev/null +++ b/.obsidian/plugins/obsidian-ocr/main.js @@ -0,0 +1,65032 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 8185: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = __webpack_require__(7147); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); +} +exports.createFileSystemAdapter = createFileSystemAdapter; + + +/***/ }), + +/***/ 1107: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; +const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); +if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { + throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); +} +const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); +const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); +const SUPPORTED_MAJOR_VERSION = 10; +const SUPPORTED_MINOR_VERSION = 10; +const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; +const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; +/** + * IS `true` for Node.js 10.10 and greater. + */ +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; + + +/***/ }), + +/***/ 5923: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Settings = exports.scandirSync = exports.scandir = void 0; +const async = __webpack_require__(1411); +const sync = __webpack_require__(3953); +const settings_1 = __webpack_require__(6913); +exports.Settings = settings_1.default; +function scandir(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.scandir = scandir; +function scandirSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.scandirSync = scandirSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} + + +/***/ }), + +/***/ 1411: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = __webpack_require__(6203); +const rpl = __webpack_require__(4595); +const constants_1 = __webpack_require__(1107); +const utils = __webpack_require__(6582); +const common = __webpack_require__(4587); +function read(directory, settings, callback) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + readdirWithFileTypes(directory, settings, callback); + return; + } + readdir(directory, settings, callback); +} +exports.read = read; +function readdirWithFileTypes(directory, settings, callback) { + settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; + } + const entries = dirents.map((dirent) => ({ + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + })); + if (!settings.followSymbolicLinks) { + callSuccessCallback(callback, entries); + return; + } + const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); + rpl(tasks, (rplError, rplEntries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; + } + callSuccessCallback(callback, rplEntries); + }); + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function makeRplTaskEntry(entry, settings) { + return (done) => { + if (!entry.dirent.isSymbolicLink()) { + done(null, entry); + return; + } + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + done(statError); + return; + } + done(null, entry); + return; + } + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + done(null, entry); + }); + }; +} +function readdir(directory, settings, callback) { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; + } + const tasks = names.map((name) => { + const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + return (done) => { + fsStat.stat(path, settings.fsStatSettings, (error, stats) => { + if (error !== null) { + done(error); + return; + } + const entry = { + name, + path, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + done(null, entry); + }); + }; + }); + rpl(tasks, (rplError, entries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; + } + callSuccessCallback(callback, entries); + }); + }); +} +exports.readdir = readdir; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); +} + + +/***/ }), + +/***/ 4587: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.joinPathSegments = void 0; +function joinPathSegments(a, b, separator) { + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; +} +exports.joinPathSegments = joinPathSegments; + + +/***/ }), + +/***/ 3953: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = __webpack_require__(6203); +const constants_1 = __webpack_require__(1107); +const utils = __webpack_require__(6582); +const common = __webpack_require__(4587); +function read(directory, settings) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + return readdir(directory, settings); +} +exports.read = read; +function readdirWithFileTypes(directory, settings) { + const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); + return dirents.map((dirent) => { + const entry = { + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + }; + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + } + catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; + } + } + } + return entry; + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function readdir(directory, settings) { + const names = settings.fs.readdirSync(directory); + return names.map((name) => { + const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + const stats = fsStat.statSync(entryPath, settings.fsStatSettings); + const entry = { + name, + path: entryPath, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + return entry; + }); +} +exports.readdir = readdir; + + +/***/ }), + +/***/ 6913: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __webpack_require__(1017); +const fsStat = __webpack_require__(6203); +const fs = __webpack_require__(8185); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports["default"] = Settings; + + +/***/ }), + +/***/ 322: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; + + +/***/ }), + +/***/ 6582: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fs = void 0; +const fs = __webpack_require__(322); +exports.fs = fs; + + +/***/ }), + +/***/ 8980: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = __webpack_require__(7147); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); +} +exports.createFileSystemAdapter = createFileSystemAdapter; + + +/***/ }), + +/***/ 6203: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.statSync = exports.stat = exports.Settings = void 0; +const async = __webpack_require__(2654); +const sync = __webpack_require__(8946); +const settings_1 = __webpack_require__(8328); +exports.Settings = settings_1.default; +function stat(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.stat = stat; +function statSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.statSync = statSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} + + +/***/ }), + +/***/ 2654: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.read = void 0; +function read(path, settings, callback) { + settings.fs.lstat(path, (lstatError, lstat) => { + if (lstatError !== null) { + callFailureCallback(callback, lstatError); + return; + } + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + callSuccessCallback(callback, lstat); + return; + } + settings.fs.stat(path, (statError, stat) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + callFailureCallback(callback, statError); + return; + } + callSuccessCallback(callback, lstat); + return; + } + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + callSuccessCallback(callback, stat); + }); + }); +} +exports.read = read; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); +} + + +/***/ }), + +/***/ 8946: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.read = void 0; +function read(path, settings) { + const lstat = settings.fs.lstatSync(path); + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return lstat; + } + try { + const stat = settings.fs.statSync(path); + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + return stat; + } + catch (error) { + if (!settings.throwErrorOnBrokenSymbolicLink) { + return lstat; + } + throw error; + } +} +exports.read = read; + + +/***/ }), + +/***/ 8328: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fs = __webpack_require__(8980); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports["default"] = Settings; + + +/***/ }), + +/***/ 5439: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; +const async_1 = __webpack_require__(9346); +const stream_1 = __webpack_require__(215); +const sync_1 = __webpack_require__(4078); +const settings_1 = __webpack_require__(8690); +exports.Settings = settings_1.default; +function walk(directory, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); + return; + } + new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); +} +exports.walk = walk; +function walkSync(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new sync_1.default(directory, settings); + return provider.read(); +} +exports.walkSync = walkSync; +function walkStream(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new stream_1.default(directory, settings); + return provider.read(); +} +exports.walkStream = walkStream; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} + + +/***/ }), + +/***/ 9346: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const async_1 = __webpack_require__(4714); +class AsyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._storage = []; + } + read(callback) { + this._reader.onError((error) => { + callFailureCallback(callback, error); + }); + this._reader.onEntry((entry) => { + this._storage.push(entry); + }); + this._reader.onEnd(() => { + callSuccessCallback(callback, this._storage); + }); + this._reader.read(); + } +} +exports["default"] = AsyncProvider; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, entries) { + callback(null, entries); +} + + +/***/ }), + +/***/ 215: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const stream_1 = __webpack_require__(2781); +const async_1 = __webpack_require__(4714); +class StreamProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._stream = new stream_1.Readable({ + objectMode: true, + read: () => { }, + destroy: () => { + if (!this._reader.isDestroyed) { + this._reader.destroy(); + } + } + }); + } + read() { + this._reader.onError((error) => { + this._stream.emit('error', error); + }); + this._reader.onEntry((entry) => { + this._stream.push(entry); + }); + this._reader.onEnd(() => { + this._stream.push(null); + }); + this._reader.read(); + return this._stream; + } +} +exports["default"] = StreamProvider; + + +/***/ }), + +/***/ 4078: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const sync_1 = __webpack_require__(9555); +class SyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new sync_1.default(this._root, this._settings); + } + read() { + return this._reader.read(); + } +} +exports["default"] = SyncProvider; + + +/***/ }), + +/***/ 4714: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const events_1 = __webpack_require__(2361); +const fsScandir = __webpack_require__(5923); +const fastq = __webpack_require__(373); +const common = __webpack_require__(6865); +const reader_1 = __webpack_require__(5274); +class AsyncReader extends reader_1.default { + constructor(_root, _settings) { + super(_root, _settings); + this._settings = _settings; + this._scandir = fsScandir.scandir; + this._emitter = new events_1.EventEmitter(); + this._queue = fastq(this._worker.bind(this), this._settings.concurrency); + this._isFatalError = false; + this._isDestroyed = false; + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit('end'); + } + }; + } + read() { + this._isFatalError = false; + this._isDestroyed = false; + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + return this._emitter; + } + get isDestroyed() { + return this._isDestroyed; + } + destroy() { + if (this._isDestroyed) { + throw new Error('The reader is already destroyed'); + } + this._isDestroyed = true; + this._queue.killAndDrain(); + } + onEntry(callback) { + this._emitter.on('entry', callback); + } + onError(callback) { + this._emitter.once('error', callback); + } + onEnd(callback) { + this._emitter.once('end', callback); + } + _pushToQueue(directory, base) { + const queueItem = { directory, base }; + this._queue.push(queueItem, (error) => { + if (error !== null) { + this._handleError(error); + } + }); + } + _worker(item, done) { + this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { + if (error !== null) { + done(error, undefined); + return; + } + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + done(null, undefined); + }); + } + _handleError(error) { + if (this._isDestroyed || !common.isFatalError(this._settings, error)) { + return; + } + this._isFatalError = true; + this._isDestroyed = true; + this._emitter.emit('error', error); + } + _handleEntry(entry, base) { + if (this._isDestroyed || this._isFatalError) { + return; + } + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + } + } + _emitEntry(entry) { + this._emitter.emit('entry', entry); + } +} +exports["default"] = AsyncReader; + + +/***/ }), + +/***/ 6865: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; +function isFatalError(settings, error) { + if (settings.errorFilter === null) { + return true; + } + return !settings.errorFilter(error); +} +exports.isFatalError = isFatalError; +function isAppliedFilter(filter, value) { + return filter === null || filter(value); +} +exports.isAppliedFilter = isAppliedFilter; +function replacePathSegmentSeparator(filepath, separator) { + return filepath.split(/[/\\]/).join(separator); +} +exports.replacePathSegmentSeparator = replacePathSegmentSeparator; +function joinPathSegments(a, b, separator) { + if (a === '') { + return b; + } + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; +} +exports.joinPathSegments = joinPathSegments; + + +/***/ }), + +/***/ 5274: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const common = __webpack_require__(6865); +class Reader { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } +} +exports["default"] = Reader; + + +/***/ }), + +/***/ 9555: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fsScandir = __webpack_require__(5923); +const common = __webpack_require__(6865); +const reader_1 = __webpack_require__(5274); +class SyncReader extends reader_1.default { + constructor() { + super(...arguments); + this._scandir = fsScandir.scandirSync; + this._storage = []; + this._queue = new Set(); + } + read() { + this._pushToQueue(this._root, this._settings.basePath); + this._handleQueue(); + return this._storage; + } + _pushToQueue(directory, base) { + this._queue.add({ directory, base }); + } + _handleQueue() { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); + } + } + _handleDirectory(directory, base) { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + for (const entry of entries) { + this._handleEntry(entry, base); + } + } + catch (error) { + this._handleError(error); + } + } + _handleError(error) { + if (!common.isFatalError(this._settings, error)) { + return; + } + throw error; + } + _handleEntry(entry, base) { + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + } + } + _pushToStorage(entry) { + this._storage.push(entry); + } +} +exports["default"] = SyncReader; + + +/***/ }), + +/***/ 8690: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __webpack_require__(1017); +const fsScandir = __webpack_require__(5923); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.basePath = this._getValue(this._options.basePath, undefined); + this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); + this.deepFilter = this._getValue(this._options.deepFilter, null); + this.entryFilter = this._getValue(this._options.entryFilter, null); + this.errorFilter = this._getValue(this._options.errorFilter, null); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.fsScandirSettings = new fsScandir.Settings({ + followSymbolicLinks: this._options.followSymbolicLinks, + fs: this._options.fs, + pathSegmentSeparator: this._options.pathSegmentSeparator, + stats: this._options.stats, + throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports["default"] = Settings; + + +/***/ }), + +/***/ 7349: +/***/ ((module) => { + +var elean = (() => { + var __defProp = Object.defineProperty; + var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); + var __export = (target, all) => { + __markAsModule(target); + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); + }; + + // src/index.ts + var src_exports = {}; + __export(src_exports, { + default: () => src_default, + version: () => version + }); + + // package.json + var version = "1.0.0"; + + // src/index.ts + var src_default = (envVar) => { + const strVar = String(envVar).toLowerCase(); + if (strVar === "" || strVar === "false" || strVar === "0" || strVar === "null" || strVar === "undefined") { + return false; + } + return true; + }; + return src_exports; +})(); +//# sourceMappingURL=elean.js.map + true&&(module.exports=elean.default),'undefined'!=typeof window&&(elean=elean.default); + +/***/ }), + +/***/ 4246: +/***/ ((module, exports, __webpack_require__) => { + +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); +var __export = (target, all) => { + __markAsModule(target); + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __reExport = (target, module2, desc) => { + if (module2 && typeof module2 === "object" || typeof module2 === "function") { + for (let key of __getOwnPropNames(module2)) + if (!__hasOwnProp.call(target, key) && key !== "default") + __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); + } + return target; +}; +var __toModule = (module2) => { + return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); +}; + +// src/index.ts +__export(exports, { + ExecError: () => ExecError, + default: () => src_default, + version: () => version +}); +var import_child_process = __toModule(__webpack_require__(2081)); +var import_elean = __toModule(__webpack_require__(7349)); +var import_mono_context = __toModule(__webpack_require__(3507)); + +// package.json +var version = "2.0.2"; + +// src/index.ts +var ExecError = class extends Error { + constructor(message, exitCode, stdoutOutput, stderrOutput) { + super(message); + this.exitCode = exitCode; + this.stdoutOutput = stdoutOutput; + this.stderrOutput = stderrOutput; + } +}; +var { REALTIME_LOG } = process.env; +var exec = (command, options) => { + const { + realtimeStdout, + logStdout, + logStderr, + loggerInstance, + stdoutLogLevel, + stderrLogLevel + } = options || {}; + const shouldRealtimeLog = realtimeStdout || (0, import_elean.default)(REALTIME_LOG); + const logger = loggerInstance || import_mono_context.default.getStateValue("logger") || console; + const child = (0, import_child_process.exec)(command); + const { stdout, stderr } = child; + const stdoutChunks = []; + const stderrChunks = []; + let stdoutOutput = ""; + let stderrOutput = ""; + stdout?.on("data", (chunk) => { + logStdout && realtimeStdout && chunk && logger && logger[stdoutLogLevel || "debug"](chunk); + stdoutChunks.push(Buffer.from(chunk)); + }); + stderr?.on("data", (chunk) => { + logStderr && realtimeStdout && chunk && logger && logger[stderrLogLevel || "debug"](chunk); + stderrChunks.push(Buffer.from(chunk)); + }); + const stdoutPromise = new Promise((resolve, reject) => { + stdout?.on("end", () => { + stdoutOutput = Buffer.concat(stdoutChunks).toString("utf8"); + resolve(); + }); + }); + const stderrPromise = new Promise((resolve, reject) => { + stderr?.on("end", () => { + stderrOutput = Buffer.concat(stderrChunks).toString("utf8"); + resolve(); + }); + }); + return { + execProcess: child, + execPromise: new Promise((resolve, reject) => { + child.addListener("error", reject); + child.addListener("exit", async (exitCode) => { + await stdoutPromise; + await stderrPromise; + if (stdoutOutput && !shouldRealtimeLog && logStdout) { + logger[stdoutLogLevel || "debug"](stdoutOutput); + } + if (exitCode === 0 && stderrOutput && logStderr) { + await logger[stderrLogLevel || "warn"](stderrOutput); + } + if (exitCode !== 0 && logStderr) { + logger[stderrLogLevel || "warn"](`Error exit code of command "${command}" is: ${exitCode}`); + reject(new ExecError(stderrOutput || stdoutOutput, exitCode, stdoutOutput, stderrOutput)); + } + resolve({ + exitCode, + stdoutOutput, + stderrOutput + }); + }); + }) + }; +}; +var src_default = exec; +// Annotate the CommonJS export names for ESM import in node: +0 && (0); +//# sourceMappingURL=exec.js.map + true&&(module.exports=exec),'undefined'!=typeof window&&(exec=exec); + +/***/ }), + +/***/ 3507: +/***/ ((module) => { + +var MonoContext = (() => { + var __defProp = Object.defineProperty; + var __defProps = Object.defineProperties; + var __getOwnPropDescs = Object.getOwnPropertyDescriptors; + var __getOwnPropSymbols = Object.getOwnPropertySymbols; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __propIsEnum = Object.prototype.propertyIsEnumerable; + var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; + }; + var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); + var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); + var __objRest = (source, exclude) => { + var target = {}; + for (var prop in source) + if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) + target[prop] = source[prop]; + if (source != null && __getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(source)) { + if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) + target[prop] = source[prop]; + } + return target; + }; + var __export = (target, all) => { + __markAsModule(target); + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); + }; + + // src/index.ts + var src_exports = {}; + __export(src_exports, { + default: () => MonoContext, + version: () => version + }); + + // package.json + var version = "1.1.2"; + + // src/index.ts + var _MonoContext = class { + constructor(warningOff = false) { + this.count = _MonoContext.count; + this.getCount = _MonoContext.getCount; + this.resetCount = _MonoContext.resetCount; + this.resetAllCounts = _MonoContext.resetAllCounts; + this.setState = _MonoContext.setState; + this.getState = _MonoContext.getState; + this.getStateValue = _MonoContext.getStateValue; + this.resetState = _MonoContext.resetState; + if (!warningOff) { + console.log("WARNING: instantiating MonoContext is unnecessary, all methods are statically defined"); + } + if (!_MonoContext.instance) { + _MonoContext.instance = this; + return this; + } + return _MonoContext.instance; + } + }; + var MonoContext = _MonoContext; + MonoContext._stateCreatedAt = new Date(); + MonoContext._stateUpdatedAt = new Date(); + MonoContext._counts = {}; + MonoContext._state = {}; + MonoContext.version = version; + MonoContext.default = _MonoContext; + MonoContext._warningMessage = 'WARNING: refusing to override "PROPERTY" property in MonoContext state'; + MonoContext.count = (key) => { + if (!_MonoContext._counts[key]) { + _MonoContext._counts[key] = 0; + } + _MonoContext._counts[key] += 1; + return _MonoContext._counts[key]; + }; + MonoContext.getCount = (key) => _MonoContext._counts[key] || 0; + MonoContext.resetCount = (key) => { + if (_MonoContext._counts[key]) { + _MonoContext._counts[key] = 0; + } + }; + MonoContext.resetAllCounts = () => { + _MonoContext._counts = {}; + }; + MonoContext.setState = (newState) => { + if (Object.keys(newState).includes("stateCreatedAt")) { + console.log(_MonoContext._warningMessage.replace("PROPERTY", "stateCreatedAt")); + } + if (Object.keys(newState).includes("stateUpdatedAt")) { + console.log(_MonoContext._warningMessage.replace("PROPERTY", "stateUpdatedAt")); + } + if (Object.keys(newState).includes("counts")) { + console.log(_MonoContext._warningMessage.replace("PROPERTY", "counts")); + } + const _a = newState, { + counts, + stateCreatedAt, + stateUpdatedAt + } = _a, safeNewState = __objRest(_a, [ + "counts", + "stateCreatedAt", + "stateUpdatedAt" + ]); + if (Object.keys(safeNewState).length > 0) { + _MonoContext._state = __spreadValues(__spreadValues({}, _MonoContext._state), safeNewState); + _MonoContext._stateUpdatedAt = new Date(); + } + return _MonoContext.getState(); + }; + MonoContext.getState = () => { + return _MonoContext._state = __spreadProps(__spreadValues({}, _MonoContext._state), { + counts: __spreadValues({}, _MonoContext._counts), + stateCreatedAt: _MonoContext._stateCreatedAt, + stateUpdatedAt: _MonoContext._stateUpdatedAt + }); + }; + MonoContext.getStateValue = (key) => _MonoContext._state[key]; + MonoContext.resetState = () => { + _MonoContext._stateCreatedAt = new Date(); + _MonoContext._stateUpdatedAt = new Date(); + _MonoContext._state = {}; + }; + return src_exports; +})(); +//# sourceMappingURL=mono-context.js.map + true&&(module.exports=MonoContext.default),'undefined'!=typeof window&&(MonoContext=MonoContext.default); + +/***/ }), + +/***/ 1182: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const stringify = __webpack_require__(3349); +const compile = __webpack_require__(7529); +const expand = __webpack_require__(8050); +const parse = __webpack_require__(4339); + +/** + * Expand the given pattern or create a regex-compatible string. + * + * ```js + * const braces = require('braces'); + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +const braces = (input, options = {}) => { + let output = []; + + if (Array.isArray(input)) { + for (let pattern of input) { + let result = braces.create(pattern, options); + if (Array.isArray(result)) { + output.push(...result); + } else { + output.push(result); + } + } + } else { + output = [].concat(braces.create(input, options)); + } + + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; + } + return output; +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * // braces.parse(pattern, [, options]); + * const ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * ``` + * @param {String} pattern Brace pattern to parse + * @param {Object} options + * @return {Object} Returns an AST + * @api public + */ + +braces.parse = (input, options = {}) => parse(input, options); + +/** + * Creates a braces string from an AST, or an AST node. + * + * ```js + * const braces = require('braces'); + * let ast = braces.parse('foo/{a,b}/bar'); + * console.log(stringify(ast.nodes[2])); //=> '{a,b}' + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.stringify = (input, options = {}) => { + if (typeof input === 'string') { + return stringify(braces.parse(input, options), options); + } + return stringify(input, options); +}; + +/** + * Compiles a brace pattern into a regex-compatible, optimized string. + * This method is called by the main [braces](#braces) function by default. + * + * ```js + * const braces = require('braces'); + * console.log(braces.compile('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.compile = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + return compile(input, options); +}; + +/** + * Expands a brace pattern into an array. This method is called by the + * main [braces](#braces) function when `options.expand` is true. Before + * using this method it's recommended that you read the [performance notes](#performance)) + * and advantages of using [.compile](#compile) instead. + * + * ```js + * const braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.expand = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + + let result = expand(input, options); + + // filter out empty strings if specified + if (options.noempty === true) { + result = result.filter(Boolean); + } + + // filter out duplicates if specified + if (options.nodupes === true) { + result = [...new Set(result)]; + } + + return result; +}; + +/** + * Processes a brace pattern and returns either an expanded array + * (if `options.expand` is true), a highly optimized regex-compatible string. + * This method is called by the main [braces](#braces) function. + * + * ```js + * const braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.create = (input, options = {}) => { + if (input === '' || input.length < 3) { + return [input]; + } + + return options.expand !== true + ? braces.compile(input, options) + : braces.expand(input, options); +}; + +/** + * Expose "braces" + */ + +module.exports = braces; + + +/***/ }), + +/***/ 7529: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fill = __webpack_require__(2664); +const utils = __webpack_require__(3083); + +const compile = (ast, options = {}) => { + let walk = (node, parent = {}) => { + let invalidBlock = utils.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let invalid = invalidBlock === true || invalidNode === true; + let prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + + if (node.isOpen === true) { + return prefix + node.value; + } + if (node.isClose === true) { + return prefix + node.value; + } + + if (node.type === 'open') { + return invalid ? (prefix + node.value) : '('; + } + + if (node.type === 'close') { + return invalid ? (prefix + node.value) : ')'; + } + + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); + } + + if (node.value) { + return node.value; + } + + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); + let range = fill(...args, { ...options, wrap: false, toRegex: true }); + + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + + if (node.nodes) { + for (let child of node.nodes) { + output += walk(child, node); + } + } + return output; + }; + + return walk(ast); +}; + +module.exports = compile; + + +/***/ }), + +/***/ 6611: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + MAX_LENGTH: 1024 * 64, + + // Digits + CHAR_0: '0', /* 0 */ + CHAR_9: '9', /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 'A', /* A */ + CHAR_LOWERCASE_A: 'a', /* a */ + CHAR_UPPERCASE_Z: 'Z', /* Z */ + CHAR_LOWERCASE_Z: 'z', /* z */ + + CHAR_LEFT_PARENTHESES: '(', /* ( */ + CHAR_RIGHT_PARENTHESES: ')', /* ) */ + + CHAR_ASTERISK: '*', /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: '&', /* & */ + CHAR_AT: '@', /* @ */ + CHAR_BACKSLASH: '\\', /* \ */ + CHAR_BACKTICK: '`', /* ` */ + CHAR_CARRIAGE_RETURN: '\r', /* \r */ + CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ + CHAR_COLON: ':', /* : */ + CHAR_COMMA: ',', /* , */ + CHAR_DOLLAR: '$', /* . */ + CHAR_DOT: '.', /* . */ + CHAR_DOUBLE_QUOTE: '"', /* " */ + CHAR_EQUAL: '=', /* = */ + CHAR_EXCLAMATION_MARK: '!', /* ! */ + CHAR_FORM_FEED: '\f', /* \f */ + CHAR_FORWARD_SLASH: '/', /* / */ + CHAR_HASH: '#', /* # */ + CHAR_HYPHEN_MINUS: '-', /* - */ + CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ + CHAR_LEFT_CURLY_BRACE: '{', /* { */ + CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ + CHAR_LINE_FEED: '\n', /* \n */ + CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ + CHAR_PERCENT: '%', /* % */ + CHAR_PLUS: '+', /* + */ + CHAR_QUESTION_MARK: '?', /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ + CHAR_RIGHT_CURLY_BRACE: '}', /* } */ + CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ + CHAR_SEMICOLON: ';', /* ; */ + CHAR_SINGLE_QUOTE: '\'', /* ' */ + CHAR_SPACE: ' ', /* */ + CHAR_TAB: '\t', /* \t */ + CHAR_UNDERSCORE: '_', /* _ */ + CHAR_VERTICAL_LINE: '|', /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ +}; + + +/***/ }), + +/***/ 8050: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fill = __webpack_require__(2664); +const stringify = __webpack_require__(3349); +const utils = __webpack_require__(3083); + +const append = (queue = '', stash = '', enclose = false) => { + let result = []; + + queue = [].concat(queue); + stash = [].concat(stash); + + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; + } + + for (let item of queue) { + if (Array.isArray(item)) { + for (let value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); + } + } + } + return utils.flatten(result); +}; + +const expand = (ast, options = {}) => { + let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; + + let walk = (node, parent = {}) => { + node.queue = []; + + let p = parent; + let q = parent.queue; + + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } + + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; + } + + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } + + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); + + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } + + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } + + let enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; + + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; + } + + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i]; + + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } + + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } + } + + return queue; + }; + + return utils.flatten(walk(ast)); +}; + +module.exports = expand; + + +/***/ }), + +/***/ 4339: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const stringify = __webpack_require__(3349); + +/** + * Constants + */ + +const { + MAX_LENGTH, + CHAR_BACKSLASH, /* \ */ + CHAR_BACKTICK, /* ` */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, /* ] */ + CHAR_DOUBLE_QUOTE, /* " */ + CHAR_SINGLE_QUOTE, /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = __webpack_require__(6611); + +/** + * parse + */ + +const parse = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + let opts = options || {}; + let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } + + let ast = { type: 'root', input, nodes: [] }; + let stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + let length = input.length; + let index = 0; + let depth = 0; + let value; + let memo = {}; + + /** + * Helpers + */ + + const advance = () => input[index++]; + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; + } + + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; + } + + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; + + push({ type: 'bos' }); + + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); + + /** + * Invalid chars + */ + + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } + + /** + * Escaped chars + */ + + if (value === CHAR_BACKSLASH) { + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); + continue; + } + + /** + * Right square bracket (literal): ']' + */ + + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ type: 'text', value: '\\' + value }); + continue; + } + + /** + * Left square bracket: '[' + */ + + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + + let closed = true; + let next; + + while (index < length && (next = advance())) { + value += next; + + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } + + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; + + if (brackets === 0) { + break; + } + } + } + + push({ type: 'text', value }); + continue; + } + + /** + * Parentheses + */ + + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: 'paren', nodes: [] }); + stack.push(block); + push({ type: 'text', value }); + continue; + } + + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ type: 'text', value }); + continue; + } + block = stack.pop(); + push({ type: 'text', value }); + block = stack[stack.length - 1]; + continue; + } + + /** + * Quotes: '|"|` + */ + + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + let open = value; + let next; + + if (options.keepQuotes !== true) { + value = ''; + } + + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } + + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } + + value += next; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Left curly brace: '{' + */ + + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; + + let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + let brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; + + block = push(brace); + stack.push(block); + push({ type: 'open', value }); + continue; + } + + /** + * Right curly brace: '}' + */ + + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ type: 'text', value }); + continue; + } + + let type = 'close'; + block = stack.pop(); + block.close = true; + + push({ type, value }); + depth--; + + block = stack[stack.length - 1]; + continue; + } + + /** + * Comma: ',' + */ + + if (value === CHAR_COMMA && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + let open = block.nodes.shift(); + block.nodes = [open, { type: 'text', value: stringify(block) }]; + } + + push({ type: 'comma', value }); + block.commas++; + continue; + } + + /** + * Dot: '.' + */ + + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + let siblings = block.nodes; + + if (depth === 0 || siblings.length === 0) { + push({ type: 'text', value }); + continue; + } + + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; + + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } + + block.ranges++; + block.args = []; + continue; + } + + if (prev.type === 'range') { + siblings.pop(); + + let before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } + + push({ type: 'dot', value }); + continue; + } + + /** + * Text + */ + + push({ type: 'text', value }); + } + + // Mark imbalanced braces and brackets as invalid + do { + block = stack.pop(); + + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); + + // get the location of the block on parent.nodes (block's siblings) + let parent = stack[stack.length - 1]; + let index = parent.nodes.indexOf(block); + // replace the (invalid) block with it's nodes + parent.nodes.splice(index, 1, ...block.nodes); + } + } while (stack.length > 0); + + push({ type: 'eos' }); + return ast; +}; + +module.exports = parse; + + +/***/ }), + +/***/ 3349: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const utils = __webpack_require__(3083); + +module.exports = (ast, options = {}) => { + let stringify = (node, parent = {}) => { + let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; + + if (node.value) { + if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { + return '\\' + node.value; + } + return node.value; + } + + if (node.value) { + return node.value; + } + + if (node.nodes) { + for (let child of node.nodes) { + output += stringify(child); + } + } + return output; + }; + + return stringify(ast); +}; + + + +/***/ }), + +/***/ 3083: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; +}; + +/** + * Find a node of the given type + */ + +exports.find = (node, type) => node.nodes.find(node => node.type === type); + +/** + * Find a node of the given type + */ + +exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return ((Number(max) - Number(min)) / Number(step)) >= limit; +}; + +/** + * Escape the given node with '\\' before node.value + */ + +exports.escapeNode = (block, n = 0, type) => { + let node = block.nodes[n]; + if (!node) return; + + if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; + } + } +}; + +/** + * Returns true if the given brace node should be enclosed in literal braces + */ + +exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + if ((node.commas >> 0 + node.ranges >> 0) === 0) { + node.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a brace node is invalid. + */ + +exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + if ((block.commas >> 0 + block.ranges >> 0) === 0) { + block.invalid = true; + return true; + } + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a node is an open or close node + */ + +exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; + } + return node.open === true || node.close === true; +}; + +/** + * Reduce an array of text nodes. + */ + +exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; +}, []); + +/** + * Flatten an array + */ + +exports.flatten = (...args) => { + const result = []; + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + let ele = arr[i]; + Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); + } + return result; + }; + flat(args); + return result; +}; + + +/***/ }), + +/***/ 8309: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const cp = __webpack_require__(2081); +const parse = __webpack_require__(4605); +const enoent = __webpack_require__(3743); + +function spawn(command, args, options) { + // Parse the arguments + const parsed = parse(command, args, options); + + // Spawn the child process + const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); + + // Hook into child process "exit" event to emit an error if the command + // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + enoent.hookChildProcess(spawned, parsed); + + return spawned; +} + +function spawnSync(command, args, options) { + // Parse the arguments + const parsed = parse(command, args, options); + + // Spawn the child process + const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); + + // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); + + return result; +} + +module.exports = spawn; +module.exports.spawn = spawn; +module.exports.sync = spawnSync; + +module.exports._parse = parse; +module.exports._enoent = enoent; + + +/***/ }), + +/***/ 3743: +/***/ ((module) => { + +"use strict"; + + +const isWin = process.platform === 'win32'; + +function notFoundError(original, syscall) { + return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { + code: 'ENOENT', + errno: 'ENOENT', + syscall: `${syscall} ${original.command}`, + path: original.command, + spawnargs: original.args, + }); +} + +function hookChildProcess(cp, parsed) { + if (!isWin) { + return; + } + + const originalEmit = cp.emit; + + cp.emit = function (name, arg1) { + // If emitting "exit" event and exit code is 1, we need to check if + // the command exists and emit an "error" instead + // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 + if (name === 'exit') { + const err = verifyENOENT(arg1, parsed, 'spawn'); + + if (err) { + return originalEmit.call(cp, 'error', err); + } + } + + return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params + }; +} + +function verifyENOENT(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, 'spawn'); + } + + return null; +} + +function verifyENOENTSync(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, 'spawnSync'); + } + + return null; +} + +module.exports = { + hookChildProcess, + verifyENOENT, + verifyENOENTSync, + notFoundError, +}; + + +/***/ }), + +/***/ 4605: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const path = __webpack_require__(1017); +const resolveCommand = __webpack_require__(2202); +const escape = __webpack_require__(5081); +const readShebang = __webpack_require__(7550); + +const isWin = process.platform === 'win32'; +const isExecutableRegExp = /\.(?:com|exe)$/i; +const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; + +function detectShebang(parsed) { + parsed.file = resolveCommand(parsed); + + const shebang = parsed.file && readShebang(parsed.file); + + if (shebang) { + parsed.args.unshift(parsed.file); + parsed.command = shebang; + + return resolveCommand(parsed); + } + + return parsed.file; +} + +function parseNonShell(parsed) { + if (!isWin) { + return parsed; + } + + // Detect & add support for shebangs + const commandFile = detectShebang(parsed); + + // We don't need a shell if the command filename is an executable + const needsShell = !isExecutableRegExp.test(commandFile); + + // If a shell is required, use cmd.exe and take care of escaping everything correctly + // Note that `forceShell` is an hidden option used only in tests + if (parsed.options.forceShell || needsShell) { + // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` + // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument + // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, + // we need to double escape them + const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); + + // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) + // This is necessary otherwise it will always fail with ENOENT in those cases + parsed.command = path.normalize(parsed.command); + + // Escape command & arguments + parsed.command = escape.command(parsed.command); + parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); + + const shellCommand = [parsed.command].concat(parsed.args).join(' '); + + parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; + parsed.command = process.env.comspec || 'cmd.exe'; + parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped + } + + return parsed; +} + +function parse(command, args, options) { + // Normalize arguments, similar to nodejs + if (args && !Array.isArray(args)) { + options = args; + args = null; + } + + args = args ? args.slice(0) : []; // Clone array to avoid changing the original + options = Object.assign({}, options); // Clone object to avoid changing the original + + // Build our parsed object + const parsed = { + command, + args, + options, + file: undefined, + original: { + command, + args, + }, + }; + + // Delegate further parsing to shell or non-shell + return options.shell ? parsed : parseNonShell(parsed); +} + +module.exports = parse; + + +/***/ }), + +/***/ 5081: +/***/ ((module) => { + +"use strict"; + + +// See http://www.robvanderwoude.com/escapechars.php +const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; + +function escapeCommand(arg) { + // Escape meta chars + arg = arg.replace(metaCharsRegExp, '^$1'); + + return arg; +} + +function escapeArgument(arg, doubleEscapeMetaChars) { + // Convert to string + arg = `${arg}`; + + // Algorithm below is based on https://qntm.org/cmd + + // Sequence of backslashes followed by a double quote: + // double up all the backslashes and escape the double quote + arg = arg.replace(/(\\*)"/g, '$1$1\\"'); + + // Sequence of backslashes followed by the end of the string + // (which will become a double quote later): + // double up all the backslashes + arg = arg.replace(/(\\*)$/, '$1$1'); + + // All other backslashes occur literally + + // Quote the whole thing: + arg = `"${arg}"`; + + // Escape meta chars + arg = arg.replace(metaCharsRegExp, '^$1'); + + // Double escape meta chars if necessary + if (doubleEscapeMetaChars) { + arg = arg.replace(metaCharsRegExp, '^$1'); + } + + return arg; +} + +module.exports.command = escapeCommand; +module.exports.argument = escapeArgument; + + +/***/ }), + +/***/ 7550: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fs = __webpack_require__(7147); +const shebangCommand = __webpack_require__(2063); + +function readShebang(command) { + // Read the first 150 bytes from the file + const size = 150; + const buffer = Buffer.alloc(size); + + let fd; + + try { + fd = fs.openSync(command, 'r'); + fs.readSync(fd, buffer, 0, size, 0); + fs.closeSync(fd); + } catch (e) { /* Empty */ } + + // Attempt to extract shebang (null is returned if not a shebang) + return shebangCommand(buffer.toString()); +} + +module.exports = readShebang; + + +/***/ }), + +/***/ 2202: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const path = __webpack_require__(1017); +const which = __webpack_require__(3500); +const getPathKey = __webpack_require__(3024); + +function resolveCommandAttempt(parsed, withoutPathExt) { + const env = parsed.options.env || process.env; + const cwd = process.cwd(); + const hasCustomCwd = parsed.options.cwd != null; + // Worker threads do not have process.chdir() + const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; + + // If a custom `cwd` was specified, we need to change the process cwd + // because `which` will do stat calls but does not support a custom cwd + if (shouldSwitchCwd) { + try { + process.chdir(parsed.options.cwd); + } catch (err) { + /* Empty */ + } + } + + let resolved; + + try { + resolved = which.sync(parsed.command, { + path: env[getPathKey({ env })], + pathExt: withoutPathExt ? path.delimiter : undefined, + }); + } catch (e) { + /* Empty */ + } finally { + if (shouldSwitchCwd) { + process.chdir(cwd); + } + } + + // If we successfully resolved, ensure that an absolute path is returned + // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it + if (resolved) { + resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); + } + + return resolved; +} + +function resolveCommand(parsed) { + return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); +} + +module.exports = resolveCommand; + + +/***/ }), + +/***/ 3500: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +const path = __webpack_require__(1017) +const COLON = isWindows ? ';' : ':' +const isexe = __webpack_require__(1959) + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, opt) => { + const colon = opt.colon || COLON + + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] + : ( + [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(opt.path || process.env.PATH || + /* istanbul ignore next: very unusual */ '').split(colon), + ] + ) + const pathExtExe = isWindows + ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' + : '' + const pathExt = isWindows ? pathExtExe.split(colon) : [''] + + if (isWindows) { + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + return { + pathEnv, + pathExt, + pathExtExe, + } +} + +const which = (cmd, opt, cb) => { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + if (!opt) + opt = {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + const step = i => new Promise((resolve, reject) => { + if (i === pathEnv.length) + return opt.all && found.length ? resolve(found) + : reject(getNotFoundError(cmd)) + + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + resolve(subStep(p, i, 0)) + }) + + const subStep = (p, i, ii) => new Promise((resolve, reject) => { + if (ii === pathExt.length) + return resolve(step(i + 1)) + const ext = pathExt[ii] + isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { + if (!er && is) { + if (opt.all) + found.push(p + ext) + else + return resolve(p + ext) + } + return resolve(subStep(p, i, ii + 1)) + }) + }) + + return cb ? step(0).then(res => cb(null, res), cb) : step(0) +} + +const whichSync = (cmd, opt) => { + opt = opt || {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (let i = 0; i < pathEnv.length; i ++) { + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + for (let j = 0; j < pathExt.length; j ++) { + const cur = p + pathExt[j] + try { + const is = isexe.sync(cur, { pathExt: pathExtExe }) + if (is) { + if (opt.all) + found.push(cur) + else + return cur + } + } catch (ex) {} + } + } + + if (opt.all && found.length) + return found + + if (opt.nothrow) + return null + + throw getNotFoundError(cmd) +} + +module.exports = which +which.sync = whichSync + + +/***/ }), + +/***/ 6004: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var isGlob = __webpack_require__(6830); +var pathPosixDirname = (__webpack_require__(1017).posix).dirname; +var isWin32 = (__webpack_require__(2037).platform)() === 'win32'; + +var slash = '/'; +var backslash = /\\/g; +var enclosure = /[\{\[].*[\}\]]$/; +var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; + +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + * @returns {string} + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + + // special case for strings ending in enclosure containing path separator + if (enclosure.test(str)) { + str += slash; + } + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlob(str) || globby.test(str)); + + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; + + +/***/ }), + +/***/ 3294: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const taskManager = __webpack_require__(5135); +const async_1 = __webpack_require__(3456); +const stream_1 = __webpack_require__(3403); +const sync_1 = __webpack_require__(4113); +const settings_1 = __webpack_require__(3862); +const utils = __webpack_require__(4426); +async function FastGlob(source, options) { + assertPatternsInput(source); + const works = getWorks(source, async_1.default, options); + const result = await Promise.all(works); + return utils.array.flatten(result); +} +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +(function (FastGlob) { + FastGlob.glob = FastGlob; + FastGlob.globSync = sync; + FastGlob.globStream = stream; + FastGlob.async = FastGlob; + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + return utils.stream.merge(works); + } + FastGlob.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob.escapePath = escapePath; + function convertPathToPattern(source) { + assertPatternsInput(source); + return utils.path.convertPathToPattern(source); + } + FastGlob.convertPathToPattern = convertPathToPattern; + let posix; + (function (posix) { + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escapePosixPath(source); + } + posix.escapePath = escapePath; + function convertPathToPattern(source) { + assertPatternsInput(source); + return utils.path.convertPosixPathToPattern(source); + } + posix.convertPathToPattern = convertPathToPattern; + })(posix = FastGlob.posix || (FastGlob.posix = {})); + let win32; + (function (win32) { + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escapeWindowsPath(source); + } + win32.escapePath = escapePath; + function convertPathToPattern(source) { + assertPatternsInput(source); + return utils.path.convertWindowsPathToPattern(source); + } + win32.convertPathToPattern = convertPathToPattern; + })(win32 = FastGlob.win32 || (FastGlob.win32 = {})); +})(FastGlob || (FastGlob = {})); +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); +} +function assertPatternsInput(input) { + const source = [].concat(input); + const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); + if (!isValidSource) { + throw new TypeError('Patterns must be a string (non empty) or an array of strings'); + } +} +module.exports = FastGlob; + + +/***/ }), + +/***/ 5135: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; +const utils = __webpack_require__(4426); +function generate(input, settings) { + const patterns = processPatterns(input, settings); + const ignore = processPatterns(settings.ignore, settings); + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, ignore); + const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); +} +exports.generate = generate; +function processPatterns(input, settings) { + let patterns = input; + /** + * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry + * and some problems with the micromatch package (see fast-glob issues: #365, #394). + * + * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown + * in matching in the case of a large set of patterns after expansion. + */ + if (settings.braceExpansion) { + patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns); + } + /** + * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used + * at any nesting level. + * + * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change + * the pattern in the filter before creating a regular expression. There is no need to change the patterns + * in the application. Only on the input. + */ + if (settings.baseNameMatch) { + patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`); + } + /** + * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion. + */ + return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern)); +} +/** + * Returns tasks grouped by basic pattern directories. + * + * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately. + * This is necessary because directory traversal starts at the base directory and goes deeper. + */ +function convertPatternsToTasks(positive, negative, dynamic) { + const tasks = []; + const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive); + const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive); + const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory); + const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory); + tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic)); + /* + * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory + * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest. + */ + if ('.' in insideCurrentDirectoryGroup) { + tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic)); + } + else { + tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic)); + } + return tasks; +} +exports.convertPatternsToTasks = convertPatternsToTasks; +function getPositivePatterns(patterns) { + return utils.pattern.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils.pattern.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils.pattern.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, group); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map((base) => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; + + +/***/ }), + +/***/ 3456: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const async_1 = __webpack_require__(1973); +const provider_1 = __webpack_require__(466); +class ProviderAsync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new async_1.default(this._settings); + } + async read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = await this.api(root, task, options); + return entries.map((entry) => options.transform(entry)); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports["default"] = ProviderAsync; + + +/***/ }), + +/***/ 346: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __webpack_require__(4426); +const partial_1 = __webpack_require__(7769); +class DeepFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + } + getFilter(basePath, positive, negative) { + const matcher = this._getMatcher(positive); + const negativeRe = this._getNegativePatternsRe(negative); + return (entry) => this._filter(basePath, entry, matcher, negativeRe); + } + _getMatcher(patterns) { + return new partial_1.default(patterns, this._settings, this._micromatchOptions); + } + _getNegativePatternsRe(patterns) { + const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); + return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); + } + _filter(basePath, entry, matcher, negativeRe) { + if (this._isSkippedByDeep(basePath, entry.path)) { + return false; + } + if (this._isSkippedSymbolicLink(entry)) { + return false; + } + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._isSkippedByPositivePatterns(filepath, matcher)) { + return false; + } + return this._isSkippedByNegativePatterns(filepath, negativeRe); + } + _isSkippedByDeep(basePath, entryPath) { + /** + * Avoid unnecessary depth calculations when it doesn't matter. + */ + if (this._settings.deep === Infinity) { + return false; + } + return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; + } + _getEntryLevel(basePath, entryPath) { + const entryPathDepth = entryPath.split('/').length; + if (basePath === '') { + return entryPathDepth; + } + const basePathDepth = basePath.split('/').length; + return entryPathDepth - basePathDepth; + } + _isSkippedSymbolicLink(entry) { + return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); + } + _isSkippedByPositivePatterns(entryPath, matcher) { + return !this._settings.baseNameMatch && !matcher.match(entryPath); + } + _isSkippedByNegativePatterns(entryPath, patternsRe) { + return !utils.pattern.matchAny(entryPath, patternsRe); + } +} +exports["default"] = DeepFilter; + + +/***/ }), + +/***/ 7026: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __webpack_require__(4426); +class EntryFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this.index = new Map(); + } + getFilter(positive, negative) { + const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions); + const negativeRe = utils.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })); + return (entry) => this._filter(entry, positiveRe, negativeRe); + } + _filter(entry, positiveRe, negativeRe) { + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._settings.unique && this._isDuplicateEntry(filepath)) { + return false; + } + if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { + return false; + } + if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) { + return false; + } + const isDirectory = entry.dirent.isDirectory(); + const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory); + if (this._settings.unique && isMatched) { + this._createIndexRecord(filepath); + } + return isMatched; + } + _isDuplicateEntry(filepath) { + return this.index.has(filepath); + } + _createIndexRecord(filepath) { + this.index.set(filepath, undefined); + } + _onlyFileFilter(entry) { + return this._settings.onlyFiles && !entry.dirent.isFile(); + } + _onlyDirectoryFilter(entry) { + return this._settings.onlyDirectories && !entry.dirent.isDirectory(); + } + _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { + if (!this._settings.absolute) { + return false; + } + const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); + return utils.pattern.matchAny(fullpath, patternsRe); + } + _isMatchToPatterns(filepath, patternsRe, isDirectory) { + // Trying to match files and directories by patterns. + const isMatched = utils.pattern.matchAny(filepath, patternsRe); + // A pattern with a trailling slash can be used for directory matching. + // To apply such pattern, we need to add a tralling slash to the path. + if (!isMatched && isDirectory) { + return utils.pattern.matchAny(filepath + '/', patternsRe); + } + return isMatched; + } +} +exports["default"] = EntryFilter; + + +/***/ }), + +/***/ 3046: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __webpack_require__(4426); +class ErrorFilter { + constructor(_settings) { + this._settings = _settings; + } + getFilter() { + return (error) => this._isNonFatalError(error); + } + _isNonFatalError(error) { + return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } +} +exports["default"] = ErrorFilter; + + +/***/ }), + +/***/ 92: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __webpack_require__(4426); +class Matcher { + constructor(_patterns, _settings, _micromatchOptions) { + this._patterns = _patterns; + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this._storage = []; + this._fillStorage(); + } + _fillStorage() { + for (const pattern of this._patterns) { + const segments = this._getPatternSegments(pattern); + const sections = this._splitSegmentsIntoSections(segments); + this._storage.push({ + complete: sections.length <= 1, + pattern, + segments, + sections + }); + } + } + _getPatternSegments(pattern) { + const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); + return parts.map((part) => { + const dynamic = utils.pattern.isDynamicPattern(part, this._settings); + if (!dynamic) { + return { + dynamic: false, + pattern: part + }; + } + return { + dynamic: true, + pattern: part, + patternRe: utils.pattern.makeRe(part, this._micromatchOptions) + }; + }); + } + _splitSegmentsIntoSections(segments) { + return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); + } +} +exports["default"] = Matcher; + + +/***/ }), + +/***/ 7769: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const matcher_1 = __webpack_require__(92); +class PartialMatcher extends matcher_1.default { + match(filepath) { + const parts = filepath.split('/'); + const levels = parts.length; + const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); + for (const pattern of patterns) { + const section = pattern.sections[0]; + /** + * In this case, the pattern has a globstar and we must read all directories unconditionally, + * but only if the level has reached the end of the first group. + * + * fixtures/{a,b}/** + * ^ true/false ^ always true + */ + if (!pattern.complete && levels > section.length) { + return true; + } + const match = parts.every((part, index) => { + const segment = pattern.segments[index]; + if (segment.dynamic && segment.patternRe.test(part)) { + return true; + } + if (!segment.dynamic && segment.pattern === part) { + return true; + } + return false; + }); + if (match) { + return true; + } + } + return false; + } +} +exports["default"] = PartialMatcher; + + +/***/ }), + +/***/ 466: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __webpack_require__(1017); +const deep_1 = __webpack_require__(346); +const entry_1 = __webpack_require__(7026); +const error_1 = __webpack_require__(3046); +const entry_2 = __webpack_require__(218); +class Provider { + constructor(_settings) { + this._settings = _settings; + this.errorFilter = new error_1.default(this._settings); + this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); + this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); + this.entryTransformer = new entry_2.default(this._settings); + } + _getRootDirectory(task) { + return path.resolve(this._settings.cwd, task.base); + } + _getReaderOptions(task) { + const basePath = task.base === '.' ? '' : task.base; + return { + basePath, + pathSegmentSeparator: '/', + concurrency: this._settings.concurrency, + deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), + entryFilter: this.entryFilter.getFilter(task.positive, task.negative), + errorFilter: this.errorFilter.getFilter(), + followSymbolicLinks: this._settings.followSymbolicLinks, + fs: this._settings.fs, + stats: this._settings.stats, + throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, + transform: this.entryTransformer.getTransformer() + }; + } + _getMicromatchOptions() { + return { + dot: this._settings.dot, + matchBase: this._settings.baseNameMatch, + nobrace: !this._settings.braceExpansion, + nocase: !this._settings.caseSensitiveMatch, + noext: !this._settings.extglob, + noglobstar: !this._settings.globstar, + posix: true, + strictSlashes: false + }; + } +} +exports["default"] = Provider; + + +/***/ }), + +/***/ 3403: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const stream_1 = __webpack_require__(2781); +const stream_2 = __webpack_require__(9086); +const provider_1 = __webpack_require__(466); +class ProviderStream extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_2.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const source = this.api(root, task, options); + const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); + source + .once('error', (error) => destination.emit('error', error)) + .on('data', (entry) => destination.emit('data', options.transform(entry))) + .once('end', () => destination.emit('end')); + destination + .once('close', () => source.destroy()); + return destination; + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports["default"] = ProviderStream; + + +/***/ }), + +/***/ 4113: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const sync_1 = __webpack_require__(112); +const provider_1 = __webpack_require__(466); +class ProviderSync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new sync_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports["default"] = ProviderSync; + + +/***/ }), + +/***/ 218: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __webpack_require__(4426); +class EntryTransformer { + constructor(_settings) { + this._settings = _settings; + } + getTransformer() { + return (entry) => this._transform(entry); + } + _transform(entry) { + let filepath = entry.path; + if (this._settings.absolute) { + filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils.path.unixify(filepath); + } + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += '/'; + } + if (!this._settings.objectMode) { + return filepath; + } + return Object.assign(Object.assign({}, entry), { path: filepath }); + } +} +exports["default"] = EntryTransformer; + + +/***/ }), + +/***/ 1973: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fsWalk = __webpack_require__(5439); +const reader_1 = __webpack_require__(2117); +const stream_1 = __webpack_require__(9086); +class ReaderAsync extends reader_1.default { + constructor() { + super(...arguments); + this._walkAsync = fsWalk.walk; + this._readerStream = new stream_1.default(this._settings); + } + dynamic(root, options) { + return new Promise((resolve, reject) => { + this._walkAsync(root, options, (error, entries) => { + if (error === null) { + resolve(entries); + } + else { + reject(error); + } + }); + }); + } + async static(patterns, options) { + const entries = []; + const stream = this._readerStream.static(patterns, options); + // After #235, replace it with an asynchronous iterator. + return new Promise((resolve, reject) => { + stream.once('error', reject); + stream.on('data', (entry) => entries.push(entry)); + stream.once('end', () => resolve(entries)); + }); + } +} +exports["default"] = ReaderAsync; + + +/***/ }), + +/***/ 2117: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __webpack_require__(1017); +const fsStat = __webpack_require__(6203); +const utils = __webpack_require__(4426); +class Reader { + constructor(_settings) { + this._settings = _settings; + this._fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this._settings.followSymbolicLinks, + fs: this._settings.fs, + throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks + }); + } + _getFullEntryPath(filepath) { + return path.resolve(this._settings.cwd, filepath); + } + _makeEntry(stats, pattern) { + const entry = { + name: pattern, + path: pattern, + dirent: utils.fs.createDirentFromStats(pattern, stats) + }; + if (this._settings.stats) { + entry.stats = stats; + } + return entry; + } + _isFatalError(error) { + return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; + } +} +exports["default"] = Reader; + + +/***/ }), + +/***/ 9086: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const stream_1 = __webpack_require__(2781); +const fsStat = __webpack_require__(6203); +const fsWalk = __webpack_require__(5439); +const reader_1 = __webpack_require__(2117); +class ReaderStream extends reader_1.default { + constructor() { + super(...arguments); + this._walkStream = fsWalk.walkStream; + this._stat = fsStat.stat; + } + dynamic(root, options) { + return this._walkStream(root, options); + } + static(patterns, options) { + const filepaths = patterns.map(this._getFullEntryPath, this); + const stream = new stream_1.PassThrough({ objectMode: true }); + stream._write = (index, _enc, done) => { + return this._getEntry(filepaths[index], patterns[index], options) + .then((entry) => { + if (entry !== null && options.entryFilter(entry)) { + stream.push(entry); + } + if (index === filepaths.length - 1) { + stream.end(); + } + done(); + }) + .catch(done); + }; + for (let i = 0; i < filepaths.length; i++) { + stream.write(i); + } + return stream; + } + _getEntry(filepath, pattern, options) { + return this._getStat(filepath) + .then((stats) => this._makeEntry(stats, pattern)) + .catch((error) => { + if (options.errorFilter(error)) { + return null; + } + throw error; + }); + } + _getStat(filepath) { + return new Promise((resolve, reject) => { + this._stat(filepath, this._fsStatSettings, (error, stats) => { + return error === null ? resolve(stats) : reject(error); + }); + }); + } +} +exports["default"] = ReaderStream; + + +/***/ }), + +/***/ 112: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fsStat = __webpack_require__(6203); +const fsWalk = __webpack_require__(5439); +const reader_1 = __webpack_require__(2117); +class ReaderSync extends reader_1.default { + constructor() { + super(...arguments); + this._walkSync = fsWalk.walkSync; + this._statSync = fsStat.statSync; + } + dynamic(root, options) { + return this._walkSync(root, options); + } + static(patterns, options) { + const entries = []; + for (const pattern of patterns) { + const filepath = this._getFullEntryPath(pattern); + const entry = this._getEntry(filepath, pattern, options); + if (entry === null || !options.entryFilter(entry)) { + continue; + } + entries.push(entry); + } + return entries; + } + _getEntry(filepath, pattern, options) { + try { + const stats = this._getStat(filepath); + return this._makeEntry(stats, pattern); + } + catch (error) { + if (options.errorFilter(error)) { + return null; + } + throw error; + } + } + _getStat(filepath) { + return this._statSync(filepath, this._fsStatSettings); + } +} +exports["default"] = ReaderSync; + + +/***/ }), + +/***/ 3862: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; +const fs = __webpack_require__(7147); +const os = __webpack_require__(2037); +/** + * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. + * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 + */ +const CPU_COUNT = Math.max(os.cpus().length, 1); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + lstatSync: fs.lstatSync, + stat: fs.stat, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +class Settings { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + if (this.onlyDirectories) { + this.onlyFiles = false; + } + if (this.stats) { + this.objectMode = true; + } + // Remove the cast to the array in the next major (#404). + this.ignore = [].concat(this.ignore); + } + _getValue(option, value) { + return option === undefined ? value : option; + } + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + } +} +exports["default"] = Settings; + + +/***/ }), + +/***/ 4825: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.splitWhen = exports.flatten = void 0; +function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); +} +exports.flatten = flatten; +function splitWhen(items, predicate) { + const result = [[]]; + let groupIndex = 0; + for (const item of items) { + if (predicate(item)) { + groupIndex++; + result[groupIndex] = []; + } + else { + result[groupIndex].push(item); + } + } + return result; +} +exports.splitWhen = splitWhen; + + +/***/ }), + +/***/ 7843: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isEnoentCodeError = void 0; +function isEnoentCodeError(error) { + return error.code === 'ENOENT'; +} +exports.isEnoentCodeError = isEnoentCodeError; + + +/***/ }), + +/***/ 6334: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; + + +/***/ }), + +/***/ 4426: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; +const array = __webpack_require__(4825); +exports.array = array; +const errno = __webpack_require__(7843); +exports.errno = errno; +const fs = __webpack_require__(6334); +exports.fs = fs; +const path = __webpack_require__(2003); +exports.path = path; +const pattern = __webpack_require__(57); +exports.pattern = pattern; +const stream = __webpack_require__(6242); +exports.stream = stream; +const string = __webpack_require__(3021); +exports.string = string; + + +/***/ }), + +/***/ 2003: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0; +const os = __webpack_require__(2037); +const path = __webpack_require__(1017); +const IS_WINDOWS_PLATFORM = os.platform() === 'win32'; +const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ +/** + * All non-escaped special characters. + * Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters. + * Windows: (){}[], !+@ before (, ! at the beginning. + */ +const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; +const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g; +/** + * The device path (\\.\ or \\?\). + * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths + */ +const DOS_DEVICE_PATH_RE = /^\\\\([.?])/; +/** + * All backslashes except those escaping special characters. + * Windows: !()+@{} + * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions + */ +const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +function unixify(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.unixify = unixify; +function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); +} +exports.makeAbsolute = makeAbsolute; +function removeLeadingDotSegment(entry) { + // We do not use `startsWith` because this is 10x slower than current implementation for some cases. + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with + if (entry.charAt(0) === '.') { + const secondCharactery = entry.charAt(1); + if (secondCharactery === '/' || secondCharactery === '\\') { + return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); + } + } + return entry; +} +exports.removeLeadingDotSegment = removeLeadingDotSegment; +exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath; +function escapeWindowsPath(pattern) { + return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escapeWindowsPath = escapeWindowsPath; +function escapePosixPath(pattern) { + return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escapePosixPath = escapePosixPath; +exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern; +function convertWindowsPathToPattern(filepath) { + return escapeWindowsPath(filepath) + .replace(DOS_DEVICE_PATH_RE, '//$1') + .replace(WINDOWS_BACKSLASHES_RE, '/'); +} +exports.convertWindowsPathToPattern = convertWindowsPathToPattern; +function convertPosixPathToPattern(filepath) { + return escapePosixPath(filepath); +} +exports.convertPosixPathToPattern = convertPosixPathToPattern; + + +/***/ }), + +/***/ 57: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; +const path = __webpack_require__(1017); +const globParent = __webpack_require__(6004); +const micromatch = __webpack_require__(850); +const GLOBSTAR = '**'; +const ESCAPE_SYMBOL = '\\'; +const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; +const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/; +const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/; +const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/; +const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./; +/** + * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string. + * The latter is due to the presence of the device path at the beginning of the UNC path. + */ +const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g; +function isStaticPattern(pattern, options = {}) { + return !isDynamicPattern(pattern, options); +} +exports.isStaticPattern = isStaticPattern; +function isDynamicPattern(pattern, options = {}) { + /** + * A special case with an empty string is necessary for matching patterns that start with a forward slash. + * An empty string cannot be a dynamic pattern. + * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. + */ + if (pattern === '') { + return false; + } + /** + * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check + * filepath directly (without read directory). + */ + if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { + return true; + } + if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.braceExpansion !== false && hasBraceExpansion(pattern)) { + return true; + } + return false; +} +exports.isDynamicPattern = isDynamicPattern; +function hasBraceExpansion(pattern) { + const openingBraceIndex = pattern.indexOf('{'); + if (openingBraceIndex === -1) { + return false; + } + const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1); + if (closingBraceIndex === -1) { + return false; + } + const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex); + return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent); +} +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; +} +exports.convertToPositivePattern = convertToPositivePattern; +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Returns patterns that can be applied inside the current directory. + * + * @example + * // ['./*', '*', 'a/*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsInsideCurrentDirectory(patterns) { + return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern)); +} +exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory; +/** + * Returns patterns to be expanded relative to (outside) the current directory. + * + * @example + * // ['../*', './../*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsOutsideCurrentDirectory(patterns) { + return patterns.filter(isPatternRelatedToParentDirectory); +} +exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory; +function isPatternRelatedToParentDirectory(pattern) { + return pattern.startsWith('..') || pattern.startsWith('./..'); +} +exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory; +function getBaseDirectory(pattern) { + return globParent(pattern, { flipBackslashes: false }); +} +exports.getBaseDirectory = getBaseDirectory; +function hasGlobStar(pattern) { + return pattern.includes(GLOBSTAR); +} +exports.hasGlobStar = hasGlobStar; +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +function isAffectDepthOfReadingPattern(pattern) { + const basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +function expandPatternsWithBraceExpansion(patterns) { + return patterns.reduce((collection, pattern) => { + return collection.concat(expandBraceExpansion(pattern)); + }, []); +} +exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; +function expandBraceExpansion(pattern) { + const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true }); + /** + * Sort the patterns by length so that the same depth patterns are processed side by side. + * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']` + */ + patterns.sort((a, b) => a.length - b.length); + /** + * Micromatch can return an empty string in the case of patterns like `{a,}`. + */ + return patterns.filter((pattern) => pattern !== ''); +} +exports.expandBraceExpansion = expandBraceExpansion; +function getPatternParts(pattern, options) { + let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); + /** + * The scan method returns an empty array in some cases. + * See micromatch/picomatch#58 for more details. + */ + if (parts.length === 0) { + parts = [pattern]; + } + /** + * The scan method does not return an empty part for the pattern with a forward slash. + * This is another part of micromatch/picomatch#58. + */ + if (parts[0].startsWith('/')) { + parts[0] = parts[0].slice(1); + parts.unshift(''); + } + return parts; +} +exports.getPatternParts = getPatternParts; +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +function convertPatternsToRe(patterns, options) { + return patterns.map((pattern) => makeRe(pattern, options)); +} +exports.convertPatternsToRe = convertPatternsToRe; +function matchAny(entry, patternsRe) { + return patternsRe.some((patternRe) => patternRe.test(entry)); +} +exports.matchAny = matchAny; +/** + * This package only works with forward slashes as a path separator. + * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes. + */ +function removeDuplicateSlashes(pattern) { + return pattern.replace(DOUBLE_SLASH_RE, '/'); +} +exports.removeDuplicateSlashes = removeDuplicateSlashes; + + +/***/ }), + +/***/ 6242: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.merge = void 0; +const merge2 = __webpack_require__(155); +function merge(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once('error', (error) => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; +} +exports.merge = merge; +function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit('close')); +} + + +/***/ }), + +/***/ 3021: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isEmpty = exports.isString = void 0; +function isString(input) { + return typeof input === 'string'; +} +exports.isString = isString; +function isEmpty(input) { + return input === ''; +} +exports.isEmpty = isEmpty; + + +/***/ }), + +/***/ 373: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/* eslint-disable no-var */ + +var reusify = __webpack_require__(3650) + +function fastqueue (context, worker, concurrency) { + if (typeof context === 'function') { + concurrency = worker + worker = context + context = null + } + + if (concurrency < 1) { + throw new Error('fastqueue concurrency must be greater than 1') + } + + var cache = reusify(Task) + var queueHead = null + var queueTail = null + var _running = 0 + var errorHandler = null + + var self = { + push: push, + drain: noop, + saturated: noop, + pause: pause, + paused: false, + concurrency: concurrency, + running: running, + resume: resume, + idle: idle, + length: length, + getQueue: getQueue, + unshift: unshift, + empty: noop, + kill: kill, + killAndDrain: killAndDrain, + error: error + } + + return self + + function running () { + return _running + } + + function pause () { + self.paused = true + } + + function length () { + var current = queueHead + var counter = 0 + + while (current) { + current = current.next + counter++ + } + + return counter + } + + function getQueue () { + var current = queueHead + var tasks = [] + + while (current) { + tasks.push(current.value) + current = current.next + } + + return tasks + } + + function resume () { + if (!self.paused) return + self.paused = false + for (var i = 0; i < self.concurrency; i++) { + _running++ + release() + } + } + + function idle () { + return _running === 0 && self.length() === 0 + } + + function push (value, done) { + var current = cache.get() + + current.context = context + current.release = release + current.value = value + current.callback = done || noop + current.errorHandler = errorHandler + + if (_running === self.concurrency || self.paused) { + if (queueTail) { + queueTail.next = current + queueTail = current + } else { + queueHead = current + queueTail = current + self.saturated() + } + } else { + _running++ + worker.call(context, current.value, current.worked) + } + } + + function unshift (value, done) { + var current = cache.get() + + current.context = context + current.release = release + current.value = value + current.callback = done || noop + + if (_running === self.concurrency || self.paused) { + if (queueHead) { + current.next = queueHead + queueHead = current + } else { + queueHead = current + queueTail = current + self.saturated() + } + } else { + _running++ + worker.call(context, current.value, current.worked) + } + } + + function release (holder) { + if (holder) { + cache.release(holder) + } + var next = queueHead + if (next) { + if (!self.paused) { + if (queueTail === queueHead) { + queueTail = null + } + queueHead = next.next + next.next = null + worker.call(context, next.value, next.worked) + if (queueTail === null) { + self.empty() + } + } else { + _running-- + } + } else if (--_running === 0) { + self.drain() + } + } + + function kill () { + queueHead = null + queueTail = null + self.drain = noop + } + + function killAndDrain () { + queueHead = null + queueTail = null + self.drain() + self.drain = noop + } + + function error (handler) { + errorHandler = handler + } +} + +function noop () {} + +function Task () { + this.value = null + this.callback = noop + this.next = null + this.release = noop + this.context = null + this.errorHandler = null + + var self = this + + this.worked = function worked (err, result) { + var callback = self.callback + var errorHandler = self.errorHandler + var val = self.value + self.value = null + self.callback = noop + if (self.errorHandler) { + errorHandler(err, val) + } + callback.call(self.context, err, result) + self.release(self) + } +} + +function queueAsPromised (context, worker, concurrency) { + if (typeof context === 'function') { + concurrency = worker + worker = context + context = null + } + + function asyncWrapper (arg, cb) { + worker.call(this, arg) + .then(function (res) { + cb(null, res) + }, cb) + } + + var queue = fastqueue(context, asyncWrapper, concurrency) + + var pushCb = queue.push + var unshiftCb = queue.unshift + + queue.push = push + queue.unshift = unshift + queue.drained = drained + + return queue + + function push (value) { + var p = new Promise(function (resolve, reject) { + pushCb(value, function (err, result) { + if (err) { + reject(err) + return + } + resolve(result) + }) + }) + + // Let's fork the promise chain to + // make the error bubble up to the user but + // not lead to a unhandledRejection + p.catch(noop) + + return p + } + + function unshift (value) { + var p = new Promise(function (resolve, reject) { + unshiftCb(value, function (err, result) { + if (err) { + reject(err) + return + } + resolve(result) + }) + }) + + // Let's fork the promise chain to + // make the error bubble up to the user but + // not lead to a unhandledRejection + p.catch(noop) + + return p + } + + function drained () { + var previousDrain = queue.drain + + var p = new Promise(function (resolve) { + queue.drain = function () { + previousDrain() + resolve() + } + }) + + return p + } +} + +module.exports = fastqueue +module.exports.promise = queueAsPromised + + +/***/ }), + +/***/ 2664: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +const util = __webpack_require__(3837); +const toRegexRange = __webpack_require__(5702); + +const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); + +const transform = toNumber => { + return value => toNumber === true ? Number(value) : String(value); +}; + +const isValidValue = value => { + return typeof value === 'number' || (typeof value === 'string' && value !== ''); +}; + +const isNumber = num => Number.isInteger(+num); + +const zeros = input => { + let value = `${input}`; + let index = -1; + if (value[0] === '-') value = value.slice(1); + if (value === '0') return false; + while (value[++index] === '0'); + return index > 0; +}; + +const stringify = (start, end, options) => { + if (typeof start === 'string' || typeof end === 'string') { + return true; + } + return options.stringify === true; +}; + +const pad = (input, maxLength, toNumber) => { + if (maxLength > 0) { + let dash = input[0] === '-' ? '-' : ''; + if (dash) input = input.slice(1); + input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); + } + if (toNumber === false) { + return String(input); + } + return input; +}; + +const toMaxLen = (input, maxLength) => { + let negative = input[0] === '-' ? '-' : ''; + if (negative) { + input = input.slice(1); + maxLength--; + } + while (input.length < maxLength) input = '0' + input; + return negative ? ('-' + input) : input; +}; + +const toSequence = (parts, options) => { + parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + + let prefix = options.capture ? '' : '?:'; + let positives = ''; + let negatives = ''; + let result; + + if (parts.positives.length) { + positives = parts.positives.join('|'); + } + + if (parts.negatives.length) { + negatives = `-(${prefix}${parts.negatives.join('|')})`; + } + + if (positives && negatives) { + result = `${positives}|${negatives}`; + } else { + result = positives || negatives; + } + + if (options.wrap) { + return `(${prefix}${result})`; + } + + return result; +}; + +const toRange = (a, b, isNumbers, options) => { + if (isNumbers) { + return toRegexRange(a, b, { wrap: false, ...options }); + } + + let start = String.fromCharCode(a); + if (a === b) return start; + + let stop = String.fromCharCode(b); + return `[${start}-${stop}]`; +}; + +const toRegex = (start, end, options) => { + if (Array.isArray(start)) { + let wrap = options.wrap === true; + let prefix = options.capture ? '' : '?:'; + return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); + } + return toRegexRange(start, end, options); +}; + +const rangeError = (...args) => { + return new RangeError('Invalid range arguments: ' + util.inspect(...args)); +}; + +const invalidRange = (start, end, options) => { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; +}; + +const invalidStep = (step, options) => { + if (options.strictRanges === true) { + throw new TypeError(`Expected step "${step}" to be a number`); + } + return []; +}; + +const fillNumbers = (start, end, step = 1, options = {}) => { + let a = Number(start); + let b = Number(end); + + if (!Number.isInteger(a) || !Number.isInteger(b)) { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; + } + + // fix negative zero + if (a === 0) a = 0; + if (b === 0) b = 0; + + let descending = a > b; + let startString = String(start); + let endString = String(end); + let stepString = String(step); + step = Math.max(Math.abs(step), 1); + + let padded = zeros(startString) || zeros(endString) || zeros(stepString); + let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; + let toNumber = padded === false && stringify(start, end, options) === false; + let format = options.transform || transform(toNumber); + + if (options.toRegex && step === 1) { + return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); + } + + let parts = { negatives: [], positives: [] }; + let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + if (options.toRegex === true && step > 1) { + push(a); + } else { + range.push(pad(format(a, index), maxLen, toNumber)); + } + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return step > 1 + ? toSequence(parts, options) + : toRegex(range, null, { wrap: false, ...options }); + } + + return range; +}; + +const fillLetters = (start, end, step = 1, options = {}) => { + if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) { + return invalidRange(start, end, options); + } + + + let format = options.transform || (val => String.fromCharCode(val)); + let a = `${start}`.charCodeAt(0); + let b = `${end}`.charCodeAt(0); + + let descending = a > b; + let min = Math.min(a, b); + let max = Math.max(a, b); + + if (options.toRegex && step === 1) { + return toRange(min, max, false, options); + } + + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + range.push(format(a, index)); + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return toRegex(range, null, { wrap: false, options }); + } + + return range; +}; + +const fill = (start, end, step, options = {}) => { + if (end == null && isValidValue(start)) { + return [start]; + } + + if (!isValidValue(start) || !isValidValue(end)) { + return invalidRange(start, end, options); + } + + if (typeof step === 'function') { + return fill(start, end, 1, { transform: step }); + } + + if (isObject(step)) { + return fill(start, end, 0, step); + } + + let opts = { ...options }; + if (opts.capture === true) opts.wrap = true; + step = step || opts.step || 1; + + if (!isNumber(step)) { + if (step != null && !isObject(step)) return invalidStep(step, opts); + return fill(start, end, 1, step); + } + + if (isNumber(start) && isNumber(end)) { + return fillNumbers(start, end, step, opts); + } + + return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); +}; + +module.exports = fill; + + +/***/ }), + +/***/ 5151: +/***/ ((module) => { + +// A simple implementation of make-array +function makeArray (subject) { + return Array.isArray(subject) + ? subject + : [subject] +} + +const EMPTY = '' +const SPACE = ' ' +const ESCAPE = '\\' +const REGEX_TEST_BLANK_LINE = /^\s+$/ +const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/ +const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/ +const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/ +const REGEX_SPLITALL_CRLF = /\r?\n/g +// /foo, +// ./foo, +// ../foo, +// . +// .. +const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/ + +const SLASH = '/' + +// Do not use ternary expression here, since "istanbul ignore next" is buggy +let TMP_KEY_IGNORE = 'node-ignore' +/* istanbul ignore else */ +if (typeof Symbol !== 'undefined') { + TMP_KEY_IGNORE = Symbol.for('node-ignore') +} +const KEY_IGNORE = TMP_KEY_IGNORE + +const define = (object, key, value) => + Object.defineProperty(object, key, {value}) + +const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g + +const RETURN_FALSE = () => false + +// Sanitize the range of a regular expression +// The cases are complicated, see test cases for details +const sanitizeRange = range => range.replace( + REGEX_REGEXP_RANGE, + (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) + ? match + // Invalid range (out of order) which is ok for gitignore rules but + // fatal for JavaScript regular expression, so eliminate it. + : EMPTY +) + +// See fixtures #59 +const cleanRangeBackSlash = slashes => { + const {length} = slashes + return slashes.slice(0, length - length % 2) +} + +// > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` + +// '`foo/`' should not continue with the '`..`' +const REPLACERS = [ + + // > Trailing spaces are ignored unless they are quoted with backslash ("\") + [ + // (a\ ) -> (a ) + // (a ) -> (a) + // (a \ ) -> (a ) + /\\?\s+$/, + match => match.indexOf('\\') === 0 + ? SPACE + : EMPTY + ], + + // replace (\ ) with ' ' + [ + /\\\s/g, + () => SPACE + ], + + // Escape metacharacters + // which is written down by users but means special for regular expressions. + + // > There are 12 characters with special meanings: + // > - the backslash \, + // > - the caret ^, + // > - the dollar sign $, + // > - the period or dot ., + // > - the vertical bar or pipe symbol |, + // > - the question mark ?, + // > - the asterisk or star *, + // > - the plus sign +, + // > - the opening parenthesis (, + // > - the closing parenthesis ), + // > - and the opening square bracket [, + // > - the opening curly brace {, + // > These special characters are often called "metacharacters". + [ + /[\\$.|*+(){^]/g, + match => `\\${match}` + ], + + [ + // > a question mark (?) matches a single character + /(?!\\)\?/g, + () => '[^/]' + ], + + // leading slash + [ + + // > A leading slash matches the beginning of the pathname. + // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". + // A leading slash matches the beginning of the pathname + /^\//, + () => '^' + ], + + // replace special metacharacter slash after the leading slash + [ + /\//g, + () => '\\/' + ], + + [ + // > A leading "**" followed by a slash means match in all directories. + // > For example, "**/foo" matches file or directory "foo" anywhere, + // > the same as pattern "foo". + // > "**/foo/bar" matches file or directory "bar" anywhere that is directly + // > under directory "foo". + // Notice that the '*'s have been replaced as '\\*' + /^\^*\\\*\\\*\\\//, + + // '**/foo' <-> 'foo' + () => '^(?:.*\\/)?' + ], + + // starting + [ + // there will be no leading '/' + // (which has been replaced by section "leading slash") + // If starts with '**', adding a '^' to the regular expression also works + /^(?=[^^])/, + function startingReplacer () { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) + // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' + + // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^' + } + ], + + // two globstars + [ + // Use lookahead assertions so that we could match more than one `'/**'` + /\\\/\\\*\\\*(?=\\\/|$)/g, + + // Zero, one or several directories + // should not use '*', or it will be replaced by the next replacer + + // Check if it is not the last `'/**'` + (_, index, str) => index + 6 < str.length + + // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches + // > zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' + + // case: /** + // > A trailing `"/**"` matches everything inside. + + // #21: everything inside but it should not include the current folder + : '\\/.+' + ], + + // normal intermediate wildcards + [ + // Never replace escaped '*' + // ignore rule '\*' will match the path '*' + + // 'abc.*/' -> go + // 'abc.*' -> skip this rule, + // coz trailing single wildcard will be handed by [trailing wildcard] + /(^|[^\\]+)(\\\*)+(?=.+)/g, + + // '*.js' matches '.js' + // '*.js' doesn't match 'abc' + (_, p1, p2) => { + // 1. + // > An asterisk "*" matches anything except a slash. + // 2. + // > Other consecutive asterisks are considered regular asterisks + // > and will match according to the previous rules. + const unescaped = p2.replace(/\\\*/g, '[^\\/]*') + return p1 + unescaped + } + ], + + [ + // unescape, revert step 3 except for back slash + // For example, if a user escape a '\\*', + // after step 3, the result will be '\\\\\\*' + /\\\\\\(?=[$.|*+(){^])/g, + () => ESCAPE + ], + + [ + // '\\\\' -> '\\' + /\\\\/g, + () => ESCAPE + ], + + [ + // > The range notation, e.g. [a-zA-Z], + // > can be used to match one of the characters in a range. + + // `\` is escaped by step 3 + /(\\)?\[([^\]/]*?)(\\*)($|\])/g, + (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE + // '\\[bar]' -> '\\\\[bar\\]' + ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` + : close === ']' + ? endEscape.length % 2 === 0 + // A normal case, and it is a range notation + // '[bar]' + // '[bar\\\\]' + ? `[${sanitizeRange(range)}${endEscape}]` + // Invalid range notaton + // '[bar\\]' -> '[bar\\\\]' + : '[]' + : '[]' + ], + + // ending + [ + // 'js' will not match 'js.' + // 'ab' will not match 'abc' + /(?:[^*])$/, + + // WTF! + // https://git-scm.com/docs/gitignore + // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) + // which re-fixes #24, #38 + + // > If there is a separator at the end of the pattern then the pattern + // > will only match directories, otherwise the pattern can match both + // > files and directories. + + // 'js*' will not match 'a.js' + // 'js/' will not match 'a.js' + // 'js' will match 'a.js' and 'a.js/' + match => /\/$/.test(match) + // foo/ will not match 'foo' + ? `${match}$` + // foo matches 'foo' and 'foo/' + : `${match}(?=$|\\/$)` + ], + + // trailing wildcard + [ + /(\^|\\\/)?\\\*$/, + (_, p1) => { + const prefix = p1 + // '\^': + // '/*' does not match EMPTY + // '/*' does not match everything + + // '\\\/': + // 'abc/*' does not match 'abc/' + ? `${p1}[^/]+` + + // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*' + + return `${prefix}(?=$|\\/$)` + } + ], +] + +// A simple cache, because an ignore rule only has only one certain meaning +const regexCache = Object.create(null) + +// @param {pattern} +const makeRegex = (pattern, ignoreCase) => { + let source = regexCache[pattern] + + if (!source) { + source = REPLACERS.reduce( + (prev, current) => prev.replace(current[0], current[1].bind(pattern)), + pattern + ) + regexCache[pattern] = source + } + + return ignoreCase + ? new RegExp(source, 'i') + : new RegExp(source) +} + +const isString = subject => typeof subject === 'string' + +// > A blank line matches no files, so it can serve as a separator for readability. +const checkPattern = pattern => pattern + && isString(pattern) + && !REGEX_TEST_BLANK_LINE.test(pattern) + && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) + + // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0 + +const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF) + +class IgnoreRule { + constructor ( + origin, + pattern, + negative, + regex + ) { + this.origin = origin + this.pattern = pattern + this.negative = negative + this.regex = regex + } +} + +const createRule = (pattern, ignoreCase) => { + const origin = pattern + let negative = false + + // > An optional prefix "!" which negates the pattern; + if (pattern.indexOf('!') === 0) { + negative = true + pattern = pattern.substr(1) + } + + pattern = pattern + // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') + // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#') + + const regex = makeRegex(pattern, ignoreCase) + + return new IgnoreRule( + origin, + pattern, + negative, + regex + ) +} + +const throwError = (message, Ctor) => { + throw new Ctor(message) +} + +const checkPath = (path, originalPath, doThrow) => { + if (!isString(path)) { + return doThrow( + `path must be a string, but got \`${originalPath}\``, + TypeError + ) + } + + // We don't know if we should ignore EMPTY, so throw + if (!path) { + return doThrow(`path must not be empty`, TypeError) + } + + // Check if it is a relative path + if (checkPath.isNotRelative(path)) { + const r = '`path.relative()`d' + return doThrow( + `path should be a ${r} string, but got "${originalPath}"`, + RangeError + ) + } + + return true +} + +const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path) + +checkPath.isNotRelative = isNotRelative +checkPath.convert = p => p + +class Ignore { + constructor ({ + ignorecase = true, + ignoreCase = ignorecase, + allowRelativePaths = false + } = {}) { + define(this, KEY_IGNORE, true) + + this._rules = [] + this._ignoreCase = ignoreCase + this._allowRelativePaths = allowRelativePaths + this._initCache() + } + + _initCache () { + this._ignoreCache = Object.create(null) + this._testCache = Object.create(null) + } + + _addPattern (pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules) + this._added = true + return + } + + if (checkPattern(pattern)) { + const rule = createRule(pattern, this._ignoreCase) + this._added = true + this._rules.push(rule) + } + } + + // @param {Array | string | Ignore} pattern + add (pattern) { + this._added = false + + makeArray( + isString(pattern) + ? splitPattern(pattern) + : pattern + ).forEach(this._addPattern, this) + + // Some rules have just added to the ignore, + // making the behavior changed. + if (this._added) { + this._initCache() + } + + return this + } + + // legacy + addPattern (pattern) { + return this.add(pattern) + } + + // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X + + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. + + // @returns {TestResult} true if a file is ignored + _testOne (path, checkUnignored) { + let ignored = false + let unignored = false + + this._rules.forEach(rule => { + const {negative} = rule + if ( + unignored === negative && ignored !== unignored + || negative && !ignored && !unignored && !checkUnignored + ) { + return + } + + const matched = rule.regex.test(path) + + if (matched) { + ignored = !negative + unignored = negative + } + }) + + return { + ignored, + unignored + } + } + + // @returns {TestResult} + _test (originalPath, cache, checkUnignored, slices) { + const path = originalPath + // Supports nullable path + && checkPath.convert(originalPath) + + checkPath( + path, + originalPath, + this._allowRelativePaths + ? RETURN_FALSE + : throwError + ) + + return this._t(path, cache, checkUnignored, slices) + } + + _t (path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path] + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH) + } + + slices.pop() + + // If the path has no parent directory, just test it + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored) + } + + const parent = this._t( + slices.join(SLASH) + SLASH, + cache, + checkUnignored, + slices + ) + + // If the path contains a parent directory, check the parent first + return cache[path] = parent.ignored + // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent + : this._testOne(path, checkUnignored) + } + + ignores (path) { + return this._test(path, this._ignoreCache, false).ignored + } + + createFilter () { + return path => !this.ignores(path) + } + + filter (paths) { + return makeArray(paths).filter(this.createFilter()) + } + + // @returns {TestResult} + test (path) { + return this._test(path, this._testCache, true) + } +} + +const factory = options => new Ignore(options) + +const isPathValid = path => + checkPath(path && checkPath.convert(path), path, RETURN_FALSE) + +factory.isPathValid = isPathValid + +// Fixes typescript +factory.default = factory + +module.exports = factory + +// Windows +// -------------------------------------------------------------- +/* istanbul ignore if */ +if ( + // Detect `process` so that it can run in browsers. + typeof process !== 'undefined' + && ( + process.env && process.env.IGNORE_TEST_WIN32 + || process.platform === 'win32' + ) +) { + /* eslint no-control-regex: "off" */ + const makePosix = str => /^\\\\\?\\/.test(str) + || /["<>|\u0000-\u001F]+/u.test(str) + ? str + : str.replace(/\\/g, '/') + + checkPath.convert = makePosix + + // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i + checkPath.isNotRelative = path => + REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) + || isNotRelative(path) +} + + +/***/ }), + +/***/ 2428: +/***/ ((module) => { + +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +module.exports = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + var match; + while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + + return false; +}; + + +/***/ }), + +/***/ 6830: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var isExtglob = __webpack_require__(2428); +var chars = { '{': '}', '(': ')', '[': ']'}; +var strictCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + var pipeIndex = -2; + var closeSquareIndex = -2; + var closeCurlyIndex = -2; + var closeParenIndex = -2; + var backSlashIndex = -2; + while (index < str.length) { + if (str[index] === '*') { + return true; + } + + if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { + return true; + } + + if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { + if (closeSquareIndex < index) { + closeSquareIndex = str.indexOf(']', index); + } + if (closeSquareIndex > index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } + } + + if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { + closeCurlyIndex = str.indexOf('}', index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } + } + + if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { + closeParenIndex = str.indexOf(')', index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + + if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { + if (pipeIndex < index) { + pipeIndex = str.indexOf('|', index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { + closeParenIndex = str.indexOf(')', pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf('\\', pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +var relaxedCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +module.exports = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var check = strictCheck; + + // optionally relax check + if (options && options.strict === false) { + check = relaxedCheck; + } + + return check(str); +}; + + +/***/ }), + +/***/ 9924: +/***/ ((module) => { + +"use strict"; +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ + + + +module.exports = function(num) { + if (typeof num === 'number') { + return num - num === 0; + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + return false; +}; + + +/***/ }), + +/***/ 1959: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var fs = __webpack_require__(7147) +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = __webpack_require__(1429) +} else { + core = __webpack_require__(4601) +} + +module.exports = isexe +isexe.sync = sync + +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') + } + + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } + }) + }) + } + + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) + }) +} + +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } + } +} + + +/***/ }), + +/***/ 4601: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = isexe +isexe.sync = sync + +var fs = __webpack_require__(7147) + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), options) +} + +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) +} + +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid + + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() + + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g + + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 + + return ret +} + + +/***/ }), + +/***/ 1429: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = isexe +isexe.sync = sync + +var fs = __webpack_require__(7147) + +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } + } + return false +} + +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) +} + + +/***/ }), + +/***/ 6486: +/***/ (function(module, exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +var __WEBPACK_AMD_DEFINE_RESULT__;/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '4.17.21'; + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** Error message constants. */ + var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', + FUNC_ERROR_TEXT = 'Expected a function', + INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** Used to compose bitmasks for function metadata. */ + var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_BOUND_FLAG = 4, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256, + WRAP_FLIP_FLAG = 512; + + /** Used as default options for `_.truncate`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; + + /** Used to detect hot functions by number of calls within a span of milliseconds. */ + var HOT_COUNT = 800, + HOT_SPAN = 16; + + /** Used to indicate the type of lazy iteratees. */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + + /** Used to associate wrap methods with their bit flags. */ + var wrapFlags = [ + ['ary', WRAP_ARY_FLAG], + ['bind', WRAP_BIND_FLAG], + ['bindKey', WRAP_BIND_KEY_FLAG], + ['curry', WRAP_CURRY_FLAG], + ['curryRight', WRAP_CURRY_RIGHT_FLAG], + ['flip', WRAP_FLIP_FLAG], + ['partial', WRAP_PARTIAL_FLAG], + ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], + ['rearg', WRAP_REARG_FLAG] + ]; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + domExcTag = '[object DOMException]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]', + weakSetTag = '[object WeakSet]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + + /** Used to match empty string literals in compiled template source. */ + var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + + /** Used to match HTML entities and HTML characters. */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source), + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + + /** Used to match template delimiters. */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + + /** Used to match leading whitespace. */ + var reTrimStart = /^\s+/; + + /** Used to match a single whitespace character. */ + var reWhitespace = /\s/; + + /** Used to match wrap detail comments. */ + var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + + /** Used to match words composed of alphanumeric characters. */ + var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + + /** + * Used to validate the `validate` option in `_.template` variable. + * + * Forbids characters which could potentially change the meaning of the function argument definition: + * - "()," (modification of function parameters) + * - "=" (default value) + * - "[]{}" (destructuring of function parameters) + * - "/" (beginning of a comment) + * - whitespace + */ + var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). + */ + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** Used to match Latin Unicode letters (excluding mathematical operators). */ + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; + + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + + /** Used to compose unicode character classes. */ + var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + + /** Used to compose unicode capture groups. */ + var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + + /** Used to compose unicode regexes. */ + var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', + rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', + rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + + /** Used to match apostrophes. */ + var reApos = RegExp(rsApos, 'g'); + + /** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ + var reComboMark = RegExp(rsCombo, 'g'); + + /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ + var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + + /** Used to match complex or compound words. */ + var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', + rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, + rsUpper + '+' + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji + ].join('|'), 'g'); + + /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ + var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + + /** Used to detect strings that need a more robust regexp to match words. */ + var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + + /** Used to assign default `context` object properties. */ + var contextProps = [ + 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', + 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', + '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + ]; + + /** Used to make template sourceURLs easier to identify. */ + var templateCounter = -1; + + /** Used to identify `toStringTag` values of typed arrays. */ + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; + + /** Used to identify `toStringTag` values supported by `_.clone`. */ + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = + cloneableTags[weakMapTag] = false; + + /** Used to map Latin Unicode letters to basic Latin letters. */ + var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\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': 's' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Built-in method references without a dependency on `root`. */ + var freeParseFloat = parseFloat, + freeParseInt = parseInt; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + /** Detect free variable `exports`. */ + var freeExports = true && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Detect free variable `process` from Node.js. */ + var freeProcess = moduleExports && freeGlobal.process; + + /** Used to access faster Node.js helpers. */ + var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} + }()); + + /* Node.js helper references. */ + var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, + nodeIsDate = nodeUtil && nodeUtil.isDate, + nodeIsMap = nodeUtil && nodeUtil.isMap, + nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, + nodeIsSet = nodeUtil && nodeUtil.isSet, + nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + + /*--------------------------------------------------------------------------*/ + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + + /** + * A specialized version of `baseAggregator` for arrays. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + return accumulator; + } + + /** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.forEachRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ + function arrayEachRight(array, iteratee) { + var length = array == null ? 0 : array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.every` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + */ + function arrayEvery(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; + } + + /** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; + } + + /** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; + } + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + + /** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + + /** + * A specialized version of `_.reduceRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduceRight(array, iteratee, accumulator, initAccum) { + var length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; + } + + /** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + + /** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + var asciiSize = baseProperty('length'); + + /** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function asciiToArray(string) { + return string.split(''); + } + + /** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function asciiWords(string) { + return string.match(reAsciiWord) || []; + } + + /** + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the found element or its key, else `undefined`. + */ + function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = key; + return false; + } + }); + return result; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); + } + + /** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ + function baseIsNaN(value) { + return value !== value; + } + + /** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ + function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? (baseSum(array, iteratee) / length) : NAN; + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ + function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + + /** + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function baseSum(array, iteratee) { + var result, + index = -1, + length = array.length; + + while (++index < length) { + var current = iteratee(array[index]); + if (current !== undefined) { + result = result === undefined ? current : (result + current); + } + } + return result; + } + + /** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + + /** + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the key-value pairs. + */ + function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); + } + + /** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function baseTrim(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; + } + + /** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ + function baseUnary(func) { + return function(value) { + return func(value); + }; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); + } + + /** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function cacheHas(cache, key) { + return cache.has(key); + } + + /** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ + function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ + function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ + function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; + } + + /** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + var deburrLetter = basePropertyOf(deburredLetters); + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + var escapeHtmlChar = basePropertyOf(htmlEscapes); + + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; + } + + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } + + /** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ + function hasUnicode(string) { + return reHasUnicode.test(string); + } + + /** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ + function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); + } + + /** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ + function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; + } + + /** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ + function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } + + /** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; + } + + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; + } + + /** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ + function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; + } + + /** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ + function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; + } + + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; + } + + /** + * Gets the number of symbols in `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ + function stringSize(string) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); + } + + /** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + + /** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; + } + return result; + } + + /** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function unicodeToArray(string) { + return string.match(reUnicode) || []; + } + + /** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function unicodeWords(string) { + return string.match(reUnicodeWord) || []; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Create a new pristine `lodash` function using the `context` object. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Util + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // Create a suped-up `defer` in Node.js. + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + var runInContext = (function runInContext(context) { + context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); + + /** Built-in constructor references. */ + var Array = context.Array, + Date = context.Date, + Error = context.Error, + Function = context.Function, + Math = context.Math, + Object = context.Object, + RegExp = context.RegExp, + String = context.String, + TypeError = context.TypeError; + + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Used to infer the `Object` constructor. */ + var objectCtorString = funcToString.call(Object); + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Built-in value references. */ + var Buffer = moduleExports ? context.Buffer : undefined, + Symbol = context.Symbol, + Uint8Array = context.Uint8Array, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, + getPrototype = overArg(Object.getPrototypeOf, Object), + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, + symIterator = Symbol ? Symbol.iterator : undefined, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + + var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); + + /** Mocked built-ins. */ + var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, + ctxNow = Date && Date.now !== root.Date.now && Date.now, + ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeFloor = Math.floor, + nativeGetSymbols = Object.getOwnPropertySymbols, + nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeIsFinite = context.isFinite, + nativeJoin = arrayProto.join, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max, + nativeMin = Math.min, + nativeNow = Date.now, + nativeParseInt = context.parseInt, + nativeRandom = Math.random, + nativeReverse = arrayProto.reverse; + + /* Built-in method references that are verified to be native. */ + var DataView = getNative(context, 'DataView'), + Map = getNative(context, 'Map'), + Promise = getNative(context, 'Promise'), + Set = getNative(context, 'Set'), + WeakMap = getNative(context, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); + + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. + * + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. + * + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ + * @constructor + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ + var baseCreate = (function() { + function object() {} + return function(proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object; + object.prototype = undefined; + return result; + }; + }()); + + /** + * The function whose prototype chain sequence wrappers inherit from. + * + * @private + */ + function baseLodash() { + // No operation performed. + } + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. + */ + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined; + } + + /** + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. + * + * @static + * @memberOf _ + * @type {Object} + */ + lodash.templateSettings = { + + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type {string} + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type {Object} + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type {Function} + */ + '_': lodash + } + }; + + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @constructor + * @param {*} value The value to wrap. + */ + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; + } + + /** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = copyArray(this.__actions__); + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = copyArray(this.__iteratees__); + result.__takeCount__ = this.__takeCount__; + result.__views__ = copyArray(this.__views__); + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + if (this.__filtered__) { + var result = new LazyWrapper(this); + result.__dir__ = -1; + result.__filtered__ = true; + } else { + result = this.clone(); + result.__dir__ *= -1; + } + return result; + } + + /** + * Extracts the unwrapped value from its lazy wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), + isRight = dir < 0, + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + iteratees = this.__iteratees__, + iterLength = iteratees.length, + resIndex = 0, + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { + return baseWrapperValue(array, this.__actions__); + } + var result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result[resIndex++] = value; + } + return result; + } + + // Ensure `LazyWrapper` is an instance of `baseLodash`. + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; + } + + /** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; + } + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); + } + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + /** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + + /** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; + } + + /** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + + /** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; + } + + /** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + + /** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + + /** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ + function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } + } + + /** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; + } + + /** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ + function setCacheHas(value) { + return this.__data__.has(value); + } + + // Add methods to `SetCache`. + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; + } + + /** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ + function stackClear() { + this.__data__ = new ListCache; + this.size = 0; + } + + /** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; + } + + /** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function stackGet(key) { + return this.__data__.get(key); + } + + /** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function stackHas(key) { + return this.__data__.has(key); + } + + /** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; + } + + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; + } + + /** + * A specialized version of `_.sample` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; + } + + /** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + } + + /** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); + } + + /** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignMergeValue(object, key, value) { + if ((value !== undefined && !eq(object[key], value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + + /** + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function baseAggregator(collection, setter, iteratee, accumulator) { + baseEach(collection, function(value, key, collection) { + setter(accumulator, value, iteratee(value), collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); + } + + /** + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); + } + + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + /** + * The base implementation of `_.at` without support for individual paths. + * + * @private + * @param {Object} object The object to iterate over. + * @param {string[]} paths The property paths to pick. + * @returns {Array} Returns the picked elements. + */ + function baseAt(object, paths) { + var index = -1, + length = paths.length, + result = Array(length), + skip = object == null; + + while (++index < length) { + result[index] = skip ? undefined : get(object, paths[index]); + } + return result; + } + + /** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ + function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; + } + + /** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result); + } + } else { + var tag = getTag(value), + isFunc = tag == funcTag || tag == genTag; + + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = (isFlat || isFunc) ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, isDeep); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + + if (isSet(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); + } else if (isMap(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + } + + var keysFunc = isFull + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); + + var props = isArr ? undefined : keysFunc(value); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; + } + + /** + * The base implementation of `_.conforms` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. + */ + function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; + } + + /** + * The base implementation of `_.conformsTo` which accepts `props` to check. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + */ + function baseConformsTo(object, source, props) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object(object); + while (length--) { + var key = props[length], + predicate = source[key], + value = object[key]; + + if ((value === undefined && !(key in object)) || !predicate(value)) { + return false; + } + } + return true; + } + + /** + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); + } + + /** + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + */ + function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; + } + if (iteratee) { + values = arrayMap(values, baseUnary(iteratee)); + } + if (comparator) { + includes = arrayIncludesWith; + isCommon = false; + } + else if (values.length >= LARGE_ARRAY_SIZE) { + includes = cacheHas; + isCommon = false; + values = new SetCache(values); + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; + } + } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.forEachRight` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEachRight = createBaseEach(baseForOwnRight, true); + + /** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; + } + + /** + * The base implementation of methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(array, iteratee, comparator) { + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index], + current = iteratee(value); + + if (current != null && (computed === undefined + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { + var computed = current, + result = value; + } + } + return result; + } + + /** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ + function baseFill(array, value, start, end) { + var length = array.length; + + start = toInteger(start); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : toInteger(end); + if (end < 0) { + end += length; + } + end = start > end ? 0 : toLength(end); + while (start < end) { + array[start++] = value; + } + return array; + } + + /** + * The base implementation of `_.filter` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; + } + + /** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseForRight = createBaseFor(true); + + /** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.forOwnRight` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwnRight(object, iteratee) { + return object && baseForRight(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. + */ + function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); + } + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; + } + + /** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + } + + /** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); + } + + /** + * The base implementation of `_.gt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + */ + function baseGt(value, other) { + return value > other; + } + + /** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); + } + + /** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHasIn(object, key) { + return object != null && key in Object(object); + } + + /** + * The base implementation of `_.inRange` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to check. + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + */ + function baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); + } + + /** + * The base implementation of methods like `_.intersection`, without support + * for iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + */ + function baseIntersection(arrays, iteratee, comparator) { + var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, + othLength = arrays.length, + othIndex = othLength, + caches = Array(othLength), + maxLength = Infinity, + result = []; + + while (othIndex--) { + var array = arrays[othIndex]; + if (othIndex && iteratee) { + array = arrayMap(array, baseUnary(iteratee)); + } + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) + ? new SetCache(othIndex && array) + : undefined; + } + array = arrays[0]; + + var index = -1, + seen = caches[0]; + + outer: + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { + continue outer; + } + } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.invert` and `_.invertBy` which inverts + * `object` with values transformed by `iteratee` and set by `setter`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform values. + * @param {Object} accumulator The initial inverted object. + * @returns {Function} Returns `accumulator`. + */ + function baseInverter(object, setter, iteratee, accumulator) { + baseForOwn(object, function(value, key, object) { + setter(accumulator, iteratee(value), key, object); + }); + return accumulator; + } + + /** + * The base implementation of `_.invoke` without support for individual + * method arguments. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function baseInvoke(object, path, args) { + path = castPath(path, object); + object = parent(object, path); + var func = object == null ? object : object[toKey(last(path))]; + return func == null ? undefined : apply(func, object, args); + } + + /** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ + function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; + } + + /** + * The base implementation of `_.isArrayBuffer` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + */ + function baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; + } + + /** + * The base implementation of `_.isDate` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + */ + function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; + } + + /** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + } + + /** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + } + + /** + * The base implementation of `_.isMap` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + */ + function baseIsMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; + } + + /** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; + } + } + } + return true; + } + + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + + /** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + + /** + * The base implementation of `_.isSet` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + */ + function baseIsSet(value) { + return isObjectLike(value) && getTag(value) == setTag; + } + + /** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ + function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + } + + /** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); + } + + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.lt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + */ + function baseLt(value, other) { + return value < other; + } + + /** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + + /** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; + } + + /** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + stack || (stack = new Stack); + if (isObject(srcValue)) { + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } + else { + var newValue = customizer + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; + + if (newValue === undefined) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); + } + + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } + else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } + else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } + else { + newValue = []; + } + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } + else if (!isObject(objValue) || isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } + else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); + } + + /** + * The base implementation of `_.nth` which doesn't coerce arguments. + * + * @private + * @param {Array} array The array to query. + * @param {number} n The index of the element to return. + * @returns {*} Returns the nth element of `array`. + */ + function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined; + } + + /** + * The base implementation of `_.orderBy` without param guards. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + + var index = -1; + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + + var result = baseMap(collection, function(value, key, collection) { + var criteria = arrayMap(iteratees, function(iteratee) { + return iteratee(value); + }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + + /** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); + } + + /** + * The base implementation of `_.pickBy` without support for iteratee shorthands. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. + */ + function basePickBy(object, paths, predicate) { + var index = -1, + length = paths.length, + result = {}; + + while (++index < length) { + var path = paths[index], + value = baseGet(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath(path, object), value); + } + } + return result; + } + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; + } + + /** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; + + while (length--) { + var index = indexes[length]; + if (length == lastIndex || index !== previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } else { + baseUnset(array, index); + } + } + } + return array; + } + + /** + * The base implementation of `_.random` without support for returning + * floating-point numbers. + * + * @private + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. + */ + function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + } + + /** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ + function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; + } + return result; + } + + /** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); + } + + /** + * The base implementation of `_.sample`. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + */ + function baseSample(collection) { + return arraySample(values(collection)); + } + + /** + * The base implementation of `_.sampleSize` without param guards. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); + } + + /** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + + /** + * The base implementation of `setData` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; + + /** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); + }; + + /** + * The base implementation of `_.shuffle`. + * + * @private + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function baseShuffle(collection) { + return shuffleSelf(values(collection)); + } + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; + } + + /** + * The base implementation of `_.some` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ + function baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; + } + + /** + * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which + * performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndex(array, value, retHighest) { + var low = 0, + high = array == null ? low : array.length; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if (computed !== null && !isSymbol(computed) && + (retHighest ? (computed <= value) : (computed < value))) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return baseSortedIndexBy(array, value, identity, retHighest); + } + + /** + * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` + * which invokes `iteratee` for `value` and each element of `array` to compute + * their sort ranking. The iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The iteratee invoked per element. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndexBy(array, value, iteratee, retHighest) { + var low = 0, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, + valIsNull = value === null, + valIsSymbol = isSymbol(value), + valIsUndefined = value === undefined; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + othIsDefined = computed !== undefined, + othIsNull = computed === null, + othIsReflexive = computed === computed, + othIsSymbol = isSymbol(computed); + + if (valIsNaN) { + var setLow = retHighest || othIsReflexive; + } else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } else if (othIsNull || othIsSymbol) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + + /** + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + if (!index || !eq(computed, seen)) { + var seen = computed; + result[resIndex++] = value === 0 ? 0 : value; + } + } + return result; + } + + /** + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. + * + * @private + * @param {*} value The value to process. + * @returns {number} Returns the number. + */ + function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; + } + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } + else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache; + } + else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.unset`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + */ + function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; + } + + /** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); + } + + /** + * The base implementation of methods like `_.dropWhile` and `_.takeWhile` + * without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && + predicate(array[index], index, array)) {} + + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + } + + /** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + return arrayReduce(actions, function(result, action) { + return action.func.apply(action.thisArg, arrayPush([result], action.args)); + }, result); + } + + /** + * The base implementation of methods like `_.xor`, without support for + * iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + */ + function baseXor(arrays, iteratee, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, + result = Array(length); + + while (++index < length) { + var array = arrays[index], + othIndex = -1; + + while (++othIndex < length) { + if (othIndex != index) { + result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); + } + } + } + return baseUniq(baseFlatten(result, 1), iteratee, comparator); + } + + /** + * This base implementation of `_.zipObject` which assigns values using `assignFunc`. + * + * @private + * @param {Array} props The property identifiers. + * @param {Array} values The property values. + * @param {Function} assignFunc The function to assign values. + * @returns {Object} Returns the new object. + */ + function baseZipObject(props, values, assignFunc) { + var index = -1, + length = props.length, + valsLength = values.length, + result = {}; + + while (++index < length) { + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); + } + return result; + } + + /** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ + function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + + /** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ + function castFunction(value) { + return typeof value == 'function' ? value : identity; + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + /** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + var castRest = baseRest; + + /** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ + function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); + } + + /** + * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). + * + * @private + * @param {number|Object} id The timer id or timeout object of the timer to clear. + */ + var clearTimeout = ctxClearTimeout || function(id) { + return root.clearTimeout(id); + }; + + /** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + + buffer.copy(result); + return result; + } + + /** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; + } + + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + + /** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + + /** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + + /** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = isSymbol(value); + + var othIsDefined = other !== undefined, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = isSymbol(other); + + if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || + (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || + (valIsNull && othIsDefined && othIsReflexive) || + (!valIsDefined && othIsReflexive) || + !valIsReflexive) { + return 1; + } + if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || + (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || + (othIsNull && valIsDefined && valIsReflexive) || + (!othIsDefined && valIsReflexive) || + !othIsReflexive) { + return -1; + } + } + return 0; + } + + /** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order + * of corresponding values. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]|string[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = compareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * (order == 'desc' ? -1 : 1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + /** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; + } + + /** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; + } + + /** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ + function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ + function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; + } + + /** + * Copies own symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbols(source, object) { + return copyObject(source, getSymbols(source), object); + } + + /** + * Copies own and inherited symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbolsIn(source, object) { + return copyObject(source, getSymbolsIn(source), object); + } + + /** + * Creates a function like `_.groupBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} [initializer] The accumulator object initializer. + * @returns {Function} Returns the new aggregator function. + */ + function createAggregator(setter, initializer) { + return function(collection, iteratee) { + var func = isArray(collection) ? arrayAggregator : baseAggregator, + accumulator = initializer ? initializer() : {}; + + return func(collection, setter, getIteratee(iteratee, 2), accumulator); + }; + } + + /** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createBind(func, bitmask, thisArg) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; + } + + /** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ + function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; + } + + /** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ + function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; + } + + /** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ + function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; + } + + /** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ + function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = getIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; + }; + } + + /** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ + function createFlow(fromRight) { + return flatRest(function(funcs) { + var length = funcs.length, + index = length, + prereq = LodashWrapper.prototype.thru; + + if (fromRight) { + funcs.reverse(); + } + while (index--) { + var func = funcs[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (prereq && !wrapper && getFuncName(func) == 'wrapper') { + var wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? index : length; + while (++index < length) { + func = funcs[index]; + + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined; + + if (data && isLaziable(data[0]) && + data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); + } + } + return function() { + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value)) { + return wrapper.plant(value).value(); + } + var index = 0, + result = length ? funcs[index].apply(this, args) : value; + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }); + } + + /** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & WRAP_ARY_FLAG, + isBind = bitmask & WRAP_BIND_FLAG, + isBindKey = bitmask & WRAP_BIND_KEY_FLAG, + isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), + isFlip = bitmask & WRAP_FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; + } + + /** + * Creates a function like `_.invertBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} toIteratee The function to resolve iteratees. + * @returns {Function} Returns the new inverter function. + */ + function createInverter(setter, toIteratee) { + return function(object, iteratee) { + return baseInverter(object, setter, toIteratee(iteratee), {}); + }; + } + + /** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @param {number} [defaultValue] The value used for `undefined` arguments. + * @returns {Function} Returns the new mathematical operation function. + */ + function createMathOperation(operator, defaultValue) { + return function(value, other) { + var result; + if (value === undefined && other === undefined) { + return defaultValue; + } + if (value !== undefined) { + result = value; + } + if (other !== undefined) { + if (result === undefined) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); + } + return result; + }; + } + + /** + * Creates a function like `_.over`. + * + * @private + * @param {Function} arrayFunc The function to iterate over iteratees. + * @returns {Function} Returns the new over function. + */ + function createOver(arrayFunc) { + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + return baseRest(function(args) { + var thisArg = this; + return arrayFunc(iteratees, function(iteratee) { + return apply(iteratee, thisArg, args); + }); + }); + }); + } + + /** + * Creates the padding for `string` based on `length`. The `chars` string + * is truncated if the number of characters exceeds `length`. + * + * @private + * @param {number} length The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padding for `string`. + */ + function createPadding(length, chars) { + chars = chars === undefined ? ' ' : baseToString(chars); + + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + return hasUnicode(chars) + ? castSlice(stringToArray(result), 0, length).join('') + : result.slice(0, length); + } + + /** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ + function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * Creates a `_.range` or `_.rangeRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new range function. + */ + function createRange(fromRight) { + return function(start, end, step) { + if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { + end = step = undefined; + } + // Ensure the sign of `-0` is preserved. + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); + return baseRange(start, end, step, fromRight); + }; + } + + /** + * Creates a function that performs a relational operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new relational operation function. + */ + function createRelationalOperation(operator) { + return function(value, other) { + if (!(typeof value == 'string' && typeof other == 'string')) { + value = toNumber(value); + other = toNumber(other); + } + return operator(value, other); + }; + } + + /** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & WRAP_CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); + + if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { + bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); + } + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, argPos, ary, arity + ]; + + var result = wrapFunc.apply(undefined, newData); + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); + } + + /** + * Creates a function like `_.round`. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ + function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + number = toNumber(number); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); + if (precision && nativeIsFinite(number)) { + // Shift with exponential notation to avoid floating-point issues. + // See [MDN](https://mdn.io/round#Examples) for more details. + var pair = (toString(number) + 'e').split('e'), + value = func(pair[0] + 'e' + (+pair[1] + precision)); + + pair = (toString(value) + 'e').split('e'); + return +(pair[0] + 'e' + (+pair[1] - precision)); + } + return func(number); + }; + } + + /** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ + var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { + return new Set(values); + }; + + /** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ + function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; + } + + /** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + var data = isBindKey ? undefined : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + if (data) { + mergeData(newData, data); + } + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] === undefined + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { + bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == WRAP_BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + var setter = data ? baseSetData : setData; + return setWrapToString(setter(result, newData), func, bitmask); + } + + /** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; + } + + /** + * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source + * objects into destination objects that are passed thru. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to merge. + * @param {Object} object The parent object of `objValue`. + * @param {Object} source The parent object of `srcValue`. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + * @returns {*} Returns the value to assign. + */ + function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); + stack['delete'](srcValue); + } + return objValue; + } + + /** + * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain + * objects. + * + * @private + * @param {*} value The value to inspect. + * @param {string} key The key of the property to inspect. + * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. + */ + function customOmitClone(value) { + return isPlainObject(value) ? undefined : value; + } + + /** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; + } + var index = -1, + result = true, + seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; + } + + /** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; + } + + /** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; + } + + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); + } + + /** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); + } + + /** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); + } + + /** + * Gets metadata for `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {*} Returns the metadata for `func`. + */ + var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); + }; + + /** + * Gets the name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ + function getFuncName(func) { + var result = (func.name + ''), + array = realNames[result], + length = hasOwnProperty.call(realNames, result) ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; + } + + /** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ + function getHolder(func) { + var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; + return object.placeholder; + } + + /** + * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, + * this function returns the custom method, otherwise it returns `baseIteratee`. + * If arguments are provided, the chosen function is invoked with them and + * its result is returned. + * + * @private + * @param {*} [value] The value to convert to an iteratee. + * @param {number} [arity] The arity of the created iteratee. + * @returns {Function} Returns the chosen function or its result. + */ + function getIteratee() { + var result = lodash.iteratee || iteratee; + result = result === iteratee ? baseIteratee : result; + return arguments.length ? result(arguments[0], arguments[1]) : result; + } + + /** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; + } + + /** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; + } + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; + } + + /** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + /** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); + }; + + /** + * Creates an array of the own and inherited enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; + }; + + /** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + var getTag = baseGetTag; + + // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. + if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return result; + }; + } + + /** + * Gets the view, applying any `transforms` to the `start` and `end` positions. + * + * @private + * @param {number} start The start of the view. + * @param {number} end The end of the view. + * @param {Array} transforms The transformations to apply to the view. + * @returns {Object} Returns an object containing the `start` and `end` + * positions of the view. + */ + function getView(start, end, transforms) { + var index = -1, + length = transforms.length; + + while (++index < length) { + var data = transforms[index], + size = data.size; + + switch (data.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + return { 'start': start, 'end': end }; + } + + /** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ + function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; + } + + /** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); + } + + /** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ + function initCloneArray(array) { + var length = array.length, + result = new array.constructor(length); + + // Add properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + result.index = array.index; + result.input = array.input; + } + return result; + } + + /** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneObject(object) { + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; + } + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ + function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return cloneArrayBuffer(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case dataViewTag: + return cloneDataView(object, isDeep); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + return cloneTypedArray(object, isDeep); + + case mapTag: + return new Ctor; + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + return cloneRegExp(object); + + case setTag: + return new Ctor; + + case symbolTag: + return cloneSymbol(object); + } + } + + /** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ + function insertWrapDetails(source, details) { + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); + } + + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + /** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); + } + + /** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); + } + + /** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. + */ + function isLaziable(func) { + var funcName = getFuncName(func), + other = lodash[funcName]; + + if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { + return false; + } + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; + } + + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + /** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ + var isMaskable = coreJsData ? isFunction : stubFalse; + + /** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ + function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; + } + + /** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + function isStrictComparable(value) { + return value === value && !isObject(value); + } + + /** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; + } + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + /** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers used to invoke a function. + * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` + * may be applied regardless of execution order. Methods like `_.ary` and + * `_.rearg` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined case where curried functions have `_.ary` + * and or `_.rearg` applied. + * + * @private + * @param {Array} data The destination metadata. + * @param {Array} source The source metadata. + * @returns {Array} Returns `data`. + */ + function mergeData(data, source) { + var bitmask = data[1], + srcBitmask = source[1], + newBitmask = bitmask | srcBitmask, + isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + + var isCombo = + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & WRAP_BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : value; + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = value; + } + // Use source `ary` if it's smaller. + if (srcBitmask & WRAP_ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + // Use source `arity` if one is not provided. + if (data[9] == null) { + data[9] = source[9]; + } + // Use source `func` and merge bitmasks. + data[0] = source[0]; + data[1] = newBitmask; + + return data; + } + + /** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; + } + + /** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + function objectToString(value) { + return nativeObjectToString.call(value); + } + + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; + } + + /** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ + function parent(object, path) { + return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); + } + + /** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ + function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; + } + + /** + * Gets the value at `key`, unless `key` is "__proto__" or "constructor". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function safeGet(object, key) { + if (key === 'constructor' && typeof object[key] === 'function') { + return; + } + + if (key == '__proto__') { + return; + } + + return object[key]; + } + + /** + * Sets metadata for `func`. + * + * **Note:** If this function becomes hot, i.e. is invoked a lot in a short + * period of time, it will trip its breaker and transition to an identity + * function to avoid garbage collection pauses in V8. See + * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) + * for more details. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var setData = shortOut(baseSetData); + + /** + * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @returns {number|Object} Returns the timer id or timeout object. + */ + var setTimeout = ctxSetTimeout || function(func, wait) { + return root.setTimeout(func, wait); + }; + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = shortOut(baseSetToString); + + /** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ + function setWrapToString(wrapper, reference, bitmask) { + var source = (reference + ''); + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); + } + + /** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ + function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; + } + + /** + * A specialized version of `_.shuffle` which mutates and sets the size of `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @param {number} [size=array.length] The size of `array`. + * @returns {Array} Returns `array`. + */ + function shuffleSelf(array, size) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + size = size === undefined ? length : size; + while (++index < size) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + array.length = size; + return array; + } + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + }); + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; + } + + /** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ + function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); + } + + /** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ + function wrapperClone(wrapper) { + if (wrapper instanceof LazyWrapper) { + return wrapper.clone(); + } + var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); + result.__actions__ = copyArray(wrapper.__actions__); + result.__index__ = wrapper.__index__; + result.__values__ = wrapper.__values__; + return result; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements split into groups the length of `size`. + * If `array` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the new array of chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ + function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size < 1) { + return []; + } + var index = 0, + resIndex = 0, + result = Array(nativeCeil(length / size)); + + while (index < length) { + result[resIndex++] = baseSlice(array, index, (index += size)); + } + return result; + } + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + function compact(array) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + } + + /** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ + var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `iteratee` which + * is invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * **Note:** Unlike `_.pullAllBy`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] + * + * // The `_.property` iteratee shorthand. + * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var differenceBy = baseRest(function(array, values) { + var iteratee = last(values); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `comparator` + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.pullAllWith`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + var differenceWith = baseRest(function(array, values) { + var comparator = last(values); + if (isArrayLikeObject(comparator)) { + comparator = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) + : []; + }); + + /** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function drop(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function dropRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.dropRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney'] + * + * // The `_.matches` iteratee shorthand. + * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropRightWhile(users, ['active', false]); + * // => objects for ['barney'] + * + * // The `_.property` iteratee shorthand. + * _.dropRightWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true, true) + : []; + } + + /** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.dropWhile(users, function(o) { return !o.active; }); + * // => objects for ['pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.dropWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropWhile(users, ['active', false]); + * // => objects for ['pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.dropWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true) + : []; + } + + /** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + */ + function fill(array, value, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); + } + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * // => 2 + * + * // The `_.matches` iteratee shorthand. + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastIndex(users, ['active', false]); + * // => 2 + * + * // The `_.property` iteratee shorthand. + * _.findLastIndex(users, 'active'); + * // => 0 + */ + function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); + } + + /** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ + function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; + } + + /** + * Recursively flattens `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ + function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; + } + + /** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ + function flattenDepth(array, depth) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(array, depth); + } + + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['a', 1], ['b', 2]]); + * // => { 'a': 1, 'b': 2 } + */ + function fromPairs(pairs) { + var index = -1, + length = pairs == null ? 0 : pairs.length, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + return result; + } + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias first + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.head([1, 2, 3]); + * // => 1 + * + * _.head([]); + * // => undefined + */ + function head(array) { + return (array && array.length) ? array[0] : undefined; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseIndexOf(array, value, index); + } + + /** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ + function initial(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 0, -1) : []; + } + + /** + * Creates an array of unique values that are included in all given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersection([2, 1], [2, 3]); + * // => [2] + */ + var intersection = baseRest(function(arrays) { + var mapped = arrayMap(arrays, castArrayLikeObject); + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + * + * // The `_.property` iteratee shorthand. + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + var intersectionBy = baseRest(function(arrays) { + var iteratee = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + if (iteratee === last(mapped)) { + iteratee = undefined; + } else { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + var intersectionWith = baseRest(function(arrays) { + var comparator = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + comparator = typeof comparator == 'function' ? comparator : undefined; + if (comparator) { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, undefined, comparator) + : []; + }); + + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ + function join(array, separator) { + return array == null ? '' : nativeJoin.call(array, separator); + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined; + } + + /** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // Search from the `fromIndex`. + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + */ + function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); + } + + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth + * element from the end is returned. + * + * @static + * @memberOf _ + * @since 4.11.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=0] The index of the element to return. + * @returns {*} Returns the nth element of `array`. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * + * _.nth(array, 1); + * // => 'b' + * + * _.nth(array, -2); + * // => 'c'; + */ + function nth(array, n) { + return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; + } + + /** + * Removes all given values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pull(array, 'a', 'c'); + * console.log(array); + * // => ['b', 'b'] + */ + var pull = baseRest(pullAll); + + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pullAll(array, ['a', 'c']); + * console.log(array); + * // => ['b', 'b'] + */ + function pullAll(array, values) { + return (array && array.length && values && values.length) + ? basePullAll(array, values) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + function pullAllBy(array, values, iteratee) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, getIteratee(iteratee, 2)) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `comparator` which + * is invoked to compare elements of `array` to `values`. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + function pullAllWith(array, values, comparator) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, undefined, comparator) + : array; + } + + /** + * Removes elements from `array` corresponding to `indexes` and returns an + * array of removed elements. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); + * + * console.log(array); + * // => ['a', 'c'] + * + * console.log(pulled); + * // => ['b', 'd'] + */ + var pullAt = flatRest(function(array, indexes) { + var length = array == null ? 0 : array.length, + result = baseAt(array, indexes); + + basePullAt(array, arrayMap(indexes, function(index) { + return isIndex(index, length) ? +index : index; + }).sort(compareAscending)); + + return result; + }); + + /** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). + * + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ + function remove(array, predicate) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = getIteratee(predicate, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; + } + + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function reverse(array) { + return array == null ? array : nativeReverse.call(array); + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function slice(array, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + else { + start = start == null ? 0 : toInteger(start); + end = end === undefined ? length : toInteger(end); + } + return baseSlice(array, start, end); + } + + /** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + */ + function sortedIndex(array, value) { + return baseSortedIndex(array, value); + } + + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); + * // => 0 + */ + function sortedIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); + } + + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([4, 5, 5, 5, 6], 5); + * // => 1 + */ + function sortedIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value); + if (index < length && eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 5, 5, 5, 6], 5); + * // => 4 + */ + function sortedLastIndex(array, value) { + return baseSortedIndex(array, value, true); + } + + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 1 + * + * // The `_.property` iteratee shorthand. + * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); + * // => 1 + */ + function sortedLastIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); + } + + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); + * // => 3 + */ + function sortedLastIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value, true) - 1; + if (eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + function sortedUniq(array) { + return (array && array.length) + ? baseSortedUniq(array) + : []; + } + + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.3] + */ + function sortedUniqBy(array, iteratee) { + return (array && array.length) + ? baseSortedUniq(array, getIteratee(iteratee, 2)) + : []; + } + + /** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.tail([1, 2, 3]); + * // => [2, 3] + */ + function tail(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 1, length) : []; + } + + /** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ + function take(array, n, guard) { + if (!(array && array.length)) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ + function takeRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.takeRightWhile(users, 'active'); + * // => [] + */ + function takeRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), false, true) + : []; + } + + /** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matches` iteratee shorthand. + * _.takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * // The `_.property` iteratee shorthand. + * _.takeWhile(users, 'active'); + * // => [] + */ + function takeWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3)) + : []; + } + + /** + * Creates an array of unique values, in order, from all given arrays using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([2], [1, 2]); + * // => [2, 1] + */ + var union = baseRest(function(arrays) { + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); + }); + + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which uniqueness is computed. Result values are chosen from the first + * array in which the value occurs. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + var unionBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. Result values are chosen from + * the first array in which the value occurs. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var unionWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); + }); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + function uniq(array) { + return (array && array.length) ? baseUniq(array) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + function uniqBy(array, iteratee) { + return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array.The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + function uniqWith(array, comparator) { + comparator = typeof comparator == 'function' ? comparator : undefined; + return (array && array.length) ? baseUniq(array, undefined, comparator) : []; + } + + /** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @since 1.2.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + * + * _.unzip(zipped); + * // => [['a', 'b'], [1, 2], [true, false]] + */ + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLikeObject(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + return baseTimes(length, function(index) { + return arrayMap(array, baseProperty(index)); + }); + } + + /** + * This method is like `_.unzip` except that it accepts `iteratee` to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee=_.identity] The function to combine + * regrouped values. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee) { + if (!(array && array.length)) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + return arrayMap(result, function(group) { + return apply(iteratee, undefined, group); + }); + } + + /** + * Creates an array excluding all given values using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.pull`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.xor + * @example + * + * _.without([2, 1, 2, 3], 1, 2); + * // => [3] + */ + var without = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, values) + : []; + }); + + /** + * Creates an array of unique values that is the + * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the given arrays. The order of result values is determined by the order + * they occur in the arrays. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.without + * @example + * + * _.xor([2, 1], [2, 3]); + * // => [1, 3] + */ + var xor = baseRest(function(arrays) { + return baseXor(arrayFilter(arrays, isArrayLikeObject)); + }); + + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which by which they're compared. The order of result values is determined + * by the order they occur in the arrays. The iteratee is invoked with one + * argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2, 3.4] + * + * // The `_.property` iteratee shorthand. + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var xorBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The order of result values is + * determined by the order they occur in the arrays. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var xorWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); + }); + + /** + * Creates an array of grouped elements, the first of which contains the + * first elements of the given arrays, the second of which contains the + * second elements of the given arrays, and so on. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + */ + var zip = baseRest(unzip); + + /** + * This method is like `_.fromPairs` except that it accepts two arrays, + * one of property identifiers and one of corresponding values. + * + * @static + * @memberOf _ + * @since 0.4.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject(['a', 'b'], [1, 2]); + * // => { 'a': 1, 'b': 2 } + */ + function zipObject(props, values) { + return baseZipObject(props || [], values || [], assignValue); + } + + /** + * This method is like `_.zipObject` except that it supports property paths. + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); + * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ + function zipObjectDeep(props, values) { + return baseZipObject(props || [], values || [], baseSet); + } + + /** + * This method is like `_.zip` except that it accepts `iteratee` to specify + * how grouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee=_.identity] The function to combine + * grouped values. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { + * return a + b + c; + * }); + * // => [111, 222] + */ + var zipWith = baseRest(function(arrays) { + var length = arrays.length, + iteratee = length > 1 ? arrays[length - 1] : undefined; + + iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; + return unzipWith(arrays, iteratee); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Seq + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _ + * .chain(users) + * .sortBy('age') + * .map(function(o) { + * return o.user + ' is ' + o.age; + * }) + * .head() + * .value(); + * // => 'pebbles is 1' + */ + function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; + } + + /** + * This method invokes `interceptor` and returns `value`. The interceptor + * is invoked with one argument; (value). The purpose of this method is to + * "tap into" a method chain sequence in order to modify intermediate results. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * // Mutate input array. + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor) { + interceptor(value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * The purpose of this method is to "pass thru" values replacing intermediate + * results in a method chain sequence. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor) { + return interceptor(value); + } + + /** + * This method is the wrapper version of `_.at`. + * + * @name at + * @memberOf _ + * @since 1.0.0 + * @category Seq + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _(object).at(['a[0].b.c', 'a[1]']).value(); + * // => [3, 4] + */ + var wrapperAt = flatRest(function(paths) { + var length = paths.length, + start = length ? paths[0] : 0, + value = this.__wrapped__, + interceptor = function(object) { return baseAt(object, paths); }; + + if (length > 1 || this.__actions__.length || + !(value instanceof LazyWrapper) || !isIndex(start)) { + return this.thru(interceptor); + } + value = value.slice(start, +start + (length ? 1 : 0)); + value.__actions__.push({ + 'func': thru, + 'args': [interceptor], + 'thisArg': undefined + }); + return new LodashWrapper(value, this.__chain__).thru(function(array) { + if (length && !array.length) { + array.push(undefined); + } + return array; + }); + }); + + /** + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. + * + * @name chain + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // A sequence without explicit chaining. + * _(users).head(); + * // => { 'user': 'barney', 'age': 36 } + * + * // A sequence with explicit chaining. + * _(users) + * .chain() + * .head() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chain sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapped = wrapped.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapped.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + + /** + * Gets the next value on a wrapped object following the + * [iterator protocol](https://mdn.io/iteration_protocols#iterator). + * + * @name next + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the next iterator value. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped.next(); + * // => { 'done': false, 'value': 1 } + * + * wrapped.next(); + * // => { 'done': false, 'value': 2 } + * + * wrapped.next(); + * // => { 'done': true, 'value': undefined } + */ + function wrapperNext() { + if (this.__values__ === undefined) { + this.__values__ = toArray(this.value()); + } + var done = this.__index__ >= this.__values__.length, + value = done ? undefined : this.__values__[this.__index__++]; + + return { 'done': done, 'value': value }; + } + + /** + * Enables the wrapper to be iterable. + * + * @name Symbol.iterator + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the wrapper object. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped[Symbol.iterator]() === wrapped; + * // => true + * + * Array.from(wrapped); + * // => [1, 2] + */ + function wrapperToIterator() { + return this; + } + + /** + * Creates a clone of the chain sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @param {*} value The value to plant. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2]).map(square); + * var other = wrapped.plant([3, 4]); + * + * other.value(); + * // => [9, 16] + * + * wrapped.value(); + * // => [1, 4] + */ + function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + clone.__index__ = 0; + clone.__values__ = undefined; + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; + } + + /** + * This method is the wrapper version of `_.reverse`. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + var wrapped = value; + if (this.__actions__.length) { + wrapped = new LazyWrapper(this); + } + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ + 'func': thru, + 'args': [reverse], + 'thisArg': undefined + }); + return new LodashWrapper(wrapped, this.__chain__); + } + return this.thru(reverse); + } + + /** + * Executes the chain sequence to resolve the unwrapped value. + * + * @name value + * @memberOf _ + * @since 0.1.0 + * @alias toJSON, valueOf + * @category Seq + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the number of times the key was returned by `iteratee`. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': 1, '6': 2 } + * + * // The `_.property` iteratee shorthand. + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ + var countBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } + }); + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] + */ + function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ + var find = createFind(findIndex); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=collection.length-1] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(findLastIndex); + + /** + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee), 1); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); + } + + /** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forEach(collection, iteratee) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @alias eachRight + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEach + * @example + * + * _.forEachRight([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `2` then `1`. + */ + function forEachRight(collection, iteratee) { + var func = isArray(collection) ? arrayEachRight : baseEachRight; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * // The `_.property` iteratee shorthand. + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ + var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + baseAssignValue(result, key, [value]); + } + }); + + /** + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * is used for equality comparisons. If `fromIndex` is negative, it's used as + * the offset from the end of `collection`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'a': 1, 'b': 2 }, 1); + * // => true + * + * _.includes('abcd', 'bc'); + * // => true + */ + function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; + + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) + ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) + : (!!length && baseIndexOf(collection, value, fromIndex) > -1); + } + + /** + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `path` is a function, it's invoked + * for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke each method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invokeMap([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invokeMap = baseRest(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); + }); + return result; + }); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var array = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.keyBy(array, function(o) { + * return String.fromCharCode(o.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.keyBy(array, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + */ + var keyBy = createAggregator(function(result, value, key) { + baseAssignValue(result, key, value); + }); + + /** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] + * The iteratees to sort by. + * @param {string[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // Sort by `user` in ascending order and by `age` in descending order. + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + */ + function orderBy(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + orders = guard ? undefined : orders; + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseOrderBy(collection, iteratees, orders); + } + + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, the second of which + * contains elements `predicate` returns falsey for. The predicate is + * invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * _.partition(users, function(o) { return o.active; }); + * // => objects for [['fred'], ['barney', 'pebbles']] + * + * // The `_.matches` iteratee shorthand. + * _.partition(users, { 'age': 1, 'active': false }); + * // => objects for [['pebbles'], ['barney', 'fred']] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.partition(users, ['active', false]); + * // => objects for [['barney', 'pebbles'], ['fred']] + * + * // The `_.property` iteratee shorthand. + * _.partition(users, 'active'); + * // => objects for [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */ + function reduce(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduce : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); + } + + /** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduce + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ + function reduceRight(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduceRight : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); + } + + /** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.filter + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * _.reject(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.reject(users, { 'age': 40, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.reject(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.reject(users, 'active'); + * // => objects for ['barney'] + */ + function reject(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, negate(getIteratee(predicate, 3))); + } + + /** + * Gets a random element from `collection`. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + */ + function sample(collection) { + var func = isArray(collection) ? arraySample : baseSample; + return func(collection); + } + + /** + * Gets `n` random elements at unique keys from `collection` up to the + * size of `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3], 2); + * // => [3, 1] + * + * _.sampleSize([1, 2, 3], 4); + * // => [2, 3, 1] + */ + function sampleSize(collection, n, guard) { + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + var func = isArray(collection) ? arraySampleSize : baseSampleSize; + return func(collection, n); + } + + /** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ + function shuffle(collection) { + var func = isArray(collection) ? arrayShuffle : baseShuffle; + return func(collection); + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable string keyed properties for objects. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the collection size. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + if (collection == null) { + return 0; + } + if (isArrayLike(collection)) { + return isString(collection) ? stringSize(collection) : collection.length; + } + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + return baseKeys(collection).length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * Iteration is stopped once `predicate` returns truthy. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.some(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, guard) { + var func = isArray(collection) ? arraySome : baseSome; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 30 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] + */ + var sortBy = baseRest(function(collection, iteratees) { + if (collection == null) { + return []; + } + var length = iteratees.length; + if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ + var now = ctxNow || function() { + return root.Date.now(); + }; + + /*------------------------------------------------------------------------*/ + + /** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ + function after(n, func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + + /** + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ + function ary(func, n, guard) { + n = guard ? undefined : n; + n = (func && n == null) ? func.length : n; + return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); + } + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and `partials` prepended to the arguments it receives. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // Bound with placeholders. + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = baseRest(function(func, thisArg, partials) { + var bitmask = WRAP_BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bind)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(func, bitmask, thisArg, partials, holders); + }); + + /** + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. See + * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Function + * @param {Object} object The object to invoke the method on. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ + var bindKey = baseRest(function(object, key, partials) { + var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bindKey)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(key, bitmask, object, partials, holders); + }); + + /** + * Creates a function that accepts arguments of `func` and either invokes + * `func` returning its result, if at least `arity` number of arguments have + * been provided, or returns a function that accepts the remaining `func` + * arguments, and so on. The arity of `func` may be specified if `func.length` + * is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ + function curry(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curry.placeholder; + return result; + } + + /** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ + function curryRight(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curryRight.placeholder; + return result; + } + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ + function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // => Logs 'deferred' after one millisecond. + */ + var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => Logs 'later' after one second. + */ + var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); + }); + + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new flipped function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + function flip(func) { + return createWrap(func, WRAP_FLIP_FLAG); + } + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = MapCache; + + /** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new negated function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ + function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + var args = arguments; + switch (args.length) { + case 0: return !predicate.call(this); + case 1: return !predicate.call(this, args[0]); + case 2: return !predicate.call(this, args[0], args[1]); + case 3: return !predicate.call(this, args[0], args[1], args[2]); + } + return !predicate.apply(this, args); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first invocation. The `func` is + * invoked with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // => `createApplication` is invoked once + */ + function once(func) { + return before(2, func); + } + + /** + * Creates a function that invokes `func` with its arguments transformed. + * + * @static + * @since 4.0.0 + * @memberOf _ + * @category Function + * @param {Function} func The function to wrap. + * @param {...(Function|Function[])} [transforms=[_.identity]] + * The argument transforms. + * @returns {Function} Returns the new function. + * @example + * + * function doubled(n) { + * return n * 2; + * } + * + * function square(n) { + * return n * n; + * } + * + * var func = _.overArgs(function(x, y) { + * return [x, y]; + * }, [square, doubled]); + * + * func(9, 3); + * // => [81, 6] + * + * func(10, 5); + * // => [100, 10] + */ + var overArgs = castRest(function(func, transforms) { + transforms = (transforms.length == 1 && isArray(transforms[0])) + ? arrayMap(transforms[0], baseUnary(getIteratee())) + : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); + + var funcsLength = transforms.length; + return baseRest(function(args) { + var index = -1, + length = nativeMin(args.length, funcsLength); + + while (++index < length) { + args[index] = transforms[index].call(this, args[index]); + } + return apply(func, this, args); + }); + }); + + /** + * Creates a function that invokes `func` with `partials` prepended to the + * arguments it receives. This method is like `_.bind` except it does **not** + * alter the `this` binding. + * + * The `_.partial.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 0.2.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // Partially applied with placeholders. + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ + var partial = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partial)); + return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); + }); + + /** + * This method is like `_.partial` except that partially applied arguments + * are appended to the arguments it receives. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // Partially applied with placeholders. + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ + var partialRight = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partialRight)); + return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); + }); + + /** + * Creates a function that invokes `func` with arguments arranged according + * to the specified `indexes` where the argument value at the first index is + * provided as the first argument, the argument value at the second index is + * provided as the second argument, and so on. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument indexes. + * @returns {Function} Returns the new function. + * @example + * + * var rearged = _.rearg(function(a, b, c) { + * return [a, b, c]; + * }, [2, 0, 1]); + * + * rearged('b', 'c', 'a') + * // => ['a', 'b', 'c'] + */ + var rearg = flatRest(function(func, indexes) { + return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); + }); + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as + * an array. + * + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.rest(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function rest(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start === undefined ? start : toInteger(start); + return baseRest(func, start); + } + + /** + * Creates a function that invokes `func` with the `this` binding of the + * create function and an array of arguments much like + * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). + * + * **Note:** This method is based on the + * [spread operator](https://mdn.io/spread_operator). + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Function + * @param {Function} func The function to spread arguments over. + * @param {number} [start=0] The start position of the spread. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ + function spread(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start == null ? 0 : nativeMax(toInteger(start), 0); + return baseRest(function(args) { + var array = args[start], + otherArgs = castSlice(args, 0, start); + + if (array) { + arrayPush(otherArgs, array); + } + return apply(func, this, otherArgs); + }); + } + + /** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed `func` invocations and a `flush` method to + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` + * timeout. The `func` is invoked with the last arguments provided to the + * throttled function. Subsequent calls to the throttled function return the + * result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // Avoid excessively updating the position while scrolling. + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. + * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); + * jQuery(element).on('click', throttled); + * + * // Cancel the trailing throttled invocation. + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); + } + + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + function unary(func) { + return ary(func, 1); + } + + /** + * Creates a function that provides `value` to `wrapper` as its first + * argument. Any additional arguments provided to the function are appended + * to those provided to the `wrapper`. The wrapper is invoked with the `this` + * binding of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {*} value The value to wrap. + * @param {Function} [wrapper=identity] The wrapper function. + * @returns {Function} Returns the new function. + * @example + * + * var p = _.wrap(_.escape, function(func, text) { + * return '

' + func(text) + '

'; + * }); + * + * p('fred, barney, & pebbles'); + * // => '

fred, barney, & pebbles

' + */ + function wrap(value, wrapper) { + return partial(castFunction(wrapper), value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.clone` except that it accepts `customizer` which + * is invoked to produce the cloned value. If `customizer` returns `undefined`, + * cloning is handled by the method instead. The `customizer` is invoked with + * up to four arguments; (value [, index|key, object, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the cloned value. + * @see _.cloneDeepWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * } + * + * var el = _.cloneWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 0 + */ + function cloneWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @see _.clone + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + function cloneDeep(value) { + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.cloneWith` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the deep cloned value. + * @see _.cloneWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * } + * + * var el = _.cloneDeepWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 20 + */ + function cloneDeepWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * Checks if `object` conforms to `source` by invoking the predicate + * properties of `source` with the corresponding property values of `object`. + * + * **Note:** This method is equivalent to `_.conforms` when `source` is + * partially applied. + * + * @static + * @memberOf _ + * @since 4.14.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); + * // => true + * + * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); + * // => false + */ + function conformsTo(object, source) { + return source == null || baseConformsTo(object, source, keys(source)); + } + + /** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + function eq(value, other) { + return value === other || (value !== value && other !== other); + } + + /** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + * @see _.lt + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ + var gt = createRelationalOperation(baseGt); + + /** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. + * @see _.lte + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ + var gte = createRelationalOperation(function(value, other) { + return value >= other; + }); + + /** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); + }; + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + var isArray = Array.isArray; + + /** + * Checks if `value` is classified as an `ArrayBuffer` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + * @example + * + * _.isArrayBuffer(new ArrayBuffer(2)); + * // => true + * + * _.isArrayBuffer(new Array(2)); + * // => false + */ + var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; + + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); + } + + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); + } + + /** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ + var isBuffer = nativeIsBuffer || stubFalse; + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + + /** + * Checks if `value` is likely a DOM element. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + * + * _.isElement(''); + * // => false + */ + function isElement(value) { + return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); + } + + /** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ + function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && + (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || + isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; + } + + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are compared by strict equality, i.e. `===`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + function isEqual(value, other) { + return baseIsEqual(value, other); + } + + /** + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + function isEqualWith(value, other, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + var result = customizer ? customizer(value, other) : undefined; + return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; + } + + /** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ + function isError(value) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(3); + * // => true + * + * _.isFinite(Number.MIN_VALUE); + * // => true + * + * _.isFinite(Infinity); + * // => false + * + * _.isFinite('3'); + * // => false + */ + function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); + } + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + function isInteger(value) { + return typeof value == 'number' && value == toInteger(value); + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); + } + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && typeof value == 'object'; + } + + /** + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false + */ + var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; + + /** + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. + * + * **Note:** This method is equivalent to `_.matches` when `source` is + * partially applied. + * + * Partial comparisons will match empty array and empty object `source` + * values against any array or object value, respectively. See `_.isEqual` + * for a list of supported value comparisons. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.isMatch(object, { 'b': 2 }); + * // => true + * + * _.isMatch(object, { 'b': 1 }); + * // => false + */ + function isMatch(object, source) { + return object === source || baseIsMatch(object, source, getMatchData(source)); + } + + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with five + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + function isMatchWith(object, source, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseIsMatch(object, source, getMatchData(source), customizer); + } + + /** + * Checks if `value` is `NaN`. + * + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ + function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is a pristine native function. + * + * **Note:** This method can't reliably detect native functions in the presence + * of the core-js package because core-js circumvents this kind of detection. + * Despite multiple requests, the core-js maintainer has made it clear: any + * attempt to fix the detection will be obstructed. As a result, we're left + * with little choice but to throw an error. Unfortunately, this also affects + * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), + * which rely on core-js. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (isMaskable(value)) { + throw new Error(CORE_ERROR_TEXT); + } + return baseIsNative(value); + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ + function isNull(value) { + return value === null; + } + + /** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + function isNil(value) { + return value == null; + } + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a number, else `false`. + * @example + * + * _.isNumber(3); + * // => true + * + * _.isNumber(Number.MIN_VALUE); + * // => true + * + * _.isNumber(Infinity); + * // => true + * + * _.isNumber('3'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || + (isObjectLike(value) && baseGetTag(value) == numberTag); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; + } + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + function isSafeInteger(value) { + return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is classified as a `Set` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @example + * + * _.isSet(new Set); + * // => true + * + * _.isSet(new WeakSet); + * // => false + */ + var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + } + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); + } + + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + + /** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ + function isUndefined(value) { + return value === undefined; + } + + /** + * Checks if `value` is classified as a `WeakMap` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. + * @example + * + * _.isWeakMap(new WeakMap); + * // => true + * + * _.isWeakMap(new Map); + * // => false + */ + function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; + } + + /** + * Checks if `value` is classified as a `WeakSet` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. + * @example + * + * _.isWeakSet(new WeakSet); + * // => true + * + * _.isWeakSet(new Set); + * // => false + */ + function isWeakSet(value) { + return isObjectLike(value) && baseGetTag(value) == weakSetTag; + } + + /** + * Checks if `value` is less than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + * @see _.gt + * @example + * + * _.lt(1, 3); + * // => true + * + * _.lt(3, 3); + * // => false + * + * _.lt(3, 1); + * // => false + */ + var lt = createRelationalOperation(baseLt); + + /** + * Checks if `value` is less than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than or equal to + * `other`, else `false`. + * @see _.gte + * @example + * + * _.lte(1, 3); + * // => true + * + * _.lte(3, 3); + * // => true + * + * _.lte(3, 1); + * // => false + */ + var lte = createRelationalOperation(function(value, other) { + return value <= other; + }); + + /** + * Converts `value` to an array. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * _.toArray({ 'a': 1, 'b': 2 }); + * // => [1, 2] + * + * _.toArray('abc'); + * // => ['a', 'b', 'c'] + * + * _.toArray(1); + * // => [] + * + * _.toArray(null); + * // => [] + */ + function toArray(value) { + if (!value) { + return []; + } + if (isArrayLike(value)) { + return isString(value) ? stringToArray(value) : copyArray(value); + } + if (symIterator && value[symIterator]) { + return iteratorToArray(value[symIterator]()); + } + var tag = getTag(value), + func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); + + return func(value); + } + + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; + } + + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toLength(3.2); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3.2'); + * // => 3 + */ + function toLength(value) { + return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; + } + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return copyObject(value, keysIn(value)); + } + + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toSafeInteger(3.2); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3.2'); + * // => 3 + */ + function toSafeInteger(value) { + return value + ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) + : (value === 0 ? value : 0); + } + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + return value == null ? '' : baseToString(value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ + var assign = createAssigner(function(object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ + var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); + }); + + /** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + + /** + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignInWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keys(source), object, customizer); + }); + + /** + * Creates an array of values corresponding to `paths` of `object`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Array} Returns the picked values. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _.at(object, ['a[0].b.c', 'a[1]']); + * // => [3, 4] + */ + var at = flatRest(baseAt); + + /** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ + function create(prototype, properties) { + var result = baseCreate(prototype); + return properties == null ? result : baseAssign(result, properties); + } + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; + }); + + /** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaults + * @example + * + * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); + * // => { 'a': { 'b': 2, 'c': 3 } } + */ + var defaultsDeep = baseRest(function(args) { + args.push(undefined, customDefaultsMerge); + return apply(mergeWith, undefined, args); + }); + + /** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findKey(users, function(o) { return o.age < 40; }); + * // => 'barney' (iteration order is not guaranteed) + * + * // The `_.matches` iteratee shorthand. + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findKey(users, 'active'); + * // => 'barney' + */ + function findKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + } + + /** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findLastKey(users, function(o) { return o.age < 40; }); + * // => returns 'pebbles' assuming `_.findKey` returns 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ + function findLastKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + } + + /** + * Iterates over own and inherited enumerable string keyed properties of an + * object and invokes `iteratee` for each property. The iteratee is invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forInRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). + */ + function forIn(object, iteratee) { + return object == null + ? object + : baseFor(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forIn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forInRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. + */ + function forInRight(object, iteratee) { + return object == null + ? object + : baseForRight(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `iteratee` for each property. The iteratee is invoked with three + * arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwnRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forOwn(object, iteratee) { + return object && baseForOwn(object, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. + */ + function forOwnRight(object, iteratee) { + return object && baseForOwnRight(object, getIteratee(iteratee, 3)); + } + + /** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functionsIn + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] + */ + function functions(object) { + return object == null ? [] : baseFunctions(object, keys(object)); + } + + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functions + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + function functionsIn(object) { + return object == null ? [] : baseFunctions(object, keysIn(object)); + } + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return object != null && hasPath(object, path, baseHas); + } + + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); + } + + /** + * Creates an object composed of the inverted keys and values of `object`. + * If `object` contains duplicate values, subsequent values overwrite + * property assignments of previous values. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Object + * @param {Object} object The object to invert. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + */ + var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + result[value] = key; + }, constant(identity)); + + /** + * This method is like `_.invert` except that the inverted object is generated + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys + * responsible for generating the inverted value. The iteratee is invoked + * with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Object + * @param {Object} object The object to invert. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invertBy(object); + * // => { '1': ['a', 'c'], '2': ['b'] } + * + * _.invertBy(object, function(value) { + * return 'group' + value; + * }); + * // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ + var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + }, getIteratee); + + /** + * Invokes the method at `path` of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + * @example + * + * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; + * + * _.invoke(object, 'a[0].b.c.slice', 1, 3); + * // => [2, 3] + */ + var invoke = baseRest(baseInvoke); + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + } + + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * string keyed property of `object` thru `iteratee`. The iteratee is invoked + * with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapValues + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + function mapKeys(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, iteratee(value, key, object), value); + }); + return result; + } + + /** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapKeys + * @example + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * _.mapValues(users, function(o) { return o.age; }); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * + * // The `_.property` iteratee shorthand. + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ + function mapValues(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, key, iteratee(value, key, object)); + }); + return result; + } + + /** + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var object = { + * 'a': [{ 'b': 2 }, { 'd': 4 }] + * }; + * + * var other = { + * 'a': [{ 'c': 3 }, { 'e': 5 }] + * }; + * + * _.merge(object, other); + * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } + */ + var merge = createAssigner(function(object, source, srcIndex) { + baseMerge(object, source, srcIndex); + }); + + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined`, merging is handled by the + * method instead. The `customizer` is invoked with six arguments: + * (objValue, srcValue, key, object, source, stack). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { 'a': [1], 'b': [2] }; + * var other = { 'a': [3], 'b': [4] }; + * + * _.mergeWith(object, other, customizer); + * // => { 'a': [1, 3], 'b': [2, 4] } + */ + var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { + baseMerge(object, source, srcIndex, customizer); + }); + + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable property paths of `object` that are not omitted. + * + * **Note:** This method is considerably slower than `_.pick`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to omit. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + var omit = flatRest(function(object, paths) { + var result = {}; + if (object == null) { + return result; + } + var isDeep = false; + paths = arrayMap(paths, function(path) { + path = castPath(path, object); + isDeep || (isDeep = path.length > 1); + return path; + }); + copyObject(object, getAllKeysIn(object), result); + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } + var length = paths.length; + while (length--) { + baseUnset(result, paths[length]); + } + return result; + }); + + /** + * The opposite of `_.pickBy`; this method creates an object composed of + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + function omitBy(object, predicate) { + return pickBy(object, negate(getIteratee(predicate))); + } + + /** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); + }); + + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + function pickBy(object, predicate) { + if (object == null) { + return {}; + } + var props = arrayMap(getAllKeysIn(object), function(prop) { + return [prop]; + }); + predicate = getIteratee(predicate); + return basePickBy(object, props, function(value, path) { + return predicate(value, path[0]); + }); + } + + /** + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a[0].b.c3', 'default'); + * // => 'default' + * + * _.result(object, 'a[0].b.c3', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + path = castPath(path, object); + + var index = -1, + length = path.length; + + // Ensure the loop is entered when path is empty. + if (!length) { + length = 1; + object = undefined; + } + while (++index < length) { + var value = object == null ? undefined : object[toKey(path[index])]; + if (value === undefined) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; + } + return object; + } + + /** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + return object == null ? object : baseSet(object, path, value); + } + + /** + * This method is like `_.set` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.setWith(object, '[0][1]', 'a', Object); + * // => { '0': { '1': 'a' } } + */ + function setWith(object, path, value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseSet(object, path, value, customizer); + } + + /** + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. If `object` is a map or set, its + * entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entries + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairs(new Foo); + * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) + */ + var toPairs = createToPairs(keys); + + /** + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. If `object` is a map + * or set, its entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entriesIn + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairsIn(new Foo); + * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) + */ + var toPairsIn = createToPairs(keysIn); + + /** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ + function transform(object, iteratee, accumulator) { + var isArr = isArray(object), + isArrLike = isArr || isBuffer(object) || isTypedArray(object); + + iteratee = getIteratee(iteratee, 4); + if (accumulator == null) { + var Ctor = object && object.constructor; + if (isArrLike) { + accumulator = isArr ? new Ctor : []; + } + else if (isObject(object)) { + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } + else { + accumulator = {}; + } + } + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; + } + + /** + * Removes the property at `path` of `object`. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 7 } }] }; + * _.unset(object, 'a[0].b.c'); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + * + * _.unset(object, ['a', '0', 'b', 'c']); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + */ + function unset(object, path) { + return object == null ? true : baseUnset(object, path); + } + + /** + * This method is like `_.set` except that accepts `updater` to produce the + * value to set. Use `_.updateWith` to customize `path` creation. The `updater` + * is invoked with one argument: (value). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.update(object, 'a[0].b.c', function(n) { return n * n; }); + * console.log(object.a[0].b.c); + * // => 9 + * + * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); + * console.log(object.x[0].y.z); + * // => 0 + */ + function update(object, path, updater) { + return object == null ? object : baseUpdate(object, path, castFunction(updater)); + } + + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + function updateWith(object, path, updater, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); + } + + /** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return object == null ? [] : baseValues(object, keys(object)); + } + + /** + * Creates an array of the own and inherited enumerable string keyed property + * values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.valuesIn(new Foo); + * // => [1, 2, 3] (iteration order is not guaranteed) + */ + function valuesIn(object) { + return object == null ? [] : baseValues(object, keysIn(object)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + function clamp(number, lower, upper) { + if (upper === undefined) { + upper = lower; + lower = undefined; + } + if (upper !== undefined) { + upper = toNumber(upper); + upper = upper === upper ? upper : 0; + } + if (lower !== undefined) { + lower = toNumber(lower); + lower = lower === lower ? lower : 0; + } + return baseClamp(toNumber(number), lower, upper); + } + + /** + * Checks if `n` is between `start` and up to, but not including, `end`. If + * `end` is not specified, it's set to `start` with `start` then set to `0`. + * If `start` is greater than `end` the params are swapped to support + * negative ranges. + * + * @static + * @memberOf _ + * @since 3.3.0 + * @category Number + * @param {number} number The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + * @see _.range, _.rangeRight + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + * + * _.inRange(-3, -2, -6); + * // => true + */ + function inRange(number, start, end) { + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + number = toNumber(number); + return baseInRange(number, start, end); + } + + /** + * Produces a random number between the inclusive `lower` and `upper` bounds. + * If only one argument is provided a number between `0` and the given number + * is returned. If `floating` is `true`, or either `lower` or `upper` are + * floats, a floating-point number is returned instead of an integer. + * + * **Note:** JavaScript follows the IEEE-754 standard for resolving + * floating-point values which can produce unexpected results. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Number + * @param {number} [lower=0] The lower bound. + * @param {number} [upper=1] The upper bound. + * @param {boolean} [floating] Specify returning a floating-point number. + * @returns {number} Returns the random number. + * @example + * + * _.random(0, 5); + * // => an integer between 0 and 5 + * + * _.random(5); + * // => also an integer between 0 and 5 + * + * _.random(5, true); + * // => a floating-point number between 0 and 5 + * + * _.random(1.2, 5.2); + * // => a floating-point number between 1.2 and 5.2 + */ + function random(lower, upper, floating) { + if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { + upper = floating = undefined; + } + if (floating === undefined) { + if (typeof upper == 'boolean') { + floating = upper; + upper = undefined; + } + else if (typeof lower == 'boolean') { + floating = lower; + lower = undefined; + } + } + if (lower === undefined && upper === undefined) { + lower = 0; + upper = 1; + } + else { + lower = toFinite(lower); + if (upper === undefined) { + upper = lower; + lower = 0; + } else { + upper = toFinite(upper); + } + } + if (lower > upper) { + var temp = lower; + lower = upper; + upper = temp; + } + if (floating || lower % 1 || upper % 1) { + var rand = nativeRandom(); + return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); + } + return baseRandom(lower, upper); + } + + /*------------------------------------------------------------------------*/ + + /** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar--'); + * // => 'fooBar' + * + * _.camelCase('__FOO_BAR__'); + * // => 'fooBar' + */ + var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize(word) : word); + }); + + /** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ + function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); + } + + /** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ + function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); + } + + /** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search up to. + * @returns {boolean} Returns `true` if `string` ends with `target`, + * else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ + function endsWith(string, target, position) { + string = toString(string); + target = baseToString(target); + + var length = string.length; + position = position === undefined + ? length + : baseClamp(toInteger(position), 0, length); + + var end = position; + position -= target.length; + return position >= 0 && string.slice(position, end) == target; + } + + /** + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional + * characters use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't need escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ + function escape(string) { + string = toString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /** + * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https://lodash\.com/\)' + */ + function escapeRegExp(string) { + string = toString(string); + return (string && reHasRegExpChar.test(string)) + ? string.replace(reRegExpChar, '\\$&') + : string; + } + + /** + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the kebab cased string. + * @example + * + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' + * + * _.kebabCase('fooBar'); + * // => 'foo-bar' + * + * _.kebabCase('__FOO_BAR__'); + * // => 'foo-bar' + */ + var kebabCase = createCompounder(function(result, word, index) { + return result + (index ? '-' : '') + word.toLowerCase(); + }); + + /** + * Converts `string`, as space separated words, to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.lowerCase('--Foo-Bar--'); + * // => 'foo bar' + * + * _.lowerCase('fooBar'); + * // => 'foo bar' + * + * _.lowerCase('__FOO_BAR__'); + * // => 'foo bar' + */ + var lowerCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + word.toLowerCase(); + }); + + /** + * Converts the first character of `string` to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.lowerFirst('Fred'); + * // => 'fred' + * + * _.lowerFirst('FRED'); + * // => 'fRED' + */ + var lowerFirst = createCaseFirst('toLowerCase'); + + /** + * Pads `string` on the left and right sides if it's shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.pad('abc', 8); + * // => ' abc ' + * + * _.pad('abc', 8, '_-'); + * // => '_-abc_-_' + * + * _.pad('abc', 3); + * // => 'abc' + */ + function pad(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + if (!length || strLength >= length) { + return string; + } + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); + } + + /** + * Pads `string` on the right side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padEnd('abc', 6); + * // => 'abc ' + * + * _.padEnd('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padEnd('abc', 3); + * // => 'abc' + */ + function padEnd(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (string + createPadding(length - strLength, chars)) + : string; + } + + /** + * Pads `string` on the left side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padStart('abc', 6); + * // => ' abc' + * + * _.padStart('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padStart('abc', 3); + * // => 'abc' + */ + function padStart(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (createPadding(length - strLength, chars) + string) + : string; + } + + /** + * Converts `string` to an integer of the specified radix. If `radix` is + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a + * hexadecimal, in which case a `radix` of `16` is used. + * + * **Note:** This method aligns with the + * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category String + * @param {string} string The string to convert. + * @param {number} [radix=10] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {number} Returns the converted integer. + * @example + * + * _.parseInt('08'); + * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] + */ + function parseInt(string, radix, guard) { + if (guard || radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); + } + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n, guard) { + if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + return baseRepeat(toString(string), n); + } + + /** + * Replaces matches for `pattern` in `string` with `replacement`. + * + * **Note:** This method is based on + * [`String#replace`](https://mdn.io/String/replace). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to modify. + * @param {RegExp|string} pattern The pattern to replace. + * @param {Function|string} replacement The match replacement. + * @returns {string} Returns the modified string. + * @example + * + * _.replace('Hi Fred', 'Fred', 'Barney'); + * // => 'Hi Barney' + */ + function replace() { + var args = arguments, + string = toString(args[0]); + + return args.length < 3 ? string : string.replace(args[1], args[2]); + } + + /** + * Converts `string` to + * [snake case](https://en.wikipedia.org/wiki/Snake_case). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the snake cased string. + * @example + * + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' + * + * _.snakeCase('fooBar'); + * // => 'foo_bar' + * + * _.snakeCase('--FOO-BAR--'); + * // => 'foo_bar' + */ + var snakeCase = createCompounder(function(result, word, index) { + return result + (index ? '_' : '') + word.toLowerCase(); + }); + + /** + * Splits `string` by `separator`. + * + * **Note:** This method is based on + * [`String#split`](https://mdn.io/String/split). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to split. + * @param {RegExp|string} separator The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * @example + * + * _.split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ + function split(string, separator, limit) { + if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { + separator = limit = undefined; + } + limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; + if (!limit) { + return []; + } + string = toString(string); + if (string && ( + typeof separator == 'string' || + (separator != null && !isRegExp(separator)) + )) { + separator = baseToString(separator); + if (!separator && hasUnicode(string)) { + return castSlice(stringToArray(string), 0, limit); + } + } + return string.split(separator, limit); + } + + /** + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * + * @static + * @memberOf _ + * @since 3.1.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar--'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__FOO_BAR__'); + * // => 'FOO BAR' + */ + var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + upperFirst(word); + }); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ + function startsWith(string, target, position) { + string = toString(string); + position = position == null + ? 0 + : baseClamp(toInteger(position), 0, string.length); + + target = baseToString(target); + return string.slice(position, position + target.length) == target; + } + + /** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is given, it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='lodash.templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the compiled template function. + * @example + * + * // Use the "interpolate" delimiter to create a compiled template. + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // Use the HTML "escape" delimiter to escape data property values. + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': '